Script written by Matthew Mecham | > Date started: 19th March 2004 | > Updated for 2.1: 23 June 2005 | +-------------------------------------------------------------------------- */ error_reporting (E_ERROR | E_WARNING | E_PARSE); set_magic_quotes_runtime(0); //+------------------------------------------------------------------------ // ENTER YOUR PATH TO THE DIRECTORY THIS SCRIPT IS IN. //+------------------------------------------------------------------------ // Tips: // // If you are using Windows and Apache, do not // use backslashes, use normal forward slashes. // You may need to remove the drive letter also // Example: C:\apache\htdocs\ibforums\ will need // to be: /apache/htdocs/ibforums/ // // If you are using Windows and IIS, then you will // need to enter double backslashes. // // In all cases, please enter a trailing slash (or // trailing backslashes...) //+------------------------------------------------------------------------ define( 'THIS_ROOT_PATH', './' ); //+------------------------------------------------------------------------ // ROOT TO REST OF IPB (SHOULD BE ABLE TO LEAVE AS-IS //+------------------------------------------------------------------------ define( 'ROOT_PATH', '../' ); //----------------------------------------------- // NO USER EDITABLE SECTIONS BELOW //----------------------------------------------- define( 'KERNEL_PATH', ROOT_PATH.'ips_kernel/' ); define( 'CACHE_PATH' , ROOT_PATH ); define ( 'IN_ACP', 1 ); define ( 'IN_IPB', 1 ); define ( 'IN_DEV', 0 ); define ( 'IPBVERSION', '2.1.7' ); define ( 'IPB_LONG_VERSION', '21013.60712.u' ); define ( 'USE_SHUTDOWN', 0 ); define ( 'SAFE_MODE_ON', 0 ); $INFO = array(); //-------------------------------- // Load our classes //-------------------------------- require ROOT_PATH . "sources/ipsclass.php"; require KERNEL_PATH . "class_converge.php"; # Initiate super-class $ipsclass = new ipsclass(); $ipsclass->vars = $INFO; $ipsclass->template = new template(); //-------------------------------- // Set up our vars //-------------------------------- $ipsclass->parse_incoming(); $ipsclass->initiate_ipsclass(); //-------------------------------- // Set converge //-------------------------------- $ipsclass->converge = new class_converge( $ipsclass->DB ); //--------------------------------------- // Installer locked? //--------------------------------------- if ( file_exists( THIS_ROOT_PATH.'install.lock') ) { install_error("Скрипт установки заблокирован!
Пожалуйста, (через FTP) удалите файл 'install/install.lock'"); exit(); } //--------------------------------------- // Make sure we've renamed conf_global.php //--------------------------------------- if ( file_exists( ROOT_PATH.'conf_global.php.dist') AND ! file_exists( ROOT_PATH.'conf_global.php') ) { if ( ! @rename( ROOT_PATH.'conf_global.php.dist', ROOT_PATH.'conf_global.php' ) ) { install_error("

Вы обязаны переименовать файл 'conf_global.php.dist' в 'conf_global.php' перед установкой форума.

Этот файл можно найти в корневой папке форума, там же где и 'admin.php' и 'index.php'."); exit(); } } //----------------------------------------------- // What to do? //----------------------------------------------- switch($ipsclass->input['a']) { case '1': do_setup_form(); break; case '2': do_install(); break; case 'templates': do_templates(); break; case 'acpperms': do_acpperms(); break; case '3': do_finish(); break; default: do_intro(); break; } /*-------------------------------------------------------------------------*/ // DO FINISH /*-------------------------------------------------------------------------*/ function do_finish() { global $ipsclass; //----------------------------------- // IMPORT $INFO! //----------------------------------- $require = ROOT_PATH."conf_global.php"; if ( ! file_exists($require) ) { install_error("Невозможно найти файл '$require'. Возможно, вам необходимо ввести полный путь к этому файлу скрипта установки (index.php). Для этого просто откройте этот файл в любом текстовом редакторе и введите значение переменной \$root (не забудьте добавить конечный слэш '/'). Пользователям NT систем необходимо использовать двойной слэш."); } require_once($require); //----------------------------------- // Attempt a DB connection.. //----------------------------------- require_once( KERNEL_PATH.'class_db_'.$INFO['sql_driver'].".php" ); $ipsclass->DB = new db_driver(); $ipsclass->DB->obj['sql_database'] = $INFO['sql_database']; $ipsclass->DB->obj['sql_user'] = $INFO['sql_user']; $ipsclass->DB->obj['sql_pass'] = $INFO['sql_pass']; $ipsclass->DB->obj['sql_host'] = $INFO['sql_host']; $ipsclass->DB->obj['sql_tbl_prefix'] = $INFO['sql_tbl_prefix']; $ipsclass->DB->obj['query_cache_file'] = ROOT_PATH.'sources/sql/'.$INFO['sql_driver'].'_admin_queries.php'; $ipsclass->DB->obj['use_shutdown'] = 0; //----------------------------------- // Required vars? //----------------------------------- if ( is_array( $ipsclass->DB->connect_vars ) and count( $ipsclass->DB->connect_vars ) ) { foreach( $ipsclass->DB->connect_vars as $k => $v ) { $ipsclass->DB->connect_vars[ $k ] = $INFO[ $k ]; } } //----------------------------------- // Attempt a connect //----------------------------------- if ( ! $ipsclass->DB->connect() ) { install_error( "Ошибка соединения:

".$ipsclass->DB->error ); } //-------------------------------- // Make CONSTANT //-------------------------------- define( 'SQL_PREFIX', $ipsclass->DB->obj['sql_tbl_prefix'] ); define( 'SQL_DRIVER', strtolower($INFO['sql_driver']) ); //----------------------------------- // Get ACP library //----------------------------------- require_once( ROOT_PATH.'sources/lib/admin_cache_functions.php' ); $acp = new admin_cache_functions(); $acp->ipsclass =& $ipsclass; $acp->_rebuild_all_caches( array(2) ); unset( $acp ); //------------------------------------------------------------- // Forum cache //------------------------------------------------------------- $ipsclass->update_forum_cache(); //------------------------------------------------------------- // Group Cache //------------------------------------------------------------- require_once( ROOT_PATH.'sources/action_admin/groups.php' ); $lib = new ad_groups(); $lib->ipsclass =& $ipsclass; $lib->rebuild_group_cache(); unset( $lib ); //------------------------------------------------------------- // Systemvars //------------------------------------------------------------- $ipsclass->cache['systemvars'] = array(); $result = $ipsclass->DB->simple_exec_query( array( 'select' => 'count(*) as cnt', 'from' => 'mail_queue' ) ); $ipsclass->cache['systemvars']['mail_queue'] = intval( $result['cnt'] ); $ipsclass->cache['systemvars']['task_next_run'] = time() + 3600; $ipsclass->update_cache( array( 'name' => 'systemvars', 'array' => 1, 'deletefirst' => 1 ) ); //------------------------------------------------------------- // Stats //------------------------------------------------------------- $ipsclass->cache['stats'] = array(); $ipsclass->cache['stats']['total_replies'] = 0; $ipsclass->cache['stats']['total_topics'] = 1; $ipsclass->cache['stats']['mem_count'] = 1; $r = $ipsclass->DB->simple_exec_query( array( 'select' => 'id, name', 'from' => 'members', 'order' => 'id DESC', 'limit' => '0,1' ) ); $ipsclass->cache['stats']['last_mem_name'] = $r['name']; $ipsclass->cache['stats']['last_mem_id'] = $r['id']; $ipsclass->update_cache( array( 'name' => 'stats', 'array' => 1, 'deletefirst' => 1 ) ); //------------------------------------------------------------- // Ranks //------------------------------------------------------------- require_once( ROOT_PATH.'sources/action_admin/member.php' ); $lib = new ad_member(); $lib->ipsclass =& $ipsclass; $lib->titles_recache(); unset( $lib ); //------------------------------------------------------------- // SETTINGS //------------------------------------------------------------- require_once( ROOT_PATH.'sources/action_admin/settings.php' ); $lib = new ad_settings(); $lib->ipsclass =& $ipsclass; $lib->setting_rebuildcache(); unset( $lib ); //------------------------------------------------------------- // EMOTICONS //------------------------------------------------------------- require_once( ROOT_PATH.'sources/action_admin/emoticons.php' ); $lib = new ad_emoticons(); $lib->ipsclass =& $ipsclass; $lib->emoticon_rebuildcache(); unset( $lib ); //------------------------------------------------------------- // LANGUAGES //------------------------------------------------------------- require_once( ROOT_PATH.'sources/action_admin/languages.php' ); $lib = new ad_languages(); $lib->ipsclass =& $ipsclass; $lib->rebuild_cache(); unset( $lib ); //------------------------------------------------------------- // ATTACHMENT TYPES //------------------------------------------------------------- require_once( ROOT_PATH.'sources/action_admin/attachments.php' ); $lib = new ad_attachments(); $lib->ipsclass =& $ipsclass; $lib->attach_type_rebuildcache(); unset( $lib ); //----------------------------------- // Attempt to lock the install.. //----------------------------------- if ($FH = @fopen( THIS_ROOT_PATH.'install.lock', 'w' ) ) { @fwrite( $FH, 'bleh', 4 ); @fclose($FH); @chmod( THIS_ROOT_PATH.'install.lock', 0666 ); $ipsclass->template->print_top('Успешно!'); $msg="Скрипт установки сейчас заблокирован (для переустановки удалите файл 'install.lock'). Для большей безопасности, пожалуйста, удалите файл install/index.php прежде, чем продолжить.

НАЖМИТЕ СЮДА, ЧТОБЫ ВОЙТИ В ФОРУМ!
"; } else { $ipsclass->template->print_top('Успешно!'); $msg = "ПОЖАЛУЙСТА, УДАЛИТЕ ФАЙЛ СКРИПТА УСТАНОВКИ ('/install/index.php') ПРЕЖДЕ, ЧЕМ ПРОДОЛЖИТЬ!
Если вы не сделаете этого, любой пользователь интернета сможет удалить данные вашего форума!

НАЖМИТЕ СЮДА, ЧТОБЫ ВОЙТИ В ФОРУМ!
"; } $ipsclass->template->contents .= "
Успешно
Успешно

$msg
"; $ipsclass->template->output(); } //*-------------------------------------------------------------------------*/ // Install the ACP perm keys /*-------------------------------------------------------------------------*/ function do_acpperms() { global $ipsclass; //----------------------------------- // INIT //----------------------------------- $inserted = 0; //----------------------------------- // IMPORT $INFO! //----------------------------------- $require = ROOT_PATH."conf_global.php"; if ( ! file_exists($require) ) { install_error("Невозможно найти '$require'. Возможно, вам необходимо ввести полный путь к этому файлу скрипта установки (index.php). Для этого просто откройте этот файл в любом текстовом редакторе и введите значение переменной \$root (не забудьте добавить конечный слэш '/'). Пользователям NT систем необходимо использовать двойной слэш."); } require_once($require); //----------------------------------- // Attempt a DB connection.. //----------------------------------- require_once( KERNEL_PATH.'class_db_'.$INFO['sql_driver'].".php" ); $ipsclass->DB = new db_driver(); $ipsclass->DB->obj['sql_database'] = $INFO['sql_database']; $ipsclass->DB->obj['sql_user'] = $INFO['sql_user']; $ipsclass->DB->obj['sql_pass'] = $INFO['sql_pass']; $ipsclass->DB->obj['sql_host'] = $INFO['sql_host']; $ipsclass->DB->obj['sql_tbl_prefix'] = $INFO['sql_tbl_prefix']; $ipsclass->DB->obj['query_cache_file'] = ROOT_PATH.'sources/sql/'.$INFO['sql_driver'].'_admin_queries.php'; $ipsclass->DB->obj['use_shutdown'] = 0; //----------------------------------- // Required vars? //----------------------------------- if ( is_array( $ipsclass->DB->connect_vars ) and count( $ipsclass->DB->connect_vars ) ) { foreach( $ipsclass->DB->connect_vars as $k => $v ) { $ipsclass->DB->connect_vars[ $k ] = $INFO[ $k ]; } } //----------------------------------- // Attempt a connect //----------------------------------- if ( ! $ipsclass->DB->connect() ) { install_error( "Ошибка соединения:

".$ipsclass->DB->error ); } //-------------------------------- // Make CONSTANT //-------------------------------- define( 'SQL_PREFIX', $ipsclass->DB->obj['sql_tbl_prefix'] ); define( 'SQL_DRIVER', strtolower($INFO['sql_driver']) ); //----------------------------------- // Get XML //----------------------------------- require_once( KERNEL_PATH.'class_xml.php' ); $xml = new class_xml(); $xml->lite_parser = 1; //------------------------------- // GET MACROS //------------------------------- $xmlfile = THIS_ROOT_PATH.'installfiles/ipb_acpperms.xml'; $content = implode( "", file($xmlfile) ); //------------------------------- // Unpack the datafile (MACRO) //------------------------------- $xml->xml_parse_document( $content ); //----------------------------------------- // Fix up... //----------------------------------------- if ( ! is_array( $xml->xml_array['permsexport']['permsgroup']['perm'][0] ) ) { //----------------------------------------- // Ensure [0] is populated //----------------------------------------- $tmp = $xml->xml_array['permsexport']['permsgroup']['perm']; unset($xml->xml_array['permsexport']['permsgroup']['perm']); $xml->xml_array['permsexport']['permsgroup']['perm'][0] = $tmp; } //----------------------------------------- // Loop through and sort out settings... //----------------------------------------- foreach( $xml->xml_array['permsexport']['permsgroup']['perm'] as $id => $entry ) { //----------------------------------------- // Do we have a row matching this already? //----------------------------------------- $_perm_main = $entry['acpperm_main']['VALUE']; $_perm_child = $entry['acpperm_child']['VALUE']; $_perm_bit = $entry['acpperm_bit']['VALUE']; $_perm_key = $_perm_main.':'.$_perm_child.':'.$_perm_bit; if ( ! $cur_perms[ $_perm_key ] ) { $ipsclass->DB->do_insert( 'admin_permission_keys', array( 'perm_key' => $_perm_key, 'perm_main' => $_perm_main, 'perm_child' => $_perm_child, 'perm_bit' => $_perm_bit ) ); $inserted++; } } //------------------------------- // ARE WE DONE? REALLY? COOL!! //------------------------------- $ipsclass->template->print_top('Успешно!'); $ipsclass->template->contents .= "
Успешно
Файлы шаблонов установлены!

$inserted настроек ограничения доступа в админцентр вставлено.
Нажмите на ссылку ниже для создания требуемых данных для кеширования

Нажмите сюда для продолжения
"; $ipsclass->template->output(); } //*-------------------------------------------------------------------------*/ // Install the template files, woohoo and stuff /*-------------------------------------------------------------------------*/ function do_templates() { global $ipsclass; //----------------------------------- // IMPORT $INFO! //----------------------------------- $require = ROOT_PATH."conf_global.php"; if ( ! file_exists($require) ) { install_error("Невозможно найти '$require'. Возможно, вам необходимо ввести полный путь к этому файлу скрипта установки (index.php). Для этого просто откройте этот файл в любом текстовом редакторе и введите значение переменной \$root (не забудьте добавить конечный слэш '/'). Пользователям NT систем необходимо использовать двойной слэш."); } require_once($require); //----------------------------------- // Attempt a DB connection.. //----------------------------------- require_once( KERNEL_PATH.'class_db_'.$INFO['sql_driver'].".php" ); $ipsclass->DB = new db_driver(); $ipsclass->DB->obj['sql_database'] = $INFO['sql_database']; $ipsclass->DB->obj['sql_user'] = $INFO['sql_user']; $ipsclass->DB->obj['sql_pass'] = $INFO['sql_pass']; $ipsclass->DB->obj['sql_host'] = $INFO['sql_host']; $ipsclass->DB->obj['sql_tbl_prefix'] = $INFO['sql_tbl_prefix']; $ipsclass->DB->obj['query_cache_file'] = ROOT_PATH.'sources/sql/'.$INFO['sql_driver'].'_admin_queries.php'; $ipsclass->DB->obj['use_shutdown'] = 0; //----------------------------------- // Required vars? //----------------------------------- if ( is_array( $ipsclass->DB->connect_vars ) and count( $ipsclass->DB->connect_vars ) ) { foreach( $ipsclass->DB->connect_vars as $k => $v ) { $ipsclass->DB->connect_vars[ $k ] = $INFO[ $k ]; } } //----------------------------------- // Attempt a connect //----------------------------------- if ( ! $ipsclass->DB->connect() ) { install_error( "Ошибка соединения:

".$ipsclass->DB->error ); } //-------------------------------- // Make CONSTANT //-------------------------------- define( 'SQL_PREFIX', $ipsclass->DB->obj['sql_tbl_prefix'] ); define( 'SQL_DRIVER', strtolower($INFO['sql_driver']) ); //----------------------------------- // Get XML //----------------------------------- require_once( KERNEL_PATH.'class_xml.php' ); $xml = new class_xml(); $xml->lite_parser = 1; //----------------------------------- // Get XML file (TEMPLATES) //----------------------------------- $xmlfile = ROOT_PATH.'ipb_templates.xml'; $setting_content = implode( "", file($xmlfile) ); //------------------------------- // Unpack the datafile (TEMPLATES) //------------------------------- $xml->xml_parse_document( $setting_content ); //------------------------------- // (TEMPLATES) //------------------------------- if ( ! is_array( $xml->xml_array['templateexport']['templategroup']['template'] ) ) { install_error("Ошибка с ipb_templates.xml - невозможно выполнить XML"); } foreach( $xml->xml_array['templateexport']['templategroup']['template'] as $id => $entry ) { $newrow = array(); $newrow['group_name'] = $entry[ 'group_name' ]['VALUE']; $newrow['section_content'] = $entry[ 'section_content' ]['VALUE']; $newrow['func_name'] = $entry[ 'func_name' ]['VALUE']; $newrow['func_data'] = $entry[ 'func_data' ]['VALUE']; $newrow['set_id'] = 1; $newrow['updated'] = time(); $ipsclass->DB->do_insert( 'skin_templates', $newrow ); } //------------------------------- // GET MACROS //------------------------------- $xmlfile = THIS_ROOT_PATH.'installfiles/ipb_macro.xml'; $setting_content = implode( "", file($xmlfile) ); //------------------------------- // Unpack the datafile (MACRO) //------------------------------- $xml->xml_parse_document( $setting_content ); //------------------------------- // (MACRO) //------------------------------- if ( ! is_array( $xml->xml_array['macroexport']['macrogroup']['macro'] ) ) { install_error("Ошибка с ipb_macro.xml - невозможно выполнить XML"); } foreach( $xml->xml_array['macroexport']['macrogroup']['macro'] as $id => $entry ) { $newrow = array(); $newrow['macro_value'] = $entry[ 'macro_value' ]['VALUE']; $newrow['macro_replace'] = $entry[ 'macro_replace' ]['VALUE']; $newrow['macro_set'] = 1; $ipsclass->DB->do_insert( 'skin_macro', $newrow ); } //------------------------------- // WRAPPER / CSS //------------------------------- require_once( THIS_ROOT_PATH.'installfiles/components.php' ); $wrapper_record = array( 'set_wrapper' => $WRAPPER, 'set_css' => $CSS, ); $ipsclass->DB->do_update( 'skin_sets', $wrapper_record, "set_skin_set_id=1" ); //------------------------------- // ARE WE DONE? REALLY? COOL!! //------------------------------- $ipsclass->template->print_top('Успешно!'); $ipsclass->template->contents .= "
Успешно
Шаблоны установлены!

Процесс установки завершен.
Нажмите на ссылку ниже для установки ограничений доступа в админцентр

Нажмите сюда для продолжения
"; $ipsclass->template->output(); } /*-------------------------------------------------------------------------*/ // DO install /*-------------------------------------------------------------------------*/ function do_install() { global $ipsclass; //----------------------------------- // INIT //----------------------------------- $NEW_INFO = array(); $need = array('board_url','sql_host','sql_database','sql_user','adminname','adminpassword','adminpassword2','email'); $setting_groups_by_key = array(); $setting_groups = array(); $extra_install = ""; //----------------------------------- // Check for blanks //----------------------------------- foreach($need as $greed) { if ( ! $ipsclass->input[ $greed ] ) { install_error("Вы обязаны заполнить все поля формы, за исключением префикса таблиц"); } } //----------------------------------- // Get XML //----------------------------------- require_once( KERNEL_PATH.'class_xml.php' ); $xml = new class_xml(); //----------------------------------- // Get XML file //----------------------------------- $xmlfile = THIS_ROOT_PATH.'installfiles/ipb_settings.xml'; $setting_content = implode( "", file($xmlfile) ); //----------------------------------- // Fix up URL //----------------------------------- $ipsclass->input['board_url'] = preg_replace( "#/$#", "", $ipsclass->input['board_url'] ); //----------------------------------- // TBL prefix //----------------------------------- if ($ipsclass->input['sql_tbl_prefix'] == "") { $ipsclass->input['sql_tbl_prefix'] = 'ibf_'; } //----------------------------------- // Safe mode //----------------------------------- $safe_mode = intval( $ipsclass->input['safe_mode'] ); //----------------------------------- // Did the admin passy and passy2 match? //----------------------------------- if ( $ipsclass->input['adminpassword2'] != $ipsclass->input['adminpassword'] ) { install_error("Введенные пароли не совпадают"); } //----------------------------------- // Get a correct path //----------------------------------- $root = THIS_ROOT_PATH; if ( $root == './') { $root = str_replace( '\\', '/', getcwd() ) . '/'; $root = str_replace( 'install/', '', $root ); } //----------------------------------- // Attempt to write the config file. //----------------------------------- $INFO = array( 'sql_driver' => $ipsclass->input['sql_driver'], 'sql_host' => $ipsclass->input['sql_host'], 'sql_database' => $ipsclass->input['sql_database'], 'sql_user' => $_POST['sql_user'], 'sql_pass' => $_POST['sql_pass'], 'sql_tbl_prefix' => $ipsclass->input['sql_tbl_prefix'], 'sql_debug' => 1, 'board_start' => time(), 'installed' => 1, 'php_ext' => 'php', 'safe_mode' => $safe_mode, 'board_url' => $ipsclass->input['board_url'], 'admin_group' => '4', 'guest_group' => '2', 'member_group' => '3', 'auth_group' => '1', ); //-------------------------------------------------- // Update VARS settings //-------------------------------------------------- $ipsclass->vars =& $INFO; //-------------------------------------------------- // Any "extra" configs required for this driver? //-------------------------------------------------- if ( file_exists( THIS_ROOT_PATH.'sql/'.$ipsclass->input['sql_driver'].'_install.php' ) ) { require_once( THIS_ROOT_PATH.'sql/'.$ipsclass->input['sql_driver'].'_install.php' ); $extra_install = new install_extra(); $extra_install->ipsclass =& $ipsclass; $extra_install->install_form_process(); if ( count( $extra_install->errors ) ) { install_error( "При проверке SQL информации обнаружены следующие ошибки:

".implode( "
", $extra_install->errors ) ); } if ( is_array( $extra_install->info_extra ) and count( $extra_install->info_extra ) ) { foreach( $extra_install->info_extra as $k => $v ) { $INFO[ $k ] = $v; } } } //----------------------------------- // Attempt a DB connection.. //----------------------------------- require ( KERNEL_PATH.'class_db_'.$INFO['sql_driver'].".php" ); $ipsclass->DB = new db_driver(); $ipsclass->DB->obj['sql_database'] = $INFO['sql_database']; $ipsclass->DB->obj['sql_user'] = $INFO['sql_user']; $ipsclass->DB->obj['sql_pass'] = $INFO['sql_pass']; $ipsclass->DB->obj['sql_host'] = $INFO['sql_host']; $ipsclass->DB->obj['sql_tbl_prefix'] = $INFO['sql_tbl_prefix']; $ipsclass->DB->obj['query_cache_file'] = ROOT_PATH.'sources/sql/'.$INFO['sql_driver'].'_admin_queries.php'; $ipsclass->DB->obj['use_shutdown'] = 0; $ipsclass->DB->return_die = 1; //----------------------------------- // Required vars? //----------------------------------- if ( is_array( $ipsclass->DB->connect_vars ) and count( $ipsclass->DB->connect_vars ) ) { foreach( $ipsclass->DB->connect_vars as $k => $v ) { $ipsclass->DB->connect_vars[ $k ] = $INFO[ $k ]; } } //----------------------------------- // Attempt a connect //----------------------------------- if ( ! $ipsclass->DB->connect() ) { install_error( "Connection error:

".$ipsclass->DB->error ); } //-------------------------------- // Make CONSTANT //-------------------------------- define( 'SQL_PREFIX', $ipsclass->DB->obj['sql_tbl_prefix'] ); define( 'SQL_DRIVER', strtolower($INFO['sql_driver']) ); $ipsclass->vars['sql_driver'] = SQL_DRIVER; //----------------------------------- // Write to disk //----------------------------------- $file_string = "<"."?php\n"; foreach( $INFO as $k => $v ) { $file_string .= '$INFO['."'".$k."'".']'."\t\t\t=\t'".$v."';\n"; } $file_string .= "\n".'?'.'>'; if ( $fh = fopen( ROOT_PATH.'conf_global.php', 'w' ) ) { fputs($fh, $file_string, strlen($file_string) ); fclose($fh); } else { install_error("Невозможна запись в 'conf_global.php'"); } //----------------------------------- // Require insert files //----------------------------------- require_once( THIS_ROOT_PATH.'sql/'.$INFO['sql_driver'].'_tables.php' ); require_once( THIS_ROOT_PATH.'sql/'.$INFO['sql_driver'].'_inserts.php' ); require_once( THIS_ROOT_PATH.'sql/'.$INFO['sql_driver'].'_fulltext.php' ); //----------------------------------- // Populate the database... //----------------------------------- foreach( $TABLE as $q ) { preg_match("/CREATE TABLE (\S+) \(/", $q, $match); if ($match[1]) { $ipsclass->DB->sql_drop_table( str_replace( 'ibf_', '', $match[1] ) ); } if ($ipsclass->input['sql_tbl_prefix'] != "ibf_") { $q = preg_replace("/ibf_(\S+?)([\s\.,]|$)/", $ipsclass->input['sql_tbl_prefix']."\\1\\2", $q); } //----------------------------------- // Pass to handler //----------------------------------- if ( $extra_install AND method_exists( $extra_install, 'process_query_create' ) ) { $q = $extra_install->process_query_create( $q ); } //----------------------------------- // Pass query //----------------------------------- if ( ! $ipsclass->DB->query($q) ) { install_error($q."

".$ipsclass->DB->error); } } //----------------------------------- // Create the fulltext index... //----------------------------------- if ( $ipsclass->DB->sql_can_fulltext() ) { foreach( $INDEX as $q ) { if ($ipsclass->input['sql_tbl_prefix'] != "ibf_") { $q = preg_replace("/ibf_(\S+?)([\s\.,]|$)/", $ipsclass->input['sql_tbl_prefix']."\\1\\2", $q); } //----------------------------------- // Pass to handler //----------------------------------- if ( $extra_install AND method_exists( $extra_install, 'process_query_index' ) ) { $q = $extra_install->process_query_index( $q ); } //----------------------------------- // Pass query //----------------------------------- if ( ! $ipsclass->DB->query($q) ) { install_error($q."

".$ipsclass->DB->error); } } } //----------------------------------- // Populate tables... //----------------------------------- foreach( $INSERT as $q ) { if ($ipsclass->input['sql_tbl_prefix'] != "ibf_") { $q = preg_replace("/ibf_(\S+?)([\s\.,]|$)/", $ipsclass->input['sql_tbl_prefix']."\\1\\2", $q); } $q = str_replace( "<%time%>", time(), $q ); //----------------------------------- // Pass to handler //----------------------------------- if ( $extra_install AND method_exists( $extra_install, 'process_query_insert' ) ) { $q = $extra_install->process_query_insert( $q ); } //----------------------------------- // Pass query //----------------------------------- if ( ! $ipsclass->DB->query($q) ) { install_error($q."

".$ipsclass->DB->error); } } //----------------------------------- // Insert the admin... //----------------------------------- $md5_once = trim(md5($ipsclass->input['adminpassword'])); $salt = $ipsclass->converge->generate_password_salt(5); $key = $ipsclass->converge->generate_auto_log_in_key(); $rpass = $ipsclass->converge->generate_compiled_passhash($salt, $md5_once); $time = time(); //----------------------------------- // Members... //----------------------------------- $member_record = array( 'id' => 1, 'name' => $ipsclass->input['adminname'], 'members_display_name' => $ipsclass->input['adminname'], 'mgroup' => 4, 'email' => $ipsclass->input['email'], 'joined' => $time, 'ip_address' => '127.0.0.1', 'posts' => 0, 'title' => 'Администратор', 'last_visit' => $time, 'last_activity' => $time, 'member_login_key' => $key, ); $ipsclass->DB->do_insert( 'members', $member_record ); //----------------------------------- // Converge... //----------------------------------- $converge_record = array( 'converge_email' => $ipsclass->input['email'], 'converge_joined' => $time, 'converge_pass_hash' => $rpass, 'converge_pass_salt' => $salt, ); $ipsclass->DB->do_insert( 'members_converge', $converge_record ); //----------------------------------- // Member Extra... //----------------------------------- $member_extra_record = array ( 'id' => 1, 'signature' => '', 'vdirs' => '', ); $ipsclass->DB->do_insert( 'member_extra', $member_extra_record ); //------------------------------- // Do we have a reg / copy key? //------------------------------- if ( file_exists( ROOT_PATH . '/retail/regkey.php' ) ) { require_once( ROOT_PATH . '/retail/regkey.php' ); $customer_reg_key = ''; } //------------------------------- // Unpack the datafile //------------------------------- $xml->xml_parse_document( $setting_content ); //------------------------------- // Known settings //------------------------------- if( substr( $ipsclass->input['board_url'], -1 ) == '/' ) { $ipsclass->input['board_url'] = substr( $ipsclass->input['board_url'], 0, -1 ); } $known = array( 'email_in' => $ipsclass->input['email'], 'email_out' => $ipsclass->input['email'], 'base_dir' => $root, 'upload_dir' => str_replace( "//", "/", $root."/uploads" ), 'upload_url' => $ipsclass->input['board_url']."/uploads", 'ipb_copy_number'=> $customer_copy_key, 'ipb_reg_number' => $customer_reg_key, ); if ( ! is_array( $xml->xml_array['settingexport']['settinggroup']['setting'] ) ) { install_error("Ошибка с ipb_settings.xml - невозможно выполнить XML файл"); } //----------------------------------------- // pArse //----------------------------------------- $fields = array( 'conf_title' , 'conf_description', 'conf_group' , 'conf_type' , 'conf_key' , 'conf_default', 'conf_extra' , 'conf_evalphp' , 'conf_protected', 'conf_position', 'conf_start_group', 'conf_end_group', 'conf_help_key', 'conf_add_cache' , 'conf_title_keyword' ); $setting_fields = array( 'conf_title_keyword', 'conf_title_title', 'conf_title_desc', 'conf_title_noshow' ); //----------------------------------------- // Fix up... //----------------------------------------- if ( ! is_array( $xml->xml_array['settingexport']['settinggroup']['setting'][0] ) ) { //----------------------------------------- // Ensure [0] is populated //----------------------------------------- $tmp = $xml->xml_array['settingexport']['settinggroup']['setting']; unset($xml->xml_array['settingexport']['settinggroup']['setting']); $xml->xml_array['settingexport']['settinggroup']['setting'][0] = $tmp; } //----------------------------------------- // Loop through and sort out settings... //----------------------------------------- foreach( $xml->xml_array['settingexport']['settinggroup']['setting'] as $id => $entry ) { $newrow = array(); //----------------------------------------- // Is setting? //----------------------------------------- if ( ! $entry['conf_is_title']['VALUE'] ) { foreach( $fields as $f ) { $newrow[$f] = $entry[ $f ]['VALUE']; } $new_settings[] = $newrow; } //----------------------------------------- // Is title? //----------------------------------------- else { foreach( $setting_fields as $f ) { $newrow[$f] = $entry[ $f ]['VALUE']; } $new_titles[] = $newrow; } } //----------------------------------------- // Sort out titles... //----------------------------------------- if ( is_array( $new_titles ) and count( $new_titles ) ) { foreach( $new_titles as $idx => $data ) { if ( $data['conf_title_title'] AND $data['conf_title_keyword'] ) { //----------------------------------------- // Get ID based on key //----------------------------------------- $save = array( 'conf_title_title' => $data['conf_title_title'], 'conf_title_desc' => $data['conf_title_desc'], 'conf_title_keyword' => $data['conf_title_keyword'], 'conf_title_noshow' => $data['conf_title_noshow'] ); //----------------------------------------- // Insert first //----------------------------------------- $ipsclass->DB->do_insert( 'conf_settings_titles', $save ); $conf_id = $ipsclass->DB->get_insert_id(); $save['conf_title_id'] = $conf_id; //----------------------------------------- // Update settings cache //----------------------------------------- $setting_groups_by_key[ $save['conf_title_keyword'] ] = $save; $setting_groups[ $save['conf_title_id'] ] = $save; $need_update[] = $conf_id; } } } //----------------------------------------- // Sort out settings //----------------------------------------- if ( is_array( $new_settings ) and count( $new_settings ) ) { foreach( $new_settings as $idx => $data ) { //----------------------------------------- // Make PHP slashes safe //----------------------------------------- //$data['conf_evalphp'] = str_replace( '\\', '\\\\', $data['conf_evalphp'] ); //----------------------------------------- // Insert known //----------------------------------------- if ( in_array( $data['conf_key'], array_keys( $known ) ) ) { $data['conf_value'] = $known[ $data['conf_key'] ]; } //----------------------------------------- // Now assign to the correct ID based on // our title keyword... //----------------------------------------- $data['conf_group'] = $setting_groups_by_key[ $data['conf_title_keyword'] ]['conf_title_id']; //----------------------------------------- // Remove from array //----------------------------------------- unset( $data['conf_title_keyword'] ); $ipsclass->DB->do_insert( 'conf_settings', $data ); } } //----------------------------------------- // Update group counts... //----------------------------------------- if ( count( $need_update ) ) { foreach( $need_update as $i => $idx ) { $conf = $ipsclass->DB->simple_exec_query( array( 'select' => 'count(*) as count', 'from' => 'conf_settings', 'where' => 'conf_group='.$idx ) ); $count = intval($conf['count']); $ipsclass->DB->do_update( 'conf_settings_titles', array( 'conf_title_count' => $count ), 'conf_title_id='.$idx ); } } //----------------------------------- // ARE WE DONE? REALLY? COOL!! //----------------------------------- $ipsclass->template->print_top('Успешно!'); $ipsclass->template->contents .= "
Успешно
Ваш форум успешно установлен!

Процесс установки почти завершен.
Следующий этап запишет шаблоны в базу данных...

Нажмите сюда, если вас не переместило автоматически...
"; $ipsclass->template->output(); } /*-------------------------------------------------------------------------*/ // SET UP FORM /*-------------------------------------------------------------------------*/ function do_setup_form() { global $ipsclass; //-------------------------------------------------- // INIT //-------------------------------------------------- $drivers = array(); $ipsclass->template->print_top('Установка'); //-------------------------------------------------- // Make sure kernel folder is present //-------------------------------------------------- if ( ! is_dir(ROOT_PATH.'ips_kernel') ) { install_error("Невозможно найти папку 'ips_kernel'. Пожалуйста, загрузите все необходимые папки и файлы."); } //-------------------------------------------------- // DO WE HAVE A DB DRIVER SET? //-------------------------------------------------- $ipsclass->input['sql_driver'] = ( $ipsclass->input['sql_driver'] == "" ) ? $_REQUEST['sql_driver'] : $ipsclass->input['sql_driver']; if ( ! $ipsclass->input['sql_driver'] ) { //---------------------------------------------- // Test to see how many DB driver's we've got.. //---------------------------------------------- $dh = opendir( ROOT_PATH.'ips_kernel' ) or install_error("Невозможно найти папку 'ips_kernel' для чтения, пожалуйста, проверьте все пути и права"); while ( $file = @readdir( $dh ) ) { if ( preg_match( "/^class_db_([a-zA-Z0-9]*)\.php/i", $file, $driver ) ) { $drivers[] = $driver[1]; } } @closedir( $dh ); //---------------------------------------------- // Got more than one? //---------------------------------------------- if ( count($drivers) > 1 ) { //------------------------------------------ // Show choice screen first... //------------------------------------------ $ipsclass->template->contents .= "
Обнаружено несколько SQL драйверов
Пожалуйста, выберите желаемый SQL драйвер для использования в вашем Invision Power Board
SQL Драйвер
(Выберите драйвер)
"; $ipsclass->template->output(); exit(); } else { //------------------------------------------ // Use only driver installed //------------------------------------------ $ipsclass->input['sql_driver'] = $drivers[0]; } } //-------------------------------------------------- // If we're here, we have chosen a driver, so....... //-------------------------------------------------- $this_url = str_replace( "/install/index.php", "", $_SERVER['HTTP_REFERER']); $this_url = str_replace( "/install/" , "", $this_url); $this_url = str_replace( "/install" , "", $this_url); $this_url = str_replace( "index.php" , "", $this_url); //-------------------------------------------------- // Test //-------------------------------------------------- if ( ! $this_url ) { $this_url = substr($_SERVER['SCRIPT_NAME'],0, -17); if ($this_url == '') { $this_url == '/'; } $this_url = 'http://'.$_SERVER['SERVER_NAME'].$this_url; } $this_url = preg_replace( "#/$#", "", str_replace( '?a=1', "", $this_url ) ); //-------------------------------------------------- // Safe mode? //-------------------------------------------------- $safe_mode = 0; if ( get_cfg_var('safe_mode') ) { $safe_mode = get_cfg_var('safe_mode'); } $ipsclass->template->contents .= "
Данные вашего сервера
Эта секция требует ввода вами ваших путей и URL'ов вашего форума.
"; if ( $safe_mode ) { $ipsclass->template->contents .= " "; } $ipsclass->template->contents .= "
IPB 'index.php' URL
Это URL (обязан начинаться с http://) вашей основной папки форума
Это может быть, например: http://www.domain.ru/forums
Обнаружен PHP Safe Mode/b>
Система установка обнаружила, что PHP на вашем сервере запущен в safe mode. Если это неверно, поправьте...
 

Ваши SQL данные
Этот блок требует от вас ввода SQL информации. Если вы ее не знаете, обратитесь к своему хостинг-провайдеру. Помните, вы должны указать в форме ниже существующую базу данных, если нет - вы должны создать новую базу данных на сервере прежде, чем продолжить установку.
SQL драйвер Вы выбрали и будете использовать ".strtoupper($ipsclass->input['sql_driver'])."
SQL хост
(обычно это localhost)
SQL имя базы данных
SQL имя пользователя
SQL пароль
SQL префикс таблиц
(Вы можете оставить поле пустым, тогда IPB будет использовать префикс по умолчанию - 'ibf_')
 

Ваша учетная запись администратора
Этот блок требует информацию для создания вашей учетной записи администратора будущего форума! Пожалуйста, введите достоверную информацию и перепроверьте ее! Для большей безопасности в качестве пароля администратора используйте комбинацию случайных чисел и букв (строчных и прописных)!
Имя пользователя
Пароль
Подтвердите пароль
E-mail
 
"; //-------------------------------------------------- // Any "extra" configs required for this driver? //-------------------------------------------------- if ( file_exists( THIS_ROOT_PATH.'sql/'.$ipsclass->input['sql_driver'].'_install.php' ) ) { require_once( THIS_ROOT_PATH.'sql/'.$ipsclass->input['sql_driver'].'_install.php' ); $extra_install = new install_extra(); $ipsclass->template->contents = str_replace( '', $extra_install->install_form_extra(), $ipsclass->template->contents ); } $ipsclass->template->output(); } /*-------------------------------------------------------------------------*/ // DO INTRO /*-------------------------------------------------------------------------*/ function do_intro() { global $ipsclass; $ipsclass->template->print_top('E-mail'); $ipsclass->template->contents .= "
Лицо :) Добро пожаловать в IPB

Прежде чем мы начнем установку форума, пожалуйста, проверьте, все ли файлы загружены на сервер, возможна ли запись в файл 'conf_global.php' (права CHMOD на файл должны быть 0666).

IPB ".IPBVERSION." требует PHP 4.3.0 или выше и SQL базу данных.

Вы также нуждаетесь в следующей информации, которую вам должен продоставить ваш хостинг-провайдер:
  • Имя вашей SQL базы данных
  • Ваше SQL имя пользователя
  • Ваш SQL пароль
  • Ваш SQL хост (обычно — localhost)

Когда вы нажмете на кнопку «Далее», вам будет дана форма для ввода всей необходимой для установки форума информации.

ПОЖАЛУЙСТА, ПОМНИТЕ: ИСПОЛЬЗУЯ ЭТОТ СКРИПТ УСТАНОВКИ, ВЫ УДАЛИТЕ ЛЮБУЮ ТЕКУЩУЮ, ИМЕЮЩУЮСЯ БАЗУ ДАННЫХ ФОРУМА INVISION POWER BOARD, ЕСЛИ ИСПОЛЬЗУЕТЕ ТАКОЙ ЖЕ ПРЕФИКС ТАБЛИЦ. "; //--------------------------------------- // Check to make sure that the config file // is there and it's got suitable permissions to write to: //--------------------------------------- $file = ROOT_PATH."conf_global.php"; $templates = THIS_ROOT_PATH."installfiles/ipb_templates.xml"; $warnings = array(); $checkfiles = array( ROOT_PATH ."ipb_templates.xml", THIS_ROOT_PATH."installfiles/components.php", THIS_ROOT_PATH."installfiles/ipb_macro.xml", THIS_ROOT_PATH."installfiles/ipb_settings.xml", THIS_ROOT_PATH."sql", KERNEL_PATH ."class_converge.php", KERNEL_PATH ."class_xml.php", ROOT_PATH ."conf_global.php" ); $writeable = array( ROOT_PATH."conf_global.php", ROOT_PATH."cache", ROOT_PATH."cache/lang_cache/", ROOT_PATH."cache/skin_cache/" ); foreach ( $checkfiles as $cf ) { if ( ! file_exists($cf) ) { $warnings[] = "Невозможно найти файл '$cf'."; } } foreach ( $writeable as $cf ) { if ( ! is_writeable($cf) ) { $warnings[] = "Невозможно произвести запись в файл '$cf'. Пожалуйста, установите права доступа к файлу (CHMOD) - 0777."; } } $phpversion = phpversion(); //---------------------------------- // CHECK BASICS //---------------------------------- if ($phpversion < '4.1.0') { $warnings[] = "Вы не сможете установить Invision Power Board. IPB требует PHP версии 4.1.0 или выше."; } if ( ! function_exists('get_cfg_var') ) { $warnings[] = "Вы не сможете установить Invision Power Board. Ваша поставка PHP не достаточна, чтобы запустить IPB."; } if ( ! function_exists('xml_parse_into_struct') ) { $warnings[] = "Вы не сможете установить Invision Power Board. IPB требует, чтобы XML-функции в PHP были включены. Пожалуйста, попросите вашего хостинг-провайдера включить поддержку XML."; } //---------------------------------- // Got error? //---------------------------------- if ( count($warnings) > 0 ) { $err_string = '·'.implode( "

·", $warnings ); $ipsclass->template->contents .= "

Внимание! Указанные ниже ошибки должны быть обязательно исправлены перед тем, как продолжить!

$err_string
"; } else { $ipsclass->template->contents .= "

Далее
"; } $ipsclass->template->contents .= "
"; $ipsclass->template->output(); } /*-------------------------------------------------------------------------*/ // Install Error /*-------------------------------------------------------------------------*/ function install_error($msg="") { global $ipsclass; $ipsclass->template->print_top('Внимание!'); $ipsclass->template->contents .= "
Внимание!

Указанные ниже ошибки должны быть обязательно исправлены перед тем, как продолжить!
Пожалуйста, вернитесь назад и попробуйте снова!

$msg
"; $ipsclass->template->output(); } /*-------------------------------------------------------------------------*/ // CLASS TEMPLATE /*-------------------------------------------------------------------------*/ class template { var $contents = ""; function output() { $year = date('Y'); echo $this->contents; echo "



Русская версия Invision Power Board © $year Invision Power Services, Inc.

"; exit(); } //-------------------------------------- function print_top($title="") { $this->contents = " Установка Invision Power Board :: $title
Инсталлятор Invision Power Board
 

"; } } ?>