From 3a6c86092b73158d8a05ba5a4cc9cde2f1bfd289 Mon Sep 17 00:00:00 2001 From: Sarjuuk Date: Mon, 31 Mar 2025 14:44:44 +0200 Subject: [PATCH] Core/Compat * create namespace Aowow to avoid naming conflicts * inclues/libs/ is outside of the Aowow namespace --- includes/ajaxHandler.class.php | 2 + includes/ajaxHandler/account.class.php | 8 ++- includes/ajaxHandler/admin.class.php | 36 +++++----- includes/ajaxHandler/arenateam.class.php | 6 +- includes/ajaxHandler/comment.class.php | 30 +++++---- includes/ajaxHandler/contactus.class.php | 20 +++--- includes/ajaxHandler/cookie.class.php | 4 +- includes/ajaxHandler/data.class.php | 14 ++-- includes/ajaxHandler/edit.class.php | 10 +-- includes/ajaxHandler/filter.class.php | 2 + includes/ajaxHandler/getdescription.class.php | 4 +- includes/ajaxHandler/gotocomment.class.php | 4 +- includes/ajaxHandler/guide.class.php | 2 + includes/ajaxHandler/guild.class.php | 6 +- includes/ajaxHandler/locale.class.php | 4 +- includes/ajaxHandler/profile.class.php | 30 +++++---- includes/basetype.class.php | 8 ++- includes/community.class.php | 2 + .../Conditions/Conditions.class.php | 2 + includes/components/SmartAI/SmartAI.class.php | 4 +- .../components/SmartAI/SmartAction.class.php | 2 + .../components/SmartAI/SmartEvent.class.php | 2 + .../components/SmartAI/SmartTarget.class.php | 2 + includes/config.class.php | 12 ++-- includes/database.class.php | 6 +- includes/defines.php | 2 + includes/game.php | 4 +- includes/kernel.php | 34 ++++++---- includes/locale.class.php | 6 +- includes/loot.class.php | 2 + includes/markup.class.php | 2 + includes/profiler.class.php | 2 + includes/stats.class.php | 2 + includes/types/achievement.class.php | 2 + includes/types/areatrigger.class.php | 2 + includes/types/arenateam.class.php | 2 + includes/types/charclass.class.php | 2 + includes/types/charrace.class.php | 2 + includes/types/creature.class.php | 2 + includes/types/currency.class.php | 2 + includes/types/emote.class.php | 2 + includes/types/enchantment.class.php | 2 + includes/types/faction.class.php | 2 + includes/types/gameobject.class.php | 2 + includes/types/guide.class.php | 2 + includes/types/guild.class.php | 2 + includes/types/icon.class.php | 2 + includes/types/item.class.php | 4 +- includes/types/itemset.class.php | 2 + includes/types/mail.class.php | 2 + includes/types/pet.class.php | 2 + includes/types/profile.class.php | 2 + includes/types/quest.class.php | 2 + includes/types/skill.class.php | 2 + includes/types/sound.class.php | 2 + includes/types/spell.class.php | 2 + includes/types/title.class.php | 2 + includes/types/user.class.php | 2 + includes/types/worldevent.class.php | 2 + includes/types/zone.class.php | 2 + includes/user.class.php | 8 ++- includes/utilities.php | 66 ++++++++++--------- index.php | 10 +-- localization/lang.class.php | 2 + localization/locale_dede.php | 2 + localization/locale_enus.php | 2 + localization/locale_eses.php | 2 + localization/locale_frfr.php | 2 + localization/locale_ruru.php | 2 + localization/locale_zhcn.php | 2 + pages/account.php | 8 ++- pages/achievement.php | 6 +- pages/achievements.php | 2 + pages/admin.php | 6 +- pages/areatrigger.php | 2 + pages/areatriggers.php | 2 + pages/arenateam.php | 2 + pages/arenateams.php | 2 + pages/class.php | 2 + pages/classes.php | 2 + pages/compare.php | 6 +- pages/currencies.php | 2 + pages/currency.php | 6 +- pages/emote.php | 2 + pages/emotes.php | 2 + pages/enchantment.php | 2 + pages/enchantments.php | 2 + pages/event.php | 6 +- pages/events.php | 2 + pages/faction.php | 2 + pages/factions.php | 2 + pages/genericPage.class.php | 14 ++-- pages/guide.php | 30 +++++---- pages/guides.php | 2 + pages/guild.php | 2 + pages/guilds.php | 2 + pages/home.php | 2 + pages/icon.php | 2 + pages/icons.php | 2 + pages/item.php | 14 ++-- pages/items.php | 2 + pages/itemset.php | 6 +- pages/itemsets.php | 2 + pages/mail.php | 2 + pages/mails.php | 2 + pages/maps.php | 2 + pages/more.php | 2 + pages/npc.php | 6 +- pages/npcs.php | 2 + pages/object.php | 6 +- pages/objects.php | 2 + pages/pet.php | 2 + pages/pets.php | 2 + pages/profile.php | 8 ++- pages/profiler.php | 2 + pages/profiles.php | 2 + pages/quest.php | 6 +- pages/quests.php | 2 + pages/race.php | 2 + pages/races.php | 2 + pages/screenshot.php | 8 ++- pages/search.php | 18 +++-- pages/skill.php | 2 + pages/skills.php | 2 + pages/sound.php | 4 +- pages/sounds.php | 2 + pages/spell.php | 6 +- pages/spells.php | 2 + pages/talent.php | 2 + pages/title.php | 2 + pages/titles.php | 2 + pages/user.php | 2 + pages/utility.php | 4 +- pages/zone.php | 2 + pages/zones.php | 4 +- prQueue | 2 + setup/setup.php | 2 + setup/tools/CLISetup.class.php | 16 +++-- setup/tools/clisetup/account.us.php | 2 + setup/tools/clisetup/datagen.us.php | 2 + setup/tools/clisetup/dbc.us.php | 2 + setup/tools/clisetup/dbconfig.us.php | 2 + setup/tools/clisetup/filegen.us.php | 2 + setup/tools/clisetup/setup.us.php | 4 +- setup/tools/clisetup/siteconfig.us.php | 2 + setup/tools/clisetup/sync.us.php | 2 + setup/tools/clisetup/update.us.php | 2 + setup/tools/dbc.class.php | 2 + setup/tools/filegen/demo.ss.php | 2 + setup/tools/filegen/enchants.ss.php | 2 + setup/tools/filegen/gems.ss.php | 2 + setup/tools/filegen/glyphs.ss.php | 2 + setup/tools/filegen/img-artwork.ss.php | 2 + setup/tools/filegen/img-maps.ss.php | 8 ++- setup/tools/filegen/img-talentcalc.ss.php | 2 + setup/tools/filegen/itemscaling.ss.php | 2 + setup/tools/filegen/itemsets.ss.php | 2 + setup/tools/filegen/locales.ss.php | 2 + setup/tools/filegen/markup.ss.php | 2 + setup/tools/filegen/pets.ss.php | 2 + setup/tools/filegen/profiler.ss.php | 4 +- setup/tools/filegen/realmmenu.ss.php | 2 + setup/tools/filegen/realms.ss.php | 2 + setup/tools/filegen/searchbox.ss.php | 2 + setup/tools/filegen/searchplugin.ss.php | 2 + setup/tools/filegen/simpleimg.ss.php | 2 + setup/tools/filegen/soundfiles.ss.php | 2 + setup/tools/filegen/statistics.ss.php | 2 + setup/tools/filegen/talentcalc.ss.php | 2 + setup/tools/filegen/talenticons.ss.php | 4 +- setup/tools/filegen/tooltips.ss.php | 2 + setup/tools/filegen/weightpresets.ss.php | 2 + setup/tools/imagecreatefromblp.func.php | 39 +++++++---- setup/tools/setupScript.class.php | 16 +++-- setup/tools/sqlgen/achievement.ss.php | 2 + setup/tools/sqlgen/achievementcriteria.ss.php | 2 + setup/tools/sqlgen/areatrigger.ss.php | 2 + setup/tools/sqlgen/classes.ss.php | 2 + setup/tools/sqlgen/creature.ss.php | 2 + setup/tools/sqlgen/currencies.ss.php | 2 + setup/tools/sqlgen/declinedword.ss.php | 2 + setup/tools/sqlgen/dungeonmap.ss.php | 2 + setup/tools/sqlgen/emotes.ss.php | 2 + setup/tools/sqlgen/events.ss.php | 2 + setup/tools/sqlgen/factions.ss.php | 2 + setup/tools/sqlgen/glyphproperties.ss.php | 2 + setup/tools/sqlgen/holidays.ss.php | 2 + setup/tools/sqlgen/icons.ss.php | 2 + setup/tools/sqlgen/itemenchantment.ss.php | 2 + .../sqlgen/itemenchantmentcondition.ss.php | 2 + setup/tools/sqlgen/itemextendedcost.ss.php | 2 + setup/tools/sqlgen/itemlimitcategory.ss.php | 2 + setup/tools/sqlgen/itemrandomenchant.ss.php | 2 + .../tools/sqlgen/itemrandomproppoints.ss.php | 2 + setup/tools/sqlgen/items.ss.php | 2 + setup/tools/sqlgen/itemset.ss.php | 2 + setup/tools/sqlgen/itemstats.ss.php | 2 + setup/tools/sqlgen/lock.ss.php | 2 + setup/tools/sqlgen/mailtemplate.ss.php | 2 + setup/tools/sqlgen/objects.ss.php | 2 + setup/tools/sqlgen/pet.ss.php | 2 + setup/tools/sqlgen/quests.ss.php | 2 + setup/tools/sqlgen/questsstartend.ss.php | 2 + setup/tools/sqlgen/races.ss.php | 2 + .../sqlgen/scalingstatdistribution.ss.php | 2 + setup/tools/sqlgen/scalingstatvalues.ss.php | 2 + setup/tools/sqlgen/shapeshiftforms.ss.php | 2 + setup/tools/sqlgen/skillline.ss.php | 2 + setup/tools/sqlgen/skilllineability.ss.php | 2 + setup/tools/sqlgen/soundemitter.ss.php | 2 + setup/tools/sqlgen/sounds.ss.php | 2 + setup/tools/sqlgen/source.ss.php | 2 + setup/tools/sqlgen/spawns.ss.php | 2 + setup/tools/sqlgen/spell.ss.php | 2 + setup/tools/sqlgen/spelldifficulty.ss.php | 2 + setup/tools/sqlgen/spellfocusobject.ss.php | 2 + setup/tools/sqlgen/spelloverride.ss.php | 2 + setup/tools/sqlgen/spellrange.ss.php | 2 + setup/tools/sqlgen/spellvariables.ss.php | 2 + setup/tools/sqlgen/summonproperties.ss.php | 2 + setup/tools/sqlgen/talents.ss.php | 2 + setup/tools/sqlgen/taxi.ss.php | 2 + setup/tools/sqlgen/titles.ss.php | 2 + setup/tools/sqlgen/totemcategory.ss.php | 2 + setup/tools/sqlgen/worldmaparea.ss.php | 2 + setup/tools/sqlgen/zones.ss.php | 2 + setup/tools/utilityScript.class.php | 2 + template/bricks/announcement.tpl.php | 4 +- template/bricks/article.tpl.php | 2 + template/bricks/book.tpl.php | 2 + template/bricks/contribute.tpl.php | 4 +- template/bricks/filter.tpl.php | 2 + template/bricks/footer.tpl.php | 2 + template/bricks/head.tpl.php | 2 + template/bricks/headIcons.tpl.php | 2 + template/bricks/header.tpl.php | 2 + template/bricks/headerMenu.tpl.php | 2 + template/bricks/infobox.tpl.php | 2 + template/bricks/lvTabs.tpl.php | 2 + template/bricks/mail.tpl.php | 2 + template/bricks/mapper.tpl.php | 2 + template/bricks/pageTemplate.tpl.php | 2 + template/bricks/reagentList.tpl.php | 2 + template/bricks/redButtons.tpl.php | 2 + template/bricks/rewards.tpl.php | 2 + template/bricks/series.tpl.php | 2 + template/bricks/tooltip.tpl.php | 2 + template/listviews/areatrigger.tpl.php | 2 + template/listviews/commentAdminCol.tpl.php | 2 + template/listviews/emote.tpl.php | 2 + template/listviews/enchantment.tpl.php | 2 + template/listviews/guideAdminCol.tpl.php | 2 + template/listviews/itemStandingCol.tpl.php | 2 + template/listviews/mail.tpl.php | 2 + template/listviews/membersCol.tpl.php | 2 + template/listviews/npcRepCol.tpl.php | 2 + template/listviews/petFoodCol.tpl.php | 2 + template/listviews/questRepCol.tpl.php | 2 + template/listviews/vendorRestockCol.tpl.php | 2 + template/localized/contrib_0.tpl.php | 2 + template/localized/contrib_2.tpl.php | 2 + template/localized/contrib_3.tpl.php | 2 + template/localized/contrib_4.tpl.php | 2 + template/localized/contrib_6.tpl.php | 2 + template/localized/contrib_8.tpl.php | 2 + template/localized/ssReminder_0.tpl.php | 2 + template/localized/ssReminder_3.tpl.php | 2 + template/localized/ssReminder_4.tpl.php | 2 + template/pages/acc-dashboard.tpl.php | 2 + template/pages/acc-recover.tpl.php | 2 + template/pages/acc-signIn.tpl.php | 2 + template/pages/acc-signUp.tpl.php | 2 + template/pages/achievement.tpl.php | 2 + template/pages/achievements.tpl.php | 2 + template/pages/admin/reports.tpl.php | 2 + template/pages/admin/screenshots.tpl.php | 2 + template/pages/admin/siteconfig.tpl.php | 2 + template/pages/admin/weight-presets.tpl.php | 2 + template/pages/areatriggers.tpl.php | 2 + template/pages/arena-teams.tpl.php | 2 + template/pages/compare.tpl.php | 2 + template/pages/detail-page-generic.tpl.php | 2 + template/pages/enchantment.tpl.php | 2 + template/pages/enchantments.tpl.php | 2 + template/pages/guide-edit.tpl.php | 2 + template/pages/guilds.tpl.php | 2 + template/pages/home.tpl.php | 2 + template/pages/icon.tpl.php | 2 + template/pages/icons.tpl.php | 2 + template/pages/item.tpl.php | 2 + template/pages/items.tpl.php | 2 + template/pages/itemset.tpl.php | 4 +- template/pages/itemsets.tpl.php | 2 + template/pages/list-page-generic.tpl.php | 2 + template/pages/maintenance.tpl.php | 2 + template/pages/maps.tpl.php | 2 + template/pages/npc.tpl.php | 2 + template/pages/npcs.tpl.php | 2 + template/pages/object.tpl.php | 2 + template/pages/objects.tpl.php | 2 + template/pages/privilege.tpl.php | 2 + template/pages/privileges.tpl.php | 2 + template/pages/profile.tpl.php | 2 + template/pages/profiler.tpl.php | 2 + template/pages/profiles.tpl.php | 2 + template/pages/quest.tpl.php | 2 + template/pages/quests.tpl.php | 2 + template/pages/roster.tpl.php | 2 + template/pages/screenshot.tpl.php | 4 +- template/pages/search.tpl.php | 2 + template/pages/sound.tpl.php | 2 + template/pages/sounds.tpl.php | 2 + template/pages/spell.tpl.php | 2 + template/pages/spells.tpl.php | 2 + template/pages/talent.tpl.php | 2 + template/pages/text-page-generic.tpl.php | 2 + template/pages/user.tpl.php | 2 + 317 files changed, 898 insertions(+), 243 deletions(-) diff --git a/includes/ajaxHandler.class.php b/includes/ajaxHandler.class.php index 27b6aae3..5094e92f 100644 --- a/includes/ajaxHandler.class.php +++ b/includes/ajaxHandler.class.php @@ -1,5 +1,7 @@ ['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], diff --git a/includes/ajaxHandler/admin.class.php b/includes/ajaxHandler/admin.class.php index 8a88a375..4de03301 100644 --- a/includes/ajaxHandler/admin.class.php +++ b/includes/ajaxHandler/admin.class.php @@ -1,5 +1,7 @@ ['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) diff --git a/includes/ajaxHandler/arenateam.class.php b/includes/ajaxHandler/arenateam.class.php index 715924bc..8d609e61 100644 --- a/includes/ajaxHandler/arenateam.class.php +++ b/includes/ajaxHandler/arenateam.class.php @@ -1,5 +1,7 @@ ['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) diff --git a/includes/ajaxHandler/comment.class.php b/includes/ajaxHandler/comment.class.php index 12bf766e..2f77b0f1 100644 --- a/includes/ajaxHandler/comment.class.php +++ b/includes/ajaxHandler/comment.class.php @@ -1,5 +1,7 @@ ['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) diff --git a/includes/ajaxHandler/contactus.class.php b/includes/ajaxHandler/contactus.class.php index a21c1eed..c665cfa6 100644 --- a/includes/ajaxHandler/contactus.class.php +++ b/includes/ajaxHandler/contactus.class.php @@ -1,20 +1,22 @@ ['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) diff --git a/includes/ajaxHandler/cookie.class.php b/includes/ajaxHandler/cookie.class.php index 066b742c..5e018e2b 100644 --- a/includes/ajaxHandler/cookie.class.php +++ b/includes/ajaxHandler/cookie.class.php @@ -1,5 +1,7 @@ _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 diff --git a/includes/ajaxHandler/data.class.php b/includes/ajaxHandler/data.class.php index ec57e1ea..0dd74805 100644 --- a/includes/ajaxHandler/data.class.php +++ b/includes/ajaxHandler/data.class.php @@ -1,17 +1,19 @@ ['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) diff --git a/includes/ajaxHandler/edit.class.php b/includes/ajaxHandler/edit.class.php index e8f31539..4bf2b34f 100644 --- a/includes/ajaxHandler/edit.class.php +++ b/includes/ajaxHandler/edit.class.php @@ -1,13 +1,15 @@ ['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)) { diff --git a/includes/ajaxHandler/filter.class.php b/includes/ajaxHandler/filter.class.php index c02e80eb..951a84be 100644 --- a/includes/ajaxHandler/filter.class.php +++ b/includes/ajaxHandler/filter.class.php @@ -1,5 +1,7 @@ [FILTER_CALLBACK, ['options' => 'AjaxHandler::checkTextBlob']] + 'description' => [FILTER_CALLBACK, ['options' => 'Aowow\AjaxHandler::checkTextBlob']] ); public function __construct(array $params) diff --git a/includes/ajaxHandler/gotocomment.class.php b/includes/ajaxHandler/gotocomment.class.php index 25f4d176..915c9102 100644 --- a/includes/ajaxHandler/gotocomment.class.php +++ b/includes/ajaxHandler/gotocomment.class.php @@ -1,12 +1,14 @@ ['filter' => FILTER_CALLBACK, 'options' => 'AjaxHandler::checkInt'] + 'id' => ['filter' => FILTER_CALLBACK, 'options' => 'Aowow\AjaxHandler::checkInt'] ); public function __construct(array $params) diff --git a/includes/ajaxHandler/guide.class.php b/includes/ajaxHandler/guide.class.php index 5bbbd04c..eb425f15 100644 --- a/includes/ajaxHandler/guide.class.php +++ b/includes/ajaxHandler/guide.class.php @@ -1,5 +1,7 @@ ['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) diff --git a/includes/ajaxHandler/locale.class.php b/includes/ajaxHandler/locale.class.php index e89fb33a..6dae7e95 100644 --- a/includes/ajaxHandler/locale.class.php +++ b/includes/ajaxHandler/locale.class.php @@ -1,12 +1,14 @@ ['filter' => FILTER_CALLBACK, 'options' => 'Locale::tryFrom'] + 'locale' => ['filter' => FILTER_CALLBACK, 'options' => 'Aowow\Locale::tryFrom'] ); public function __construct(array $params) diff --git a/includes/ajaxHandler/profile.class.php b/includes/ajaxHandler/profile.class.php index c636a046..a3bd2435 100644 --- a/includes/ajaxHandler/profile.class.php +++ b/includes/ajaxHandler/profile.class.php @@ -1,5 +1,7 @@ ['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) diff --git a/includes/basetype.class.php b/includes/basetype.class.php index 02688a99..2398fab1 100644 --- a/includes/basetype.class.php +++ b/includes/basetype.class.php @@ -1,5 +1,7 @@ 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 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; diff --git a/includes/community.class.php b/includes/community.class.php index c1d0c23d..128b955c 100644 --- a/includes/community.class.php +++ b/includes/community.class.php @@ -1,5 +1,7 @@ rawData); diff --git a/includes/components/SmartAI/SmartAction.class.php b/includes/components/SmartAI/SmartAction.class.php index 0e2d0711..6ab636e9 100644 --- a/includes/components/SmartAI/SmartAction.class.php +++ b/includes/components/SmartAI/SmartAction.class.php @@ -1,5 +1,7 @@ [, $flags, $catg, , ]) if ($catg == $category && !($flags & self::FLAG_INTERNAL)) diff --git a/includes/database.class.php b/includes/database.class.php index b8ec0dbe..7c9cfc4d 100644 --- a/includes/database.class.php +++ b/includes/database.class.php @@ -1,5 +1,7 @@ setErrorHandler(['DB', 'errorHandler']); + $interface->setErrorHandler(self::errorHandler(...)); if ($options['prefix']) $interface->setIdentPrefix($options['prefix']); diff --git a/includes/defines.php b/includes/defines.php index 6738ab2a..42496b14 100644 --- a/includes/defines.php +++ b/includes/defines.php @@ -1,5 +1,7 @@ id; diff --git a/includes/kernel.php b/includes/kernel.php index eacde4bf..427bc40e 100644 --- a/includes/kernel.php +++ b/includes/kernel.php @@ -1,5 +1,7 @@ !extension_loaded($x))) $error .= 'Required Extension '.implode(', ', $ext)." was not found. Please check if it should exist, using \"php -m\"\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! diff --git a/includes/locale.class.php b/includes/locale.class.php index cc7d08e6..235d2d92 100644 --- a/includes/locale.class.php +++ b/includes/locale.class.php @@ -1,5 +1,7 @@ store = new WeakMap(); + $this->store = new \WeakMap(); $callback ??= fn($x) => $x; diff --git a/includes/loot.class.php b/includes/loot.class.php index 13b28e0f..c7029470 100644 --- a/includes/loot.class.php +++ b/includes/loot.class.php @@ -1,5 +1,7 @@ $id, 'tooltip' => $this->renderTooltip(true), - 'spells' => new StdClass // placeholder for knownSpells + 'spells' => new \StdClass // placeholder for knownSpells ); } } diff --git a/includes/types/itemset.class.php b/includes/types/itemset.class.php index f833c9a4..e2a1eaba 100644 --- a/includes/types/itemset.class.php +++ b/includes/types/itemset.class.php @@ -1,5 +1,7 @@ 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] ); diff --git a/index.php b/index.php index 048c243f..62867356 100644 --- a/index.php +++ b/index.php @@ -1,5 +1,7 @@ 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'])) diff --git a/localization/lang.class.php b/localization/lang.class.php index 9c76f6bf..6a3d5ff0 100644 --- a/localization/lang.class.php +++ b/localization/lang.class.php @@ -1,5 +1,7 @@ ['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] ); diff --git a/pages/achievement.php b/pages/achievement.php index 5ac531b8..ff11d36f 100644 --- a/pages/achievement.php +++ b/pages/achievement.php @@ -1,5 +1,7 @@ ['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); diff --git a/pages/achievements.php b/pages/achievements.php index 27251c1d..41528b4b 100644 --- a/pages/achievements.php +++ b/pages/achievements.php @@ -1,5 +1,7 @@ ['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'] ); diff --git a/pages/areatrigger.php b/pages/areatrigger.php index a588fb0f..1bd29174 100644 --- a/pages/areatrigger.php +++ b/pages/areatrigger.php @@ -1,5 +1,7 @@ ['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 = ''; diff --git a/pages/currencies.php b/pages/currencies.php index 4186feab..dbdf57ca 100644 --- a/pages/currencies.php +++ b/pages/currencies.php @@ -1,5 +1,7 @@ ['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); diff --git a/pages/emote.php b/pages/emote.php index 8d634b78..79425311 100644 --- a/pages/emote.php +++ b/pages/emote.php @@ -1,5 +1,7 @@ ['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); diff --git a/pages/events.php b/pages/events.php index fa13bb4d..4807ce20 100644 --- a/pages/events.php +++ b/pages/events.php @@ -1,5 +1,7 @@ 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); } diff --git a/pages/guide.php b/pages/guide.php index ed60239d..9b0c62f4 100644 --- a/pages/guide.php +++ b/pages/guide.php @@ -1,5 +1,7 @@ ['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); diff --git a/pages/guides.php b/pages/guides.php index 1848cc99..13201813 100644 --- a/pages/guides.php +++ b/pages/guides.php @@ -1,5 +1,7 @@ ['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); diff --git a/pages/items.php b/pages/items.php index 1800a5c7..9ef10744 100644 --- a/pages/items.php +++ b/pages/items.php @@ -1,5 +1,7 @@ ['filter' => FILTER_CALLBACK, 'options' => 'Locale::tryFromDomain']]; + protected $_get = ['domain' => ['filter' => FILTER_CALLBACK, 'options' => 'Aowow\Locale::tryFromDomain']]; private $powerTpl = '$WowheadPower.registerItemSet(%d, %d, %s);'; @@ -241,7 +243,7 @@ class ItemsetPage 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); diff --git a/pages/itemsets.php b/pages/itemsets.php index 540d6a9a..87b274b5 100644 --- a/pages/itemsets.php +++ b/pages/itemsets.php @@ -1,5 +1,7 @@ ['filter' => FILTER_CALLBACK, 'options' => 'Locale::tryFromDomain']]; + protected $_get = ['domain' => ['filter' => FILTER_CALLBACK, 'options' => 'Aowow\Locale::tryFromDomain']]; private $soundIds = []; private $powerTpl = '$WowheadPower.registerNpc(%d, %d, %s);'; @@ -899,7 +901,7 @@ class NpcPage 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); diff --git a/pages/npcs.php b/pages/npcs.php index a2feafde..6b798132 100644 --- a/pages/npcs.php +++ b/pages/npcs.php @@ -1,5 +1,7 @@ ['filter' => FILTER_CALLBACK, 'options' => 'Locale::tryFromDomain']]; + protected $_get = ['domain' => ['filter' => FILTER_CALLBACK, 'options' => 'Aowow\Locale::tryFromDomain']]; private $powerTpl = '$WowheadPower.registerObject(%d, %d, %s);'; @@ -485,7 +487,7 @@ class ObjectPage 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), Lang::FMT_RAW); diff --git a/pages/objects.php b/pages/objects.php index 7f173ac7..8f46d233 100644 --- a/pages/objects.php +++ b/pages/objects.php @@ -1,5 +1,7 @@ ['filter' => FILTER_CALLBACK, 'options' => 'Locale::tryFromDomain'], - 'new' => ['filter' => FILTER_CALLBACK, 'options' => 'GenericPage::checkEmptySet'] + 'domain' => ['filter' => FILTER_CALLBACK, 'options' => 'Aowow\Locale::tryFromDomain'], + 'new' => ['filter' => FILTER_CALLBACK, 'options' => 'Aowow\GenericPage::checkEmptySet'] ); private $isCustom = false; @@ -189,7 +191,7 @@ class ProfilePage extends GenericPage if (!$this->isCustom) $id = "'".$this->profile[0].'.'.urlencode($this->profile[1]).'.'.urlencode($this->profile[2])."'"; - $power = new StdClass(); + $power = new \StdClass(); if ($this->subject && !$this->subject->error && $this->subject->isVisibleToUser()) { $n = $this->subject->getField('name'); diff --git a/pages/profiler.php b/pages/profiler.php index 934234a8..7b057719 100644 --- a/pages/profiler.php +++ b/pages/profiler.php @@ -1,5 +1,7 @@ ['filter' => FILTER_CALLBACK, 'options' => 'Locale::tryFromDomain']]; + protected $_get = ['domain' => ['filter' => FILTER_CALLBACK, 'options' => 'Aowow\Locale::tryFromDomain']]; private $powerTpl = '$WowheadPower.registerQuest(%d, %d, %s);'; @@ -1042,7 +1044,7 @@ class QuestPage 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), Lang::FMT_RAW); diff --git a/pages/quests.php b/pages/quests.php index 6ddc9431..3172a09d 100644 --- a/pages/quests.php +++ b/pages/quests.php @@ -1,5 +1,7 @@ ['filter' => FILTER_CALLBACK, 'options' => 'ScreenshotPage::checkCoords'], - 'screenshotalt' => ['filter' => FILTER_CALLBACK, 'options' => 'GenericPage::checkTextBlob'] + 'coords' => ['filter' => FILTER_CALLBACK, 'options' => 'Aowow\ScreenshotPage::checkCoords'], + 'screenshotalt' => ['filter' => FILTER_CALLBACK, 'options' => 'Aowow\GenericPage::checkTextBlob'] ); public function __construct($pageCall, $pageParam) @@ -350,7 +352,7 @@ class ScreenshotPage extends GenericPage } // check if file is an image; allow jpeg, png - $finfo = new finfo(FILEINFO_MIME); // fileInfo appends charset information and other nonsense + $finfo = new \finfo(FILEINFO_MIME); // fileInfo appends charset information and other nonsense $mime = $finfo->file($_FILES['screenshotfile']['tmp_name']); if (preg_match('/^image\/(png|jpe?g)/i', $mime, $m)) $isPNG = $m[0] == 'image/png'; diff --git a/pages/search.php b/pages/search.php index fc60c1b1..af8bf81c 100644 --- a/pages/search.php +++ b/pages/search.php @@ -1,5 +1,7 @@ ['filter' => FILTER_CALLBACK, 'options' => 'GenericPage::checkIntArray'], - 'wtv' => ['filter' => FILTER_CALLBACK, 'options' => 'GenericPage::checkIntArray'], - 'slots' => ['filter' => FILTER_CALLBACK, 'options' => 'GenericPage::checkIntArray'], - 'type' => ['filter' => FILTER_CALLBACK, 'options' => 'GenericPage::checkInt'], - 'json' => ['filter' => FILTER_CALLBACK, 'options' => 'GenericPage::checkEmptySet'], - 'opensearch' => ['filter' => FILTER_CALLBACK, 'options' => 'GenericPage::checkEmptySet'] + 'wt' => ['filter' => FILTER_CALLBACK, 'options' => 'Aowow\GenericPage::checkIntArray'], + 'wtv' => ['filter' => FILTER_CALLBACK, 'options' => 'Aowow\GenericPage::checkIntArray'], + 'slots' => ['filter' => FILTER_CALLBACK, 'options' => 'Aowow\GenericPage::checkIntArray'], + 'type' => ['filter' => FILTER_CALLBACK, 'options' => 'Aowow\GenericPage::checkInt'], + 'json' => ['filter' => FILTER_CALLBACK, 'options' => 'Aowow\GenericPage::checkEmptySet'], + 'opensearch' => ['filter' => FILTER_CALLBACK, 'options' => 'Aowow\GenericPage::checkEmptySet'] ); private $maxResults = 500; @@ -235,6 +237,8 @@ class SearchPage extends GenericPage header(MIME_TYPE_JSON); exit(Util::toJSON([$this->search, [], []])); } + + exit; } public function display(string $override = '') : never @@ -245,6 +249,8 @@ class SearchPage extends GenericPage $this->displayExtra([$this, 'generateOpenSearch'], MIME_TYPE_OPENSEARCH); else if ($this->searchMask & SEARCH_TYPE_JSON) $this->displayExtra([$this, 'generateJsonSearch']); + + exit; } // !note! dear reader, if you ever try to generate a string, that is to be evaled by JS, NEVER EVER terminate with a \n ..... $totalHoursWasted +=2; diff --git a/pages/skill.php b/pages/skill.php index 6902d9c1..efcf6a7f 100644 --- a/pages/skill.php +++ b/pages/skill.php @@ -1,5 +1,7 @@ ['filter' => FILTER_CALLBACK, 'options' => 'GenericPage::checkEmptySet']]; + protected $_get = ['playlist' => ['filter' => FILTER_CALLBACK, 'options' => 'Aowow\GenericPage::checkEmptySet']]; private $cat = 0; diff --git a/pages/sounds.php b/pages/sounds.php index 244d1117..6263e45d 100644 --- a/pages/sounds.php +++ b/pages/sounds.php @@ -1,5 +1,7 @@ ['filter' => FILTER_CALLBACK, 'options' => 'Locale::tryFromDomain']]; + protected $_get = ['domain' => ['filter' => FILTER_CALLBACK, 'options' => 'Aowow\Locale::tryFromDomain']]; private $difficulties = []; private $firstRank = 0; @@ -1279,7 +1281,7 @@ class SpellPage extends GenericPage protected function generateTooltip() { - $power = new StdClass(); + $power = new \StdClass(); if (!$this->subject->error) { [$tooltip, $ttSpells] = $this->subject->renderTooltip(); diff --git a/pages/spells.php b/pages/spells.php index 632a9004..f4068c9a 100644 --- a/pages/spells.php +++ b/pages/spells.php @@ -1,5 +1,7 @@ 'latest-videos', 12 => 'most-comments', 13 => 'missing-screenshots' ); - protected $_get = ['rss' => ['filter' => FILTER_CALLBACK, 'options' => 'GenericPage::checkEmptySet']]; + protected $_get = ['rss' => ['filter' => FILTER_CALLBACK, 'options' => 'Aowow\GenericPage::checkEmptySet']]; private $page = ''; private $rss = false; diff --git a/pages/zone.php b/pages/zone.php index 7ff8ad9a..7ee4bec5 100644 --- a/pages/zone.php +++ b/pages/zone.php @@ -1,5 +1,7 @@ 'mapper-generic' ), 'som' => $somData, - 'mapperData' => [$mapFile => new stdClass()] + 'mapperData' => [$mapFile => new \StdClass()] ); } } diff --git a/prQueue b/prQueue index 9680aa89..92166883 100755 --- a/prQueue +++ b/prQueue @@ -1,6 +1,8 @@ #!/usr/bin/env php $us) - if (in_array('TrSubScripts', class_uses($us))) + if (in_array(__NAMESPACE__.'\TrSubScripts', class_uses($us))) $us->assignGenerators($name); self::evalOpts(); } - public static function getSubScripts(string $invoker = '') : generator + public static function getSubScripts(string $invoker = '') : \Generator { foreach (self::$setupScriptRefs as [$src, $name, $ref]) if (!$invoker || $src == $invoker) @@ -473,10 +475,10 @@ class CLISetup try { - $iterator = new RecursiveDirectoryIterator(self::$srcDir); - $iterator->setFlags(RecursiveDirectoryIterator::SKIP_DOTS); + $iterator = new \RecursiveDirectoryIterator(self::$srcDir); + $iterator->setFlags(\RecursiveDirectoryIterator::SKIP_DOTS); - foreach (new RecursiveIteratorIterator($iterator, RecursiveIteratorIterator::SELF_FIRST) as $path) + foreach (new \RecursiveIteratorIterator($iterator, \RecursiveIteratorIterator::SELF_FIRST) as $path) { $_ = CLI::nicePath($path->getPathname()); self::$mpqFiles[strtolower($_)] = $_; @@ -484,7 +486,7 @@ class CLISetup CLI::write('indexing game data from '.self::$srcDir.' for first time use... done!', CLI::LOG_INFO); } - catch (UnexpectedValueException $e) + catch (\UnexpectedValueException $e) { CLI::write('- mpqData dir '.self::$srcDir.' does not exist', CLI::LOG_ERROR); return false; @@ -601,7 +603,7 @@ class CLISetup return true; } - public static function searchGlobalStrings(string $pattern) : Generator + public static function searchGlobalStrings(string $pattern) : \Generator { if (!self::$gsFiles) return; diff --git a/setup/tools/clisetup/account.us.php b/setup/tools/clisetup/account.us.php index 10e5e3eb..a9d97421 100644 --- a/setup/tools/clisetup/account.us.php +++ b/setup/tools/clisetup/account.us.php @@ -1,5 +1,7 @@ getPath()); diff --git a/setup/tools/clisetup/siteconfig.us.php b/setup/tools/clisetup/siteconfig.us.php index fe692b78..17dcf0c8 100644 --- a/setup/tools/clisetup/siteconfig.us.php +++ b/setup/tools/clisetup/siteconfig.us.php @@ -1,5 +1,7 @@ genSteps[self::M_SPAWNS][self::GEN_IDX_DEST_INFO][0][0] . $zoneId . '.png'; @@ -769,7 +771,7 @@ CLISetup::registerSetup("build", new class extends SetupScript $this->success = false; } - private function buildSubZones(GdImage $resMap, int $wmaId, Locale $loc) : void + private function buildSubZones(\GdImage $resMap, int $wmaId, Locale $loc) : void { foreach ($this->wmOverlays[$wmaId] as &$row) { @@ -806,7 +808,7 @@ CLISetup::registerSetup("build", new class extends SetupScript } } - private function generateOverlay(int $wmaId, string $basePath) : ?GdImage + private function generateOverlay(int $wmaId, string $basePath) : ?\GdImage { if (!isset($this->wmOverlays[$wmaId])) return null; diff --git a/setup/tools/filegen/img-talentcalc.ss.php b/setup/tools/filegen/img-talentcalc.ss.php index 77908825..e9ac6a6d 100644 --- a/setup/tools/filegen/img-talentcalc.ss.php +++ b/setup/tools/filegen/img-talentcalc.ss.php @@ -1,5 +1,7 @@ $x & (1 << $i)))) $excludes[$type][$i + 1] = $ids; - $buff = "g_excludes = ".Util::toJSON($excludes ?: (new StdClass)).";\n"; + $buff = "g_excludes = ".Util::toJSON($excludes ?: (new \StdClass)).";\n"; if (!CLISetup::writeFile('datasets/quick-excludes', $buff)) $this->success = false; diff --git a/setup/tools/filegen/realmmenu.ss.php b/setup/tools/filegen/realmmenu.ss.php index 08180f9d..ca4ae692 100644 --- a/setup/tools/filegen/realmmenu.ss.php +++ b/setup/tools/filegen/realmmenu.ss.php @@ -1,5 +1,7 @@ success; } - private function compileTexture(string $ttField, int $searchMask, int $tabIdx) : ?GDImage + private function compileTexture(string $ttField, int $searchMask, int $tabIdx) : ?\GdImage { $icons = DB::Aowow()->SelectCol( 'SELECT ic.`name` AS "iconString" diff --git a/setup/tools/filegen/tooltips.ss.php b/setup/tools/filegen/tooltips.ss.php index b6782247..9330dc75 100644 --- a/setup/tools/filegen/tooltips.ss.php +++ b/setup/tools/filegen/tooltips.ss.php @@ -1,5 +1,7 @@ $fileSize) { CLI::write('file '.$fileName.' is corrupted/incomplete'.$debugStr, CLI::LOG_ERROR); - return; + return null; } if ($header['type'] == 1) @@ -117,16 +119,19 @@ else { CLI::write('file '.$fileName.' has unsupported type'.$debugStr, CLI::LOG_ERROR); - return; + return null; } return $img; } // uncompressed - function icfb1($width, $height, $palette, $data) + function icfb1(int $width, int $height, $palette, string $data) : ?\GdImage { $img = imagecreatetruecolor($width, $height); + if (!$img) + return null; + imagesavealpha($img, true); imagealphablending($img, false); @@ -148,15 +153,18 @@ } // DXTC - function icfb2($width, $height, $data, $alphaBits, $alphaType) + function icfb2(int $width, int $height, string $data, int $alphaBits, int $alphaType) : ?\GdImage { if (!in_array($alphaBits * 10 + $alphaType, [0, 10, 41, 81, 87, 88])) { CLI::write('unsupported compression type', CLI::LOG_ERROR); - return; + return null; } $img = imagecreatetruecolor($width, $height); + if (!$img) + return null; + imagesavealpha($img, true); imagealphablending($img, false); @@ -304,9 +312,12 @@ } // plain - function icfb3($width, $height, $data) + function icfb3(int $width, int $height, string $data) : ?\GdImage { $img = imagecreatetruecolor($width, $height); + if (!$img) + return null; + $i = unpack("V*", $data); for ($y = 0; $y < $height; $y++) diff --git a/setup/tools/setupScript.class.php b/setup/tools/setupScript.class.php index a6f9896d..c26ef13e 100644 --- a/setup/tools/setupScript.class.php +++ b/setup/tools/setupScript.class.php @@ -1,5 +1,7 @@ query('UPDATE ?_'.$this->getName().' SET ?a WHERE id = ?d', $data, $id); } - catch (Exception $e) + catch (\Exception $e) { trigger_error('custom data for entry #'.$id.': '.$e->getMessage(), E_USER_ERROR); $ok = false; @@ -239,7 +241,7 @@ trait TrImageProcessor // prefer manually converted PNG files (as the imagecreatefromblp-script has issues with some formats) // alpha channel issues observed with locale deDE Hilsbrad and Elwynn - maps // see: https://github.com/Kanma/BLPConverter - private function loadImageFile(string $path, ?bool &$noSrc = false) : ?GdImage + private function loadImageFile(string $path, ?bool &$noSrc = false) : ?\GdImage { $result = null; $noSrc = false; @@ -264,7 +266,7 @@ trait TrImageProcessor return $result; } - private function writeImageFile(GdImage $src, string $outFile, array $srcDims, array $destDims) : bool + private function writeImageFile(\GdImage $src, string $outFile, array $srcDims, array $destDims) : bool { $success = false; $outRes = imagecreatetruecolor($destDims['w'], $destDims['h']); @@ -313,7 +315,7 @@ trait TrComplexImage { use TrImageProcessor { TrImageProcessor::writeImageFile as _writeImageFile; } - private function writeImageFile(GdImage $src, string $outFile, int $w, int $h) : bool + private function writeImageFile(\GdImage $src, string $outFile, int $w, int $h) : bool { $srcDims = array( 'x' => 0, @@ -331,7 +333,7 @@ trait TrComplexImage return $this->_writeImageFile($src, $outFile, $srcDims, $destDims); } - private function createAlphaImage(int $w, int $h) : ?GdImage + private function createAlphaImage(int $w, int $h) : ?\GdImage { $img = imagecreatetruecolor($w, $h); if (!$img) @@ -351,7 +353,7 @@ trait TrComplexImage return $img; } - private function assembleImage(string $baseName, array $tileData, int $destW, int $destH) : ?GdImage + private function assembleImage(string $baseName, array $tileData, int $destW, int $destH) : ?\GdImage { $dest = imagecreatetruecolor($destW, $destH); if (!$dest) @@ -487,7 +489,7 @@ abstract class SetupScript CLI::write('[build] created '.$newDirs.' extra paths'); // load DBC files - if (!in_array('TrDBCcopy', class_uses($this))) + if (!in_array(__NAMESPACE__.'\TrDBCcopy', class_uses($this))) { foreach ($this->getRequiredDBCs() as $req) { diff --git a/setup/tools/sqlgen/achievement.ss.php b/setup/tools/sqlgen/achievement.ss.php index 3baee0b9..fc5d54be 100644 --- a/setup/tools/sqlgen/achievement.ss.php +++ b/setup/tools/sqlgen/achievement.ss.php @@ -1,5 +1,7 @@ + announcements as $id => $data): ?> @@ -7,4 +9,4 @@ foreach ($this->announcements as $id => $data): \ No newline at end of file +?> diff --git a/template/bricks/article.tpl.php b/template/bricks/article.tpl.php index cbc1c5a0..9df83fbf 100644 --- a/template/bricks/article.tpl.php +++ b/template/bricks/article.tpl.php @@ -1,3 +1,5 @@ + + article)): ?> diff --git a/template/bricks/book.tpl.php b/template/bricks/book.tpl.php index 9557013e..2116874e 100644 --- a/template/bricks/book.tpl.php +++ b/template/bricks/book.tpl.php @@ -1,3 +1,5 @@ + + pageText)): ?> diff --git a/template/bricks/contribute.tpl.php b/template/bricks/contribute.tpl.php index 8e602a46..a4387dd9 100644 --- a/template/bricks/contribute.tpl.php +++ b/template/bricks/contribute.tpl.php @@ -1,3 +1,5 @@ + + contribute)): ?> @@ -9,7 +11,7 @@ if (!empty($this->contribute)):
localizedBrick('contrib', Lang::getLocale()); + $this->localizedBrick('contrib'); ?>
diff --git a/template/bricks/filter.tpl.php b/template/bricks/filter.tpl.php index 8d96eae6..0cbc279c 100644 --- a/template/bricks/filter.tpl.php +++ b/template/bricks/filter.tpl.php @@ -1,3 +1,5 @@ + +