Version 3.0.5

This commit is contained in:
Neo committed 2025-12-19 00:31:03 -08:00
1 parent 19b38c7c74
commit 1d4720f3e2
3755 files changed
+508378 -664541

No files matched your search

+209
View File
@@ -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