代碼: 選擇全部
##############################################################
## MOD Title: Page Permissions
## MOD Author: drathbun < N/A > (Dave Rathbun) http://www.phpBBDoctor.com
## MOD Description: Set permissions by page (guest, reg, private, mod, admin)
## MOD Version: 1.0.0
##
##
## Installation Level: Easy
## Installation Time: ~ 5 Minutes
## Files To Edit: includes/constants.php, includes/functions.php, language/lang_english/lang_admin.php, language/lang_english/lang_main.php
## Included Files: cache_pages.php, admin_page_permissions.php, phpbbdoctor_cache_functions.php, page_permissions.php, page_permissions_list_body.tpl, page_permissions_edit_body.tpl
## License: http://opensource.org/licenses/gpl-license.php GNU General Public License v2
##############################################################
## For security purposes, please check: http://www.phpbb.com/mods/
## for the latest version of this MOD. Although MODs are checked
## before being allowed in the MODs Database there is no guarantee
## that there are no security problems within the MOD. No support
## will be given for MODs not found within the MODs Database which
## can be found at http://www.phpbb.com/mods/
##############################################################
## Author Notes:
## This MOD is designed to allow board administrators to
## control access at the page level rather than at the forum
## level. It is not intended to replace the existing phpBB
## permission system but to supplement it.
##
## For example, a common request is to "protect" the member
## list by preventing guests from viewing that page. Or perhaps
## even only allowing board moderators to view that
## information. This MOD will do that. It can also handle pages
## with different functions such as profile.php (which handles
## editing profiles, viewing profiles, and even new user
## registrations).
##
## This MOD also sets up a page view counter for each page that
## you specify. Page counts are incremented based on MEMBER or
## GUEST viewing, and can be reset at any time.
##
## Finally, you can disable individual pages. If a page is
## disabled users with ADMIN permissions can still view the
## pages, which will allow you to work on the page without
## other board members seeing what is going on. Want to shut
## down new user registrations? Simply set the profile page
## with mode of "register" to ADMIN and nobody will be able to
## register. Want to keep guests from viewing member profiles?
## Want to restrict access to a custom php page to members of a
## specific group? This MOD can do all of that.
##
## Access levels include:
## Guest
## Registered
## Private
## Moderator
## Administrator
##
## Note that there is a loophole with "moderator" permissions.
## Users that have ever been a moderator of something may still
## have a user_level value of "2", which means that they can
## still appear as a Moderator. This is not a problem with this
## MOD, and to the best of my knowledge has been fixed in the
## latest versions of phpBB.
##
## Final note: this MOD can be used to set permissions for
## *any* page in your board, even something that is not a part
## of the standard phpBB distribution. You must, however,
## include the phpBB session handler in order for this to work.
## At the current time all pages must be in the same directory
## as the forum.
##
## Permissions Hierarchy (changed in 0.7.2)
## A page may have different permissions based on different URL
## parameters. One valid parameter is "no" parameter. In older
## versions (0.7.0 and earlier) this MOD would first find the
## match for a page with no parameter and use the permission
## settings at that level for all accesses to that page, even
## if there was a potential match for the URL parameters. In
## 0.7.2 the process has been fixed. You can now have different
## permissions for a page both with and without URL parameters
## and it should work correctly.
##
## eXtreme Styles MOD
## If you have this MOD installed you need to make a small
## change to one of the files to keep it from removing the Page
## Permissions cache file when a "clear all" process is run.
## Open admin/xs_cache.php and find the following code:
## $skip_files = array(
## '.',
## '..',
## '.htaccess',
## 'index.htm',
## 'index.html',
## 'index.php',
## 'attach_config.php',
## );
##
## Inline find );
## Before, add
## 'cache_pages.php'
##
## Note that in my version this line
## 'attach_config.php',
## has an extra comma at the end, which should not be there. If
## your version does not have this extra comma then you will
## need to add one in order to avoid a syntax error, then add
## in the extra line as noted above. The final block of code
## should look something like this:
## $skip_files = array(
## '.',
## '..',
## '.htaccess',
## 'index.htm',
## 'index.html',
## 'index.php',
## 'attach_config.php',
## 'cache_pages.php'
## );
##
## This MOD has 20 install instructions.
##############################################################
## MOD History:
##
## 2006-03-31 - Version 1.0.0
## Release candidate
##
## Prior version history available on the author's
## web site
##############################################################
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD
##############################################################
#
#-----[ SQL ]-------------------------------------
#
CREATE TABLE phpbb_pages
(page_id mediumint(5) unsigned not null auto_increment
,page_name varchar(32) not null
,page_parm_name varchar(32) default ''
,page_parm_value varchar(32) default ''
,page_key varchar(255) default ''
,member_views int(11) unsigned default 0
,guest_views int(11) unsigned default 0
,disable_page tinyint(1) unsigned default 0
,auth_level tinyint(2) unsigned default 0
,min_post_count mediumint(8) unsigned default 0
,max_post_count mediumint(8) unsigned default 0
,group_list varchar(255) default ''
,primary key (page_id)
,unique key (page_key)
);
insert into phpbb_pages (page_name, page_key) values ('index.php', 'index.php');
insert into phpbb_pages (page_name, page_key) values ('viewforum.php', 'viewforum.php');
insert into phpbb_pages (page_name, page_key) values ('viewtopic.php', 'viewtopic.php');
insert into phpbb_pages (page_name, page_key) values ('faq.php', 'faq.php');
insert into phpbb_pages (page_name, page_key) values ('search.php', 'search.php');
insert into phpbb_pages (page_name, page_key) values ('login.php', 'login.php');
insert into phpbb_pages (page_name, page_key, auth_level) values ('memberlist.php', 'memberlist.php', 1);
insert into phpbb_pages (page_name, page_key, page_parm_name, page_parm_value, auth_level) values ('profile.php', 'profile.php?mode=viewprofile', 'mode', 'viewprofile', 1);
insert into phpbb_pages (page_name, page_key, page_parm_name, page_parm_value) values ('profile.php', 'profile.php?mode=register', 'mode', 'register');
#
#-----[ COPY ]-------------------------------------
#
copy cache_pages.php to cache/cache_pages.php
copy admin_page_permissions.php to admin/admin_page_permissions.php
copy phpbbdoctor_cache_functions.php to admin/phpbbdoctor_cache_functions.php
copy page_permissions.php to includes/page_permissions.php
copy page_permissions_list_body.tpl to templates/subSilver/admin/page_permissions_list_body.tpl
copy page_permissions_edit_body.tpl to templates/subSilver/admin/page_permissions_edit_body.tpl
#
#-----[ DIY INSTRUCTIONS ]-------------------------------------
#
CHMOD cache/cache_pages.php to 666
#\r
#-----[ OPEN ]-------------------------------------
#
includes/constants.php
#
#-----[ FIND ]-------------------------------------
#
?>
#
#-----[ BEFORE, ADD ]-------------------------------------
#
// BEGIN Page Permissions 1.0.0 (www.phpBBDoctor.com)
define('PAGES_TABLE', $table_prefix.'pages');
define('PAGE_AUTH_GUEST', 0);
define('PAGE_AUTH_REG', 1);
define('PAGE_AUTH_PRIVATE', 2);
define('PAGE_AUTH_MOD', 3);
define('PAGE_AUTH_ADMIN', 4);
// END Page Permissions 1.0.0 (www.phpBBDoctor.com)
#
#-----[ OPEN ]-------------------------------------
#
includes/functions.php
#
#-----[ FIND ]-------------------------------------
#
//
// Set up style
#
#-----[ BEFORE, ADD ]-------------------------------------
#
// BEGIN Page Permissions 1.0.0 (www.phpBBDoctor.com)
include_once($phpbb_root_path . 'includes/page_permissions.php');
// END Page Permissions 1.0.0 (www.phpBBDoctor.com)
#
#-----[ OPEN ]-------------------------------------
#
language/lang_english/lang_admin.php
#
#-----[ FIND ]-------------------------------------
#
//
// That's all Folks!
#
#-----[ BEFORE, ADD ]-------------------------------------
#
// BEGIN Page Permissions 1.0.0 (www.phpBBDoctor.com)
$lang['Add_new_page'] = 'Add new page';
$lang['No_page_selected'] = 'No page selected';
$lang['No_page_group'] = 'None';
$lang['Unknown_group_type'] = 'Unknown';
$lang['Page_permissions_admin_title'] = 'Page Permissions';
$lang['Page_permissions_element'] = 'Page';
$lang['Page_ID'] = 'Page ID (System assigned)';
$lang['Page_name'] = 'Page Name';
$lang['Page_function'] = 'Page Function';
$lang['Guest_views'] = 'Guest Views';
$lang['Guest_views_pct'] = 'Pct';
$lang['Guest_views_explain'] = 'This counter shows how many page views were done by guest viewers. This value may be adjusted in case you want to start over at a certain point.';
$lang['Member_views'] = 'Member Views';
$lang['Member_views_pct'] = 'Pct';
$lang['Member_views_explain'] = 'This counter shows how many page views were done by viewers that were logged on to your board. This value may be adjusted in case you want to start over at a certain point.';
$lang['Page_views'] = 'Page Views';
$lang['Page_views_pct'] = 'Pct';
$lang['Total_page_views'] = 'Total Page Views';
$lang['Page_permissions_explain'] = 'This table lists all site pages that have been added to your page permissions list. The ID is assigned by the system. The page view count is updated each time a page is viewed or refreshed. You can use this page to disable individual pages, set guest view permissions, or require admin access.';
$lang['Disable_page'] = 'Disable?';
$lang['Disable_page_explain'] = 'This option allows you to disable a page without disabling your entire board. Admin-level users will still be able to view / interact with this page but everyone else will receive a message saying that the page is offline. To change this message edit the entry in the main language file instead of the admin version.';
$lang['Auth_level'] = 'Access Level';
$lang['Page_parm_name'] = 'Parameter';
$lang['Page_parm_name_explain'] = 'Some pages have parameters based by GET or POST. If you want to check for a specific value, enter the parameter name to check here. An example might be "mode" for the profile page. You might want to set different permissions for "register" than you would for "viewprofile" or other values. Note that you do <b>not</b> have to define all possible parameter values, only those that you want to track or assign permissions to.';
$lang['Page_parm_value'] = 'Value (Required if Parameter is provided)';
$lang['Min_post_count'] = 'Min Posts';
$lang['Min_post_count_explain'] = 'A non-zero value here means that a user must have a minimum post count in order to view a page. As an example, this would allow you to set a minimum number of posts to view the memberlist or even a specific forum.';
$lang['Max_post_count'] = 'Max Posts';
$lang['Max_post_count_explain'] = 'A non-zero value here means that a user must have less than a set number of posts in order to view the page. Be careful that your max post count is higher than your min post count or you will have created a page that nobody can view. An administrator can always view the page.';
$lang['Page_group'] = 'Group Access Allowed';
$lang['Page_group_explain'] = 'Select one or more groups allowed to access this page. Note that this information is only used for access level <b>Private</b>';
$lang['Permission_public'] = 'Public';
$lang['Permission_registered'] = 'Registered';
$lang['Permission_private'] = 'Private';
$lang['Permission_moderator'] = 'Moderator';
$lang['Permission_administrator'] = 'Administrator';
// Added when we included ability to enable / disable page view counts
$lang['Page_view_count_is'] = 'Page view count is ';
$lang['Count_views'] = 'Increment page view counters: ';
$lang['Save_count_views'] = ' Save ';
// Added when we included ability to mass enable / disable pages on page listing
$lang['Update_selected_pages'] = 'Update Selected Pages';
$lang['1_page_enabled'] = 'There was 1 page enabled';
$lang['1_page_disabled'] = 'There was 1 page disabled';
$lang['X_pages_enabled'] = 'There were %d pages enabled';
$lang['X_pages_disabled'] = 'There were %d pages disabled';
// General admin token strings used
// in all phpBBDoctor admin pages
$lang['Updated'] = ' Updated ';
$lang['Inserted'] = ' Inserted ';
$lang['Deleted'] = ' Deleted ';
$lang['Rebuild_cache'] = 'Rebuild cache';
$lang['Cache_updated'] = ' cache updated ';
$lang['Click_return_list'] = 'Click %sHere%s to return to %s list';
// END Page Permissions 1.0.0 (www.phpBBDoctor.com)
#
#-----[ OPEN ]-------------------------------------
#
language/lang_english/lang_main.php
#
#-----[ FIND ]-------------------------------------
#
//
// That's all, Folks!
#
#-----[ BEFORE, ADD ]-------------------------------------
#
// BEGIN Page Permissions 1.0.0 (www.phpBBDoctor.com)
$lang['Page_disabled'] = 'This page is temporarily offline for maintenance';
$lang['Insufficient_privileges'] = 'You do not have authorization to view this page';
$lang['Post_count_too_low'] = 'You do not have enough posts to view this page yet.';
$lang['Post_count_too_high'] = 'You have too many posts to view this page.';
// END Page Permissions 1.0.0 (www.phpBBDoctor.com)
#
#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------
#
# EoM