################################################################
##                       JUNIOR ADMIN                         ##
##                           2.0.5                            ##
################################################################
##
##   Description:  This will allow you to define
##                 any and all users you'd like to
##                 have access to whatever admin
##                 modules you'd like.  
##
##   Compatibility:   phpBB - 2.0.4 - 2.0.6
##                    php   - 4.0.1 or above
################################################################
****************************************************************
**   Author:       Nivisec (support@nivisec.com)              **
**                 http://www.nivisec.com                     **
**                                                            **
**   Language                                                 **
**   Files At:     http://www.nivisec.com/phpbb.php?l=la      **
****************************************************************
################################################################
##   Installation Level: Fairly Easy
##   Installation Time:  8-15 minutes
##
##   Author Notes:
##     Once installed, you will have a new admin panel
##     option called "Junior Admin" under the "User Admin"
##     area.
##
##     You should install my Color Groups mod to have
##     Junior Admin take advantage of it fully.  It is
##     not required however.
##
##   Support:    http://www.phpbbhacks.com/forums 
##   Copyright:  2002-2003 Nivisec.com
## 
################################################################
##                  ********* UPDATING *********
##   Please see the goodies/updating/ directory
##   for information on upgrading from a previous
##   version.
################################################################
#
#-----[ UPLOAD ]------------------------------------------ 
#   If you are having trouble understanding this section, read
#   the goodies/understanding_upload.txt file.
#
nivisec_install.php to /
nivisec_schema/*.* to nivisec_schema/
admin/admin_jr_admin.php to admin/
language/lang_english/lang_jr_admin.php to language/lang_english/
includes/functions_jr_admin.php to includes/
images/*.* to images/
templates/subSilver/admin/*.* to templates/subSilver/admin/

# 
#-----[ RUN ]------------------------------------------ 
#
#  Choose Install from the list of items here.  If you
#  are upgrading from a previous version, please see
#  goodies/updating/ for more info first.
#
nivisec_install.php

# 
#-----[ OPEN ]------------------------------------------ 
# 
includes/constants.php

# 
#-----[ FIND ]------------------------------------------ 
#
define('GROUPS_TABLE', $table_prefix.'groups');

# 
#-----[ AFTER, ADD ]------------------------------------------ 
#
define('JR_ADMIN_TABLE', $table_prefix.'jr_admin_users');

# 
#-----[ OPEN ]------------------------------------------ 
# 
includes/page_tail.php

# 
#-----[ FIND ]------------------------------------------ 
#
$admin_link = ( $userdata['user_level'] == ADMIN ) ? '<a href="admin/index.' . $phpEx . '?sid=' . $userdata['session_id'] . '">' . $lang['Admin_panel'] . '</a><br /><br />' : '';

# 
#-----[ REPLACE WITH ]------------------------------------------ 
#
include_once($phpbb_root_path . 'includes/functions_jr_admin.' . $phpEx);
$admin_link = jr_admin_make_admin_link();

# 
#-----[ OPEN ]------------------------------------------ 
# 
admin/pagestart.php

# 
#-----[ FIND ]------------------------------------------ 
#
//
// End session management
//

# 
#-----[ AFTER, ADD ]------------------------------------------ 
#
include_once($phpbb_root_path . 'includes/functions_jr_admin.' . $phpEx);
find_lang_file_nivisec('lang_jr_admin');

# 
#-----[ FIND ]------------------------------------------ 
#
else if ($userdata['user_level'] != ADMIN)
{
	message_die(GENERAL_MESSAGE, $lang['Not_admin']);
}

# 
#-----[ REPLACE WITH ]------------------------------------------ 
#
elseif (!jr_admin_secure(basename($HTTP_SERVER_VARS['REQUEST_URI'])))
{
	message_die(GENERAL_ERROR, $lang['Error_Module_ID'], '', __LINE__, __FILE__);	
}

# 
#-----[ OPEN ]------------------------------------------ 
# 
admin/index.php

# 
#-----[ FIND ]------------------------------------------ 
#
	$dir = @opendir(".");

	$setmodules = 1;
	while( $file = @readdir($dir) )
	{
		if( preg_match("/^admin_.*?\." . $phpEx . "$/", $file) )
		{
			include($file);
		}
	}

	@closedir($dir);

	unset($setmodules);

# 
#-----[ REPLACE WITH ]------------------------------------------ 
#
	$jr_admin_userdata = jr_admin_get_user_info($userdata['user_id']);
	$module = jr_admin_get_module_list($jr_admin_userdata['user_jr_admin']);

# 
#-----[ FIND ]------------------------------------------ 
#
	ksort($module);

	while( list($cat, $action_array) = each($module) )
	{
		$cat = ( !empty($lang[$cat]) ) ? $lang[$cat] : preg_replace("/_/", " ", $cat);

		$template->assign_block_vars("catrow", array(
			"ADMIN_CATEGORY" => $cat)
		);

		ksort($action_array);

		$row_count = 0;
		while( list($action, $file)	= each($action_array) )
		{
			$row_color = ( !($row_count%2) ) ? $theme['td_color1'] : $theme['td_color2'];
			$row_class = ( !($row_count%2) ) ? $theme['td_class1'] : $theme['td_class2'];

			$action = ( !empty($lang[$action]) ) ? $lang[$action] : preg_replace("/_/", " ", $action);

			$template->assign_block_vars("catrow.modulerow", array(
				"ROW_COLOR" => "#" . $row_color,
				"ROW_CLASS" => $row_class, 

				"ADMIN_MODULE" => $action,
				"U_ADMIN_MODULE" => append_sid($file))
			);
			$row_count++;
		}
	}

# 
#-----[ REPLACE WITH ]------------------------------------------ 
#
	jr_admin_make_left_pane();
	
# 
#-----[ FIND ]------------------------------------------ 
#
	else
	{
		$template->assign_vars(array(
			"L_NO_GUESTS_BROWSING" => $lang['No_users_browsing'])
		);
	}

# 
#-----[ AFTER, ADD ]------------------------------------------ 
#
	jr_admin_make_info_box();
	
# 
#-----[ OPEN ]------------------------------------------ 
# 
templates/subSilver/admin/index_body.tpl

# 
#-----[ FIND ]------------------------------------------ 
#
  <!-- END guest_user_row -->
</table>

# 
#-----[ AFTER, ADD ]------------------------------------------ 
#
{JR_ADMIN_INFO_TABLE}

# 
#-----[ SAVE & CLOSE ALL FILES ]-------------------------- 
#
#End
