Revision 2098
Added by darkviper over 11 years ago
| install.php | ||
|---|---|---|
| 26 | 26 |
require($config_file); |
| 27 | 27 |
} |
| 28 | 28 |
|
| 29 |
//require_once(WB_PATH.'/framework/class.admin.php'); |
|
| 29 |
$oTrans = Translate::getInstance(); |
|
| 30 |
$oTrans->enableAddon('admin\\modules');
|
|
| 30 | 31 |
$admin = new admin('Addons', 'modules_install', false);
|
| 31 | 32 |
if( !$admin->checkFTAN() ) |
| 32 | 33 |
{
|
| 33 | 34 |
$admin->print_header(); |
| 34 |
$admin->print_error($MESSAGE['GENERIC_SECURITY_ACCESS']);
|
|
| 35 |
$admin->print_error($oTrans->MESSAGE_GENERIC_SECURITY_ACCESS);
|
|
| 35 | 36 |
} |
| 36 | 37 |
// After check print the header |
| 37 | 38 |
$admin->print_header(); |
| ... | ... | |
| 54 | 55 |
// Try to upload the file to the temp dir |
| 55 | 56 |
if(!move_uploaded_file($_FILES['userfile']['tmp_name'], $temp_file)) |
| 56 | 57 |
{
|
| 57 |
$admin->print_error($MESSAGE['GENERIC_BAD_PERMISSIONS']);
|
|
| 58 |
$admin->print_error($oTrans->MESSAGE_GENERIC_BAD_PERMISSIONS);
|
|
| 58 | 59 |
} |
| 59 | 60 |
} else {
|
| 60 | 61 |
$iErrorMessage = ( isset($_FILES['userfile']['error']) && ( $_FILES['userfile']['error'] > 0 ) ? $_FILES['userfile']['error'] : UNKNOW_UPLOAD_ERROR ); |
| ... | ... | |
| 85 | 86 |
default: |
| 86 | 87 |
$key = 'UNKNOW_UPLOAD_ERROR'; |
| 87 | 88 |
} |
| 88 |
|
|
| 89 |
$admin->print_error($MESSAGE[$key].'<br />'.$MESSAGE['GENERIC_CANNOT_UPLOAD']); |
|
| 89 |
$admin->print_error($oTrans->{'MESSAGE_'.$key}.'<br />'.$oTrans->MESSAGE_GENERIC_CANNOT_UPLOAD);
|
|
| 90 | 90 |
} |
| 91 | 91 |
|
| 92 | 92 |
// Include the PclZip class file (thanks to |
| ... | ... | |
| 103 | 103 |
// Check if uploaded file is a valid Add-On zip file |
| 104 | 104 |
if (!($list && file_exists($temp_unzip . 'index.php'))) |
| 105 | 105 |
{
|
| 106 |
$admin->print_error($MESSAGE['GENERIC_INVALID_ADDON_FILE']);
|
|
| 106 |
$admin->print_error($oTrans->MESSAGE_GENERIC_INVALID_ADDON_FILE);
|
|
| 107 | 107 |
} |
| 108 | 108 |
|
| 109 | 109 |
// Include the modules info file |
| ... | ... | |
| 119 | 119 |
if(!isset($module_directory)) |
| 120 | 120 |
{
|
| 121 | 121 |
if(file_exists($temp_file)) { unlink($temp_file); } // Remove temp file
|
| 122 |
$admin->print_error($MESSAGE['GENERIC_INVALID']);
|
|
| 122 |
$admin->print_error($oTrans->MESSAGE_GENERIC_INVALID);
|
|
| 123 | 123 |
} |
| 124 | 124 |
|
| 125 | 125 |
// Check if this module is already installed |
| ... | ... | |
| 136 | 136 |
{
|
| 137 | 137 |
|
| 138 | 138 |
if(file_exists($temp_file)) { unlink($temp_file); } // Remove temp file
|
| 139 |
$admin->print_error($MESSAGE['GENERIC_ALREADY_INSTALLED']);
|
|
| 139 |
$admin->print_error($oTrans->MESSAGE_GENERIC_ALREADY_INSTALLED);
|
|
| 140 | 140 |
} |
| 141 | 141 |
|
| 142 | 142 |
$action="upgrade"; |
| ... | ... | |
| 148 | 148 |
if(!is_writable(WB_PATH.'/modules/')) |
| 149 | 149 |
{
|
| 150 | 150 |
if(file_exists($temp_file)) { unlink($temp_file); } // Remove temp file
|
| 151 |
$admin->print_error($MESSAGE['GENERIC_BAD_PERMISSIONS']);
|
|
| 151 |
$admin->print_error($oTrans->MESSAGE_GENERIC_BAD_PERMISSIONS);
|
|
| 152 | 152 |
} |
| 153 | 153 |
|
| 154 | 154 |
// Set module directory |
| ... | ... | |
| 166 | 166 |
|
| 167 | 167 |
if(!$list) |
| 168 | 168 |
{
|
| 169 |
$admin->print_error($MESSAGE['GENERIC_CANNOT_UNZIP']);
|
|
| 169 |
$admin->print_error($oTrans->MESSAGE_GENERIC_CANNOT_UNZIP);
|
|
| 170 | 170 |
} |
| 171 | 171 |
/* |
| 172 | 172 |
|
| ... | ... | |
| 200 | 200 |
{
|
| 201 | 201 |
// Load module info into DB |
| 202 | 202 |
load_module(WB_PATH.'/modules/'.$module_directory, false); |
| 203 |
$admin->print_success($MESSAGE['GENERIC_INSTALLED']);
|
|
| 203 |
$admin->print_success($oTrans->MESSAGE_GENERIC_INSTALLED);
|
|
| 204 | 204 |
} elseif ($action=="upgrade") |
| 205 | 205 |
{
|
| 206 | 206 |
|
| 207 | 207 |
upgrade_module($module_directory, false); |
| 208 |
$admin->print_success($MESSAGE['GENERIC_UPGRADED']);
|
|
| 208 |
$admin->print_success($oTrans->MESSAGE_GENERIC_UPGRADED);
|
|
| 209 | 209 |
} |
| 210 | 210 |
|
| 211 | 211 |
// Print admin footer |
Also available in: Unified diff
! activate class Translate for all addons in admin/ (except pages/)
! class.admin >> add translation of the current theme to Translate