Project

General

Profile

« Previous | Next » 

Revision 1520

Added by darkviper almost 13 years ago

/modules/output_filter completely recoded
+ new filter for relative-URL added
+ some small fixes
/admin/admintools/tool.php completely recoded
/wb/index.php output_filter request changed to adopt new output_filter

View differences:

tool.php
3 3
 *
4 4
 * @category        admin
5 5
 * @package         admintools
6
 * @author          WebsiteBaker Project
7
 * @copyright       2004-2009, Ryan Djurovich
8
 * @copyright       2009-2011, Website Baker Org. e.V.
6
 * @author          WB-Project, Werner v.d. Decken
7
 * @copyright       2011, Website Baker Org. e.V.
9 8
 * @link			http://www.websitebaker2.org/
10 9
 * @license         http://www.gnu.org/licenses/gpl.html
11
 * @platform        WebsiteBaker 2.8.x
10
 * @platform        WebsiteBaker 2.8.2
12 11
 * @requirements    PHP 5.2.2 and higher
13 12
 * @version         $Id$
14 13
 * @filesource		$HeadURL$
15 14
 * @lastmodified    $Date$
16 15
 *
17 16
 */
18

  
19 17
require('../../config.php');
20 18
require_once(WB_PATH.'/framework/class.admin.php');
21 19
require_once(WB_PATH.'/framework/functions.php');
22 20

  
23
if(!isset($_GET['tool'])) {
24
	header("Location: index.php");
25
	exit(0);
26
} else {
27
	$array = array();
28
	preg_match("/[a-z,_,a-z]+/i",$_GET['tool'],$array);
29
	$tool = $array[0];
30
}
31

  
32
$ModulesUsingFTAN = '';
33
$admin_header =  true;
34
if(isset($_POST['save_settings'])) {
35
	$ModulesUsingFTAN = WB_PATH.'/modules/'.$tool.'/FTAN_SUPPORTED';
36
}
37

  
38
$admin_header = (file_exists($ModulesUsingFTAN) && is_file($ModulesUsingFTAN)) == false;
39
$admin = new admin('admintools', 'admintools', $admin_header );
40

  
41
// Check if tool is installed
42
$result = $database->query("SELECT * FROM ".TABLE_PREFIX."addons WHERE type = 'module' AND function = 'tool' AND directory = '".preg_replace('/[^a-z0-9_-]/i', "", $tool)."'");
43
if($result->numRows() == 0) {
44
	header("Location: index.php");
45
	exit(0);
46
}
47
$tools = $result->fetchRow();
48
if(!isset($_POST['save_settings'])) {
49

  
50
?>
51
<h4>
52
	<a href="<?php echo ADMIN_URL; ?>/admintools/index.php"><?php echo $HEADING['ADMINISTRATION_TOOLS']; ?></a>
53
	&raquo;
54
	<?php echo $tools['name']; ?>
55
</h4>
56
<?php
57
}
58
require(WB_PATH.'/modules/'.$tools['directory'].'/tool.php');
59

  
60
$admin->print_footer();
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
					  '&raquo'.$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
	}

Also available in: Unified diff