diff --git a/phpBB/language/lang_english/lang_main.php b/phpBB/language/lang_english/lang_main.php index 7588248a94..667b2439be 100644 --- a/phpBB/language/lang_english/lang_main.php +++ b/phpBB/language/lang_english/lang_main.php @@ -284,6 +284,7 @@ $lang['Post_a_reply'] = "Post a reply"; $lang['Post_topic_as'] = "Post topic as"; $lang['Edit_Post'] = "Edit post"; $lang['Post_Normal'] = "Normal"; +$lang['Post_Global_Announcement'] = "Global Announcement"; $lang['Post_Announcement'] = "Announcement"; $lang['Post_Sticky'] = "Sticky"; $lang['Options'] = "Options"; diff --git a/phpBB/posting.php b/phpBB/posting.php index aa702482ad..5cbac0cca7 100644 --- a/phpBB/posting.php +++ b/phpBB/posting.php @@ -525,11 +525,15 @@ else if( $topic_status == TOPIC_LOCKED ) // if( isset($HTTP_POST_VARS['topictype']) ) { - if($HTTP_POST_VARS['topictype'] == "announce") + if( $HTTP_POST_VARS['topictype'] == "global" ) + { + $topic_type = POST_ANNOUNCE_GLOBAL; + } + else if( $HTTP_POST_VARS['topictype'] == "announce" ) { $topic_type = POST_ANNOUNCE; } - else if($HTTP_POST_VARS['topictype'] == "sticky") + else if( $HTTP_POST_VARS['topictype'] == "sticky" ) { $topic_type = POST_STICKY; } @@ -550,7 +554,7 @@ $auth_type = AUTH_ALL; switch( $mode ) { case 'newtopic': - if( $topic_type == POST_ANNOUNCE ) + if( $topic_type == POST_ANNOUNCE || $topic_type == POST_GLOBAL_ANNOUNCE ) { $is_auth_type = "auth_announce"; $auth_string = $lang['can_post_announcements']; @@ -638,6 +642,11 @@ if( !$is_auth[$is_auth_type] ) message_die(GENERAL_MESSAGE, $message); } +else if( $topic_type == POST_GLOBAL_ANNOUNCE && $userdata['user_level'] != ADMIN ) +{ + $message = $lang['Sorry_auth'] . $lang['Administrators'] . $auth_string . $lang['this_forum']; + message_die(GENERAL_MESSAGE, $message); +} // // End Auth // @@ -933,22 +942,11 @@ if( ( $submit || $confirm || $mode == "delete" ) && !$error ) $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) +/* if( $topic_type != POST_GLOBAL_ANNOUNCE ) { - $sql .= " WHERE forum_id = $forum_id"; + $sql .= " WHERE forum_id = $forum_id"; } - +*/ if($db->sql_query($sql)) { $sql = "UPDATE " . USERS_TABLE . " @@ -2255,6 +2253,16 @@ if( $mode == 'newtopic' || ( $mode == 'editpost' && $is_first_post_topic ) ) { $template->assign_block_vars("type_toggle", array()); + if( $userdata['user_level'] == ADMIN ) + { + $global_announce_toggle = 'sql_query($sql)) {