diff options
Diffstat (limited to 'phpBB')
-rw-r--r-- | phpBB/db/mysql_basic.sql | 2 | ||||
-rw-r--r-- | phpBB/db/mysql_schema.sql | 21 | ||||
-rw-r--r-- | phpBB/db/postgres_schema.sql | 13 | ||||
-rw-r--r-- | phpBB/includes/constants.php | 7 | ||||
-rwxr-xr-x | phpBB/language/lang_english.php | 5 | ||||
-rw-r--r-- | phpBB/posting.php | 99 | ||||
-rw-r--r-- | phpBB/templates/Default/viewforum_body.tpl | 2 | ||||
-rw-r--r-- | phpBB/templates/PSO/posting_body.tpl | 2 | ||||
-rw-r--r-- | phpBB/templates/PSO/viewforum_body.tpl | 4 | ||||
-rw-r--r-- | phpBB/viewforum.php | 134 | ||||
-rw-r--r-- | phpBB/viewtopic.php | 16 |
11 files changed, 195 insertions, 110 deletions
diff --git a/phpBB/db/mysql_basic.sql b/phpBB/db/mysql_basic.sql index 1299c3611b..77792733f8 100644 --- a/phpBB/db/mysql_basic.sql +++ b/phpBB/db/mysql_basic.sql @@ -38,7 +38,7 @@ INSERT INTO phpbb_auth_forums (forum_id, auth_view, auth_read, auth_post, auth_r INSERT INTO phpbb_auth_access (group_id, forum_id, auth_view, auth_read, auth_post, auth_reply, auth_edit, auth_delete, auth_announce, auth_sticky, auth_votecreate, auth_vote, auth_mod) VALUES (2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1); # -- Demo Topic -INSERT INTO phpbb_topics VALUES(1, 1, 'Demo Topic', 1, NOW(), 0, 0, 0, 0, 1); +INSERT INTO phpbb_topics VALUES(1, 1, 'Demo Topic', 1, NOW(), 0, 0, 0, 0, 0, 1); # -- Demo Post INSERT INTO phpbb_posts VALUES(1, 1, 1, 1, NOW(), '127.0.0.1' , LEFT(MD5('42'), 10)); diff --git a/phpBB/db/mysql_schema.sql b/phpBB/db/mysql_schema.sql index fb2897a4aa..bf6ea64c2c 100644 --- a/phpBB/db/mysql_schema.sql +++ b/phpBB/db/mysql_schema.sql @@ -18,10 +18,10 @@ CREATE TABLE phpbb_auth_access ( auth_reply tinyint(1) DEFAULT '0' NOT NULL, auth_edit tinyint(1) DEFAULT '0' NOT NULL, auth_delete tinyint(1) DEFAULT '0' NOT NULL, - auth_announce tinyint(1) DEFAULT '0' NOT NULL, - auth_sticky tinyint(1) DEFAULT '0' NOT NULL, - auth_votecreate tinyint(1) DEFAULT '0' NOT NULL, - auth_attachments tinyint(1) DEFAULT '0' NOT NULL, + auth_announce tinyint(1) DEFAULT '0' NOT NULL, + auth_sticky tinyint(1) DEFAULT '0' NOT NULL, + auth_votecreate tinyint(1) DEFAULT '0' NOT NULL, + auth_attachments tinyint(1) DEFAULT '0' NOT NULL, auth_vote tinyint(1) DEFAULT '0' NOT NULL, auth_mod tinyint(1) DEFAULT '0' NOT NULL, auth_admin tinyint(1) DEFAULT '0' NOT NULL @@ -40,10 +40,10 @@ CREATE TABLE phpbb_auth_forums ( auth_reply tinyint(4) DEFAULT '0' NOT NULL, auth_edit tinyint(4) DEFAULT '0' NOT NULL, auth_delete tinyint(4) DEFAULT '0' NOT NULL, - auth_announce tinyint(4) DEFAULT '0' NOT NULL, - auth_sticky tinyint(4) DEFAULT '0' NOT NULL, + auth_announce tinyint(4) DEFAULT '0' NOT NULL, + auth_sticky tinyint(4) DEFAULT '0' NOT NULL, auth_votecreate tinyint(4) DEFAULT '0' NOT NULL, - auth_vote tinyint(4) DEFAULT '0' NOT NULL, + auth_vote tinyint(4) DEFAULT '0' NOT NULL, auth_attachments tinyint(4) DEFAULT '0' NOT NULL ); @@ -125,7 +125,7 @@ CREATE TABLE phpbb_config ( email_from varchar(100), flood_interval int(4) NOT NULL, avatar_filesize int(11) DEFAULT '6144' NOT NULL, - avatar_path varchar(255) DEFAULT 'images/avatars' NOT NULL, + avatar_path varchar(255) DEFAULT 'images/avatars' NOT NULL, default_theme int(11) DEFAULT '1' NOT NULL, default_lang varchar(255), default_dateformat varchar(14) DEFAULT 'd M Y H:i' NOT NULL, @@ -273,8 +273,8 @@ CREATE TABLE phpbb_session ( session_id char(32) DEFAULT '' NOT NULL, session_user_id int(11) DEFAULT '0' NOT NULL, session_start int(11) DEFAULT '0' NOT NULL, - session_time int(11) DEFAULT '0' NOT NULL, - session_last_visit int(11) DEFAULT '0' NOT NULL, + session_time int(11) DEFAULT '0' NOT NULL, + session_last_visit int(11) DEFAULT '0' NOT NULL, session_ip char(8) DEFAULT '0' NOT NULL, session_page int(11) DEFAULT '0' NOT NULL, session_logged_in tinyint(1) DEFAULT '0' NOT NULL, @@ -407,6 +407,7 @@ CREATE TABLE phpbb_topics ( topic_views int(10) DEFAULT '0' NOT NULL, topic_replies int(11) DEFAULT '0' NOT NULL, topic_status tinyint(3) DEFAULT '0' NOT NULL, + topic_type tinyint(3) DEFAULT '0' NOT NULL, topic_notify tinyint(3) DEFAULT '0', topic_last_post_id int(11) DEFAULT '0' NOT NULL, PRIMARY KEY (topic_id), diff --git a/phpBB/db/postgres_schema.sql b/phpBB/db/postgres_schema.sql index 5863deac54..06e79697af 100644 --- a/phpBB/db/postgres_schema.sql +++ b/phpBB/db/postgres_schema.sql @@ -34,7 +34,7 @@ CREATE TABLE phpbb_auth_forums ( auth_announce int2 DEFAULT '0' NOT NULL, auth_sticky int2 DEFAULT '0' NOT NULL, auth_votecreate int2 DEFAULT '0' NOT NULL, - auth_vote int2 DEFAULT '0' NOT NULL, + auth_vote int2 DEFAULT '0' NOT NULL, auth_attachments int2 DEFAULT '0' NOT NULL ); @@ -53,8 +53,8 @@ CREATE TABLE phpbb_auth_access ( auth_delete int2 DEFAULT '0' NOT NULL, auth_announce int2 DEFAULT '0' NOT NULL, auth_sticky int2 DEFAULT '0' NOT NULL, - auth_votecreate int2 DEFAULT '0' NOT NULL, - auth_attachments int2 DEFAULT '0' NOT NULL, + auth_votecreate int2 DEFAULT '0' NOT NULL, + auth_attachments int2 DEFAULT '0' NOT NULL, auth_vote int2 DEFAULT '0' NOT NULL, auth_mod int2 DEFAULT '0' NOT NULL, auth_admin int2 DEFAULT '0' NOT NULL @@ -141,7 +141,7 @@ CREATE TABLE phpbb_config ( system_timezone int4 NOT NULL, sys_template varchar(50) NOT NULL, avatar_filesize int4 DEFAULT '6144' NOT NULL, - avatar_path varchar(255) DEFAULT 'images/avatars' NOT NULL, + avatar_path varchar(255) DEFAULT 'images/avatars' NOT NULL, override_themes int2 NOT NULL, flood_interval int NOT NULL, selected int2 NOT NULL, @@ -286,8 +286,8 @@ CREATE TABLE phpbb_session ( session_id char(32) DEFAULT '0' NOT NULL, session_user_id int4 DEFAULT '0' NOT NULL, session_start int4 DEFAULT '0' NOT NULL, - session_time int4 DEFAULT '0' NOT NULL, - session_last_visit int4 DEFAULT '0' NOT NULL, + session_time int4 DEFAULT '0' NOT NULL, + session_last_visit int4 DEFAULT '0' NOT NULL, session_ip char(8) DEFAULT '0' NOT NULL, session_page int4 DEFAULT '0' NOT NULL, session_logged_in int2 DEFAULT '0' NOT NULL, @@ -404,6 +404,7 @@ CREATE TABLE phpbb_topics ( topic_replies int4 DEFAULT '0' NOT NULL, forum_id int4 DEFAULT '0' NOT NULL, topic_status int2 DEFAULT '0' NOT NULL, + topic_type int2 DEFAULT '0' NOT NULL, topic_notify int2 DEFAULT '0', topic_last_post_id int4 DEFAULT '0' NOT NULL, CONSTRAINT phpbb_topics_pkey PRIMARY KEY (topic_id) diff --git a/phpBB/includes/constants.php b/phpBB/includes/constants.php index 5f82d4f2a8..5dbe9960f7 100644 --- a/phpBB/includes/constants.php +++ b/phpBB/includes/constants.php @@ -40,6 +40,13 @@ define(ADMIN, 1); define(UNLOCKED, 0); define(LOCKED, 1); +// Topic types +define(NORMAL, 0); +define(STICKY, 1); +define(ANNOUCE, 2); +define(GLOB_ANNOUNCE, 3); + + // Ban time types define(SECONDS, 1); define(MINUTES, 2); diff --git a/phpBB/language/lang_english.php b/phpBB/language/lang_english.php index 44e6322d13..18d057c021 100755 --- a/phpBB/language/lang_english.php +++ b/phpBB/language/lang_english.php @@ -126,6 +126,8 @@ $lang['Forum_Index'] = "Forum Index"; // // Viewforum // +$lang['Annoucement'] = "<b>Annoucement:</b>"; +$lang['Sticky'] = "<b>Sticky:</b>"; // // Viewtopic @@ -140,6 +142,9 @@ $lang['Empty_subj'] = "You must specifiy a subject when posting a new topic."; $lang['Empty_msg'] = "You must enter a message when posting!"; $lang['Postnew'] = "Post New Topic"; $lang['Post_new_in'] = "Post New Topic in:"; // Followed by forum name +$lang['Post_Annoucement'] = "Post as an annoucement"; +$lang['Post_Sticky'] = "Stick this topic"; +$lang['Annouce_and_sticky'] = "You cannot post a topic that is both an annoucement and a sticky topic"; // diff --git a/phpBB/posting.php b/phpBB/posting.php index d998720ca4..d52e238c10 100644 --- a/phpBB/posting.php +++ b/phpBB/posting.php @@ -90,11 +90,27 @@ init_userprefs($userdata); switch($mode) { case 'newtopic': - $auth_type = AUTH_POST; - $is_auth_type = "auth_post"; - $error_string = "post new topics"; + if(isset($HTTP_POST_VARS['annouce'])) + { + $auth_type = AUTH_ANNOUCE; + $is_auth_type = "auth_announce"; + $error_string = "post annoucements"; + } + else if(isset($HTTP_POST_VARS['sticky'])) + { + $auth_type = AUTH_STICKY; + $is_auth_type = "auth_sticky"; + $error_string = "post sticky topics"; + } + else + { + $auth_type = AUTH_ALL; + $is_auth_type = "auth_post"; + $error_string = "post new topics"; + } break; case 'reply': + $auth_type = AUTH_REPLY; $is_auth_type = "auth_reply"; $error_string = "reply to topics"; @@ -110,8 +126,8 @@ switch($mode) $error_string = "delete topics"; break; default: - $auth_type = AUTH_POST; - $is_auth_type = "auth_post"; + $auth_type = AUTH_ALL; + $is_auth_type = "auth_all"; $error_string = "post new topics"; break; } @@ -153,6 +169,21 @@ $disable_bbcode = (isset($HTTP_POST_VARS['disable_bbcode'])) ? $HTTP_POST_VARS[' $disable_smilies = (isset($HTTP_POST_VARS['disable_smile'])) ? $HTTP_POST_VARS['disable_smile'] : !$userdata['user_allowsmile']; $attach_sig = (isset($HTTP_POST_VARS['attach_sig'])) ? $HTTP_POST_VARS['attach_sig'] : $userdata['user_attachsig']; $notify = (isset($HTTP_POST_VARS['notify'])) ? $HTTP_POST_VARS['notify'] : $userdata["always_notify"]; +$annouce = (isset($HTTP_POST_VARS['annouce'])) ? $HTTP_POST_VARS['annouce'] : ""; +$sticky = (isset($HTTP_POST_VARS['sticky'])) ? $HTTP_POST_VARS['sticky'] : ""; + +if($annouce) +{ + $topic_type = ANNOUCE; +} +else if($sticky) +{ + $topic_type = STICKY; +} +else +{ + $topic_type = NORMAL; +} // // Prepare our message and subject on a 'submit' @@ -195,6 +226,17 @@ if(isset($HTTP_POST_VARS['submit'])) $error_msg .= $lang['Empty_subj']; } + // You can't make it both an annoumcement and a stick topic + if($annouce && $sticky) + { + $error = TRUE; + if(isset($error_msg)) + { + $error_msg .= "<br />"; + } + $error_msg .= $lang['Annouce_and_sticky']; + } + if(!empty($HTTP_POST_VARS['message'])) { if(!$error) @@ -274,8 +316,8 @@ switch($mode) { $topic_time = get_gmt_ts(); $topic_notify = ($HTTP_POST_VARS['notify']) ? $HTTP_POST_VARS['notify'] : 0; - $sql = "INSERT INTO ".TOPICS_TABLE." (topic_title, topic_poster, topic_time, forum_id, topic_notify, topic_status) - VALUES ('$subject', ".$userdata['user_id'].", ".$topic_time.", $forum_id, $topic_notify, ".UNLOCKED.")"; + $sql = "INSERT INTO ".TOPICS_TABLE." (topic_title, topic_poster, topic_time, forum_id, topic_notify, topic_status, topic_type) + VALUES ('$subject', ".$userdata['user_id'].", ".$topic_time.", $forum_id, $topic_notify, ".UNLOCKED.", ".$topic_type.")"; if($db->sql_query($sql)) { @@ -807,20 +849,6 @@ if($error) } $forum_info = $db->sql_fetchrow($result); $forum_name = stripslashes($forum_info['forum_name']); - $forum_access = $forum_info['forum_access']; - - if($forum_access == ANONALLOWED) - { - $about_posting = "$l_anonusers $l_inthisforum $l_anonhint"; - } - if($forum_access == REGONLY) - { - $about_posting = "$l_regusers $l_inthisforum"; - } - if($forum_access == MODONLY) - { - $about_posting = "$l_modusers $l_inthisforum"; - } $template->set_filenames(array( "body" => "posting_body.tpl", @@ -905,6 +933,31 @@ if($error) } $sig_toggle .= "> $l_attachsig"; + if($mode == 'newtopic') + { + if($is_auth['auth_announce']) + { + $annouce_toggle = '<input type="checkbox" name="annouce" '; + if($annouce) + { + $announce_toggle .= "checked"; + } + $annouce_toggle .= '> '.$lang['Post_Annoucement']; + } + + + if($is_auth['auth_sticky']) + { + $sticky_toggle = '<input type="checkbox" name="sticky" '; + if($sticky) + { + $sticky_toggle .= "checked"; + } + $sticky_toggle .= '> '.$lang['Post_Sticky']; + } + } + + if($mode == 'newtopic' || ($mode == 'editpost' && $notify)) { $notify_toggle = '<input type="checkbox" name="notify" '; @@ -923,7 +976,6 @@ if($error) $hidden_form_fields = "<input type=\"hidden\" name=\"mode\" value=\"$mode\"><input type=\"hidden\" name=\"".POST_FORUM_URL."\" value=\"$forum_id\"><input type=\"hidden\" name=\"".POST_TOPIC_URL."\" value=\"$topic_id\"><input type=\"hidden\" name=\"".POST_POST_URL."\" value=\"$post_id\">"; $template->assign_vars(array( - "L_ABOUT_POST" => $l_aboutpost, "L_SUBJECT" => $l_subject, "L_MESSAGE_BODY" => $l_body, "L_OPTIONS" => $l_options, @@ -931,7 +983,6 @@ if($error) "L_SUBMIT" => $l_submit, "L_CANCEL" => $l_cancelpost, - "ABOUT_POSTING" => $about_posting, "USERNAME_INPUT" => $username_input, "PASSWORD_INPUT" => $password_input, "SUBJECT_INPUT" => $subject_input, @@ -940,6 +991,8 @@ if($error) "HTML_TOGGLE" => $html_toggle, "SMILE_TOGGLE" => $smile_toggle, "SIG_TOGGLE" => $sig_toggle, + "ANNOUNCE_TOGGLE" => $annouce_toggle, + "STICKY_TOGGLE" => $sticky_toggle, "NOTIFY_TOGGLE" => $notify_toggle, "BBCODE_TOGGLE" => $bbcode_toggle, "BBCODE_STATUS" => $bbcode_status, diff --git a/phpBB/templates/Default/viewforum_body.tpl b/phpBB/templates/Default/viewforum_body.tpl index f96cf44cd6..38b68b1528 100644 --- a/phpBB/templates/Default/viewforum_body.tpl +++ b/phpBB/templates/Default/viewforum_body.tpl @@ -42,7 +42,7 @@ <!-- BEGIN topicrow --> <tr bgcolor="#DDDDDD" class="tablebody"> <td width="5%" align="center" valign="middle">{topicrow.FOLDER}</td> - <td><a href="{topicrow.U_VIEW_TOPIC}">{topicrow.TOPIC_TITLE}</a> {topicrow.GOTO_PAGE}</td> + <td>{topicrow.TOPIC_TYPE}<a href="{topicrow.U_VIEW_TOPIC}">{topicrow.TOPIC_TITLE}</a> {topicrow.GOTO_PAGE}</td> <td width="5%" align="center" valign="middle">{topicrow.REPLIES}</td> <td width="10%" align="center" valign="middle">{topicrow.TOPIC_POSTER}</td> <td width="5%" align="center" valign="middle">{topicrow.VIEWS}</td> diff --git a/phpBB/templates/PSO/posting_body.tpl b/phpBB/templates/PSO/posting_body.tpl index 90315a84f4..3c3c655eab 100644 --- a/phpBB/templates/PSO/posting_body.tpl +++ b/phpBB/templates/PSO/posting_body.tpl @@ -34,7 +34,7 @@ function insertCode(formObj, selectObj){ </tr> <tr> <td bgcolor="{T_TD_COLOR1}"><font face="{T_FONTFACE1}" size="{T_FONTSIZE2}"><b>{L_OPTIONS}</b></font></td> - <td bgcolor="{T_TD_COLOR2}"><font face="{T_FONTFACE1}" size="{T_FONTSIZE2}">{HTML_TOGGLE}<br>{BBCODE_TOGGLE}<br>{SMILE_TOGGLE}<br>{SIG_TOGGLE}<br>{NOTIFY_TOGGLE}</font></td> + <td bgcolor="{T_TD_COLOR2}"><font face="{T_FONTFACE1}" size="{T_FONTSIZE2}">{HTML_TOGGLE}<br>{BBCODE_TOGGLE}<br>{SMILE_TOGGLE}<br>{SIG_TOGGLE}<br>{STICKY_TOGGLE}<br>{ANNOUNCE_TOGGLE}<br>{NOTIFY_TOGGLE}</font></td> </tr> <tr> <td colspan="2" bgcolor="{T_TH_COLOR3}" align="center">{S_HIDDEN_FORM_FIELDS}<input type="submit" name="preview" value="{L_PREVIEW}"> <input type="submit" name="submit" value="{L_SUBMIT}"> <input type="submit" name="cancel" value="{L_CANCEL}"></td> diff --git a/phpBB/templates/PSO/viewforum_body.tpl b/phpBB/templates/PSO/viewforum_body.tpl index e5c77151e4..6b13e633b0 100644 --- a/phpBB/templates/PSO/viewforum_body.tpl +++ b/phpBB/templates/PSO/viewforum_body.tpl @@ -22,12 +22,12 @@ <td width="8%" bgcolor="{T_TH_COLOR3}" align="center"><font face="{T_FONTFACE2}" size="{T_FONTSIZE2}"><b>{L_REPLIES}</b></font></td> <td width="20%" bgcolor="{T_TH_COLOR3}" align="center"><font face="{T_FONTFACE2}" size="{T_FONTSIZE2}"><b> {L_AUTHOR}</b></font></td> <td width="6%" bgcolor="{T_TH_COLOR3}" align="center"><font face="{T_FONTFACE2}" size="{T_FONTSIZE2}"><b>{L_VIEWS}</b></font></td> - <td width="17%" bgcolor="{T_TH_COLOR3}" align="center"><font face="{T_FONTFACE2}" size="{T_FONTSIZE2}"><b>{L_LASTPOST}</b></font></td> + <td width="17%" bgcolor="{T_TH_COLOR3}" align="center"><font face="{T_FONTFACE2}" size="{T_FONTSIZE2}"><b>{L_LASTPOST}</b></font></td> </tr> <!-- BEGIN topicrow --> <tr> <td bgcolor="{T_TD_COLOR1}" align="center" valign="middle"> {topicrow.FOLDER} </td> - <td bgcolor="{T_TD_COLOR2}"><font face="{T_FONTFACE1}" size="{T_FONTSIZE1}"> <a href="{topicrow.U_VIEW_TOPIC}">{topicrow.TOPIC_TITLE}</a> {topicrow.GOTO_PAGE}</td> + <td bgcolor="{T_TD_COLOR2}"><font face="{T_FONTFACE1}" size="{T_FONTSIZE1}"> {topicrow.TOPIC_TYPE}<a href="{topicrow.U_VIEW_TOPIC}">{topicrow.TOPIC_TITLE}</a> {topicrow.GOTO_PAGE}</td> <td bgcolor="{T_TD_COLOR1}" align="center" valign="middle"><font face="{T_FONTFACE1}" size="{T_FONTSIZE2}">{topicrow.REPLIES}</font></td> <td bgcolor="{T_TD_COLOR2}" align="center" valign="middle"><font face="{T_FONTFACE1}" size="{T_FONTSIZE2}"><a href="{topicrow.U_TOPIC_POSTER_PROFILE}">{topicrow.TOPIC_POSTER}</a></font></td> <td bgcolor="{T_TD_COLOR1}" align="center" valign="middle"><font face="{T_FONTFACE1}" size="{T_FONTSIZE2}">{topicrow.VIEWS}</font></td> diff --git a/phpBB/viewforum.php b/phpBB/viewforum.php index f3296fc73a..64f24c85fc 100644 --- a/phpBB/viewforum.php +++ b/phpBB/viewforum.php @@ -1,26 +1,26 @@ <?php -/*************************************************************************** - * - * ------------------- - * begin : Saturday, Feb 13, 2001 - * copyright : (C) 2001 The phpBB Group - * email : support@phpbb.com - * +/*************************************************************************** + * + * ------------------- + * begin : Saturday, Feb 13, 2001 + * copyright : (C) 2001 The phpBB Group + * email : support@phpbb.com + * * $Id$ - * - * - ***************************************************************************/ - - -/*************************************************************************** - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * - ***************************************************************************/ + * + * + ***************************************************************************/ + + +/*************************************************************************** + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * + ***************************************************************************/ include('extension.inc'); include('common.'.$phpEx); @@ -57,24 +57,24 @@ init_userprefs($userdata); if(isset($forum_id)) { /* - $sql = "SELECT f.forum_name, f.forum_topics, f.auth_view, f.auth_read, f.auth_post, f.auth_reply, f.auth_edit, f.auth_delete, f.auth_votecreate, f.auth_vote, u.username, u.user_id - FROM ".FORUMS_TABLE." f, ".USERS_TABLE." u, ".USER_GROUP_TABLE." ug, ".AUTH_ACCESS_TABLE." aa + $sql = "SELECT f.forum_name, f.forum_topics, f.auth_view, f.auth_read, f.auth_post, f.auth_reply, f.auth_edit, f.auth_delete, f.auth_votecreate, f.auth_vote, u.username, u.user_id + FROM ".FORUMS_TABLE." f, ".USERS_TABLE." u, ".USER_GROUP_TABLE." ug, ".AUTH_ACCESS_TABLE." aa WHERE f.forum_id = $forum_id - AND aa.auth_mod = 1 - AND aa.forum_id = f.forum_id - AND ug.group_id = aa.group_id + AND aa.auth_mod = 1 + AND aa.forum_id = f.forum_id + AND ug.group_id = aa.group_id AND u.user_id = ug.user_id"; */ - $sql = "SELECT f.forum_name, f.forum_topics, u.username, u.user_id, fa.* - FROM ".FORUMS_TABLE." f, ".USERS_TABLE." u, ".USER_GROUP_TABLE." ug, ".AUTH_ACCESS_TABLE." aa, ".AUTH_FORUMS_TABLE." fa + $sql = "SELECT f.forum_name, f.forum_topics, u.username, u.user_id, fa.* + FROM ".FORUMS_TABLE." f, ".USERS_TABLE." u, ".USER_GROUP_TABLE." ug, ".AUTH_ACCESS_TABLE." aa, ".AUTH_FORUMS_TABLE." fa WHERE f.forum_id = $forum_id AND fa.forum_id = f.forum_id - AND aa.auth_mod = 1 - AND aa.forum_id = f.forum_id - AND ug.group_id = aa.group_id + AND aa.auth_mod = 1 + AND aa.forum_id = f.forum_id + AND ug.group_id = aa.group_id AND u.user_id = ug.user_id"; } -else +else { error_die(GENERAL_ERROR, "You have reached this page in error, please go back and try again"); } @@ -83,9 +83,9 @@ if(!$result = $db->sql_query($sql)) { error_die(SQL_QUERY, "Couldn't obtain forums information.", __LINE__, __FILE__); } -// If the query doesn't return any rows this +// If the query doesn't return any rows this // isn't a valid forum. Inform the user. -if(!$total_rows = $db->sql_numrows($result)) +if(!$total_rows = $db->sql_numrows($result)) { error_die(GENERAL_ERROR, "The forum you selected does not exist. Please go back and try again."); } @@ -108,7 +108,7 @@ if(!$is_auth['auth_read'] || !$is_auth['auth_view']) // to read this forum ... // include('includes/page_header.'.$phpEx); - + $msg = "I am sorry but only " . $is_auth['auth_read_type'] . " can read this forum."; $template->set_filenames(array( @@ -135,16 +135,16 @@ for($x = 0; $x < $db->sql_numrows($result); $x++) { if($x > 0) $forum_moderators .= ", "; - + $forum_moderators .= "<a href=\"".append_sid("profile.$phpEx?mode=viewprofile&".POST_USERS_URL."=".$forum_row[$x]['user_id'])."\">".$forum_row[$x]['username']."</a>"; } // // Generate a 'Show posts in previous x days' -// select box. If the postdays var is POSTed -// then get it's value, find the number of topics -// with dates newer than it (to properly handle +// select box. If the postdays var is POSTed +// then get it's value, find the number of topics +// with dates newer than it (to properly handle // pagination) and alter the main query // $previous_days = array(0, 1, 7, 14, 30, 60, 180, 364); @@ -156,9 +156,9 @@ if(!empty($HTTP_POST_VARS['postdays']) || !empty($HTTP_GET_VARS['postdays'])) $post_days = (!empty($HTTP_POST_VARS['postdays'])) ? $HTTP_POST_VARS['postdays'] : $HTTP_GET_VARS['postdays']; $min_post_time = time() - ($post_days * 86400); - $sql = "SELECT COUNT(*) AS forum_topics - FROM ".TOPICS_TABLE." - WHERE forum_id = $forum_id + $sql = "SELECT COUNT(*) AS forum_topics + FROM ".TOPICS_TABLE." + WHERE forum_id = $forum_id AND topic_time > $min_post_time"; if(!$result = $db->sql_query($sql)) @@ -195,11 +195,12 @@ $select_post_days .= "</select>"; $sql = "SELECT t.*, u.username, u.user_id, u2.username as user2, u2.user_id as id2, p.post_time FROM ".TOPICS_TABLE." t, ".USERS_TABLE." u, ".POSTS_TABLE." p, ".USERS_TABLE." u2 WHERE t.forum_id = $forum_id - AND t.topic_poster = u.user_id - AND p.post_id = t.topic_last_post_id - AND p.poster_id = u2.user_id + AND t.topic_poster = u.user_id + AND p.post_id = t.topic_last_post_id + AND p.poster_id = u2.user_id + AND t.topic_type <> ".GLOB_ANNOUNCE." $limit_posts_time - ORDER BY p.post_time DESC + ORDER BY t.topic_type DESC, p.post_time DESC LIMIT $start, ".$board_config['topics_per_page']; if(!$t_result = $db->sql_query($sql)) { @@ -208,7 +209,7 @@ if(!$t_result = $db->sql_query($sql)) $total_topics = $db->sql_numrows($t_result); // -// Post URL generation for +// Post URL generation for // templating vars // $post_new_topic_url = append_sid("posting.".$phpEx."?mode=newtopic&".POST_FORUM_URL."=$forum_id"); @@ -278,8 +279,8 @@ if($total_topics) $unread_topic_list['lastupdate'] = time(); - $sql = "UPDATE " . USERS_TABLE . " - SET user_topics_unvisited = '" . serialize($unread_topic_list) . "' + $sql = "UPDATE " . USERS_TABLE . " + SET user_topics_unvisited = '" . serialize($unread_topic_list) . "' WHERE user_id = " . $userdata['user_id']; if(!$s_topic_times = $db->sql_query($sql)) { @@ -291,6 +292,22 @@ if($total_topics) for($x = 0; $x < $total_topics; $x++) { $topic_title = stripslashes($topic_rowset[$x]['topic_title']); + + $topic_type = $topic_rowset[$x]['topic_type']; + + if($topic_type == ANNOUCE) + { + $topic_type = $lang['Annoucement'] . " "; + } + else if($topic_type == STICKY) + { + $topic_type = $lang['Sticky'] . " "; + } + else + { + $topic_type = ""; + } + $topic_id = $topic_rowset[$x]['topic_id']; $replies = $topic_rowset[$x]['topic_replies']; @@ -300,14 +317,14 @@ if($total_topics) $times = 1; for($i = 0; $i < ($replies + 1); $i += $board_config['posts_per_page']) { - if($times > 4) + if($times > 4) { - if(($i + $board_config['posts_per_page']) >= ($replies + 1)) + if(($i + $board_config['posts_per_page']) >= ($replies + 1)) { $goto_page.=" ... <a href=\"".append_sid("viewtopic.$phpEx?".POST_TOPIC_URL."=".$topic_id."&start=$i")."\">$times</a>"; } } - else + else { if($times != 1) { @@ -319,7 +336,7 @@ if($total_topics) } $goto_page.= ")"; } - else + else { $goto_page = ""; } @@ -339,7 +356,7 @@ if($total_topics) $folder_image = ($topic_rowset[$x]['post_time'] > $userdata['session_time'] - 300) ? "<img src=\"".$images['new_folder']."\">" : "<img src=\"".$images['folder']."\">"; } // } - + $view_topic_url = append_sid("viewtopic.".$phpEx."?".POST_TOPIC_URL."=".$topic_id."&".$replies); $topic_poster = stripslashes($topic_rowset[$x]['username']); @@ -354,11 +371,12 @@ if($total_topics) $template->assign_block_vars("topicrow", array( "FORUM_ID" => $forum_id, "TOPIC_ID" => $topic_id, - "FOLDER" => $folder_image, + "FOLDER" => $folder_image, "TOPIC_POSTER" => $topic_poster, "GOTO_PAGE" => $goto_page, "REPLIES" => $replies, "TOPIC_TITLE" => $topic_title, + "TOPIC_TYPE" => $topic_type, "VIEWS" => $views, "LAST_POST_TIME" => $last_post_time, "LAST_POST_USER" => $last_post_user, @@ -381,10 +399,10 @@ if($total_topics) $template->assign_vars(array( "PAGINATION" => generate_pagination("viewforum.$phpEx?".POST_FORUM_URL."=$forum_id&postdays=$post_days", $topics_count, $board_config['topics_per_page'], $start), "ON_PAGE" => (floor($start/$board_config['topics_per_page'])+1), - "TOTAL_PAGES" => ceil($topics_count/$board_config['topics_per_page']), + "TOTAL_PAGES" => ceil($topics_count/$board_config['topics_per_page']), "S_AUTH_LIST" => $s_auth_can, - + "L_OF" => $lang['of'], "L_PAGE" => $lang['Page'], "L_GOTO_PAGE" => $lang['Goto_page']) @@ -401,7 +419,7 @@ else // error_die(NO_POSTS); } - + include('includes/page_tail.'.$phpEx); ?>
\ No newline at end of file diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index 3ff1567863..04ea4177a7 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -142,10 +142,10 @@ else /* $order_sql = (!isset($post_id)) ? "" : "GROUP BY p.post_id, t.topic_id, t.topic_title, t.topic_status, t.topic_replies, t.topic_time, f.forum_name, f.forum_id, f.auth_view, f.auth_read, f.auth_post, f.auth_reply, f.auth_edit, f.auth_delete, f.auth_votecreate, f.auth_vote, f.auth_attachments ORDER BY p.post_id ASC"; - $sql = "SELECT t.topic_id, t.topic_title, t.topic_status, t.topic_replies, t.topic_time, f.forum_name, f.forum_id, f.auth_view, f.auth_read, f.auth_post, f.auth_reply, f.auth_edit, f.auth_delete, f.auth_votecreate, f.auth_vote, f.auth_attachments" . $count_sql . " - FROM $join_sql_table ".TOPICS_TABLE." t, ".FORUMS_TABLE." f - WHERE $join_sql - AND f.forum_id = t.forum_id + $sql = "SELECT t.topic_id, t.topic_title, t.topic_status, t.topic_replies, t.topic_time, f.forum_name, f.forum_id, f.auth_view, f.auth_read, f.auth_post, f.auth_reply, f.auth_edit, f.auth_delete, f.auth_votecreate, f.auth_vote, f.auth_attachments" . $count_sql . " + FROM $join_sql_table ".TOPICS_TABLE." t, ".FORUMS_TABLE." f + WHERE $join_sql + AND f.forum_id = t.forum_id $order_sql"; */ $order_sql = (!isset($post_id)) ? "" : "GROUP BY p.post_id, t.topic_id, t.topic_title, t.topic_status, t.topic_replies, t.topic_time, f.forum_name, f.forum_id, fa.auth_view, fa.auth_read, fa.auth_post, fa.auth_reply, fa.auth_edit, fa.auth_delete, fa.auth_announce, fa.auth_sticky, fa.auth_votecreate, fa.auth_vote ORDER BY p.post_id ASC"; @@ -271,8 +271,8 @@ if($userdata['user_id'] != ANONYMOUS) { unset($unread_topic_list[$forum_id][$topic_id]); - $sql = "UPDATE " . USERS_TABLE . " - SET user_topics_unvisited = '" . serialize($unread_topic_list) . "' + $sql = "UPDATE " . USERS_TABLE . " + SET user_topics_unvisited = '" . serialize($unread_topic_list) . "' WHERE user_id = " . $userdata['user_id']; if(!$s_topic_times = $db->sql_query($sql)) { @@ -578,8 +578,8 @@ $template->assign_vars(array( "ON_PAGE" => (floor($start/$board_config['posts_per_page'])+1), "TOTAL_PAGES" => ceil(($total_replies)/$board_config['posts_per_page']), - "S_AUTH_LIST" => $s_auth_can, - "S_TOPIC_ADMIN" => $topic_mod, + "S_AUTH_LIST" => $s_auth_can, + "S_TOPIC_ADMIN" => $topic_mod, "L_OF" => $lang['of'], "L_PAGE" => $lang['Page'], |