Project

General

Profile

« Previous | Next » 

Revision 735

Added by thorn over 16 years ago

added missing sorting to language dropdown in admin/pages/settings.php

View differences:

settings.php
36 36
require_once(WB_PATH.'/framework/class.admin.php');
37 37
$admin = new admin('Pages', 'pages_settings');
38 38

  
39
// Include the WB functions file
40
require_once(WB_PATH.'/framework/functions-utf8.php');
41

  
39 42
// Get perms
40 43
$database = new database();
41 44
$results = $database->query("SELECT * FROM ".TABLE_PREFIX."pages WHERE page_id = '$page_id'");
......
368 371
	$template->parse('menu_list', 'menu_list_block', true);
369 372
}
370 373

  
371
// Language list
372
if($handle = opendir(WB_PATH.'/languages/')) {
373
	$template->set_block('main_block', 'language_list_block', 'language_list');
374
	while (false !== ($file = readdir($handle))) {
375
		if($file != '.' AND $file != '..' AND $file != '.svn' AND $file != 'index.php') {
376
			// Include the languages info file
377
			require(WB_PATH.'/languages/'.$file);
378
			// Work-out if this language is selected
379
			if($language_code == $results_array['language']) { $selected = ' selected'; } else { $selected = ''; }
380
			// Set the language info
381
			$template->set_var(array('VALUE' => $language_code, 'SELECTED' => $selected, 'NAME' => $language_name));
382
			// Parse row
383
			$template->parse('language_list', 'language_list_block', true);
374
// Insert language values
375
$template->set_block('main_block', 'language_list_block', 'language_list');
376
$result = $database->query("SELECT * FROM ".TABLE_PREFIX."addons WHERE type = 'language' order by name");
377
if($result->numRows() > 0) {
378
	while($addon = $result->fetchRow()) {
379
		$l_codes[$addon['name']] = $addon['directory'];
380
		$l_names[$addon['name']] = entities_to_7bit($addon['name']); // sorting-problem workaround
381
	}
382
	asort($l_names);
383
	foreach($l_names as $l_name=>$v) {
384
		// Insert code and name
385
		$template->set_var(array(
386
								'VALUE' => $l_codes[$l_name],
387
								'NAME' => $l_name
388
								));
389
		// Check if it is selected
390
		if($results_array['language'] == $l_codes[$l_name]) {
391
			$template->set_var('SELECTED', ' selected');
392
		} else {
393
			$template->set_var('SELECTED', '');
384 394
		}
395
		$template->parse('language_list', 'language_list_block', true);
385 396
	}
386 397
}
387
// Restore to original language
388
require(WB_PATH.'/languages/'.LANGUAGE.'.php');
389 398

  
390 399
// Select disabled if searching is disabled
391 400
if($results_array['searching'] == 0) {
......
451 460
// Print admin footer
452 461
$admin->print_footer();
453 462

  
454
?>
463
?>

Also available in: Unified diff