1
|
<?php
|
2
|
/**
|
3
|
*
|
4
|
* @category admin
|
5
|
* @package modules
|
6
|
* @author Christian Sommer
|
7
|
* @author WebsiteBaker Project
|
8
|
* @copyright 2004-2009, Ryan Djurovich
|
9
|
* @copyright 2009-2011, Website Baker Org. e.V.
|
10
|
* @link http://www.websitebaker2.org/
|
11
|
* @license http://www.gnu.org/licenses/gpl.html
|
12
|
* @platform WebsiteBaker 2.8.x
|
13
|
* @requirements PHP 5.2.2 and higher
|
14
|
* @version $Id: manual_install.php 1457 2011-06-25 17:18:50Z Luisehahne $
|
15
|
* @filesource $HeadURL: svn://isteam.dynxs.de/wb-archiv/tags/2.8.2/wb/admin/modules/manual_install.php $
|
16
|
* @lastmodified $Date: 2011-06-25 19:18:50 +0200 (Sat, 25 Jun 2011) $
|
17
|
*
|
18
|
*/
|
19
|
|
20
|
/**
|
21
|
* check if there is anything to do
|
22
|
*/
|
23
|
|
24
|
/**
|
25
|
* check if user has permissions to access this file
|
26
|
*/
|
27
|
// include WB configuration file and WB admin class
|
28
|
require_once('../../config.php');
|
29
|
require_once('../../framework/class.admin.php');
|
30
|
|
31
|
// check user permissions for admintools (redirect users with wrong permissions)
|
32
|
$admin = new admin('Admintools', 'admintools', false, false);
|
33
|
|
34
|
if (!(isset($_POST['action']) && in_array($_POST['action'], array('install', 'upgrade', 'uninstall')))) { die(header('Location: index.php?advanced')); }
|
35
|
if (!(isset($_POST['file']) && $_POST['file'] != '' && (strpos($_POST['file'], '..') === false))){ die(header('Location: index.php?advanced')); }
|
36
|
|
37
|
$js_back = ADMIN_URL . '/modules/index.php?advanced';
|
38
|
if( !$admin->checkFTAN() )
|
39
|
{
|
40
|
$admin->print_header();
|
41
|
$admin->print_error($MESSAGE['GENERIC_SECURITY_ACCESS'],$js_back);
|
42
|
}
|
43
|
|
44
|
if ($admin->get_permission('admintools') == false) { die(header('Location: ../../index.php')); }
|
45
|
|
46
|
// check if the referer URL if available
|
47
|
$referer = isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] :
|
48
|
(isset($HTTP_SERVER_VARS['HTTP_REFERER']) ? $HTTP_SERVER_VARS['HTTP_REFERER'] : '');
|
49
|
|
50
|
// if referer is set, check if script was invoked from "admin/modules/index.php"
|
51
|
$required_url = ADMIN_URL . '/modules/index.php';
|
52
|
if ($referer != '' && (!(strpos($referer, $required_url) !== false || strpos($referer, $required_url) !== false)))
|
53
|
{ die(header('Location: ../../index.php')); }
|
54
|
|
55
|
// include WB functions file
|
56
|
require_once(WB_PATH . '/framework/functions.php');
|
57
|
|
58
|
// load WB language file
|
59
|
require_once(WB_PATH . '/languages/' . LANGUAGE .'.php');
|
60
|
|
61
|
// create Admin object with admin header
|
62
|
$admin = new admin('Addons', '', true, false);
|
63
|
|
64
|
/**
|
65
|
* Manually execute the specified module file (install.php, upgrade.php or uninstall.php)
|
66
|
*/
|
67
|
// check if specified module folder exists
|
68
|
$mod_path = WB_PATH . '/modules/' . basename(WB_PATH . '/' . $_POST['file']);
|
69
|
|
70
|
// let the old variablename if module use it
|
71
|
$module_dir = $mod_path;
|
72
|
if (!file_exists($mod_path . '/' . $_POST['action'] . '.php'))
|
73
|
{
|
74
|
$admin->print_header();
|
75
|
$admin->print_error($TEXT['NOT_FOUND'].': <tt>"'.htmlentities(basename($mod_path)).'/'.$_POST['action'].'.php"</tt> ', $js_back);
|
76
|
}
|
77
|
|
78
|
// include modules install.php script
|
79
|
require($mod_path . '/' . $_POST['action'] . '.php');
|
80
|
|
81
|
// load module info into database and output status message
|
82
|
load_module($mod_path, false);
|
83
|
$msg = $TEXT['EXECUTE'] . ': <tt>"' . htmlentities(basename($mod_path)) . '/' . $_POST['action'] . '.php"</tt>';
|
84
|
|
85
|
switch ($_POST['action'])
|
86
|
{
|
87
|
case 'install':
|
88
|
// $admin->print_header();
|
89
|
$admin->print_success($msg, $js_back);
|
90
|
break;
|
91
|
|
92
|
case 'upgrade':
|
93
|
upgrade_module(basename($mod_path), false);
|
94
|
// $admin->print_header();
|
95
|
$admin->print_success($msg, $js_back);
|
96
|
break;
|
97
|
|
98
|
case 'uninstall':
|
99
|
// $admin->print_header();
|
100
|
$admin->print_success($msg, $js_back);
|
101
|
break;
|
102
|
}
|
103
|
|