Revision 99
Added by stefan about 20 years ago
| install.php | ||
|---|---|---|
| 1 | 1 |
<?php |
| 2 | 2 |
|
| 3 |
// $Id: install.php,v 1.8 2005/04/02 06:25:53 rdjurovich Exp $
|
|
| 3 |
// $Id$ |
|
| 4 | 4 |
|
| 5 | 5 |
/* |
| 6 | 6 |
|
| ... | ... | |
| 55 | 55 |
// Setup the PclZip object |
| 56 | 56 |
$archive = new PclZip($temp_file); |
| 57 | 57 |
// Unzip the files to the temp unzip folder |
| 58 |
$list = $archive->extract(PCLZIP_OPT_PATH, $temp_unzip, PCLZIP_OPT_REMOVE_ALL_PATH);
|
|
| 58 |
$list = $archive->extract(PCLZIP_OPT_PATH, $temp_unzip); |
|
| 59 | 59 |
// Include the templates info file |
| 60 | 60 |
require($temp_unzip.'info.php'); |
| 61 | 61 |
// Delete the temp unzip directory |
| ... | ... | |
| 67 | 67 |
$admin->print_error($MESSAGE['GENERIC']['INVALID']); |
| 68 | 68 |
} |
| 69 | 69 |
|
| 70 |
// Check if a template with the same name already exists |
|
| 70 |
// Check if this module is already installed |
|
| 71 |
// and compare versions if so |
|
| 72 |
$new_template_version=$template_version; |
|
| 71 | 73 |
if(is_dir(WB_PATH.'/templates/'.$template_directory)) {
|
| 72 |
if(file_exists($temp_file)) { unlink($temp_file); } // Remove temp file
|
|
| 73 |
$admin->print_error($MESSAGE['GENERIC']['ALREADY_INSTALLED']); |
|
| 74 |
if(file_exists(WB_PATH.'/templates/'.$template_directory.'/info.php')) {
|
|
| 75 |
require(WB_PATH.'/templates/'.$template_directory.'/info.php'); |
|
| 76 |
// Version to be installed is older than currently installed version |
|
| 77 |
if ($template_version>$new_template_version) {
|
|
| 78 |
if(file_exists($temp_file)) { unlink($temp_file); } // Remove temp file
|
|
| 79 |
$admin->print_error($MESSAGE['GENERIC']['ALREADY_INSTALLED']); |
|
| 80 |
} |
|
| 81 |
} |
|
| 82 |
$success_message=$MESSAGE['GENERIC']['UPGRADED']; |
|
| 83 |
} else {
|
|
| 84 |
$success_message=$MESSAGE['GENERIC']['INSTALLED']; |
|
| 74 | 85 |
} |
| 75 | 86 |
|
| 76 | 87 |
// Check if template dir is writable |
| ... | ... | |
| 90 | 101 |
} |
| 91 | 102 |
|
| 92 | 103 |
// Unzip template to the template dir |
| 93 |
$list = $archive->extract(PCLZIP_OPT_PATH, $template_dir, PCLZIP_OPT_REMOVE_ALL_PATH);
|
|
| 104 |
$list = $archive->extract(PCLZIP_OPT_PATH, $template_dir); |
|
| 94 | 105 |
if(!$list) {
|
| 95 | 106 |
$admin->print_error($MESSAGE['GENERIC']['CANNOT_UNZIP']); |
| 96 | 107 |
} |
| ... | ... | |
| 109 | 120 |
} |
| 110 | 121 |
|
| 111 | 122 |
// Print success message |
| 112 |
$admin->print_success($MESSAGE['GENERIC']['INSTALLED']);
|
|
| 123 |
$admin->print_success($success_message);
|
|
| 113 | 124 |
|
| 114 | 125 |
// Print admin footer |
| 115 | 126 |
$admin->print_footer(); |
Also available in: Unified diff
Implemented upgrade functionality in templates and languages. Fixed some bugs.