Project

General

Profile

« Previous | Next » 

Revision 2098

Added by darkviper over 10 years ago

! activate class Translate for all addons in admin/ (except pages/)
! class.admin >> add translation of the current theme to Translate

View differences:

install.php
20 20

  
21 21
// Setup admin object
22 22
require('../../config.php');
23
$oTrans = Translate::getInstance();
24
$oTrans->enableAddon('admin\\addons');
23 25
require_once(WB_PATH.'/framework/class.admin.php');
24 26
// suppress to print the header, so no new FTAN will be set
25 27
$admin = new admin('Addons', 'templates_install', false);
26 28
if( !$admin->checkFTAN() )
27 29
{
28 30
	$admin->print_header();
29
	$admin->print_error($MESSAGE['GENERIC_SECURITY_ACCESS']);
31
	$admin->print_error($oTrans->MESSAGE_GENERIC_SECURITY_ACCESS);
30 32
}
31 33
// After check print the header
32 34
$admin->print_header();
......
47 49

  
48 50
// Try to upload the file to the temp dir
49 51
if(!move_uploaded_file($_FILES['userfile']['tmp_name'], $temp_file)) {
50
	$admin->print_error($MESSAGE['GENERIC_CANNOT_UPLOAD']);
52
	$admin->print_error($oTrans->MESSAGE_GENERIC_CANNOT_UPLOAD);
51 53
}
52 54

  
53 55
// Include the PclZip class file (thanks to
......
63 65
$list = $archive->extract(PCLZIP_OPT_PATH, $temp_unzip);
64 66

  
65 67
// Check if uploaded file is a valid Add-On zip file
66
if (!($list && file_exists($temp_unzip . 'index.php'))) $admin->print_error($MESSAGE['GENERIC_INVALID_ADDON_FILE']);
68
if (!($list && file_exists($temp_unzip . 'index.php'))) $admin->print_error($oTrans->MESSAGE_GENERIC_INVALID_ADDON_FILE);
67 69

  
68 70
// Include the templates info file
69 71
require($temp_unzip.'info.php');
......
78 80
// Check if the file is valid
79 81
if(!isset($template_directory)) {
80 82
	if(file_exists($temp_file)) { unlink($temp_file); } // Remove temp file
81
	$admin->print_error($MESSAGE['GENERIC_INVALID']);
83
	$admin->print_error($oTrans->MESSAGE_GENERIC_INVALID);
82 84
}
83 85

  
84 86
// Check if this module is already installed
......
90 92
		// Version to be installed is older than currently installed version
91 93
		if (versionCompare($template_version, $new_template_version, '>=')) {
92 94
			if(file_exists($temp_file)) { unlink($temp_file); } // Remove temp file
93
			$admin->print_error($MESSAGE['GENERIC_ALREADY_INSTALLED']);
95
			$admin->print_error($oTrans->MESSAGE_GENERIC_ALREADY_INSTALLED);
94 96
		}
95 97
	}
96
	$success_message=$MESSAGE['GENERIC_UPGRADED'];
98
	$success_message=$oTrans->MESSAGE_GENERIC_UPGRADED;
97 99
} else {
98
	$success_message=$MESSAGE['GENERIC_INSTALLED'];
100
	$success_message=$oTrans->MESSAGE_GENERIC_INSTALLED;
99 101
}
100 102

  
101 103
// Check if template dir is writable
102 104
if(!is_writable(WB_PATH.'/templates/')) {
103 105
	if(file_exists($temp_file)) { unlink($temp_file); } // Remove temp file
104
	$admin->print_error($MESSAGE['TEMPLATES_BAD_PERMISSIONS']);
106
	$admin->print_error($oTrans->MESSAGE_TEMPLATES_BAD_PERMISSIONS);
105 107
}
106 108

  
107 109
// Set template dir
......
122 124
	$list = $archive->extract(PCLZIP_OPT_PATH, $template_dir );
123 125
}
124 126
if(!$list) {
125
	$admin->print_error($MESSAGE['GENERIC_CANNOT_UNZIP']);
127
	$admin->print_error($oTrans->MESSAGE_GENERIC_CANNOT_UNZIP);
126 128
}
127 129

  
128 130
// Delete the temp zip file

Also available in: Unified diff