Revision 938
Added by doc over 16 years ago
| manual_install.php | ||
|---|---|---|
| 1 | 1 |
<?php |
| 2 | 2 |
/** |
| 3 |
* $Id:$
|
|
| 3 |
* $Id$ |
|
| 4 | 4 |
* Website Baker Manual module installation |
| 5 | 5 |
* |
| 6 | 6 |
* This file contains the function to invoke the module install or upgrade |
| ... | ... | |
| 12 | 12 |
* @author Christian Sommer |
| 13 | 13 |
* @copyright (c) 2009 |
| 14 | 14 |
* @license http://www.gnu.org/copyleft/lesser.html |
| 15 |
* @version 0.1.0
|
|
| 15 |
* @version 0.2.0
|
|
| 16 | 16 |
* @platform Website Baker 2.7 |
| 17 | 17 |
* |
| 18 | 18 |
* Website Baker Project <http://www.websitebaker.org/> |
| ... | ... | |
| 36 | 36 |
/** |
| 37 | 37 |
* check if there is anything to do |
| 38 | 38 |
*/ |
| 39 |
if (!(isset($_POST['file']) && (strpos($_POST['file'], '..') === false))) die(header('Location: index.php'));
|
|
| 39 |
if (!(isset($_POST['action']) && in_array($_POST['action'], array('install', 'upgrade', 'uninstall')))) die(header('Location: index.php?advanced'));
|
|
| 40 |
if (!(isset($_POST['file']) && $_POST['file'] != '' && (strpos($_POST['file'], '..') === false))) die(header('Location: index.php?advanced'));
|
|
| 40 | 41 |
|
| 41 | 42 |
/** |
| 42 | 43 |
* check if user has permissions to access this file |
| ... | ... | |
| 66 | 67 |
|
| 67 | 68 |
// create Admin object with admin header |
| 68 | 69 |
$admin = new admin('Addons', '', true, false);
|
| 69 |
$js_back = ADMIN_URL . '/modules/index.php'; |
|
| 70 |
$js_back = ADMIN_URL . '/modules/index.php?advanced';
|
|
| 70 | 71 |
|
| 71 | 72 |
/** |
| 72 |
* Reload all specified Addons
|
|
| 73 |
* Manually execute the specified module file (install.php, upgrade.php or uninstall.php)
|
|
| 73 | 74 |
*/ |
| 74 | 75 |
// check if specified module folder exists |
| 75 | 76 |
$mod_path = WB_PATH . '/modules/' . basename(WB_PATH . '/' . $_POST['file']); |
| 76 |
if (!file_exists($mod_path . '/install.php')) $admin->print_error($MESSAGE['GENERIC']['NOT_INSTALLED'], $js_back);
|
|
| 77 |
if (!file_exists($mod_path . '/' . $_POST['action'] . '.php')) $admin->print_error($TEXT['NOT_FOUND'] . ': <tt>"' . htmlentities(basename($mod_path)) . '/' . $_POST['action'] . '.php"</tt> ', $js_back);
|
|
| 77 | 78 |
|
| 78 | 79 |
// include modules install.php script |
| 79 |
require($mod_path . '/install.php');
|
|
| 80 |
require($mod_path . '/' . $_POST['action'] . '.php');
|
|
| 80 | 81 |
|
| 81 | 82 |
// load module info into database and output status message |
| 82 | 83 |
load_module($mod_path, false); |
| 83 |
$admin->print_success($MESSAGE['GENERIC']['INSTALLED'], $js_back);
|
|
| 84 |
$msg = $TEXT['EXECUTE'] . ': <tt>"' . htmlentities(basename($mod_path)) . '/' . $_POST['action'] . '.php"</tt>';
|
|
| 84 | 85 |
|
| 86 |
switch ($_POST['action']) {
|
|
| 87 |
case 'install': |
|
| 88 |
$admin->print_success($msg, $js_back); |
|
| 89 |
break; |
|
| 90 |
|
|
| 91 |
case 'upgrade': |
|
| 92 |
$admin->print_success($msg, $js_back); |
|
| 93 |
break; |
|
| 94 |
|
|
| 95 |
case 'uninstall': |
|
| 96 |
$admin->print_success($msg, $js_back); |
|
| 97 |
break; |
|
| 98 |
} |
|
| 99 |
|
|
| 85 | 100 |
?> |
Also available in: Unified diff
added option to invoke module upgrade.php/uninstall.php files from backend (for modules uploaded via FTP)