1
|
<?php
|
2
|
/**
|
3
|
*
|
4
|
* @category admin
|
5
|
* @package admintools
|
6
|
* @author WB-Project, Werner v.d. Decken
|
7
|
* @copyright 2012, WebsiteBaker Org. e.V.
|
8
|
* @link http://www.websitebaker2.org/
|
9
|
* @license http://www.gnu.org/licenses/gpl.html
|
10
|
* @platform WebsiteBaker 2.8.2
|
11
|
* @requirements PHP 5.2.2 and higher
|
12
|
* @version $Id: tool.php 1805 2012-11-04 00:53:51Z Luisehahne $
|
13
|
* @filesource $HeadURL: svn://isteam.dynxs.de/wb-archiv/branches/2.8.x/wb/admin/admintools/tool.php $
|
14
|
* @lastmodified $Date: 2012-11-04 01:53:51 +0100 (Sun, 04 Nov 2012) $
|
15
|
*
|
16
|
*/
|
17
|
|
18
|
$config_file = realpath('../../config.php');
|
19
|
if(file_exists($config_file) && !defined('WB_URL'))
|
20
|
{
|
21
|
require_once($config_file);
|
22
|
}
|
23
|
|
24
|
if(!class_exists('admin', false)){
|
25
|
include(WB_PATH.'/framework/class.admin.php');
|
26
|
$admin = new admin('Admintools','admintools');
|
27
|
}
|
28
|
|
29
|
require_once(WB_PATH.'/framework/functions.php');
|
30
|
|
31
|
$toolDir = (isset($_GET['tool']) && (trim($_GET['tool']) != '') ? trim($_GET['tool']) : '');
|
32
|
$doSave = (isset($_POST['save_settings']) || (isset($_POST['action']) && strtolower($_POST['action']) == 'save'));
|
33
|
|
34
|
// test for valid tool name
|
35
|
if(preg_match('/^[a-z][a-z_\-0-9]{2,}$/i', $toolDir)) {
|
36
|
// Check if tool is installed
|
37
|
$sql = 'SELECT `name` FROM `'.TABLE_PREFIX.'addons` '.
|
38
|
'WHERE `type`=\'module\' AND `function`=\'tool\' '.
|
39
|
'AND `directory`=\''.$toolDir.'\'';
|
40
|
if(($toolName = $database->get_one($sql))) {
|
41
|
// create admin-object and print header if FTAN is NOT supported AND function 'save' is requested
|
42
|
$admin_header = !(is_file(WB_PATH.'/modules/'.$toolDir.'/FTAN_SUPPORTED') && $doSave);
|
43
|
$admin = new admin('admintools', 'admintools', $admin_header );
|
44
|
if(!$doSave) {
|
45
|
// show title if not function 'save' is requested
|
46
|
print '<h4><a href="'.ADMIN_URL.'/admintools/index.php" '.
|
47
|
'title="'.$HEADING['ADMINISTRATION_TOOLS'].'">'.
|
48
|
$HEADING['ADMINISTRATION_TOOLS'].'</a>'.
|
49
|
' » '.$toolName.'</h4>'."\n";
|
50
|
}
|
51
|
// include modules tool.php
|
52
|
require(WB_PATH.'/modules/'.$toolDir.'/tool.php');
|
53
|
$admin->print_footer();
|
54
|
} else {
|
55
|
// no installed module found, jump to index.php of admintools
|
56
|
// header('location: '.ADMIN_URL.'/admintools/index.php');
|
57
|
// exit(0);
|
58
|
$admin->send_header(ADMIN_URL.'/admintools/index.php');
|
59
|
}
|
60
|
}else {
|
61
|
// invalid module name requested, jump to index.php of admintools
|
62
|
// header('location: '.ADMIN_URL.'/admintools/index.php');
|
63
|
// exit(0);
|
64
|
$admin->send_header(ADMIN_URL.'/admintools/index.php');
|
65
|
}
|