Revision 1712
Added by Dietmar about 12 years ago
install.php | ||
---|---|---|
3 | 3 |
* |
4 | 4 |
* @category admin |
5 | 5 |
* @package templates |
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 |
... | ... | |
48 | 47 |
|
49 | 48 |
// Try to upload the file to the temp dir |
50 | 49 |
if(!move_uploaded_file($_FILES['userfile']['tmp_name'], $temp_file)) { |
51 |
$admin->print_error($MESSAGE['GENERIC']['CANNOT_UPLOAD']);
|
|
50 |
$admin->print_error($MESSAGE['GENERIC_CANNOT_UPLOAD']);
|
|
52 | 51 |
} |
53 | 52 |
|
54 |
// Include the PclZip class file (thanks to
|
|
53 |
// Include the PclZip class file (thanks to |
|
55 | 54 |
require_once(WB_PATH.'/include/pclzip/pclzip.lib.php'); |
56 | 55 |
|
57 | 56 |
// Remove any vars with name "template_directory" and "theme_directory" |
... | ... | |
64 | 63 |
$list = $archive->extract(PCLZIP_OPT_PATH, $temp_unzip); |
65 | 64 |
|
66 | 65 |
// Check if uploaded file is a valid Add-On zip file |
67 |
if (!($list && file_exists($temp_unzip . 'index.php'))) $admin->print_error($MESSAGE['GENERIC']['INVALID_ADDON_FILE']);
|
|
66 |
if (!($list && file_exists($temp_unzip . 'index.php'))) $admin->print_error($MESSAGE['GENERIC_INVALID_ADDON_FILE']);
|
|
68 | 67 |
|
69 | 68 |
// Include the templates info file |
70 | 69 |
require($temp_unzip.'info.php'); |
... | ... | |
79 | 78 |
// Check if the file is valid |
80 | 79 |
if(!isset($template_directory)) { |
81 | 80 |
if(file_exists($temp_file)) { unlink($temp_file); } // Remove temp file |
82 |
$admin->print_error($MESSAGE['GENERIC']['INVALID']);
|
|
81 |
$admin->print_error($MESSAGE['GENERIC_INVALID']);
|
|
83 | 82 |
} |
84 | 83 |
|
85 | 84 |
// Check if this module is already installed |
... | ... | |
91 | 90 |
// Version to be installed is older than currently installed version |
92 | 91 |
if (versionCompare($template_version, $new_template_version, '>=')) { |
93 | 92 |
if(file_exists($temp_file)) { unlink($temp_file); } // Remove temp file |
94 |
$admin->print_error($MESSAGE['GENERIC']['ALREADY_INSTALLED']);
|
|
93 |
$admin->print_error($MESSAGE['GENERIC_ALREADY_INSTALLED']);
|
|
95 | 94 |
} |
96 |
}
|
|
97 |
$success_message=$MESSAGE['GENERIC']['UPGRADED'];
|
|
95 |
} |
|
96 |
$success_message=$MESSAGE['GENERIC_UPGRADED'];
|
|
98 | 97 |
} else { |
99 |
$success_message=$MESSAGE['GENERIC']['INSTALLED'];
|
|
98 |
$success_message=$MESSAGE['GENERIC_INSTALLED'];
|
|
100 | 99 |
} |
101 | 100 |
|
102 | 101 |
// Check if template dir is writable |
103 | 102 |
if(!is_writable(WB_PATH.'/templates/')) { |
104 | 103 |
if(file_exists($temp_file)) { unlink($temp_file); } // Remove temp file |
105 |
$admin->print_error($MESSAGE['TEMPLATES']['BAD_PERMISSIONS']);
|
|
104 |
$admin->print_error($MESSAGE['TEMPLATES_BAD_PERMISSIONS']);
|
|
106 | 105 |
} |
107 | 106 |
|
108 | 107 |
// Set template dir |
... | ... | |
116 | 115 |
} |
117 | 116 |
|
118 | 117 |
// Unzip template to the template dir |
119 |
$list = $archive->extract(PCLZIP_OPT_PATH, $template_dir, PCLZIP_OPT_REPLACE_NEWER); |
|
118 |
//$list = $archive->extract(PCLZIP_OPT_PATH, $template_dir, PCLZIP_OPT_REPLACE_NEWER); |
|
119 |
if(isset($_POST['overwrite'])){ |
|
120 |
$list = $archive->extract(PCLZIP_OPT_PATH, $template_dir, PCLZIP_OPT_REPLACE_NEWER ); |
|
121 |
} else { |
|
122 |
$list = $archive->extract(PCLZIP_OPT_PATH, $template_dir ); |
|
123 |
} |
|
120 | 124 |
if(!$list) { |
121 |
$admin->print_error($MESSAGE['GENERIC']['CANNOT_UNZIP']);
|
|
125 |
$admin->print_error($MESSAGE['GENERIC_CANNOT_UNZIP']);
|
|
122 | 126 |
} |
123 | 127 |
|
124 | 128 |
// Delete the temp zip file |
... | ... | |
142 | 146 |
|
143 | 147 |
// Print admin footer |
144 | 148 |
$admin->print_footer(); |
145 |
|
|
146 |
?> |
Also available in: Unified diff
! update folder admin/addons admin/skel/htt