| 1 | <?php
 | 
  
    | 2 | /**
 | 
  
    | 3 |  *
 | 
  
    | 4 |  * @category        admin
 | 
  
    | 5 |  * @package         admintools
 | 
  
    | 6 |  * @author          WB-Project, Werner v.d. Decken
 | 
  
    | 7 |  * @copyright       2012, WebsiteBaker Org. e.V.
 | 
  
    | 8 |  * @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: index.php 2098 2014-02-11 01:37:03Z darkviper $
 | 
  
    | 13 |  * @filesource		$HeadURL: svn://isteam.dynxs.de/wb-archiv/branches/2.8.x/wb/admin/admintools/index.php $
 | 
  
    | 14 |  * @lastmodified    $Date: 2014-02-11 02:37:03 +0100 (Tue, 11 Feb 2014) $
 | 
  
    | 15 |  *
 | 
  
    | 16 |  */
 | 
  
    | 17 | 
 | 
  
    | 18 | 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 | $admin = new admin('admintools', 'admintools');
 | 
  
    | 28 | 
 | 
  
    | 29 | // Include the WB functions file
 | 
  
    | 30 | require_once(WB_PATH.'/framework/functions.php');
 | 
  
    | 31 | 
 | 
  
    | 32 | // Setup template object, parse vars to it, then parse it
 | 
  
    | 33 | // Create new template object
 | 
  
    | 34 | $template = new Template(dirname($admin->correct_theme_source('admintools.htt')),'keep');
 | 
  
    | 35 | // $template->debug = true;
 | 
  
    | 36 | $template->set_file('page', 'admintools.htt');
 | 
  
    | 37 | $template->set_block('page', 'main_block', 'main');
 | 
  
    | 38 | $oTrans = Translate::getInstance();
 | 
  
    | 39 | $oTrans->enableAddon('admin\\admintools');
 | 
  
    | 40 | $template->set_var($oTrans->getLangArray());
 | 
  
    | 41 | // Insert required template variables
 | 
  
    | 42 | $template->set_var('ADMIN_URL', ADMIN_URL);
 | 
  
    | 43 | $template->set_var('THEME_URL', THEME_URL);
 | 
  
    | 44 | 
 | 
  
    | 45 | // Insert tools into tool list
 | 
  
    | 46 | $template->set_block('main_block', 'tool_list_block', 'tool_list');
 | 
  
    | 47 | $template->set_var('TOOL_NAME', '');
 | 
  
    | 48 | $template->set_var('tool_list', '');
 | 
  
    | 49 | $template->set_var('TOOL_DIR', '');
 | 
  
    | 50 | $template->set_var('TOOL_DESCRIPTION', '');
 | 
  
    | 51 | $template->set_var('NO_CONTENT', '');
 | 
  
    | 52 | $results = $database->query("SELECT * FROM ".TABLE_PREFIX."addons WHERE type = 'module' AND function = 'tool' order by name");
 | 
  
    | 53 | $bHasToolRights = false;
 | 
  
    | 54 | if($results->numRows() > 0) {
 | 
  
    | 55 | 	while( $tool = $results->fetchRow(MYSQL_ASSOC) ) {
 | 
  
    | 56 |         $bHasToolRights = false;
 | 
  
    | 57 | 		if( $admin->get_permission($tool['directory'],'module' ) )
 | 
  
    | 58 | 		{
 | 
  
    | 59 |             $bHasToolRights = true;
 | 
  
    | 60 | 		$template->set_var('TOOL_NAME', $tool['name']);
 | 
  
    | 61 | 			$template->set_var('TOOL_DIR', $tool['directory']);
 | 
  
    | 62 | 	// check if a module description exists for the displayed backend language
 | 
  
    | 63 | 			$tool_description = false;
 | 
  
    | 64 | 			if(function_exists('file_get_contents') && file_exists(WB_PATH.'/modules/'.$tool['directory'].'/languages/'.LANGUAGE .'.php')) {
 | 
  
    | 65 | 				// read contents of the module language file into string
 | 
  
    | 66 | 				$data = @file_get_contents(WB_PATH .'/modules/' .$tool['directory'] .'/languages/' .LANGUAGE .'.php');
 | 
  
    | 67 | 				$tool_description = get_variable_content('module_description', $data, true, false);
 | 
  
    | 68 | 			}
 | 
  
    | 69 | 			if(file_exists(WB_PATH .'/modules/' .$tool['directory'].'/tool_icon.png'))
 | 
  
    | 70 | 			{
 | 
  
    | 71 | 				$template->set_var('TOOL_ICON', WB_URL.'/modules/' .$tool['directory'].'/tool_icon.png');
 | 
  
    | 72 | 			} else {
 | 
  
    | 73 | 				$template->set_var('TOOL_ICON', THEME_URL.'/icons/admintools.png');
 | 
  
    | 74 | 			}
 | 
  
    | 75 | 			$template->set_var('TOOL_DESCRIPTION', ($tool_description === False)? $tool['description'] :$tool_description);
 | 
  
    | 76 | 			$template->parse('tool_list', 'tool_list_block', true);
 | 
  
    | 77 | 		}
 | 
  
    | 78 | 	}
 | 
  
    | 79 | 
 | 
  
    | 80 | }
 | 
  
    | 81 | 
 | 
  
    | 82 | $template->set_var('TOOL_LIST', ($bHasToolRights==false) ? $oTrans->TEXT_NONE.' '.$oTrans->TEXT_MODULE_PERMISSIONS : ' ');
 | 
  
    | 83 | 
 | 
  
    | 84 | //template->set_var('TOOL_LIST', '<li> </li>');
 | 
  
    | 85 | // Parse template objects output
 | 
  
    | 86 | $template->parse('main', 'main_block', false);
 | 
  
    | 87 | $template->pparse('output', 'page');
 | 
  
    | 88 | 
 | 
  
    | 89 | $admin->print_footer();
 |