1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-01-19 15:17:16 +01:00

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
This commit is contained in:
dougk_ff7 2001-10-16 01:00:47 +00:00
parent a1c1036b8c
commit 8f45c77883
5 changed files with 78 additions and 13 deletions

View File

@ -331,9 +331,20 @@ 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);

View File

@ -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);
?>

View File

@ -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');

View File

@ -435,14 +435,17 @@ 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'] )
@ -553,8 +556,14 @@ if($total_topics)
}
}
}
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> ";
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'];

View File

@ -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";
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))
{