Version 2.2.0 RC-1

This commit is contained in:
Neo committed 2025-12-19 00:22:37 -08:00
1 parent f73f8bff6d
commit 22f1b963ee
1034 files changed
+178610 -70897

No files matched your search

+199 -132
View File
@@ -2,28 +2,18 @@
/*
+--------------------------------------------------------------------------
| Invision Power Board 2.1.7
| Invision Power Board
| =============================================
| by Matthew Mecham
| (c) 2001 - 2005 Invision Power Services, Inc.
| (c) 2001 - 2006 Invision Power Services, Inc.
| http://www.invisionpower.com
| =============================================
| Web: http://www.invisionboard.com
| http://www.ibresource.ru/products/invisionpowerboard/
| Time: Tuesday 18th of July 2006 05:56:00 PM
| Release: 52f408a29988b02f45b5e6f4ba5af0ae
| Licence Info: http://www.invisionboard.com/?license
| http://www.ibresource.ru/license
+---------------------------------------------------------------------------
| INVISION POWER BOARD IS NOT FREE / OPEN SOURCE!
+---------------------------------------------------------------------------
| INVISION POWER BOARD ÍÅ ßÂËßÅÒÑß ÁÅÑÏËÀÒÍÛÌ ÏÐÎÃÐÀÌÌÍÛÌ ÎÁÅÑÏÅ×ÅÍÈÅÌ!
| Ïðàâà íà ÏÎ ïðèíàäëåæàò Invision Power Services
| Ïðàâà íà ïåðåâîä IBResource (http://www.ibresource.ru)
+---------------------------------------------------------------------------
| > $Date: 2006-02-02 17:23:13 +0000 (Thu, 02 Feb 2006) $
| > $Revision: 133 $
| > $Author: bfarber $
| > $Date: 2006-09-22 11:28:54 +0100 (Fri, 22 Sep 2006) $
| > $Revision: 567 $
| > $Author: matt $
+---------------------------------------------------------------------------
|
| > Help Control functions
@@ -37,7 +27,7 @@
if ( ! defined( 'IN_ACP' ) )
{
print "<h1>Íåâåðíûé âõîä</h1> Ó Âàñ íåò äîñòóïà ê äèðåêòèâå ýòîãî ôàéëà. Åñëè Âû ïðîâîäèëè îáíîâëåíèÿ, óáåäèòåñü, ÷òî íå çàáûëè îáíîâèòü 'admin.php'.";
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded 'admin.php'.";
exit();
}
@@ -52,17 +42,6 @@ class ad_login
function auto_run()
{
//-----------------------------------------
// Kill globals - globals bad, Homer good.
//-----------------------------------------
$tmp_in = array_merge( $_GET, $_POST, $_COOKIE );
foreach ( $tmp_in as $k => $v )
{
unset($$k);
}
//-----------------------------------------
// What to do?
//-----------------------------------------
@@ -72,8 +51,17 @@ class ad_login
case 'login':
$this->login_form();
break;
case 'logout':
case 'login-out':
// Do we have a session?
$sess_cookie = $this->ipsclass->my_getcookie( "ipb_admin_session_id" );
if( $sess_cookie )
{
$this->ipsclass->DB->do_delete( "admin_sessions", "session_id='{$sess_cookie}'" );
}
$this->ipsclass->my_setcookie("ipb_admin_session_id", "-1", -1);
$this->login_form();
break;
case 'login-complete':
@@ -93,31 +81,66 @@ class ad_login
function login_complete()
{
//-----------------------------------------
// We must have submitted the form
// time to check some details.
// INIT
//-----------------------------------------
$this->ipsclass->input['username'] = str_replace( '|', '&#124;', $this->ipsclass->input['username'] );
$username = str_replace( '|', '&#124;', $this->ipsclass->input['username'] );
//-----------------------------------------
// Check
//-----------------------------------------
if ( empty($this->ipsclass->input['username']) )
{
$this->login_form("Âû äîëæíû ââåñòè èìÿ ïîëüçîâàòåëÿ ïåðåä òåì, êàê ïðîäîëæèòü");
$this->login_form("You must enter a username before proceeding");
}
if ( empty($this->ipsclass->input['password']) )
{
$this->login_form("Âû äîëæíû ââåñòè ïàðîëü ïåðåä òåì, êàê ïðîäîëæèòü");
$this->login_form("You must enter a password before proceeding");
}
//-----------------------------------------
// Attempt to get the details from the
// DB
// Load handler...
//-----------------------------------------
require_once( ROOT_PATH.'sources/handlers/han_login.php' );
$this->han_login = new han_login();
$this->han_login->ipsclass =& $this->ipsclass;
$this->han_login->is_admin_auth = 1;
$this->han_login->init();
//-----------------------------------------
// Check auth
//-----------------------------------------
$this->ipsclass->DB->cache_add_query( 'login_getmember', array( 'username' => strtolower($this->ipsclass->input['username']) ) );
$this->ipsclass->DB->cache_exec_query();
$mem = $this->ipsclass->DB->fetch_row();
$this->han_login->login_authenticate( $username, $this->ipsclass->input['password'] );
//-----------------------------------------
// Check return code...
//-----------------------------------------
$mem = $this->han_login->member;
if ( ( ! $mem['id'] ) or ( $this->han_login->return_code == 'NO_USER' ) )
{
$this->write_to_log( $this->ipsclass->input['username'], 'fail' );
$this->login_form( "Username or password incorrect");
}
if ( $this->han_login->return_code != 'SUCCESS' )
{
if ( $this->han_login->return_code == 'ACCOUNT_LOCKED' )
{
$this->write_to_log( $this->ipsclass->input['username'], 'fail' );
$this->login_form( "Your account has been locked due to the number of failed login attempts made" );
}
else
{
$this->write_to_log( $this->ipsclass->input['username'], 'fail' );
$this->login_form( "Username or password incorrect" );
}
}
//-----------------------------------------
// Get perms
@@ -127,99 +150,135 @@ class ad_login
$this->ipsclass->sess->build_group_permissions();
$mem = $this->ipsclass->sess->member;
if ( empty($mem['id']) )
if ( $mem['g_access_cp'] != 1 )
{
$this->login_form("Íå ïîëó÷èëîñü îáíàðóæèòü òàêîå èìÿ ïîëüçîâàòåëÿ, ïîïðîáóéòå åùå ðàç");
}
//-----------------------------------------
// Load converge member
//-----------------------------------------
$this->ipsclass->converge->converge_load_member($mem['email']);
if ( ! $this->ipsclass->converge->member['converge_id'] )
{
$this->login_form("Íå ïîëó÷èëîñü îáíàðóæèòü òàêîå èìÿ ïîëüçîâàòåëÿ, ïîïðîáóéòå åùå ðàç");
}
//-----------------------------------------
// Check converge pass
//-----------------------------------------
$pass = md5( $this->ipsclass->input['password'] );
//-----------------------------------------
// Check password...
//-----------------------------------------
if ( $this->ipsclass->converge->converge_authenticate_member( $pass ) != TRUE )
{
$this->login_form("Ïàðîëü, êîòîðûé âû ââåëè - íåâåðåí");
$this->write_to_log( $this->ipsclass->input['username'], 'fail' );
$this->login_form("You do not have access to the administrative CP");
}
else
{
if ($mem['g_access_cp'] != 1)
{
$this->login_form("Ó âàñ íåò ïðàâ äîñòóï â àäìèíöåíòð");
}
else
{
//-----------------------------------------
// Fix up query string...
//-----------------------------------------
$extra_query = "";
if ( $_POST['qstring'] )
{
$extra_query = urldecode( $_POST['qstring'] );
$extra_query = str_replace( "{$this->ipsclass->vars['board_url']}" , "" , $extra_query );
$extra_query = preg_replace( "!/?admin\.{$this->ipsclass->vars['php_ext']}!i", "" , $extra_query );
$extra_query = preg_replace( "!^\?!" , "" , $extra_query );
$extra_query = preg_replace( "!adsess=(\w){32}!" , "" , $extra_query );
$extra_query = preg_replace( "!s=(\w){32}!" , "" , $extra_query );
$extra_query = preg_replace( "!act=login!" , "" , $extra_query );
$extra_query = preg_replace( "!code=template-edit-bit!" , "" , $extra_query );
$extra_query = preg_replace( "!code=template-bits-list!" , "" , $extra_query );
$extra_query = preg_replace( "!bitname=(\w)!" , "" , $extra_query );
$extra_query = $this->ipsclass->parse_clean_value( $extra_query );
}
//-----------------------------------------
// All is good, rejoice as we set a
// session for this user
//-----------------------------------------
$sess_id = md5( uniqid( microtime() ) );
$db_string = $this->ipsclass->DB->compile_db_insert_string( array (
'session_id' => $sess_id,
'session_ip_address' => $this->ipsclass->ip_address,
'session_member_name' => $mem['name'],
'session_member_id' => $mem['id'],
'session_member_login_key' => $mem['member_login_key'],
'session_location' => 'index',
'session_log_in_time' => time(),
'session_running_time' => time(),
) );
$this->ipsclass->DB->query("INSERT INTO ibf_admin_sessions (".$db_string['FIELD_NAMES'].") VALUES (".$db_string['FIELD_VALUES'].")");
$this->ipsclass->input['adsess'] = $sess_id;
//-----------------------------------------
// Redirect...
//-----------------------------------------
$this->ipsclass->admin->redirect( $this->ipsclass->vars['board_url']."/admin.".$this->ipsclass->vars['php_ext']."?adsess=".$this->ipsclass->input['adsess']."&".$extra_query, 'Âõîä îñóùåñòâëåí' );
exit();
//-----------------------------------------
// Fix up query string...
//-----------------------------------------
$extra_query = "";
if ( $_POST['qstring'] )
{
$extra_query = urldecode( $_POST['qstring'] );
$extra_query = str_replace( "{$this->ipsclass->vars['board_url']}" , "" , $extra_query );
$extra_query = preg_replace( "!/?admin\.{$this->ipsclass->vars['php_ext']}!i", "" , $extra_query );
$extra_query = preg_replace( "!^\?!" , "" , $extra_query );
$extra_query = preg_replace( "!adsess=(\w){32}!" , "" , $extra_query );
$extra_query = preg_replace( "!s=(\w){32}!" , "" , $extra_query );
$extra_query = preg_replace( "!act=login!" , "" , $extra_query );
$extra_query = preg_replace( "!code=template-edit-bit!" , "" , $extra_query );
$extra_query = preg_replace( "!code=template-bits-list!" , "" , $extra_query );
$extra_query = preg_replace( "!bitname=(\w)!" , "" , $extra_query );
$extra_query = $this->ipsclass->parse_clean_value( $extra_query );
}
//-----------------------------------------
// Delete old sessions..
//-----------------------------------------
$this->ipsclass->DB->do_delete( 'admin_sessions', 'session_member_id='.$mem['id'] );
//-----------------------------------------
// All is good, rejoice as we set a
// session for this user
//-----------------------------------------
$sess_id = md5( uniqid( microtime() ) );
$this->ipsclass->DB->do_insert( 'admin_sessions', array (
'session_id' => $sess_id,
'session_ip_address' => $this->ipsclass->ip_address,
'session_member_name' => $mem['name'],
'session_member_id' => $mem['id'],
'session_member_login_key' => md5( $mem['joined'] . $mem['ip_address'] ),
'session_location' => 'index',
'session_log_in_time' => time(),
'session_running_time' => time(),
) );
$this->ipsclass->input['adsess'] = $sess_id;
//-----------------------------------------
// Set a session ID cookie
//-----------------------------------------
$this->ipsclass->my_setcookie("ipb_admin_session_id", $sess_id, 0);
$this->write_to_log( $this->ipsclass->input['username'], 'ok' );
//-----------------------------------------
// Lets add some data in here for the access logs...
//-----------------------------------------
$extra_query .= "&member_id=".$mem['id'].'&password=ok';
//-----------------------------------------
// Redirect...
//-----------------------------------------
$this->ipsclass->admin->redirect( $this->ipsclass->vars['board_url'].'/'.IPB_ACP_DIRECTORY."/index.".$this->ipsclass->vars['php_ext']."?adsess=".$this->ipsclass->input['adsess']."&".$extra_query, 'Log In Successful' );
exit();
}
}
/*-------------------------------------------------------------------------*/
// Write to the log in table
/*-------------------------------------------------------------------------*/
/**
* Write to the admin log in loggy ma log
*
* @param string Username
* @param string ok/fail flag
*/
function write_to_log( $username='', $flag='fail' )
{
//-----------------------------------------
// INIT
//-----------------------------------------
$username = $username ? $username : $this->ipsclass->input['username'];
$flag = ( $flag == 'ok' ) ? 1 : 0;
$admin_post_details = array();
//-----------------------------------------
// Generate POST / GET details
//-----------------------------------------
foreach( $_GET as $k => $v )
{
$admin_post_details['get'][ htmlspecialchars( $k ) ] = htmlspecialchars( $v );
}
foreach( $_POST as $k => $v )
{
if ( $k == 'password' )
{
$v = str_repeat( '*', strlen( $v ) - 1 ) . substr( $v, -1, 1 );
}
$admin_post_details['post'][ htmlspecialchars( $k ) ] = htmlspecialchars( $v );
}
//-----------------------------------------
// Write to disk...
//-----------------------------------------
$this->ipsclass->DB->do_insert( 'admin_login_logs', array( 'admin_ip_address' => $this->ipsclass->ip_address,
'admin_username' => $username,
'admin_time' => time(),
'admin_success' => $flag,
'admin_post_details' => serialize($admin_post_details) ) );
}
/*-------------------------------------------------------------------------*/
// Show the log in form
/*-------------------------------------------------------------------------*/
@@ -230,7 +289,7 @@ class ad_login
// INIT
//-----------------------------------------
$message = $message ? $message : $this->ipsclass->admin_session['_session_message'];
$message = $message ? $message : (isset($this->ipsclass->admin_session['_session_message']) ? $this->ipsclass->admin_session['_session_message'] : '');
//-------------------------------------------------------
// Remove all out of date sessions, like a good boy. Woof.
@@ -238,7 +297,7 @@ class ad_login
$cut_off_stamp = time() - 60*60*2;
$this->ipsclass->DB->query("DELETE FROM ibf_admin_sessions WHERE session_log_in_time < $cut_off_stamp");
$this->ipsclass->DB->do_delete( 'admin_sessions', "session_log_in_time < {$cut_off_stamp}" );
//------------------------------------------------------
// AUTO Log in ma-thingy?
@@ -251,11 +310,19 @@ class ad_login
if ( $mid > 0 )
{
$this->ipsclass->DB->query("SELECT m.id, m.name, m.mgroup, g.g_access_cp FROM ibf_members m, ibf_groups g WHERE m.id=$mid AND g.g_id=m.mgroup AND g.g_access_cp=1");
$this->ipsclass->DB->build_query( array( 'select' => 'm.id, m.name, m.mgroup, g.g_access_cp',
'from' => array( 'members' => 'm' ),
'where' => "m.id={$mid} AND g.g_access_cp=1",
'add_join' => array( 1 => array( 'type' => 'left',
'from' => array( 'groups' => 'g' ),
'where' => 'g.g_id=m.mgroup' )
)
) );
$this->ipsclass->DB->exec_query();
if ( $r = $this->ipsclass->DB->fetch_row() )
{
$name = $r['name'];
$name = $this->ipsclass->vars['ipbli_usertype'] == 'username' ? $r['name'] : $r['email'];
$extra = 'onload="document.theAdminForm.password.focus();"';
}
}
@@ -264,7 +331,7 @@ class ad_login
// SHW DA FRM (txt msg stylee)
//------------------------------------------------------
$qs = str_replace( '&amp;' , '&', $this->ipsclass->parse_clean_value( urldecode( $_SERVER['QUERY_STRING'] ) ) );
$qs = str_replace( '&amp;' , '&', $this->ipsclass->parse_clean_value( urldecode( $this->ipsclass->my_getenv('QUERY_STRING') ) ) );
$qs = str_replace( 'adsess=' , 'old_adsess=', $qs );
$qs = str_replace( 'act=menu', '', $qs );
$qs = str_replace( '&lt;' , '', $qs );
@@ -272,10 +339,10 @@ class ad_login
$qs = str_replace( '(' , '', $qs );
$qs = str_replace( ')' , '', $qs );
$this->ipsclass->html_title = "IPB: Àäìèíöåíòð: Âõîä";
$this->ipsclass->html = str_replace( '<%CONTENT%>', $this->ipsclass->skin_global_acp->log_in_form( $qs, $message, $name ), $this->ipsclass->skin_global_acp->global_main_wrapper() );
$this->ipsclass->html_title = "IPB: ACP: Log in";
$this->ipsclass->html = str_replace( '<%CONTENT%>', $this->ipsclass->skin_acp_global->log_in_form( $qs, $message, $name ), $this->ipsclass->skin_acp_global->global_main_wrapper() );
$this->ipsclass->html = str_replace( '<%TITLE%>' , $this->ipsclass->html_title, $this->ipsclass->html );
$this->ipsclass->html = str_replace( "<body", "<body style='background-image:url({$this->ipsclass->skin_url}/images/blank.gif)'", $this->ipsclass->html );
$this->ipsclass->html = str_replace( "<body", "<body style='background-image:url({$this->ipsclass->skin_acp_url}/images/blank.gif)'", $this->ipsclass->html );
@header("Content-type: text/html");
print $this->ipsclass->html;