http://www.icyphoenix.com/viewtopic.php?f=30&t=15
-----------------------------------
KugeLSichA
Thu 10 Aug, 2006 01:37

How To Add A New Page Permission To ACP
-----------------------------------
Hi there,

if you have an new site that is not included in the xs package, and you know who i can add a new site AUTH to the DB which is configuarable over the site page permissions in ACP, just let me know.

if you have the time maybe one can write an documantation about this, like an MOD install instruction.. maybe others find this usefull

thx

[hr]

EDITED BY MG

[code]
##############################################################
## MOD Title: Page permissions for a new site in phpBBXS
## MOD Author: KugeLSichA < kugelsicha@caromonline.de > (HoLLe) http://www.caromguild.de
## MOD Description: If you have an other site that is not included in phpBBXS 
##                  package, and you want to add the phpBBXS site 
##                  permissions to this site, add the following lines to your 
##                  site.
##                  Site permissions can be set in ACP -> config -> site 
##                  permissions.
## MOD Version: 1.0.0
##
## Installation Level: Easy
## Installation Time: 5 min
## Files To Edit: 4
##                adm/admin_board_permissions.php
##                lanugage/lang_english/lang_admin.php
##                new_page.php
##                templates/ca_aphrodite/admin/board_config_permissions_body.tpl
## Included Files: n/a
##############################################################
## 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 MODs not offered
## in our MOD-Database, located at: http://www.phpbb.com/mods/downloads/
##############################################################
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD
##############################################################
#
#-----[ SQL ]------------------------------------------
#
INSERT INTO `phpbb_config_mg` (`config_name`, `config_value`) VALUES ('auth_view_new_page', '0');

#
#-----[ OPEN ]------------------------------------------
#
adm/admin_board_permissions.php
#
#-----[ FIND ]------------------------------------------
#
$auth_view['viewonline'] = auth_select($new['auth_view_viewonline'], 'auth_view_viewonline');
#
#-----[ AFTER, ADD ]------------------------------------------
#
$auth_view['new_page'] = auth_select($new['auth_view_new_page'], 'auth_view_new_page');
#
#-----[ FIND ]------------------------------------------
#
"L_AUTH_VIEW_VIEWONLINE" => $lang['auth_view_viewonline'],
#
#-----[ AFTER, ADD ]------------------------------------------
#
"L_AUTH_NEW_PAGE" => $lang['auth_new_page'],
#
#-----[ FIND ]------------------------------------------
#
"S_AUTH_VIEW_VIEWONLINE" => $auth_view['viewonline'],
#
#-----[ AFTER, ADD ]------------------------------------------
#
"S_AUTH_VIEW_NEW_PAGE" => $auth_view['new_page'],

#
#-----[ OPEN ]------------------------------------------
#
templates/ca_aphrodite/admin/board_config_permissions_body.tpl
#
#-----[ FIND ]------------------------------------------
#
	<tr>
		<td class="row1">{L_AUTH_VIEW_VIEWONLINE}</td>
		<td class="row2">{S_AUTH_VIEW_VIEWONLINE}</td>
	</tr>
#
#-----[ AFTER, ADD ]------------------------------------------
#
	<tr>
		<td class="row1">{L_AUTH_VIEW_NEW_PAGE}</td>
		<td class="row2">{S_AUTH_VIEW_NEW_PAGE}</td>
	</tr>

#
#-----[ OPEN ]------------------------------------------
#
# do this for all languages you have installed!
lanugage/lang_english/lang_admin.php
#
#-----[ FIND ]------------------------------------------
#
$lang['auth_view_viewonline'] = 'View Online';
#
#-----[ AFTER, ADD ]------------------------------------------
#
$lang['auth_view_new_page'] = 'New Page';

#
#-----[ OPEN ]------------------------------------------
#
new_page.php
#
#-----[ FIND ]------------------------------------------
#
# similar
// Start session management
$userdata = session_pagestart($user_ip, PAGE_INDEX);
init_userprefs($userdata);
// End session management 
#
#-----[ AFTER, ADD ]------------------------------------------
#
$auth_level_req = $config_mg['auth_view_new_page'];
if ($auth_level_req > AUTH_ALL)
{
    if ( ($auth_level_req == AUTH_REG) && (!$userdata['session_logged_in']) )
    {
        message_die(GENERAL_MESSAGE, $lang['Not_Auth_View']);
    }
    if ($userdata['user_level'] != ADMIN)
    {
        if ( $auth_level_req == AUTH_ADMIN )
        {
            message_die(GENERAL_MESSAGE, $lang['Not_Auth_View']);
        }
        if ( ($auth_level_req == AUTH_MOD) && ($userdata['user_level'] != MOD) )
        {
            message_die(GENERAL_MESSAGE, $lang['Not_Auth_View']);
        }
    }
}
 
#
#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------
#
# EoM
[/code]


-----------------------------------
Mighty Gorgon
Thu 10 Aug, 2006 02:17

Re: How To Add A New Site AUTH
-----------------------------------
[quote user="KugeLSichA" post="41"]Hi there,

if you have an new site that is not included in the xs package, and you know who i can add a new site AUTH to the DB which is configuarable over the site page permissions in ACP, just let me know.

if you have the time maybe one can write an documantation about this, like an MOD install instruction.. maybe others find this usefull

thx[/quote]
Sorry, but can you explain this again? I haven't understand what do you mean.


-----------------------------------
KugeLSichA
Thu 10 Aug, 2006 02:26

Re: How To Add A New Site AUTH
-----------------------------------
i have a new site, maybe movies.php

and want to add this code:
[code]$auth_level_req = $config_mg['auth_view_forum'];
if ($auth_level_req > AUTH_ALL)
{
	if ( ($auth_level_req == AUTH_REG) && (!$userdata['session_logged_in']) )
	{
		redirect(append_sid(LOGIN_MG . "?redirect=forum.$phpEx", true));
	}
	if ($userdata['user_level'] != ADMIN)
	{
		if ( $auth_level_req == AUTH_ADMIN )
		{
			message_die(GENERAL_MESSAGE, $lang['Not_Auth_View']);
		}
		if ( ($auth_level_req == AUTH_MOD) && ($userdata['user_level'] != MOD) )
		{
			message_die(GENERAL_MESSAGE, $lang['Not_Auth_View']);
		}
	}
}[/code]

to it... this is the code from forum.php... and i nee an how to, for adding the new DB field, and which is to edit in the ACP, that i can that up the page mermissions...

you understand?


-----------------------------------
Mighty Gorgon
Thu 10 Aug, 2006 09:31

Re: How To Add A New Site AUTH
-----------------------------------
Ok, now I got this! :lol:

[list=1][*]First thing you have to choose the name for the DB field and add it:
[codeblock]INSERT INTO `phpbb_config_mg` (`config_name`, `config_value`) VALUES ('auth_view_new_page', '0');[/codeblock]
[*]Open [b]adm/admin_board_permissions.php[/b]
FIND
[codeblock]$auth_view['viewonline'] = auth_select($new['auth_view_viewonline'], 'auth_view_viewonline');[/codeblock]
ADD AFTER
[codeblock]$auth_view['new_page'] = auth_select($new['auth_view_new_page'], 'auth_view_new_page');[/codeblock]
FIND
[codeblock]	"L_AUTH_VIEW_VIEWONLINE" => $lang['auth_view_viewonline'],[/codeblock]
ADD AFTER
[codeblock]	"L_AUTH_NEW_PAGE" => $lang['auth_new_page'],[/codeblock]
FIND
[codeblock]	"S_AUTH_VIEW_VIEWONLINE" => $auth_view['viewonline'],[/codeblock]
ADD AFTER
[codeblock]	"S_AUTH_VIEW_NEW_PAGE" => $auth_view['new_page'],[/codeblock]
[*]Open [b]templates/ca_aphrodite/admin/board_config_permissions_body.tpl[/b]
FIND
[codeblock]	<tr>
		<td class="row1">{L_AUTH_VIEW_VIEWONLINE}</td>
		<td class="row2">{S_AUTH_VIEW_VIEWONLINE}</td>
	</tr>
[/codeblock]
ADD AFTER
[codeblock]	<tr>
		<td class="row1">{L_AUTH_VIEW_NEW_PAGE}</td>
		<td class="row2">{S_AUTH_VIEW_NEW_PAGE}</td>
	</tr>
[/codeblock]
[*]Open [b]language/lang_*/lang_admin.php[/b]
FIND
[codeblock]$lang['auth_view_viewonline'] = 'View Online';[/codeblock]
ADD AFTER
[codeblock]$lang['auth_view_new_page'] = 'New Page';[/codeblock]
[*]And finally add the code to your page... [b]new_page.php[/b]
FIND (similar)
[codeblock]// Start session management
$userdata = session_pagestart($user_ip, PAGE_INDEX);
init_userprefs($userdata);
// End session management
[/codeblock]
ADD AFTER
[codeblock]$auth_level_req = $config_mg['auth_view_new_page'];
if ($auth_level_req > AUTH_ALL)
{
	if ( ($auth_level_req == AUTH_REG) && (!$userdata['session_logged_in']) )
	{
		message_die(GENERAL_MESSAGE, $lang['Not_Auth_View']);
	}
	if ($userdata['user_level'] != ADMIN)
	{
		if ( $auth_level_req == AUTH_ADMIN )
		{
			message_die(GENERAL_MESSAGE, $lang['Not_Auth_View']);
		}
		if ( ($auth_level_req == AUTH_MOD) && ($userdata['user_level'] != MOD) )
		{
			message_die(GENERAL_MESSAGE, $lang['Not_Auth_View']);
		}
	}
}
[/codeblock][/list]

You owe me a beer.


P.S.: Topic title changed.


-----------------------------------
KugeLSichA
Thu 10 Aug, 2006 11:52

Re: How To Add A New Page Permission To ACP
-----------------------------------
great MG,

thats exactly what i want to get.

maybe other users need this too, if they have other MODs installed.

thx.

[ot]P.S.: you can get a beer, but u dont have an beer MOD in your forum :D [/ot]


-----------------------------------
Mighty Gorgon
Thu 10 Aug, 2006 12:23

Re: How To Add A New Page Permission To ACP
-----------------------------------
[quote user="KugeLSichA" post="66"]great MG,

thats exactly what i want to get.

maybe other users need this too, if they have other MODs installed.

thx.

[ot]P.S.: you can get a beer, but u dont have an beer MOD in your forum :D [/ot][/quote]
It took me an hour writing this... so we are tied... :wink:

I'll go to a pub buying a beer for myself! :lol:

 :beer:


-----------------------------------
KugeLSichA
Sat 12 Aug, 2006 11:11

Re: How To Add A New Page Permission To ACP
-----------------------------------
ok here i have written this as a MOD for easily download.

thx to MG for help.

[code]
##############################################################
## MOD Title: Page permissions for a new site in phpBBXS
## MOD Author: KugeLSichA < kugelsicha@caromonline.de > (HoLLe) http://www.caromguild.de
## MOD Description: If you have an other site that is not included in phpBBXS 
##                  package, and you want to add the phpBBXS site 
##                  permissions to this site, add the following lines to your 
##                  site.
##                  Site permissions can be set in ACP -> config -> site 
##                  permissions.
## MOD Version: 1.0.0
##
## Installation Level: Easy
## Installation Time: 5 min
## Files To Edit: 4
##                adm/admin_board_permissions.php
##                lanugage/lang_english/lang_admin.php
##                new_page.php
##                templates/ca_aphrodite/admin/board_config_permissions_body.tpl
## Included Files: n/a
##############################################################
## 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 MODs not offered
## in our MOD-Database, located at: http://www.phpbb.com/mods/downloads/
##############################################################
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD
##############################################################
#
#-----[ SQL ]------------------------------------------
#
INSERT INTO `phpbb_config_mg` (`config_name`, `config_value`) VALUES ('auth_view_new_page', '0');

#
#-----[ OPEN ]------------------------------------------
#
adm/admin_board_permissions.php
#
#-----[ FIND ]------------------------------------------
#
$auth_view['viewonline'] = auth_select($new['auth_view_viewonline'], 'auth_view_viewonline');
#
#-----[ AFTER, ADD ]------------------------------------------
#
$auth_view['new_page'] = auth_select($new['auth_view_new_page'], 'auth_view_new_page');
#
#-----[ FIND ]------------------------------------------
#
"L_AUTH_VIEW_VIEWONLINE" => $lang['auth_view_viewonline'],
#
#-----[ AFTER, ADD ]------------------------------------------
#
"L_AUTH_NEW_PAGE" => $lang['auth_new_page'],
#
#-----[ FIND ]------------------------------------------
#
"S_AUTH_VIEW_VIEWONLINE" => $auth_view['viewonline'],
#
#-----[ AFTER, ADD ]------------------------------------------
#
"S_AUTH_VIEW_NEW_PAGE" => $auth_view['new_page'],

#
#-----[ OPEN ]------------------------------------------
#
templates/ca_aphrodite/admin/board_config_permissions_body.tpl
#
#-----[ FIND ]------------------------------------------
#
	<tr>
		<td class="row1">{L_AUTH_VIEW_VIEWONLINE}</td>
		<td class="row2">{S_AUTH_VIEW_VIEWONLINE}</td>
	</tr>
#
#-----[ AFTER, ADD ]------------------------------------------
#
	<tr>
		<td class="row1">{L_AUTH_VIEW_NEW_PAGE}</td>
		<td class="row2">{S_AUTH_VIEW_NEW_PAGE}</td>
	</tr>

#
#-----[ OPEN ]------------------------------------------
#
# do this for all languages you have installed!
lanugage/lang_english/lang_admin.php
#
#-----[ FIND ]------------------------------------------
#
$lang['auth_view_viewonline'] = 'View Online';
#
#-----[ AFTER, ADD ]------------------------------------------
#
$lang['auth_view_new_page'] = 'New Page';

#
#-----[ OPEN ]------------------------------------------
#
new_page.php
#
#-----[ FIND ]------------------------------------------
#
# similar
// Start session management
$userdata = session_pagestart($user_ip, PAGE_INDEX);
init_userprefs($userdata);
// End session management 
#
#-----[ AFTER, ADD ]------------------------------------------
#
$auth_level_req = $config_mg['auth_view_new_page'];
if ($auth_level_req > AUTH_ALL)
{
    if ( ($auth_level_req == AUTH_REG) && (!$userdata['session_logged_in']) )
    {
        message_die(GENERAL_MESSAGE, $lang['Not_Auth_View']);
    }
    if ($userdata['user_level'] != ADMIN)
    {
        if ( $auth_level_req == AUTH_ADMIN )
        {
            message_die(GENERAL_MESSAGE, $lang['Not_Auth_View']);
        }
        if ( ($auth_level_req == AUTH_MOD) && ($userdata['user_level'] != MOD) )
        {
            message_die(GENERAL_MESSAGE, $lang['Not_Auth_View']);
        }
    }
}
 
#
#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------
#
# EoM
[/code]


