| 1 | 
        
            1457
         | 
        
            Luisehahne
         | 
        <?php
  | 
      
      
        | 2 | 
        
         | 
        
         | 
        /**
  | 
      
      
        | 3 | 
        
         | 
        
         | 
         *
  | 
      
      
        | 4 | 
        
         | 
        
         | 
         * @category        admin
  | 
      
      
        | 5 | 
        
         | 
        
         | 
         * @package         admintools
  | 
      
      
        | 6 | 
        
            1520
         | 
        
            darkviper
         | 
         * @author          WB-Project, Werner v.d. Decken
  | 
      
      
        | 7 | 
        
            1711
         | 
        
            Luisehahne
         | 
         * @copyright       2012, WebsiteBaker Org. e.V.
  | 
      
      
        | 8 | 
        
            1457
         | 
        
            Luisehahne
         | 
         * @link			http://www.websitebaker2.org/
  | 
      
      
        | 9 | 
        
         | 
        
         | 
         * @license         http://www.gnu.org/licenses/gpl.html
  | 
      
      
        | 10 | 
        
         | 
        
         | 
         * @platform        WebsiteBaker 2.8.x
  | 
      
      
        | 11 | 
        
         | 
        
         | 
         * @requirements    PHP 5.2.2 and higher
  | 
      
      
        | 12 | 
        
         | 
        
         | 
         * @version         $Id$
  | 
      
      
        | 13 | 
        
         | 
        
         | 
         * @filesource		$HeadURL$
  | 
      
      
        | 14 | 
        
         | 
        
         | 
         * @lastmodified    $Date$
  | 
      
      
        | 15 | 
        
         | 
        
         | 
         *
  | 
      
      
        | 16 | 
        
         | 
        
         | 
         */
  | 
      
      
        | 17 | 
        
         | 
        
         | 
        
  | 
      
      
        | 18 | 
        
            1812
         | 
        
            Luisehahne
         | 
        if(!defined('WB_URL'))
 | 
      
      
        | 19 | 
        
         | 
        
         | 
        {
 | 
      
      
        | 20 | 
        
         | 
        
         | 
            $config_file = realpath('../../config.php');
 | 
      
      
        | 21 | 
        
         | 
        
         | 
            if(file_exists($config_file) && !defined('WB_URL'))
 | 
      
      
        | 22 | 
        
         | 
        
         | 
            {
 | 
      
      
        | 23 | 
        
         | 
        
         | 
            	require($config_file);
  | 
      
      
        | 24 | 
        
         | 
        
         | 
            }
  | 
      
      
        | 25 | 
        
         | 
        
         | 
        }
  | 
      
      
        | 26 | 
        
         | 
        
         | 
        if(!class_exists('admin', false)){ include(WB_PATH.'/framework/class.admin.php'); }
 | 
      
      
        | 27 | 
        
            1457
         | 
        
            Luisehahne
         | 
        $admin = new admin('admintools', 'admintools');
 | 
      
      
        | 28 | 
        
         | 
        
         | 
        
  | 
      
      
        | 29 | 
        
         | 
        
         | 
        // Include the WB functions file
  | 
      
      
        | 30 | 
        
         | 
        
         | 
        require_once(WB_PATH.'/framework/functions.php');
  | 
      
      
        | 31 | 
        
         | 
        
         | 
        
  | 
      
      
        | 32 | 
        
            1529
         | 
        
            Luisehahne
         | 
        // Setup template object, parse vars to it, then parse it
  | 
      
      
        | 33 | 
        
            1457
         | 
        
            Luisehahne
         | 
        // Create new template object
  | 
      
      
        | 34 | 
        
            1711
         | 
        
            Luisehahne
         | 
        $template = new Template(dirname($admin->correct_theme_source('admintools.htt')),'keep');
 | 
      
      
        | 35 | 
        
            1529
         | 
        
            Luisehahne
         | 
        // $template->debug = true;
  | 
      
      
        | 36 | 
        
            1457
         | 
        
            Luisehahne
         | 
        $template->set_file('page', 'admintools.htt');
 | 
      
      
        | 37 | 
        
         | 
        
         | 
        $template->set_block('page', 'main_block', 'main');
 | 
      
      
        | 38 | 
        
         | 
        
         | 
        
  | 
      
      
        | 39 | 
        
         | 
        
         | 
        // Insert required template variables
  | 
      
      
        | 40 | 
        
         | 
        
         | 
        $template->set_var('ADMIN_URL', ADMIN_URL);
 | 
      
      
        | 41 | 
        
         | 
        
         | 
        $template->set_var('THEME_URL', THEME_URL);
 | 
      
      
        | 42 | 
        
         | 
        
         | 
        $template->set_var('HEADING_ADMINISTRATION_TOOLS', $HEADING['ADMINISTRATION_TOOLS']);
 | 
      
      
        | 43 | 
        
         | 
        
         | 
        
  | 
      
      
        | 44 | 
        
         | 
        
         | 
        // Insert tools into tool list
  | 
      
      
        | 45 | 
        
         | 
        
         | 
        $template->set_block('main_block', 'tool_list_block', 'tool_list');
 | 
      
      
        | 46 | 
        
            1711
         | 
        
            Luisehahne
         | 
        $template->set_var('TOOL_NAME', '');
 | 
      
      
        | 47 | 
        
            1812
         | 
        
            Luisehahne
         | 
        $template->set_var('tool_list', '');
 | 
      
      
        | 48 | 
        
            1711
         | 
        
            Luisehahne
         | 
        $template->set_var('TOOL_DIR', '');
 | 
      
      
        | 49 | 
        
         | 
        
         | 
        $template->set_var('TOOL_DESCRIPTION', '');
 | 
      
      
        | 50 | 
        
         | 
        
         | 
        $template->set_var('NO_CONTENT', '');
 | 
      
      
        | 51 | 
        
            1457
         | 
        
            Luisehahne
         | 
        $results = $database->query("SELECT * FROM ".TABLE_PREFIX."addons WHERE type = 'module' AND function = 'tool' order by name");
 | 
      
      
        | 52 | 
        
            1812
         | 
        
            Luisehahne
         | 
        $bHasToolRights = false;
  | 
      
      
        | 53 | 
        
            1457
         | 
        
            Luisehahne
         | 
        if($results->numRows() > 0) {
 | 
      
      
        | 54 | 
        
            1812
         | 
        
            Luisehahne
         | 
        	while( $tool = $results->fetchRow(MYSQL_ASSOC) ) {
 | 
      
      
        | 55 | 
        
         | 
        
         | 
                $bHasToolRights = false;
  | 
      
      
        | 56 | 
        
            1711
         | 
        
            Luisehahne
         | 
        		if( $admin->get_permission($tool['directory'],'module' ) )
  | 
      
      
        | 57 | 
        
         | 
        
         | 
        		{
 | 
      
      
        | 58 | 
        
            1812
         | 
        
            Luisehahne
         | 
                    $bHasToolRights = true;
  | 
      
      
        | 59 | 
        
         | 
        
         | 
        		$template->set_var('TOOL_NAME', $tool['name']);
 | 
      
      
        | 60 | 
        
            1711
         | 
        
            Luisehahne
         | 
        			$template->set_var('TOOL_DIR', $tool['directory']);
 | 
      
      
        | 61 | 
        
            1812
         | 
        
            Luisehahne
         | 
        	// check if a module description exists for the displayed backend language
  | 
      
      
        | 62 | 
        
            1711
         | 
        
            Luisehahne
         | 
        			$tool_description = false;
  | 
      
      
        | 63 | 
        
         | 
        
         | 
        			if(function_exists('file_get_contents') && file_exists(WB_PATH.'/modules/'.$tool['directory'].'/languages/'.LANGUAGE .'.php')) {
 | 
      
      
        | 64 | 
        
         | 
        
         | 
        				// read contents of the module language file into string
  | 
      
      
        | 65 | 
        
         | 
        
         | 
        				$data = @file_get_contents(WB_PATH .'/modules/' .$tool['directory'] .'/languages/' .LANGUAGE .'.php');
  | 
      
      
        | 66 | 
        
         | 
        
         | 
        				$tool_description = get_variable_content('module_description', $data, true, false);
 | 
      
      
        | 67 | 
        
         | 
        
         | 
        			}
  | 
      
      
        | 68 | 
        
         | 
        
         | 
        			if(file_exists(WB_PATH .'/modules/' .$tool['directory'].'/tool_icon.png'))
  | 
      
      
        | 69 | 
        
         | 
        
         | 
        			{
 | 
      
      
        | 70 | 
        
         | 
        
         | 
        				$template->set_var('TOOL_ICON', WB_URL.'/modules/' .$tool['directory'].'/tool_icon.png');
 | 
      
      
        | 71 | 
        
         | 
        
         | 
        			} else {
 | 
      
      
        | 72 | 
        
         | 
        
         | 
        				$template->set_var('TOOL_ICON', THEME_URL.'/icons/admintools.png');
 | 
      
      
        | 73 | 
        
         | 
        
         | 
        			}
  | 
      
      
        | 74 | 
        
         | 
        
         | 
        			$template->set_var('TOOL_DESCRIPTION', ($tool_description === False)? $tool['description'] :$tool_description);
 | 
      
      
        | 75 | 
        
         | 
        
         | 
        			$template->parse('tool_list', 'tool_list_block', true);
 | 
      
      
        | 76 | 
        
            1679
         | 
        
            Luisehahne
         | 
        		}
  | 
      
      
        | 77 | 
        
            1457
         | 
        
            Luisehahne
         | 
        	}
  | 
      
      
        | 78 | 
        
            1711
         | 
        
            Luisehahne
         | 
        
  | 
      
      
        | 79 | 
        
            1457
         | 
        
            Luisehahne
         | 
        }
  | 
      
      
        | 80 | 
        
         | 
        
         | 
        
  | 
      
      
        | 81 | 
        
            1812
         | 
        
            Luisehahne
         | 
        $template->set_var('TOOL_LIST', ($bHasToolRights==false) ? $TEXT['NONE'].' '.$TEXT['MODULE_PERMISSIONS'] : ' ');
 | 
      
      
        | 82 | 
        
         | 
        
         | 
        
  | 
      
      
        | 83 | 
        
         | 
        
         | 
        //template->set_var('TOOL_LIST', '<li> </li>');
 | 
      
      
        | 84 | 
        
            1457
         | 
        
            Luisehahne
         | 
        // Parse template objects output
  | 
      
      
        | 85 | 
        
         | 
        
         | 
        $template->parse('main', 'main_block', false);
 | 
      
      
        | 86 | 
        
         | 
        
         | 
        $template->pparse('output', 'page');
 | 
      
      
        | 87 | 
        
         | 
        
         | 
        
  | 
      
      
        | 88 | 
        
         | 
        
         | 
        $admin->print_footer();
  |