|
From: Doug K. <dou...@us...> - 2001-10-16 14:43:07
|
Update of /cvsroot/phpbb/phpBB2
In directory usw-pr-cvs1:/tmp/cvs-serv9854
Modified Files:
posting.php viewforum.php viewtopic.php
Log Message:
More changes for global announcements. They no longer require the mode to be set (it works without), posting.php has been updated to reflect replies to announcements in ALL forums, and a admin page for announcements (global) has been added, although it can only link to pages with the true forum and auth permissions. A more refined version will be coming soon
Index: posting.php
===================================================================
RCS file: /cvsroot/phpbb/phpBB2/posting.php,v
retrieving revision 1.81
retrieving revision 1.82
diff -C2 -r1.81 -r1.82
*** posting.php 2001/10/16 11:12:27 1.81
--- posting.php 2001/10/16 13:09:23 1.82
***************
*** 926,930 ****
if($db->sql_query($sql))
! {
$sql = "UPDATE " . FORUMS_TABLE . "
SET forum_last_post_id = $new_post_id, forum_posts = forum_posts + 1";
--- 926,930 ----
if($db->sql_query($sql))
! {
$sql = "UPDATE " . FORUMS_TABLE . "
SET forum_last_post_id = $new_post_id, forum_posts = forum_posts + 1";
***************
*** 933,938 ****
$sql .= ", forum_topics = forum_topics + 1";
}
$sql .= " WHERE forum_id = $forum_id";
!
if($db->sql_query($sql))
{
--- 933,953 ----
$sql .= ", forum_topics = forum_topics + 1";
}
+
+ $sqlquery = "SELECT topic_type FROM " . TOPICS_TABLE . "
+ WHERE topic_id = $topic_id";
+ if($result = $db->sql_query($sqlquery))
+ {
+ $topic_row = $db->sql_fetchrow($result);
+ $topic_type = intval($topic_row['topic_type']);
+ }
+ else
+ {
+ message_die(GENERAL_ERROR, "Could not query topics table.", __LINE__, __FILE__, $sqlquery, "");
+ }
+ if($topic_type != POST_ANNOUNCE)
+ {
$sql .= " WHERE forum_id = $forum_id";
! }
!
if($db->sql_query($sql))
{
Index: viewforum.php
===================================================================
RCS file: /cvsroot/phpbb/phpBB2/viewforum.php,v
retrieving revision 1.92
retrieving revision 1.93
diff -C2 -r1.92 -r1.93
*** viewforum.php 2001/10/16 01:00:47 1.92
--- viewforum.php 2001/10/16 13:09:45 1.93
***************
*** 436,451 ****
{
$topic_type = $lang['Topic_Announcement'] . " ";
- $is_announcement = TRUE;
}
else if($topic_type == POST_STICKY)
{
$topic_type = $lang['Topic_Sticky'] . " ";
- $is_announcement = FALSE;
}
else
{
! $topic_type = "";
! $is_announcement = FALSE;
! }
if( $topic_rowset[$i]['topic_vote'] )
--- 436,447 ----
{
$topic_type = $lang['Topic_Announcement'] . " ";
}
else if($topic_type == POST_STICKY)
{
$topic_type = $lang['Topic_Sticky'] . " ";
}
else
{
! $topic_type = ""; }
if( $topic_rowset[$i]['topic_vote'] )
***************
*** 556,568 ****
}
}
- }
- if($is_announcement == TRUE)
- {
- $view_topic_url = append_sid("viewtopic.$phpEx?mode=viewannounce&". POST_FORUM_URL . "=" . $forum_id . "&" . POST_TOPIC_URL . "=$topic_id");
- }
- else
- {
- $view_topic_url = append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id");
}
$topic_poster = $topic_rowset[$i]['username'];
--- 552,558 ----
}
}
}
+
+ $view_topic_url = append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id");
$topic_poster = $topic_rowset[$i]['username'];
***************
*** 573,584 ****
$last_post = $last_post_time . "<br />" . $lang['by'] . " ";
$last_post .= ( $topic_rowset[$i]['id2'] == ANONYMOUS ) ? $topic_rowset[$i]['user2'] . " " : "<a href=\"" . append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . "=" . $topic_rowset[$i]['id2']) . "\">" . $topic_rowset[$i]['user2'] . "</a> ";
! if($is_announcement == TRUE)
! {
! $last_post .= "<a href=\"" . append_sid("viewtopic.$phpEx?mode=viewannounce&" . POST_FORUM_URL . "=" . $forum_id . "&" . POST_POST_URL . "=" . $topic_rowset[$i]['topic_last_post_id']) . "#" . $topic_rowset[$i]['topic_last_post_id'] . "\"><img src=\"" . $images['icon_latest_reply'] . "\" border=\"0\" alt=\"" . $lang['View_latest_post'] . "\" /></a>";
! }
! else
! {
! $last_post .= "<a href=\"" . append_sid("viewtopic.$phpEx?" . POST_POST_URL . "=" . $topic_rowset[$i]['topic_last_post_id']) . "#" . $topic_rowset[$i]['topic_last_post_id'] . "\"><img src=\"" . $images['icon_latest_reply'] . "\" border=\"0\" alt=\"" . $lang['View_latest_post'] . "\" /></a>";
! }
$views = $topic_rowset[$i]['topic_views'];
--- 563,567 ----
$last_post = $last_post_time . "<br />" . $lang['by'] . " ";
$last_post .= ( $topic_rowset[$i]['id2'] == ANONYMOUS ) ? $topic_rowset[$i]['user2'] . " " : "<a href=\"" . append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . "=" . $topic_rowset[$i]['id2']) . "\">" . $topic_rowset[$i]['user2'] . "</a> ";
! $last_post .= "<a href=\"" . append_sid("viewtopic.$phpEx?" . POST_POST_URL . "=" . $topic_rowset[$i]['topic_last_post_id']) . "#" . $topic_rowset[$i]['topic_last_post_id'] . "\"><img src=\"" . $images['icon_latest_reply'] . "\" border=\"0\" alt=\"" . $lang['View_latest_post'] . "\" /></a>";
$views = $topic_rowset[$i]['topic_views'];
Index: viewtopic.php
===================================================================
RCS file: /cvsroot/phpbb/phpBB2/viewtopic.php,v
retrieving revision 1.121
retrieving revision 1.122
diff -C2 -r1.121 -r1.122
*** viewtopic.php 2001/10/16 01:00:47 1.121
--- viewtopic.php 2001/10/16 13:09:56 1.122
***************
*** 148,169 ****
$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, t.topic_type, t.topic_vote, f.forum_name, f.forum_status, f.forum_id, f.auth_view, f.auth_read, f.auth_post, f.auth_reply, f.auth_edit, f.auth_delete, f.auth_sticky, f.auth_announce, f.auth_pollcreate, f.auth_vote, f.auth_attachments ORDER BY p.post_id ASC";
! if( $mode=="viewannounce" )
! {
! $sql = "SELECT t.topic_id, t.topic_title, t.topic_status, t.topic_replies, t.topic_time, t.topic_type, t.topic_vote, f.forum_name, f.forum_status, f.forum_id, f.auth_view, f.auth_read, f.auth_post, f.auth_reply, f.auth_edit, f.auth_delete, f.auth_sticky, f.auth_announce, f.auth_pollcreate, f.auth_vote, f.auth_attachments" . $count_sql . "
! FROM $join_sql_table " . TOPICS_TABLE . " t, " . FORUMS_TABLE . " f
! WHERE $join_sql AND
! t.topic_type = " . POST_ANNOUNCE . " AND
! (f.forum_id = " . $forum_id . "
! OR f.forum_id = -1)
! $order_sql";
! }
! else
! {
! $sql = "SELECT t.topic_id, t.topic_title, t.topic_status, t.topic_replies, t.topic_time, t.topic_type, t.topic_vote, f.forum_name, f.forum_status, f.forum_id, f.auth_view, f.auth_read, f.auth_post, f.auth_reply, f.auth_edit, f.auth_delete, f.auth_sticky, f.auth_announce, f.auth_pollcreate, 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";
! }
if(!$result = $db->sql_query($sql))
--- 148,156 ----
$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, t.topic_type, t.topic_vote, f.forum_name, f.forum_status, f.forum_id, f.auth_view, f.auth_read, f.auth_post, f.auth_reply, f.auth_edit, f.auth_delete, f.auth_sticky, f.auth_announce, f.auth_pollcreate, 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, t.topic_type, t.topic_vote, f.forum_name, f.forum_status, f.forum_id, f.auth_view, f.auth_read, f.auth_post, f.auth_reply, f.auth_edit, f.auth_delete, f.auth_sticky, f.auth_announce, f.auth_pollcreate, 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";
if(!$result = $db->sql_query($sql))
|