Project

General

Profile

« Previous | Next » 

Revision 170

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
141 141

  
142 142
// Insert language values
143 143
$template->set_block('main_block', 'language_list_block', 'language_list');
144
if($handle = opendir(WB_PATH.'/languages/')) {
145
   while (false !== ($file = readdir($handle))) {
146
		if($file != '.' AND $file != '..' AND !is_dir($file) AND $file != 'index.php') {
147
			// Get language name
148
			require(WB_PATH.'/languages/'.$file);
149
			// Insert code and name
150
			$template->set_var(array(
151
											'CODE' => $language_code,
152
											'NAME' => $language_name
153
											)
154
									);
155
			// Check if it is selected
156
			if(DEFAULT_LANGUAGE == $language_code) {
157
				$template->set_var('SELECTED', ' selected');
158
			} else {
159
				$template->set_var('SELECTED', '');
160
			}
161
			$template->parse('language_list', 'language_list_block', true);
144
$result = $database->query("SELECT * FROM ".TABLE_PREFIX."addons WHERE type = 'language'");
145
if($result->numRows() > 0) {
146
	while ($addon = $result->fetchRow()) {
147
		// Insert code and name
148
		$template->set_var(array(
149
								'CODE' => $addon['directory'],
150
								'NAME' => $addon['name']
151
								));
152
		// Check if it is selected
153
		if(DEFAULT_LANGUAGE == $addon['directory']) {
154
			$template->set_var('SELECTED', ' selected');
155
		} else {
156
			$template->set_var('SELECTED', '');
162 157
		}
158
		$template->parse('language_list', 'language_list_block', true);
163 159
	}
164
	// Restore language to original file
165
	require(WB_PATH.'/languages/'.LANGUAGE.'.php');
166 160
}
167 161

  
168 162
// Insert default timezone values
......
222 216

  
223 217
// Insert templates
224 218
$template->set_block('main_block', 'template_list_block', 'template_list');
225
if($handle = opendir(WB_PATH.'/templates/')) {
226
	while (false !== ($file = readdir($handle))) {
227
		if($file != "." AND $file != ".." AND $file != ".svn" AND is_dir(WB_PATH."/templates/$file") AND file_exists(WB_PATH."/templates/$file/info.php")) {
228
			include(WB_PATH."/templates/$file/info.php");
229
			$template->set_var('FILE', $file);
230
			$template->set_var('NAME', $template_name);
231
			if($file == DEFAULT_TEMPLATE ? $selected = ' selected' : $selected = '');
232
			$template->set_var('SELECTED', $selected);
233
			$template->parse('template_list', 'template_list_block', true);
234
		}
219
$result = $database->query("SELECT * FROM ".TABLE_PREFIX."addons WHERE type = 'template'");
220
if($result->numRows() > 0) {
221
	while($addon = $result->fetchRow()) {
222
		$template->set_var('FILE', $addon['directory']);
223
		$template->set_var('NAME', $addon['name']);
224
		if($file == DEFAULT_TEMPLATE ? $selected = ' selected' : $selected = '');
225
		$template->set_var('SELECTED', $selected);
226
		$template->parse('template_list', 'template_list_block', true);
235 227
	}
236 228
}
237 229

  
......
581 573

  
582 574
$admin->print_footer();
583 575

  
584
?>
576
?>

Also available in: Unified diff