Project

General

Profile

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 2098 darkviper
$oTrans = Translate::getInstance();
39
$oTrans->enableAddon('admin\\admintools');
40
$template->set_var($oTrans->getLangArray());
41 1457 Luisehahne
// 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 1711 Luisehahne
$template->set_var('TOOL_NAME', '');
48 1812 Luisehahne
$template->set_var('tool_list', '');
49 1711 Luisehahne
$template->set_var('TOOL_DIR', '');
50
$template->set_var('TOOL_DESCRIPTION', '');
51
$template->set_var('NO_CONTENT', '');
52 1457 Luisehahne
$results = $database->query("SELECT * FROM ".TABLE_PREFIX."addons WHERE type = 'module' AND function = 'tool' order by name");
53 1812 Luisehahne
$bHasToolRights = false;
54 1457 Luisehahne
if($results->numRows() > 0) {
55 1812 Luisehahne
	while( $tool = $results->fetchRow(MYSQL_ASSOC) ) {
56
        $bHasToolRights = false;
57 1711 Luisehahne
		if( $admin->get_permission($tool['directory'],'module' ) )
58
		{
59 1812 Luisehahne
            $bHasToolRights = true;
60
		$template->set_var('TOOL_NAME', $tool['name']);
61 1711 Luisehahne
			$template->set_var('TOOL_DIR', $tool['directory']);
62 1812 Luisehahne
	// check if a module description exists for the displayed backend language
63 1711 Luisehahne
			$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 1679 Luisehahne
		}
78 1457 Luisehahne
	}
79 1711 Luisehahne
80 1457 Luisehahne
}
81
82 2098 darkviper
$template->set_var('TOOL_LIST', ($bHasToolRights==false) ? $oTrans->TEXT_NONE.' '.$oTrans->TEXT_MODULE_PERMISSIONS : '&nbsp;');
83 1812 Luisehahne
84
//template->set_var('TOOL_LIST', '<li>&nbsp;</li>');
85 1457 Luisehahne
// Parse template objects output
86
$template->parse('main', 'main_block', false);
87
$template->pparse('output', 'page');
88
89
$admin->print_footer();