Changeset 6596 for trunk/comments.php
- Timestamp:
- Jun 24, 2010, 8:36:24 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/comments.php
r6363 r6596 360 360 361 361 $query = ' 362 SELECT com.id AS comment_id 363 , com.image_id 364 , ic.category_id 365 , com.author 366 , com.author_id 367 , com.date 368 , com.content 369 , com.validated 362 SELECT com.id AS comment_id, 363 com.image_id, 364 com.author, 365 com.author_id, 366 com.date, 367 com.content, 368 com.validated 370 369 FROM '.IMAGE_CATEGORY_TABLE.' AS ic 371 INNERJOIN '.COMMENTS_TABLE.' AS com370 LEFT JOIN '.COMMENTS_TABLE.' AS com 372 371 ON ic.image_id = com.image_id 373 372 LEFT JOIN '.USERS_TABLE.' As u … … 375 374 WHERE '.implode(' 376 375 AND ', $page['where_clauses']).' 377 GROUP BY comment_id 376 GROUP BY comment_id, 377 com.image_id, 378 com.author, 379 com.author_id, 380 com.date, 381 com.content, 382 com.validated 378 383 ORDER BY '.$page['sort_by'].' '.$page['sort_order']; 379 384 if ('all' != $page['items_number']) … … 389 394 array_push($comments, $row); 390 395 array_push($element_ids, $row['image_id']); 391 array_push($category_ids, $row['category_id']);392 396 } 393 397 … … 409 413 // retrieving category informations 410 414 $query = ' 411 SELECT id, name, permalink, uppercats 412 FROM '.CATEGORIES_TABLE.' 413 WHERE id IN ('.implode(',', $category_ids).') 415 SELECT c.id, name, permalink, uppercats, com.id as comment_id 416 FROM '.CATEGORIES_TABLE.' AS c 417 LEFT JOIN '.IMAGE_CATEGORY_TABLE.' AS ic 418 ON c.id=ic.category_id 419 LEFT JOIN '.COMMENTS_TABLE.' AS com 420 ON ic.image_id=com.image_id 414 421 ;'; 415 $categories = hash_from_query($query, ' id');422 $categories = hash_from_query($query, 'comment_id'); 416 423 417 424 foreach ($comments as $comment) … … 432 439 $url = make_picture_url( 433 440 array( 434 'category' => $categories[ $comment['c ategory_id'] ],441 'category' => $categories[ $comment['comment_id'] ], 435 442 'image_id' => $comment['image_id'], 436 443 'image_file' => $elements[$comment['image_id']]['file'],
Note: See TracChangeset
for help on using the changeset viewer.