Project

General

Profile

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 2098 2014-02-11 01:37:03Z darkviper $
13
 * @filesource		$HeadURL: svn://isteam.dynxs.de/wb-archiv/branches/2.8.x/wb/admin/admintools/tool.php $
14
 * @lastmodified    $Date: 2014-02-11 02:37:03 +0100 (Tue, 11 Feb 2014) $
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',false);
27
}
28
$oDb = WbDatabase::getInstance();
29
$oTrans = Translate::getInstance();
30
$oTrans->enableAddon('admin\\admintools');
31

    
32
require_once(WB_PATH.'/framework/functions.php');
33

    
34
$toolDir = (isset($_POST['tool']) && (trim($_POST['tool']) != '') ? trim($_POST['tool']) : '');
35
$toolDir = (isset($_GET['tool']) && (trim($_GET['tool']) != '') ? trim($_GET['tool']) : $toolDir);
36
$doSave  = (isset($_POST['save_settings']) || (isset($_POST['action']) && strtolower($_POST['action']) == 'save'));
37

    
38
// test for valid tool name
39
	if(preg_match('/^[a-z][a-z_\-0-9]{2,}$/i', $toolDir)) {
40
	// Check if tool is installed
41
		$sql = 'SELECT `name` FROM `'.$oDb->TablePrefix.'addons` '.
42
		       'WHERE `type`=\'module\' AND `function`=\'tool\' '.
43
		              'AND `directory`=\''.$toolDir.'\'';
44
		if(($toolName = $oDb->getOne($sql))) {
45
		// create admin-object and print header if FTAN is NOT supported AND function 'save' is requested
46
			$admin_header = !(is_file(WB_PATH.'/modules/'.$toolDir.'/FTAN_SUPPORTED') && $doSave);
47
			$admin = new admin('admintools', 'admintools', $admin_header );
48
			if(!$doSave) {
49
			// show title if not function 'save' is requested
50
				print '<h4><a href="'.ADMIN_URL.'/admintools/index.php" '.
51
				      'title="'.$oTrans->HEADING_ADMINISTRATION_TOOLS.'">'.
52
				      $oTrans->HEADING_ADMINISTRATION_TOOLS.'</a>'.
53
					  '&nbsp;&raquo;&nbsp;'.$toolName.'</h4>'."\n";
54
			}
55
			// include modules tool.php
56
			require(WB_PATH.'/modules/'.$toolDir.'/tool.php');
57
			$admin->print_footer();
58
		} else {
59
		// no installed module found, jump to index.php of admintools
60
//			header('location: '.ADMIN_URL.'/admintools/index.php');
61
//			exit(0);
62
			$admin->send_header(ADMIN_URL.'/admintools/index.php');
63
		}
64
	}else {
65
	// invalid module name requested, jump to index.php of admintools
66
//		header('location: '.ADMIN_URL.'/admintools/index.php');
67
//		exit(0);
68
		$admin->send_header(ADMIN_URL.'/admintools/index.php');
69
	}
(2-2/2)