How to add task.php as a special page in this mod?

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 !

How to add task.php as a special page in this mod?

Postby being on Mon 17. Mar, 2003 20:58

have installed the mod and works fine for the memberlist and index page

but how can i add task.php(the new to-do-list mod) as a special page, so only certain usergroups are permitted to access this page

please advise

thank u
being
Poster
Poster
 
Posts: 12
Joined: Sun 29. Dec, 2002 22:28

Postby Niels on Tue 08. Apr, 2003 15:43

First of all, I'm will say that I am not aware of how the to do mod works, but I'll describe the basic principle:

first you must add the page as a forum, to do this, you may make a
[ADD SQL] (like this)
Code: Select all
'INSERT IGNORE INTO ' . FORUMS_TABLE . ' (forum_id ,cat_id, forum_name, forum_desc, forum_status )
VALUES ("'.PAGE_TO_DO.'", "0", "TO DO PAGE", "TO DO Control", 1 )',

pay attention that this is taken from one of my db_update.php files, to manually add this, you need to substitude some of the code, if you are in doubt about what to change you sohuld not do it manually !
I asume that the TO-DO list mod, have a new entry in constants.php, witch look define a page number to this
"define ('PAGE_TO_DO',........"
or similar, if another word for PAGE_TO_DO, then you have to replace this in this tutorial

then you need to add some extra code to the page_header.php, witch will allow templates to not show the link to the to-do list

e.g.
Code: Select all
[FIND]
$view_pages_ary = auth(AUTH_VIEW, AUTH_LIST_ALL, $userdata);

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


now you need to surrender the link in the template (proberbly the overall_header.tpl file)
with
Code: Select all
<!-- BEGIN switch_to_do_on -->
and
<!-- END switch_to_do_on -->


finally you need to open the drop in file task.php
in the header of this file, you need to place a code like this
Code: Select all
[FIND]
// End session management
//

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

if( !$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=task.$phpEx", true));
      exit;
   }
   $message = sprintf ($lang['Sorry_no_auth'],$is_auth['auth_read_type']);
   message_die(GENERAL_MESSAGE, $message);
}
//
// End auth check
//


if you inside the task.php file need to specify if a user only may do specific actions, you may use the $is_auth['auth_post'] or like to detemen if the user are allowed or not
User avatar
Niels
Poster
Poster
 
Posts: 4390
Joined: Sat 27. Jul, 2002 15:46

Postby m3kon on Thu 19. Jun, 2003 15:37

has anybody actually managed to add a new page with permissions so that only certain users/groups can see it, if so can you please explain a little better, i want to make a new page and get it so only certain usergroups can see it i got the,
Code: Select all
"INSERT IGNORE INTO ".FORUMS_TABLE." (forum_id ,cat_id, forum_name, forum_desc, forum_status )
VALUES ('-101', '0', 'PAGE_TVAONLY', 'TVAONLY Control', 1 )",

code to add from the shoutbox install, but still not sure the rest ?

Thanks in advance...
m3kon
Poster
Poster
 
Posts: 10
Joined: Tue 22. Oct, 2002 18:03

Postby Niels on Thu 04. Sep, 2003 12:39

take a look at this
http://mods.db9.dk/viewtopic.php?p=10132#10132

it is a basic tutorial about how to add into search.php, the principle is the same with other pages.


about your SQL....
VALUES ('-101', '0', 'PAGE_TVAONLY'


the value MUST be a uniqe value, most pages have a special page ID defined in constants.php, you need to use this instead - if the page have no page ID defined, I would advice to add one. so, take any availble NEGATIVE value.
e.g. NOT -101 as this is used for shoutbox
define('PAGE_SHOUTBOX_MAX',-101);
(if a how-to is EM ready, it will mostly be bullet prof, since a machine is more picky than a human. :D)
User avatar
Niels
Poster
Poster
 
Posts: 4390
Joined: Sat 27. Jul, 2002 15:46


Return to Extra permission [2.0.6/EM]

Who is online

Users browsing this forum: No registered users and 1 guest

cron