| 1 | 
        
            536
         | 
        
            doc
         | 
        <?php
  | 
      
      
        | 2 | 
        
            1398
         | 
        
            FrankH
         | 
        /**
  | 
      
      
        | 3 | 
        
         | 
        
         | 
         *
  | 
      
      
        | 4 | 
        
         | 
        
         | 
         * @category        admin
  | 
      
      
        | 5 | 
        
         | 
        
         | 
         * @package         admintools
  | 
      
      
        | 6 | 
        
            1520
         | 
        
            darkviper
         | 
         * @author          WB-Project, Werner v.d. Decken
  | 
      
      
        | 7 | 
        
         | 
        
         | 
         * @copyright       2011, Website Baker Org. e.V.
  | 
      
      
        | 8 | 
        
            1398
         | 
        
            FrankH
         | 
         * @link			http://www.websitebaker2.org/
  | 
      
      
        | 9 | 
        
         | 
        
         | 
         * @license         http://www.gnu.org/licenses/gpl.html
  | 
      
      
        | 10 | 
        
            1520
         | 
        
            darkviper
         | 
         * @platform        WebsiteBaker 2.8.2
  | 
      
      
        | 11 | 
        
            1398
         | 
        
            FrankH
         | 
         * @requirements    PHP 5.2.2 and higher
  | 
      
      
        | 12 | 
        
         | 
        
         | 
         * @version         $Id$
  | 
      
      
        | 13 | 
        
            1457
         | 
        
            Luisehahne
         | 
         * @filesource		$HeadURL$
  | 
      
      
        | 14 | 
        
         | 
        
         | 
         * @lastmodified    $Date$
  | 
      
      
        | 15 | 
        
            1398
         | 
        
            FrankH
         | 
         *
  | 
      
      
        | 16 | 
        
         | 
        
         | 
         */
  | 
      
      
        | 17 | 
        
            536
         | 
        
            doc
         | 
        require('../../config.php');
 | 
      
      
        | 18 | 
        
         | 
        
         | 
        require_once(WB_PATH.'/framework/class.admin.php');
  | 
      
      
        | 19 | 
        
         | 
        
         | 
        require_once(WB_PATH.'/framework/functions.php');
  | 
      
      
        | 20 | 
        
         | 
        
         | 
        
  | 
      
      
        | 21 | 
        
            1520
         | 
        
            darkviper
         | 
        	$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 | 
        
            1552
         | 
        
            Luisehahne
         | 
        					  ' » '.$toolName.'</h4>'."\n";
  | 
      
      
        | 39 | 
        
            1520
         | 
        
            darkviper
         | 
        			}
  | 
      
      
        | 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 | 
        
         | 
        
         | 
        	}
  |