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
require('../../config.php');
19
require_once(WB_PATH.'/framework/class.admin.php');
20
$admin = new admin('admintools', 'admintools');
21
22
// Include the WB functions file
23
require_once(WB_PATH.'/framework/functions.php');
24
25 1529 Luisehahne
// Setup template object, parse vars to it, then parse it
26 1457 Luisehahne
// Create new template object
27 1711 Luisehahne
$template = new Template(dirname($admin->correct_theme_source('admintools.htt')),'keep');
28 1529 Luisehahne
// $template->debug = true;
29 1457 Luisehahne
$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 1711 Luisehahne
$template->set_var('TOOL_NAME', '');
40 1810 Luisehahne
$template->set_var('tool_list', $TEXT['NONE'].' '.$TEXT['MODULE_PERMISSIONS']);
41 1711 Luisehahne
$template->set_var('TOOL_DIR', '');
42
$template->set_var('TOOL_DESCRIPTION', '');
43
$template->set_var('NO_CONTENT', '');
44
45 1457 Luisehahne
$results = $database->query("SELECT * FROM ".TABLE_PREFIX."addons WHERE type = 'module' AND function = 'tool' order by name");
46
if($results->numRows() > 0) {
47 1711 Luisehahne
	while( $tool = $results->fetchRow() ) {
48
49
		if( $admin->get_permission($tool['directory'],'module' ) )
50
		{
51
			$template->set_var('TOOL_NAME', $tool['name']);
52
			$template->set_var('TOOL_DIR', $tool['directory']);
53 1679 Luisehahne
// /icons/admintools.png
54 1457 Luisehahne
		// check if a module description exists for the displayed backend language
55 1711 Luisehahne
			$tool_description = false;
56
			if(function_exists('file_get_contents') && file_exists(WB_PATH.'/modules/'.$tool['directory'].'/languages/'.LANGUAGE .'.php')) {
57
				// read contents of the module language file into string
58
				$data = @file_get_contents(WB_PATH .'/modules/' .$tool['directory'] .'/languages/' .LANGUAGE .'.php');
59
				$tool_description = get_variable_content('module_description', $data, true, false);
60
			}
61
			if(file_exists(WB_PATH .'/modules/' .$tool['directory'].'/tool_icon.png'))
62
			{
63
				$template->set_var('TOOL_ICON', WB_URL.'/modules/' .$tool['directory'].'/tool_icon.png');
64
			} else {
65
				$template->set_var('TOOL_ICON', THEME_URL.'/icons/admintools.png');
66
			}
67
			$template->set_var('TOOL_DESCRIPTION', ($tool_description === False)? $tool['description'] :$tool_description);
68
			$template->parse('tool_list', 'tool_list_block', true);
69 1679 Luisehahne
		}
70 1457 Luisehahne
	}
71 1711 Luisehahne
72 1457 Luisehahne
} else {
73 1711 Luisehahne
	$template->set_var('TOOL_LIST', $TEXT['NONE_FOUND']);
74 1457 Luisehahne
}
75
76 1711 Luisehahne
$template->set_var('TOOL_LIST', '<li>&nbsp;</li>');
77 1457 Luisehahne
// Parse template objects output
78
$template->parse('main', 'main_block', false);
79
$template->pparse('output', 'page');
80
81
$admin->print_footer();