Question about your reply?

This mod will make it posible to specify permissions to all "special pages, like MEMBERLIST, PROFILE VIEW and so on.
The permissions support USERGROUP, making this tool very powerfull

Moderator: Moderators

Forum rules
The content in this forum is dated Dec. 21 2005 and can be used as Archive only. This Forum is LOCKED and READ ONLY !

Question about your reply?

Postby II_Iron on Mon 20. Jan, 2003 23:37

Niels, you posted this reply :http://www.phpbb.com/phpBB/viewtopic.php?p=410631#410631 and I have your pre-loaded installed. Is it possible to add non-php pages to the extra permisions? I have a calendar an links page that are mods to the board, and they are not listed in the dropdown box.
II_Iron
Poster
Poster
 
Posts: 35
Joined: Wed 08. May, 2002 22:31

Postby Niels on Thu 23. Jan, 2003 13:58

yes, no problem
(I asume when you talk about a "drop-down" - you are refaring to the forum permission drop down list - rigth ?)

to add the calender mod :
first go into your constants.php, and define a page number (if not already done)
Code: Select all
define('PAGE_CALENDER', -77);

(you may assign any "free" NEGATIVE number)

afte this is done, you must add a new entry in the DB
like this one (snap from my db_update.php file)

Code: Select all
'INSERT IGNORE INTO ' . FORUMS_TABLE . ' (forum_id ,cat_id, forum_name, forum_desc, forum_status )
VALUES ("'.PAGE_CALENDER.'", "0", "CALENDER PAGE", "Calender Page Control", 1 )',


after this is done, you may configure permissions inside admin panel
to make these to work, you should add this to the page_header.php
Code: Select all
[FIND]
if ($view_pages_ary[''.PAGE_PROFILE]['auth_view'])
{
   $template->assign_block_vars('switch_profile_on', array());
}

[AFTER, ADD]
if ($view_pages_ary[''.PAGE_CALENDER]['auth_view'])
{
   $template->assign_block_vars('switch_calender_on', array());
}


in file
calender.php (or like)

Code: Select all
[FIND]
// End session management
//

[AFTER, ADD] (something like this)
// Added for Extra permission MOD
// Start auth check
//
$is_auth = array();
$is_auth = auth(AUTH_ALL, PAGE_CALENDER, $userdata);

if( !$is_auth['auth_view'] || !$is_auth['auth_read'] )
{
   if ( !$userdata['session_logged_in'] )
   {
      $header_location = ( @preg_match("/Microsoft|WebSTAR|Xitami/", getenv("SERVER_SOFTWARE")) ) ? "Refresh: 0; URL=" : "Location: ";
      header($header_location . append_sid("login.$phpEx?redirect=calender.$phpEx", true));
      exit;
   }
   $message = ( !$is_auth['auth_view'] ) ? $lang['Topic_post_not_exist'] : sprintf($lang['Sorry_auth_read'], $is_auth['auth_read_type']);
   message_die(GENERAL_MESSAGE, $message);
}


you may inside any template, where the link to the calender is, place a switch before/after the HTML code, so users only see this link if they have been granted "auth_view"

e.g. in the overall_body.tpl, something like this:
Code: Select all
<!-- BEGIN switch_calender_on -->
<a href="{U_CALENDER}" class="mainmenu"><img src="templates/subSilver/images/icon_mini_calender.gif" width="12" height="13" border="0" alt="{L_CALENDER}" hspace="3" />{L_CALENDER}</a>&nbsp; &nbsp;
<!-- END switch_calender_on -->


btw. have you figured out how it all works..I haven't made any "precise" manual, and have figured out that most poeple would guess how it works :D
User avatar
Niels
Poster
Poster
 
Posts: 4390
Joined: Sat 27. Jul, 2002 15:46

Postby II_Iron on Fri 24. Jan, 2003 05:55

Thanks for the reply, and yes I have figured out how it works. As for this mod, is there a way for it to work on a non-php page?
II_Iron
Poster
Poster
 
Posts: 35
Joined: Wed 08. May, 2002 22:31


Return to Extra permission [2.0.6/EM]

Who is online

Users browsing this forum: No registered users and 0 guests

cron