Project

General

Profile

1
<?php
2
/**
3
 *
4
 * @category        admin
5
 * @package         admintools
6
 * @author          WB-Project, Werner v.d. Decken
7
 * @copyright       2011, Website Baker 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 1552 2011-12-31 14:57:31Z Luisehahne $
13
 * @filesource		$HeadURL: svn://isteam.dynxs.de/wb-archiv/branches/2.8.x/wb/admin/admintools/tool.php $
14
 * @lastmodified    $Date: 2011-12-31 15:57:31 +0100 (Sat, 31 Dec 2011) $
15
 *
16
 */
17
require('../../config.php');
18
require_once(WB_PATH.'/framework/class.admin.php');
19
require_once(WB_PATH.'/framework/functions.php');
20

    
21
	$toolDir = (isset($_GET['tool']) && (trim($_GET['tool']) != '') ? trim($_GET['tool']) : '');
22
	$doSave = (isset($_POST['save_settings']) || (isset($_POST['action']) && strtolower($_POST['action']) == 'save'));
23
// test for valid tool name
24
	if(preg_match('/^[a-z][a-z_\-0-9]{2,}$/i', $toolDir)) {
25
	// Check if tool is installed
26
		$sql = 'SELECT `name` FROM `'.TABLE_PREFIX.'addons` '.
27
		       'WHERE `type`=\'module\' AND `function`=\'tool\' '.
28
		              'AND `directory`=\''.$toolDir.'\'';
29
		if(($toolName = $database->get_one($sql))) {
30
		// create admin-object and print header if FTAN is NOT supported AND function 'save' is requested
31
			$admin_header = !(is_file(WB_PATH.'/modules/'.$toolDir.'/FTAN_SUPPORTED') && $doSave);
32
			$admin = new admin('admintools', 'admintools', $admin_header );
33
			if(!$doSave) {
34
			// show title if not function 'save' is requested
35
				print '<h4><a href="'.ADMIN_URL.'/admintools/index.php" '.
36
				      'title="'.$HEADING['ADMINISTRATION_TOOLS'].'">'.
37
				      $HEADING['ADMINISTRATION_TOOLS'].'</a>'.
38
					  '&nbsp;&raquo;&nbsp;'.$toolName.'</h4>'."\n";
39
			}
40
			// include modules tool.php
41
			require(WB_PATH.'/modules/'.$toolDir.'/tool.php');
42
			$admin->print_footer();
43
		}else {
44
		// no installed module found, jump to index.php of admintools
45
			header('location: '.ADMIN_URL.'/admintools/index.php');
46
			exit(0);
47
		}
48
	}else {
49
	// invalid module name requested, jump to index.php of admintools
50
		header('location: '.ADMIN_URL.'/admintools/index.php');
51
		exit(0);
52
	}
(2-2/2)