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 2070 2014-01-03 01:21:42Z darkviper $
|
13
|
* @filesource $HeadURL: svn://isteam.dynxs.de/wb-archiv/branches/2.8.x/wb/admin/admintools/index.php $
|
14
|
* @lastmodified $Date: 2014-01-03 02:21:42 +0100 (Fri, 03 Jan 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
|
|
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
|
$template->set_var('TOOL_NAME', '');
|
47
|
$template->set_var('tool_list', '');
|
48
|
$template->set_var('TOOL_DIR', '');
|
49
|
$template->set_var('TOOL_DESCRIPTION', '');
|
50
|
$template->set_var('NO_CONTENT', '');
|
51
|
$results = $database->query("SELECT * FROM ".TABLE_PREFIX."addons WHERE type = 'module' AND function = 'tool' order by name");
|
52
|
$bHasToolRights = false;
|
53
|
if($results->numRows() > 0) {
|
54
|
while( $tool = $results->fetchRow(MYSQL_ASSOC) ) {
|
55
|
$bHasToolRights = false;
|
56
|
if( $admin->get_permission($tool['directory'],'module' ) )
|
57
|
{
|
58
|
$bHasToolRights = true;
|
59
|
$template->set_var('TOOL_NAME', $tool['name']);
|
60
|
$template->set_var('TOOL_DIR', $tool['directory']);
|
61
|
// check if a module description exists for the displayed backend language
|
62
|
$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
|
}
|
77
|
}
|
78
|
|
79
|
}
|
80
|
|
81
|
$template->set_var('TOOL_LIST', ($bHasToolRights==false) ? $TEXT['NONE'].' '.$TEXT['MODULE_PERMISSIONS'] : ' ');
|
82
|
|
83
|
//template->set_var('TOOL_LIST', '<li> </li>');
|
84
|
// Parse template objects output
|
85
|
$template->parse('main', 'main_block', false);
|
86
|
$template->pparse('output', 'page');
|
87
|
|
88
|
$admin->print_footer();
|