Changeset 6602
- Timestamp:
- Jun 24, 2010, 10:35:46 PM (14 years ago)
- Location:
- branches/2.1
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2.1/comments.php
r6364 r6602 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 370 INNER JOIN '.COMMENTS_TABLE.' AS com … … 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 421 '.get_sql_condition_FandF 422 ( 423 array 424 ( 425 'forbidden_categories' => 'c.id', 426 'visible_categories' => 'c.id' 427 ), 428 'WHERE' 429 ).' 414 430 ;'; 415 $categories = hash_from_query($query, ' id');431 $categories = hash_from_query($query, 'comment_id'); 416 432 417 433 foreach ($comments as $comment) … … 432 448 $url = make_picture_url( 433 449 array( 434 'category' => $categories[ $comment['c ategory_id'] ],450 'category' => $categories[ $comment['comment_id'] ], 435 451 'image_id' => $comment['image_id'], 436 452 'image_file' => $elements[$comment['image_id']]['file'], -
branches/2.1/include/functions_comment.inc.php
r6590 r6602 134 134 if ($comment_action!='reject' and $conf['anti-flood_time']>0 ) 135 135 { // anti-flood system 136 $reference_date = time() - $conf['anti-flood_time'];136 $reference_date = date('c', time() - $conf['anti-flood_time']); 137 137 $query = ' 138 138 SELECT id FROM '.COMMENTS_TABLE.' 139 WHERE date > FROM_UNIXTIME('.$reference_date.')139 WHERE date > \''.$reference_date.'\' 140 140 AND author_id = '.$comm['author_id']; 141 141 if ( pwg_db_num_rows( pwg_query( $query ) ) > 0 )
Note: See TracChangeset
for help on using the changeset viewer.