From c6cf57a138e968568e2aded01cdf5303f83d850c Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Wed, 29 Mar 2006 17:46:17 +0000 Subject: [PATCH] #1382 git-svn-id: file:///svn/phpbb/trunk@5756 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/functions_admin.php | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/phpBB/includes/functions_admin.php b/phpBB/includes/functions_admin.php index 240336583f..8ac13e25c1 100644 --- a/phpBB/includes/functions_admin.php +++ b/phpBB/includes/functions_admin.php @@ -25,7 +25,7 @@ function recalc_btree($sql_id, $sql_table, $module_class = '') return; } - $sql_where = ($module_class) ? " WHERE module_class = '" . $db->sql_escape($module_class) . "'" : ' WHERE 1 '; + $sql_where = ($module_class) ? " WHERE module_class = '" . $db->sql_escape($module_class) . "'" : ''; // Reset to minimum possible left and right id $sql = "SELECT MIN(left_id) as min_left_id, MIN(right_id) as min_right_id @@ -57,8 +57,8 @@ function recalc_btree($sql_id, $sql_table, $module_class = '') { $sql = "SELECT left_id, right_id FROM $sql_table - $sql_where - AND $sql_id = {$item_data['parent_id']}"; + $sql_where " . (($sql_where) ? 'AND' : 'WHERE') . " + $sql_id = {$item_data['parent_id']}"; $result = $db->sql_query($sql); if (!$row = $db->sql_fetchrow($result)) @@ -70,14 +70,14 @@ function recalc_btree($sql_id, $sql_table, $module_class = '') $sql = "UPDATE $sql_table SET left_id = left_id + 2, right_id = right_id + 2 - $sql_where - AND left_id > {$row['right_id']}"; + $sql_where " . (($sql_where) ? 'AND' : 'WHERE') . " + left_id > {$row['right_id']}"; $db->sql_query($sql); $sql = "UPDATE $sql_table SET right_id = right_id + 2 - $sql_where - AND {$row['left_id']} BETWEEN left_id AND right_id"; + $sql_where " . (($sql_where) ? 'AND' : 'WHERE') . " + {$row['left_id']} BETWEEN left_id AND right_id"; $db->sql_query($sql); $item_data['left_id'] = $row['right_id']; @@ -102,7 +102,6 @@ function recalc_btree($sql_id, $sql_table, $module_class = '') WHERE $sql_id = " . $item_data[$sql_id]; $db->sql_query($sql); } - $db->sql_freeresult($f_result); }