Project

General

Profile

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 1711 2012-08-29 11:56:10Z Luisehahne $
13
 * @filesource		$HeadURL: svn://isteam.dynxs.de/wb-archiv/branches/2.8.x/wb/admin/admintools/index.php $
14
 * @lastmodified    $Date: 2012-08-29 13:56:10 +0200 (Wed, 29 Aug 2012) $
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
// 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')),'keep');
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
$template->set_var('TOOL_NAME', '');
40
$template->set_var('TOOL_DIR', '');
41
$template->set_var('TOOL_DESCRIPTION', '');
42
$template->set_var('NO_CONTENT', '');
43

    
44
$results = $database->query("SELECT * FROM ".TABLE_PREFIX."addons WHERE type = 'module' AND function = 'tool' order by name");
45
if($results->numRows() > 0) {
46
	while( $tool = $results->fetchRow() ) {
47

    
48
		if( $admin->get_permission($tool['directory'],'module' ) )
49
		{
50
			$template->set_var('TOOL_NAME', $tool['name']);
51
			$template->set_var('TOOL_DIR', $tool['directory']);
52
// /icons/admintools.png
53
		// check if a module description exists for the displayed backend language
54
			$tool_description = false;
55
			if(function_exists('file_get_contents') && file_exists(WB_PATH.'/modules/'.$tool['directory'].'/languages/'.LANGUAGE .'.php')) {
56
				// read contents of the module language file into string
57
				$data = @file_get_contents(WB_PATH .'/modules/' .$tool['directory'] .'/languages/' .LANGUAGE .'.php');
58
				$tool_description = get_variable_content('module_description', $data, true, false);
59
			}
60
			if(file_exists(WB_PATH .'/modules/' .$tool['directory'].'/tool_icon.png'))
61
			{
62
				$template->set_var('TOOL_ICON', WB_URL.'/modules/' .$tool['directory'].'/tool_icon.png');
63
			} else {
64
				$template->set_var('TOOL_ICON', THEME_URL.'/icons/admintools.png');
65
			}
66
			$template->set_var('TOOL_DESCRIPTION', ($tool_description === False)? $tool['description'] :$tool_description);
67
			$template->parse('tool_list', 'tool_list_block', true);
68
		}
69
	}
70

    
71
} else {
72
	$template->set_var('TOOL_LIST', $TEXT['NONE_FOUND']);
73
}
74

    
75
$template->set_var('TOOL_LIST', '<li>&nbsp;</li>');
76
// Parse template objects output
77
$template->parse('main', 'main_block', false);
78
$template->pparse('output', 'page');
79

    
80
$admin->print_footer();
(1-1/2)