Skip to content
Permalink
Browse files

bugfixes for sql (if mysql extension misses, ignore the version check)

each() deprecated and replaced
also forestoutcomes alive=false will be writting to an integer value and provoke an error.
  • Loading branch information...
root
root committed Jan 13, 2019
1 parent d31c686 commit fce86544ec719f0d9d45a89a3063ffa49b39aa27
@@ -18,7 +18,7 @@
if (version_compare(PHP_VERSION, '5.0.0') < 0) {
$requirements_met=false;
$php_met=false;
} elseif (version_compare(mysql_get_client_info(), '5.0.3') < 0) {
} elseif (function_exists("mysql_get_client_info") && version_compare(mysql_get_client_info(), '5.0.3') < 0) {
$requirements_met=false;
$mysql_met=false;
}
@@ -27,7 +27,7 @@
//we have NO output object possibly :( hence no nice formatting
echo "<h1>Requirements not sufficient<br/><br/>";
if (!$php_met) echo sprintf("You need PHP5 to install this version. Please upgrade from your existing PHP version %s.<br/>",PHP_VERSION);
if (!$mysql_met) echo sprintf("You need Mysql 5.0 to install this version. Please upgrade from your existing Mysql version %s.<br/>",mysql_get_client_info());
if (!$mysql_met && function_exists("mysql_get_client_info")) echo sprintf("You need Mysql 5.0 to install this version. Please upgrade from your existing Mysql version %s.<br/>",mysql_get_client_info());
exit(1);
}
@@ -82,8 +82,11 @@ function db_error($link=false){
function db_fetch_assoc(&$result){
if (is_array($result)){
//cached data
if (list($key,$val)=each($result))
if (is_array($result)) {
$val = current($result);
next($result);
return $val;
}
else
return false;
}else{
@@ -82,8 +82,11 @@ function db_error(){
function db_fetch_assoc(&$result){
if (is_array($result)){
//cached data
if (list($key,$val)=each($result))
if (is_array($result)) {
$val = current($result);
next($result);
return $val;
}
else
return false;
}else{
@@ -83,8 +83,11 @@ function db_error(){
function db_fetch_assoc(&$result){
if (is_array($result)){
//cached data
if (list($key,$val)=each($result))
if (is_array($result)) {
$val = current($result);
next($result);
return $val;
}
else
return false;
}else{
@@ -9,7 +9,7 @@
function set_magic_quotes(&$vars) {
if (is_array($vars)) {
reset($vars);
while (list($key,$val) = each($vars))
foreach ($vars as $key=>$val)
set_magic_quotes($vars[$key]);
}else{
$vars = addslashes($vars);
@@ -158,7 +158,7 @@ function forestdefeat($enemies,$where="in the forest"){
} else {
addnews("%s",$deathmessage['deathmessage']);
}
$session['user']['alive']=false;
$session['user']['alive']=0;
debuglog("lost gold when they were slain $where",false,false,"forestlose",-$session['user']['gold']);
$session['user']['gold']=0;
$session['user']['hitpoints']=0;
@@ -914,44 +914,44 @@
"1.2.5 +nb Edition"=>array(),
"1.2.6 +n Edition"=>array(
//conversion lotgd tables to mysql 5.7 which is already in all_tables.php
"UPDATE ".db_prefix'accounts'." SET laston='1970-01-01 00:00:00' WHERE laston='0000-00-00 00:00:00'",
"UPDATE ".db_prefix'accounts'." SET lasthit='1970-01-01 00:00:00' WHERE lasthit='0000-00-00 00:00:00'",
"UPDATE ".db_prefix'accounts'." SET lastmotd='1970-01-01 00:00:00' WHERE lastmotd='0000-00-00 00:00:00'",
"UPDATE ".db_prefix'accounts'." SET pvpflag='1970-01-01 00:00:00' WHERE pvpflag='0000-00-00 00:00:00'",
"UPDATE ".db_prefix'accounts'." SET recentcomments='1970-01-01 00:00:00' WHERE recentcomments='0000-00-00 00:00:00'",
"UPDATE ".db_prefix'accounts'." SET biotime='1970-01-01 00:00:00' WHERE biotime='0000-00-00 00:00:00'",
"UPDATE ".db_prefix'accounts'." SET clanjoindate='1970-01-01 00:00:00' WHERE clanjoindate='0000-00-00 00:00:00'",
"UPDATE ".db_prefix'accounts'." SET regdate='1970-01-01 00:00:00' WHERE regdate='0000-00-00 00:00:00'",
"UPDATE ".db_prefix('accounts')." SET laston='1970-01-01 00:00:00' WHERE laston='0000-00-00 00:00:00'",
"UPDATE ".db_prefix('accounts')." SET lasthit='1970-01-01 00:00:00' WHERE lasthit='0000-00-00 00:00:00'",
"UPDATE ".db_prefix('accounts')." SET lastmotd='1970-01-01 00:00:00' WHERE lastmotd='0000-00-00 00:00:00'",
"UPDATE ".db_prefix('accounts')." SET pvpflag='1970-01-01 00:00:00' WHERE pvpflag='0000-00-00 00:00:00'",
"UPDATE ".db_prefix('accounts')." SET recentcomments='1970-01-01 00:00:00' WHERE recentcomments='0000-00-00 00:00:00'",
"UPDATE ".db_prefix('accounts')." SET biotime='1970-01-01 00:00:00' WHERE biotime='0000-00-00 00:00:00'",
"UPDATE ".db_prefix('accounts')." SET clanjoindate='1970-01-01 00:00:00' WHERE clanjoindate='0000-00-00 00:00:00'",
"UPDATE ".db_prefix('accounts')." SET regdate='1970-01-01 00:00:00' WHERE regdate='0000-00-00 00:00:00'",
"UPDATE ".db_prefix'paylog'." SET processdate='1970-01-01 00:00:00' WHERE processdate='0000-00-00 00:00:00'",
"UPDATE ".db_prefix'accounts'." SET lastmotd='1970-01-01 00:00:00' WHERE lastmotd='0000-00-00 00:00:00'",
"UPDATE ".db_prefix'accounts'." SET lastmotd='1970-01-01 00:00:00' WHERE lastmotd='0000-00-00 00:00:00'",
"UPDATE ".db_prefix('paylog')." SET processdate='1970-01-01 00:00:00' WHERE processdate='0000-00-00 00:00:00'",
"UPDATE ".db_prefix('accounts')." SET lastmotd='1970-01-01 00:00:00' WHERE lastmotd='0000-00-00 00:00:00'",
"UPDATE ".db_prefix('accounts')." SET lastmotd='1970-01-01 00:00:00' WHERE lastmotd='0000-00-00 00:00:00'",
"UPDATE ".db_prefix'bans'." SET banexpire='2159-01-01 00:00:00' WHERE banexpire='0000-00-00 00:00:00'",
"UPDATE ".db_prefix'bans'." SET lasthit='2159-01-01 00:00:00' WHERE lasthit='0000-00-00 00:00:00'",
"UPDATE ".db_prefix('bans')." SET banexpire='2159-01-01 00:00:00' WHERE banexpire='0000-00-00 00:00:00'",
"UPDATE ".db_prefix('bans')." SET lasthit='2159-01-01 00:00:00' WHERE lasthit='0000-00-00 00:00:00'",
"UPDATE ".db_prefix'commentary'." SET postdate='1970-01-01 00:00:00' WHERE postdate='0000-00-00 00:00:00'",
"UPDATE ".db_prefix('commentary')." SET postdate='1970-01-01 00:00:00' WHERE postdate='0000-00-00 00:00:00'",
"UPDATE ".db_prefix'debuglog'." SET date='1970-01-01 00:00:00' WHERE date='0000-00-00 00:00:00'",
"UPDATE ".db_prefix'debuglog_archive'." SET date='1970-01-01 00:00:00' WHERE date='0000-00-00 00:00:00'",
"UPDATE ".db_prefix('debuglog')." SET date='1970-01-01 00:00:00' WHERE date='0000-00-00 00:00:00'",
"UPDATE ".db_prefix('debuglog_archive')." SET date='1970-01-01 00:00:00' WHERE date='0000-00-00 00:00:00'",
"UPDATE ".db_prefix'faillog'." SET date='1970-01-01 00:00:00' WHERE date='0000-00-00 00:00:00'",
"UPDATE ".db_prefix'gamelog'." SET date='1970-01-01 00:00:00' WHERE date='0000-00-00 00:00:00'",
"UPDATE ".db_prefix('faillog')." SET date='1970-01-01 00:00:00' WHERE date='0000-00-00 00:00:00'",
"UPDATE ".db_prefix('gamelog')." SET date='1970-01-01 00:00:00' WHERE date='0000-00-00 00:00:00'",
"UPDATE ".db_prefix'logdnet'." SET lastupdate='1970-01-01 00:00:00' WHERE lastupdate='0000-00-00 00:00:00'",
"UPDATE ".db_prefix'logdnet'." SET lastping='1970-01-01 00:00:00' WHERE lastping='0000-00-00 00:00:00'",
"UPDATE ".db_prefix('logdnet')." SET lastupdate='1970-01-01 00:00:00' WHERE lastupdate='0000-00-00 00:00:00'",
"UPDATE ".db_prefix('logdnet')." SET lastping='1970-01-01 00:00:00' WHERE lastping='0000-00-00 00:00:00'",
"UPDATE ".db_prefix'mail'." SET sent='1970-01-01 00:00:00' WHERE sent='0000-00-00 00:00:00'",
"UPDATE ".db_prefix('mail')." SET sent='1970-01-01 00:00:00' WHERE sent='0000-00-00 00:00:00'",
"UPDATE ".db_prefix'moderatedcomments'." SET moddate='1970-01-01 00:00:00' WHERE moddate='0000-00-00 00:00:00'",
"UPDATE ".db_prefix('moderatedcomments')." SET moddate='1970-01-01 00:00:00' WHERE moddate='0000-00-00 00:00:00'",
"UPDATE ".db_prefix'modules'." SET installdate='1970-01-01 00:00:00' WHERE installdate='0000-00-00 00:00:00'",
"UPDATE ".db_prefix'modules'." SET filemoddate='1970-01-01 00:00:00' WHERE filemoddate='0000-00-00 00:00:00'",
"UPDATE ".db_prefix('modules')." SET installdate='1970-01-01 00:00:00' WHERE installdate='0000-00-00 00:00:00'",
"UPDATE ".db_prefix('modules')." SET filemoddate='1970-01-01 00:00:00' WHERE filemoddate='0000-00-00 00:00:00'",
"UPDATE ".db_prefix'news'." SET newsdate='1970-01-01 00:00:00' WHERE newsdate='0000-00-00 00:00:00'",
"UPDATE ".db_prefix('news')." SET newsdate='1970-01-01 00:00:00' WHERE newsdate='0000-00-00 00:00:00'",
"UPDATE ".db_prefix'petitions'." SET date='1970-01-01 00:00:00' WHERE date='0000-00-00 00:00:00'",
"UPDATE ".db_prefix'petitions'." SET closedate='1970-01-01 00:00:00' WHERE closedate='0000-00-00 00:00:00'",
"UPDATE ".db_prefix('petitions')." SET date='1970-01-01 00:00:00' WHERE date='0000-00-00 00:00:00'",
"UPDATE ".db_prefix('petitions')." SET closedate='1970-01-01 00:00:00' WHERE closedate='0000-00-00 00:00:00'",
),
);
?>

0 comments on commit fce8654

Please sign in to comment.
You can’t perform that action at this time.