Перейти к контенту
  • 0

Проблема с установкой ipb v2.0.4


alexli2008

Вопрос

После того как залил файлы из папки upload на хостинг перешел к установке и вот что пишет:

<?php

/*
+--------------------------------------------------------------------------
|   INVISION POWER BOARD INSTALLER v2.0
|   ========================================
|   by Matthew Mecham
|   © 2001 - 2004 Invision Power Services, Inc.
|   [url="http://www.invisionpower.com"]http://www.invisionpower.com[/url]
|   ========================================
|   Web: [url="http://www.invisionboard.com"]http://www.invisionboard.com[/url]
+--------------------------------------------------------------------------
|
|   > Script written by Matthew Mecham
|   > Date started: 19th March 2004
|
+--------------------------------------------------------------------------
*/

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_IPB', 1 );
define ( 'IN_DEV', 0 );

define ( 'IPBVERSION', '2.0.0' );

define ( 'USE_SHUTDOWN', 0 );
define ( 'SAFE_MODE_ON', 0 );

//-----------------------------------------------
// INIT CLASSES
//-----------------------------------------------

require_once( ROOT_PATH.'sources/functions.php' );

$template = new template;
$std      = new FUNC();
$ibforums = new info();

//-----------------------------------------------
// PARSE INCOMING
//-----------------------------------------------

$VARS = $std->parse_incoming();

//+---------------------------------------
// What are we doing then? Eh? I'm talking to you!
//+---------------------------------------

if ( file_exists( THIS_ROOT_PATH.'install.lock') )
{
install_error("This installer is locked!<br>Please (via FTP) remove the 'install/install.lock' file");
exit();
}


switch($VARS['a'])
{
case '1':
	do_setup_form();
	break;

case '2':
	do_install();
	break;

case 'templates':
	do_templates();
	break;

case '3':
	do_finish();
	break;

default:
	do_intro();
	break;
}



function do_finish()
{
global $std, $template, $root, $VARS, $DB, $ibforums;

//-----------------------------------
// IMPORT $INFO!
//-----------------------------------

$require = ROOT_PATH."conf_global.php";

if ( ! file_exists($require) )
{
	install_error("Could not locate '$require'. You may need to enter a value for the root path in this installer script, to do this, simply open up this script in a text editor and enter a value in \$root - remember to add a trailing slash. NT users will need to use double backslashes");
}

include($require);

$INFO['sql_driver'] = strtolower($INFO['sql_driver']);

//-----------------------------------
// Get SQL engine
//-----------------------------------

require ( KERNEL_PATH.'class_db_'.$INFO['sql_driver'].".php");

$DB = new db_driver();

$DB->obj['sql_database']     = $INFO['sql_database'];
$DB->obj['sql_user']         = $INFO['sql_user'];
$DB->obj['sql_pass']         = $INFO['sql_pass'];
$DB->obj['sql_host']         = $INFO['sql_host'];
$DB->obj['sql_tbl_prefix']   = $INFO['sql_tbl_prefix'];
$DB->obj['query_cache_file'] = ROOT_PATH.'sources/sql/'.$INFO['sql_driver'].'_admin_queries.php';
$DB->obj['use_shutdown']     = 0;

//-----------------------------------
// Required vars?
//-----------------------------------

if ( is_array( $DB->connect_vars ) and count( $DB->connect_vars ) )
{
	foreach( $DB->connect_vars as $k => $v )
	{
		$DB->connect_vars[ $k ] = $INFO[ $k ];
	}
}

define ( 'SQL_DRIVER', strtolower($INFO['sql_driver']) );
$ibforums->vars['sql_driver'] = SQL_DRIVER;

//--------------------------------
// Get a DB connection
//--------------------------------

$DB->connect();

//-----------------------------------
// Get ACP library
//-----------------------------------

require_once( ROOT_PATH.'sources/admin/admin_cache_functions.php' );
$acp = new admin_cache_functions();

//-----------------------------------
// Cache skins and shit
//-----------------------------------

$acp->_rebuild_all_caches( array(2) );

//-------------------------------------------------------------
// Forum cache
//-------------------------------------------------------------

$ibforums->cache['forum_cache'] = array();

$DB->simple_construct( array( 'select' => '*',
							  'from'   => 'forums',
							  'order'  => 'parent_id, position'
					 )      );
$DB->simple_exec();

while( $fr = $DB->fetch_row() )
{
	$perms = unserialize(stripslashes($fr['permission_array']));

	$fr['read_perms']   = $perms['read_perms'];
	$fr['reply_perms']  = $perms['reply_perms'];
	$fr['start_perms']  = $perms['start_perms'];
	$fr['upload_perms'] = $perms['upload_perms'];
	$fr['show_perms']   = $perms['show_perms'];

	unset($fr['permission_array']);

	$ibforums->cache['forum_cache'][ $fr['id'] ] = $fr;
}

$std->update_cache( array( 'name' => 'forum_cache', 'array' => 1, 'deletefirst' => 1 ) );

//-------------------------------------------------------------
// Group Cache
//-------------------------------------------------------------

$ibforums->cache['group_cache'] = array();

$DB->simple_construct( array( 'select' => "*",
							  'from'   => 'groups'
					 )      );

$DB->simple_exec();

while ( $i = $DB->fetch_row() )
{
	$ibforums->cache['group_cache'][ $i['g_id'] ] = $i;
}

$std->update_cache( array( 'name' => 'group_cache', 'array' => 1, 'deletefirst' => 1 ) );

//-------------------------------------------------------------
// Systemvars
//-------------------------------------------------------------

$ibforums->cache['systemvars'] = array();

$result = $DB->simple_exec_query( array( 'select' => 'count(*) as cnt', 'from' => 'mail_queue' ) );

$ibforums->cache['systemvars']['mail_queue'] = intval( $result['cnt'] );
$ibforums->cache['systemvars']['task_next_run'] = time() + 3600;

$std->update_cache( array( 'name' => 'systemvars', 'array' => 1, 'deletefirst' => 1 ) );

//-------------------------------------------------------------
// Stats
//-------------------------------------------------------------

$ibforums->cache['stats'] = array();

$ibforums->cache['stats']['total_replies'] = 0;
$ibforums->cache['stats']['total_topics']  = 1;
$ibforums->cache['stats']['mem_count']     = 1;

$r = $DB->simple_exec_query( array( 'select' => 'id, name',
									'from'   => 'members',
									'order'  => 'id DESC',
									'limit'  => '0,1'
						   )      );

$ibforums->cache['stats']['last_mem_name'] = $r['name'];
$ibforums->cache['stats']['last_mem_id']   = $r['id'];

$std->update_cache( array( 'name' => 'stats', 'array' => 1, 'deletefirst' => 1 ) );

//-------------------------------------------------------------
// Ranks
//-------------------------------------------------------------

$ibforums->cache['ranks'] = array();

$DB->simple_construct( array( 'select' => 'id, title, pips, posts',
							  'from'   => 'titles',
							  'order'  => "posts DESC",
					)      );

$DB->simple_exec();

while ($i = $DB->fetch_row())
{
	$ibforums->cache['ranks'][ $i['id'] ] = array(
												  'TITLE' => $i['title'],
												  'PIPS'  => $i['pips'],
												  'POSTS' => $i['posts'],
												);
}

$std->update_cache( array( 'name' => 'ranks', 'array' => 1, 'deletefirst' => 1 ) );


//-------------------------------------------------------------
// SETTINGS
//-------------------------------------------------------------

$ibforums->cache['settings'] = array();

$DB->simple_construct( array( 'select' => '*', 'from' => 'conf_settings', 'where' => 'conf_add_cache=1' ) );
$info = $DB->simple_exec();

while ( $r = $DB->fetch_row($info) )
{
	$ibforums->cache['settings'][ $r['conf_key'] ] = $r['conf_value'] != "" ? $r['conf_value'] : $r['conf_default'];
}

$std->update_cache( array( 'name' => 'settings', 'array' => 1, 'deletefirst' => 1 ) );

//-------------------------------------------------------------
// EMOTICONS
//-------------------------------------------------------------

$ibforums->cache['emoticons'] = array();

$DB->simple_construct( array( 'select' => 'typed,image,clickable,emo_set', 'from' => 'emoticons' ) );
$DB->simple_exec();

while ( $r = $DB->fetch_row() )
{
	$ibforums->cache['emoticons'][] = $r;
}

$std->update_cache( array( 'name' => 'emoticons', 'array' => 1, 'deletefirst' => 1 ) );

//-------------------------------------------------------------
// LANGUAGES
//-------------------------------------------------------------

$ibforums->cache['languages'] = array();

$DB->simple_construct( array( 'select' => 'ldir,lname', 'from' => 'languages' ) );
$DB->simple_exec();

while ( $r = $DB->fetch_row() )
{
	$ibforums->cache['languages'][] = $r;
}

$std->update_cache( array( 'name' => 'languages', 'array' => 1, 'deletefirst' => 1 ) );

//-------------------------------------------------------------
// ATTACHMENT TYPES
//-------------------------------------------------------------

$ibforums->cache['attachtypes'] = array();

$DB->simple_construct( array( 'select' => 'atype_extension,atype_mimetype,atype_post,atype_photo,atype_img', 'from' => 'attachments_type', 'where' => "atype_photo=1 OR atype_post=1" ) );
$DB->simple_exec();

while ( $r = $DB->fetch_row() )
{
	$ibforums->cache['attachtypes'][ $r['atype_extension'] ] = $r;
}

$std->update_cache( array( 'name' => 'attachtypes', 'array' => 1, 'deletefirst' => 1 ) );


//-----------------------------------
// 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 );

	$template->print_top('Success!');

	$msg="Although the installer is now locked (to re-install, remove the file 'install.lock'), for added security, please remove the index.php program before continuing.
		 <br><br>
		 <center><b><a href='../index.php?act=Login&CODE=00'>CLICK HERE TO LOG IN!</a></center>";
}
else
{
	$template->print_top('Success!');

	$msg = "PLEASE REMOVE THE INSTALLER ('index.php') BEFORE CONTINUING!<br>Failure to do so will enable ANYONE to delete your board at any time!
			<br><br>
			<center><b><a href='../index.php?act=Login&CODE=00'>CLICK HERE TO LOG IN!</a></center>";
}

$template->contents .= "
<div class='centerbox'>
<div class='tableborder'>
<div class='maintitle'>Success</div>
<div class='tablepad'>
<b>The installation is now complete!</b>
<br><br>
$msg
</div>
</div>
</div>";

$template->output();



}


//+---------------------------------------
// Install the template files, woohoo and stuff
//+---------------------------------------


function do_templates()
{
global $std, $template, $root, $VARS, $HTTP_POST_VARS;

//-----------------------------------
// IMPORT $INFO!
//-----------------------------------

$require = ROOT_PATH."conf_global.php";

if ( ! file_exists($require) )
{
	install_error("Could not locate '$require'. You may need to enter a value for the root path in this installer script, to do this, simply open up this script in a text editor and enter a value in \$root - remember to add a trailing slash. NT users will need to use double backslashes");
}

include($require);

//-----------------------------------
// Attempt a DB connection..
//-----------------------------------

require ( KERNEL_PATH.'class_db_'.$INFO['sql_driver'].".php");

$DB = new db_driver();

$DB->obj['sql_database']     = $INFO['sql_database'];
$DB->obj['sql_user']         = $INFO['sql_user'];
$DB->obj['sql_pass']         = $INFO['sql_pass'];
$DB->obj['sql_host']         = $INFO['sql_host'];
$DB->obj['sql_tbl_prefix']   = $INFO['sql_tbl_prefix'];
$DB->obj['use_shutdown']     = 0;
   $DB->return_die				 = 1;

//-----------------------------------
// Required vars?
//-----------------------------------

if ( is_array( $DB->connect_vars ) and count( $DB->connect_vars ) )
{
	foreach( $DB->connect_vars as $k => $v )
	{
		$DB->connect_vars[ $k ] = $INFO[ $k ];
	}
}

if (! $DB->connect())
{
	install_error($DB->error);
}

define ( 'SQL_DRIVER', strtolower($INFO['sql_driver']) );
$ibforums->vars['sql_driver'] = SQL_DRIVER;

//-----------------------------------
// Get XML
//-----------------------------------

require_once( KERNEL_PATH.'class_xml.php' );

$xml = new class_xml();

//-----------------------------------
// 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("Error with ipb_templates.xml - could not process XML properly");
}

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();

	$db_string = $DB->compile_db_insert_string($newrow);
	$query = "INSERT INTO ".$INFO['sql_tbl_prefix']."skin_templates (" .$db_string['FIELD_NAMES']. ") VALUES (". $db_string['FIELD_VALUES'] .")";

	if ( ! $DB->query($query) )
	{
		install_error($query."<br /><br />".$DB->error);
	}
}

//-------------------------------
// GET MACRO
//-------------------------------

$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("Error with ipb_macro.xml - could not process XML properly");
}

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;

	$db_string = $DB->compile_db_insert_string($newrow);
	$query = "INSERT INTO ".$INFO['sql_tbl_prefix']."skin_macro (" .$db_string['FIELD_NAMES']. ") VALUES (". $db_string['FIELD_VALUES'] .")";

	if ( ! $DB->query($query) )
	{
		install_error($query."<br /><br />".$DB->error);
	}
}

//-------------------------------
// WRAPPER / CSS
//-------------------------------

require_once( THIS_ROOT_PATH.'installfiles/components.php' );

$wrapper_record = array( 'set_wrapper'	=>	$WRAPPER,
						 'set_css'		=>	$CSS,
					   );

$str = $DB->compile_db_update_string($wrapper_record);
$query = "UPDATE ".$INFO['sql_tbl_prefix']."skin_sets set ".$str." where set_skin_set_id=1";

if ( ! $DB->query($query) )
{
	install_error($query."<br /><br />".$DB->error);
}

//-------------------------------
// ARE WE DONE? REALLY? COOL!!
//-------------------------------

$template->print_top('Success!');

  	$template->contents .= "
<div class='centerbox'>
<div class='tableborder'>
<div class='maintitle'>Success</div>
<div class='tablepad'>
<b>Template files installed!</b>
<br><br>
The installation process is now complete.
<br>
Click the link below to clean up the installer and build the required caches
<br><br>
<center><b><a href='index.php?a=3'>CLICK HERE TO FINISH</a></center>
</div>
</div>
</div>";

$template->output();

}

//+---------------------------------------


function do_install()
{
global $std, $template, $VARS;

//-----------------------------------
// Ok, lets check for blankies...
//-----------------------------------

$DB = "";

$NEW_INFO = array();

$need = array('board_url','sql_host','sql_database','sql_user','adminname','adminpassword','adminpassword2','email');

foreach($need as $greed)
{
	if ($VARS[ $greed ] == "")
	{
		install_error("You must complete all of the form with the sole exception of 'SQL Table prefix'");
	}
}

//-----------------------------------
// Get converge
//-----------------------------------

require_once( KERNEL_PATH.'class_converge.php' );

$converge = new class_converge( $DB );

//-----------------------------------
// 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
//-----------------------------------

$VARS['board_url'] = preg_replace( "#/$#", "", $VARS['board_url'] );

if ($VARS['sql_tbl_prefix'] == "")
{
	$VARS['sql_tbl_prefix'] = 'ibf_';
}

$safe_mode = intval( $VARS['safe_mode'] );

//-----------------------------------
// Did the admin passy and passy2 match?
//-----------------------------------

if ($VARS['adminpassword2'] != $VARS['adminpassword'])
{
	install_error("Your passwords did not match");
}

//-----------------------------------
// Guess a 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'     => $VARS['sql_driver'],
			   'sql_host'       => $VARS['sql_host'],
			   'sql_database'   => $VARS['sql_database'],
			   'sql_user'       => $_POST['sql_user'],
			   'sql_pass'       => $_POST['sql_pass'],
			   'sql_tbl_prefix' => $VARS['sql_tbl_prefix'],
			   'sql_debug'      => 1,

			   'board_start'    => time(),
			   'installed'      => 1,

			   'php_ext'        => 'php',
			   'safe_mode'      => $safe_mode,

			   'board_url'      => $VARS['board_url'],

			   'admin_group'	=> '4',
			   'guest_group'    => '2',
			   'member_group'   => '3',
			   'auth_group'		=> '1',
			 );

//--------------------------------------------------
// Any "extra" configs required for this driver?
//--------------------------------------------------

if ( file_exists( THIS_ROOT_PATH.'sql/'.$VARS['sql_driver'].'_install.php' ) )
{
	require_once( THIS_ROOT_PATH.'sql/'.$VARS['sql_driver'].'_install.php' );

	$extra_install = new install_extra();

	$extra_install->install_form_process();

	if ( count( $extra_install->errors ) )
	{
		install_error( "The following error(s) occured when checking the SQL information:<br /><br />".implode( "<br />", $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");

$DB = new db_driver();

$DB->obj['sql_database']     = $INFO['sql_database'];
$DB->obj['sql_user']         = $INFO['sql_user'];
$DB->obj['sql_pass']         = $INFO['sql_pass'];
$DB->obj['sql_host']         = $INFO['sql_host'];
$DB->obj['sql_tbl_prefix']   = $INFO['sql_tbl_prefix'];
$DB->obj['query_cache_file'] = ROOT_PATH.'sources/sql/'.$INFO['sql_driver'].'_admin_queries.php';
$DB->obj['use_shutdown']     = 0;
   $DB->return_die				 = 1;

//-----------------------------------
// Required vars?
//-----------------------------------

if ( is_array( $DB->connect_vars ) and count( $DB->connect_vars ) )
{
	foreach( $DB->connect_vars as $k => $v )
	{
		$DB->connect_vars[ $k ] = $INFO[ $k ];
	}
}

//-----------------------------------
// Attempt a connect
//-----------------------------------

if ( ! $DB->connect() )
{
	install_error( "Connection error:<br /><br />".$DB->error );
}

define ( 'SQL_DRIVER', strtolower($INFO['sql_driver']) );
$ibforums->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("Could not write to '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])
   {
	   $DB->sql_drop_table( str_replace( 'ibf_', '', $match[1] ) );
   }

   if ($VARS['sql_tbl_prefix'] != "ibf_")
   {
	  $q = preg_replace("/ibf_(\S+?)([\s\.,]|$)/", $VARS['sql_tbl_prefix']."\\1\\2", $q);
   }

   if ( ! $DB->query($q) )
   {
	   install_error($q."<br /><br />".$DB->error);
   }
}

//-----------------------------------
// Create the fulltext index...
//-----------------------------------

if ( $DB->sql_can_fulltext() )
{
	 foreach( $INDEX as $q )
	 {
	 	if ($VARS['sql_tbl_prefix'] != "ibf_")
        {
           $q = preg_replace("/ibf_(\S+?)([\s\.,]|$)/", $VARS['sql_tbl_prefix']."\\1\\2", $q);
        }

        if ( ! $DB->query($q) )
        {
        	install_error($q."<br /><br />".$DB->error);
        }
	}
}

//-----------------------------------
// Populate tables...
//-----------------------------------

foreach( $INSERT as $q )
{
 	if ($VARS['sql_tbl_prefix'] != "ibf_")
       {
          $q = preg_replace("/ibf_(\S+?)([\s\.,]|$)/", $VARS['sql_tbl_prefix']."\\1\\2", $q);
       }

	$q = str_replace( "<%time%>", time(), $q );

       if ( ! $DB->query($q) )
       {
       	install_error($q."<br /><br />".$DB->error);
       }
}

//-----------------------------------
// Insert the admin...
//-----------------------------------

$md5_once = trim(md5($VARS['adminpassword']));

$salt     = $converge->generate_password_salt(5);

$key      = $converge->generate_auto_log_in_key();
$rpass    = $converge->generate_compiled_passhash($salt, $md5_once);

$salt     = str_replace( '\\', "\\\\", $salt );

$time     = time();

//$salt     = preg_replace( "/'/", "\\'", $salt );

//-----------------------------------
// Members...
//-----------------------------------

$member_record = array (	'id'				=>	1,
							'name'				=>	$VARS['adminname'],
							'mgroup'			=>	4,
							'email'				=>	$VARS['email'],
							'joined'			=>	$time,
							'ip_address'		=>	'127.0.0.1',
							'posts'				=>	0,
							'title'				=>	'Administrator',
							'last_visit'		=>	$time,
							'last_activity'		=>	$time,
							'member_login_key'	=>	$key,
						);
$db_string = $DB->compile_db_insert_string($member_record);
$query = "INSERT INTO ".$VARS['sql_tbl_prefix']."members (" .$db_string['FIELD_NAMES']. ") VALUES (". $db_string['FIELD_VALUES'] .")";

if ( ! $DB->query($query) )
{
	install_error($query."<br /><br />".$DB->error);
}

//-----------------------------------
// Converge...
//-----------------------------------

$converge_record = array	(	'converge_email'		=>	$VARS['email'],
								'converge_joined'		=>	$time,
								'converge_pass_hash'	=>	$rpass,
								'converge_pass_salt'	=>	$salt,
							);	
$db_string = $DB->compile_db_insert_string($converge_record);
$query = "INSERT INTO ".$VARS['sql_tbl_prefix']."members_converge (" .$db_string['FIELD_NAMES']. ") VALUES (". $db_string['FIELD_VALUES'] .")";

if ( ! $DB->query($query) )
{
	install_error($query."<br /><br />".$DB->error);
}

//-----------------------------------
// Member Extra...
//-----------------------------------

$member_extra_record = array	(	'id'		=>	1,
									'signature'	=>	'',
									'vdirs'		=>	'',
								);	
$db_string = $DB->compile_db_insert_string($member_extra_record);
$query = "INSERT INTO ".$VARS['sql_tbl_prefix']."member_extra (" .$db_string['FIELD_NAMES']. ") VALUES (". $db_string['FIELD_VALUES'] .")";

if ( ! $DB->query($query) )
{
	install_error($query."<br /><br />".$DB->error);
}

//-------------------------------
// Do we have a reg / copy key?
//-------------------------------

if ( file_exists( ROOT_PATH . '/retail/regkey.php' ) )
{
	require_once( ROOT_PATH . '/retail/regkey.php' );

	if ( $customer_reg_key == '1113973200-24242-171-44564-LIFE' )
	{
		$customer_reg_key = '';
	}
}

//-------------------------------
// Unpack the datafile
//-------------------------------

$xml->xml_parse_document( $setting_content );

//-------------------------------
// pArse
//-------------------------------

$fields = array( 'conf_title', 'conf_description', 'conf_group', 'conf_type', 'conf_key', 'conf_value', 'conf_default',
				 'conf_extra', 'conf_evalphp', 'conf_protected', 'conf_position', 'conf_start_group', 'conf_end_group',
				 'conf_help_key', 'conf_add_cache' );

$known = array(  'email_in'       => $VARS['email'],
				 'email_out'      => $VARS['email'],
				 'base_dir'       => $root,
				 'upload_dir'     => $root."uploads",
				 'upload_url'     => $VARS['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("Error with ipb_settings.xml - could not process XML properly");
}

foreach( $xml->xml_array['settingexport']['settinggroup']['setting'] as $id => $entry )
{
	if ( ! $entry['conf_key']['VALUE'] )
	{
		continue;
	}

	$newrow = array();

	$entry['conf_value']['VALUE'] = "";

	if ( in_array( $entry['conf_key']['VALUE'], array_keys( $known ) ) )
	{
		$entry['conf_value']['VALUE'] = $known[ $entry['conf_key']['VALUE'] ];
	}

	//-----------------------------------
	// Make PHP slashes safe
	//-----------------------------------

	$entry['conf_evalphp']['VALUE'] = str_replace( '\\', '\\\\', $entry['conf_evalphp']['VALUE'] );

	foreach( $fields as $f )
	{
		$newrow[$f] = $entry[ $f ]['VALUE'];
	}

	$db_string = $DB->compile_db_insert_string($newrow);
	$query = "INSERT INTO ".$VARS['sql_tbl_prefix']."conf_settings (" .$db_string['FIELD_NAMES']. ") VALUES (". $db_string['FIELD_VALUES'] .")";

	if ( ! $DB->query($query) )
	{
		install_error($query."<br /><br />".$DB->error);
	}
}

//-----------------------------------
// ARE WE DONE? REALLY? COOL!!
//-----------------------------------

$template->print_top('Success!');

$template->contents .= "
<div class='centerbox'>
<div class='tableborder'>
<div class='maintitle'>Success</div>
<div class='tablepad'>
<b>Your board has now been installed!</b>
<br><br>
The installation process is almost complete.
<br>
The next step will install the templates into your database
<br><br>
<center><b><a href='index.php?a=templates'>CLICK HERE TO CONTINUE</a></center>
</div>
</div>
</div>";

$template->output();
}



/*-------------------------------------------------------------------------*/
// SET UP FORM
/*-------------------------------------------------------------------------*/


function do_setup_form()
{
global $std, $template;

$template->print_top('Set Up form');

if ( ! is_dir(ROOT_PATH.'ips_kernel') )
{
	install_error("Cannot locate 'ips_kernel' directory. Please make sure you uploaded all the folders and files.");
}

//--------------------------------------------------
// DO WE HAVE A DB DRIVER SET?
//--------------------------------------------------

$VARS['sql_driver'] = ( $VARS['sql_driver'] == "" ) ? $_REQUEST['sql_driver'] : $VARS['sql_driver'];

if ( ! $VARS['sql_driver'] )
{
	//----------------------------------------------
	// Test to see how many DB driver's we've got..
	//----------------------------------------------

	$drivers = array();

	$dh = opendir( ROOT_PATH.'ips_kernel' ) or install_error("Cannot locate 'ips_kernel' directory for reading, please check all paths and permissions");

	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...
			//------------------------------------------

			$template->contents .= "<form action='index.php' method='POST'>
								<input type='hidden' name='a' value='1'>
								<div class='centerbox'>
								<div class='tableborder'>
								<div class='maintitle'>Multiple SQL Drivers Detected</div>
								<div class='pformstrip'>Please which SQL engine you wish to use with your Invision Power Board</div>
								<table width='100%' cellspacing='1'>
								<tr>
								  <td class='pformleftw'><b>SQL Driver</b><div class='description'>(Select the database engine you are using)</div></td>
								  <td class='pformright'><select name='sql_driver' id='textinput'>\n";

								  foreach ($drivers as $k => $v)
								  {
									  $selected            = ($v == "mysql") ? " selected='selected'" : "";
									  $template->contents .= "<option value='".$v."'".$selected.">".strtoupper($v)."</option>\n";
								  }

								  $template->contents .= "</select>
									</td>
								  </tr>
								  </table>
								  <div align='center' class='pformstrip'  style='text-align:center'><input type='image' src='img/install_proceed.gif'></div>
								  </div>
								  </div>
								  </form>";

		$template->output();

			exit();

		}
		else
		{
			//------------------------------------------
			// Use only driver installed
			//------------------------------------------

			$VARS['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);

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');
}

$template->contents .= "
<form action='index.php' method='POST'>
<input type='hidden' name='a' value='2'>
<input type='hidden' name='sql_driver' value='{$VARS['sql_driver']}'>
<div class='centerbox'>

<div class='tableborder'>
<div class='maintitle'>Your Server Environment</div>
<div class='pformstrip'>This section requires you to enter the paths and URL's for the board.</div>
<table width='100%' cellspacing='1'>
<tr>
  <td class='pformleftw'><b>IPB 'index.php' URL</b><div class='description'>This is the URL (must start with http://) to your main IPB directory<br />An example might be: <b>http://www.domain.com/forums</b></div></td>
  <td class='pformright'><input type='text' id='textinput' name='board_url' value='$this_url'></td>
</tr>";

if ( $safe_mode )
{
	$template->contents .= "
	<tr>
  	 <td class='pformleftw'><b>Safe Mode Detected</b><div class='description'>The installer has detected that your PHP is running with safe mode enabled. If you know this is not correct, please adjust the setting.</div></td>
  	 <td class='pformright'><select id='textinput' name='safe_mode'><option value='1' selected='selected'>Safe Mode Enabled</option><option value='0'>Safe Mode NOT Enabled</option></select></td>
	</tr>";
}

$template->contents .= "
</table>
</div>
<div class='fade'> </div>

<br />

<div class='tableborder'>
<div class='maintitle'>Your SQL Environment</div>
<div class='pformstrip'>This section requires you to enter your SQL information. If in doubt, please check with your webhost before asking for support. You may choose to enter an existing database name,if not - you must create a new database before continuing.</div>
<table width='100%' cellspacing='1'>
<tr>
  <td class='pformleftw'><b>SQL Driver</b></td>
  <td class='pformright'>You have chosen to use <b>".strtoupper($VARS['sql_driver'])."</b></td>
</tr>
<tr>
  <td class='pformleftw'><b>SQL Host</b><div class='description'>(localhost is usually sufficient)</div></td>
  <td class='pformright'><input type='text' id='textinput' name='sql_host' value='localhost'></td>
</tr>

<tr>
  <td class='pformleftw'><b>SQL Database Name</b></td>
  <td class='pformright'><input type='text' id='textinput' name='sql_database' value=''></td>
</tr>

<tr>
  <td class='pformleftw'><b>SQL Username</b></td>
  <td class='pformright'><input type='text' id='textinput' name='sql_user' value=''></td>
</tr>

<tr>
  <td class='pformleftw'><b>SQL Password</b></td>
  <td class='pformright'><input type='text' id='textinput' name='sql_pass' value=''></td>
</tr>
<!--{EXTRA.SQL}-->
<tr>
  <td class='pformleftw'><b>SQL Table Prefix</b><div class='description'>(You can leave this blank and IPB will use 'ibf_' as a default)</div></td>
  <td class='pformright'><input type='text' id='textinput' name='sql_tbl_prefix' value=''></td>
</tr>
</table>
</div>
<div class='fade'> </div>

<br />

<div class='tableborder'>
<div class='maintitle'>Your Admin Account</div>
<div class='pformstrip'>This section requires information to create your administration account. Please enter the data carefully!</div>
<table width='100%' cellspacing='1'>
<tr>
  <td class='pformleftw'><b>Username</b></td>
  <td class='pformright'><input type='text' id='textinput' name='adminname' value=''></td>
</tr>

<tr>
  <td class='pformleftw'><b>Password</b></td>
  <td class='pformright'><input type='text' id='textinput' name='adminpassword' value=''></td>
</tr>

<tr>
  <td class='pformleftw'><b>Re-type your password</b></td>
  <td class='pformright'><input type='text' id='textinput' name='adminpassword2' value=''></td>
</tr>

<tr>
  <td class='pformleftw'><b>Email Address</b></td>
  <td class='pformright'><input type='text' id='textinput' name='email' value=''></td>
</tr>
</table>
<div align='center' class='pformstrip'  style='text-align:center'><input type='image' src='img/install_proceed.gif'></div>
</div>
<div class='fade'> </div>
</div>
</form>";

//--------------------------------------------------
// Any "extra" configs required for this driver?
//--------------------------------------------------

if ( file_exists( THIS_ROOT_PATH.'sql/'.$VARS['sql_driver'].'_install.php' ) )
{
	require_once( THIS_ROOT_PATH.'sql/'.$VARS['sql_driver'].'_install.php' );
	$extra_install = new install_extra();

	$template->contents = str_replace( '<!--{EXTRA.SQL}-->', $extra_install->install_form_extra(), $template->contents );
}

$template->output();

}

//---------------------------------------

function do_intro()
{
global $std, $template, $root;

$template->print_top('Welcome');

$template->contents .= "<table width='80%' border='0' cellpadding='0' cellspacing='0' align='center'>
						<tr>
						 <td valign='top'><img src='img/install_face.jpg' border='0' alt='Intro'></td>
						 <td><img src='img/install_text.gif' border='0' alt='Welcome to IPB'>
						  <br /><br />
						   Before we go any further, please ensure that all the files have been uploaded, and that the 
						   file 'conf_global.php' has suitable permissions to allow this script to write to it ( 0666 should be sufficient ).
						   <br /><br />
						   <b>IPB ".IPBVERSION." requires PHP 4.1.0 or better and an SQL database.</b>
						   <br /><br />
						   You will also need the following information that your webhost can provide:
						   <ul>
						   <li>Your SQL database name</li>
						   <li>Your SQL username</li>
						   <li>Your SQL password</li>
						   <li>Your SQL host address (usually localhost)</li>
						   </ul>
						   <br />
						   Once you have clicked on proceed, you will be taken to a form to enter information the installer needs to set up your board.
						   <br><br>
						   <b>PLEASE NOTE: USING THIS INSTALLER WILL DELETE ANY CURRENT INVISION POWER BOARD DATABASE IF YOU ARE USING THE SAME TABLE PREFIX</b>
						   ";

//---------------------------------------			 
// 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",
					// KERNEL_PATH   ."class_db_".SQL_DRIVER.".php",
					 ROOT_PATH     ."conf_global.php",

				  );

$writeable  = array( ROOT_PATH."conf_global.php",
					 ROOT_PATH."skin_cache/"
				   );

foreach ( $checkfiles as $cf )
{
	if ( ! file_exists($cf) )
	{
		$warnings[] = "Cannot locate the file '$cf'.";
	}
}

foreach ( $writeable as $cf )
{
	if ( ! is_writeable($cf) )
	{
		$warnings[] = "Cannot write to the file '$cf'. Please CHMOD to 0777.";
	}
}

$phpversion = phpversion();

//----------------------------------
// CHECK BASICS
//----------------------------------

if ($phpversion < '4.1.0')
{
	$warnings[] = "<b>You cannot install Invision Power Board. Invision Power Board requires PHP Version 4.1.0 or better.</b>";
}

if ( ! function_exists('get_cfg_var') )
{
	$warnings[] = "<b>You cannot install Invision Power Board. Your PHP installation isn't sufficient to run IPB.</b>";
}

if ( ! function_exists('xml_parse_into_struct') )
{
	$warnings[] = "<b>You cannot install Invision Power Board. IPB requires that the XML functions in PHP are enabled, please ask your host to enable XML.</b>";
}

//----------------------------------
// Got error?
//----------------------------------

if ( count($warnings) > 0 )
{

	$err_string = '·'.implode( "<br /><br />·", $warnings );

	$template->contents .= "<br /><br />
						    <div class='warnbox'>
						     <strong>Warning!</strong>
						     <b>The following errors must be rectified before continuing!</b>
							 <br><br>
							 $err_string
						    </div>";
}
else
{
	$template->contents .= "<br /><br /><div align='center'><a href='index.php?a=1'><img src='img/install_proceed.gif' border='0' alt='proceed'></a></div>";
}

$template->contents .= " </td>
						  </tr>
						 </table>";

$template->output();
}



function install_error($msg="")
{
global $std, $template, $root;

$template->print_top('Warning!');



$template->contents .= "<div class='warnbox'>
					     <strong style='font-size:16px;color:#F00'>Warning!</strong>
					     <br /><br />
					     <b>The following errors must be rectified before continuing!</b><br>Please go back and try again!
					     <br><br>
					     $msg
					    </div>";



$template->output();
}

//+--------------------------------------------------------------------------
// CLASSES
//+--------------------------------------------------------------------------

class info
{
function info()
{
	global $INFO;

	$ibforums->vars = $INFO;
}
}

class template
{
var $contents = "";

function output()
{
	echo $this->contents;
	echo "   

			 <br><br><br><br><center><span id='copy'><a href='http://www.invisionboard.com'>Invision Power Board</a> © 2004 <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a></span></center>

			 </body>
			 </html>";
	exit();
}

//--------------------------------------

function print_top($title="")
{

	$this->contents = "<html>
	          <head><title>Invision Power Board Set Up :: $title </title>
	          <style type='text/css'>

	          	BODY		          	
	          	{
	          		font-size: 11px;
	          		font-family: Verdana, Arial;
	          		color: #000;
	          		margin: 0px;
	          		padding: 0px;
	          		background-image: url(img/fadebg.jpg);
	          		background-repeat: no-repeat;
	          		background-position: right bottom;
	          	}

	          	TABLE, TR, TD     { font-family:Verdana, Arial;font-size: 11px; color:#000 }

				a:link, a:visited, a:active  { color:#000055 }
				a:hover                      { color:#333377;text-decoration:underline }

				.centerbox { margin-right:10%;margin-left:10%;text-align:left }

				.warnbox {
						   border:1px solid #F00;
						   background: #FFE0E0;
						   padding:6px;
						   margin-right:10%;margin-left:10%;text-align:left;
						 }

				.tablepad    { background-color:#F5F9FD;padding:6px }
			    .description { color:gray;font-size:10px }
				.pformstrip { background-color: #D1DCEB; color:#3A4F6C;font-weight:bold;padding:7px;margin-top:1px;text-align:left }
				.pformleftw { background-color: #F5F9FD; padding:6px; margin-top:1px;width:50%; border-top:1px solid #C2CFDF; border-right:1px solid #C2CFDF; }
				.pformright { background-color: #F5F9FD; padding:6px; margin-top:1px;border-top:1px solid #C2CFDF; }

				.tableborder { border:1px solid #345487;background-color:#FFF; padding:0px; margin:0px; width:100% }

				.maintitle { text-align:left;vertical-align:middle;font-weight:bold; color:#FFF; letter-spacing:1px; padding:8px 0px 8px 5px; background-image: url(img/tile_back.gif) }
				.maintitle a:link, .maintitle  a:visited, .maintitle  a:active { text-decoration: none; color: #FFF }
				.maintitle a:hover { text-decoration: underline }

				#copy { font-size:10px }

				#button   { background-color: #4C77B6; color: #FFFFFF; font-family:Verdana, Arial; font-size:11px }

				#textinput { background-color: #EEEEEE; color:К#000000; font-family:Verdana, Arial; font-size:11px; width:100% }

				#dropdown { background-color: #EEEEEE; color:К#000000; font-family:Verdana, Arial; font-size:10px }

				#multitext { background-color: #EEEEEE; color:К#000000; font-family:Courier, Verdana, Arial; font-size:10px }

				#logostrip {
							 padding: 0px;
							 margin: 0px;
							 background: #7AA3D0;
						   }

				.fade					
				{
					background-image: url(img/fade.jpg);
					background-repeat: repeat-x;
				}

			  </style>
			  </head>
			 <body marginheight='0' marginwidth='0' leftmargin='0' topmargin='0' bgcolor='#FFFFFF'>

			 <div id='logostrip'><img src='img/title.gif' border='0' alt='Invision Power Board Installer' /></div>
			 <div class='fade'> </div>
			 <br />
			 ";

}
}



?>

ПОМОГИТЕ!!Что делать??

Ссылка на комментарий
Поделиться на других сайтах

Рекомендуемые сообщения

  • 0

Люди помогите пожалуйста,только все объясните,а то я в этих делах дуб-дубом!

Все установил,все данные правильно указал,создал админа.Но при входе на форум выдает ошибку:

Warning: require_once(../sources/functions.php) [function.require-once]: failed to open stream: No such file or directory in /home/tu2.ru/z/zo/zona/htdocs/www/index.php on line 68

Плизз помогите.Версия форума ipb v2.0.4.Хостинг бесплатный-hostland.su.

Ссылка на комментарий
Поделиться на других сайтах

Присоединиться к обсуждению

Вы можете ответить сейчас, а зарегистрироваться позже. Если у вас уже есть аккаунт, войдите, чтобы ответить от своего имени.

Гость
Ответить на вопрос...

×   Вы вставили отформатированный текст.   Удалить форматирование

  Допустимо не более 75 смайлов.

×   Ваша ссылка была автоматически заменена на медиа-контент.   Отображать как ссылку

×   Ваши публикации восстановлены.   Очистить редактор

×   Вы не можете вставить изображения напрямую. Загрузите или вставьте изображения по ссылке.

Зарузка...
×
×
  • Создать...

Важная информация

Находясь на нашем сайте, вы соглашаетесь на использование файлов cookie, а также с нашим положением о конфиденциальности Политика конфиденциальности и пользовательским соглашением Условия использования.