Vergleich install/upgrade.php - 1.2.1 - 1.2.6

  Keine Änderungen   Hinzugefügt   Modifiziert   Entfernt
Zeile 6Zeile 6
 * Website: http://www.mybboard.com
* License: http://www.mybboard.com/eula.html
*

 * Website: http://www.mybboard.com
* License: http://www.mybboard.com/eula.html
*

 * $Id: upgrade.php 2282 2006-09-27 13:34:37Z chris $

 * $Id: upgrade.php 2801 2007-02-14 06:12:05Z chris $

 */
error_reporting(E_ALL & ~E_NOTICE);


 */
error_reporting(E_ALL & ~E_NOTICE);


define("MYBB_ROOT", dirname(dirname(__FILE__)));

define('MYBB_ROOT', dirname(dirname(__FILE__))."/");

define("INSTALL_ROOT", dirname(__FILE__));

define("INSTALL_ROOT", dirname(__FILE__));

 
define('IN_MYBB', 1);





require_once MYBB_ROOT."/inc/class_core.php";

require_once MYBB_ROOT."inc/class_core.php";

$mybb = new MyBB;

// Include the files necessary for installation

$mybb = new MyBB;

// Include the files necessary for installation

require_once MYBB_ROOT."/inc/class_timers.php";
require_once MYBB_ROOT."/inc/functions.php";
require_once MYBB_ROOT."/inc/class_xml.php";
require_once MYBB_ROOT."/inc/config.php";
require_once MYBB_ROOT."/inc/db_".$config['dbtype'].".php";
require_once MYBB_ROOT.'/inc/class_language.php';

require_once MYBB_ROOT."inc/class_timers.php";
require_once MYBB_ROOT."inc/functions.php";
require_once MYBB_ROOT."inc/class_xml.php";
require_once MYBB_ROOT."inc/config.php";
require_once MYBB_ROOT."inc/db_".$config['dbtype'].".php";
require_once MYBB_ROOT.'inc/class_language.php';

$lang = new MyLanguage();

$lang = new MyLanguage();

$lang->set_path('resources/');

$lang->set_path(MYBB_ROOT.'install/resources/');

$lang->load('language');

// If there's a custom admin dir, use it.

$lang->load('language');

// If there's a custom admin dir, use it.

Zeile 32Zeile 33
// Legacy for those boards trying to upgrade from an older version
if(isset($config['admindir']))
{

// Legacy for those boards trying to upgrade from an older version
if(isset($config['admindir']))
{

	require_once MYBB_ROOT."/".$config['admindir']."/adminfunctions.php";

	require_once MYBB_ROOT.$config['admindir']."/adminfunctions.php";

}
// Current
else if(isset($config['admin_dir']))
{

}
// Current
else if(isset($config['admin_dir']))
{

	require_once MYBB_ROOT."/".$config['admin_dir']."/adminfunctions.php";

	require_once MYBB_ROOT.$config['admin_dir']."/adminfunctions.php";

}
// No custom set
else
{

}
// No custom set
else
{

	require_once MYBB_ROOT."/admin/adminfunctions.php";

	require_once MYBB_ROOT."admin/adminfunctions.php";

}

// Include the necessary contants for installation

}

// Include the necessary contants for installation

Zeile 76Zeile 77
	{
if($db->table_exists(TABLE_PREFIX."datacache"))
{

	{
if($db->table_exists(TABLE_PREFIX."datacache"))
{

			require_once MYBB_ROOT."/inc/class_datacache.php";

			require_once MYBB_ROOT."inc/class_datacache.php";

			$cache = new datacache;
$plugins = $cache->read('plugins', true);
if(!empty($plugins['active']))

			$cache = new datacache;
$plugins = $cache->read('plugins', true);
if(!empty($plugins['active']))

Zeile 197Zeile 198
		  name varchar(100) NOT NULL default '',
pid smallint unsigned NOT NULL default '0',
def smallint(1) NOT NULL default '0',

		  name varchar(100) NOT NULL default '',
pid smallint unsigned NOT NULL default '0',
def smallint(1) NOT NULL default '0',

		  css text NOT NULL default '',
cssbits text NOT NULL default '',
themebits text NOT NULL default '',
extracss text NOT NULL default '',
allowedgroups text NOT NULL default '',

		  css text NOT NULL,
cssbits text NOT NULL,
themebits text NOT NULL,
extracss text NOT NULL,
allowedgroups text NOT NULL,

		  csscached bigint(30) NOT NULL default '0',
PRIMARY KEY (tid)
) TYPE=MyISAM;");

		  csscached bigint(30) NOT NULL default '0',
PRIMARY KEY (tid)
) TYPE=MyISAM;");

		$db->query("INSERT INTO ".TABLE_PREFIX."themes (name,pid) VALUES ('MyBB Master Style','0')");
$db->query("INSERT INTO ".TABLE_PREFIX."themes (name,pid,def) VALUES ('MyBB Default','1','1')");
























$insert_array = array(
'name' => 'MyBB Master Style',
'pid' => 0,
'css' => '',
'cssbits' => '',
'themebits' => '',
'extracss' => '',
'allowedgroups' => ''
);
$db->insert_query(TABLE_PREFIX."themes", $insert_array);

$insert_array = array(
'name' => 'MyBB Default',
'pid' => 1,
'def' => 1,
'css' => '',
'cssbits' => '',
'themebits' => '',
'extracss' => '',
'allowedgroups' => ''
);
$db->insert_query(TABLE_PREFIX."themes", $insert_array);


		$sid = $db->insert_id();
$db->query("UPDATE ".TABLE_PREFIX."users SET style='$sid'");
$db->query("UPDATE ".TABLE_PREFIX."forums SET style='0'");

		$sid = $db->insert_id();
$db->query("UPDATE ".TABLE_PREFIX."users SET style='$sid'");
$db->query("UPDATE ".TABLE_PREFIX."forums SET style='0'");

Zeile 243Zeile 266
		if($oldtemp['tid'])
{
$db->query("UPDATE ".TABLE_PREFIX."templates SET template='$templatevalue', version='$templateversion', dateline='$time' WHERE title='$templatename' AND sid='-2'");

		if($oldtemp['tid'])
{
$db->query("UPDATE ".TABLE_PREFIX."templates SET template='$templatevalue', version='$templateversion', dateline='$time' WHERE title='$templatename' AND sid='-2'");

		}
else
{

		}
else
{

			$db->query("INSERT INTO ".TABLE_PREFIX."templates (title,template,sid,version,status,dateline) VALUES ('$templatename','$templatevalue','$sid','$templateversion','','$time')");
$newcount++;
}

			$db->query("INSERT INTO ".TABLE_PREFIX."templates (title,template,sid,version,status,dateline) VALUES ('$templatename','$templatevalue','$sid','$templateversion','','$time')");
$newcount++;
}

Zeile 259Zeile 282
{
global $db, $output, $system_upgrade_detail, $lang;


{
global $db, $output, $system_upgrade_detail, $lang;


	if(!is_writable(MYBB_ROOT."/inc/settings.php"))

	if(!is_writable(MYBB_ROOT."inc/settings.php"))

	{
$output->print_header("Rebuilding Settings");
echo "<p><div class=\"error\"><span style=\"color: red; font-weight: bold;\">Error: Unable to open inc/settings.php</span><h3>Before the upgrade process can continue, you need to changes the permissions of inc/settings.php so it is writable.</h3></div></p>";

	{
$output->print_header("Rebuilding Settings");
echo "<p><div class=\"error\"><span style=\"color: red; font-weight: bold;\">Error: Unable to open inc/settings.php</span><h3>Before the upgrade process can continue, you need to changes the permissions of inc/settings.php so it is writable.</h3></div></p>";

Zeile 280Zeile 303
	$output->print_header($lang->upgrade_datacache_building);

$contents .= $lang->upgrade_building_datacache;

	$output->print_header($lang->upgrade_datacache_building);

$contents .= $lang->upgrade_building_datacache;

	require_once MYBB_ROOT."/inc/class_datacache.php";

	require_once MYBB_ROOT."inc/class_datacache.php";

	$cache = new datacache;
$cache->updateversion();
$cache->updateattachtypes();

	$cache = new datacache;
$cache->updateversion();
$cache->updateattachtypes();

Zeile 323Zeile 346
	}
$output->print_contents(sprintf($lang->upgrade_congrats, $mybb->version, $lock_note));
$output->print_footer();

	}
$output->print_contents(sprintf($lang->upgrade_congrats, $mybb->version, $lock_note));
$output->print_footer();

}


}


function whatsnext()
{
global $output, $db, $system_upgrade_detail, $lang;

function whatsnext()
{
global $output, $db, $system_upgrade_detail, $lang;

Zeile 334Zeile 357
		$output->print_header($lang->upgrade_template_reversion);
$output->print_contents($lang->upgrade_template_reversion_success);
$output->print_footer("templates");

		$output->print_header($lang->upgrade_template_reversion);
$output->print_contents($lang->upgrade_template_reversion_success);
$output->print_footer("templates");

	}

	}

	else
{
upgradethemes();

	else
{
upgradethemes();

Zeile 362Zeile 385
	if(!$function)
{
$function = "whatsnext";

	if(!$function)
{
$function = "whatsnext";

	}

	}

	return $function;
}


	return $function;
}


Zeile 385Zeile 408
}

function get_upgrade_store($title)

}

function get_upgrade_store($title)

{

{

	global $db;
$query = $db->query("SELECT * FROM ".TABLE_PREFIX."upgrade_data WHERE title='".$db->escape_string($title)."'");
$data = $db->fetch_array($query);

	global $db;
$query = $db->query("SELECT * FROM ".TABLE_PREFIX."upgrade_data WHERE title='".$db->escape_string($title)."'");
$data = $db->fetch_array($query);

Zeile 393Zeile 416
}

function add_upgrade_store($title, $contents)

}

function add_upgrade_store($title, $contents)

{
global $db;

{
global $db;

	$db->query("REPLACE INTO ".TABLE_PREFIX."upgrade_data (title,contents) VALUES ('".$db->escape_string($title)."', '".$db->escape_string(serialize($contents))."')");
}

function sync_settings($redo=0)

	$db->query("REPLACE INTO ".TABLE_PREFIX."upgrade_data (title,contents) VALUES ('".$db->escape_string($title)."', '".$db->escape_string(serialize($contents))."')");
}

function sync_settings($redo=0)

{
global $db;

{
global $db;

	
$settingcount = $groupcount = 0;
if($redo == 2)

	
$settingcount = $groupcount = 0;
if($redo == 2)

Zeile 410Zeile 433
		  gid smallint unsigned NOT NULL auto_increment,
name varchar(100) NOT NULL default '',
title varchar(220) NOT NULL default '',

		  gid smallint unsigned NOT NULL auto_increment,
name varchar(100) NOT NULL default '',
title varchar(220) NOT NULL default '',

		  description text NOT NULL default '',

		  description text NOT NULL,

		  disporder smallint unsigned NOT NULL default '0',
isdefault char(3) NOT NULL default '',
PRIMARY KEY (gid)

		  disporder smallint unsigned NOT NULL default '0',
isdefault char(3) NOT NULL default '',
PRIMARY KEY (gid)

Zeile 497Zeile 520
	}
if($redo >= 1)
{

	}
if($redo >= 1)
{

		require MYBB_ROOT."/inc/settings.php";

		require MYBB_ROOT."inc/settings.php";

		foreach($settings as $key => $val)
{
$db->update_query(TABLE_PREFIX."settings", array('value' => $db->escape_string($val)), "name='$key'");

		foreach($settings as $key => $val)
{
$db->update_query(TABLE_PREFIX."settings", array('value' => $db->escape_string($val)), "name='$key'");

Zeile 511Zeile 534
		$settings .= "\$settings['{$setting['name']}'] = \"".$setting['value']."\";\n";
}
$settings = "<?php\n/*********************************\ \n DO NOT EDIT THIS FILE, PLEASE USE\n THE SETTINGS EDITOR\n\*********************************/\n\n$settings\n?>";

		$settings .= "\$settings['{$setting['name']}'] = \"".$setting['value']."\";\n";
}
$settings = "<?php\n/*********************************\ \n DO NOT EDIT THIS FILE, PLEASE USE\n THE SETTINGS EDITOR\n\*********************************/\n\n$settings\n?>";

	$file = fopen(MYBB_ROOT."/inc/settings.php", "w");

	$file = fopen(MYBB_ROOT."inc/settings.php", "w");

	fwrite($file, $settings);
fclose($file);
return array($groupcount, $settingcount);

	fwrite($file, $settings);
fclose($file);
return array($groupcount, $settingcount);

Zeile 519Zeile 542

function write_settings()
{


function write_settings()
{

	global $db, $cwd;

	global $db;

	$query = $db->query('SELECT * FROM '.TABLE_PREFIX.'settings ORDER BY title ASC');
while($setting = $db->fetch_array($query))
{

	$query = $db->query('SELECT * FROM '.TABLE_PREFIX.'settings ORDER BY title ASC');
while($setting = $db->fetch_array($query))
{

Zeile 529Zeile 552
	if(!empty($settings))
{
$settings = "<?php\n/*********************************\ \n DO NOT EDIT THIS FILE, PLEASE USE\n THE SETTINGS EDITOR\n\*********************************/\n\n{$settings}\n?>";

	if(!empty($settings))
{
$settings = "<?php\n/*********************************\ \n DO NOT EDIT THIS FILE, PLEASE USE\n THE SETTINGS EDITOR\n\*********************************/\n\n{$settings}\n?>";

		$file = fopen(MYBB_ROOT."/inc/settings.php", "w");

		$file = fopen(MYBB_ROOT."inc/settings.php", "w");

		fwrite($file, $settings);
fclose($file);
}

		fwrite($file, $settings);
fclose($file);
}