Changeset 1861 for trunk/include/functions_category.inc.php
- Timestamp:
- Feb 27, 2007, 2:56:16 AM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/functions_category.inc.php
r1854 r1861 78 78 if (isset($page['category'])) 79 79 { 80 $query.= ' OR id_uppercat IN ('.$page[' uppercats'].')';80 $query.= ' OR id_uppercat IN ('.$page['category']['uppercats'].')'; 81 81 } 82 82 $query.= ')'; … … 112 112 } 113 113 114 return get_html_menu_category($cats );114 return get_html_menu_category($cats, @$page['category'] ); 115 115 } 116 116 … … 135 135 function get_cat_info( $id ) 136 136 { 137 $infos = array('nb_images','id_uppercat','comment','site_id'138 ,'dir','date_last','uploadable','status','visible'139 ,'representative_picture_id','uppercats','commentable'140 ,'image_order');141 142 137 $query = ' 143 SELECT '.implode(',', $infos).'138 SELECT * 144 139 FROM '.CATEGORIES_TABLE.' 145 140 WHERE id = '.$id.' 146 141 ;'; 147 $ row = mysql_fetch_array(pwg_query($query));148 if (empty($ row))142 $cat = mysql_fetch_assoc(pwg_query($query)); 143 if (empty($cat)) 149 144 return null; 150 145 151 $cat = array(); 152 foreach ($infos as $info) 153 { 154 if (isset($row[$info])) 155 { 156 $cat[$info] = $row[$info]; 157 } 158 else 159 { 160 $cat[$info] = ''; 161 } 146 foreach ($cat as $k => $v) 147 { 162 148 // If the field is true or false, the variable is transformed into a 163 149 // boolean value. 164 if ($cat[$ info] == 'true' or $cat[$info] == 'false')165 { 166 $cat[$ info] = get_boolean( $cat[$info] );150 if ($cat[$k] == 'true' or $cat[$k] == 'false') 151 { 152 $cat[$k] = get_boolean( $cat[$k] ); 167 153 } 168 154 } … … 171 157 preg_match('/<(div|br|img|script).*>/i', $cat['comment']) ) ) 172 158 { 173 $cat['comment'] = nl2br( $cat['comment']);159 $cat['comment'] = nl2br(@$cat['comment']); 174 160 } 175 161 176 162 $names = array(); 177 163 $query = ' 178 SELECT name,id164 SELECT id, name 179 165 FROM '.CATEGORIES_TABLE.' 180 166 WHERE id IN ('.$cat['uppercats'].') 181 167 ;'; 182 168 $result = pwg_query($query); 183 while($row = mysql_fetch_a rray($result))184 { 185 $names[$row['id']] = $row ['name'];169 while($row = mysql_fetch_assoc($result)) 170 { 171 $names[$row['id']] = $row; 186 172 } 187 173 188 174 // category names must be in the same order than uppercats list 189 $cat[' name'] = array();175 $cat['upper_names'] = array(); 190 176 foreach (explode(',', $cat['uppercats']) as $cat_id) 191 177 { 192 $cat[' name'][$cat_id] = $names[$cat_id];178 $cat['upper_names'][$cat_id] = $names[$cat_id]; 193 179 } 194 180 … … 346 332 foreach ($ids as $num => $category_id) 347 333 { 334 is_numeric($category_id) 335 or trigger_error( 336 'get_subcat_ids expecting numeric, not '.gettype($category_id), 337 E_USER_WARNING 338 ); 348 339 if ($num > 0) 349 340 {
Note: See TracChangeset
for help on using the changeset viewer.