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