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:

trunk/wb/admin/templates/index.php
33 33

  
34 34
// Insert values into template list
35 35
$template->set_block('main_block', 'template_list_block', 'template_list');
36
if($handle = opendir(WB_PATH.'/templates/')) {
37
	while (false !== ($file = readdir($handle))) {
38
		if($file != "." AND $file != ".." AND $file != ".svn" AND is_dir(WB_PATH."/templates/$file") AND file_exists(WB_PATH."/templates/$file/info.php")) {
39
			// Include the templates info file
40
			require(WB_PATH.'/templates/'.$file.'/info.php');
41
			$template->set_var('VALUE', $file);
42
			$template->set_var('NAME', $template_name);
43
			$template->parse('template_list', 'template_list_block', true);
44
		}
36
$result = $database->query("SELECT * FROM ".TABLE_PREFIX."addons WHERE type = 'template'");
37
if($result->numRows() > 0) {
38
	while($addon = $result->fetchRow()) {
39
		$template->set_var('VALUE', $addon['directory']);
40
		$template->set_var('NAME', $addon['name']);
41
		$template->parse('template_list', 'template_list_block', true);
45 42
	}
46 43
}
47 44

  
trunk/wb/admin/pages/settings.php
290 290
}
291 291
// Templates list
292 292
$template->set_block('main_block', 'template_list_block', 'template_list');
293
if($handle = opendir(WB_PATH.'/templates/')) {
294
	while(false !== ($file = readdir($handle))) {
295
		if($file != "." AND $file != ".." AND $file != ".svn" AND is_dir(WB_PATH."/templates/$file") AND file_exists(WB_PATH.'/templates/'.$file.'/info.php')) {
296
			// Include the templates info file
297
			require(WB_PATH.'/templates/'.$file.'/info.php');
298
			// Check if the user has perms to use this template
299
			if($file == $results_array['template'] OR $admin->get_permission($file, 'template') == true) {
300
				$template->set_var('VALUE', $file);
301
				$template->set_var('NAME', $template_name);
302
				if($file == $results_array['template']) {
303
					$template->set_var('SELECTED', ' selected');
304
				} else {
305
					$template->set_var('SELECTED', '');
306
				}
307
				$template->parse('template_list', 'template_list_block', true);
293
$result = $database->query("SELECT * FROM ".TABLE_PREFIX."addons WHERE type = 'template'");
294
if($result->numRows() > 0) {
295
	while($addon = $result->fetchRow()) { 
296
		// Check if the user has perms to use this template
297
		if($addon['directory'] == $results_array['template'] OR $admin->get_permission($addon['directory'], 'template') == true) {
298
			$template->set_var('VALUE', $addon['directory']);
299
			$template->set_var('NAME', $addon['name']);
300
			if($addon['directory'] == $results_array['template']) {
301
				$template->set_var('SELECTED', ' selected');
302
			} else {
303
				$template->set_var('SELECTED', '');
308 304
			}
305
			$template->parse('template_list', 'template_list_block', true);
309 306
		}
310 307
	}
311
	// Unset all menu arrays
312
	unset($menu);
313 308
}
314 309

  
315 310
// Menu list
trunk/wb/admin/pages/sections_save.php
78 78
		$module_path = WB_PATH.'/modules/'.$section['module'].'/info.php';
79 79
		if(file_exists($module_path)) {
80 80
			require($module_path);
81
			if(!isset($module_type)) { $module_type = 'unknown'; }
82
			if(!is_numeric(array_search($section['module'], $module_permissions)) AND $module_type == 'page') {
81
			if(!isset($module_function)) { $module_function = 'unknown'; }
82
			if(!is_numeric(array_search($section['module'], $module_permissions)) AND $module_function == 'page') {
83 83
				// Update the section record with properties
84 84
				$section_id = $section['section_id'];
85 85
				$sql = '';
......
91 91
					}
92 92
				}
93 93
			}
94
			if(isset($module_type)) { unset($module_type); } // Unset module type
94
			if(isset($module_function)) { unset($module_function); } // Unset module type
95 95
		}
96 96
	}
97 97
}
trunk/wb/admin/pages/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

  
trunk/wb/admin/pages/sections.php
164 164
		$module_path = WB_PATH.'/modules/'.$section['module'].'/info.php';
165 165
		if(file_exists($module_path)) {
166 166
			require($module_path);
167
			if(!isset($module_type)) { $module_type = 'unknown'; }
168
			if(!is_numeric(array_search($section['module'], $module_permissions)) AND $module_type == 'page') {
167
			if(!isset($module_function)) { $module_function = 'unknown'; }
168
			if(!is_numeric(array_search($section['module'], $module_permissions)) AND $module_function == 'page') {
169 169
			?>
170 170
			<tr>
171 171
				<td style="width: 250px;"><a href="<?php echo ADMIN_URL; ?>/pages/modify.php?page_id=<?php echo $page_id; ?>#<?php echo $section['section_id']; ?>"><?php echo $module_name; ?></a></td>
......
204 204
			</tr>
205 205
			<?php
206 206
			}
207
			if(isset($module_type)) { unset($module_type); } // Unset module type
207
			if(isset($module_function)) { unset($module_function); } // Unset module type
208 208
		}
209 209
	}
210 210
	?>
......
236 236
			<select name="module" style="width: 100%;">
237 237
			<?php
238 238
			// Insert module list
239
			if($handle = opendir(WB_PATH.'/modules/')) {
240
				while (false !== ($file = readdir($handle))) {
241
					if($file != '.' AND $file != '..' AND $file != '.svn' AND $file != 'menu_link' AND is_dir(WB_PATH."/modules/$file") AND file_exists(WB_PATH."/modules/$file/info.php")) {
242
						// Include the modules info file
243
						require(WB_PATH.'/modules/'.$file.'/info.php');
244
						// Check if user is allowed to use this module
245
						if(!isset($module_type)) { $module_type = 'unknown'; }
246
						if(!is_numeric(array_search($file, $module_permissions)) AND $module_type == 'page') {
247
							?>
248
							<option value="<?php echo $file; ?>"<?php if($file == 'wysiwyg') { echo 'selected'; } ?>><?php echo $module_name; ?></option>
249
							<?php
250
						}
251
						if(isset($module_type)) { unset($module_type); } // Unset module type
252
			
239
			$result = $database->query("SELECT * FROM ".TABLE_PREFIX."addons WHERE type = 'module' AND function = 'page' AND directory != 'menu_link'");
240
			if($result->numRows() > 0) {
241
				while($module = $result->fetchRow()) {
242
					// Check if user is allowed to use this module
243
					if(!is_numeric(array_search($module['directory'], $module_permissions))) {
244
						?>
245
						<option value="<?php echo $module['directory']; ?>"<?php if($module['directory'] == 'wysiwyg') { echo 'selected'; } ?>><?php echo $module['name']; ?></option>
246
						<?php
253 247
					}
254 248
				}
255 249
			}
trunk/wb/admin/languages/index.php
35 35

  
36 36
// Insert values into language list
37 37
$template->set_block('main_block', 'language_list_block', 'language_list');
38
if ($handle = opendir(WB_PATH.'/languages/')) {
39
	while (false !== ($file = readdir($handle))) {
40
		if($file != '.' AND $file != '..' AND $file != '.svn' AND $file != 'index.php') {
41
			// Include the languages info file
42
			require(WB_PATH.'/languages/'.$file);
43
			$template->set_var('VALUE', $language_code);
44
			$template->set_var('NAME', $language_name.' ('.$language_code.')');
45
			$template->parse('language_list', 'language_list_block', true);
46
		}
38
$result = $database->query("SELECT * FROM ".TABLE_PREFIX."addons WHERE type = 'language'");
39
if($result->numRows() > 0) {
40
	while ($addon = $result->fetchRow()) {
41
		$template->set_var('VALUE', $addon['directory']);
42
		$template->set_var('NAME', $addon['name'].' ('.$addon['directory'].')');
43
		$template->parse('language_list', 'language_list_block', true);
47 44
	}
48
	// Restore language to original file
49
	require(WB_PATH.'/languages/'.LANGUAGE.'.php');
50 45
}
51 46

  
52 47
// Insert permissions values
trunk/wb/admin/modules/index.php
1 1
<?php
2 2

  
3
// $Id: index.php,v 1.2 2005/04/02 06:25:37 rdjurovich Exp $
3
// $Id$
4 4

  
5 5
/*
6 6

  
......
35 35

  
36 36
// Insert values into module list
37 37
$template->set_block('main_block', 'module_list_block', 'module_list');
38
if($handle = opendir(WB_PATH.'/modules/')) {
39
	while (false !== ($file = readdir($handle))) {
40
		if($file != "." AND $file != ".." AND $file != ".svn" AND is_dir(WB_PATH."/modules/$file") AND file_exists(WB_PATH."/modules/$file/info.php")) {
41
			// Include the modules info file
42
			require(WB_PATH.'/modules/'.$file.'/info.php');
43
			$template->set_var('VALUE', $file);
44
			$template->set_var('NAME', $module_name);
45
			$template->parse('module_list', 'module_list_block', true);
46
		}
38
$result = $database->query("SELECT * FROM ".TABLE_PREFIX."addons WHERE type = 'module'");
39
if($result->numRows() > 0) {
40
	while ($addon = $result->fetchRow()) {
41
		$template->set_var('VALUE', $addon['directory']);
42
		$template->set_var('NAME', $addon['name']);
43
		$template->parse('module_list', 'module_list_block', true);
47 44
	}
48 45
}
49 46

  

Also available in: Unified diff