Project

General

Profile

« Previous | Next » 

Revision 1812

Added by Dietmar about 12 years ago

  1. fixed always show "no modul rights" in admintools

View differences:

index.php
15 15
 *
16 16
 */
17 17

  
18
require('../../config.php');
19
require_once(WB_PATH.'/framework/class.admin.php');
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'); }
20 27
$admin = new admin('admintools', 'admintools');
21 28

  
22 29
// Include the WB functions file
......
37 44
// Insert tools into tool list
38 45
$template->set_block('main_block', 'tool_list_block', 'tool_list');
39 46
$template->set_var('TOOL_NAME', '');
40
$template->set_var('tool_list', $TEXT['NONE'].' '.$TEXT['MODULE_PERMISSIONS']);
47
$template->set_var('tool_list', '');
41 48
$template->set_var('TOOL_DIR', '');
42 49
$template->set_var('TOOL_DESCRIPTION', '');
43 50
$template->set_var('NO_CONTENT', '');
44

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

  
54
	while( $tool = $results->fetchRow(MYSQL_ASSOC) ) {
55
        $bHasToolRights = false;
49 56
		if( $admin->get_permission($tool['directory'],'module' ) )
50 57
		{
51
			$template->set_var('TOOL_NAME', $tool['name']);
58
            $bHasToolRights = true;
59
		$template->set_var('TOOL_NAME', $tool['name']);
52 60
			$template->set_var('TOOL_DIR', $tool['directory']);
53
// /icons/admintools.png
54
		// check if a module description exists for the displayed backend language
61
	// check if a module description exists for the displayed backend language
55 62
			$tool_description = false;
56 63
			if(function_exists('file_get_contents') && file_exists(WB_PATH.'/modules/'.$tool['directory'].'/languages/'.LANGUAGE .'.php')) {
57 64
				// read contents of the module language file into string
......
69 76
		}
70 77
	}
71 78

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

  
76
$template->set_var('TOOL_LIST', '<li>&nbsp;</li>');
81
$template->set_var('TOOL_LIST', ($bHasToolRights==false) ? $TEXT['NONE'].' '.$TEXT['MODULE_PERMISSIONS'] : '&nbsp;');
82

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

Also available in: Unified diff