Changeset 27369
- Timestamp:
- Feb 13, 2014, 11:21:12 PM (10 years ago)
- Location:
- trunk/include
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/calendar_base.class.php
r26865 r27369 247 247 GROUP BY period;'; 248 248 249 $level_items = simple_hash_from_query($query, 'period', 'nb_images');249 $level_items = query2array($query, 'period', 'nb_images'); 250 250 251 251 if ( count($level_items)==1 and … … 318 318 319 319 $current = implode('-', $page['chronology_date'] ); 320 $upper_items = array_from_query( $query, 'period');320 $upper_items = query2array($query,null, 'period'); 321 321 322 322 usort($upper_items, 'version_compare'); -
trunk/include/category_default.inc.php
r26461 r27369 85 85 GROUP BY image_id 86 86 ;'; 87 $nb_comments_of = simple_hash_from_query($query, 'image_id', 'nb_comments');87 $nb_comments_of = query2array($query, 'image_id', 'nb_comments'); 88 88 } 89 89 } -
trunk/include/functions.inc.php
r27336 r27369 1254 1254 function simple_hash_from_query($query, $keyname, $valuename) 1255 1255 { 1256 $array = array(); 1257 1258 $result = pwg_query($query); 1259 while ($row = pwg_db_fetch_assoc($result)) 1260 { 1261 $array[ $row[$keyname] ] = $row[$valuename]; 1262 } 1263 1264 return $array; 1256 return query2array($query, $keyname, $valuename); 1265 1257 } 1266 1258 … … 1276 1268 function hash_from_query($query, $keyname) 1277 1269 { 1278 $array = array(); 1279 $result = pwg_query($query); 1280 while ($row = pwg_db_fetch_assoc($result)) 1281 { 1282 $array[ $row[$keyname] ] = $row; 1283 } 1284 return $array; 1270 return query2array($query, $keyname); 1285 1271 } 1286 1272 … … 1297 1283 function array_from_query($query, $fieldname=false) 1298 1284 { 1299 $array = array();1300 1301 $result = pwg_query($query);1302 1285 if (false === $fieldname) 1303 1286 { 1304 while ($row = pwg_db_fetch_assoc($result)) 1305 { 1306 $array[] = $row; 1307 } 1287 return query2array($query); 1308 1288 } 1309 1289 else 1310 1290 { 1311 while ($row = pwg_db_fetch_assoc($result)) 1312 { 1313 $array[] = $row[$fieldname]; 1314 } 1315 } 1316 return $array; 1291 return query2array($query, null, $fieldname); 1292 } 1317 1293 } 1318 1294 -
trunk/include/functions_category.inc.php
r26461 r27369 206 206 WHERE id IN ('.$cat['uppercats'].') 207 207 ;'; 208 $names = hash_from_query($query, 'id');208 $names = query2array($query, 'id'); 209 209 210 210 // category names must be in the same order than uppercats list … … 303 303 $fullname = true) 304 304 { 305 $categories = array_from_query($query);305 $categories = query2array($query); 306 306 usort($categories, 'global_rank_compare'); 307 307 display_select_categories($categories, $selecteds, $blockname, $fullname); … … 363 363 WHERE permalink IN ('.$in.') 364 364 ;'; 365 $perma_hash = hash_from_query($query, 'permalink');365 $perma_hash = query2array($query, 'permalink'); 366 366 367 367 if ( empty($perma_hash) ) -
trunk/include/functions_html.inc.php
r26649 r27369 114 114 FROM '.CATEGORIES_TABLE.' 115 115 ;'; 116 $cache['cat_names'] = hash_from_query($query, 'id');116 $cache['cat_names'] = query2array($query, 'id'); 117 117 } 118 118 -
trunk/include/functions_notification.inc.php
r26461 r27369 218 218 } 219 219 $query = 'SELECT DISTINCT '.$field_id.' '.$query.';'; 220 $infos = array_from_query($query);220 $infos = query2array($query); 221 221 return $infos; 222 222 break; … … 457 457 LIMIT '.$max_dates.' 458 458 ;'; 459 $dates = array_from_query($query);459 $dates = query2array($query); 460 460 461 461 for ($i=0; $i<count($dates); $i++) … … 472 472 LIMIT '.$max_elements.' 473 473 ;'; 474 $dates[$i]['elements'] = array_from_query($query);474 $dates[$i]['elements'] = query2array($query); 475 475 } 476 476 … … 490 490 LIMIT '.$max_cats.' 491 491 ;'; 492 $dates[$i]['categories'] = array_from_query($query);492 $dates[$i]['categories'] = query2array($query); 493 493 } 494 494 }
Note: See TracChangeset
for help on using the changeset viewer.