* enforced v7.1 compliance, preparations for v7.2
 * removed deprecated usage of each()
 * prefer array deconstruction via [] instead of calling list()
 * try to catch failed session_start()
 * prefer ... - Token instead of calling func_get_args() func_num_args()
 * enforce return types in AjaxHandler
 * revision push
This commit is contained in:
Sarjuuk
2018-11-27 00:43:32 +01:00
parent f8a34aa98e
commit d9cd24026c
46 changed files with 299 additions and 342 deletions

View File

@@ -29,7 +29,7 @@ class AreaTriggerPage extends GenericPage
$this->subject = new AreaTriggerList(array(['id', $this->typeId]));
if ($this->subject->error)
$this->notFound(Util::ucFirst(Lang::game('areatrigger')), Lang::areatriger('notFound'));
$this->notFound(Util::ucFirst(Lang::game('areatrigger')), Lang::areatrigger('notFound'));
$this->name = $this->subject->getField('name') ?: 'AT #'.$this->typeId;
}

View File

@@ -87,7 +87,7 @@ class CurrencyPage extends GenericPage
{
$this->extendGlobalData($lootTabs->jsGlobals);
foreach ($lootTabs->iterate() as list($file, $tabData))
foreach ($lootTabs->iterate() as [$file, $tabData])
$this->lvTabs[] = [$file, $tabData];
}

View File

@@ -355,7 +355,7 @@ class EventPage extends GenericPage
$this->saveCache($tt);
}
list($start, $end) = $this->postCache();
[$start, $end] = $this->postCache();
header('Content-type: application/x-javascript; charset=utf-8');
die(sprintf($tt, $start, $end));

View File

@@ -392,6 +392,7 @@ class GenericPage
if (!empty($this->hasComContent)) // get comments, screenshots, videos
{
$jsGlobals = [];
$this->community = CommunityContent::getAll($this->type, $this->typeId, $jsGlobals);
$this->extendGlobalData($jsGlobals); // as comments are not cached, those globals cant be either
$this->applyGlobals();
@@ -746,6 +747,9 @@ class GenericPage
public function extendGlobalData($data, $extra = null) // add jsGlobals or typeIds (can be mixed in one array: TYPE => [mixeddata]) to display on the page
{
if ($data === null)
throw new ErrorException('ffffuuuu.....!');
foreach ($data as $type => $globals)
{
if (!is_array($globals) || !$globals)
@@ -975,7 +979,7 @@ class GenericPage
if (substr_count($cache[0], ' ') < 2)
return false;
list($time, $rev, $type) = explode(' ', $cache[0]);
[$time, $rev, $type] = explode(' ', $cache[0]);
if ($time + CFG_CACHE_DECAY <= time() || $rev != AOWOW_REVISION)
$cache = null;

View File

@@ -450,7 +450,7 @@ class ItemPage extends genericPage
{
$this->extendGlobalData($lootTabs->jsGlobals);
foreach ($lootTabs->iterate() as $idx => list($file, $tabData))
foreach ($lootTabs->iterate() as $idx => [$file, $tabData])
{
if (!$tabData['data'])
continue;

View File

@@ -184,7 +184,7 @@ class MorePage extends GenericPage
'copper' => 0
);
foreach ($tabs as list($t, $tabId, $tabName))
foreach ($tabs as [$t, $tabId, $tabName])
{
// stuff received
$res = DB::Aowow()->select('

View File

@@ -385,7 +385,7 @@ class QuestPage extends GenericPage
$this->extendGlobalData($olItemData->getJSGlobals(GLOBALINFO_SELF));
$providedRequired = false;
foreach ($olItems as $i => list($itemId, $qty, $provided))
foreach ($olItems as $i => [$itemId, $qty, $provided])
{
if (!$i || !$itemId || !in_array($itemId, $olItemData->getFoundIDs()))
continue;
@@ -568,11 +568,11 @@ class QuestPage extends GenericPage
*/
$nSources = 0;
foreach ($lootTabs->iterate() as list($type, $data))
foreach ($lootTabs->iterate() as [$type, $data])
if ($type == 'creature' || $type == 'object')
$nSources += count(array_filter($data['data'], function($val) { return $val['percent'] >= 1.0; }));
foreach ($lootTabs->iterate() as $idx => list($file, $tabData))
foreach ($lootTabs->iterate() as $idx => [$file, $tabData])
{
if (!$tabData['data'])
continue;
@@ -653,7 +653,7 @@ class QuestPage extends GenericPage
// POI objectives
// also map olItems to objectiveIdx so every container gets the same pin color
foreach ($olItems as $i => list($itemId, $qty, $provided))
foreach ($olItems as $i => [$itemId, $qty, $provided])
{
if (!$provided && $itemId)
{

View File

@@ -171,7 +171,7 @@ class SearchPage extends GenericPage
if ($this->searchMask & SEARCH_TYPE_REGULAR)
{
$foundTotal = 0;
foreach ($this->lvTabs as list($file, $tabData, $_, $osInfo))
foreach ($this->lvTabs as [$file, $tabData, , $osInfo])
$foundTotal += count($tabData['data']);
if ($foundTotal == 1) // only one match -> redirect to find
@@ -300,13 +300,13 @@ class SearchPage extends GenericPage
[], [], [], [], [], [], []
);
foreach ($this->lvTabs as list($_, $_, $_, $osInfo))
foreach ($this->lvTabs as [ , , , $osInfo])
$foundTotal += $osInfo[2];
if (!$foundTotal || $asError)
return '["'.Util::jsEscape($this->search).'", []]';
foreach ($this->lvTabs as list($_, $tabData, $_, $osInfo))
foreach ($this->lvTabs as [ , $tabData, , $osInfo])
{
$max = max(1, intVal($limit * $osInfo[2] / $foundTotal));
$limit -= $max;

View File

@@ -264,7 +264,7 @@ class UtilityPage extends GenericPage
{
$item = $channel->addChild('item');
foreach ($row as $key => list($isCData, $attrib, $text))
foreach ($row as $key => [$isCData, $attrib, $text])
{
if ($isCData && $text)
$child = $item->addChild($key)->addCData($text);