|
From: Paul S. O. <ps...@us...> - 2002-04-07 08:08:05
|
Update of /cvsroot/phpbb/phpBB2
In directory usw-pr-cvs1:/tmp/cvs-serv31763
Modified Files:
Tag: phpBB-2_0_0
search.php
Log Message:
Fix ordering problem for topics
Index: search.php
===================================================================
RCS file: /cvsroot/phpbb/phpBB2/search.php,v
retrieving revision 1.72
retrieving revision 1.72.2.1
diff -C2 -r1.72 -r1.72.2.1
*** search.php 31 Mar 2002 19:13:06 -0000 1.72
--- search.php 7 Apr 2002 00:41:55 -0000 1.72.2.1
***************
*** 116,124 ****
$start = ( isset($HTTP_GET_VARS['start']) ) ? intval($HTTP_GET_VARS['start']) : 0;
- //
- // Define some globally used data
- //
$sort_by_types = array($lang['Sort_Time'], $lang['Sort_Post_Subject'], $lang['Sort_Topic_Title'], $lang['Sort_Author'], $lang['Sort_Forum']);
- $sort_by_sql = array('p.post_time', 'pt.post_subject', 't.topic_title', 'u.username', 'f.forum_id');
//
--- 116,120 ----
***************
*** 447,452 ****
else if ( $search_author != '' || $search_time || $auth_sql != '' )
{
! $where_sql = ( $search_author == '' && $auth_sql == '' ) ? "post_id IN (" . implode(', ', $search_ids) . ")" : "p.post_id IN (" . implode(", ", $search_ids) . ")";
! $from_sql = ( $search_author == '' && $auth_sql == '' ) ? POSTS_TABLE : POSTS_TABLE . " p";
if ( $search_time )
--- 443,448 ----
else if ( $search_author != '' || $search_time || $auth_sql != '' )
{
! $where_sql = ( $search_author == '' && $auth_sql == '' ) ? 'post_id IN (' . implode(', ', $search_ids) . ')' : 'p.post_id IN (' . implode(', ', $search_ids) . ')';
! $from_sql = ( $search_author == '' && $auth_sql == '' ) ? POSTS_TABLE : POSTS_TABLE . ' p';
if ( $search_time )
***************
*** 641,648 ****
AND u2.user_id = p2.poster_id";
}
!
$per_page = ( $show_results == 'posts' ) ? $board_config['posts_per_page'] : $board_config['topics_per_page'];
! $sql .= " ORDER BY " . $sort_by_sql[$sort_by] . " $sort_dir LIMIT $start, " . $per_page;
if ( !$result = $db->sql_query($sql) )
--- 637,663 ----
AND u2.user_id = p2.poster_id";
}
!
$per_page = ( $show_results == 'posts' ) ? $board_config['posts_per_page'] : $board_config['topics_per_page'];
! $sql .= " ORDER BY ";
! switch ( $sort_by )
! {
! case 1:
! $sql .= ( $show_results == 'posts' ) ? 'pt.post_subject' : 't.topic_title';
! break;
! case 2:
! $sql .= 't.topic_title';
! break;
! case 3:
! $sql .= 'u.username';
! break;
! case 4:
! $sql .= 'f.forum_id';
! break;
! default:
! $sql .= ( $show_results == 'posts' ) ? 'p.post_time' : 'p2.post_time';
! break;
! }
! $sql .= " $sort_dir LIMIT $start, " . $per_page;
if ( !$result = $db->sql_query($sql) )
***************
*** 1299,1301 ****
include($phpbb_root_path . 'includes/page_tail.'.$phpEx);
! ?>
--- 1314,1316 ----
include($phpbb_root_path . 'includes/page_tail.'.$phpEx);
! ?>
\ No newline at end of file
|