aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB
diff options
context:
space:
mode:
authordougk_ff7 <dougk_ff7@users.sourceforge.net>2001-10-16 01:00:47 +0000
committerdougk_ff7 <dougk_ff7@users.sourceforge.net>2001-10-16 01:00:47 +0000
commit8f45c77883d9349e974e19f7db8526176d09f201 (patch)
tree5616afc2168c05c83635e9337497d76912966d91 /phpBB
parenta1c1036b8c8c1bbb27105df9c4b7b6d11612c888 (diff)
downloadforums-8f45c77883d9349e974e19f7db8526176d09f201.tar
forums-8f45c77883d9349e974e19f7db8526176d09f201.tar.gz
forums-8f45c77883d9349e974e19f7db8526176d09f201.tar.bz2
forums-8f45c77883d9349e974e19f7db8526176d09f201.tar.xz
forums-8f45c77883d9349e974e19f7db8526176d09f201.zip
Just the start to the wonderful world of global announcements. Adds support for them as well as creates a new forum, id -1. Do not delete the forum. I'll write the admin later.
git-svn-id: file:///svn/phpbb/trunk@1215 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB')
-rw-r--r--phpBB/admin/admin_forums.php15
-rw-r--r--phpBB/config.php19
-rw-r--r--phpBB/db/mysql_basic.sql2
-rw-r--r--phpBB/viewforum.php24
-rw-r--r--phpBB/viewtopic.php31
5 files changed, 78 insertions, 13 deletions
diff --git a/phpBB/admin/admin_forums.php b/phpBB/admin/admin_forums.php
index 6fe927c24b..f206fd7f59 100644
--- a/phpBB/admin/admin_forums.php
+++ b/phpBB/admin/admin_forums.php
@@ -330,10 +330,21 @@ if( !empty($mode) )
$max_order = $row['max_order'];
$next_order = $max_order + 1;
+
+ $sql = "SELECT MAX(forum_id) AS max_id
+ FROM " . FORUMS_TABLE;
+ if( !$result = $db->sql_query($sql) )
+ {
+ message_die(GENERAL_ERROR, "Couldn't get order number from forums table", "", __LINE__, __FILE__, $sql);
+ }
+ $row = $db->sql_fetchrow($result);
+
+ $max_id = $row['max_id'];
+ $next_id = $max_id + 1;
// There is no problem having duplicate forum names so we won't check for it.
- $sql = "INSERT INTO " . FORUMS_TABLE . " (forum_name, cat_id, forum_desc, forum_order, forum_status, prune_enable)
- VALUES ('" . $HTTP_POST_VARS['forumname'] . "', " . intval($HTTP_POST_VARS['cat_id']) . ", '" . $HTTP_POST_VARS['forumdesc'] . "', $next_order, " . intval($HTTP_POST_VARS['forumstatus']) . ", " . intval($HTTP_POST_VARS['prune_enable']) . ")";
+ $sql = "INSERT INTO " . FORUMS_TABLE . " (forum_id, forum_name, cat_id, forum_desc, forum_order, forum_status, prune_enable)
+ VALUES ('" . $next_id . "', '" . $HTTP_POST_VARS['forumname'] . "', " . intval($HTTP_POST_VARS['cat_id']) . ", '" . $HTTP_POST_VARS['forumdesc'] . "', $next_order, " . intval($HTTP_POST_VARS['forumstatus']) . ", " . intval($HTTP_POST_VARS['prune_enable']) . ")";
if( !$result = $db->sql_query($sql) )
{
message_die(GENERAL_ERROR, "Couldn't insert row in forums table", "", __LINE__, __FILE__, $sql);
diff --git a/phpBB/config.php b/phpBB/config.php
index e69de29bb2..2a378b51eb 100644
--- a/phpBB/config.php
+++ b/phpBB/config.php
@@ -0,0 +1,19 @@
+<?php
+
+//
+// phpBB 2.x auto-generated config file
+// Do not change anything in this file!
+//
+
+$dbms = "mysql";
+
+$dbhost = "127.0.0.1";
+$dbname = "devphpbb2";
+$dbuser = "dougk";
+$dbpasswd = "dougk";
+
+$table_prefix = "phpbb_";
+
+define('PHPBB_INSTALLED', true);
+
+?> \ No newline at end of file
diff --git a/phpBB/db/mysql_basic.sql b/phpBB/db/mysql_basic.sql
index b7845f96ca..7dbf99abb9 100644
--- a/phpBB/db/mysql_basic.sql
+++ b/phpBB/db/mysql_basic.sql
@@ -61,7 +61,7 @@ INSERT INTO phpbb_categories (cat_id, cat_title, cat_order) VALUES (1, 'Test cat
# -- Forums
INSERT INTO phpbb_forums (forum_id, forum_name, forum_desc, cat_id, forum_order, forum_posts, forum_topics, forum_last_post_id, auth_view, auth_read, auth_post, auth_reply, auth_edit, auth_delete, auth_announce, auth_sticky, auth_pollcreate, auth_vote, auth_attachments) VALUES (1, 'Test Forum 1', 'This is just a test forum.', 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 3, 1, 1, 1, 3);
-
+INSERT INTO phpbb_forums (forum_id, forum_name, forum_desc, cat_id, forum_order, forum_posts, forum_topics, forum_last_post_id, auth_view, auth_read, auth_post, auth_reply, auth_edit, auth_delete, auth_announce, auth_sticky, auth_pollcreate, auth_vote, auth_attachments) VALUES (-1, 'Global Announcements', 'This forum is required for the global announcements to function properly. DO NOT DELETE IT UNDER ANY CIRCUMSTANCES!', 6, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 3, 1, 1, 1, 3);
# -- Users
INSERT INTO phpbb_users (user_id, username, user_level, user_regdate, user_password, user_autologin_key, user_email, user_icq, user_website, user_occ, user_from, user_interests, user_sig, user_viewemail, user_style, user_aim, user_yim, user_msnm, user_posts, user_attachsig, user_allowsmile, user_allowhtml, user_allowbbcode, user_allow_pm, user_notify_pm, user_allow_viewonline, user_rank, user_avatar, user_lang, user_timezone, user_dateformat, user_actkey, user_newpasswd, user_notify, user_active) VALUES ( '-1', 'Anonymous', '0', '', '', '', '', '', '', '', '', '', '', '0', '0', '', '', '', '', '', '', '', '0', '0', '1', '', '', '', '', '', '', '', '', '0', '0');
diff --git a/phpBB/viewforum.php b/phpBB/viewforum.php
index 1ad3c7cd96..ee8b398f08 100644
--- a/phpBB/viewforum.php
+++ b/phpBB/viewforum.php
@@ -435,21 +435,24 @@ if($total_topics)
if($topic_type == POST_ANNOUNCE)
{
$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'] )
{
$topic_type .= $lang['Topic_Poll'] . " ";
}
-
+
$topic_id = $topic_rowset[$i]['topic_id'];
$replies = $topic_rowset[$i]['topic_replies'];
@@ -553,8 +556,14 @@ if($total_topics)
}
}
}
-
- $view_topic_url = append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id");
+ 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'];
$topic_poster_profile_url = append_sid("profile.$phpEx?mode=viewprofile&amp;" . POST_USERS_URL . "=" . $topic_rowset[$i]['user_id']);
@@ -563,7 +572,14 @@ if($total_topics)
$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&amp;" . 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>";
+ 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'];
diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php
index aed3fab93f..bc1c0d6c43 100644
--- a/phpBB/viewtopic.php
+++ b/phpBB/viewtopic.php
@@ -38,11 +38,16 @@ if(isset($HTTP_GET_VARS[POST_POST_URL]))
}
$start = ( isset($HTTP_GET_VARS['start']) ) ? intval($HTTP_GET_VARS['start']) : 0;
+
+$mode = (isset($HTTP_GET_VARS['mode'])) ? addslashes($HTTP_GET_VARS['mode']) : "";
+
+$forum_id = (isset($HTTP_GET_VARS['f'])) ? intval($HTTP_GET_VARS['f']) : "";
+
//
// End initial var setup
//
-if( !isset($topic_id) && !isset($post_id) )
+if( !isset($topic_id) && !isset($post_id) && ($mode != "viewannounce") )
{
message_die(GENERAL_MESSAGE, 'Topic_post_not_exist');
}
@@ -130,6 +135,7 @@ if( isset($HTTP_GET_VARS["view"]) && empty($HTTP_GET_VARS[POST_POST_URL]) )
}
}
+
//
// This rather complex gaggle of code handles querying for topics but
// also allows for direct linking to a post (and the calculation of which
@@ -141,11 +147,24 @@ $count_sql = (!isset($post_id)) ? "" : ", COUNT(p2.post_id) AS prev_posts";
$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( $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))
{