phpBB/viewforum.php


Find line 49 and add the green lines
} else { $mark_read = ''; } // $sort_by is a number that maps to the array below. Note, this mod ensures that no www-data ever gets into any query // check here to see if the table alias is necessary..i dont think so, eg : t.topic_title APT simply topic_title $sort_map = array( 'topic_title', 'topic_replies', 'topic_views', 'topic_poster', 'post_time', 'user2'); $sort_direc_map = array ( 'DESC' , 'ASC' ); //if sort_by is defined, then u better have a sort_direc along with it. this is why i only check for sort_by if ( isset($HTTP_GET_VARS['sort_by']) || isset($HTTP_POST_VARS['sort_by']) ) { $sort_by = (isset($HTTP_POST_VARS['sort_by'])) ? $HTTP_POST_VARS['sort_by'] : $HTTP_GET_VARS['sort_by']; $sort_direc = (isset($HTTP_POST_VARS['sort_direc'])) ? $HTTP_POST_VARS['sort_direc'] : $HTTP_GET_VARS['sort_direc']; if (!in_array($sort_by,$sort_map)){ $sort_by ='post_time'; } if (!in_array($sort_direc,$sort_direc_map)){ $sort_direc = 'DESC'; } $sort_by = "t.topic_poster"; } else { $sort_by = 'post_time'; $sort_direc = 'DESC'; } // // End initial var setup // //

Find line 311 and delete the red lines and add the green lines
// // Grab all the basic data (all topics except announcements) // for this forum // $sql = "SELECT t.*, u.username, u.user_id, u2.username as user2, u2.user_id as id2, p.post_username, p2.post_username AS post_username2, p2.post_time FROM " . TOPICS_TABLE . " t, " . USERS_TABLE . " u, " . POSTS_TABLE . " p, " . POSTS_TABLE . " p2, " . USERS_TABLE . " u2 WHERE t.forum_id = $forum_id AND t.topic_poster = u.user_id AND p.post_id = t.topic_first_post_id AND p2.post_id = t.topic_last_post_id AND u2.user_id = p2.poster_id AND t.topic_type <> " . POST_ANNOUNCE . " $limit_topics_time ORDER BY t.topic_type DESC, t.topic_last_post_id DESC ORDER BY t.topic_type DESC, $sort_by $sort_direc LIMIT $start, ".$board_config['topics_per_page']; if ( !($result = $db->sql_query($sql)) ) { message_die(GENERAL_ERROR, 'Could not obtain topic information', '', __LINE__, __FILE__, $sql); }

Find line 393 and delete the red lines and add the green lines
$template->set_filenames(array( 'body' => 'viewforum_body.tpl') ); make_jumpbox('viewforum.'.$phpEx); $template->assign_vars(array( $template_array = array(); //for coders: $sort_map is at the top $column_headers = array( $sort_map[0], 'TOPICS', $lang['Topics'], $sort_map[1], 'REPLIES', $lang['Replies'], $sort_map[2], 'VIEWS', $lang['Views'], $sort_map[3], 'AUTHOR', $lang['Author'], $sort_map[4], 'LASTPOST', $lang['Last_Post'], $sort_map[5], 'LASTPOSTER', $lang['Last_Person_To_Post'] ); $hold = $column_headers; for($i=0;$i<count($hold);$i++) { $DBcol = $hold[$i]; $name = $hold[$i+1]; $i18n = $hold[$i+2]; $baselink = "viewforum.$phpEx?" . POST_FORUM_URL ."=$forum_id"; //the column title $template_array["L_$name"] = $i18n; //the link and colors to indicate direction of sort if($sort_by == $DBcol) { $sort_direcO = ($sort_direc == 'DESC') ? 'ASC' : 'DESC'; //this if-then-else is an ugly hack because there is a sharing of columns and its as much as im willing to do for now if($sort_by == 'user2') { $template_array["L_HEADER_COLOR_LASTPOST"] = ($sort_direc == 'DESC') ? 'hl1' : 'hl2'; } else { $template_array["L_HEADER_COLOR_$name"] = ($sort_direc == 'DESC') ? 'hl1' : 'hl2'; } $template_array["U_CHOOSE_SORT_$name"] = append_sid("$baselink"."&sort_by=$DBcol"."&sort_direc=$sort_direcO"); } else { $template_array["L_HEADER_COLOR_$name"] = 'thTop'; $template_array["U_CHOOSE_SORT_$name"] = append_sid("$baselink"."&sort_by=$DBcol"."&sort_direc=DESC"); } } $template_array = array_merge($template_array, array( 'FORUM_ID' => $forum_id, 'FORUM_NAME' => $forum_row['forum_name'], 'MODERATORS' => $forum_moderators, 'POST_IMG' => ( $forum_row['forum_status'] == FORUM_LOCKED ) ? $images['post_locked'] : $images['post_new'],

Find line 410 and delete the red lines
'FOLDER_STICKY_IMG' => $images['folder_sticky'], 'FOLDER_STICKY_NEW_IMG' => $images['folder_sticky_new'], 'FOLDER_ANNOUNCE_IMG' => $images['folder_announce'], 'FOLDER_ANNOUNCE_NEW_IMG' => $images['folder_announce_new'], 'L_TOPICS' => $lang['Topics'], 'L_REPLIES' => $lang['Replies'], 'L_VIEWS' => $lang['Views'], 'L_POSTS' => $lang['Posts'], 'L_LASTPOST' => $lang['Last_Post'], 'L_MODERATOR' => $l_moderators, 'L_MARK_TOPICS_READ' => $lang['Mark_all_topics'], 'L_POST_NEW_TOPIC' => ( $forum_row['forum_status'] == FORUM_LOCKED ) ? $lang['Forum_locked'] : $lang['Post_new_topic'], 'L_NO_NEW_POSTS' => $lang['No_new_posts'], 'L_NEW_POSTS' => $lang['New_posts'],

Find line 428 and delete the red lines and add the green lines
'L_NEW_POSTS_HOT' => $lang['New_posts_hot'], 'L_ANNOUNCEMENT' => $lang['Post_Announcement'], 'L_STICKY' => $lang['Post_Sticky'], 'L_POSTED' => $lang['Posted'], 'L_JOINED' => $lang['Joined'], 'L_AUTHOR' => $lang['Author'], 'S_AUTH_LIST' => $s_auth_can, 'U_VIEW_FORUM' => append_sid("viewforum.$phpEx?" . POST_FORUM_URL ."=$forum_id"), 'U_MARK_READ' => append_sid("viewforum.$phpEx?" . POST_FORUM_URL . "=$forum_id&mark=topics")) ); $template->assign_vars($template_array); // // End header // //

Find line 659 and delete the red lines and add the green lines
'U_VIEW_TOPIC' => $view_topic_url) ); } $template->assign_vars(array( 'PAGINATION' => generate_pagination("viewforum.$phpEx?" . POST_FORUM_URL . "=$forum_id&topicdays=$topic_days", $topics_count, $board_config['topics_per_page'], $start), 'PAGINATION' => generate_pagination("viewforum.$phpEx?" . POST_FORUM_URL . "=$forum_id&topicdays=$topic_days&sort_by=$sort_by&sort_direc=$sort_direc", $topics_count, $board_config['topics_per_page'], $start), 'PAGE_NUMBER' => sprintf($lang['Page_of'], ( floor( $start / $board_config['topics_per_page'] ) + 1 ), ceil( $topics_count / $board_config['topics_per_page'] )), 'L_GOTO_PAGE' => $lang['Goto_page']) ); }