Revision 1712
Added by Luisehahne about 13 years ago
| install.php | ||
|---|---|---|
| 3 | 3 |
* |
| 4 | 4 |
* @category admin |
| 5 | 5 |
* @package languages |
| 6 |
* @author WebsiteBaker Project |
|
| 7 |
* @copyright 2004-2009, Ryan Djurovich |
|
| 8 |
* @copyright 2009-2011, Website Baker Org. e.V. |
|
| 6 |
* @author Ryan Djurovich, WebsiteBaker Project |
|
| 7 |
* @copyright 2009-2012, WebsiteBaker Org. e.V. |
|
| 9 | 8 |
* @link http://www.websitebaker2.org/ |
| 10 | 9 |
* @license http://www.gnu.org/licenses/gpl.html |
| 11 | 10 |
* @platform WebsiteBaker 2.8.x |
| ... | ... | |
| 60 | 59 |
// Check if language dir is writable |
| 61 | 60 |
if(!is_writable(WB_PATH.'/languages/')) {
|
| 62 | 61 |
if(file_exists($temp_file)) { unlink($temp_file); } // Remove temp file
|
| 63 |
$admin->print_error($MESSAGE['GENERIC']['BAD_PERMISSIONS']);
|
|
| 62 |
$admin->print_error($MESSAGE['GENERIC_BAD_PERMISSIONS']);
|
|
| 64 | 63 |
} |
| 65 | 64 |
|
| 66 | 65 |
// Try to upload the file to the temp dir |
| 67 | 66 |
if(!move_uploaded_file($_FILES['userfile']['tmp_name'], $temp_file)) {
|
| 68 | 67 |
if(file_exists($temp_file)) { unlink($temp_file); } // Remove temp file
|
| 69 |
$admin->print_error($MESSAGE['GENERIC']['CANNOT_UPLOAD']);
|
|
| 68 |
$admin->print_error($MESSAGE['GENERIC_CANNOT_UPLOAD']);
|
|
| 70 | 69 |
} |
| 71 | 70 |
|
| 72 | 71 |
// Check if uploaded file is a valid language file (no binary file etc.) |
| 73 | 72 |
$content = file_get_contents($temp_file); |
| 74 |
if (strpos($content, '<?php') === false) $admin->print_error($MESSAGE['GENERIC']['INVALID_LANGUAGE_FILE']);
|
|
| 73 |
if (strpos($content, '<?php') === false) $admin->print_error($MESSAGE['GENERIC_INVALID_LANGUAGE_FILE']);
|
|
| 75 | 74 |
|
| 76 | 75 |
// Remove any vars with name "language_code" |
| 77 | 76 |
unset($language_code); |
| ... | ... | |
| 88 | 87 |
if(file_exists($temp_file)) { unlink($temp_file); } // Remove temp file
|
| 89 | 88 |
// Restore to correct language |
| 90 | 89 |
require(WB_PATH.'/languages/'.LANGUAGE.'.php'); |
| 91 |
$admin->print_error($MESSAGE['GENERIC']['INVALID_LANGUAGE_FILE']);
|
|
| 90 |
$admin->print_error($MESSAGE['GENERIC_INVALID_LANGUAGE_FILE']);
|
|
| 92 | 91 |
} |
| 93 | 92 |
|
| 94 | 93 |
// Set destination for language file |
| ... | ... | |
| 101 | 100 |
if (versionCompare($language_version, $new_language_version, '>=')) {
|
| 102 | 101 |
// Restore to correct language |
| 103 | 102 |
require(WB_PATH . '/languages/' . LANGUAGE . '.php'); |
| 104 |
$admin->print_error($MESSAGE['GENERIC']['ALREADY_INSTALLED']);
|
|
| 103 |
$admin->print_error($MESSAGE['GENERIC_ALREADY_INSTALLED']);
|
|
| 105 | 104 |
} |
| 106 | 105 |
$action="upgrade"; |
| 107 | 106 |
unlink($language_file); |
| ... | ... | |
| 120 | 119 |
|
| 121 | 120 |
// Print success message |
| 122 | 121 |
if ($action=="install") {
|
| 123 |
$admin->print_success($MESSAGE['GENERIC']['INSTALLED']);
|
|
| 122 |
$admin->print_success($MESSAGE['GENERIC_INSTALLED']);
|
|
| 124 | 123 |
} else {
|
| 125 |
$admin->print_success($MESSAGE['GENERIC']['UPGRADED']);
|
|
| 124 |
$admin->print_success($MESSAGE['GENERIC_UPGRADED']);
|
|
| 126 | 125 |
} |
| 127 | 126 |
|
| 128 | 127 |
// Print admin footer |
| 129 | 128 |
$admin->print_footer(); |
| 130 |
|
|
| 131 |
?> |
|
Also available in: Unified diff
! update folder admin/addons admin/skel/htt