Version 3.0.5
This commit is contained in:
1 parent
19b38c7c74
commit
1d4720f3e2
3755 files changed
+508378
-664541
No files matched your search
@@ -0,0 +1,209 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Invision Power Services
|
||||
* IP.Board v3.0.5
|
||||
* Static SETUP Classes for IP.Board 3
|
||||
*
|
||||
* These classes are not required as objects.
|
||||
* Last Updated: $Date: 2009-05-20 07:39:47 -0400 (Wed, 20 May 2009) $
|
||||
*
|
||||
* @author Matt Mecham
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license http://www.iinvisionpower.com/community/board/license.html
|
||||
* @package Invision Power Board
|
||||
* @link http://www.iinvisionpower.com
|
||||
* @since 1st December 2008
|
||||
* @version $Revision: 4672 $
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* Collection of methods to for installation alone
|
||||
*
|
||||
* @author Matt
|
||||
*/
|
||||
class IPSInstall
|
||||
{
|
||||
/**
|
||||
* Create admin account
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
static public function createAdminAccount()
|
||||
{
|
||||
/* Build Entry */
|
||||
$_mke_time = ( ipsRegistry::$settings['login_key_expire'] ) ? ( time() + ( intval( ipsRegistry::$settings['login_key_expire'] ) * 86400 ) ) : 0;
|
||||
$salt = IPSMember::generatePasswordSalt( 5 );
|
||||
$passhash = IPSMember::generateCompiledPasshash( $salt, md5( IPSSetUp::getSavedData('admin_pass') ) );
|
||||
$_dname = IPSSetUp::getSavedData('admin_user');
|
||||
|
||||
$member = array(
|
||||
'name' => $_dname,
|
||||
'members_l_username' => mb_strtolower( $_dname ),
|
||||
'members_display_name' => $_dname,
|
||||
'members_l_display_name' => mb_strtolower( $_dname ),
|
||||
'members_seo_name' => IPSText::makeSeoTitle( $_dname ),
|
||||
'member_login_key' => IPSMember::generateAutoLoginKey(),
|
||||
'member_login_key_expire' => $_mke_time,
|
||||
'title' => 'Администратор',
|
||||
'email' => IPSSetUp::getSavedData('admin_email') ,
|
||||
'member_group_id' => 4,
|
||||
'posts' => 1,
|
||||
'joined' => time(),
|
||||
'last_visit' => time(),
|
||||
'last_activity' => time(),
|
||||
'ip_address' => my_getenv('REMOTE_ADDR'),
|
||||
'view_sigs' => 1,
|
||||
'email_pm' => 1,
|
||||
'view_img' => 1,
|
||||
'view_avs' => 1,
|
||||
'restrict_post' => 0,
|
||||
'msg_show_notification' => 1,
|
||||
'msg_count_total' => 0,
|
||||
'msg_count_new' => 0,
|
||||
'coppa_user' => 0,
|
||||
'language' => IPSLib::getDefaultLanguage(),
|
||||
'members_auto_dst' => 1,
|
||||
'members_editor_choice' => ipsRegistry::$settings['ips_default_editor'],
|
||||
'allow_admin_mails' => 0,
|
||||
'hide_email' => 1,
|
||||
'members_pass_hash' => $passhash,
|
||||
'members_pass_salt' => $salt,
|
||||
);
|
||||
|
||||
/* Insert: MEMBERS */
|
||||
ipsRegistry::DB()->force_data_type = array( 'name' => 'string', 'members_display_name' => 'string', 'members_l_username' => 'string', 'members_l_display_name' => 'string' );
|
||||
|
||||
ipsRegistry::DB()->insert( 'members', $member );
|
||||
|
||||
$member_id = ipsRegistry::DB()->getInsertId();
|
||||
$member['member_id'] = $member_id;
|
||||
|
||||
/* Insert into the custom profile fields DB */
|
||||
ipsRegistry::DB()->force_data_type = array();
|
||||
ipsRegistry::DB()->insert( 'pfields_content', array( 'member_id' => $member_id, 'updated' => time() ) );
|
||||
|
||||
/* Insert into pp */
|
||||
ipsRegistry::DB()->insert( 'profile_portal', array(
|
||||
'pp_member_id' => $member_id,
|
||||
'pp_setting_count_friends' => 1,
|
||||
'signature' => '',
|
||||
'pconversation_filters' => '',
|
||||
'pp_setting_count_comments' => 1 ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Writes out conf_global
|
||||
*
|
||||
* @access public
|
||||
* @return bool File written successfully
|
||||
*/
|
||||
static public function writeConfiguration()
|
||||
{
|
||||
//-----------------------------------------
|
||||
// Safe mode?
|
||||
//-----------------------------------------
|
||||
|
||||
$safe_mode = 0;
|
||||
|
||||
if ( @get_cfg_var('safe_mode') )
|
||||
{
|
||||
$safe_mode = @get_cfg_var('safe_mode');
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Set info array
|
||||
//-----------------------------------------
|
||||
|
||||
$INFO = array(
|
||||
'sql_driver' => IPSSetUp::getSavedData('sql_driver'),
|
||||
'sql_host' => IPSSetUp::getSavedData('db_host'),
|
||||
'sql_database' => IPSSetUp::getSavedData('db_name'),
|
||||
'sql_user' => IPSSetUp::getSavedData('db_user'),
|
||||
'sql_pass' => IPSSetUp::getSavedData('db_pass'),
|
||||
'sql_tbl_prefix' => IPSSetUp::getSavedData('db_pre'),
|
||||
'sql_debug' => 1,
|
||||
'sql_charset' => 'utf8',
|
||||
|
||||
'board_start' => time(),
|
||||
'installed' => 1,
|
||||
|
||||
'php_ext' => 'php',
|
||||
'safe_mode' => $safe_mode,
|
||||
|
||||
//'base_url' => IPSSetUp::getSavedData('install_url'),
|
||||
'board_url' => IPSSetUp::getSavedData('install_url'),
|
||||
'banned_group' => '5',
|
||||
'admin_group' => '4',
|
||||
'guest_group' => '2',
|
||||
'member_group' => '3',
|
||||
'auth_group' => '1',
|
||||
'use_friendly_urls' => 1,
|
||||
'_jsDebug' => 0
|
||||
);
|
||||
|
||||
//---------------------------------------------
|
||||
// Any "extra" configs required for this driver?
|
||||
//---------------------------------------------
|
||||
|
||||
foreach( IPSSetUp::getSavedDataAsArray() as $k => $v )
|
||||
{
|
||||
if ( preg_match( "#^__sql__#", $k ) )
|
||||
{
|
||||
$k = str_replace( "__sql__", "", $k );
|
||||
|
||||
$INFO[ $k ] = $v;
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------
|
||||
// Write to disk
|
||||
//---------------------------------------------
|
||||
|
||||
$core_conf = "<"."?php\n";
|
||||
|
||||
foreach( $INFO as $k => $v )
|
||||
{
|
||||
$core_conf .= '$INFO['."'".$k."'".']'."\t\t\t=\t'".$v."';\n";
|
||||
}
|
||||
|
||||
$core_conf .= "\ndefine('IN_DEV', 0);";
|
||||
|
||||
$core_conf .= "\n".'?'.'>';
|
||||
|
||||
/* Write Configuration Files */
|
||||
$output[] = 'Запись файлов настройки<br />';
|
||||
|
||||
$ret = IPSSetUp::writeFile( IPSSetUp::getSavedData('install_dir') . '/conf_global.php' , $core_conf );
|
||||
|
||||
/* Now freeze data */
|
||||
IPSSetUp::freezeSavedData();
|
||||
|
||||
return $ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* Clean up conf global
|
||||
* Removes data variables
|
||||
*
|
||||
* @access public
|
||||
* @return boolean
|
||||
*/
|
||||
static public function cleanConfGlobal()
|
||||
{
|
||||
if ( $contents = @file_get_contents( IPSSetUp::getSavedData('install_dir') . '/conf_global.php' ) )
|
||||
{
|
||||
if ( $contents )
|
||||
{
|
||||
$contents = preg_replace( "#/\*~~DATA~~\*/(.+?)\n/\*\*/#s", "", $contents );
|
||||
|
||||
return IPSSetUp::writeFile( IPSSetUp::getSavedData('install_dir') . '/conf_global.php' , $contents );
|
||||
}
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,294 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Invision Power Services
|
||||
* IP.Board v3.0.5
|
||||
* ipsController for setup
|
||||
* Last Updated: $Date: 2009-05-15 09:34:37 -0400 (Fri, 15 May 2009) $
|
||||
*
|
||||
* @author Matt Mecham
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license http://www.iinvisionpower.com/community/board/license.html
|
||||
* @package Invision Power Board
|
||||
* @link http://www.iinvisionpower.com
|
||||
* @since 1st December 2008
|
||||
* @version $Revision: 4656 $
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* Class "Controller"
|
||||
* A very simple public facing interface to resolve incoming data into
|
||||
* a command class
|
||||
*
|
||||
* @author Matt Mecham
|
||||
* @since Wednesday 14th May 2008
|
||||
* @package Invision Power Board
|
||||
*/
|
||||
class ipsController
|
||||
{
|
||||
/**
|
||||
* Registry reference
|
||||
*
|
||||
* @access private
|
||||
* @var object
|
||||
*/
|
||||
private $registry;
|
||||
|
||||
/**
|
||||
* Current command
|
||||
*
|
||||
* @access public
|
||||
* @var object
|
||||
*/
|
||||
static public $cmd;
|
||||
|
||||
/**
|
||||
* Make us a singleton please
|
||||
*
|
||||
* @access private
|
||||
* @return void
|
||||
*/
|
||||
private function __construct() { }
|
||||
|
||||
/**
|
||||
* Public facing function to run the controller
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
static public function run()
|
||||
{
|
||||
$instance = new ipsController();
|
||||
$instance->init();
|
||||
$instance->handleRequest();
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize ipsRegistry and this class
|
||||
*
|
||||
* @access protected
|
||||
* @return void
|
||||
*/
|
||||
protected function init()
|
||||
{
|
||||
$this->registry = ipsRegistry::instance();
|
||||
$this->registry->init();
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle the incoming request using the command resolver
|
||||
*
|
||||
* @access protected
|
||||
* @return void
|
||||
*/
|
||||
protected function handleRequest()
|
||||
{
|
||||
$cmd_r = new ipsController_CommandResolver();
|
||||
self::$cmd = $cmd_r->getCommand( $this->registry );
|
||||
self::$cmd->execute( $this->registry );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Class "Command Resolver"
|
||||
* Resolves the incoming data
|
||||
*
|
||||
* @author Matt Mecham
|
||||
* @since Wednesday 14th May 2008
|
||||
* @package Invision Power Board
|
||||
*/
|
||||
class ipsController_CommandResolver
|
||||
{
|
||||
/**
|
||||
* Base command
|
||||
*
|
||||
* @access private
|
||||
* @var object
|
||||
*/
|
||||
private static $base_cmd;
|
||||
|
||||
/**
|
||||
* AJAX command
|
||||
*
|
||||
* @access private
|
||||
* @var object
|
||||
*/
|
||||
private static $ajax_cmd;
|
||||
|
||||
/**
|
||||
* Default command
|
||||
*
|
||||
* @access private
|
||||
* @var object
|
||||
*/
|
||||
private static $default_cmd;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
if ( ! self::$base_cmd )
|
||||
{
|
||||
self::$base_cmd = new ReflectionClass( 'ipsCommand' );
|
||||
self::$default_cmd = new ipsCommand_default();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the command
|
||||
*
|
||||
* @access public
|
||||
* @param object ipsRegistry reference
|
||||
* @return object Command object
|
||||
*/
|
||||
public function getCommand( ipsRegistry $registry )
|
||||
{
|
||||
$section = ipsRegistry::$current_section;
|
||||
$filepath = ( IPS_IS_UPGRADER ) ? IPS_ROOT_PATH . 'setup/applications/upgrade/sections/' : IPS_ROOT_PATH . 'setup/applications/install/sections/';
|
||||
|
||||
/* Got a section? */
|
||||
if ( ! $section )
|
||||
{
|
||||
if ( file_exists( $filepath . 'index.php' ) )
|
||||
{
|
||||
$section = 'index';
|
||||
}
|
||||
}
|
||||
|
||||
$classname = IPS_APP_COMPONENT . '_' . $section;
|
||||
|
||||
if ( file_exists( $filepath . 'manualResolver.php' ) )
|
||||
{
|
||||
require_once( $filepath . 'manualResolver.php' );
|
||||
$classname = IPS_APP_COMPONENT . '_' . $module . '_manualResolver';
|
||||
}
|
||||
else if ( file_exists( $filepath . $section . '.php' ) )
|
||||
{
|
||||
require_once( $filepath . $section . '.php' );
|
||||
}
|
||||
|
||||
if ( class_exists( $classname ) )
|
||||
{
|
||||
$cmd_class = new ReflectionClass( $classname );
|
||||
|
||||
if ( $cmd_class->isSubClassOf( self::$base_cmd ) )
|
||||
{
|
||||
return $cmd_class->newInstance();
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new Exception( "$section в модуле $module не существует!" );
|
||||
}
|
||||
}
|
||||
|
||||
# Fudge it to return just the default object
|
||||
return clone self::$default_cmd;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
abstract class ipsCommand
|
||||
{
|
||||
/**#@+
|
||||
* Registry Object Shortcuts
|
||||
*
|
||||
* @access protected
|
||||
* @var object
|
||||
*/
|
||||
protected $registry;
|
||||
protected $DB;
|
||||
protected $settings;
|
||||
protected $request;
|
||||
protected $lang;
|
||||
protected $member;
|
||||
protected $cache;
|
||||
|
||||
/**
|
||||
* Constructor override
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
final public function __construct()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Create registry shortcuts
|
||||
*
|
||||
* @access public
|
||||
* @param object ipsRegistry reference
|
||||
* @return void
|
||||
*/
|
||||
public function makeRegistryShortcuts( ipsRegistry $registry )
|
||||
{
|
||||
/* Make registry objects */
|
||||
$this->registry = $registry;
|
||||
$this->DB = $this->registry->DB();
|
||||
$this->settings =& $this->registry->fetchSettings();
|
||||
$this->request =& $this->registry->fetchRequest();
|
||||
$this->member = $this->registry->member();
|
||||
$this->memberData =& $this->registry->member()->fetchMemberData();
|
||||
$this->cache = $this->registry->cache();
|
||||
$this->caches =& $this->registry->cache()->fetchCaches();
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute the commands
|
||||
*
|
||||
* @access public
|
||||
* @param object ipsRegistry reference
|
||||
* @return void
|
||||
*/
|
||||
public function execute( ipsRegistry $registry )
|
||||
{
|
||||
$this->makeRegistryShortcuts( $registry );
|
||||
$this->doExecute( $registry );
|
||||
}
|
||||
|
||||
/**
|
||||
* doExecute, most be override
|
||||
*
|
||||
* @access protected
|
||||
* @param object ipsRegistry reference
|
||||
* @return void
|
||||
*/
|
||||
protected abstract function doExecute( ipsRegistry $registry );
|
||||
}
|
||||
|
||||
|
||||
class ipsCommand_default extends ipsCommand
|
||||
{
|
||||
/**
|
||||
* Main execution method
|
||||
*
|
||||
* @access public
|
||||
* @param object ipsRegistry reference
|
||||
* @return void
|
||||
*/
|
||||
protected function doExecute( ipsRegistry $registry )
|
||||
{
|
||||
$filepath = IPSLib::getAppDir( IPS_APP_COMPONENT ) . '/modules/' . ipsRegistry::$current_module . '/' . ipsRegistry::$current_section . '.php';
|
||||
$filepath = str_replace( DOC_IPS_ROOT_PATH, '', $filepath );
|
||||
|
||||
//-----------------------------------------
|
||||
// Uh oh, this is a big one.. (no forums app)
|
||||
//-----------------------------------------
|
||||
|
||||
if ( ! file_exists( $filepath ) )
|
||||
{
|
||||
print "Не найден файл команд " . ipsRegistry::$current_module;
|
||||
exit();
|
||||
}
|
||||
else
|
||||
{
|
||||
print "Нет действий!";
|
||||
exit();
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,765 @@
|
||||
<?php
|
||||
/**
|
||||
* Invision Power Services
|
||||
* IP.Board v3.0.5
|
||||
* Installer output methods
|
||||
* Last Updated: $Date: 2009-11-19 11:58:45 -0500 (Thu, 19 Nov 2009) $
|
||||
*
|
||||
* @author Matt Mecham
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license http://www.iinvisionpower.com/community/board/license.html
|
||||
* @package Invision Power Board
|
||||
* @link http://www.iinvisionpower.com
|
||||
* @since 1st December 2008
|
||||
* @version $Revision: 5443 $
|
||||
*
|
||||
*/
|
||||
|
||||
if ( ! defined( 'IN_IPB' ) )
|
||||
{
|
||||
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
|
||||
exit();
|
||||
}
|
||||
|
||||
/**
|
||||
* class output
|
||||
*
|
||||
* Class for managing skins, templates and printing output
|
||||
*
|
||||
* @author Matt Mecham
|
||||
* @package Invision Power Board
|
||||
* @version 3.0.0
|
||||
*/
|
||||
class output
|
||||
{
|
||||
/**#@+
|
||||
* Registry Object Shortcuts
|
||||
*
|
||||
* @access public
|
||||
* @var object
|
||||
*/
|
||||
public $registry;
|
||||
public $DB;
|
||||
public $settings;
|
||||
public $request;
|
||||
public $member;
|
||||
public $cache;
|
||||
|
||||
/**
|
||||
* URLs array
|
||||
*
|
||||
* @access public
|
||||
* @var array
|
||||
*/
|
||||
public $urls = array();
|
||||
|
||||
/**
|
||||
* Template
|
||||
*
|
||||
* @access protected
|
||||
* @var object
|
||||
*/
|
||||
protected $template = '';
|
||||
|
||||
/**
|
||||
* Image url
|
||||
*
|
||||
* @access protected
|
||||
* @var string
|
||||
*/
|
||||
protected $imgUrl = '';
|
||||
|
||||
/**
|
||||
* HTML to output
|
||||
*
|
||||
* @access protected
|
||||
* @var string
|
||||
*/
|
||||
protected $_html = '';
|
||||
|
||||
/**
|
||||
* Page title
|
||||
*
|
||||
* @access protected
|
||||
* @var string
|
||||
*/
|
||||
protected $_title = '';
|
||||
|
||||
/**
|
||||
* Error messages
|
||||
*
|
||||
* @access protected
|
||||
* @var array
|
||||
*/
|
||||
protected $_errors = array();
|
||||
|
||||
/**
|
||||
* Navigation information
|
||||
*
|
||||
* @access protected
|
||||
* @var array
|
||||
*/
|
||||
protected $__navigation = array();
|
||||
|
||||
/**
|
||||
* Currently in an error
|
||||
*
|
||||
* @access protected
|
||||
* @var bool
|
||||
*/
|
||||
protected $_isError = FALSE;
|
||||
|
||||
/**
|
||||
* Navigation information
|
||||
*
|
||||
* @access pubic
|
||||
* @var array
|
||||
*/
|
||||
public $_navigation = array();
|
||||
|
||||
/**
|
||||
* Warnings
|
||||
*
|
||||
* @access protected
|
||||
* @var array
|
||||
*/
|
||||
protected $_warnings = array();
|
||||
|
||||
/**
|
||||
* Sequence data
|
||||
*
|
||||
* @access public
|
||||
* @var array
|
||||
*/
|
||||
public $sequenceData = array();
|
||||
|
||||
/**
|
||||
* Current page
|
||||
*
|
||||
* @access public
|
||||
* @var string
|
||||
*/
|
||||
public $currentPage = '';
|
||||
|
||||
/**
|
||||
* Next page
|
||||
*
|
||||
* @access public
|
||||
* @var string
|
||||
*/
|
||||
public $nextAction = '';
|
||||
|
||||
/**
|
||||
* Hide continue button
|
||||
*
|
||||
* @access public
|
||||
* @var bool
|
||||
*/
|
||||
public $_hideButton = FALSE;
|
||||
|
||||
/**
|
||||
* Install steps
|
||||
*
|
||||
* @access private
|
||||
* @var array
|
||||
*/
|
||||
private $_installStep = array();
|
||||
|
||||
/**
|
||||
* Internal array for messages
|
||||
*
|
||||
* @access private
|
||||
* @var array
|
||||
*/
|
||||
private $_messages = array();
|
||||
|
||||
private $_curVersion = 0;
|
||||
private $_curApp = '';
|
||||
|
||||
/**
|
||||
* Construct
|
||||
*
|
||||
* @access public
|
||||
* @param object ipsRegistry reference
|
||||
* @param bool Whether to init
|
||||
* @return void
|
||||
*/
|
||||
public function __construct( ipsRegistry $registry, $init=FALSE )
|
||||
{
|
||||
/* Make object */
|
||||
$this->registry = $registry;
|
||||
$this->DB = $this->registry->DB();
|
||||
$this->settings =& $this->registry->fetchSettings();
|
||||
$this->request =& $this->registry->fetchRequest();
|
||||
$this->member = $this->registry->member();
|
||||
$this->memberData =& $this->registry->member()->fetchMemberData();
|
||||
$this->cache = $this->registry->cache();
|
||||
$this->caches =& $this->registry->cache()->fetchCaches();
|
||||
|
||||
if ( $init === TRUE )
|
||||
{
|
||||
/* Load 'template' */
|
||||
require_once( IPS_ROOT_PATH . 'setup/templates/skin_setup.php' );
|
||||
$this->template = new skin_setup( $registry );
|
||||
|
||||
/* Images URL */
|
||||
$this->imageUrl = '../setup/public/images';
|
||||
|
||||
/* Fetch sequence data */
|
||||
require_once( IPS_KERNEL_PATH . 'classXML.php' );
|
||||
$xml = new classXML( IPSSetUp::charSet );
|
||||
$file = ( IPS_IS_UPGRADER ) ? IPS_ROOT_PATH . 'setup/xml/upgrade_sequence.xml' : IPS_ROOT_PATH . 'setup/xml/sequence.xml';
|
||||
|
||||
try
|
||||
{
|
||||
$xml->load( $file );
|
||||
|
||||
foreach( $xml->fetchElements( 'action' ) as $xmlelement )
|
||||
{
|
||||
$data = $xml->fetchElementsFromRecord( $xmlelement );
|
||||
|
||||
$_tmp[ $data['position'] ] = $data;
|
||||
|
||||
ksort( $_tmp );
|
||||
|
||||
foreach( $_tmp as $pos => $data )
|
||||
{
|
||||
$this->sequenceData[ $data['file'] ] = $data['menu'];
|
||||
}
|
||||
}
|
||||
}
|
||||
catch( Exception $error )
|
||||
{
|
||||
$this->addError( "Невозможно найти файл: " . $file );
|
||||
}
|
||||
|
||||
|
||||
/* Set up URLs */
|
||||
$this->settings['base_url'] = ( $this->settings['base_url'] ) ? $this->settings['base_url'] : IPSSetUp::getSavedData('install_url');
|
||||
$this->settings['img_url_no_dir'] = $this->settings['base_url'] . '/public/style_images/';
|
||||
|
||||
/* Set Current Page */
|
||||
$this->currentPage = ( $this->request['section'] ) ? $this->request['section'] : 'index';
|
||||
|
||||
if ( ! $this->sequenceData[ $this->currentPage ] )
|
||||
{
|
||||
$this->currentPage = 'index';
|
||||
}
|
||||
|
||||
/* Set default next action */
|
||||
$_hit = 0;
|
||||
foreach( $this->sequenceData as $file => $text )
|
||||
{
|
||||
if ( $_hit )
|
||||
{
|
||||
$this->nextAction = $file;
|
||||
break;
|
||||
}
|
||||
|
||||
if ( $file == $this->currentPage )
|
||||
{
|
||||
$_hit = 1;
|
||||
}
|
||||
}
|
||||
|
||||
/* Build all skins array */
|
||||
if ( IPS_IS_UPGRADER )
|
||||
{
|
||||
/* For < 3.0.0 upgrades, they won't have this table, so check for it */
|
||||
if ( $this->DB->checkForTable( 'skin_collections' ) )
|
||||
{
|
||||
$this->DB->build( array( 'select' => '*',
|
||||
'from' => 'skin_collections',
|
||||
'order' => 'set_id ASC' ) );
|
||||
$this->DB->execute();
|
||||
|
||||
while( $_skinSets = $this->DB->fetch() )
|
||||
{
|
||||
$id = $_skinSets['set_id'];
|
||||
|
||||
$this->allSkins[ $id ] = $_skinSets;
|
||||
$this->allSkins[ $id ]['_parentTree'] = unserialize( $_skinSets['set_parent_array'] );
|
||||
$this->allSkins[ $id ]['_childTree'] = unserialize( $_skinSets['set_child_array'] );
|
||||
$this->allSkins[ $id ]['_userAgents'] = unserialize( $_skinSets['set_locked_uagent'] );
|
||||
$this->allSkins[ $id ]['_cssGroupsArray'] = unserialize( $_skinSets['set_css_groups'] );
|
||||
$this->allSkins[ $id ]['_youCanUse'] = TRUE;
|
||||
$this->allSkins[ $id ]['_gatewayExclude'] = FALSE;
|
||||
|
||||
/* Array groups */
|
||||
if ( is_array( $this->allSkins[ $id ]['_cssGroupsArray'] ) )
|
||||
{
|
||||
ksort( $this->allSkins[ $id ]['_cssGroupsArray'], SORT_NUMERIC );
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->allSkins[ $id ]['_cssGroupsArray'] = array();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Add an message string
|
||||
*
|
||||
* @access public
|
||||
* @param string Message
|
||||
* @return void
|
||||
*/
|
||||
public function addMessage( $string )
|
||||
{
|
||||
$this->_messages[] = $string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add an error string
|
||||
*
|
||||
* @access public
|
||||
* @param string Error
|
||||
* @return void
|
||||
*/
|
||||
public function addError( $string )
|
||||
{
|
||||
$this->_errors[] = $string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a warning string
|
||||
*
|
||||
* @access public
|
||||
* @param string Warning
|
||||
* @return void
|
||||
*/
|
||||
public function addWarning( $string )
|
||||
{
|
||||
$this->_warnings[] = $string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetch errors
|
||||
*
|
||||
* @access public
|
||||
* @return array Errors
|
||||
*/
|
||||
public function fetchErrors()
|
||||
{
|
||||
return $this->_errors;
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetch warnings
|
||||
*
|
||||
* @access public
|
||||
* @return array Warnings
|
||||
*/
|
||||
public function fetchWarnings()
|
||||
{
|
||||
return $this->_warnings;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add content
|
||||
*
|
||||
* @access public
|
||||
* @param string content to add
|
||||
* @param boolean Prepend isntead of append
|
||||
* @return void
|
||||
*/
|
||||
public function addContent( $content, $prepend=false )
|
||||
{
|
||||
if( $prepend )
|
||||
{
|
||||
$this->_html = $content . $this->_html;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->_html .= $content;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the current version and app
|
||||
*
|
||||
* @access public
|
||||
* @param string Current Human version
|
||||
* @param string App key
|
||||
* @return void
|
||||
*/
|
||||
public function setVersionAndApp( $version, $app )
|
||||
{
|
||||
$this->_curVersion = $version;
|
||||
$this->_curApp = $app;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the current install step
|
||||
*
|
||||
* @access public
|
||||
* @param mixed Current step
|
||||
* @param int Total steps
|
||||
* @return void
|
||||
*/
|
||||
public function setInstallStep( $current, $total )
|
||||
{
|
||||
$this->_installStep = array( $current, $total );
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the hide button value
|
||||
*
|
||||
* @access public
|
||||
* @param boolean TRUE = hide button, FALSE = show button
|
||||
* @return void
|
||||
*/
|
||||
public function setHideButton( $hide=FALSE )
|
||||
{
|
||||
$this->_hideButton = $hide;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the next action value
|
||||
*
|
||||
* @access public
|
||||
* @param string action URL
|
||||
* @return void
|
||||
*/
|
||||
public function setNextAction( $url )
|
||||
{
|
||||
$this->nextAction = $url;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the title of the document
|
||||
*
|
||||
* @access public
|
||||
* @param string Page title
|
||||
* @return void
|
||||
*/
|
||||
public function setTitle( $title )
|
||||
{
|
||||
$this->_title = $title;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add navigational elements
|
||||
*
|
||||
* @access public
|
||||
* @param string Nav title
|
||||
* @param string Nav URL
|
||||
* @param string SEO title
|
||||
* @param string SEO template
|
||||
* @return void
|
||||
*/
|
||||
public function addNavigation( $title, $url, $seoTitle='', $seoTemplate='' )
|
||||
{
|
||||
$this->_navigation[] = array( $title, $url, $seoTitle, $seoTemplate );
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the is error flag
|
||||
*
|
||||
* @access public
|
||||
* @param bool Error yes/no
|
||||
* @return void
|
||||
*/
|
||||
public function setError( $boolean )
|
||||
{
|
||||
$this->_isError = $boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* Wrapper to return template function
|
||||
*
|
||||
* @access public
|
||||
* @return object
|
||||
*/
|
||||
public function template()
|
||||
{
|
||||
return $this->template;
|
||||
}
|
||||
|
||||
/**
|
||||
* Replace IPS tags
|
||||
* Converts over <#IMG_DIR#>, etc
|
||||
*
|
||||
* @access public
|
||||
* @param string
|
||||
* @return string
|
||||
* @todo [Future] Remove the legacy remapping in 3.1. We will assume posts have been rebuilt by then.
|
||||
*/
|
||||
public function replaceMacros( $text )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// General replacements
|
||||
//-----------------------------------------
|
||||
|
||||
$text = str_replace( "<#IMG_DIR#>" , $this->skin['set_image_dir'], $text );
|
||||
$text = str_replace( "<#EMO_DIR#>" , $this->skin['set_emo_dir'] , $text );
|
||||
$text = str_replace( "<% CHARSET %>" , IPS_DOC_CHAR_SET , $text );
|
||||
$text = str_replace( "{style_image_url}" , $this->settings['img_url'] , $text );
|
||||
$text = str_replace( "{style_images_url}" , $this->settings['img_url'] , $text );
|
||||
|
||||
//-----------------------------------------
|
||||
// Fix legacy emoticon/avatar/images links
|
||||
//-----------------------------------------
|
||||
|
||||
$text = preg_replace( "#img\s+?src=([\"'])(?:{$this->settings['board_url']}[^\"']+?)?(?<!public%2F)style_(images|avatars|emoticons)([^\"']+?)[\"'](.+?)?".">#is", "img src=\\1".$this->settings['public_dir']."style_\\2\\3\\1\\4>", $text );
|
||||
|
||||
//-----------------------------------------
|
||||
// Fix up IPB image url
|
||||
//-----------------------------------------
|
||||
|
||||
if ( $this->settings['ipb_img_url'] )
|
||||
{
|
||||
$text = preg_replace( "#img\s+?src=[\"']public/style_(images|avatars|emoticons)(.+?)[\"'](.+?)?".">#is", "img src=\"".$this->settings['ipb_img_url']."public/style_\\1\\2\"\\3>", $text );
|
||||
}
|
||||
|
||||
|
||||
return $text;
|
||||
}
|
||||
|
||||
/**
|
||||
* Main output function
|
||||
*
|
||||
* @access public
|
||||
* @access boolean TRUE - freeze data, FALSE, do not.
|
||||
* @return void Nothin'
|
||||
*/
|
||||
public function sendOutput( $saveData=TRUE )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// INIT
|
||||
//-----------------------------------------
|
||||
|
||||
$_hit = 0;
|
||||
|
||||
/* Options */
|
||||
$options['savedData'] = ( $saveData === TRUE ) ? IPSSetUp::freezeSavedData() : '';
|
||||
$options['hideButton'] = ( $this->_hideButton === TRUE ) ? TRUE : FALSE;
|
||||
$options['progress'] = array();
|
||||
|
||||
/* Sequence progress */
|
||||
foreach( $this->sequenceData as $key => $page )
|
||||
{
|
||||
if ( $key == $this->currentPage )
|
||||
{
|
||||
$options['progress'][] = array( 'step_doing', $page );
|
||||
$_hit = 1;
|
||||
}
|
||||
else if( $_hit )
|
||||
{
|
||||
$options['progress'][] = array( 'step_notdone', $page );
|
||||
}
|
||||
else
|
||||
{
|
||||
$options['progress'][] = array( 'step_done', $page );
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Header
|
||||
//-----------------------------------------
|
||||
|
||||
header( "HTTP/1.0 200 OK" );
|
||||
header( "HTTP/1.1 200 OK" );
|
||||
//header( "Content-type: text/html;charset={$this->settings['gb_char_set']}" );
|
||||
header( "Content-type: text/html;charset=utf-8" );
|
||||
header( "Cache-Control: no-cache, must-revalidate, max-age=0" );
|
||||
header( "Expires: 0" );
|
||||
header( "Pragma: no-cache" );
|
||||
|
||||
$template = $this->template->globalTemplate( $this->_title, $this->_html, $options, $this->_errors, $this->_warnings, $this->_messages, $this->_installStep, $this->_curVersion, $this->_curApp );
|
||||
|
||||
print $template;
|
||||
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Print a redirect screen
|
||||
* Wrapper function, really
|
||||
*
|
||||
* @access public
|
||||
* @param string Text to display on the redirect screen
|
||||
* @param string URL to direct to
|
||||
* @param string SEO Title
|
||||
* @return string HTML to browser and exits
|
||||
*/
|
||||
public function redirectScreen( $text="", $url="", $seoTitle="" )
|
||||
{
|
||||
//-----------------------------------------
|
||||
// INIT
|
||||
//-----------------------------------------
|
||||
|
||||
$this->_sendOutputSetUp( 'redirect' );
|
||||
|
||||
//-----------------------------------------
|
||||
// Forcing silent redirects?
|
||||
//-----------------------------------------
|
||||
|
||||
if ( $this->settings['ipb_remove_redirect_pages'] == 1 )
|
||||
{
|
||||
$this->silentRedirect( $url );
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Gather output
|
||||
//-----------------------------------------
|
||||
|
||||
$output = $this->outputFormatClass->fetchOutput( $this->_html, $this->_title, $this->_navigation, $this->_documentHeadItems, $this->_jsLoader, array( 'url' => $url, 'text' => $text, 'seoTitle' => $seoTitle ) );
|
||||
|
||||
//-----------------------------------------
|
||||
// Check for SQL Debug
|
||||
//-----------------------------------------
|
||||
|
||||
$this->_checkSQLDebug();
|
||||
|
||||
//-----------------------------------------
|
||||
// Print it...
|
||||
//-----------------------------------------
|
||||
|
||||
$this->outputFormatClass->printHeader();
|
||||
|
||||
print $output;
|
||||
|
||||
$this->outputFormatClass->finishUp();
|
||||
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Immediate redirect
|
||||
*
|
||||
* @access public
|
||||
* @param string URL to redirect to
|
||||
* @param string SEO Title
|
||||
* @return mixed
|
||||
*/
|
||||
public function silentRedirect( $url, $seoTitle='' )
|
||||
{
|
||||
return $this->outputFormatClass->silentRedirect( $url, $seoTitle );
|
||||
}
|
||||
|
||||
/**
|
||||
* Add content to the document <head>
|
||||
*
|
||||
* @access public
|
||||
* @param string Type of data to add: css, js, raw, rss, rsd, etc
|
||||
* @param string Data to add
|
||||
* @return void
|
||||
*/
|
||||
public function addToDocumentHead( $type, $data )
|
||||
{
|
||||
$this->_documentHeadItems[ $type ][] = $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Process remap data
|
||||
* For use with IN_DEV
|
||||
*
|
||||
* @access public
|
||||
* @return array Array of remap data
|
||||
*/
|
||||
public function buildRemapData()
|
||||
{
|
||||
$remapData = array();
|
||||
|
||||
if ( IN_DEV and file_exists( DOC_IPS_ROOT_PATH . 'cache/skin_cache/masterMap.php' ) )
|
||||
{
|
||||
require( DOC_IPS_ROOT_PATH . 'cache/skin_cache/masterMap.php' );
|
||||
|
||||
if ( is_array( $REMAP ) )
|
||||
{
|
||||
/* Master skins */
|
||||
foreach( array( 'templates', 'css' ) as $type )
|
||||
{
|
||||
foreach( $REMAP[ $type ] as $id => $dir )
|
||||
{
|
||||
if ( preg_match( "#^[a-zA-Z]#", $id ) )
|
||||
{
|
||||
/* we're using a key */
|
||||
$_skin = $this->_fetchSkinByKey( $id );
|
||||
|
||||
$remapData[ $type ][ $_skin['set_id'] ] = $dir;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* ID */
|
||||
$remapData[ $type ][ $id ] = $dir;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* IN DEV default */
|
||||
if ( preg_match( "#^[a-zA-Z]#", $REMAP['inDevDefault'] ) )
|
||||
{
|
||||
$_skin = $this->_fetchSkinByKey( $REMAP['inDevDefault'] );
|
||||
|
||||
$remapData['inDevDefault'] = $_skin['set_id'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$remapData['inDevDefault'] = $REMAP['inDevDefault'];
|
||||
}
|
||||
|
||||
/* IN DEV export */
|
||||
foreach( $REMAP['export'] as $id => $key )
|
||||
{
|
||||
if ( preg_match( "#^[a-zA-Z]#", $key ) )
|
||||
{
|
||||
$_skin = $this->_fetchSkinByKey( $key );
|
||||
|
||||
$remapData['export'][ $id ] = $_skin['set_id'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$remapData['export'][ $id ] = $id;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$remapData = array( 'templates' => array( 0 => 'master_skin' ),
|
||||
'css' => array( 0 => 'master_css' ),
|
||||
'inDevDefault' => 0 );
|
||||
}
|
||||
|
||||
return $remapData;
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetch a skin set via a key
|
||||
*
|
||||
* @access private
|
||||
* @param string Skin set key
|
||||
* @return array Array of skin data
|
||||
*/
|
||||
public function _fetchSkinByKey( $key )
|
||||
{
|
||||
if ( ! is_array( $this->allSkins ) )
|
||||
{
|
||||
$this->DB->build( array( 'select' => '*',
|
||||
'from' => 'skin_collections' ) );
|
||||
$this->DB->execute();
|
||||
|
||||
while( $skin = $this->DB->fetch() )
|
||||
{
|
||||
$this->allSkins[ $skin['set_id'] ] = $skin;
|
||||
}
|
||||
}
|
||||
|
||||
foreach( $this->allSkins as $_id => $_data )
|
||||
{
|
||||
if ( $_data['set_key'] == $key )
|
||||
{
|
||||
return $_data;
|
||||
}
|
||||
}
|
||||
|
||||
return array();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,258 @@
|
||||
<?php
|
||||
/**
|
||||
* Invision Power Services
|
||||
* IP.Board v3.0.5
|
||||
* Setup sessions class
|
||||
* Last Updated: $Date: 2009-08-07 07:52:33 -0400 (Fri, 07 Aug 2009) $
|
||||
*
|
||||
* @author Matt Mecham
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license http://www.iinvisionpower.com/community/board/license.html
|
||||
* @package Invision Power Board
|
||||
* @link http://www.iinvisionpower.com
|
||||
* @since 1st December 2008
|
||||
* @version $Revision: 4999 $
|
||||
*
|
||||
*/
|
||||
|
||||
if ( ! defined( 'IN_IPB' ) )
|
||||
{
|
||||
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";
|
||||
exit();
|
||||
}
|
||||
|
||||
define( 'IPB_UPGRADER_IP_MATCH', FALSE );
|
||||
|
||||
class sessions extends ips_MemberRegistry
|
||||
{
|
||||
/**
|
||||
* Variable for session validated
|
||||
*
|
||||
* @access private
|
||||
* @var array
|
||||
*/
|
||||
private $_data = array();
|
||||
|
||||
/**
|
||||
* Time out seconds
|
||||
*
|
||||
* @access private
|
||||
* @var int
|
||||
*/
|
||||
private $_time_out_secs = 86400;
|
||||
|
||||
/**
|
||||
* ACP session id
|
||||
*
|
||||
* @access private
|
||||
* @var string
|
||||
*/
|
||||
private $_adsess = '';
|
||||
|
||||
/**
|
||||
* Validated?
|
||||
*
|
||||
* @access private
|
||||
* @var bool
|
||||
*/
|
||||
private $_validated = false;
|
||||
|
||||
/**
|
||||
* Message to pass
|
||||
*
|
||||
* @access private
|
||||
* @var string
|
||||
*/
|
||||
private $_message;
|
||||
|
||||
/**
|
||||
* Authorize
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
/* Make object */
|
||||
$this->registry = ipsRegistry::instance();
|
||||
$this->DB = $this->registry->DB();
|
||||
$this->settings =& $this->registry->fetchSettings();
|
||||
$this->request =& $this->registry->fetchRequest();
|
||||
|
||||
/* Grab session */
|
||||
$_s = IPSText::md5Clean( $this->request['s'] );
|
||||
|
||||
/* Got a session? */
|
||||
if ( ! $_s )
|
||||
{
|
||||
return $this->_response( 0, '' );
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->DB->build( array( 'select' => '*',
|
||||
'from' => 'upgrade_sessions',
|
||||
'where' => "session_id='" . $_s . "'" ) );
|
||||
|
||||
$this->DB->execute();
|
||||
|
||||
$_data = $this->DB->fetch();
|
||||
|
||||
if ( ! $_data['session_id'] )
|
||||
{
|
||||
/* No record found */
|
||||
return $this->_response( 0, '' );
|
||||
}
|
||||
else if ( ! $_data['session_member_id'] )
|
||||
{
|
||||
/* No member ID found */
|
||||
return $this->_response( 0, 'Невозможно получить корректный ID пользователя' );
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Load member */
|
||||
self::instance()->data_store = $this->registry->getClass('legacy')->loadMemberData( $_data['session_member_id'] );
|
||||
|
||||
/* Member exists? */
|
||||
if ( ! self::instance()->data_store['email'] )
|
||||
{
|
||||
return $this->_response( 0, 'Неверный ID пользователя' );
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Authenticate */
|
||||
if ( $_data['session_member_key'] != $this->registry->getClass('legacy')->fetchAuthKey() )
|
||||
{
|
||||
return $this->_response( 0, 'Неверный ключ сессии' );
|
||||
}
|
||||
else
|
||||
{
|
||||
/* ACP access? */
|
||||
if ( self::instance()->data_store['g_access_cp'] != 1)
|
||||
{
|
||||
return $this->_response( 0, 'У вас нет доступа к администраторским функциям' );
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->_validated = TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------
|
||||
// If we're here, we're valid...
|
||||
//--------------------------------------------
|
||||
|
||||
if ( $this->_validated === TRUE )
|
||||
{
|
||||
self::setUpMember();
|
||||
|
||||
if ( $_data['session_current_time'] < ( time() - $this->_time_out_secs ) )
|
||||
{
|
||||
return $this->_response( 0, '' );
|
||||
}
|
||||
|
||||
/* Check IPs? */
|
||||
else if ( IPB_UPGRADER_IP_MATCH )
|
||||
{
|
||||
$first_ip = preg_replace( "/^([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})/", "\\1.\\2.\\3", $_data['session_ip_address'] );
|
||||
$second_ip = preg_replace( "/^([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})/", "\\1.\\2.\\3", self::instance()->ip_address );
|
||||
|
||||
if ( $first_ip != $second_ip )
|
||||
{
|
||||
return $this->_response( 0, 'Ваш IP адрес не совпадает ни с одной из наших записей' );
|
||||
}
|
||||
}
|
||||
|
||||
/* Still here? Lets update the session, then */
|
||||
$this->DB->update( 'upgrade_sessions', array( 'session_current_time' => time(),
|
||||
'session_section' => $this->request['section'],
|
||||
'session_post' => serialize( $_POST ),
|
||||
'session_get' => serialize( $_GET ) ), 'session_id=\'' . $this->request['s'] . '\'' );
|
||||
|
||||
|
||||
/* If we're hitting the index and we have a valid session, go right to overview */
|
||||
if ( ! $this->request['section'] OR $this->request['section'] == 'index' )
|
||||
{
|
||||
$this->request['section'] = 'overview';
|
||||
}
|
||||
|
||||
return $this->_response( 1, '' );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a session
|
||||
*
|
||||
* @access public
|
||||
* @param array Array of member Data
|
||||
* @param string Auth Key
|
||||
* @return nufink
|
||||
*/
|
||||
public function createSession( $member, $authKey )
|
||||
{
|
||||
$_bash = time() - $this->_time_out_secs;
|
||||
$_s = md5( uniqid( microtime(), true ) . self::instance()->ip_address );
|
||||
|
||||
if ( $member['member_id'] AND $authKey )
|
||||
{
|
||||
$this->DB->delete( 'upgrade_sessions', 'session_current_time < ' . $_bash );
|
||||
$this->DB->insert( 'upgrade_sessions', array( 'session_id' => $_s,
|
||||
'session_member_id' => $member['member_id'],
|
||||
'session_member_key' => $authKey,
|
||||
'session_start_time' => time(),
|
||||
'session_current_time' => time(),
|
||||
'session_ip_address' => self::instance()->ip_address,
|
||||
'session_section' => 'index',
|
||||
'session_post' => serialize( array() ),
|
||||
'session_get' => serialize( array() ),
|
||||
'session_data' => serialize( array() ),
|
||||
'session_extra' => '' ) );
|
||||
|
||||
return $_s;
|
||||
}
|
||||
else
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation code
|
||||
*
|
||||
* @access public
|
||||
* @return mixed
|
||||
*/
|
||||
public function getStatus()
|
||||
{
|
||||
return $this->_validated;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation message
|
||||
*
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function getMessage()
|
||||
{
|
||||
return $this->_message;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the response
|
||||
*
|
||||
* @access protected
|
||||
* @param bool Validated
|
||||
* @param string Message
|
||||
* @return mixed
|
||||
*/
|
||||
protected function _response( $validated, $message )
|
||||
{
|
||||
$this->_validated = $validated;
|
||||
$this->_message = $message;
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,197 @@
|
||||
<?php
|
||||
/**
|
||||
* Invision Power Services
|
||||
* IP.Board v3.0.5
|
||||
* Version Specific Upgrade Functions
|
||||
* Last Updated: $Date: 2009-01-05 22:21:54 +0000 (Mon, 05 Jan 2009) $
|
||||
*
|
||||
* @author Matt Mecham
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license http://www.iinvisionpower.com/community/board/license.html
|
||||
* @package Invision Power Board
|
||||
* @link http://www.iinvisionpower.com
|
||||
* @since 1st December 2008
|
||||
* @version $Revision: 3572 $
|
||||
*
|
||||
*/
|
||||
|
||||
class upgradeLegacy
|
||||
{
|
||||
/**
|
||||
* Member data
|
||||
*
|
||||
* @access private
|
||||
* @var array
|
||||
*/
|
||||
private $_member;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function __construct( ipsRegistry $registry )
|
||||
{
|
||||
/* Make object */
|
||||
$this->registry = $registry;
|
||||
$this->DB = $this->registry->DB();
|
||||
$this->settings =& $this->registry->fetchSettings();
|
||||
$this->request =& $this->registry->fetchRequest();
|
||||
$this->cache = $this->registry->cache();
|
||||
$this->caches =& $this->registry->cache()->fetchCaches();
|
||||
|
||||
//* Make sure tables exist that won't in pre 3.0 versions */
|
||||
if ( file_exists( IPS_ROOT_PATH . 'setup/sql/ipb3_' . strtolower( ipsRegistry::$settings['sql_driver'] ) . '.php' ) )
|
||||
{
|
||||
require( IPS_ROOT_PATH . 'setup/sql/ipb3_' . strtolower( ipsRegistry::$settings['sql_driver'] ) . '.php' );
|
||||
|
||||
$prefix = $this->registry->dbFunctions()->getPrefix();
|
||||
|
||||
if ( ! $this->DB->checkForTable( 'upgrade_history' ) )
|
||||
{
|
||||
if ( $UPGRADE_HISTORY_TABLE )
|
||||
{
|
||||
$this->DB->query( IPSSetUp::addPrefixToQuery( $UPGRADE_HISTORY_TABLE, $prefix ) );
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! $this->DB->checkForField( 'upgrade_app', 'upgrade_history' ) )
|
||||
{
|
||||
if ( $UPGRADE_TABLE_FIELD )
|
||||
{
|
||||
$this->DB->query( IPSSetUp::addPrefixToQuery( $UPGRADE_TABLE_FIELD, $prefix ) );
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! $this->DB->checkForTable( 'upgrade_sessions' ) )
|
||||
{
|
||||
if ( $UPGRADE_SESSION_TABLE )
|
||||
{
|
||||
$this->DB->query( IPSSetUp::addPrefixToQuery( $UPGRADE_SESSION_TABLE, $prefix ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetch auth key
|
||||
*
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function fetchAuthKey()
|
||||
{
|
||||
if ( ! $this->_member['id'] AND ! $this->_member['member_id'] )
|
||||
{
|
||||
throw new Exception( "ПОЛЬЗОВАТЕЛЬ НЕ ЗАГРУЖЕН" );
|
||||
}
|
||||
else
|
||||
{
|
||||
return ( $this->_member['password'] ) ? md5( $this->_member['password'] ) : md5( $this->_member['legacy_password'] );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetch member data
|
||||
*
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function fetchMemberData()
|
||||
{
|
||||
return ( is_array( $this->_member ) ) ? $this->_member : array();
|
||||
}
|
||||
|
||||
/**
|
||||
* Load and return member data
|
||||
*
|
||||
* @access public
|
||||
* @param int Member ID to load
|
||||
* @return array
|
||||
*/
|
||||
public function loadMemberData( $memberId )
|
||||
{
|
||||
/* Attempt to load member */
|
||||
$this->DB->build( array( 'select' => 'm.*',
|
||||
'from' => array( 'members' => 'm' ),
|
||||
'where' => 'm.id=' . intval( $memberId ),
|
||||
'add_join' => array( array( 'select' => 'g.*',
|
||||
'from' => array( 'groups' => 'g' ),
|
||||
'where' => 'g.g_id=m.mgroup' ) ) ) );
|
||||
|
||||
$this->DB->execute();
|
||||
|
||||
$this->_member = $this->DB->fetch();
|
||||
|
||||
/* Fix up pre-3 stuffs */
|
||||
$this->_member['member_id'] = $this->_member['id'];
|
||||
$this->_member['member_group_id'] = $this->_member['mgroup'];
|
||||
|
||||
/* Occasionally 1.x installs do not have an email address. Most likey an InvisionFree issue */
|
||||
if ( ! $this->_member['email'] )
|
||||
{
|
||||
$this->DB->update( 'members', array( 'email' => 'email_' . $this->_member['id'] . '_@changeMe.com' ), 'id=' . $memberId );
|
||||
}
|
||||
|
||||
return $this->fetchMemberData();
|
||||
}
|
||||
|
||||
/**
|
||||
* Authenticate log in
|
||||
*
|
||||
* @access public
|
||||
* @param string Username (from $this->request)
|
||||
* @param string Password (from $this->request)
|
||||
* @return mixed TRUE if successful, string (message) if not
|
||||
*/
|
||||
public function authenticateLogIn( $username, $password )
|
||||
{
|
||||
/* Attempt to load member */
|
||||
$this->DB->build( array( 'select' => 'm.*',
|
||||
'from' => array( 'members' => 'm' ),
|
||||
'where' => 'LOWER(m.name)=\'' . mb_strtolower( $username ) . '\'',
|
||||
'add_join' => array( array( 'select' => 'g.*',
|
||||
'from' => array( 'groups' => 'g' ),
|
||||
'where' => 'g.g_id=m.mgroup' ) ) ) );
|
||||
|
||||
|
||||
$this->DB->execute();
|
||||
|
||||
$mem = $this->DB->fetch();
|
||||
$pass = md5( $password );
|
||||
|
||||
/* Check it out */
|
||||
if ( ! $mem['id'] )
|
||||
{
|
||||
return 'Пользователь таким именем не найден';
|
||||
}
|
||||
|
||||
if ( $pass != $mem['password'] AND $pass != $mem['legacy_password'] )
|
||||
{
|
||||
return 'Неверный пароль';
|
||||
}
|
||||
|
||||
if ( $mem['g_access_cp'] != 1 )
|
||||
{
|
||||
return 'У вас нет доступа к системе обновления';
|
||||
}
|
||||
|
||||
/* Set up _member */
|
||||
$this->loadMemberData( $mem['id'] );
|
||||
|
||||
/* Still here? */
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return log in form HTML
|
||||
*
|
||||
* @access public
|
||||
* @return string HTML
|
||||
*/
|
||||
public function fetchLogInForm()
|
||||
{
|
||||
return $this->registry->output->template()->upgrade_login_200plus( 'username' );
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,241 @@
|
||||
<?php
|
||||
/**
|
||||
* Invision Power Services
|
||||
* IP.Board v3.0.5
|
||||
* Version Specific Upgrade Functions
|
||||
* Last Updated: $Date: 2009-01-05 22:21:54 +0000 (Mon, 05 Jan 2009) $
|
||||
*
|
||||
* @author Matt Mecham
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license http://www.iinvisionpower.com/community/board/license.html
|
||||
* @package Invision Power Board
|
||||
* @link http://www.iinvisionpower.com
|
||||
* @since 1st December 2008
|
||||
* @version $Revision: 3572 $
|
||||
*
|
||||
*/
|
||||
|
||||
class upgradeLegacy
|
||||
{
|
||||
/**
|
||||
* Member data
|
||||
*
|
||||
* @access private
|
||||
* @var array
|
||||
*/
|
||||
private $_member;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function __construct( ipsRegistry $registry )
|
||||
{
|
||||
/* Make object */
|
||||
$this->registry = $registry;
|
||||
$this->DB = $this->registry->DB();
|
||||
$this->settings =& $this->registry->fetchSettings();
|
||||
$this->request =& $this->registry->fetchRequest();
|
||||
$this->cache = $this->registry->cache();
|
||||
$this->caches =& $this->registry->cache()->fetchCaches();
|
||||
|
||||
/* Make sure tables exist that won't in pre 3.0 versions */
|
||||
if ( file_exists( IPS_ROOT_PATH . 'setup/sql/ipb3_' . strtolower( ipsRegistry::$settings['sql_driver'] ) . '.php' ) )
|
||||
{
|
||||
require( IPS_ROOT_PATH . 'setup/sql/ipb3_' . strtolower( ipsRegistry::$settings['sql_driver'] ) . '.php' );
|
||||
|
||||
$prefix = $this->registry->dbFunctions()->getPrefix();
|
||||
|
||||
if ( ! $this->DB->checkForField( 'upgrade_app', 'upgrade_history' ) )
|
||||
{
|
||||
if ( $UPGRADE_TABLE_FIELD )
|
||||
{
|
||||
$this->DB->query( IPSSetUp::addPrefixToQuery( $UPGRADE_TABLE_FIELD, $prefix ) );
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! $this->DB->checkForTable( 'upgrade_sessions' ) )
|
||||
{
|
||||
if ( $UPGRADE_SESSION_TABLE )
|
||||
{
|
||||
$this->DB->query( IPSSetUp::addPrefixToQuery( $UPGRADE_SESSION_TABLE, $prefix ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetch auth key
|
||||
*
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function fetchAuthKey()
|
||||
{
|
||||
if ( ! $this->_member['id'] AND ! $this->_member['member_id'] )
|
||||
{
|
||||
throw new Exception( "ПОЛЬЗОВАТЕЛЬ НЕ ЗАГРУЖЕН" );
|
||||
}
|
||||
else
|
||||
{
|
||||
return $this->_member['member_login_key'];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetch member data
|
||||
*
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function fetchMemberData()
|
||||
{
|
||||
return ( is_array( $this->_member ) ) ? $this->_member : array();
|
||||
}
|
||||
|
||||
/**
|
||||
* Load and return member data
|
||||
*
|
||||
* @access public
|
||||
* @param int Member ID to load
|
||||
* @return array
|
||||
*/
|
||||
public function loadMemberData( $memberId )
|
||||
{
|
||||
/* At this point, we could be either using 2.3 or 3.0 */
|
||||
if ( $this->DB->checkForField( 'member_id', 'members' ) )
|
||||
{
|
||||
/* Attempt to load member */
|
||||
$this->DB->build( array( 'select' => 'm.*',
|
||||
'from' => array( 'members' => 'm' ),
|
||||
'where' => 'm.member_id=' . intval( $memberId ),
|
||||
'add_join' => array( array( 'select' => 'g.*',
|
||||
'from' => array( 'groups' => 'g' ),
|
||||
'where' => 'g.g_id=m.member_group_id' ) ) ) );
|
||||
|
||||
$this->DB->execute();
|
||||
|
||||
$this->_member = $this->DB->fetch();
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Attempt to load member */
|
||||
$this->DB->build( array( 'select' => 'm.*',
|
||||
'from' => array( 'members' => 'm' ),
|
||||
'where' => 'm.id=' . intval( $memberId ),
|
||||
'add_join' => array( array( 'select' => 'g.*',
|
||||
'from' => array( 'groups' => 'g' ),
|
||||
'where' => 'g.g_id=m.mgroup' ) ) ) );
|
||||
|
||||
$this->DB->execute();
|
||||
|
||||
$this->_member = $this->DB->fetch();
|
||||
|
||||
/* Fix up pre-3 stuffs */
|
||||
$this->_member['member_id'] = $this->_member['id'];
|
||||
$this->_member['member_group_id'] = $this->_member['mgroup'];
|
||||
}
|
||||
|
||||
/* Set up seconday groups */
|
||||
$this->_member = ips_MemberRegistry::setUpSecondaryGroups( $this->_member );
|
||||
|
||||
return $this->fetchMemberData();
|
||||
}
|
||||
|
||||
/**
|
||||
* Authenticate log in
|
||||
*
|
||||
* @access public
|
||||
* @param string Username (from $this->request)
|
||||
* @param string Password (from $this->request)
|
||||
* @return mixed TRUE if successful, string (message) if not
|
||||
*/
|
||||
public function authenticateLogIn( $username, $password )
|
||||
{
|
||||
/* Log in type */
|
||||
$loginType = $this->_fetchLogInType();
|
||||
$where = ( $loginType == 'username' ) ? 'LOWER(m.name)=\'' . mb_strtolower( $username ) . '\'' : 'm.email=\'' . mb_strtolower( $username ) . '\'';
|
||||
|
||||
/* Attempt to load member */
|
||||
$this->DB->build( array( 'select' => 'm.*',
|
||||
'from' => array( 'members' => 'm' ),
|
||||
'where' => $where,
|
||||
'add_join' => array( array( 'select' => 'g.*',
|
||||
'from' => array( 'groups' => 'g' ),
|
||||
'where' => 'g.g_id=m.mgroup' ),
|
||||
array( 'select' => 'c.*',
|
||||
'from' => array( 'members_converge' => 'c' ),
|
||||
'where' => 'c.converge_email=m.email' ) ) ) );
|
||||
|
||||
|
||||
$this->DB->execute();
|
||||
|
||||
$mem = $this->DB->fetch();
|
||||
|
||||
/* Check it out */
|
||||
if ( ! $mem['id'] OR ! $mem['converge_pass_hash'] )
|
||||
{
|
||||
return 'Пользователь не найден';
|
||||
}
|
||||
|
||||
if ( $mem['converge_pass_hash'] != md5( md5( $mem['converge_pass_salt'] ) . md5( $password ) ) )
|
||||
{
|
||||
return 'Неверный пароль';
|
||||
}
|
||||
|
||||
/* Test seconday groups */
|
||||
$mem = ipsRegistry::member()->setUpSecondaryGroups( $mem );
|
||||
|
||||
if ( $mem['g_access_cp'] != 1 )
|
||||
{
|
||||
return 'У вас нет доступа к системе обновления';
|
||||
}
|
||||
|
||||
/* Set up _member */
|
||||
$this->loadMemberData( $mem['id'] );
|
||||
|
||||
/* Still here? */
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return log in form HTML
|
||||
*
|
||||
* @access public
|
||||
* @return string HTML
|
||||
*/
|
||||
public function fetchLogInForm()
|
||||
{
|
||||
$loginType = $this->_fetchLogInType();
|
||||
|
||||
return $this->registry->output->template()->upgrade_login_200plus( $loginType );
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetch the log in type
|
||||
*
|
||||
* @access private
|
||||
* @return string
|
||||
*/
|
||||
public function _fetchLoginType()
|
||||
{
|
||||
$loginType = 'username';
|
||||
|
||||
$this->DB->build( array( 'select' => '*', 'from' => 'conf_settings', 'where' => "conf_key IN('ipbli_usertype','converge_login_method')", 'order' => 'conf_key ASC' ) );
|
||||
$this->DB->execute();
|
||||
|
||||
while( $r = $this->DB->fetch() )
|
||||
{
|
||||
$r['conf_value'] = $r['conf_value'] ? $r['conf_value'] : $r['conf_default'];
|
||||
|
||||
if ( $r['conf_value'] )
|
||||
{
|
||||
$loginType = $r['conf_value'];
|
||||
}
|
||||
}
|
||||
|
||||
return $loginType;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,205 @@
|
||||
<?php
|
||||
/**
|
||||
* Invision Power Services
|
||||
* IP.Board v3.0.5
|
||||
* Version Specific Upgrade Functions
|
||||
* Last Updated: $Date: 2009-01-05 22:21:54 +0000 (Mon, 05 Jan 2009) $
|
||||
*
|
||||
* @author Matt Mecham
|
||||
* @copyright (c) 2001 - 2009 Invision Power Services, Inc.
|
||||
* @license http://www.iinvisionpower.com/community/board/license.html
|
||||
* @package Invision Power Board
|
||||
* @link http://www.iinvisionpower.com
|
||||
* @since 1st December 2008
|
||||
* @version $Revision: 3572 $
|
||||
*
|
||||
*/
|
||||
|
||||
class upgradeLegacy
|
||||
{
|
||||
/**
|
||||
* Member data
|
||||
*
|
||||
* @access private
|
||||
* @var array
|
||||
*/
|
||||
private $_member;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function __construct( ipsRegistry $registry )
|
||||
{
|
||||
/* Make object */
|
||||
$this->registry = $registry;
|
||||
$this->DB = $this->registry->DB();
|
||||
$this->settings =& $this->registry->fetchSettings();
|
||||
$this->request =& $this->registry->fetchRequest();
|
||||
$this->cache = $this->registry->cache();
|
||||
$this->caches =& $this->registry->cache()->fetchCaches();
|
||||
|
||||
/* Make sure tables exist that won't in pre 3.0 versions */
|
||||
if ( file_exists( IPS_ROOT_PATH . 'setup/sql/ipb3_' . strtolower( ipsRegistry::$settings['sql_driver'] ) . '.php' ) )
|
||||
{
|
||||
require( IPS_ROOT_PATH . 'setup/sql/ipb3_' . strtolower( ipsRegistry::$settings['sql_driver'] ) . '.php' );
|
||||
|
||||
$prefix = $this->registry->dbFunctions()->getPrefix();
|
||||
|
||||
if ( ! $this->DB->checkForField( 'upgrade_app', 'upgrade_history' ) )
|
||||
{
|
||||
if ( $UPGRADE_TABLE_FIELD )
|
||||
{
|
||||
$this->DB->query( IPSSetUp::addPrefixToQuery( $UPGRADE_TABLE_FIELD, $prefix ) );
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! $this->DB->checkForTable( 'upgrade_sessions' ) )
|
||||
{
|
||||
if ( $UPGRADE_SESSION_TABLE )
|
||||
{
|
||||
$this->DB->query( IPSSetUp::addPrefixToQuery( $UPGRADE_SESSION_TABLE, $prefix ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetch auth key
|
||||
*
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function fetchAuthKey()
|
||||
{
|
||||
if ( ! $this->_member['member_id'] )
|
||||
{
|
||||
throw new Exception( "ПОЛЬЗОВАТЕЛЬ НЕ ЗАГРУЖЕН" );
|
||||
}
|
||||
else
|
||||
{
|
||||
return $this->_member['member_login_key'];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetch member data
|
||||
*
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function fetchMemberData()
|
||||
{
|
||||
return ( is_array( $this->_member ) ) ? $this->_member : array();
|
||||
}
|
||||
|
||||
/**
|
||||
* Load and return member data
|
||||
*
|
||||
* @access public
|
||||
* @param int Member ID to load
|
||||
* @return array
|
||||
*/
|
||||
public function loadMemberData( $memberId )
|
||||
{
|
||||
/* Attempt to load member */
|
||||
$this->DB->build( array( 'select' => 'm.*',
|
||||
'from' => array( 'members' => 'm' ),
|
||||
'where' => 'm.member_id=' . intval( $memberId ),
|
||||
'add_join' => array( array( 'select' => 'g.*',
|
||||
'from' => array( 'groups' => 'g' ),
|
||||
'where' => 'g.g_id=m.member_group_id' ) ) ) );
|
||||
|
||||
$this->DB->execute();
|
||||
|
||||
/* Set up seconday groups */
|
||||
$this->_member = ips_MemberRegistry::setUpSecondaryGroups( $this->DB->fetch() );
|
||||
|
||||
return $this->fetchMemberData();
|
||||
}
|
||||
|
||||
/**
|
||||
* Authenticate log in
|
||||
*
|
||||
* @access public
|
||||
* @param string Username (from $this->request)
|
||||
* @param string Password (from $this->request)
|
||||
* @return mixed TRUE if successful, string (message) if not
|
||||
*/
|
||||
public function authenticateLogIn( $username, $password )
|
||||
{
|
||||
require_once( IPS_ROOT_PATH . 'sources/handlers/han_login.php' );
|
||||
$han_login = new han_login( $this->registry );
|
||||
$han_login->is_admin_auth = 1;
|
||||
$han_login->init();
|
||||
|
||||
$email = '';
|
||||
|
||||
/* Is this a username or email address? */
|
||||
if ( IPSText::checkEmailAddress( $username ) )
|
||||
{
|
||||
$email = $username;
|
||||
$username = '';
|
||||
}
|
||||
|
||||
$han_login->loginAuthenticate( $username, $email, $password );
|
||||
|
||||
$mem = $han_login->member_data;
|
||||
|
||||
if ( ( ! $mem['member_id'] ) or ( $han_login->return_code == 'NO_USER' ) )
|
||||
{
|
||||
return 'Пользователь не найден';
|
||||
}
|
||||
|
||||
if ( $han_login->return_code == 'NO_ACCESS' )
|
||||
{
|
||||
return 'У вас нет доступа к системе обновления';
|
||||
}
|
||||
else if ( $han_login->return_code != 'SUCCESS' )
|
||||
{
|
||||
return 'Имя пользователя или пароль неверны';
|
||||
}
|
||||
|
||||
/* Test seconday groups */
|
||||
$mem = ipsRegistry::member()->setUpSecondaryGroups( $mem );
|
||||
|
||||
if ( $mem['g_access_cp'] != 1 )
|
||||
{
|
||||
return 'У вас нет доступа к системе обновления';
|
||||
}
|
||||
|
||||
/* Set up _member */
|
||||
$this->loadMemberData( $mem['member_id'] );
|
||||
|
||||
/* Still here? */
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return log in form HTML
|
||||
*
|
||||
* @access public
|
||||
* @return string HTML
|
||||
*/
|
||||
public function fetchLogInForm()
|
||||
{
|
||||
require_once( IPS_ROOT_PATH . 'sources/handlers/han_login.php' );
|
||||
$han_login = new han_login( $this->registry );
|
||||
$han_login->is_admin_auth = 1;
|
||||
$han_login->init();
|
||||
|
||||
$additional_data = ''; //$han_login->additionalFormHTML();
|
||||
$replace = false;
|
||||
$data = array();
|
||||
|
||||
if( !is_null($additional_data) AND is_array($additional_data) AND count($additional_data) )
|
||||
{
|
||||
$replace = $additional_data[0];
|
||||
$data = $additional_data[1];
|
||||
}
|
||||
|
||||
return $this->registry->output->template()->upgrade_login_300plus( $data, $replace == 'replace' ? true : false );
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user