AoWoW is now compatible with php7

(php7 is recommended but not required)
This commit is contained in:
Sarjuuk
2016-01-31 15:54:33 +01:00
parent 5abdbe2080
commit f076a30180
14 changed files with 34 additions and 34 deletions

View File

@@ -30,7 +30,7 @@ class DbSimple_Mysqli extends DbSimple_Database
* constructor(string $dsn)
* Connect to MySQL server.
*/
function DbSimple_Mysqli($dsn)
function __construct($dsn)
{
if (!is_callable("mysqli_connect"))
@@ -178,7 +178,7 @@ class DbSimple_Mysqli extends DbSimple_Database
protected function _performFetch($result)
{
$row = mysqli_fetch_assoc($result);
if (mysql_error()) return $this->_setDbError($this->_lastQuery);
if (mysqli_error($this->link)) return $this->_setDbError($this->_lastQuery);
if ($row === false) return null;
return $row;
}

View File

@@ -466,10 +466,10 @@ class AchievementPage extends GenericPage
die($tt);
}
public function notFound()
public function notFound($title = '', $msg = '')
{
if ($this->mode != CACHE_TYPE_TOOLTIP)
return parent::notFound(Lang::game('achievement'), Lang::achievement('notFound'));
return parent::notFound($title ?: Lang::game('achievement'), $msg ?: Lang::achievement('notFound'));
header('Content-type: application/x-javascript; charset=utf-8');
echo $this->generateTooltip(true);

View File

@@ -29,7 +29,7 @@ class CurrencyPage extends GenericPage
$this->subject = new CurrencyList(array(['id', $this->typeId]));
if ($this->subject->error)
$this->notFound(Lang::game('currency'), Lang::currency('notFound'));
$this->notFound();
$this->name = $this->subject->getField('name', true);
}
@@ -259,10 +259,10 @@ class CurrencyPage extends GenericPage
die($tt);
}
public function notFound()
public function notFound($title = '', $msg = '')
{
if ($this->mode != CACHE_TYPE_TOOLTIP)
return parent::notFound(Lang::game('currency'), Lang::currency('notFound'));
return parent::notFound($title ?: Lang::game('currency'), $msg ?: Lang::currency('notFound'));
header('Content-type: application/x-javascript; charset=utf-8');
echo $this->generateTooltip(true);

View File

@@ -32,7 +32,7 @@ class EventPage extends GenericPage
$this->subject = new WorldEventList(array(['id', $this->typeId]));
if ($this->subject->error)
$this->notFound(Lang::game('event'), Lang::event('notFound'));
$this->notFound();
$this->hId = $this->subject->getField('holidayId');
$this->eId = $this->typeId;
@@ -358,10 +358,10 @@ class EventPage extends GenericPage
die(sprintf($tt, $start, $end));
}
public function notFound()
public function notFound($title = '', $msg = '')
{
if ($this->mode != CACHE_TYPE_TOOLTIP)
return parent::notFound(Lang::game('event'), Lang::event('notFound'));
return parent::notFound($title ?: Lang::game('event'), $msg ?: Lang::event('notFound'));
header('Content-type: application/x-javascript; charset=utf-8');
echo $this->generateTooltip(true);

View File

@@ -1182,7 +1182,7 @@ class ItemPage extends genericPage
return parent::display($override);
}
public function notFound()
public function notFound($title = '', $msg = '')
{
if ($this->mode == CACHE_TYPE_TOOLTIP)
{
@@ -1197,7 +1197,7 @@ class ItemPage extends genericPage
exit();
}
else
return parent::notFound(Lang::game('item'), Lang::item('notFound'));
return parent::notFound($title ?: Lang::game('item'), $msg ?: Lang::item('notFound'));
}
}

View File

@@ -33,7 +33,7 @@ class ItemsetPage extends GenericPage
$this->subject = new ItemsetList(array(['id', $this->typeId]));
if ($this->subject->error)
$this->notFound(Lang::game('itemset'), Lang::itemset('notFound'));
$this->notFound();
$this->name = $this->subject->getField('name', true);
$this->extendGlobalData($this->subject->getJSGlobals());
@@ -260,10 +260,10 @@ class ItemsetPage extends GenericPage
die($tt);
}
public function notFound()
public function notFound($title = '', $msg = '')
{
if ($this->mode != CACHE_TYPE_TOOLTIP)
return parent::notFound(Lang::game('itemset'), Lang::itemset('notFound'));
return parent::notFound($title ?: Lang::game('itemset'), $msg ?: Lang::itemset('notFound'));
header('Content-type: application/x-javascript; charset=utf-8');
echo $this->generateTooltip(true);

View File

@@ -817,10 +817,10 @@ class NpcPage extends GenericPage
die($tt);
}
public function notFound()
public function notFound($title = '', $msg = '')
{
if ($this->mode != CACHE_TYPE_TOOLTIP)
return parent::notFound(Lang::game('npc'), Lang::npc('notFound'));
return parent::notFound($title ?: Lang::game('npc'), $msg ?: Lang::npc('notFound'));
header('Content-type: application/x-javascript; charset=utf-8');
echo $this->generateTooltip(true);

View File

@@ -498,10 +498,10 @@ class ObjectPage extends GenericPage
die($tt);
}
public function notFound()
public function notFound($title = '', $msg = '')
{
if ($this->mode != CACHE_TYPE_TOOLTIP)
return parent::notFound(Lang::game('object'), Lang::gameObject('notFound'));
return parent::notFound($title ?: Lang::game('object'), $msg ?: Lang::gameObject('notFound'));
header('Content-type: application/x-javascript; charset=utf-8');
echo $this->generateTooltip(true);

View File

@@ -122,10 +122,10 @@ class ProfilePage extends GenericPage
die($this->generateTooltip());
}
public function notFound()
public function notFound($title = '', $msg = '')
{
if ($this->mode != CACHE_TYPE_TOOLTIP)
return parent::notFound(Util::ucFirst(Lang::game('profile')), '[NNF]profile or char doesn\'t exist');
return parent::notFound($title ?: Util::ucFirst(Lang::game('profile')), $msg ?: '[NNF]profile or char doesn\'t exist');
header('Content-type: application/x-javascript; charset=utf-8');
echo $this->generateTooltip(true);

View File

@@ -696,10 +696,10 @@ class QuestPage extends GenericPage
die($tt);
}
public function notFound()
public function notFound($title = '', $msg = '')
{
if ($this->mode != CACHE_TYPE_TOOLTIP)
return parent::notFound(Lang::game('quest'), Lang::quest('notFound'));
return parent::notFound($title ?: Lang::game('quest'), $msg ?: Lang::quest('notFound'));
header('Content-type: application/x-javascript; charset=utf-8');
echo $this->generateTooltip(true);

View File

@@ -196,7 +196,7 @@ class SearchPage extends GenericPage
$this->performSearch();
}
public function notFound()
public function notFound($title = '', $msg = '')
{
if ($this->searchMask & SEARCH_TYPE_REGULAR)
{

View File

@@ -1211,10 +1211,10 @@ class SpellPage extends GenericPage
die($tt);
}
public function notFound()
public function notFound($title = '', $msg = '')
{
if ($this->mode != CACHE_TYPE_TOOLTIP)
return parent::notFound(Lang::game('spell'), Lang::spell('notFound'));
return parent::notFound($title ?: Lang::game('spell'), $msg ?: Lang::spell('notFound'));
header('Content-type: application/x-javascript; charset=utf-8');
echo $this->generateTooltip(true);

View File

@@ -110,7 +110,7 @@ function firstrun()
fclose($h);
};
$testDB = function(&$error)
function testDB(&$error)
{
require 'config/config.php';
@@ -133,9 +133,9 @@ function firstrun()
}
return empty($error);
};
}
$testSelf = function(&$error)
function testSelf(&$error)
{
$error = [];
$test = function($url, &$rCode)
@@ -171,13 +171,13 @@ function firstrun()
$error[] = ' * STATIC_HOST is empty';
return empty($error);
};
}
$testAcc = function(&$error)
function testAcc(&$error)
{
$error = [];
return !!DB::Aowow()->selectCell('SELECT id FROM ?_account WHERE userPerms = 1');
};
}
function endSetup()
{
@@ -243,7 +243,7 @@ function firstrun()
// check script result
if ($step[2])
{
if (!$$step[2]($errors))
if (!$step[2]($errors))
{
CLISetup::log($step[4], CLISetup::LOG_ERROR);
foreach ($errors as $e)

View File

@@ -210,7 +210,7 @@ class FileGen
// check for required auxiliary DBC files
foreach ($reqDBC as $req)
if (!CLISetup::loadDBC($req))
continue 2;
continue;
// must generate content
// PH format: /*setup:<setupFunc>*/