Forum level annoucements and sticky topics are done.

Added topic_type field to the topics database in order to handle ordering. Would have used topic_status but that would have messed up the ordering when topics were locked


git-svn-id: file:///svn/phpbb/trunk@437 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
James Atkinson 2001-06-07 07:56:45 +00:00
parent f49da7909b
commit 1010b488ca
11 changed files with 193 additions and 108 deletions

View file

@ -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); 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 # -- 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 # -- Demo Post
INSERT INTO phpbb_posts VALUES(1, 1, 1, 1, NOW(), '127.0.0.1' , LEFT(MD5('42'), 10)); INSERT INTO phpbb_posts VALUES(1, 1, 1, 1, NOW(), '127.0.0.1' , LEFT(MD5('42'), 10));

View file

@ -18,10 +18,10 @@ CREATE TABLE phpbb_auth_access (
auth_reply tinyint(1) DEFAULT '0' NOT NULL, auth_reply tinyint(1) DEFAULT '0' NOT NULL,
auth_edit tinyint(1) DEFAULT '0' NOT NULL, auth_edit tinyint(1) DEFAULT '0' NOT NULL,
auth_delete tinyint(1) DEFAULT '0' NOT NULL, auth_delete tinyint(1) DEFAULT '0' NOT NULL,
auth_announce tinyint(1) DEFAULT '0' NOT NULL, auth_announce tinyint(1) DEFAULT '0' NOT NULL,
auth_sticky tinyint(1) DEFAULT '0' NOT NULL, auth_sticky tinyint(1) DEFAULT '0' NOT NULL,
auth_votecreate tinyint(1) DEFAULT '0' NOT NULL, auth_votecreate tinyint(1) DEFAULT '0' NOT NULL,
auth_attachments tinyint(1) DEFAULT '0' NOT NULL, auth_attachments tinyint(1) DEFAULT '0' NOT NULL,
auth_vote tinyint(1) DEFAULT '0' NOT NULL, auth_vote tinyint(1) DEFAULT '0' NOT NULL,
auth_mod tinyint(1) DEFAULT '0' NOT NULL, auth_mod tinyint(1) DEFAULT '0' NOT NULL,
auth_admin 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_reply tinyint(4) DEFAULT '0' NOT NULL,
auth_edit tinyint(4) DEFAULT '0' NOT NULL, auth_edit tinyint(4) DEFAULT '0' NOT NULL,
auth_delete tinyint(4) DEFAULT '0' NOT NULL, auth_delete tinyint(4) DEFAULT '0' NOT NULL,
auth_announce tinyint(4) DEFAULT '0' NOT NULL, auth_announce tinyint(4) DEFAULT '0' NOT NULL,
auth_sticky tinyint(4) DEFAULT '0' NOT NULL, auth_sticky tinyint(4) DEFAULT '0' NOT NULL,
auth_votecreate 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 auth_attachments tinyint(4) DEFAULT '0' NOT NULL
); );
@ -125,7 +125,7 @@ CREATE TABLE phpbb_config (
email_from varchar(100), email_from varchar(100),
flood_interval int(4) NOT NULL, flood_interval int(4) NOT NULL,
avatar_filesize int(11) DEFAULT '6144' 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_theme int(11) DEFAULT '1' NOT NULL,
default_lang varchar(255), default_lang varchar(255),
default_dateformat varchar(14) DEFAULT 'd M Y H:i' NOT NULL, 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_id char(32) DEFAULT '' NOT NULL,
session_user_id int(11) DEFAULT '0' NOT NULL, session_user_id int(11) DEFAULT '0' NOT NULL,
session_start int(11) DEFAULT '0' NOT NULL, session_start int(11) DEFAULT '0' NOT NULL,
session_time int(11) DEFAULT '0' NOT NULL, session_time int(11) DEFAULT '0' NOT NULL,
session_last_visit int(11) DEFAULT '0' NOT NULL, session_last_visit int(11) DEFAULT '0' NOT NULL,
session_ip char(8) DEFAULT '0' NOT NULL, session_ip char(8) DEFAULT '0' NOT NULL,
session_page int(11) DEFAULT '0' NOT NULL, session_page int(11) DEFAULT '0' NOT NULL,
session_logged_in tinyint(1) 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_views int(10) DEFAULT '0' NOT NULL,
topic_replies int(11) DEFAULT '0' NOT NULL, topic_replies int(11) DEFAULT '0' NOT NULL,
topic_status tinyint(3) 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_notify tinyint(3) DEFAULT '0',
topic_last_post_id int(11) DEFAULT '0' NOT NULL, topic_last_post_id int(11) DEFAULT '0' NOT NULL,
PRIMARY KEY (topic_id), PRIMARY KEY (topic_id),

View file

@ -34,7 +34,7 @@ CREATE TABLE phpbb_auth_forums (
auth_announce int2 DEFAULT '0' NOT NULL, auth_announce int2 DEFAULT '0' NOT NULL,
auth_sticky int2 DEFAULT '0' NOT NULL, auth_sticky int2 DEFAULT '0' NOT NULL,
auth_votecreate 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 auth_attachments int2 DEFAULT '0' NOT NULL
); );
@ -53,8 +53,8 @@ CREATE TABLE phpbb_auth_access (
auth_delete int2 DEFAULT '0' NOT NULL, auth_delete int2 DEFAULT '0' NOT NULL,
auth_announce int2 DEFAULT '0' NOT NULL, auth_announce int2 DEFAULT '0' NOT NULL,
auth_sticky int2 DEFAULT '0' NOT NULL, auth_sticky int2 DEFAULT '0' NOT NULL,
auth_votecreate int2 DEFAULT '0' NOT NULL, auth_votecreate int2 DEFAULT '0' NOT NULL,
auth_attachments int2 DEFAULT '0' NOT NULL, auth_attachments int2 DEFAULT '0' NOT NULL,
auth_vote int2 DEFAULT '0' NOT NULL, auth_vote int2 DEFAULT '0' NOT NULL,
auth_mod int2 DEFAULT '0' NOT NULL, auth_mod int2 DEFAULT '0' NOT NULL,
auth_admin 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, system_timezone int4 NOT NULL,
sys_template varchar(50) NOT NULL, sys_template varchar(50) NOT NULL,
avatar_filesize int4 DEFAULT '6144' 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, override_themes int2 NOT NULL,
flood_interval int NOT NULL, flood_interval int NOT NULL,
selected int2 NOT NULL, selected int2 NOT NULL,
@ -286,8 +286,8 @@ CREATE TABLE phpbb_session (
session_id char(32) DEFAULT '0' NOT NULL, session_id char(32) DEFAULT '0' NOT NULL,
session_user_id int4 DEFAULT '0' NOT NULL, session_user_id int4 DEFAULT '0' NOT NULL,
session_start int4 DEFAULT '0' NOT NULL, session_start int4 DEFAULT '0' NOT NULL,
session_time int4 DEFAULT '0' NOT NULL, session_time int4 DEFAULT '0' NOT NULL,
session_last_visit int4 DEFAULT '0' NOT NULL, session_last_visit int4 DEFAULT '0' NOT NULL,
session_ip char(8) DEFAULT '0' NOT NULL, session_ip char(8) DEFAULT '0' NOT NULL,
session_page int4 DEFAULT '0' NOT NULL, session_page int4 DEFAULT '0' NOT NULL,
session_logged_in int2 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, topic_replies int4 DEFAULT '0' NOT NULL,
forum_id int4 DEFAULT '0' NOT NULL, forum_id int4 DEFAULT '0' NOT NULL,
topic_status int2 DEFAULT '0' NOT NULL, topic_status int2 DEFAULT '0' NOT NULL,
topic_type int2 DEFAULT '0' NOT NULL,
topic_notify int2 DEFAULT '0', topic_notify int2 DEFAULT '0',
topic_last_post_id int4 DEFAULT '0' NOT NULL, topic_last_post_id int4 DEFAULT '0' NOT NULL,
CONSTRAINT phpbb_topics_pkey PRIMARY KEY (topic_id) CONSTRAINT phpbb_topics_pkey PRIMARY KEY (topic_id)

View file

@ -40,6 +40,13 @@ define(ADMIN, 1);
define(UNLOCKED, 0); define(UNLOCKED, 0);
define(LOCKED, 1); define(LOCKED, 1);
// Topic types
define(NORMAL, 0);
define(STICKY, 1);
define(ANNOUCE, 2);
define(GLOB_ANNOUNCE, 3);
// Ban time types // Ban time types
define(SECONDS, 1); define(SECONDS, 1);
define(MINUTES, 2); define(MINUTES, 2);

View file

@ -126,6 +126,8 @@ $lang['Forum_Index'] = "Forum Index";
// //
// Viewforum // Viewforum
// //
$lang['Annoucement'] = "<b>Annoucement:</b>";
$lang['Sticky'] = "<b>Sticky:</b>";
// //
// Viewtopic // 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['Empty_msg'] = "You must enter a message when posting!";
$lang['Postnew'] = "Post New Topic"; $lang['Postnew'] = "Post New Topic";
$lang['Post_new_in'] = "Post New Topic in:"; // Followed by forum name $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";
// //

View file

@ -90,11 +90,27 @@ init_userprefs($userdata);
switch($mode) switch($mode)
{ {
case 'newtopic': case 'newtopic':
$auth_type = AUTH_POST; if(isset($HTTP_POST_VARS['annouce']))
$is_auth_type = "auth_post"; {
$error_string = "post new topics"; $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; break;
case 'reply': case 'reply':
$auth_type = AUTH_REPLY; $auth_type = AUTH_REPLY;
$is_auth_type = "auth_reply"; $is_auth_type = "auth_reply";
$error_string = "reply to topics"; $error_string = "reply to topics";
@ -110,8 +126,8 @@ switch($mode)
$error_string = "delete topics"; $error_string = "delete topics";
break; break;
default: default:
$auth_type = AUTH_POST; $auth_type = AUTH_ALL;
$is_auth_type = "auth_post"; $is_auth_type = "auth_all";
$error_string = "post new topics"; $error_string = "post new topics";
break; 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']; $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']; $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"]; $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' // Prepare our message and subject on a 'submit'
@ -195,6 +226,17 @@ if(isset($HTTP_POST_VARS['submit']))
$error_msg .= $lang['Empty_subj']; $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(!empty($HTTP_POST_VARS['message']))
{ {
if(!$error) if(!$error)
@ -274,8 +316,8 @@ switch($mode)
{ {
$topic_time = get_gmt_ts(); $topic_time = get_gmt_ts();
$topic_notify = ($HTTP_POST_VARS['notify']) ? $HTTP_POST_VARS['notify'] : 0; $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) $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.")"; VALUES ('$subject', ".$userdata['user_id'].", ".$topic_time.", $forum_id, $topic_notify, ".UNLOCKED.", ".$topic_type.")";
if($db->sql_query($sql)) if($db->sql_query($sql))
{ {
@ -807,20 +849,6 @@ if($error)
} }
$forum_info = $db->sql_fetchrow($result); $forum_info = $db->sql_fetchrow($result);
$forum_name = stripslashes($forum_info['forum_name']); $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( $template->set_filenames(array(
"body" => "posting_body.tpl", "body" => "posting_body.tpl",
@ -905,6 +933,31 @@ if($error)
} }
$sig_toggle .= "> $l_attachsig"; $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)) if($mode == 'newtopic' || ($mode == 'editpost' && $notify))
{ {
$notify_toggle = '<input type="checkbox" name="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\">"; $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( $template->assign_vars(array(
"L_ABOUT_POST" => $l_aboutpost,
"L_SUBJECT" => $l_subject, "L_SUBJECT" => $l_subject,
"L_MESSAGE_BODY" => $l_body, "L_MESSAGE_BODY" => $l_body,
"L_OPTIONS" => $l_options, "L_OPTIONS" => $l_options,
@ -931,7 +983,6 @@ if($error)
"L_SUBMIT" => $l_submit, "L_SUBMIT" => $l_submit,
"L_CANCEL" => $l_cancelpost, "L_CANCEL" => $l_cancelpost,
"ABOUT_POSTING" => $about_posting,
"USERNAME_INPUT" => $username_input, "USERNAME_INPUT" => $username_input,
"PASSWORD_INPUT" => $password_input, "PASSWORD_INPUT" => $password_input,
"SUBJECT_INPUT" => $subject_input, "SUBJECT_INPUT" => $subject_input,
@ -940,6 +991,8 @@ if($error)
"HTML_TOGGLE" => $html_toggle, "HTML_TOGGLE" => $html_toggle,
"SMILE_TOGGLE" => $smile_toggle, "SMILE_TOGGLE" => $smile_toggle,
"SIG_TOGGLE" => $sig_toggle, "SIG_TOGGLE" => $sig_toggle,
"ANNOUNCE_TOGGLE" => $annouce_toggle,
"STICKY_TOGGLE" => $sticky_toggle,
"NOTIFY_TOGGLE" => $notify_toggle, "NOTIFY_TOGGLE" => $notify_toggle,
"BBCODE_TOGGLE" => $bbcode_toggle, "BBCODE_TOGGLE" => $bbcode_toggle,
"BBCODE_STATUS" => $bbcode_status, "BBCODE_STATUS" => $bbcode_status,

View file

@ -42,7 +42,7 @@
<!-- BEGIN topicrow --> <!-- BEGIN topicrow -->
<tr bgcolor="#DDDDDD" class="tablebody"> <tr bgcolor="#DDDDDD" class="tablebody">
<td width="5%" align="center" valign="middle">{topicrow.FOLDER}</td> <td width="5%" align="center" valign="middle">{topicrow.FOLDER}</td>
<td><a href="{topicrow.U_VIEW_TOPIC}">{topicrow.TOPIC_TITLE}</a>&nbsp;{topicrow.GOTO_PAGE}</td> <td>{topicrow.TOPIC_TYPE}<a href="{topicrow.U_VIEW_TOPIC}">{topicrow.TOPIC_TITLE}</a>&nbsp;{topicrow.GOTO_PAGE}</td>
<td width="5%" align="center" valign="middle">{topicrow.REPLIES}</td> <td width="5%" align="center" valign="middle">{topicrow.REPLIES}</td>
<td width="10%" align="center" valign="middle">{topicrow.TOPIC_POSTER}</td> <td width="10%" align="center" valign="middle">{topicrow.TOPIC_POSTER}</td>
<td width="5%" align="center" valign="middle">{topicrow.VIEWS}</td> <td width="5%" align="center" valign="middle">{topicrow.VIEWS}</td>

View file

@ -34,7 +34,7 @@ function insertCode(formObj, selectObj){
</tr> </tr>
<tr> <tr>
<td bgcolor="{T_TD_COLOR1}"><font face="{T_FONTFACE1}" size="{T_FONTSIZE2}"><b>{L_OPTIONS}</b></font></td> <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>
<tr> <tr>
<td colspan="2" bgcolor="{T_TH_COLOR3}" align="center">{S_HIDDEN_FORM_FIELDS}<input type="submit" name="preview" value="{L_PREVIEW}">&nbsp;<input type="submit" name="submit" value="{L_SUBMIT}">&nbsp;<input type="submit" name="cancel" value="{L_CANCEL}"></td> <td colspan="2" bgcolor="{T_TH_COLOR3}" align="center">{S_HIDDEN_FORM_FIELDS}<input type="submit" name="preview" value="{L_PREVIEW}">&nbsp;<input type="submit" name="submit" value="{L_SUBMIT}">&nbsp;<input type="submit" name="cancel" value="{L_CANCEL}"></td>

View file

@ -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="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>&nbsp;{L_AUTHOR}</b></font></td> <td width="20%" bgcolor="{T_TH_COLOR3}" align="center"><font face="{T_FONTFACE2}" size="{T_FONTSIZE2}"><b>&nbsp;{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="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> </tr>
<!-- BEGIN topicrow --> <!-- BEGIN topicrow -->
<tr> <tr>
<td bgcolor="{T_TD_COLOR1}" align="center" valign="middle">&nbsp;{topicrow.FOLDER}&nbsp;</td> <td bgcolor="{T_TD_COLOR1}" align="center" valign="middle">&nbsp;{topicrow.FOLDER}&nbsp;</td>
<td bgcolor="{T_TD_COLOR2}"><font face="{T_FONTFACE1}" size="{T_FONTSIZE1}">&nbsp;<a href="{topicrow.U_VIEW_TOPIC}">{topicrow.TOPIC_TITLE}</a>&nbsp;{topicrow.GOTO_PAGE}</td> <td bgcolor="{T_TD_COLOR2}"><font face="{T_FONTFACE1}" size="{T_FONTSIZE1}">&nbsp;{topicrow.TOPIC_TYPE}<a href="{topicrow.U_VIEW_TOPIC}">{topicrow.TOPIC_TITLE}</a>&nbsp;{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_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_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> <td bgcolor="{T_TD_COLOR1}" align="center" valign="middle"><font face="{T_FONTFACE1}" size="{T_FONTSIZE2}">{topicrow.VIEWS}</font></td>

View file

@ -1,26 +1,26 @@
<?php <?php
/*************************************************************************** /***************************************************************************
* *
* ------------------- * -------------------
* begin : Saturday, Feb 13, 2001 * begin : Saturday, Feb 13, 2001
* copyright : (C) 2001 The phpBB Group * copyright : (C) 2001 The phpBB Group
* email : support@phpbb.com * email : support@phpbb.com
* *
* $Id$ * $Id$
* *
* *
***************************************************************************/ ***************************************************************************/
/*************************************************************************** /***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or * the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* *
***************************************************************************/ ***************************************************************************/
include('extension.inc'); include('extension.inc');
include('common.'.$phpEx); include('common.'.$phpEx);
@ -57,24 +57,24 @@ init_userprefs($userdata);
if(isset($forum_id)) 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 $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 FROM ".FORUMS_TABLE." f, ".USERS_TABLE." u, ".USER_GROUP_TABLE." ug, ".AUTH_ACCESS_TABLE." aa
WHERE f.forum_id = $forum_id WHERE f.forum_id = $forum_id
AND aa.auth_mod = 1 AND aa.auth_mod = 1
AND aa.forum_id = f.forum_id AND aa.forum_id = f.forum_id
AND ug.group_id = aa.group_id AND ug.group_id = aa.group_id
AND u.user_id = ug.user_id"; AND u.user_id = ug.user_id";
*/ */
$sql = "SELECT f.forum_name, f.forum_topics, u.username, u.user_id, 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 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 WHERE f.forum_id = $forum_id
AND fa.forum_id = f.forum_id AND fa.forum_id = f.forum_id
AND aa.auth_mod = 1 AND aa.auth_mod = 1
AND aa.forum_id = f.forum_id AND aa.forum_id = f.forum_id
AND ug.group_id = aa.group_id AND ug.group_id = aa.group_id
AND u.user_id = ug.user_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"); 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__); 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. // 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."); 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 ... // to read this forum ...
// //
include('includes/page_header.'.$phpEx); include('includes/page_header.'.$phpEx);
$msg = "I am sorry but only " . $is_auth['auth_read_type'] . " can read this forum."; $msg = "I am sorry but only " . $is_auth['auth_read_type'] . " can read this forum.";
$template->set_filenames(array( $template->set_filenames(array(
@ -135,16 +135,16 @@ for($x = 0; $x < $db->sql_numrows($result); $x++)
{ {
if($x > 0) if($x > 0)
$forum_moderators .= ", "; $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>"; $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' // Generate a 'Show posts in previous x days'
// select box. If the postdays var is POSTed // select box. If the postdays var is POSTed
// then get it's value, find the number of topics // then get it's value, find the number of topics
// with dates newer than it (to properly handle // with dates newer than it (to properly handle
// pagination) and alter the main query // pagination) and alter the main query
// //
$previous_days = array(0, 1, 7, 14, 30, 60, 180, 364); $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']; $post_days = (!empty($HTTP_POST_VARS['postdays'])) ? $HTTP_POST_VARS['postdays'] : $HTTP_GET_VARS['postdays'];
$min_post_time = time() - ($post_days * 86400); $min_post_time = time() - ($post_days * 86400);
$sql = "SELECT COUNT(*) AS forum_topics $sql = "SELECT COUNT(*) AS forum_topics
FROM ".TOPICS_TABLE." FROM ".TOPICS_TABLE."
WHERE forum_id = $forum_id WHERE forum_id = $forum_id
AND topic_time > $min_post_time"; AND topic_time > $min_post_time";
if(!$result = $db->sql_query($sql)) 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 $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 FROM ".TOPICS_TABLE." t, ".USERS_TABLE." u, ".POSTS_TABLE." p, ".USERS_TABLE." u2
WHERE t.forum_id = $forum_id WHERE t.forum_id = $forum_id
AND t.topic_poster = u.user_id AND t.topic_poster = u.user_id
AND p.post_id = t.topic_last_post_id AND p.post_id = t.topic_last_post_id
AND p.poster_id = u2.user_id AND p.poster_id = u2.user_id
AND t.topic_type <> ".GLOB_ANNOUNCE."
$limit_posts_time $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']; LIMIT $start, ".$board_config['topics_per_page'];
if(!$t_result = $db->sql_query($sql)) 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); $total_topics = $db->sql_numrows($t_result);
// //
// Post URL generation for // Post URL generation for
// templating vars // templating vars
// //
$post_new_topic_url = append_sid("posting.".$phpEx."?mode=newtopic&".POST_FORUM_URL."=$forum_id"); $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(); $unread_topic_list['lastupdate'] = time();
$sql = "UPDATE " . USERS_TABLE . " $sql = "UPDATE " . USERS_TABLE . "
SET user_topics_unvisited = '" . serialize($unread_topic_list) . "' SET user_topics_unvisited = '" . serialize($unread_topic_list) . "'
WHERE user_id = " . $userdata['user_id']; WHERE user_id = " . $userdata['user_id'];
if(!$s_topic_times = $db->sql_query($sql)) if(!$s_topic_times = $db->sql_query($sql))
{ {
@ -291,6 +292,22 @@ if($total_topics)
for($x = 0; $x < $total_topics; $x++) for($x = 0; $x < $total_topics; $x++)
{ {
$topic_title = stripslashes($topic_rowset[$x]['topic_title']); $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']; $topic_id = $topic_rowset[$x]['topic_id'];
$replies = $topic_rowset[$x]['topic_replies']; $replies = $topic_rowset[$x]['topic_replies'];
@ -300,14 +317,14 @@ if($total_topics)
$times = 1; $times = 1;
for($i = 0; $i < ($replies + 1); $i += $board_config['posts_per_page']) 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>"; $goto_page.=" ... <a href=\"".append_sid("viewtopic.$phpEx?".POST_TOPIC_URL."=".$topic_id."&start=$i")."\">$times</a>";
} }
} }
else else
{ {
if($times != 1) if($times != 1)
{ {
@ -319,7 +336,7 @@ if($total_topics)
} }
$goto_page.= ")"; $goto_page.= ")";
} }
else else
{ {
$goto_page = ""; $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']."\">"; $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); $view_topic_url = append_sid("viewtopic.".$phpEx."?".POST_TOPIC_URL."=".$topic_id."&".$replies);
$topic_poster = stripslashes($topic_rowset[$x]['username']); $topic_poster = stripslashes($topic_rowset[$x]['username']);
@ -354,11 +371,12 @@ if($total_topics)
$template->assign_block_vars("topicrow", array( $template->assign_block_vars("topicrow", array(
"FORUM_ID" => $forum_id, "FORUM_ID" => $forum_id,
"TOPIC_ID" => $topic_id, "TOPIC_ID" => $topic_id,
"FOLDER" => $folder_image, "FOLDER" => $folder_image,
"TOPIC_POSTER" => $topic_poster, "TOPIC_POSTER" => $topic_poster,
"GOTO_PAGE" => $goto_page, "GOTO_PAGE" => $goto_page,
"REPLIES" => $replies, "REPLIES" => $replies,
"TOPIC_TITLE" => $topic_title, "TOPIC_TITLE" => $topic_title,
"TOPIC_TYPE" => $topic_type,
"VIEWS" => $views, "VIEWS" => $views,
"LAST_POST_TIME" => $last_post_time, "LAST_POST_TIME" => $last_post_time,
"LAST_POST_USER" => $last_post_user, "LAST_POST_USER" => $last_post_user,
@ -381,10 +399,10 @@ if($total_topics)
$template->assign_vars(array( $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), "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), "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, "S_AUTH_LIST" => $s_auth_can,
"L_OF" => $lang['of'], "L_OF" => $lang['of'],
"L_PAGE" => $lang['Page'], "L_PAGE" => $lang['Page'],
"L_GOTO_PAGE" => $lang['Goto_page']) "L_GOTO_PAGE" => $lang['Goto_page'])
@ -401,7 +419,7 @@ else
// //
error_die(NO_POSTS); error_die(NO_POSTS);
} }
include('includes/page_tail.'.$phpEx); include('includes/page_tail.'.$phpEx);
?> ?>

View file

@ -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"; $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 . " $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 FROM $join_sql_table ".TOPICS_TABLE." t, ".FORUMS_TABLE." f
WHERE $join_sql WHERE $join_sql
AND f.forum_id = t.forum_id AND f.forum_id = t.forum_id
$order_sql"; $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"; $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]); unset($unread_topic_list[$forum_id][$topic_id]);
$sql = "UPDATE " . USERS_TABLE . " $sql = "UPDATE " . USERS_TABLE . "
SET user_topics_unvisited = '" . serialize($unread_topic_list) . "' SET user_topics_unvisited = '" . serialize($unread_topic_list) . "'
WHERE user_id = " . $userdata['user_id']; WHERE user_id = " . $userdata['user_id'];
if(!$s_topic_times = $db->sql_query($sql)) 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), "ON_PAGE" => (floor($start/$board_config['posts_per_page'])+1),
"TOTAL_PAGES" => ceil(($total_replies)/$board_config['posts_per_page']), "TOTAL_PAGES" => ceil(($total_replies)/$board_config['posts_per_page']),
"S_AUTH_LIST" => $s_auth_can, "S_AUTH_LIST" => $s_auth_can,
"S_TOPIC_ADMIN" => $topic_mod, "S_TOPIC_ADMIN" => $topic_mod,
"L_OF" => $lang['of'], "L_OF" => $lang['of'],
"L_PAGE" => $lang['Page'], "L_PAGE" => $lang['Page'],