######################################################## ## Mod Title: Global Announcment mod ## Mod Version: 1.2.3 ## Author: Niels Chr. Denmark < ncr@db9.dk > (Niels Chr. Rød) HTTP://mods.db9.dk ## ## This mod is for phpBB2!! ver 2.0.3 ## ## This mod, makes it posible to post global announcements vieweble in all forums, ## it suppport auth level, witch means you can define in forum permissions, ## who have ritgh to post global announcements, note though that if you have given ## this rights in one forum, then it gives no meaning to restrict it to the same user(s) ## in another forum - the post is global ## Note also that once a global announcement is posted, the permission on the topic, wil be the same as that ## forum where it is posted, this is useful if you wan to restrict your users from replying - solution is ## to post the global announcement inside a forum where the users can not reply, the subject of the global ## announcement will though always be visible, even though the user have no rigths , it is first when they try to view ## the topic, that the permission in the original forum takes over ## ## There is a know isue this this mod, a global announcement will still "belong" to the forum where ## it original was posted, this means that if a user reply to sutch a post, then they will be redirected ## to that forum, nothing to do about that, also when using search, it will be displayed in the original forum ## ## If you wish to assign special rigths to the global announcement, then create a category named ## exactly as this "global_announcement". This cattegory is not showen to other that ADMIN ## inside this category, make a forum with a empty name, and post the global announcement here ## that way preventing the users to se the forum, where the global announcement is posted ## make this forum "view_auth" ALL and "read_auth" ALL, all other settings are up to you ## ## instalation rated medium ## instalation time: aprox 10-20 min ## ## Files to edit: 14 ## language/lang_english/lang_main.php ## language/lang_english/lang_admin.php ## viewforum.php ## index.php ## includes/constants.php ## search.php ## posting.php ## modcp.php ## includes/auth.php ## includes/functions.php ## admin/admin_forumauth.php ## Admin/admin_ug_auth.php ## templates/subsilver/viewforum_body.tpl ## /templates/subsilver/template.cfg ## Files to add: 2 ## templates/subsilver/images/folder_global_announce.gif ## templates/subsilver/images/folder_global_announce_new.gif ## ## History: ## 0.9.0. - initial beta ## 1.0.0. - initial release ## 1.0.5. - History started, fixed a error in admin_ug_auth.php ## 1.0.6. - one more typo fixed in the admin_ug_auth.php ## 1.0.7. - makes it posible to make a hidden category, so global announcement can be controlled more exact ## 1.2.0. - now confirmed on phpBB2 ver 2.0.2, minor changes needed ## 1.2.1. - folder URL of folder_global_announce_new.gif was wrong ## 1.2.2. - fixed that the "hidden" cattegory "global_announcement" was showen in drop-down box ## 1.2.3. - includes images for "fi apple" template ## ############################################################## ## For Security Purposes, Please Check: http://www.phpbb.com/mods/downloads/ for the ## latest version of this MOD. Downloading this MOD from other sites could cause malicious code ## to enter into your phpBB Forum. As such, phpBB will not offer support for MOD's not offered ## in our MOD-Database, located at: http://www.phpbb.com/mods/downloads/ ############################################################## ## Authors Notes: ## ## if you are using a prefix to you DB tabels then you have to add this to ## the SQL commands, e.g. "phpbb_users" instead of just "users" - ONLY ## in the initial [SQL ADD] commands, not in the php code ! ## if in doubt about how to do this, then run the included db_update.php, witch will do the nessesary changes ## ## The most important thing to keep in mind is, take your time, make ## sure you are finding the correct lines to modify, then take care to paste the new code. ## Please also keep in mind, if you are using more than one language file or theme at your ## site, you will need to edit the corrosponding files for each occurrence. Good Luck! ## ################################################################# ## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD ## and the Database ################################################################# # #-----[ ADD SQL ]------------------------------------------ # # or run the included db_update.php file ALTER TABLE forums ADD auth_globalannounce TINYINT (2) DEFAULT '3' NOT NULL AFTER auth_announce # #-----[ ADD SQL ]------------------------------------------ # # or run the included db_update.php file ALTER TABLE auth_access ADD auth_globalannounce TINYINT (1) AFTER auth_announce # #-----[ OPEN ]------------------------------------------ # # (remember to change this in every language dir) language/lang_english/lang_main.php # #-----[ FIND ]------------------------------------------ # // // That's all Folks! // ------------------------------------------------- # #-----[ AFTER, ADD ]------------------------------------------ # // add to global announcment mod $lang['Topic_global_announcement']='Global Announcement:'; $lang['Post_global_announcement'] = 'Global Announcement'; # #-----[ OPEN ]------------------------------------------ # # (remember to change this in every language dir) language/lang_english/lang_admin.php # #-----[ FIND ]------------------------------------------ # // // That's all Folks! // ------------------------------------------------- # #-----[ AFTER, ADD ]------------------------------------------ # // add to global announcment mod $lang['Globalannounce'] ='Global Announce'; # #-----[ OPEN ]------------------------------------------ # index.php # #-----[ FIND ]------------------------------------------ # FROM " . CATEGORIES_TABLE . " c # #-----[ AFTER, ADD ]------------------------------------------ # ".(($userdata['user_level']!=ADMIN)? "WHERE c.cat_title<>\"global_announcement\"" :"" )." # #-----[ OPEN ]------------------------------------------ # viewforum.php # #-----[ FIND ]------------------------------------------ # if( $topic_type == POST_ANNOUNCE ) { $topic_type = $lang['Topic_Announcement'] . ' '; } # #-----[ AFTER, ADD ]------------------------------------------ # else if( $topic_type == POST_GLOBAL_ANNOUNCE ) { $topic_type = $lang['Topic_global_announcement'] . ' '; } # #-----[ FIND ]------------------------------------------ # if( $topic_rowset[$i]['topic_type'] == POST_ANNOUNCE ) { $folder = $images['folder_announce']; # #-----[ BEFORE, ADD ]------------------------------------------ # if( $topic_rowset[$i]['topic_type'] == POST_GLOBAL_ANNOUNCE ) { $folder = $images['folder_global_announce']; $folder_new = $images['folder_global_announce_new']; } else # #-----[ DELETE ]------------------------------------------ # $topic_rowset = array(); $total_announcements = 0; # #-----[ FIND ]------------------------------------------ # // // All announcement data, this keeps announcements // on each viewforum page ... # #-----[ BEFORE, ADD ]------------------------------------------ # // // All GLOBAL announcement data, this keeps GLOBAL announcements // on each viewforum page ... // $sql = "SELECT t.*, u.username, u.user_id, u2.username as user2, u2.user_id as id2, p.post_time, p.post_username FROM " . TOPICS_TABLE . " t, " . USERS_TABLE . " u, " . POSTS_TABLE . " p, " . USERS_TABLE . " u2 WHERE t.topic_poster = u.user_id AND p.post_id = t.topic_last_post_id AND p.poster_id = u2.user_id AND t.topic_type = " . POST_GLOBAL_ANNOUNCE . " ORDER BY t.topic_last_post_id DESC "; if( !$result = $db->sql_query($sql) ) { message_die(GENERAL_ERROR, "Couldn't obtain topic information", "", __LINE__, __FILE__, $sql); } $topic_rowset = array(); $total_announcements = 0; while( $row = $db->sql_fetchrow($result) ) { $topic_rowset[] = $row; $total_announcements++; } $db->sql_freeresult($result); # #-----[ FIND ]------------------------------------------ # AND t.topic_type <> " . POST_ANNOUNCE . " # #-----[ AFTER, ADD ]------------------------------------------ # AND t.topic_type <> " . POST_GLOBAL_ANNOUNCE . " # #-----[ FIND ]------------------------------------------ # 'FOLDER_ANNOUNCE_NEW_IMG' => $images['folder_announce_new'], # #-----[ AFTER, ADD ]------------------------------------------ # 'FOLDER_GLOBAL_ANNOUNCE_IMG' => $images['folder_global_announce'], 'FOLDER_GLOBAL_ANNOUNCE_NEW_IMG' => $images['folder_global_announce_new'], # #-----[ FIND ]------------------------------------------ # 'L_ANNOUNCEMENT' => $lang['Post_Announcement'], # #-----[ AFTER, ADD ]------------------------------------------ # 'L_GLOBAL_ANNOUNCEMENT' => $lang['Post_global_announcement'], # #-----[ OPEN ]------------------------------------------ # includes/constants.php # #-----[ FIND ]------------------------------------------ # define('AUTH_ATTACH', 11); # #-----[ AFTER, ADD ]------------------------------------------ # define('AUTH_GLOBALANNOUNCE', 12); # #-----[ OPEN ]------------------------------------------ # includes/auth.php # #-----[ FIND ]------------------------------------------ # case AUTH_ALL: $a_sql = ' $auth_fields = array( # #-----[ IN-LINE FIND ]------------------------------------------ # , a.auth_announce # #-----[ IN-LINE AFTER, ADD ]------------------------------------------ # , a.auth_globalannounce # #-----[ IN-LINE FIND ]------------------------------------------ # , 'auth_announce' # #-----[ IN-LINE AFTER, ADD ]------------------------------------------ # , 'auth_globalannounce' # #-----[ FIND ]------------------------------------------ # $auth_fields = array('auth_announce'); break; # #-----[ AFTER, ADD ]------------------------------------------ # case AUTH_GLOBALANNOUNCE: $a_sql = 'a.auth_globalannounce'; $auth_fields = array('auth_globalannounce'); break; # #-----[ OPEN ]------------------------------------------ # includes/funtions.php # #-----[ FIND ]------------------------------------------ # function make_jumpbox($action, $match_forum_id = 0) { global $template, $lang, $db, $SID, $nav_links, $phpEx; # #-----[ IN-LINE FIND ]------------------------------------------ # ; # #-----[ IN-LINE BEFORE ADD ]------------------------------------------ # , $userdata # #-----[ FIND ]------------------------------------------ # $sql = "SELECT FROM " . CATEGORIES_TABLE . " c, " . FORUMS_TABLE . " f WHERE f.cat_id = c.cat_id # #-----[ AFTER, ADD ]------------------------------------------ # ".(($userdata['user_level'] == ADMIN)? "" : "AND c.cat_title<>'global_announcement'" )." # #-----[ OPEN ]------------------------------------------ # search.php # #-----[ FIND ]------------------------------------------ # if ($topic_type == POST_ANNOUNCE) { $topic_type = $lang['Topic_Announcement'] . ' '; } # #-----[ BEFORE, ADD ]------------------------------------------ # if($topic_type == POST_GLOBAL_ANNOUNCE ) { $topic_type = $lang['Topic_global_announcement'] . " "; } else # #-----[ FIND ]------------------------------------------ # else if ( $searchset[$i]['topic_type'] == POST_ANNOUNCE ) # #-----[ IN-LINE FIND ]------------------------------------------ # ) # #-----[ IN-LINE BEFORE, ADD ]------------------------------------------ # || $searchset[$i]['topic_type'] == POST_GLOBAL_ANNOUNCE # #-----[ FIND ]------------------------------------------ # $sql = "SELECT c.cat_title, c.cat_id, f.forum_name, f.forum_id FROM " . CATEGORIES_TABLE . " c, " . FORUMS_TABLE . " f WHERE f.cat_id = c.cat_id # #-----[ AFTER, ADD ]------------------------------------------ # ".(($userdata['user_level'] == ADMIN)? "" : "AND c.cat_title<>'global_announcement'" )." # #-----[ OPEN ]------------------------------------------ # posting.php # #-----[ FIND ]------------------------------------------ # if ( $topic_type == POST_ANNOUNCE ) # #-----[ BEFORE, ADD ]------------------------------------------ # if ( $topic_type == POST_GLOBAL_ANNOUNCE ) { $is_auth_type = 'auth_globalannounce'; } else # #-----[ FIND ]------------------------------------------ # $topic_type = ( $topic_type != $post_data['topic_type'] && !$is_auth['auth_sticky'] && !$is_auth['auth_announce'] ) ? $post_data['topic_type'] : $topic_type; # #-----[ IN-LINE FIND ]------------------------------------------ # ) # #-----[ IN-LINE BEFORE, ADD ]------------------------------------------ # && !$is_auth['auth_globalannounce'] # #-----[ FIND ]------------------------------------------ # $topic_type_toggle .= ' /> ' . $lang['Post_Announcement'] . '  '; } # #-----[ AFTER, ADD ]------------------------------------------ # if( $is_auth['auth_globalannounce'] ) { $topic_type_toggle .= ' array(AUTH_ALL, AUTH_ALL, AUTH_ALL, AUTH_ALL, AUTH_REG, AUTH_REG, AUTH_MOD, AUTH_MOD, AUTH_REG, AUTH_REG), 1 => array(AUTH_ALL, AUTH_ALL, AUTH_REG, AUTH_REG, AUTH_REG, AUTH_REG, AUTH_MOD, AUTH_MOD, AUTH_REG, AUTH_REG), 2 => array(AUTH_REG, AUTH_REG, AUTH_REG, AUTH_REG, AUTH_REG, AUTH_REG, AUTH_MOD, AUTH_MOD, AUTH_REG, AUTH_REG), 3 => array(AUTH_ALL, AUTH_ACL, AUTH_ACL, AUTH_ACL, AUTH_ACL, AUTH_ACL, AUTH_ACL, AUTH_MOD, AUTH_ACL, AUTH_ACL), 4 => array(AUTH_ACL, AUTH_ACL, AUTH_ACL, AUTH_ACL, AUTH_ACL, AUTH_ACL, AUTH_ACL, AUTH_MOD, AUTH_ACL, AUTH_ACL), 5 => array(AUTH_ALL, AUTH_MOD, AUTH_MOD, AUTH_MOD, AUTH_MOD, AUTH_MOD, AUTH_MOD, AUTH_MOD, AUTH_MOD, AUTH_MOD), 6 => array(AUTH_MOD, AUTH_MOD, AUTH_MOD, AUTH_MOD, AUTH_MOD, AUTH_MOD, AUTH_MOD, AUTH_MOD, AUTH_MOD, AUTH_MOD), ); # #-----[ REPLACE WITH ]------------------------------------------ # $simple_auth_ary = array( 0 => array(AUTH_ALL, AUTH_ALL, AUTH_ALL, AUTH_ALL, AUTH_REG, AUTH_REG, AUTH_MOD, AUTH_MOD, AUTH_MOD, AUTH_REG, AUTH_REG), 1 => array(AUTH_ALL, AUTH_ALL, AUTH_REG, AUTH_REG, AUTH_REG, AUTH_REG, AUTH_MOD, AUTH_MOD, AUTH_MOD, AUTH_REG, AUTH_REG), 2 => array(AUTH_REG, AUTH_REG, AUTH_REG, AUTH_REG, AUTH_REG, AUTH_REG, AUTH_MOD, AUTH_MOD, AUTH_MOD, AUTH_REG, AUTH_REG), 3 => array(AUTH_ALL, AUTH_ACL, AUTH_ACL, AUTH_ACL, AUTH_ACL, AUTH_ACL, AUTH_ACL, AUTH_MOD, AUTH_MOD, AUTH_ACL, AUTH_ACL), 4 => array(AUTH_ACL, AUTH_ACL, AUTH_ACL, AUTH_ACL, AUTH_ACL, AUTH_ACL, AUTH_ACL, AUTH_MOD, AUTH_MOD, AUTH_ACL, AUTH_ACL), 5 => array(AUTH_ALL, AUTH_MOD, AUTH_MOD, AUTH_MOD, AUTH_MOD, AUTH_MOD, AUTH_MOD, AUTH_MOD, AUTH_MOD, AUTH_MOD, AUTH_MOD), 6 => array(AUTH_MOD, AUTH_MOD, AUTH_MOD, AUTH_MOD, AUTH_MOD, AUTH_MOD, AUTH_MOD, AUTH_MOD, AUTH_MOD, AUTH_MOD, AUTH_MOD), ); # #-----[ FIND ]------------------------------------------ # $forum_auth_fields = array('auth_view', 'auth_read', 'auth_post', 'auth_reply', 'auth_edit', 'auth_delete', 'auth_sticky', 'auth_announce', 'auth_vote', 'auth_pollcreate'); # #-----[ IN-LINE FIND ]------------------------------------------ # , 'auth_announce' # #-----[ IN-LINE AFTER, ADD ]------------------------------------------ # , 'auth_globalannounce' # #-----[ FIND ]------------------------------------------ # 'auth_announce' => $lang['Announce'], # #-----[ AFTER, ADD ]------------------------------------------ # 'auth_globalannounce' => $lang['Globalannounce'], # #-----[ OPEN ]------------------------------------------ # admin/admin_ug_auth.php # #-----[ FIND ]------------------------------------------ # $forum_auth_fields = array('auth_view', 'auth_read', 'auth_post', 'auth_reply', 'auth_edit', 'auth_delete', 'auth_sticky', 'auth_announce', 'auth_vote', 'auth_pollcreate'); # #-----[ IN-LINE FIND ]------------------------------------------ # , 'auth_announce' # #-----[ IN-LINE AFTER, ADD ]------------------------------------------ # , 'auth_globalannounce' # #-----[ FIND ]------------------------------------------ # 'auth_announce' => AUTH_ANNOUNCE, # #-----[ AFTER, ADD ]------------------------------------------ # 'auth_globalannounce' => AUTH_GLOBALANNOUNCE, # #-----[ FIND ]------------------------------------------ # 'auth_announce' => $lang['Announce'], # #-----[ AFTER, ADD ]------------------------------------------ # 'auth_globalannounce' => $lang['Globalannounce'], # #-----[ FIND ]------------------------------------------ # SET auth_view = 0, auth_read = 0, auth_post = 0, auth_reply = 0, auth_edit = 0, auth_delete = 0, auth_sticky = 0, auth_announce = 0 # #-----[ IN-LINE FIND ]------------------------------------------ # , auth_announce = 0 # #-----[ IN-LINE AFTER, ADD ]------------------------------------------ # , auth_globalannounce = 0 # #-----[ FIND ]------------------------------------------ # SET auth_view = 0, auth_read = 0, auth_post = 0, auth_reply = 0, auth_edit = 0, auth_delete = 0, auth_sticky = 0, auth_announce = 0 # #-----[ IN-LINE FIND ]------------------------------------------ # , auth_announce = 0 # #-----[ IN-LINE AFTER, ADD ]------------------------------------------ # , auth_globalannounce = 0 # #-----[ OPEN ]------------------------------------------ # # (remember to do this to alle templates instaled on the board) templates/Subsilver/viewforum_body.tpl # #-----[ FIND ]------------------------------------------ # {L_ANNOUNCEMENT} {L_ANNOUNCEMENT} # #-----[ REPLACE WITH ]------------------------------------------ # {L_GLOBAL_ANNOUNCEMENT} {L_GLOBAL_ANNOUNCEMENT} # #-----[ FIND ]------------------------------------------ # {L_STICKY} {L_STICKY} # #-----[ REPLACE WITH ]------------------------------------------ # {L_ANNOUNCEMENT} {L_ANNOUNCEMENT} # #-----[ FIND ]------------------------------------------ # {L_NO_NEW_POSTS_TOPIC_LOCKED} {L_NO_NEW_POSTS_LOCKED} # #-----[ AFTER, ADD ]------------------------------------------ #    {L_STICKY} {L_STICKY} # #-----[ OPEN ]------------------------------------------ # # (remeber to do this to alle templates instaled on the board) templates/subsilver/subsilver.cfg # #-----[ FIND ]------------------------------------------ # $images['folder_announce_new'] = "$current_template_images/folder_announce_new.gif"; # #-----[ AFTER, ADD ]------------------------------------------ # $images['folder_global_announce'] = "$current_template_images/folder_global_announce.gif"; $images['folder_global_announce_new'] = "$current_template_images/folder_global_announce_new.gif"; # #-----[ COPY ]------------------------------------------ # templates/subsilver/images/folder_global_announce.gif # #-----[ COPY ]------------------------------------------ # templates/subsilver/images/folder_global_announce_new.gif # #-----[ SAVE/CLOSE ALL FILES ]------------------------------------------ # # EoM