Код: Выделить всё
############################################### 
##   Hack Title:   Main Admin Security 
##   Hack Version:   1.1.0 
##   Author:      Aiencran 
##   Description:   This hack gives some extra security to the main administrator. 
##          - The other administrators can't delete the Main Admin 
##          - They can't change his profile 
##          - They can't change his user level to simple user 
##   Compatibility:   2.0.10 
## 
##   Installation Level: Easy 
##   Installation Time: 2 Minutes 
##   Files To Edit: 4 
##      admin/admin_ug_auth.php, 
##      admin/admin_users.php, 
##      language/lang_english/lang_admin.php, 
##      language/lang_italian/lang_admin.php 
## 
##   Included Files: None 
## 
##   History: 
##      2004-08-21 - Version 1.1.0 
##         - Added Main Admin's profile security 
## 
##      2004-08-14 - Version 1.0.0 
##         - First version 
## 
##   Author Notes: 
##      In this MOD I supposed that Main Admin's user_id is 2. Feel free to changhe '2' with the id of your MainAdmin. 
## 
##   Support:      None 
##   Copyright:      ©2004 Main Admin Security 1.1.0 - Aiencran 
## 
############################################### 
##   You downloaded this hack from phpBBHacks.com, the #1 source for phpBB related downloads. 
##   Please visit http://www.phpbbhacks.com/forums for support. 
############################################### 
## 
############################################### 
##   This hack is released under the GPL License. 
##   This hack can be freely used, but not distributed, without permission. 
##   Intellectual Property is retained by the hack author(s) listed above. 
############################################### 
# 
#-----[ OPEN ]------------------------------------------ 
# 
/language/lang_english/lang_admin.php 
# 
#-----[ FIND ]------------------------------------------ 
# 
// 
// That's all Folks! 
# 
#-----[ BEFORE, ADD ]------------------------------------ 
# 
$lang['Main_Admin_Undeleted'] = 'Main Admin can\'t be deleted!'; 
$lang['Main_Admin_Unchanged_Profile'] = 'You can\'t modify Main Admin\'s profile!'; 
$lang['Main_Admin_Unchanged_Level'] = 'Main Admin can\'t become a simple user!'; 
# 
#-----[ OPEN ]------------------------------------------ 
# 
/admin/admin_users.php 
# 
#-----[ FIND ]------------------------------------------ 
# (old code) 
# 
if( $HTTP_POST_VARS['deleteuser'] ) 
# 
#-----[ FIND ]------------------------------------------ 
# (new code) 
# 
if( $HTTP_POST_VARS['deleteuser'] && ( $userdata['user_id'] != $user_id ) ) 
# 
#-----[ REPLACE WITH ]------------------------------------------ 
# 
// 
// Main Admin can't be deleted 
// 
if( $HTTP_POST_VARS['deleteuser'] && $user_id == 2) 
{ 
   message_die(GENERAL_ERROR, $lang['Main_Admin_Undeleted'] ); 
} 
if( $HTTP_POST_VARS['deleteuser'] && $user_id != 2) 
# 
#-----[ FIND ]------------------------------------------ 
# (old code) 
$username = ( !empty($HTTP_POST_VARS['username']) ) ? trim(strip_tags(htmlspecialchars($HTTP_POST_VARS['username']))) : ''; 
# 
#-----[ FIND ]------------------------------------------ 
# (new code) 
$username = ( !empty($HTTP_POST_VARS['username']) ) ? phpbb_clean_username($HTTP_POST_VARS['username']) : ''; 
# 
#-----[ BEFORE, ADD ]------------------------------------ 
# 
// 
// Main Admin's profile can't be modified 
// 
if ( $user_id == 2 && $userdata['user_id'] != 2 ) 
{ 
   message_die(GENERAL_ERROR, $lang['Main_Admin_Unchanged_Profile'] ); 
} 
# 
#-----[ OPEN ]------------------------------------------ 
# 
/admin/admin_ug_auth.php 
# 
#-----[ FIND ]------------------------------------------ 
# 
// 
// Make admin a user (if already admin) ... ignore if you're trying 
// to change yourself from an admin to user! 
// 
if ( $userdata['user_id'] != $user_id ) 
# 
#-----[ REPLACE WITH ]------------------------------------------ 
# 
// 
// Make admin a user (if already admin) ... ignore if you're trying 
// to change yourself from an admin to user! 
// 
if ( $user_id == 2 ) 
{ 
   message_die(GENERAL_ERROR, $lang['Main_Admin_Unchanged_Level'] ); 
} 
else if ( $userdata['user_id'] != $user_id ) 
# 
#-----[ SAVE & CLOSE ALL FILES ]-------------------------- 
# 
#End 


