Vergleich install/resources/upgrade5.php - 1.2.0 - 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: upgrade5.php 2187 2006-09-02 13:48:31Z chris $

 * $Id: upgrade5.php 2439 2006-11-26 14:00:13Z CraKteR $

 */

/**

 */

/**

Zeile 29Zeile 29
	$output->print_header("Performing Queries");

echo "<p>Performing necessary upgrade queries..</p>";

	$output->print_header("Performing Queries");

echo "<p>Performing necessary upgrade queries..</p>";

 
	

	$db->query("ALTER TABLE ".TABLE_PREFIX."users CHANGE avatartype avatartype varchar(10) NOT NULL;");

	$db->query("ALTER TABLE ".TABLE_PREFIX."users CHANGE avatartype avatartype varchar(10) NOT NULL;");

	$db->query("ALTER TABLE ".TABLE_PREFIX."users ADD totalpms int(10) NOT NULL default '0' AFTER showcodebuttons;");
$db->query("ALTER TABLE ".TABLE_PREFIX."users ADD newpms int(10) NOT NULL default '0' AFTER totalpms;");
$db->query("ALTER TABLE ".TABLE_PREFIX."users ADD unreadpms int(10) NOT NULL default '0' AFTER newpms;");
$db->query("ALTER TABLE ".TABLE_PREFIX."users ADD showredirect char(3) NOT NULL default '' AFTER showquickreply;");
$db->query("ALTER TABLE ".TABLE_PREFIX."users ADD avatardimensions varchar(10) NOT NULL default '' AFTER avatar;");
$db->query("ALTER TABLE ".TABLE_PREFIX."threads ADD unapprovedposts INT(10) unsigned NOT NULL default '0' AFTER visible;");
$db->query("ALTER TABLE ".TABLE_PREFIX."forums ADD unapprovedthreads INT(10) unsigned NOT NULL default '0' AFTER rules;");
$db->query("ALTER TABLE ".TABLE_PREFIX."forums ADD unapprovedposts INT(10) unsigned NOT NULL default '0' AFTER rules;");
$db->query("ALTER TABLE ".TABLE_PREFIX."forums ADD defaultdatecut smallint(4) unsigned NOT NULL default '0' AFTER unapprovedposts;");
$db->query("ALTER TABLE ".TABLE_PREFIX."forums ADD defaultsortby varchar(10) NOT NULL default '' AFTER defaultdatecut;");
$db->query("ALTER TABLE ".TABLE_PREFIX."forums ADD defaultsortorder varchar(4) NOT NULL default '' AFTER defaultsortby;");
$db->query("ALTER TABLE ".TABLE_PREFIX."forums ADD lastposteruid int(10) unsigned NOT NULL default '0' AFTER lastposter;");
$db->query("ALTER TABLE ".TABLE_PREFIX."forums ADD lastpostsubject varchar(120) NOT NULL default '' AFTER lastposttid");
$db->query("ALTER TABLE ".TABLE_PREFIX."threads ADD lastposteruid int unsigned NOT NULL default '0' AFTER lastposter");
$db->query("ALTER TABLE ".TABLE_PREFIX."groupleaders ADD canmanagemembers char(3) NOT NULL default '' AFTER uid;");
$db->query("ALTER TABLE ".TABLE_PREFIX."groupleaders ADD canmanagerequests char(3) NOT NULL default '' AFTER canmanagemembers;");
$db->query("ALTER TABLE ".TABLE_PREFIX."adminoptions ADD caneditlangs char(3) NOT NULL default '' AFTER canedithelp;");
$db->query("ALTER TABLE ".TABLE_PREFIX."adminoptions ADD canrundbtools char(3) NOT NULL default ''");
$db->query("ALTER TABLE ".TABLE_PREFIX."themes ADD allowedgroups text NOT NULL default '' AFTER extracss;");
$db->query("ALTER TABLE ".TABLE_PREFIX."moderators ADD canmovetononmodforum char(3) NOT NULL default '' AFTER canmanagethreads;");
$db->query("ALTER TABLE ".TABLE_PREFIX."themes ADD csscached bigint(30) NOT NULL default '0'");

$db->query("UPDATE ".TABLE_PREFIX."adminoptions SET caneditlangs='yes'");





















































































	if(!$db->field_exists('totalpms', TABLE_PREFIX."users"))
{
$db->query("ALTER TABLE ".TABLE_PREFIX."users ADD totalpms int(10) NOT NULL default '0' AFTER showcodebuttons;");
}

if(!$db->field_exists('newpms', TABLE_PREFIX."users"))
{
$db->query("ALTER TABLE ".TABLE_PREFIX."users ADD newpms int(10) NOT NULL default '0' AFTER totalpms;");
}

if(!$db->field_exists('unreadpms', TABLE_PREFIX."users"))
{
$db->query("ALTER TABLE ".TABLE_PREFIX."users ADD unreadpms int(10) NOT NULL default '0' AFTER newpms;");
}

if(!$db->field_exists('showredirect', TABLE_PREFIX."users"))
{
$db->query("ALTER TABLE ".TABLE_PREFIX."users ADD showredirect char(3) NOT NULL default '' AFTER showquickreply;");
}

if(!$db->field_exists('avatardimensions', TABLE_PREFIX."users"))
{
$db->query("ALTER TABLE ".TABLE_PREFIX."users ADD avatardimensions varchar(10) NOT NULL default '' AFTER avatar;");
}

if(!$db->field_exists('unapprovedposts', TABLE_PREFIX."threads"))
{
$db->query("ALTER TABLE ".TABLE_PREFIX."threads ADD unapprovedposts INT(10) unsigned NOT NULL default '0' AFTER visible;");
}

if(!$db->field_exists('unapprovedthreads', TABLE_PREFIX."forums"))
{
$db->query("ALTER TABLE ".TABLE_PREFIX."forums ADD unapprovedthreads INT(10) unsigned NOT NULL default '0' AFTER rules;");
}

if(!$db->field_exists('unapprovedposts', TABLE_PREFIX."forums"))
{
$db->query("ALTER TABLE ".TABLE_PREFIX."forums ADD unapprovedposts INT(10) unsigned NOT NULL default '0' AFTER rules;");
}

if(!$db->field_exists('defaultdatecut', TABLE_PREFIX."forums"))
{
$db->query("ALTER TABLE ".TABLE_PREFIX."forums ADD defaultdatecut smallint(4) unsigned NOT NULL default '0' AFTER unapprovedposts;");
}

if(!$db->field_exists('defaultsortby', TABLE_PREFIX."forums"))
{
$db->query("ALTER TABLE ".TABLE_PREFIX."forums ADD defaultsortby varchar(10) NOT NULL default '' AFTER defaultdatecut;");
}

if(!$db->field_exists('defaultsortorder', TABLE_PREFIX."forums"))
{
$db->query("ALTER TABLE ".TABLE_PREFIX."forums ADD defaultsortorder varchar(4) NOT NULL default '' AFTER defaultsortby;");
}

if(!$db->field_exists('lastposteruid', TABLE_PREFIX."forums"))
{
$db->query("ALTER TABLE ".TABLE_PREFIX."forums ADD lastposteruid int(10) unsigned NOT NULL default '0' AFTER lastposter;");
}

if(!$db->field_exists('lastpostsubject', TABLE_PREFIX."forums"))
{
$db->query("ALTER TABLE ".TABLE_PREFIX."forums ADD lastpostsubject varchar(120) NOT NULL default '' AFTER lastposttid");
}

if(!$db->field_exists('lastposteruid', TABLE_PREFIX."threads"))
{
$db->query("ALTER TABLE ".TABLE_PREFIX."threads ADD lastposteruid int unsigned NOT NULL default '0' AFTER lastposter");
}

if(!$db->field_exists('canmanagemembers', TABLE_PREFIX."groupleaders"))
{
$db->query("ALTER TABLE ".TABLE_PREFIX."groupleaders ADD canmanagemembers char(3) NOT NULL default '' AFTER uid;");
}

if(!$db->field_exists('canmanagerequests', TABLE_PREFIX."groupleaders"))
{
$db->query("ALTER TABLE ".TABLE_PREFIX."groupleaders ADD canmanagerequests char(3) NOT NULL default '' AFTER canmanagemembers;");
}

if(!$db->field_exists('caneditlangs', TABLE_PREFIX."adminoptions"))
{
$db->query("ALTER TABLE ".TABLE_PREFIX."adminoptions ADD caneditlangs char(3) NOT NULL default '' AFTER canedithelp;");
}

if(!$db->field_exists('canrundbtools', TABLE_PREFIX."adminoptions"))
{
$db->query("ALTER TABLE ".TABLE_PREFIX."adminoptions ADD canrundbtools char(3) NOT NULL default ''");
}

if(!$db->field_exists('allowedgroups', TABLE_PREFIX."themes"))
{
$db->query("ALTER TABLE ".TABLE_PREFIX."themes ADD allowedgroups text NOT NULL AFTER extracss;");
}

if(!$db->field_exists('canmovetononmodforum', TABLE_PREFIX."moderators"))
{
$db->query("ALTER TABLE ".TABLE_PREFIX."moderators ADD canmovetononmodforum char(3) NOT NULL default '' AFTER canmanagethreads;");
}

if(!$db->field_exists('csscached', TABLE_PREFIX."themes"))
{
$db->query("ALTER TABLE ".TABLE_PREFIX."themes ADD csscached bigint(30) NOT NULL default '0'");
}

$db->query("UPDATE ".TABLE_PREFIX."adminoptions SET caneditlangs='yes' WHERE canrunmaint='yes'");
$db->query("UPDATE ".TABLE_PREFIX."adminoptions SET caneditlangs='no' WHERE canrunmaint='no'");

	$db->query("UPDATE ".TABLE_PREFIX."adminoptions SET canrundbtools='yes' WHERE canrunmaint='yes'");
$db->query("UPDATE ".TABLE_PREFIX."adminoptions SET canrundbtools='no' WHERE canrunmaint='no'");
$db->query("UPDATE ".TABLE_PREFIX."settings SET optionscode='select\r\ninstant=Instant Activation\r\nverify=Send Email Verification\r\nrandompass=Send Random Password\r\nadmin=Administrator Activation' WHERE name = 'regtype'");
$db->query("UPDATE ".TABLE_PREFIX."users SET totalpms='-1', newpms='-1', unreadpms='-1'");
$db->query("UPDATE ".TABLE_PREFIX."settings SET name='maxmessagelength' WHERE name='messagelength'");

	$db->query("UPDATE ".TABLE_PREFIX."adminoptions SET canrundbtools='yes' WHERE canrunmaint='yes'");
$db->query("UPDATE ".TABLE_PREFIX."adminoptions SET canrundbtools='no' WHERE canrunmaint='no'");
$db->query("UPDATE ".TABLE_PREFIX."settings SET optionscode='select\r\ninstant=Instant Activation\r\nverify=Send Email Verification\r\nrandompass=Send Random Password\r\nadmin=Administrator Activation' WHERE name = 'regtype'");
$db->query("UPDATE ".TABLE_PREFIX."users SET totalpms='-1', newpms='-1', unreadpms='-1'");
$db->query("UPDATE ".TABLE_PREFIX."settings SET name='maxmessagelength' WHERE name='messagelength'");

	
$db->query("UPDATE ".TABLE_PREFIX."users SET language=''");
$db->query("UPDATE ".TABLE_PREFIX."settings SET value='english' WHERE name='cplanguage'");
$db->query("UPDATE ".TABLE_PREFIX."settings SET value='english' WHERE name='bblanguage'");

 

$db->query("DROP TABLE IF EXISTS ".TABLE_PREFIX."mycode");
$db->query("CREATE TABLE ".TABLE_PREFIX."mycode (
cid int unsigned NOT NULL auto_increment,
title varchar(100) NOT NULL default '',


$db->query("DROP TABLE IF EXISTS ".TABLE_PREFIX."mycode");
$db->query("CREATE TABLE ".TABLE_PREFIX."mycode (
cid int unsigned NOT NULL auto_increment,
title varchar(100) NOT NULL default '',

		    description text NOT NULL default '',
regex text NOT NULL default '',
replacement text NOT NULL default '',

		    description text NOT NULL,
regex text NOT NULL,
replacement text NOT NULL,

		    active char(3) NOT NULL default '',
PRIMARY KEY(cid)
) TYPE=MyISAM;");

		    active char(3) NOT NULL default '',
PRIMARY KEY(cid)
) TYPE=MyISAM;");

Zeile 115Zeile 196
		  uid int unsigned NOT NULL default '0',
dateline bigint(30) NOT NULL default '0',
ipaddress varchar(120) NOT NULL default '',

		  uid int unsigned NOT NULL default '0',
dateline bigint(30) NOT NULL default '0',
ipaddress varchar(120) NOT NULL default '',

		  threads text NOT NULL default '',
posts text NOT NULL default '',

		  threads text NOT NULL,
posts text NOT NULL,

		  searchtype varchar(10) NOT NULL default '',
resulttype varchar(10) NOT NULL default '',

		  searchtype varchar(10) NOT NULL default '',
resulttype varchar(10) NOT NULL default '',

		  querycache text NOT NULL default '',

		  querycache text NOT NULL,

		  PRIMARY KEY  (sid)
) TYPE=MyISAM;");


		  PRIMARY KEY  (sid)
) TYPE=MyISAM;");


Zeile 142Zeile 223
	$bannedips = $db->fetch_field($query, 'sid');
$bannedips = explode(" ", $bannedips);
$bannedips = implode(",", $bannedips);

	$bannedips = $db->fetch_field($query, 'sid');
$bannedips = explode(" ", $bannedips);
$bannedips = implode(",", $bannedips);

	$query = $db->query("UPDATE ".TABLE_PREFIX."settings SET value='".$db->escape_string($bannedips)."' WHERE name='bannedips'");

	$db->query("UPDATE ".TABLE_PREFIX."settings SET value='".$db->escape_string($bannedips)."' WHERE name='bannedips'");





	$query = $db->query("DROP TABLE ".TABLE_PREFIX."reputation");

	$db->query("DROP TABLE IF EXISTS ".TABLE_PREFIX."reputation");





	$query = $db->query("CREATE TABLE ".TABLE_PREFIX."reputation (

	$db->query("CREATE TABLE ".TABLE_PREFIX."reputation (

	  rid int unsigned NOT NULL auto_increment,
uid int unsigned NOT NULL default '0',
adduid int unsigned NOT NULL default '0',

	  rid int unsigned NOT NULL auto_increment,
uid int unsigned NOT NULL default '0',
adduid int unsigned NOT NULL default '0',

Zeile 156Zeile 237
      PRIMARY KEY(rid)
) TYPE=MyISAM;");


      PRIMARY KEY(rid)
) TYPE=MyISAM;");


	$query = $db->query("CREATE TABLE ".TABLE_PREFIX."mailqueue (


	$db->query("DROP TABLE IF EXISTS ".TABLE_PREFIX."mailqueue");
$db->query("CREATE TABLE ".TABLE_PREFIX."mailqueue (

		mid int unsigned NOT NULL auto_increment,
mailto varchar(200) NOT NULL,
mailfrom varchar(200) NOT NULL,

		mid int unsigned NOT NULL auto_increment,
mailto varchar(200) NOT NULL,
mailfrom varchar(200) NOT NULL,

Zeile 164Zeile 246
		message text NOT NULL,
headers text NOT NULL,
PRIMARY KEY(mid)

		message text NOT NULL,
headers text NOT NULL,
PRIMARY KEY(mid)

	) TYPE=MyISAM;");

$db->query("UPDATE ".TABLE_PREFIX."users SET reputation='0'");


	) TYPE=MyISAM;");

$db->query("UPDATE ".TABLE_PREFIX."users SET reputation='0'");


	$db->query("UPDATE ".TABLE_PREFIX."usergroups SET reputationpower='1'");
$db->query("UPDATE ".TABLE_PREFIX."usergroups SET reputationpower='2' WHERE cancp='yes'");


	$db->query("UPDATE ".TABLE_PREFIX."usergroups SET reputationpower='1'");
$db->query("UPDATE ".TABLE_PREFIX."usergroups SET reputationpower='2' WHERE cancp='yes'");


	$db->query("ALTER TABLE ".TABLE_PREFIX."users DROP rating;");

$db->query("ALTER TABLE ".TABLE_PREFIX."threads ADD attachmentcount int(10) unsigned NOT NULL default '0'");

$db->query("ALTER TABLE ".TABLE_PREFIX."posts ADD posthash varchar(32) NOT NULL default '' AFTER visible");











	if($db->field_exists('rating', TABLE_PREFIX."users"))
{
$db->query("ALTER TABLE ".TABLE_PREFIX."users DROP rating;");
}

if(!$db->field_exists('attachmentcount', TABLE_PREFIX."threads"))
{
$db->query("ALTER TABLE ".TABLE_PREFIX."threads ADD attachmentcount int(10) unsigned NOT NULL default '0'");
}

if(!$db->field_exists('posthash', TABLE_PREFIX."posts"))
{
$db->query("ALTER TABLE ".TABLE_PREFIX."posts ADD posthash varchar(32) NOT NULL default '' AFTER visible");
}


	$db->query("ALTER TABLE ".TABLE_PREFIX."attachtypes CHANGE extension extension varchar(10) NOT NULL;");

	$db->query("ALTER TABLE ".TABLE_PREFIX."attachtypes CHANGE extension extension varchar(10) NOT NULL;");


$db->query("ALTER TABLE ".TABLE_PREFIX."threads ADD deletetime int(10) unsigned NOT NULL default '0' AFTER attachmentcount");

$db->query("ALTER TABLE ".TABLE_PREFIX."sessions ADD loginattempts tinyint(2) NOT NULL default '1'");
$db->query("ALTER TABLE ".TABLE_PREFIX."sessions ADD failedlogin bigint(30) NOT NULL default '0'");


$db->query("ALTER TABLE ".TABLE_PREFIX."usergroups ADD canviewthreads char(3) NOT NULL default '' AFTER canview");
$db->query("ALTER TABLE ".TABLE_PREFIX."forumpermissions ADD canviewthreads char(3) NOT NULL default '' AFTER canview");

$db->query("DROP TABLE ".TABLE_PREFIX."regimages");

















	
if(!$db->field_exists('deletetime', TABLE_PREFIX."threads"))
{
$db->query("ALTER TABLE ".TABLE_PREFIX."threads ADD deletetime int(10) unsigned NOT NULL default '0' AFTER attachmentcount");
}

if(!$db->field_exists('loginattempts', TABLE_PREFIX."sessions"))
{
$db->query("ALTER TABLE ".TABLE_PREFIX."sessions ADD loginattempts tinyint(2) NOT NULL default '1'");
}

if(!$db->field_exists('failedlogin', TABLE_PREFIX."sessions"))
{
$db->query("ALTER TABLE ".TABLE_PREFIX."sessions ADD failedlogin bigint(30) NOT NULL default '0'");
}

if(!$db->field_exists('canviewthreads', TABLE_PREFIX."usergroups"))
{
$db->query("ALTER TABLE ".TABLE_PREFIX."usergroups ADD canviewthreads char(3) NOT NULL default '' AFTER canview");
}

if(!$db->field_exists('canviewthreads', TABLE_PREFIX."forumpermissions"))
{
$db->query("ALTER TABLE ".TABLE_PREFIX."forumpermissions ADD canviewthreads char(3) NOT NULL default '' AFTER canview");
}

$db->query("DROP TABLE IF EXISTS ".TABLE_PREFIX."captcha");

	$db->query("CREATE TABLE ".TABLE_PREFIX."captcha (
imagehash varchar(32) NOT NULL default '',
imagestring varchar(8) NOT NULL default '',
dateline bigint(30) NOT NULL default '0'
) TYPE=MyISAM;");


	$db->query("CREATE TABLE ".TABLE_PREFIX."captcha (
imagehash varchar(32) NOT NULL default '',
imagestring varchar(8) NOT NULL default '',
dateline bigint(30) NOT NULL default '0'
) TYPE=MyISAM;");


	$db->query("ALTER TABLE ".TABLE_PREFIX."moderatorlog ADD data text NOT NULL default '' AFTER action;");






	if(!$db->field_exists('data', TABLE_PREFIX."moderatorlog"))
{
$db->query("ALTER TABLE ".TABLE_PREFIX."moderatorlog ADD data text NOT NULL AFTER action;");
}

$db->query("DROP TABLE IF EXISTS ".TABLE_PREFIX."adminsessions");

	$db->query("CREATE TABLE ".TABLE_PREFIX."adminsessions (
sid varchar(32) NOT NULL default '',
uid int unsigned NOT NULL default '0',

	$db->query("CREATE TABLE ".TABLE_PREFIX."adminsessions (
sid varchar(32) NOT NULL default '',
uid int unsigned NOT NULL default '0',

Zeile 206Zeile 317
		lastactive bigint(30) NOT NULL default '0'
) TYPE=MyISAM;");


		lastactive bigint(30) NOT NULL default '0'
) TYPE=MyISAM;");


 
	$db->query("DROP TABLE IF EXISTS ".TABLE_PREFIX."modtools");

	$db->query("CREATE TABLE ".TABLE_PREFIX."modtools (
tid smallint unsigned NOT NULL auto_increment,
name varchar(200) NOT NULL,

	$db->query("CREATE TABLE ".TABLE_PREFIX."modtools (
tid smallint unsigned NOT NULL auto_increment,
name varchar(200) NOT NULL,

Zeile 217Zeile 329
	PRIMARY KEY (tid)
) TYPE=MyISAM;");


	PRIMARY KEY (tid)
) TYPE=MyISAM;");


	$db->query("ALTER TABLE ".TABLE_PREFIX."usergroups ADD disporder smallint(6) NOT NULL default '0' AFTER image");





	if(!$db->field_exists('disporder', TABLE_PREFIX."usergroups"))
{
$db->query("ALTER TABLE ".TABLE_PREFIX."usergroups ADD disporder smallint(6) NOT NULL default '0' AFTER image");
}


	$db->query("UPDATE ".TABLE_PREFIX."usergroups SET canviewthreads=canview");
$db->query("UPDATE ".TABLE_PREFIX."forumpermissions SET canviewthreads=canview");


	$db->query("UPDATE ".TABLE_PREFIX."usergroups SET canviewthreads=canview");
$db->query("UPDATE ".TABLE_PREFIX."forumpermissions SET canviewthreads=canview");


	echo "Done</p>";
echo "<p>Click next to continue with the upgrade process.</p>";

	$contents .= "Done</p>";
$contents .= "<p>Click next to continue with the upgrade process.</p>";

	$output->print_contents($contents);
$output->print_footer("5_redoconfig");
}

	$output->print_contents($contents);
$output->print_footer("5_redoconfig");
}

Zeile 256Zeile 372
		exit;
}


		exit;
}


	$fh = @fopen(MYBB_ROOT."/inc/config.php", "w");

	$fh = @fopen(MYBB_ROOT."inc/config.php", "w");

	if(!$fh)
{
echo "<p><span style=\"color: red; font-weight: bold;\">Unable to open inc/config.php</span><br />Before the upgrade process can continue, you need to changes the permissions of inc/config.php so it is writable.</p><input type=\"hidden\" name=\"uid\" value=\"{$uid}\" />";

	if(!$fh)
{
echo "<p><span style=\"color: red; font-weight: bold;\">Unable to open inc/config.php</span><br />Before the upgrade process can continue, you need to changes the permissions of inc/config.php so it is writable.</p><input type=\"hidden\" name=\"uid\" value=\"{$uid}\" />";

Zeile 275Zeile 391
	}
$configdata = "<?php
/**

	}
$configdata = "<?php
/**

 * Daatabase configuration

 * Database configuration

 */

\$config['dbtype'] = '{$config['dbtype']}';

 */

\$config['dbtype'] = '{$config['dbtype']}';

Zeile 284Zeile 400
\$config['password'] = '{$config['password']}';
\$config['database'] = '{$config['database']}';
\$config['table_prefix'] = '{$config['table_prefix']}';

\$config['password'] = '{$config['password']}';
\$config['database'] = '{$config['database']}';
\$config['table_prefix'] = '{$config['table_prefix']}';


/**


/**

 * Admin CP directory
* For security reasons, it is recommended you
* rename your Admin CP directory. You then need

 * Admin CP directory
* For security reasons, it is recommended you
* rename your Admin CP directory. You then need

Zeile 351Zeile 467
	}
else
{

	}
else
{

		$query = $db->simple_select(TABLE_PREFIX."threads", "COUNT(*) as num_threads");

		$query = $db->simple_select(TABLE_PREFIX."threads", "COUNT(*) as num_threads", "closed NOT LIKE 'moved|%'");

		$num_threads = $db->fetch_field($query, 'num_threads');
$tpp = intval($_POST['tpp']);
$start = intval($_POST['start']);
$end = $start+$tpp;

		$num_threads = $db->fetch_field($query, 'num_threads');
$tpp = intval($_POST['tpp']);
$start = intval($_POST['start']);
$end = $start+$tpp;

 
		if($end > $num_threads)
{
$end = $num_threads;
}

		echo "<p>Updating {$start} to {$end} of {$num_threads}...</p>";

		echo "<p>Updating {$start} to {$end} of {$num_threads}...</p>";

		$query = $db->simple_select(TABLE_PREFIX."threads", "tid, firstpost", "", array("order_by" => "tid", "order_dir" => "asc", "limit" => $tpp, "limit_start" => $start));

		$query = $db->simple_select(TABLE_PREFIX."threads", "tid, firstpost", "closed NOT LIKE 'moved|%'", array("order_by" => "tid", "order_dir" => "asc", "limit" => $tpp, "limit_start" => $start));

		while($thread = $db->fetch_array($query))
{
update_thread_count($thread['tid']);

		while($thread = $db->fetch_array($query))
{
update_thread_count($thread['tid']);