Project

General

Profile

« Previous | Next » 

Revision 169

Added by ryan about 19 years ago

Fixed addon listing in numerous places so it now use's DB for info

View differences:

index.php
480 480
$module_permissions = $_SESSION['MODULE_PERMISSIONS'];
481 481
// Modules list
482 482
$template->set_block('main_block', 'module_list_block', 'module_list');
483
if($handle = opendir(WB_PATH.'/modules/')) {
484
	while (false !== ($file = readdir($handle))) {
485
		if($file != '.' AND $file != '..' AND $file != '.svn' AND is_dir(WB_PATH."/modules/$file") AND file_exists(WB_PATH."/modules/$file/info.php")) {
486
			// Include the modules info file
487
			require(WB_PATH.'/modules/'.$file.'/info.php');
488
			// Check if user is allowed to use this module
489
			if(!isset($module_type)) { $module_type = 'unknown'; }
490
			if(!is_numeric(array_search($file, $module_permissions)) AND $module_type == 'page') {
491
				$template->set_var('VALUE', $file);
492
				$template->set_var('NAME', $module_name);
493
				if($file == 'wysiwyg') {
494
					$template->set_var('SELECTED', ' selected');
495
				} else {
496
					$template->set_var('SELECTED', '');
497
				}
498
				$template->parse('module_list', 'module_list_block', true);
483
$result = $database->query("SELECT * FROM ".TABLE_PREFIX."addons WHERE type = 'module' AND function = 'page'");
484
if($result->numRows() > 0) {
485
	while ($module = $result->fetchRow()) {
486
		// Check if user is allowed to use this module
487
		if(!isset($module['function'])) { $module['function'] = 'unknown'; }
488
		if(!is_numeric(array_search($module['directory'], $module_permissions))) {
489
			$template->set_var('VALUE', $module['directory']);
490
			$template->set_var('NAME', $module['name']);
491
			if($module['directory'] == 'wysiwyg') {
492
				$template->set_var('SELECTED', ' selected');
493
			} else {
494
				$template->set_var('SELECTED', '');
499 495
			}
500
			if(isset($module_type)) { unset($module_type); } // Unset module type
496
			$template->parse('module_list', 'module_list_block', true);
501 497
		}
498
		if(isset($module_function)) { unset($module_function); } // Unset module type
502 499
	}
503 500
}
504 501

  

Also available in: Unified diff