Core/Compat

* create namespace Aowow to avoid naming conflicts
 * inclues/libs/ is outside of the Aowow namespace
This commit is contained in:
Sarjuuk 2025-03-31 14:44:44 +02:00
parent 4ccf917707
commit 3a6c86092b
317 changed files with 898 additions and 243 deletions

View file

@ -1,5 +1,7 @@
<?php
namespace Aowow;
if (!defined('AOWOW_REVISION'))
die('illegal access');

View file

@ -1,5 +1,7 @@
<?php
namespace Aowow;
if (!defined('AOWOW_REVISION'))
die('illegal access');
@ -10,9 +12,9 @@ class AjaxAccount extends AjaxHandler
'groups' => ['filter' => FILTER_SANITIZE_NUMBER_INT],
'save' => ['filter' => FILTER_SANITIZE_NUMBER_INT],
'delete' => ['filter' => FILTER_SANITIZE_NUMBER_INT],
'id' => ['filter' => FILTER_CALLBACK, 'options' => 'AjaxHandler::checkIdList'],
'name' => ['filter' => FILTER_CALLBACK, 'options' => 'AjaxAccount::checkName' ],
'scale' => ['filter' => FILTER_CALLBACK, 'options' => 'AjaxAccount::checkScale' ],
'id' => ['filter' => FILTER_CALLBACK, 'options' => 'Aowow\AjaxHandler::checkIdList'],
'name' => ['filter' => FILTER_CALLBACK, 'options' => 'Aowow\AjaxAccount::checkName' ],
'scale' => ['filter' => FILTER_CALLBACK, 'options' => 'Aowow\AjaxAccount::checkScale' ],
'reset' => ['filter' => FILTER_SANITIZE_NUMBER_INT],
'mode' => ['filter' => FILTER_SANITIZE_NUMBER_INT],
'type' => ['filter' => FILTER_SANITIZE_NUMBER_INT],

View file

@ -1,5 +1,7 @@
<?php
namespace Aowow;
if (!defined('AOWOW_REVISION'))
die('illegal access');
@ -7,25 +9,25 @@ class AjaxAdmin extends AjaxHandler
{
protected $validParams = ['screenshots', 'siteconfig', 'weight-presets', 'spawn-override', 'guide', 'comment'];
protected $_get = array(
'action' => ['filter' => FILTER_CALLBACK, 'options' => 'AjaxHandler::checkTextLine' ],
'id' => ['filter' => FILTER_CALLBACK, 'options' => 'AjaxHandler::checkIdListUnsigned'],
'key' => ['filter' => FILTER_CALLBACK, 'options' => 'AjaxAdmin::checkKey' ],
'all' => ['filter' => FILTER_CALLBACK, 'options' => 'AjaxHandler::checkEmptySet' ],
'type' => ['filter' => FILTER_CALLBACK, 'options' => 'AjaxHandler::checkInt' ],
'typeid' => ['filter' => FILTER_CALLBACK, 'options' => 'AjaxHandler::checkInt' ],
'user' => ['filter' => FILTER_CALLBACK, 'options' => 'AjaxAdmin::checkUser' ],
'val' => ['filter' => FILTER_CALLBACK, 'options' => 'AjaxHandler::checkTextBlob' ],
'guid' => ['filter' => FILTER_CALLBACK, 'options' => 'AjaxHandler::checkInt' ],
'area' => ['filter' => FILTER_CALLBACK, 'options' => 'AjaxHandler::checkInt' ],
'floor' => ['filter' => FILTER_CALLBACK, 'options' => 'AjaxHandler::checkInt' ]
'action' => ['filter' => FILTER_CALLBACK, 'options' => 'Aowow\AjaxHandler::checkTextLine' ],
'id' => ['filter' => FILTER_CALLBACK, 'options' => 'Aowow\AjaxHandler::checkIdListUnsigned'],
'key' => ['filter' => FILTER_CALLBACK, 'options' => 'Aowow\AjaxAdmin::checkKey' ],
'all' => ['filter' => FILTER_CALLBACK, 'options' => 'Aowow\AjaxHandler::checkEmptySet' ],
'type' => ['filter' => FILTER_CALLBACK, 'options' => 'Aowow\AjaxHandler::checkInt' ],
'typeid' => ['filter' => FILTER_CALLBACK, 'options' => 'Aowow\AjaxHandler::checkInt' ],
'user' => ['filter' => FILTER_CALLBACK, 'options' => 'Aowow\AjaxAdmin::checkUser' ],
'val' => ['filter' => FILTER_CALLBACK, 'options' => 'Aowow\AjaxHandler::checkTextBlob' ],
'guid' => ['filter' => FILTER_CALLBACK, 'options' => 'Aowow\AjaxHandler::checkInt' ],
'area' => ['filter' => FILTER_CALLBACK, 'options' => 'Aowow\AjaxHandler::checkInt' ],
'floor' => ['filter' => FILTER_CALLBACK, 'options' => 'Aowow\AjaxHandler::checkInt' ]
);
protected $_post = array(
'alt' => ['filter' => FILTER_CALLBACK, 'options' => 'AjaxHandler::checkTextBlob'],
'id' => ['filter' => FILTER_CALLBACK, 'options' => 'AjaxHandler::checkInt' ],
'scale' => ['filter' => FILTER_CALLBACK, 'options' => 'AjaxAdmin::checkScale' ],
'__icon' => ['filter' => FILTER_CALLBACK, 'options' => 'AjaxAdmin::checkKey' ],
'status' => ['filter' => FILTER_CALLBACK, 'options' => 'AjaxHandler::checkInt' ],
'msg' => ['filter' => FILTER_CALLBACK, 'options' => 'AjaxHandler::checkTextBlob']
'alt' => ['filter' => FILTER_CALLBACK, 'options' => 'Aowow\AjaxHandler::checkTextBlob'],
'id' => ['filter' => FILTER_CALLBACK, 'options' => 'Aowow\AjaxHandler::checkInt' ],
'scale' => ['filter' => FILTER_CALLBACK, 'options' => 'Aowow\AjaxAdmin::checkScale' ],
'__icon' => ['filter' => FILTER_CALLBACK, 'options' => 'Aowow\AjaxAdmin::checkKey' ],
'status' => ['filter' => FILTER_CALLBACK, 'options' => 'Aowow\AjaxHandler::checkInt' ],
'msg' => ['filter' => FILTER_CALLBACK, 'options' => 'Aowow\AjaxHandler::checkTextBlob']
);
public function __construct(array $params)

View file

@ -1,5 +1,7 @@
<?php
namespace Aowow;
if (!defined('AOWOW_REVISION'))
die('illegal access');
@ -7,8 +9,8 @@ class AjaxArenaTeam extends AjaxHandler
{
protected $validParams = ['resync', 'status'];
protected $_get = array(
'id' => ['filter' => FILTER_CALLBACK, 'options' => 'AjaxHandler::checkIdList' ],
'profile' => ['filter' => FILTER_CALLBACK, 'options' => 'AjaxHandler::checkEmptySet'],
'id' => ['filter' => FILTER_CALLBACK, 'options' => 'Aowow\AjaxHandler::checkIdList' ],
'profile' => ['filter' => FILTER_CALLBACK, 'options' => 'Aowow\AjaxHandler::checkEmptySet'],
);
public function __construct(array $params)

View file

@ -1,5 +1,7 @@
<?php
namespace Aowow;
if (!defined('AOWOW_REVISION'))
die('illegal access');
@ -11,23 +13,23 @@ class AjaxComment extends AjaxHandler
const REPLY_LENGTH_MAX = 600;
protected $_post = array(
'id' => ['filter' => FILTER_CALLBACK, 'options' => 'AjaxHandler::checkIdListUnsigned'],
'body' => ['filter' => FILTER_CALLBACK, 'options' => 'AjaxHandler::checkTextBlob' ],
'commentbody' => ['filter' => FILTER_CALLBACK, 'options' => 'AjaxHandler::checkTextBlob' ],
'response' => ['filter' => FILTER_CALLBACK, 'options' => 'AjaxHandler::checkTextBlob' ],
'reason' => ['filter' => FILTER_CALLBACK, 'options' => 'AjaxHandler::checkTextBlob' ],
'remove' => ['filter' => FILTER_SANITIZE_NUMBER_INT ],
'commentId' => ['filter' => FILTER_SANITIZE_NUMBER_INT ],
'replyId' => ['filter' => FILTER_SANITIZE_NUMBER_INT ],
'sticky' => ['filter' => FILTER_SANITIZE_NUMBER_INT ],
// 'username' => ['filter' => FILTER_CALLBACK, 'options' => 'AjaxHandler::checkTextLine' ]
'id' => ['filter' => FILTER_CALLBACK, 'options' => 'Aowow\AjaxHandler::checkIdListUnsigned'],
'body' => ['filter' => FILTER_CALLBACK, 'options' => 'Aowow\AjaxHandler::checkTextBlob' ],
'commentbody' => ['filter' => FILTER_CALLBACK, 'options' => 'Aowow\AjaxHandler::checkTextBlob' ],
'response' => ['filter' => FILTER_CALLBACK, 'options' => 'Aowow\AjaxHandler::checkTextBlob' ],
'reason' => ['filter' => FILTER_CALLBACK, 'options' => 'Aowow\AjaxHandler::checkTextBlob' ],
'remove' => ['filter' => FILTER_SANITIZE_NUMBER_INT ],
'commentId' => ['filter' => FILTER_SANITIZE_NUMBER_INT ],
'replyId' => ['filter' => FILTER_SANITIZE_NUMBER_INT ],
'sticky' => ['filter' => FILTER_SANITIZE_NUMBER_INT ],
// 'username' => ['filter' => FILTER_CALLBACK, 'options' => 'Aowow\AjaxHandler::checkTextLine' ]
);
protected $_get = array(
'id' => ['filter' => FILTER_CALLBACK, 'options' => 'AjaxHandler::checkInt'],
'type' => ['filter' => FILTER_CALLBACK, 'options' => 'AjaxHandler::checkInt'],
'typeid' => ['filter' => FILTER_CALLBACK, 'options' => 'AjaxHandler::checkInt'],
'rating' => ['filter' => FILTER_SANITIZE_NUMBER_INT ]
'id' => ['filter' => FILTER_CALLBACK, 'options' => 'Aowow\AjaxHandler::checkInt'],
'type' => ['filter' => FILTER_CALLBACK, 'options' => 'Aowow\AjaxHandler::checkInt'],
'typeid' => ['filter' => FILTER_CALLBACK, 'options' => 'Aowow\AjaxHandler::checkInt'],
'rating' => ['filter' => FILTER_SANITIZE_NUMBER_INT ]
);
public function __construct(array $params)

View file

@ -1,20 +1,22 @@
<?php
namespace Aowow;
if (!defined('AOWOW_REVISION'))
die('illegal access');
class AjaxContactus extends AjaxHandler
{
protected $_post = array(
'mode' => ['filter' => FILTER_SANITIZE_NUMBER_INT ],
'reason' => ['filter' => FILTER_SANITIZE_NUMBER_INT ],
'ua' => ['filter' => FILTER_CALLBACK, 'options' => 'AjaxHandler::checkTextLine'],
'appname' => ['filter' => FILTER_CALLBACK, 'options' => 'AjaxHandler::checkTextLine'],
'page' => ['filter' => FILTER_SANITIZE_URL ],
'desc' => ['filter' => FILTER_CALLBACK, 'options' => 'AjaxHandler::checkTextBlob'],
'id' => ['filter' => FILTER_SANITIZE_NUMBER_INT ],
'relatedurl' => ['filter' => FILTER_SANITIZE_URL ],
'email' => ['filter' => FILTER_SANITIZE_EMAIL ]
'mode' => ['filter' => FILTER_SANITIZE_NUMBER_INT ],
'reason' => ['filter' => FILTER_SANITIZE_NUMBER_INT ],
'ua' => ['filter' => FILTER_CALLBACK, 'options' => 'Aowow\AjaxHandler::checkTextLine'],
'appname' => ['filter' => FILTER_CALLBACK, 'options' => 'Aowow\AjaxHandler::checkTextLine'],
'page' => ['filter' => FILTER_SANITIZE_URL ],
'desc' => ['filter' => FILTER_CALLBACK, 'options' => 'Aowow\AjaxHandler::checkTextBlob'],
'id' => ['filter' => FILTER_SANITIZE_NUMBER_INT ],
'relatedurl' => ['filter' => FILTER_SANITIZE_URL ],
'email' => ['filter' => FILTER_SANITIZE_EMAIL ]
);
public function __construct(array $params)

View file

@ -1,5 +1,7 @@
<?php
namespace Aowow;
if (!defined('AOWOW_REVISION'))
die('illegal access');
@ -12,7 +14,7 @@ class AjaxCookie extends AjaxHandler
return;
$this->_get = array(
$params[0] => ['filter' => FILTER_CALLBACK, 'options' => 'AjaxHandler::checkTextLine'],
$params[0] => ['filter' => FILTER_CALLBACK, 'options' => 'Aowow\AjaxHandler::checkTextLine'],
);
// NOW we know, what to expect and sanitize

View file

@ -1,17 +1,19 @@
<?php
namespace Aowow;
if (!defined('AOWOW_REVISION'))
die('illegal access');
class AjaxData extends AjaxHandler
{
protected $_get = array(
'locale' => ['filter' => FILTER_CALLBACK, 'options' => 'Locale::tryFrom' ],
't' => ['filter' => FILTER_CALLBACK, 'options' => 'AjaxHandler::checkTextLine'],
'catg' => ['filter' => FILTER_SANITIZE_NUMBER_INT ],
'skill' => ['filter' => FILTER_CALLBACK, 'options' => 'AjaxData::checkSkill' ],
'class' => ['filter' => FILTER_SANITIZE_NUMBER_INT ],
'callback' => ['filter' => FILTER_CALLBACK, 'options' => 'AjaxData::checkCallback' ]
'locale' => ['filter' => FILTER_CALLBACK, 'options' => 'Aowow\Locale::tryFrom' ],
't' => ['filter' => FILTER_CALLBACK, 'options' => 'Aowow\AjaxHandler::checkTextLine'],
'catg' => ['filter' => FILTER_SANITIZE_NUMBER_INT ],
'skill' => ['filter' => FILTER_CALLBACK, 'options' => 'Aowow\AjaxData::checkSkill' ],
'class' => ['filter' => FILTER_SANITIZE_NUMBER_INT ],
'callback' => ['filter' => FILTER_CALLBACK, 'options' => 'Aowow\AjaxData::checkCallback' ]
);
public function __construct(array $params)

View file

@ -1,13 +1,15 @@
<?php
namespace Aowow;
if (!defined('AOWOW_REVISION'))
die('illegal access');
class AjaxEdit extends AjaxHandler
{
protected $_get = array(
'qqfile' => ['filter' => FILTER_CALLBACK, 'options' => 'AjaxHandler::checkTextLine'],
'guide' => ['filter' => FILTER_SANITIZE_NUMBER_INT ]
'qqfile' => ['filter' => FILTER_CALLBACK, 'options' => 'Aowow\AjaxHandler::checkTextLine'],
'guide' => ['filter' => FILTER_SANITIZE_NUMBER_INT ]
);
public function __construct(array $params)
@ -41,12 +43,12 @@ class AjaxEdit extends AjaxHandler
$tmpPath = 'static/uploads/temp/';
$tmpFile = User::$displayName.'-'.Type::GUIDE.'-0-'.Util::createHash(16);
$uploader = new qqFileUploader(['jpg', 'jpeg', 'png'], 10 * 1024 * 1024);
$uploader = new \qqFileUploader(['jpg', 'jpeg', 'png'], 10 * 1024 * 1024);
$result = $uploader->handleUpload($tmpPath, $tmpFile, true);
if (isset($result['success']))
{
$finfo = new finfo(FILEINFO_MIME);
$finfo = new \finfo(FILEINFO_MIME);
$mime = $finfo->file($tmpPath.$result['newFilename']);
if (preg_match('/^image\/(png|jpe?g)/i', $mime, $m))
{

View file

@ -1,5 +1,7 @@
<?php
namespace Aowow;
if (!defined('AOWOW_REVISION'))
die('illegal access');

View file

@ -1,12 +1,14 @@
<?php
namespace Aowow;
if (!defined('AOWOW_REVISION'))
die('illegal access');
class AjaxGetdescription extends AjaxHandler
{
protected $_post = array(
'description' => [FILTER_CALLBACK, ['options' => 'AjaxHandler::checkTextBlob']]
'description' => [FILTER_CALLBACK, ['options' => 'Aowow\AjaxHandler::checkTextBlob']]
);
public function __construct(array $params)

View file

@ -1,12 +1,14 @@
<?php
namespace Aowow;
if (!defined('AOWOW_REVISION'))
die('illegal access');
class AjaxGotocomment extends AjaxHandler
{
protected $_get = array(
'id' => ['filter' => FILTER_CALLBACK, 'options' => 'AjaxHandler::checkInt']
'id' => ['filter' => FILTER_CALLBACK, 'options' => 'Aowow\AjaxHandler::checkInt']
);
public function __construct(array $params)

View file

@ -1,5 +1,7 @@
<?php
namespace Aowow;
if (!defined('AOWOW_REVISION'))
die('illegal access');

View file

@ -1,5 +1,7 @@
<?php
namespace Aowow;
if (!defined('AOWOW_REVISION'))
die('illegal access');
@ -7,8 +9,8 @@ class AjaxGuild extends AjaxHandler
{
protected $validParams = ['resync', 'status'];
protected $_get = array(
'id' => ['filter' => FILTER_CALLBACK, 'options' => 'AjaxHandler::checkIdList' ],
'profile' => ['filter' => FILTER_CALLBACK, 'options' => 'AjaxHandler::checkEmptySet'],
'id' => ['filter' => FILTER_CALLBACK, 'options' => 'Aowow\AjaxHandler::checkIdList' ],
'profile' => ['filter' => FILTER_CALLBACK, 'options' => 'Aowow\AjaxHandler::checkEmptySet'],
);
public function __construct(array $params)

View file

@ -1,12 +1,14 @@
<?php
namespace Aowow;
if (!defined('AOWOW_REVISION'))
die('illegal access');
class AjaxLocale extends AjaxHandler
{
protected $_get = array(
'locale' => ['filter' => FILTER_CALLBACK, 'options' => 'Locale::tryFrom']
'locale' => ['filter' => FILTER_CALLBACK, 'options' => 'Aowow\Locale::tryFrom']
);
public function __construct(array $params)

View file

@ -1,5 +1,7 @@
<?php
namespace Aowow;
if (!defined('AOWOW_REVISION'))
die('illegal access');
@ -9,16 +11,16 @@ class AjaxProfile extends AjaxHandler
protected $validParams = ['link', 'unlink', 'pin', 'unpin', 'public', 'private', 'avatar', 'resync', 'status', 'save', 'delete', 'purge', 'summary', 'load'];
protected $_get = array(
'id' => ['filter' => FILTER_CALLBACK, 'options' => 'AjaxHandler::checkIdList' ],
'items' => ['filter' => FILTER_CALLBACK, 'options' => 'AjaxProfile::checkItemList'],
'size' => ['filter' => FILTER_CALLBACK, 'options' => 'AjaxHandler::checkTextLine'],
'guild' => ['filter' => FILTER_CALLBACK, 'options' => 'AjaxHandler::checkEmptySet'],
'arena-team' => ['filter' => FILTER_CALLBACK, 'options' => 'AjaxHandler::checkEmptySet'],
'user' => ['filter' => FILTER_CALLBACK, 'options' => 'AjaxProfile::checkUser' ]
'id' => ['filter' => FILTER_CALLBACK, 'options' => 'Aowow\AjaxHandler::checkIdList' ],
'items' => ['filter' => FILTER_CALLBACK, 'options' => 'Aowow\AjaxProfile::checkItemList'],
'size' => ['filter' => FILTER_CALLBACK, 'options' => 'Aowow\AjaxHandler::checkTextLine'],
'guild' => ['filter' => FILTER_CALLBACK, 'options' => 'Aowow\AjaxHandler::checkEmptySet'],
'arena-team' => ['filter' => FILTER_CALLBACK, 'options' => 'Aowow\AjaxHandler::checkEmptySet'],
'user' => ['filter' => FILTER_CALLBACK, 'options' => 'Aowow\AjaxProfile::checkUser' ]
);
protected $_post = array(
'name' => ['filter' => FILTER_CALLBACK, 'options' => 'AjaxHandler::checkTextLine'],
'name' => ['filter' => FILTER_CALLBACK, 'options' => 'Aowow\AjaxHandler::checkTextLine'],
'level' => ['filter' => FILTER_SANITIZE_NUMBER_INT],
'class' => ['filter' => FILTER_SANITIZE_NUMBER_INT],
'race' => ['filter' => FILTER_SANITIZE_NUMBER_INT],
@ -28,17 +30,17 @@ class AjaxProfile extends AjaxHandler
'talenttree2' => ['filter' => FILTER_SANITIZE_NUMBER_INT],
'talenttree3' => ['filter' => FILTER_SANITIZE_NUMBER_INT],
'activespec' => ['filter' => FILTER_SANITIZE_NUMBER_INT],
'talentbuild1' => ['filter' => FILTER_CALLBACK, 'options' => 'AjaxProfile::checkTalentString'],
'glyphs1' => ['filter' => FILTER_CALLBACK, 'options' => 'AjaxProfile::checkGlyphString' ],
'talentbuild2' => ['filter' => FILTER_CALLBACK, 'options' => 'AjaxProfile::checkTalentString'],
'glyphs2' => ['filter' => FILTER_CALLBACK, 'options' => 'AjaxProfile::checkGlyphString' ],
'icon' => ['filter' => FILTER_CALLBACK, 'options' => 'AjaxHandler::checkTextLine' ],
'description' => ['filter' => FILTER_CALLBACK, 'options' => 'AjaxHandler::checkTextBlob' ],
'talentbuild1' => ['filter' => FILTER_CALLBACK, 'options' => 'Aowow\AjaxProfile::checkTalentString'],
'glyphs1' => ['filter' => FILTER_CALLBACK, 'options' => 'Aowow\AjaxProfile::checkGlyphString' ],
'talentbuild2' => ['filter' => FILTER_CALLBACK, 'options' => 'Aowow\AjaxProfile::checkTalentString'],
'glyphs2' => ['filter' => FILTER_CALLBACK, 'options' => 'Aowow\AjaxProfile::checkGlyphString' ],
'icon' => ['filter' => FILTER_CALLBACK, 'options' => 'Aowow\AjaxHandler::checkTextLine' ],
'description' => ['filter' => FILTER_CALLBACK, 'options' => 'Aowow\AjaxHandler::checkTextBlob' ],
'source' => ['filter' => FILTER_SANITIZE_NUMBER_INT],
'copy' => ['filter' => FILTER_SANITIZE_NUMBER_INT],
'public' => ['filter' => FILTER_SANITIZE_NUMBER_INT],
'gearscore' => ['filter' => FILTER_SANITIZE_NUMBER_INT],
'inv' => ['filter' => FILTER_CALLBACK, 'options' => 'AjaxHandler::checkIdListUnsigned', 'flags' => FILTER_REQUIRE_ARRAY],
'inv' => ['filter' => FILTER_CALLBACK, 'options' => 'Aowow\AjaxHandler::checkIdListUnsigned', 'flags' => FILTER_REQUIRE_ARRAY],
);
public function __construct(array $params)

View file

@ -1,5 +1,7 @@
<?php
namespace Aowow;
if (!defined('AOWOW_REVISION'))
die("illegal access");
@ -280,7 +282,7 @@ abstract class BaseType
// hackfix the inner items query to not contain duplicate column names
// yes i know the real solution would be to not have items and item_stats share column names
// soon™....
if (get_class($this) == 'ItemList')
if (get_class($this) == __NAMESPACE__.'\ItemList')
$totalQuery = str_replace([', `is`.*', ', i.id AS id'], '', $totalQuery);
$this->matches += DB::{$n}($dbIdx)->selectCell('SELECT COUNT(*) FROM ('.$totalQuery.') x');
@ -581,7 +583,7 @@ trait spawnHelper
private function createShortSpawns() // [zoneId, floor, [[x1, y1], [x2, y2], ..]] as tooltip2 if enabled by <a rel="map" ...> or anchor #map (one area, one floor, one creature, no survivors)
{
$this->spawnResult[SPAWNINFO_SHORT] = new StdClass;
$this->spawnResult[SPAWNINFO_SHORT] = new \StdClass;
// first get zone/floor with the most spawns
if ($res = DB::Aowow()->selectRow('SELECT `areaId`, `floor` FROM ?_spawns WHERE `type` = ?d AND `typeId` = ?d AND `posX` > 0 AND `posY` > 0 GROUP BY `areaId`, `floor` ORDER BY COUNT(1) DESC LIMIT 1', self::$type, $this->id))
@ -1023,7 +1025,7 @@ abstract class Filter
$cats[$idx] = $cat;
}
private function &criteriaIterator() : Generator
private function &criteriaIterator() : \Generator
{
if (!$this->fiData['c'])
return;

View file

@ -1,5 +1,7 @@
<?php
namespace Aowow;
if (!defined('AOWOW_REVISION'))
die('illegal access');

View file

@ -1,5 +1,7 @@
<?php
namespace Aowow;
if (!defined('AOWOW_REVISION'))
die('illegal access');

View file

@ -1,5 +1,7 @@
<?php
namespace Aowow;
if (!defined('AOWOW_REVISION'))
die('illegal access');
@ -558,7 +560,7 @@ class SmartAI
/* Structured Lisview Display */
/******************************/
private function &iterate() : Generator
private function &iterate() : \Generator
{
reset($this->rawData);

View file

@ -1,5 +1,7 @@
<?php
namespace Aowow;
if (!defined('AOWOW_REVISION'))
die('illegal access');

View file

@ -1,5 +1,7 @@
<?php
namespace Aowow;
if (!defined('AOWOW_REVISION'))
die('illegal access');

View file

@ -1,5 +1,7 @@
<?php
namespace Aowow;
if (!defined('AOWOW_REVISION'))
die('illegal access');

View file

@ -1,5 +1,7 @@
<?php
namespace Aowow;
if (!defined('AOWOW_REVISION'))
die('illegal access');
@ -83,7 +85,7 @@ class Cfg
if ($flags & self::FLAG_ON_LOAD_FN)
{
if (!method_exists('Cfg', $key))
if (!method_exists(__CLASS__, $key))
self::throwError('Aowow config '.strtoupper($key).' flagged for onLoadFN handling, but no handler was set');
else
self::{$key}($value);
@ -211,7 +213,7 @@ class Cfg
if ($flags & self::FLAG_ON_SET_FN)
{
$errMsg = '';
if (!method_exists('Cfg', $key))
if (!method_exists(__CLASS__, $key))
$errMsg = 'Aowow config '.strtoupper($key).' flagged for onSetFN validation, but no handler was set';
else
self::{$key}($value, $errMsg);
@ -228,7 +230,7 @@ class Cfg
if ($flags & self::FLAG_ON_LOAD_FN)
{
if (!method_exists('Cfg', $key))
if (!method_exists(__CLASS__, $key))
return 'Aowow config '.strtoupper($key).' flagged for onLoadFN handling, but no handler was set';
else
self::{$key}($value);
@ -266,7 +268,7 @@ class Cfg
if ($flags & self::FLAG_ON_SET_FN)
{
$errMsg = '';
if (!method_exists('Cfg', $key))
if (!method_exists(__CLASS__, $key))
$errMsg = 'required onSetFN validator not set';
else
self::{$key}($default, $errMsg);
@ -285,7 +287,7 @@ class Cfg
return self::handleFileBuild($key, $rebuildFiles);
}
public static function forCategory(int $category) : Generator
public static function forCategory(int $category) : \Generator
{
foreach (self::$store as $k => [, $flags, $catg, , ])
if ($catg == $category && !($flags & self::FLAG_INTERNAL))

View file

@ -1,5 +1,7 @@
<?php
namespace Aowow;
if (!defined('AOWOW_REVISION'))
die('illegal access');
@ -30,9 +32,9 @@ class DB
}
$options = &self::$optionsCache[$idx];
$interface = DbSimple_Generic::connect(self::createConnectSyntax($options));
$interface = \DbSimple_Generic::connect(self::createConnectSyntax($options));
$interface->setErrorHandler(['DB', 'errorHandler']);
$interface->setErrorHandler(self::errorHandler(...));
if ($options['prefix'])
$interface->setIdentPrefix($options['prefix']);

View file

@ -1,5 +1,7 @@
<?php
namespace Aowow;
if (!defined('AOWOW_REVISION'))
die('illegal access');

View file

@ -1,5 +1,7 @@
<?php
namespace Aowow;
if (!defined('AOWOW_REVISION'))
die('illegal access');
@ -163,7 +165,7 @@ class Game
switch (gettype($spell))
{
case 'object':
if (get_class($spell) != 'SpellList')
if (get_class($spell) != __NAMESPACE__.'\SpellList')
return [];
$lookup[] = $spell->id;

View file

@ -1,5 +1,7 @@
<?php
namespace Aowow;
mb_internal_encoding('UTF-8');
mysqli_report(MYSQLI_REPORT_ERROR);
@ -11,7 +13,7 @@ define('CLI_HAS_E', CLI && // WIN10 and later u
$reqExt = ['SimpleXML', 'gd', 'mysqli', 'mbstring', 'fileinfo'/*, 'gmp'*/];
$badExt = ['Intl']; // Intl contains its own class Locale. What? Namespaces? Never heard of those!
$badExt = [];
$error = '';
if ($ext = array_filter($reqExt, fn($x) => !extension_loaded($x)))
$error .= 'Required Extension <b>'.implode(', ', $ext)."</b> was not found. Please check if it should exist, using \"<i>php -m</i>\"\n\n";
@ -47,18 +49,18 @@ require_once 'pages/genericPage.class.php';
// TC systems
spl_autoload_register(function ($class)
{
switch($class)
switch ($class)
{
case 'SmartAI':
case 'SmartEvent':
case 'SmartAction':
case 'SmartTarget':
case __NAMESPACE__.'\SmartAI':
case __NAMESPACE__.'\SmartEvent':
case __NAMESPACE__.'\SmartAction':
case __NAMESPACE__.'\SmartTarget':
require_once 'includes/components/SmartAI/SmartAI.class.php';
require_once 'includes/components/SmartAI/SmartEvent.class.php';
require_once 'includes/components/SmartAI/SmartAction.class.php';
require_once 'includes/components/SmartAI/SmartTarget.class.php';
break;
case 'Conditions':
case __NAMESPACE__.'\Conditions':
require_once 'includes/components/Conditions/Conditions.class.php';
break;
}
@ -72,6 +74,9 @@ spl_autoload_register(function ($class)
if (class_exists($class)) // already registered
return;
if ($i = strrpos($class, '\\'))
$class = substr($class, $i + 1);
if (preg_match('/[^\w]/i', $class)) // name should contain only letters
return;
@ -90,7 +95,7 @@ spl_autoload_register(function ($class)
if (file_exists('includes/types/'.$cl.'.class.php'))
require_once 'includes/types/'.$cl.'.class.php';
else
throw new Exception('could not register type class: '.$cl);
throw new \Exception('could not register type class: '.$cl);
return;
}
@ -101,7 +106,7 @@ spl_autoload_register(function ($class)
if (file_exists('includes/ajaxHandler/'.strtr($class, ['ajax' => '']).'.class.php'))
require_once 'includes/ajaxHandler/'.strtr($class, ['ajax' => '']).'.class.php';
else
throw new Exception('could not register ajaxHandler class: '.$class);
throw new \Exception('could not register ajaxHandler class: '.$class);
return;
}
@ -220,7 +225,10 @@ if (!CLI)
{
// not displaying the brb gnomes as static_host is missing, but eh...
if (!DB::isConnected(DB_AOWOW) || !DB::isConnected(DB_WORLD) || !Cfg::get('HOST_URL') || !Cfg::get('STATIC_URL'))
{
Lang::load(Locale::EN);
(new GenericPage())->maintenance();
}
// Setup Session
$cacheDir = Cfg::get('SESSION_CACHE_DIR');
@ -247,15 +255,15 @@ if (!CLI)
// set up some logging (~10 queries will execute before we init the user and load the config)
if (Cfg::get('DEBUG') >= CLI::LOG_INFO && User::isInGroup(U_GROUP_DEV | U_GROUP_ADMIN))
{
DB::Aowow()->setLogger(['DB', 'profiler']);
DB::World()->setLogger(['DB', 'profiler']);
DB::Aowow()->setLogger(DB::profiler(...));
DB::World()->setLogger(DB::profiler(...));
if (DB::isConnected(DB_AUTH))
DB::Auth()->setLogger(['DB', 'profiler']);
DB::Auth()->setLogger(DB::profiler(...));
if (!empty($AoWoWconf['characters']))
foreach ($AoWoWconf['characters'] as $idx => $__)
if (DB::isConnected(DB_CHARACTERS . $idx))
DB::Characters($idx)->setLogger(['DB', 'profiler']);
DB::Characters($idx)->setLogger(DB::profiler(...));
}
// parse page-parameters .. sanitize before use!

View file

@ -1,5 +1,7 @@
<?php
namespace Aowow;
if (!defined('AOWOW_REVISION'))
die('illegal access');
@ -178,11 +180,11 @@ enum Locale : int
/* The shape of things to come */
class LocString
{
private WeakMap $store;
private \WeakMap $store;
public function __construct(array $data, string $key = 'name', ?callable $callback = null)
{
$this->store = new WeakMap();
$this->store = new \WeakMap();
$callback ??= fn($x) => $x;

View file

@ -1,5 +1,7 @@
<?php
namespace Aowow;
if (!defined('AOWOW_REVISION'))
die('illegal access');

View file

@ -1,5 +1,7 @@
<?php
namespace Aowow;
if (!defined('AOWOW_REVISION'))
die('illegal access');

View file

@ -1,5 +1,7 @@
<?php
namespace Aowow;
if (!defined('AOWOW_REVISION'))
die('illegal access');

View file

@ -1,5 +1,7 @@
<?php
namespace Aowow;
if (!defined('AOWOW_REVISION'))
die('illegal access');

View file

@ -1,5 +1,7 @@
<?php
namespace Aowow;
if (!defined('AOWOW_REVISION'))
die('illegal access');

View file

@ -1,5 +1,7 @@
<?php
namespace Aowow;
if (!defined('AOWOW_REVISION'))
die('illegal access');

View file

@ -1,5 +1,7 @@
<?php
namespace Aowow;
if (!defined('AOWOW_REVISION'))
die('illegal access');

View file

@ -1,5 +1,7 @@
<?php
namespace Aowow;
if (!defined('AOWOW_REVISION'))
die('illegal access');

View file

@ -1,5 +1,7 @@
<?php
namespace Aowow;
if (!defined('AOWOW_REVISION'))
die('illegal access');

View file

@ -1,5 +1,7 @@
<?php
namespace Aowow;
if (!defined('AOWOW_REVISION'))
die('illegal access');

View file

@ -1,5 +1,7 @@
<?php
namespace Aowow;
if (!defined('AOWOW_REVISION'))
die('illegal access');

View file

@ -1,5 +1,7 @@
<?php
namespace Aowow;
if (!defined('AOWOW_REVISION'))
die('illegal access');

View file

@ -1,5 +1,7 @@
<?php
namespace Aowow;
if (!defined('AOWOW_REVISION'))
die('illegal access');

View file

@ -1,5 +1,7 @@
<?php
namespace Aowow;
if (!defined('AOWOW_REVISION'))
die('illegal access');

View file

@ -1,5 +1,7 @@
<?php
namespace Aowow;
if (!defined('AOWOW_REVISION'))
die('illegal access');

View file

@ -1,5 +1,7 @@
<?php
namespace Aowow;
if (!defined('AOWOW_REVISION'))
die('illegal access');

View file

@ -1,5 +1,7 @@
<?php
namespace Aowow;
if (!defined('AOWOW_REVISION'))
die('illegal access');

View file

@ -1,5 +1,7 @@
<?php
namespace Aowow;
if (!defined('AOWOW_REVISION'))
die('illegal access');

View file

@ -1,5 +1,7 @@
<?php
namespace Aowow;
if (!defined('AOWOW_REVISION'))
die('illegal access');
@ -488,7 +490,7 @@ class ItemList extends BaseType
$extra[$id] = array(
'id' => $id,
'tooltip' => $this->renderTooltip(true),
'spells' => new StdClass // placeholder for knownSpells
'spells' => new \StdClass // placeholder for knownSpells
);
}
}

View file

@ -1,5 +1,7 @@
<?php
namespace Aowow;
if (!defined('AOWOW_REVISION'))
die('illegal access');

View file

@ -1,5 +1,7 @@
<?php
namespace Aowow;
if (!defined('AOWOW_REVISION'))
die('illegal access');

View file

@ -1,5 +1,7 @@
<?php
namespace Aowow;
if (!defined('AOWOW_REVISION'))
die('illegal access');

View file

@ -1,5 +1,7 @@
<?php
namespace Aowow;
if (!defined('AOWOW_REVISION'))
die('illegal access');

View file

@ -1,5 +1,7 @@
<?php
namespace Aowow;
if (!defined('AOWOW_REVISION'))
die('illegal access');

View file

@ -1,5 +1,7 @@
<?php
namespace Aowow;
if (!defined('AOWOW_REVISION'))
die('illegal access');

View file

@ -1,5 +1,7 @@
<?php
namespace Aowow;
if (!defined('AOWOW_REVISION'))
die('illegal access');

View file

@ -1,5 +1,7 @@
<?php
namespace Aowow;
if (!defined('AOWOW_REVISION'))
die('illegal access');

View file

@ -1,5 +1,7 @@
<?php
namespace Aowow;
if (!defined('AOWOW_REVISION'))
die('illegal access');

View file

@ -1,5 +1,7 @@
<?php
namespace Aowow;
if (!defined('AOWOW_REVISION'))
die('illegal access');

View file

@ -1,5 +1,7 @@
<?php
namespace Aowow;
if (!defined('AOWOW_REVISION'))
die('illegal access');

View file

@ -1,5 +1,7 @@
<?php
namespace Aowow;
if (!defined('AOWOW_REVISION'))
die('illegal access');

View file

@ -1,5 +1,7 @@
<?php
namespace Aowow;
if (!defined('AOWOW_REVISION'))
die('illegal access');
@ -281,14 +283,14 @@ class User
require 'config/extAuth.php';
if (!function_exists('extAuth'))
if (!function_exists('\extAuth'))
{
trigger_error('external auth function extAuth() not defined in config/extAuth.php');
return AUTH_INTERNAL_ERR;
}
$extGroup = -1;
$result = extAuth($name, $pass, $extId, $extGroup);
$result = \extAuth($name, $pass, $extId, $extGroup);
if ($result == AUTH_OK && $extId)
{
@ -543,7 +545,7 @@ class User
$gUser['upvoteRep'] = Cfg::get('REP_REQ_UPVOTE');
$gUser['characters'] = self::getCharacters();
$gUser['excludegroups'] = self::$excludeGroups;
$gUser['settings'] = (new StdClass); // profiler requires this to be set; has property premiumborder (NYI)
$gUser['settings'] = (new \StdClass); // profiler requires this to be set; has property premiumborder (NYI)
if (Cfg::get('DEBUG') && User::isInGroup(U_GROUP_DEV | U_GROUP_ADMIN | U_GROUP_TESTER))
$gUser['debug'] = true; // csv id-list output option on listviews

View file

@ -1,12 +1,14 @@
<?php
namespace Aowow;
if (!defined('AOWOW_REVISION'))
die('illegal access');
class SimpleXML extends SimpleXMLElement
class SimpleXML extends \SimpleXMLElement
{
public function addCData(string $cData) : SimpleXMLElement
public function addCData(string $cData) : \SimpleXMLElement
{
$node = dom_import_simplexml($this);
$no = $node->ownerDocument;
@ -23,7 +25,7 @@ trait TrRequestData
public const PATTERN_TEXT_BLOB = '/[\x00-\x09\x0B-\x1F\p{Cf}\p{Co}\p{Cs}\p{Cn}]/ui';
protected $_get = []; // fill with variables you that are going to be used; eg:
protected $_post = []; // 'id' => ['filter' => FILTER_CALLBACK, 'options' => 'AjaxHandler::checkIdList']
protected $_post = []; // 'id' => ['filter' => FILTER_CALLBACK, 'options' => 'Aowow\AjaxHandler::checkIdList']
protected $_cookie = [];
private $filtered = false;
@ -1702,35 +1704,35 @@ abstract class Type
public const IDX_JSG_TPL = 2;
public const IDX_FLAGS = 3;
private static /* array */ $data = array(
self::NPC => ['CreatureList', 'npc', 'g_npcs', 0x1],
self::OBJECT => ['GameObjectList', 'object', 'g_objects', 0x1],
self::ITEM => ['ItemList', 'item', 'g_items', 0x1],
self::ITEMSET => ['ItemsetList', 'itemset', 'g_itemsets', 0x1],
self::QUEST => ['QuestList', 'quest', 'g_quests', 0x1],
self::SPELL => ['SpellList', 'spell', 'g_spells', 0x1],
self::ZONE => ['ZoneList', 'zone', 'g_gatheredzones', 0x1],
self::FACTION => ['FactionList', 'faction', 'g_factions', 0x1],
self::PET => ['PetList', 'pet', 'g_pets', 0x1],
self::ACHIEVEMENT => ['AchievementList', 'achievement', 'g_achievements', 0x1],
self::TITLE => ['TitleList', 'title', 'g_titles', 0x1],
self::WORLDEVENT => ['WorldEventList', 'event', 'g_holidays', 0x1],
self::CHR_CLASS => ['CharClassList', 'class', 'g_classes', 0x1],
self::CHR_RACE => ['CharRaceList', 'race', 'g_races', 0x1],
self::SKILL => ['SkillList', 'skill', 'g_skills', 0x1],
self::STATISTIC => ['AchievementList', 'achievement', 'g_achievements', 0x0], // alias for achievements; exists only for Markup
self::CURRENCY => ['CurrencyList', 'currency', 'g_gatheredcurrencies',0x1],
self::SOUND => ['SoundList', 'sound', 'g_sounds', 0x1],
self::ICON => ['IconList', 'icon', 'g_icons', 0x1],
self::GUIDE => ['GuideList', 'guide', '', 0x0],
self::PROFILE => ['ProfileList', '', '', 0x0], // x - not known in javascript
self::GUILD => ['GuildList', '', '', 0x0], // x
self::ARENA_TEAM => ['ArenaTeamList', '', '', 0x0], // x
self::USER => ['UserList', 'user', 'g_users', 0x0], // x
self::EMOTE => ['EmoteList', 'emote', 'g_emotes', 0x1],
self::ENCHANTMENT => ['EnchantmentList', 'enchantment', 'g_enchantments', 0x1],
self::AREATRIGGER => ['AreatriggerList', 'areatrigger', '', 0x0],
self::MAIL => ['MailList', 'mail', '', 0x1]
private static array $data = array(
self::NPC => [__NAMESPACE__ . '\CreatureList', 'npc', 'g_npcs', 0x1],
self::OBJECT => [__NAMESPACE__ . '\GameObjectList', 'object', 'g_objects', 0x1],
self::ITEM => [__NAMESPACE__ . '\ItemList', 'item', 'g_items', 0x1],
self::ITEMSET => [__NAMESPACE__ . '\ItemsetList', 'itemset', 'g_itemsets', 0x1],
self::QUEST => [__NAMESPACE__ . '\QuestList', 'quest', 'g_quests', 0x1],
self::SPELL => [__NAMESPACE__ . '\SpellList', 'spell', 'g_spells', 0x1],
self::ZONE => [__NAMESPACE__ . '\ZoneList', 'zone', 'g_gatheredzones', 0x1],
self::FACTION => [__NAMESPACE__ . '\FactionList', 'faction', 'g_factions', 0x1],
self::PET => [__NAMESPACE__ . '\PetList', 'pet', 'g_pets', 0x1],
self::ACHIEVEMENT => [__NAMESPACE__ . '\AchievementList', 'achievement', 'g_achievements', 0x1],
self::TITLE => [__NAMESPACE__ . '\TitleList', 'title', 'g_titles', 0x1],
self::WORLDEVENT => [__NAMESPACE__ . '\WorldEventList', 'event', 'g_holidays', 0x1],
self::CHR_CLASS => [__NAMESPACE__ . '\CharClassList', 'class', 'g_classes', 0x1],
self::CHR_RACE => [__NAMESPACE__ . '\CharRaceList', 'race', 'g_races', 0x1],
self::SKILL => [__NAMESPACE__ . '\SkillList', 'skill', 'g_skills', 0x1],
self::STATISTIC => [__NAMESPACE__ . '\AchievementList', 'achievement', 'g_achievements', 0x0], // alias for achievements; exists only for Markup
self::CURRENCY => [__NAMESPACE__ . '\CurrencyList', 'currency', 'g_gatheredcurrencies',0x1],
self::SOUND => [__NAMESPACE__ . '\SoundList', 'sound', 'g_sounds', 0x1],
self::ICON => [__NAMESPACE__ . '\IconList', 'icon', 'g_icons', 0x1],
self::GUIDE => [__NAMESPACE__ . '\GuideList', 'guide', '', 0x0],
self::PROFILE => [__NAMESPACE__ . '\ProfileList', '', '', 0x0], // x - not known in javascript
self::GUILD => [__NAMESPACE__ . '\GuildList', '', '', 0x0], // x
self::ARENA_TEAM => [__NAMESPACE__ . '\ArenaTeamList', '', '', 0x0], // x
self::USER => [__NAMESPACE__ . '\UserList', 'user', 'g_users', 0x0], // x
self::EMOTE => [__NAMESPACE__ . '\EmoteList', 'emote', 'g_emotes', 0x1],
self::ENCHANTMENT => [__NAMESPACE__ . '\EnchantmentList', 'enchantment', 'g_enchantments', 0x1],
self::AREATRIGGER => [__NAMESPACE__ . '\AreatriggerList', 'areatrigger', '', 0x0],
self::MAIL => [__NAMESPACE__ . '\MailList', 'mail', '', 0x1]
);

View file

@ -1,5 +1,7 @@
<?php
namespace Aowow;
require 'includes/kernel.php';
if (CLI)
@ -98,7 +100,7 @@ switch ($pageCall)
try // can it be handled as ajax?
{
$out = '';
$class = 'Ajax'.$cleanName;
$class = __NAMESPACE__.'\\'.'Ajax'.$cleanName;
$ajax = new $class(explode('.', $pageParam));
if ($ajax->handle($out))
@ -114,11 +116,11 @@ switch ($pageCall)
}
}
else
throw new Exception('not handled as ajax');
throw new \Exception('not handled as ajax');
}
catch (Exception $e) // no, apparently not..
catch (\Exception $e) // no, apparently not..
{
$class = $cleanName.'Page';
$class = __NAMESPACE__.'\\'.$cleanName.'Page';
$classInstance = new $class($pageCall, $pageParam);
if (is_callable([$classInstance, 'display']))

View file

@ -1,5 +1,7 @@
<?php
namespace Aowow;
if (!defined('AOWOW_REVISION'))
die('illegal access');

View file

@ -1,5 +1,7 @@
<?php
namespace Aowow;
if (!defined('AOWOW_REVISION'))
die('illegal access');

View file

@ -1,5 +1,7 @@
<?php
namespace Aowow;
if (!defined('AOWOW_REVISION'))
die('illegal access');

View file

@ -1,5 +1,7 @@
<?php
namespace Aowow;
if (!defined('AOWOW_REVISION'))
die('illegal access');

View file

@ -1,5 +1,7 @@
<?php
namespace Aowow;
if (!defined('AOWOW_REVISION'))
die('illegal access');

View file

@ -1,5 +1,7 @@
<?php
namespace Aowow;
if (!defined('AOWOW_REVISION'))
die('illegal access');

View file

@ -1,5 +1,7 @@
<?php
namespace Aowow;
if (!defined('AOWOW_REVISION'))
die('illegal access');

View file

@ -1,5 +1,7 @@
<?php
namespace Aowow;
if (!defined('AOWOW_REVISION'))
die('illegal access');
@ -44,10 +46,10 @@ class AccountPage extends GenericPage
protected $_post = array(
'username' => ['filter' => FILTER_SANITIZE_SPECIAL_CHARS, 'flags' => FILTER_FLAG_STRIP_AOWOW],
'password' => ['filter' => FILTER_CALLBACK, 'options' => 'GenericPage::checkTextLine'],
'c_password' => ['filter' => FILTER_CALLBACK, 'options' => 'GenericPage::checkTextLine'],
'password' => ['filter' => FILTER_CALLBACK, 'options' => 'Aowow\GenericPage::checkTextLine'],
'c_password' => ['filter' => FILTER_CALLBACK, 'options' => 'Aowow\GenericPage::checkTextLine'],
'token' => ['filter' => FILTER_SANITIZE_SPECIAL_CHARS, 'flags' => FILTER_FLAG_STRIP_AOWOW],
'remember_me' => ['filter' => FILTER_CALLBACK, 'options' => 'AccountPage::rememberCallback'],
'remember_me' => ['filter' => FILTER_CALLBACK, 'options' => 'Aowow\AccountPage::rememberCallback'],
'email' => ['filter' => FILTER_SANITIZE_EMAIL]
);

View file

@ -1,5 +1,7 @@
<?php
namespace Aowow;
if (!defined('AOWOW_REVISION'))
die('illegal access');
@ -38,7 +40,7 @@ class AchievementPage extends GenericPage
protected $tabId = 0;
protected $mode = CACHE_TYPE_PAGE;
protected $_get = ['domain' => ['filter' => FILTER_CALLBACK, 'options' => 'Locale::tryFromDomain']];
protected $_get = ['domain' => ['filter' => FILTER_CALLBACK, 'options' => 'Aowow\Locale::tryFromDomain']];
private $powerTpl = '$WowheadPower.registerAchievement(%d, %d, %s);';
@ -548,7 +550,7 @@ class AchievementPage extends GenericPage
protected function generateTooltip()
{
$power = new StdClass();
$power = new \StdClass();
if (!$this->subject->error)
{
$power->{'name_'.Lang::getLocale()->json()} = $this->subject->getField('name', true);

View file

@ -1,5 +1,7 @@
<?php
namespace Aowow;
if (!defined('AOWOW_REVISION'))
die('illegal access');

View file

@ -1,5 +1,7 @@
<?php
namespace Aowow;
if (!defined('AOWOW_REVISION'))
die('illegal access');
@ -22,8 +24,8 @@ class AdminPage extends GenericPage
protected $_get = array(
'all' => ['filter' => FILTER_UNSAFE_RAW],
'type' => ['filter' => FILTER_CALLBACK, 'options' => 'GenericPage::checkInt'],
'typeid' => ['filter' => FILTER_CALLBACK, 'options' => 'GenericPage::checkInt'],
'type' => ['filter' => FILTER_CALLBACK, 'options' => 'Aowow\GenericPage::checkInt'],
'typeid' => ['filter' => FILTER_CALLBACK, 'options' => 'Aowow\GenericPage::checkInt'],
'user' => ['filter' => FILTER_CALLBACK, 'options' => 'urldecode']
);

View file

@ -1,5 +1,7 @@
<?php
namespace Aowow;
if (!defined('AOWOW_REVISION'))
die('illegal access');

View file

@ -1,5 +1,7 @@
<?php
namespace Aowow;
if (!defined('AOWOW_REVISION'))
die('illegal access');

View file

@ -1,5 +1,7 @@
<?php
namespace Aowow;
if (!defined('AOWOW_REVISION'))
die('illegal access');

View file

@ -1,5 +1,7 @@
<?php
namespace Aowow;
if (!defined('AOWOW_REVISION'))
die('illegal access');

View file

@ -1,5 +1,7 @@
<?php
namespace Aowow;
if (!defined('AOWOW_REVISION'))
die('illegal access');

View file

@ -1,5 +1,7 @@
<?php
namespace Aowow;
if (!defined('AOWOW_REVISION'))
die('illegal access');

View file

@ -1,5 +1,7 @@
<?php
namespace Aowow;
if (!defined('AOWOW_REVISION'))
die('illegal access');
@ -23,8 +25,8 @@ class ComparePage extends GenericPage
protected $summary = [];
protected $cmpItems = [];
protected $_get = ['compare' => ['filter' => FILTER_CALLBACK, 'options' => 'ComparePage::checkCompareString']];
protected $_cookie = ['compare_groups' => ['filter' => FILTER_CALLBACK, 'options' => 'ComparePage::checkCompareString']];
protected $_get = ['compare' => ['filter' => FILTER_CALLBACK, 'options' => 'Aowow\ComparePage::checkCompareString']];
protected $_cookie = ['compare_groups' => ['filter' => FILTER_CALLBACK, 'options' => 'Aowow\ComparePage::checkCompareString']];
private $compareString = '';

View file

@ -1,5 +1,7 @@
<?php
namespace Aowow;
if (!defined('AOWOW_REVISION'))
die('illegal access');

View file

@ -1,5 +1,7 @@
<?php
namespace Aowow;
if (!defined('AOWOW_REVISION'))
die('illegal access');
@ -17,7 +19,7 @@ class CurrencyPage extends GenericPage
protected $tabId = 0;
protected $mode = CACHE_TYPE_PAGE;
protected $_get = ['domain' => ['filter' => FILTER_CALLBACK, 'options' => 'Locale::tryFromDomain']];
protected $_get = ['domain' => ['filter' => FILTER_CALLBACK, 'options' => 'Aowow\Locale::tryFromDomain']];
private $powerTpl = '$WowheadPower.registerCurrency(%d, %d, %s);';
@ -228,7 +230,7 @@ class CurrencyPage extends GenericPage
protected function generateTooltip()
{
$power = new StdClass();
$power = new \StdClass();
if (!$this->subject->error)
{
$power->{'name_'.Lang::getLocale()->json()} = $this->subject->getField('name', true);

View file

@ -1,5 +1,7 @@
<?php
namespace Aowow;
if (!defined('AOWOW_REVISION'))
die('illegal access');

View file

@ -1,5 +1,7 @@
<?php
namespace Aowow;
if (!defined('AOWOW_REVISION'))
die('illegal access');

View file

@ -1,5 +1,7 @@
<?php
namespace Aowow;
if (!defined('AOWOW_REVISION'))
die('illegal access');

View file

@ -1,5 +1,7 @@
<?php
namespace Aowow;
if (!defined('AOWOW_REVISION'))
die('illegal access');

View file

@ -1,5 +1,7 @@
<?php
namespace Aowow;
if (!defined('AOWOW_REVISION'))
die('illegal access');
@ -19,7 +21,7 @@ class EventPage extends GenericPage
protected $tabId = 0;
protected $mode = CACHE_TYPE_PAGE;
protected $_get = ['domain' => ['filter' => FILTER_CALLBACK, 'options' => 'Locale::tryFromDomain']];
protected $_get = ['domain' => ['filter' => FILTER_CALLBACK, 'options' => 'Aowow\Locale::tryFromDomain']];
private $powerTpl = '$WowheadPower.registerHoliday(%d, %d, %s);';
private $hId = 0;
@ -280,7 +282,7 @@ class EventPage extends GenericPage
protected function generateTooltip() : string
{
$power = new StdClass();
$power = new \StdClass();
if (!$this->subject->error)
{
$power->{'name_'.Lang::getLocale()->json()} = $this->subject->getField('name', true);

View file

@ -1,5 +1,7 @@
<?php
namespace Aowow;
if (!defined('AOWOW_REVISION'))
die('illegal access');

View file

@ -1,5 +1,7 @@
<?php
namespace Aowow;
if (!defined('AOWOW_REVISION'))
die('illegal access');

View file

@ -1,5 +1,7 @@
<?php
namespace Aowow;
if (!defined('AOWOW_REVISION'))
die('illegal access');

View file

@ -1,5 +1,7 @@
<?php
namespace Aowow;
if (!defined('AOWOW_REVISION'))
die('illegal access');
@ -922,8 +924,10 @@ class GenericPage
}
// load brick with more text then vars
protected function localizedBrick(string $file, Locale $loc = Locale::EN) : void
protected function localizedBrick(string $file, ?Locale $loc = null) : void
{
$loc ??= Lang::getLocale();
if (!$this->isSaneInclude('template/localized/', $file.'_'.$loc->value))
{
if ($loc == Locale::EN || !$this->isSaneInclude('template/localized/', $file.'_'.Locale::EN->value))
@ -1039,12 +1043,12 @@ class GenericPage
{
try
{
$rp = new ReflectionProperty($this, $key);
$rp = new \ReflectionProperty($this, $key);
if ($rp && ($rp->isPublic() || $rp->isProtected()))
if (!in_array($key, $noCache))
$cache[$key] = $val;
}
catch (ReflectionException $e) { } // shut up!
catch (\ReflectionException $e) { } // shut up!
}
}
else
@ -1175,11 +1179,11 @@ class GenericPage
return false;
}
private function memcached() : Memcached
private function memcached() : \Memcached
{
if (!$this->memcached && (Cfg::get('CACHE_MODE') & CACHE_MODE_MEMCACHED))
{
$this->memcached = new Memcached();
$this->memcached = new \Memcached();
$this->memcached->addServer('localhost', 11211);
}

View file

@ -1,5 +1,7 @@
<?php
namespace Aowow;
if (!defined('AOWOW_REVISION'))
die('illegal access');
@ -38,22 +40,22 @@ class GuidePage extends GenericPage
private /* bool */ $save = false;
protected /* array */ $_get = array(
'id' => ['filter' => FILTER_CALLBACK, 'options' => 'GenericPage::checkInt'],
'rev' => ['filter' => FILTER_CALLBACK, 'options' => 'GenericPage::checkInt']
'id' => ['filter' => FILTER_CALLBACK, 'options' => 'Aowow\GenericPage::checkInt'],
'rev' => ['filter' => FILTER_CALLBACK, 'options' => 'Aowow\GenericPage::checkInt']
);
protected /* array */ $_post = array(
'save' => ['filter' => FILTER_CALLBACK, 'options' => 'GenericPage::checkEmptySet'],
'submit' => ['filter' => FILTER_CALLBACK, 'options' => 'GenericPage::checkEmptySet'],
'title' => ['filter' => FILTER_CALLBACK, 'options' => 'GenericPage::checkTextLine'],
'name' => ['filter' => FILTER_CALLBACK, 'options' => 'GenericPage::checkTextLine'],
'description' => ['filter' => FILTER_CALLBACK, 'options' => 'GuidePage::checkDescription'],
'changelog' => ['filter' => FILTER_CALLBACK, 'options' => 'GenericPage::checkTextBlob'],
'body' => ['filter' => FILTER_CALLBACK, 'options' => 'GenericPage::checkTextBlob'],
'locale' => ['filter' => FILTER_CALLBACK, 'options' => 'GenericPage::checkInt'],
'category' => ['filter' => FILTER_CALLBACK, 'options' => 'GenericPage::checkInt'],
'specId' => ['filter' => FILTER_CALLBACK, 'options' => 'GenericPage::checkInt'],
'classId' => ['filter' => FILTER_CALLBACK, 'options' => 'GenericPage::checkInt']
'save' => ['filter' => FILTER_CALLBACK, 'options' => 'Aowow\GenericPage::checkEmptySet'],
'submit' => ['filter' => FILTER_CALLBACK, 'options' => 'Aowow\GenericPage::checkEmptySet'],
'title' => ['filter' => FILTER_CALLBACK, 'options' => 'Aowow\GenericPage::checkTextLine'],
'name' => ['filter' => FILTER_CALLBACK, 'options' => 'Aowow\GenericPage::checkTextLine'],
'description' => ['filter' => FILTER_CALLBACK, 'options' => 'Aowow\GuidePage::checkDescription'],
'changelog' => ['filter' => FILTER_CALLBACK, 'options' => 'Aowow\GenericPage::checkTextBlob'],
'body' => ['filter' => FILTER_CALLBACK, 'options' => 'Aowow\GenericPage::checkTextBlob'],
'locale' => ['filter' => FILTER_CALLBACK, 'options' => 'Aowow\GenericPage::checkInt'],
'category' => ['filter' => FILTER_CALLBACK, 'options' => 'Aowow\GenericPage::checkInt'],
'specId' => ['filter' => FILTER_CALLBACK, 'options' => 'Aowow\GenericPage::checkInt'],
'classId' => ['filter' => FILTER_CALLBACK, 'options' => 'Aowow\GenericPage::checkInt']
);
public function __construct($pageCall, $pageParam)
@ -500,7 +502,7 @@ class GuidePage extends GenericPage
protected function generateTooltip()
{
$power = new StdClass();
$power = new \StdClass();
if (!$this->subject->error)
{
$power->{'name_'.Lang::getLocale()->json()} = strip_tags($this->name);

View file

@ -1,5 +1,7 @@
<?php
namespace Aowow;
if (!defined('AOWOW_REVISION'))
die('illegal access');

View file

@ -1,5 +1,7 @@
<?php
namespace Aowow;
if (!defined('AOWOW_REVISION'))
die('illegal access');

View file

@ -1,5 +1,7 @@
<?php
namespace Aowow;
if (!defined('AOWOW_REVISION'))
die('illegal access');

View file

@ -1,5 +1,7 @@
<?php
namespace Aowow;
if (!defined('AOWOW_REVISION'))
die('illegal access');

View file

@ -1,5 +1,7 @@
<?php
namespace Aowow;
if (!defined('AOWOW_REVISION'))
die('illegal access');

View file

@ -1,5 +1,7 @@
<?php
namespace Aowow;
if (!defined('AOWOW_REVISION'))
die('illegal access');

View file

@ -1,5 +1,7 @@
<?php
namespace Aowow;
if (!defined('AOWOW_REVISION'))
die('illegal access');
@ -29,11 +31,11 @@ class ItemPage extends genericPage
);
protected $_get = array(
'domain' => ['filter' => FILTER_CALLBACK, 'options' => 'Locale::tryFromDomain'],
'rand' => ['filter' => FILTER_CALLBACK, 'options' => 'GenericPage::checkInt'],
'ench' => ['filter' => FILTER_CALLBACK, 'options' => 'GenericPage::checkInt'],
'gems' => ['filter' => FILTER_CALLBACK, 'options' => 'GenericPage::checkIntArray'],
'sock' => ['filter' => FILTER_CALLBACK, 'options' => 'GenericPage::checkEmptySet']
'domain' => ['filter' => FILTER_CALLBACK, 'options' => 'Aowow\Locale::tryFromDomain'],
'rand' => ['filter' => FILTER_CALLBACK, 'options' => 'Aowow\GenericPage::checkInt'],
'ench' => ['filter' => FILTER_CALLBACK, 'options' => 'Aowow\GenericPage::checkInt'],
'gems' => ['filter' => FILTER_CALLBACK, 'options' => 'Aowow\GenericPage::checkIntArray'],
'sock' => ['filter' => FILTER_CALLBACK, 'options' => 'Aowow\GenericPage::checkEmptySet']
);
private $powerTpl = '$WowheadPower.registerItem(%s, %d, %s);';
@ -1030,7 +1032,7 @@ class ItemPage extends genericPage
protected function generateTooltip()
{
$power = new StdClass();
$power = new \StdClass();
if (!$this->subject->error)
{
$power->{'name_'.Lang::getLocale()->json()} = Lang::unescapeUISequences($this->subject->getField('name', true, false, $this->enhancedTT), Lang::FMT_RAW);

Some files were not shown because too many files have changed in this diff Show more