Project

General

Profile

« Previous | Next » 

Revision 1415

Added by DarkViper almost 14 years ago

fixed unsave sql-queries in /admin/pages/settings

View differences:

settings.php
41 41
	exit();
42 42
}
43 43
*/
44

  
45 44
$sql = 'SELECT * FROM `'.TABLE_PREFIX.'pages` WHERE `page_id` = '.$page_id;
46 45
$results = $database->query($sql);
47 46
$results_array = $results->fetchRow();
......
116 115
		);
117 116

  
118 117
// Work-out if we should show the "manage sections" link
119
$sql = 'SELECT `section_id` FROM `'.TABLE_PREFIX.'sections` WHERE `page_id`='.$page_id.' AND `module`="menu_link"';
120
$query_sections = $database->query($sql);
121
if (isset($query_sections) && $query_sections->numRows() > 0)
118
$sql = 'SELECT COUNT(*) FROM `'.TABLE_PREFIX.'sections` WHERE `page_id`='.$page_id.' AND `module`="menu_link"';
119
$sections_available = (intval($database->get_one($sql)) != 0);
120
if ($sections_available)
122 121
{
123 122
    $template->set_var('DISPLAY_MANAGE_SECTIONS', 'display:none;');
124 123
} elseif(MANAGE_SECTIONS == 'enabled')
......
194 193
			$template->parse('group_list', 'group_list_block', true);
195 194
		}
196 195
	}
196

  
197 197
// Group list 2 (viewing_groups)
198 198
	$viewing_groups = explode(',', str_replace('_', '', $results_array['viewing_groups']));
199 199

  
......
471 471
$template->set_block('main_block', 'template_list_block', 'template_list');
472 472

  
473 473
$sql = 'SELECT * FROM `'.TABLE_PREFIX.'addons` WHERE `type` = "template" AND `function` = "template" order by `name`';
474
$result = $database->query($sql);
475
if (isset($result) && $result->numRows() > 0)
474
if( ($res_templates = $database->query($sql)) )
476 475
{
477
	while($addon = $result->fetchRow())
476
	while($rec_template = $res_templates->fetchRow())
478 477
    {
479 478
		// Check if the user has perms to use this template
480
		if($addon['directory'] == $results_array['template'] OR $admin->get_permission($addon['directory'], 'template') == true)
479
		if($rec_template['directory'] == $results_array['template'] OR $admin->get_permission($rec_template['directory'], 'template') == true)
481 480
        {
482
			$template->set_var('VALUE', $addon['directory']);
483
			$template->set_var('NAME', $addon['name']);
484
			if($addon['directory'] == $results_array['template'])
481
			$template->set_var('VALUE', $rec_template['directory']);
482
			$template->set_var('NAME', $rec_template['name']);
483
			if($rec_template['directory'] == $results_array['template'])
485 484
            {
486 485
				$template->set_var('SELECTED', ' selected="selected"');
487 486
			} else {
......
533 532
$template->set_block('main_block', 'language_list_block', 'language_list');
534 533

  
535 534
$sql = 'SELECT * FROM `'.TABLE_PREFIX.'addons` WHERE `type` = "language" ORDER BY `name`';
536
$result = $database->query($sql);
537
if (isset($result) && $result->numRows() > 0)
535
if( ($res_languages = $database->query($sql)) )
538 536
{
539
	while($addon = $result->fetchRow())
537
	while($rec_language = $res_languages->fetchRow())
540 538
    {
541
		$l_codes[$addon['name']] = $addon['directory'];
542
		$l_names[$addon['name']] = entities_to_7bit($addon['name']); // sorting-problem workaround
539
		$l_codes[$rec_language['name']] = $rec_language['directory'];
540
		$l_names[$rec_language['name']] = entities_to_7bit($rec_language['name']); // sorting-problem workaround
543 541
	}
544 542
	asort($l_names);
545 543
	foreach($l_names as $l_name=>$v)

Also available in: Unified diff