diff --git a/includes/class.achievement.php b/includes/class.achievement.php
index ef6498c8..c0ea8e62 100644
--- a/includes/class.achievement.php
+++ b/includes/class.achievement.php
@@ -54,7 +54,7 @@ class Achievement extends BaseType
{
$result = DB::Aowow()->Select('SELECT * FROM ?_achievementcriteria WHERE `refAchievement` = ? ORDER BY `order` ASC', $this->Id);
if (!$result)
- return array();
+ return [];
if (is_array($result[0]))
$this->criteria = $result;
@@ -108,8 +108,8 @@ class Achievement extends BaseType
return $this->tooltip;
$criteria = $this->getCriteria();
- $tmp = array();
- $rows = array();
+ $tmp = [];
+ $rows = [];
$i = 0;
foreach ($criteria as $_row)
{
@@ -224,7 +224,7 @@ class AchievementList extends BaseTypeList
//"rewards":[[11,137],[3,138]] [what, entry] 3:item; 11:title, 6:spell(unused)
if (!empty($acv->template['rewardIds']))
{
- $rewards = array();
+ $rewards = [];
$rewIds = explode(" ", $acv->template['rewardIds']);
foreach ($rewIds as $rewId)
$rewards[] = ($rewId > 0 ? "[3,".$rewId."]" : ($rewId < 0 ? "[11,".-$rewId."]" : NULL));
@@ -322,7 +322,7 @@ class AchievementList extends BaseTypeList
$series |= DB::Aowow()->SelectCell('SELECT Id FROM ?_achievement WHERE parent = ?d', $acv->Id);
// set rewards
- $rewardIds = array();
+ $rewardIds = [];
if ($rStr = $acv->template['reward_loc0'])
{
diff --git a/includes/class.community.php b/includes/class.community.php
index d18a1739..7560c61c 100644
--- a/includes/class.community.php
+++ b/includes/class.community.php
@@ -15,14 +15,14 @@ class CommunityContent
private function getComments($type, $typeId)
{
// comments
- return array();
+ return [];
}
private function getVideos($type, $typeId)
{
return DB::Aowow()->Query("
SELECT
- v.Id,
+ v.Id,
a.displayName AS user,
v.date,
v.videoId,
diff --git a/includes/class.database.php b/includes/class.database.php
index 90808537..150b66cf 100644
--- a/includes/class.database.php
+++ b/includes/class.database.php
@@ -11,9 +11,9 @@ if (!defined('AOWOW_REVISION'))
class DB
{
- private static $interfaceCache = array();
- private static $optionsCache = array();
- private static $connectionCache = array();
+ private static $interfaceCache = [];
+ private static $optionsCache = [];
+ private static $connectionCache = [];
private static function createConnectSyntax(&$options)
{
diff --git a/includes/class.item.php b/includes/class.item.php
index 539d45af..e9f36d65 100644
--- a/includes/class.item.php
+++ b/includes/class.item.php
@@ -176,7 +176,7 @@ class Item extends BaseType
rand: >0: randomPropId; <0: randomSuffixId
interactive (set to place javascript/anchors to manipulate level and ratings or link to filters (static tooltips vs popup tooltip))
*/
- public function createTooltip($enhance = array(), $interactive = false)
+ public function createTooltip($enhance = [], $interactive = false)
{
if (!empty($this->tooltip))
return $this->tooltip;
@@ -404,7 +404,7 @@ class Item extends BaseType
);
}
else
- $enhance['gems'] = array();
+ $enhance['gems'] = [];
// zero fill empty sockets
$sockCount = $this->json['nsockets'] + (isset($enhance['sock']) ? 1 : 0);
@@ -561,14 +561,14 @@ class Item extends BaseType
// todo: aaaand another one for optimization
$craftSpell = new Spell($this->template['spellid_2']);
$craftItem = new Item($craftSpell->template["effect1CreateItemId"]);
- $reagentItems = array();
+ $reagentItems = [];
for ($i = 1; $i <= 8; $i++)
if ($craftSpell->template["reagent".$i])
$reagentItems[$craftSpell->template["reagent".$i]] = $craftSpell->template["reagentCount".$i];
$reagents = new ItemList(array(['i.entry', array_keys($reagentItems)]));
- $reqReag = array();
+ $reqReag = [];
foreach ($reagents->container as $r)
$reqReag[] = ''.$r->name.' ('.$reagentItems[$r->Id].')';
@@ -580,7 +580,7 @@ class Item extends BaseType
// Item Set
$tmpX = '';
- $pieces = array();
+ $pieces = [];
$itemset = DB::Aowow()->selectRow('
SELECT
*
@@ -605,7 +605,7 @@ class Item extends BaseType
}
$tmpX .= implode('
', $pieces);
- $x .= '
'.Util::localizedString($itemset, 'name').' (0/'.$num.')';
+ $x .= '
'.Util::localizedString($itemset, 'name').' (0/'.$num.')';
if ($itemset['skillID']) // bonus requires skill to activate
{
@@ -843,7 +843,7 @@ class Item extends BaseType
if ($this->json['socketbonus'] > 0)
{
$enh = DB::Aowow()->selectRow('SELECT * FROM ?_itemenchantment WHERE Id = ?;', $this->json['socketbonus']);
- $this->json['socketbonusstat'] = array();
+ $this->json['socketbonusstat'] = [];
$socketbonusstat = Util::parseItemEnchantment($enh);
foreach ($socketbonusstat as $k => $v)
$this->json['socketbonusstat'][] = '"'.$k.'":'.$v;
@@ -874,8 +874,8 @@ class Item extends BaseType
foreach ($subItems as $k => $sI)
{
- $jsonEquip = array();
- $jsonText = array();
+ $jsonEquip = [];
+ $jsonText = [];
for ($i = 1; $i < 6; $i++)
{
if ($sI['enchantId'.$i] <= 0)
diff --git a/includes/class.spell.php b/includes/class.spell.php
index 52cc3615..ffab7e28 100644
--- a/includes/class.spell.php
+++ b/includes/class.spell.php
@@ -655,7 +655,7 @@ class Spell extends BaseType
public function getTooltip()
{
// get reagents
- $reagents = array();
+ $reagents = [];
for ($j = 1; $j <= 8; $j++)
{
if($this->template['reagent'.$j] <= 0)
@@ -670,7 +670,7 @@ class Spell extends BaseType
$reagents = array_reverse($reagents);
// get tools
- $tools = array();
+ $tools = [];
for ($i = 1; $i <= 2; $i++)
{
// Tools
diff --git a/includes/kernel.php b/includes/kernel.php
index f82b9640..ddd94e2a 100644
--- a/includes/kernel.php
+++ b/includes/kernel.php
@@ -6,17 +6,23 @@ if (!defined('AOWOW_REVISION'))
ini_set('serialize_precision', 4);
-require('includes/defines.php');
-require('config/config.php');
+require 'includes/defines.php';
+require 'config/config.php';
$e = !!$AoWoWconf['debug'] ? (E_ALL & ~(E_DEPRECATED|E_USER_DEPRECATED|E_STRICT)) : 0;
error_reporting($e);
-require('includes/Smarty-2.6.26/libs/Smarty.class.php'); // Libraray: http://www.smarty.net/
-require('includes/DbSimple/Generic.php'); // Libraray: http://en.dklab.ru/lib/DbSimple
-require('includes/utilities.php');
-require('includes/class.user.php');
-require('includes/class.database.php');
+require 'includes/Smarty-2.6.26/libs/Smarty.class.php'; // Libraray: http://www.smarty.net/
+require 'includes/DbSimple/Generic.php'; // Libraray: http://en.dklab.ru/lib/DbSimple
+require 'includes/utilities.php';
+require 'includes/class.user.php';
+require 'includes/class.database.php';
+
+// autoload any List-Classes
+spl_autoload_register(function ($class) {
+ if (!strpos($class, 'Mysql') && !strpos($class, 'Filter'))
+ require 'includes/class.'.strtr($class, ['List' => '']).'.php';
+});
// debug: measure execution times
Util::execTime(!!$AoWoWconf['debug']);
@@ -24,7 +30,7 @@ Util::execTime(!!$AoWoWconf['debug']);
// Setup Smarty
class Smarty_AoWoW extends Smarty
{
- var $config = array();
+ var $config = [];
public function __construct($config)
{
@@ -87,7 +93,7 @@ class Smarty_AoWoW extends Smarty
if (!$cache)
return false;
- $cache = explode("\n", $cache);
+ $cache = explode("\n", $cache, 2);
@list($time, $rev) = explode(' ', $cache[0]);
$expireTime = $time + $this->config['page']['cacheTimer'];
diff --git a/includes/utilities.php b/includes/utilities.php
index 0f2e4030..663fbc1c 100644
--- a/includes/utilities.php
+++ b/includes/utilities.php
@@ -134,7 +134,7 @@ class BaseTypeList
public function getListviewData()
{
- $data = array();
+ $data = [];
// no extra queries required, just call recursively
foreach ($this->container as $type)
$data[] = $type->getListviewData();
@@ -177,7 +177,7 @@ class Lang
public static function load($loc)
{
- if (@(require 'localization/locale_'.$loc.'.php')) !== 1
+ if (@(require 'localization/locale_'.$loc.'.php') !== 1)
die('File for localization '.$loc.' not found.');
foreach ($lang as $k => $v)
@@ -187,7 +187,7 @@ class Lang
// todo: expand
public static function getInfoBoxForFlags($flags)
{
- $tmp = array();
+ $tmp = [];
if ($flags & CUSTOM_DISABLED)
$tmp[] = ''.self::$main['disabled'].'';
@@ -216,7 +216,7 @@ class Lang
{
$stanceMask &= 0x1F84F213E; // clamp to available stances/forms..
- $tmp = array();
+ $tmp = [];
$i = 1;
while ($stanceMask)
@@ -236,7 +236,7 @@ class Lang
{
$schoolMask &= 0x7F; // clamp to available schools..
- $tmp = array();
+ $tmp = [];
$i = 1;
while ($schoolMask)
@@ -262,7 +262,7 @@ class Lang
if (!$classMask) // no restrictions left
return false;
- $tmp = array();
+ $tmp = [];
$i = 1;
while ($classMask)
@@ -288,7 +288,7 @@ class Lang
if (!$raceMask) // no restrictions left (we don't display 'both factions')
return false;
- $tmp = array();
+ $tmp = [];
$side = 0;
$i = 1;
@@ -955,7 +955,7 @@ class Util
public static function parseTime($sec)
{
- $time = array();
+ $time = [];
if ($sec >= 3600 * 24)
{
@@ -990,7 +990,7 @@ class Util
public static function formatTime($base, $short = false)
{
$s = self::parseTime($base / 1000);
- $fmt = array();
+ $fmt = [];
if ($short)
{
@@ -1159,7 +1159,7 @@ class Util
if (!$enchant || empty($enchant))
return false;
- $jsonStats = array();
+ $jsonStats = [];
for ($h = 1; $h <= 3; $h++)
{
if (isset($amountOverride)) // itemSuffixes have dynamic amount
@@ -1210,7 +1210,7 @@ class Util
}
// check if we use these mods
- $return = array();
+ $return = [];
foreach ($jsonStats as $k => $v)
{
if ($str = Util::$itemMods[$k])
diff --git a/localization/locale_eses.php b/localization/locale_eses.php
index f83be62e..061cd7b1 100644
--- a/localization/locale_eses.php
+++ b/localization/locale_eses.php
@@ -109,8 +109,8 @@ $lang = array(
'resetForm' => "Reiniciar formulario",
'refineSearch' => "Sugerencia: Refina tu búsqueda llendo a una subcategoría.",
),
- 'error' => array(),
- 'account' => array(),
+ 'error' => [],
+ 'account' => [],
'talent' => array(
'talentCalc' => "Calculadora de talentos",
'petCalc' => "Calculadora de mascotas",
diff --git a/localization/locale_frfr.php b/localization/locale_frfr.php
index cf145371..d5aa13ce 100644
--- a/localization/locale_frfr.php
+++ b/localization/locale_frfr.php
@@ -114,7 +114,7 @@ $lang = array(
'goStart' => "Return to the homepage",
'goForum' => "Feedback forum",
),
- 'account' => array(),
+ 'account' => [],
'achievement' => array(
'achievements' => "hauts faits",
'criteria' => "Critères",
diff --git a/localization/locale_ruru.php b/localization/locale_ruru.php
index b768c029..35b69570 100644
--- a/localization/locale_ruru.php
+++ b/localization/locale_ruru.php
@@ -114,7 +114,7 @@ $lang = array(
'goStart' => "Return to the homepage",
'goForum' => "Feedback forum",
),
- 'account' => array(),
+ 'account' => [],
'achievement' => array(
'achievements' => "достижения",
'criteria' => "Критерий",
diff --git a/opensearch.php b/opensearch.php
index 75296fc8..4007ae37 100644
--- a/opensearch.php
+++ b/opensearch.php
@@ -25,11 +25,6 @@ if (!defined('AOWOW_REVISION'))
// Ajax can't handle debug, force to false
$AoWoWconf['debug'] = false;
-require_once('includes/kernel.php');
-// require_once('includes/class.filter.php');
-require_once('includes/class.item.php');
-require_once('includes/class.spell.php');
-
header("Content-type: text/javascript");
// Receives requests from at least 3 characters (although vovhede and 1 character)
@@ -42,14 +37,14 @@ if (strlen($_query) < 3)
echo "[\"".str_replace('"', '\"', $_query)."\", [\n";
// Item Comparison search
-$foundItems = array();
-$foundSets = array();
-$pieceAssoc = array();
+$foundItems = [];
+$foundSets = [];
+$pieceAssoc = [];
if ($_type & 0x10) {
$rows = DB::Aowow()->Select('
SELECT
- itemsetID as id,
+ id,
refSetId as idbak,
CONCAT(7 - quality, ?#) as name,
minlevel,
@@ -70,9 +65,10 @@ if ($_type & 0x10) {
);
// parse items, create class-array
+
foreach ($rows as $row)
{
- $row['pieces'] = array();
+ $row['pieces'] = [];
for ($i=1; $i<=10; $i++)
{
if ($row['item'.$i])
@@ -83,7 +79,7 @@ if ($_type & 0x10) {
unset($row['item'.$i]);
}
}
- $row['classes'] = array();
+ $row['classes'] = [];
for ($i = 1; $i < 12; $i++)
if ($row['reqclass'] & (1 << $i))
$row['classes'][] = $i + 1;
@@ -94,17 +90,17 @@ if ($_type & 0x10) {
}
if ($_type & 0x18) { // 3 | 4
$conditions = array(
- array('i.class', 'IN', [2, 4]),
- empty($foundItems) ? array(User::$localeId ? 'name_loc'.User::$localeId : 'name', 'LIKE', '%'.$_query.'%') : array('i.entry', 'IN', $foundItems)
+ array('i.class', [2, 4]),
+ empty($foundItems) ? array(User::$localeId ? 'name_loc'.User::$localeId : 'name', $_query) : array('i.entry', $foundItems)
);
$iList = new ItemList($conditions);
- $items = array();
- foreach ($iList->itemList as $id => $item)
+ $items = [];
+ foreach ($iList->container as $id => $item)
{
$item->getJsonStats($pieceAssoc);
- $stats = array();
+ $stats = [];
foreach ($item->json as $k => $v)
{
if (!$v && $k != 'classs' && $k != 'subclass')
@@ -123,7 +119,7 @@ if ($_type & 0x18) { // 3 | 4
$i = 0;
foreach ($foundSets as $single)
{
- $set = array();
+ $set = [];
foreach ($single as $key => $value)
{
if ((is_numeric($value) && $value == 0) || $value === "false")
diff --git a/pages/compare.php b/pages/compare.php
index 035df95d..ffd05b07 100644
--- a/pages/compare.php
+++ b/pages/compare.php
@@ -3,14 +3,11 @@
if (!defined('AOWOW_REVISION'))
die('invalid access');
-require 'includes/class.item.php';
-require 'includes/class.spell.php';
-require 'includes/class.faction.php'; // items may require a faction to use/own
-
$pageData = array(
'summary' => '[]',
'items' => []
);
+$compareString = '';
// prefer $_GET over $_COOKIE
if (!empty($_GET['compare']))
@@ -21,11 +18,11 @@ else if (!empty($_COOKIE['compare_groups']))
if ($compareString)
{
$sets = explode(";", $compareString);
- $items = array();
+ $items = [];
foreach ($sets as $set)
{
$itemsting = explode(":", $set);
- $outString = array();
+ $outString = [];
foreach ($itemsting as $substring)
{
$params = explode(".", $substring);
@@ -37,14 +34,14 @@ if ($compareString)
// MATCH() AGAINST() for integers would be nice...
$res = DB::Aowow()->SelectRow(
- "SELECT itemsetID FROM ?_itemset WHERE
+ "SELECT Id FROM ?_itemset WHERE
item1 = ? OR item2 = ? OR item3 = ? OR item4 = ? OR item5 = ? OR
item6 = ? OR item7 = ? OR item8 = ? OR item9 = ? OR item10 = ?",
(int)$params[0], (int)$params[0], (int)$params[0], (int)$params[0], (int)$params[0], (int)$params[0], (int)$params[0], (int)$params[0], (int)$params[0], (int)$params[0]
);
if ($res)
- $piecesAssoc[(int)$params[0]] = $res['itemsetID'];
+ $piecesAssoc[(int)$params[0]] = $res['Id'];
}
$outSet[] = "[".implode(',', $outString)."]";
}
@@ -54,7 +51,7 @@ if ($compareString)
foreach ($iList->container as $item)
{
$item->getJsonStats();
- $stats = array();
+ $stats = [];
foreach ($item->json as $k => $v)
$stats[] = is_numeric($v) || $v[0] == "{" ? '"'.$k.'":'.$v.'' : '"'.$k.'":"'.$v.'"';
diff --git a/pages/error.php b/pages/error.php
index a4142d93..79b7cf0d 100644
--- a/pages/error.php
+++ b/pages/error.php
@@ -3,7 +3,15 @@
if (!defined('AOWOW_REVISION'))
die('illegal access');
+// Announcements
+$announcements = DB::Aowow()->Select('SELECT * FROM ?_announcements WHERE flags & 0x10 AND (page = "*")');
+foreach ($announcements as $k => $v)
+ $announcements[$k]['text'] = Util::localizedString($v, 'text');
+
+
$smarty->assign('lang', array_merge(Lang::$main, Lang::$error));
+$smarty->assign('announcements', $announcements);
+$smarty->assign('mysql', DB::Aowow()->getStatistics());
$smarty->display('error.tpl');
exit();
diff --git a/pages/item.php b/pages/item.php
index a742c5c4..f53e6cce 100644
--- a/pages/item.php
+++ b/pages/item.php
@@ -5,14 +5,10 @@ if (!defined('AOWOW_REVISION'))
// require 'includes/game.php';
-require 'includes/class.spell.php';
// require 'includes/allquests.php';
-require 'includes/class.item.php';
// require 'includes/allnpcs.php';
// require 'includes/allobjects.php';
// require 'includes/class.community.php'; // wo dont need those .. yet
-// require 'includes/class.achievement.php';
-require 'includes/class.faction.php';
$id = intVal($pageParam);
$item = new Item($id);
@@ -30,7 +26,7 @@ else if (isset($_GET['power']))
Util::powerUseLocale($_GET['domain']);
- $enh = array();
+ $enh = [];
$itemString = $id;
if (isset($_GET['rand']))
@@ -54,7 +50,8 @@ else if (isset($_GET['power']))
$itemString .= 's';
}
- $cacheKeyTooltip = implode(':', [CACHETYPE_TOOLTIP, TYPE_ITEM, $itemString, -1, User::$localeId]);
+ // : are not accepted in filenames
+ $cacheKeyTooltip = implode('_', [CACHETYPE_TOOLTIP, TYPE_ITEM, str_replace(':', ',', $itemString), -1, User::$localeId]);
// output json for tooltips
if (!$smarty->loadCache($cacheKeyTooltip, $x))
@@ -93,7 +90,7 @@ if(!$smarty->loadCache($cacheKeyPage, $item))
$drops_cr = drop('creature_loot_template', $item['entry']);
if($drops_cr)
{
- $item['droppedby'] = array();
+ $item['droppedby'] = [];
foreach($drops_cr as $lootid => $drop)
{
$rows = $DB->select('
@@ -127,9 +124,9 @@ if(!$smarty->loadCache($cacheKeyPage, $item))
$drops_go = drop('gameobject_loot_template', $item['entry']);
if($drops_go)
{
- $item['containedinobject'] = array();
- $item['minedfromobject'] = array();
- $item['gatheredfromobject'] = array();
+ $item['containedinobject'] = [];
+ $item['minedfromobject'] = [];
+ $item['gatheredfromobject'] = [];
foreach($drops_go as $lootid => $drop)
{
// Сундуки
@@ -195,21 +192,21 @@ if(!$smarty->loadCache($cacheKeyPage, $item))
);
if($rows_soldby)
{
- $item['soldby'] = array();
+ $item['soldby'] = [];
foreach($rows_soldby as $i => $row)
{
- $item['soldby'][$i] = array();
+ $item['soldby'][$i] = [];
$item['soldby'][$i] = creatureinfo2($row);
$item['soldby'][$i]['stock'] = ($row['stock'] == 0 ? -1 : $row['stock']);
if($row['ExtendedCost'])
{
- $item['soldby'][$i]['cost'] = array();
+ $item['soldby'][$i]['cost'] = [];
$extcost = $DB->selectRow('SELECT * FROM ?_item_extended_cost WHERE extendedcostID=?d LIMIT 1', abs($row['ExtendedCost']));
if($extcost['reqhonorpoints'])
$item['soldby'][$i]['cost']['honor'] = ($row['A'] == 1 ? 1 : -1) * $extcost['reqhonorpoints'];
if($extcost['reqarenapoints'])
$item['soldby'][$i]['cost']['arena'] = $extcost['reqarenapoints'];
- $item['soldby'][$i]['cost']['items'] = array();
+ $item['soldby'][$i]['cost']['items'] = [];
for ($j=1;$j<=5;$j++)
if(($extcost['reqitem'.$j]>0) and ($extcost['reqitemcount'.$j]>0))
{
@@ -242,7 +239,7 @@ if(!$smarty->loadCache($cacheKeyPage, $item))
);
if($rows_qr)
{
- $item['objectiveof'] = array();
+ $item['objectiveof'] = [];
foreach($rows_qr as $row)
$item['objectiveof'][] = GetQuestInfo($row, 0xFFFFFF);
}
@@ -262,7 +259,7 @@ if(!$smarty->loadCache($cacheKeyPage, $item))
);
if($rows_qp)
{
- $item['providedfor'] = array();
+ $item['providedfor'] = [];
foreach($rows_qp as $row)
$item['providedfor'][] = GetQuestInfo($row, 0xFFFFFF);
}
@@ -293,7 +290,7 @@ if(!$smarty->loadCache($cacheKeyPage, $item))
);
if($rows_qrw)
{
- $item['rewardof'] = array();
+ $item['rewardof'] = [];
foreach($rows_qrw as $row)
$item['rewardof'][] = GetQuestInfo($row, 0xFFFFFF);
}
@@ -319,7 +316,7 @@ if(!$smarty->loadCache($cacheKeyPage, $item))
if($rows_qm)
{
if (!isset($item['rewardof']))
- $item['rewardof'] = array();
+ $item['rewardof'] = [];
foreach($rows_qm as $row)
$item['rewardof'][] = GetQuestInfo($row, 0xFFFFFF);
}
@@ -332,7 +329,7 @@ if(!$smarty->loadCache($cacheKeyPage, $item))
$drops_cii = drop('item_loot_template', $item['entry']);
if($drops_cii)
{
- $item['containedinitem'] = array();
+ $item['containedinitem'] = [];
foreach($drops_cii as $lootid => $drop)
{
$rows = $DB->select('
@@ -366,7 +363,7 @@ if(!$smarty->loadCache($cacheKeyPage, $item))
$drops_pp = drop('pickpocketing_loot_template', $item['entry']);
if($drops_pp)
{
- $item['pickpocketingloot'] = array();
+ $item['pickpocketingloot'] = [];
foreach($drops_pp as $lootid => $drop)
{
$rows = $DB->select('
@@ -400,7 +397,7 @@ if(!$smarty->loadCache($cacheKeyPage, $item))
$drops_sk = drop('skinning_loot_template', $item['entry']);
if($drops_sk)
{
- $item['skinnedfrom'] = array();
+ $item['skinnedfrom'] = [];
foreach($drops_sk as $lootid => $drop)
{
$rows = $DB->select('
@@ -438,7 +435,7 @@ if(!$smarty->loadCache($cacheKeyPage, $item))
$drops_pr = drop('prospecting_loot_template', $item['entry']);
if($drops_pr)
{
- $item['prospectingloot'] = array();
+ $item['prospectingloot'] = [];
foreach($drops_pr as $lootid => $drop)
{
$rows = $DB->select('
@@ -474,7 +471,7 @@ if(!$smarty->loadCache($cacheKeyPage, $item))
$drops_de = drop('disenchant_loot_template', $item['entry']);
if($drops_de)
{
- $item['disenchantedfrom'] = array();
+ $item['disenchantedfrom'] = [];
foreach($drops_de as $lootid => $drop)
{
$rows = $DB->select('
@@ -529,7 +526,7 @@ if(!$smarty->loadCache($cacheKeyPage, $item))
);
if($rows_cpi)
{
- $item['canbeplacedin'] = array();
+ $item['canbeplacedin'] = [];
foreach($rows_cpi as $row)
$item['canbeplacedin'][] = iteminfo2($row, 0);
}
@@ -557,11 +554,11 @@ if(!$smarty->loadCache($cacheKeyPage, $item))
);
if($rows_r)
{
- $item['reagentfor'] = array();
+ $item['reagentfor'] = [];
$quality = 1;
foreach($rows_r as $i=>$row)
{
- $item['reagentfor'][$i] = array();
+ $item['reagentfor'][$i] = [];
$item['reagentfor'][$i]['entry'] = $row['spellID'];
$item['reagentfor'][$i]['name'] = $row['spellname_loc'.$_SESSION['locale']];
$item['reagentfor'][$i]['school'] = $row['resistancesID'];
@@ -604,7 +601,7 @@ if(!$smarty->loadCache($cacheKeyPage, $item))
);
if($rows_cf)
{
- $item['createdfrom'] = array();
+ $item['createdfrom'] = [];
foreach($rows_cf as $row)
{
$skillrow = $DB->selectRow('
@@ -625,7 +622,7 @@ if(!$smarty->loadCache($cacheKeyPage, $item))
$drops_fi = drop('fishing_loot_template', $item['entry']);
if($drops_fi)
{
- $item['fishedin'] = array();
+ $item['fishedin'] = [];
foreach($drops_fi as $lootid => $drop)
{
// Обычные локации
@@ -672,7 +669,7 @@ if(!$smarty->loadCache($cacheKeyPage, $item))
$drops_mi = drop('milling_loot_template', $item['entry']);
if($drops_mi)
{
- $item['milledfrom'] = array();
+ $item['milledfrom'] = [];
foreach($drops_mi as $lootid => $drop)
{
$rows = $DB->select('
@@ -725,14 +722,14 @@ if(!$smarty->loadCache($cacheKeyPage, $item))
);
if($rows_cf)
{
- $item['currencyfor'] = array();
+ $item['currencyfor'] = [];
foreach($rows_cf as $row)
{
$id=$row['entry'];
- $item['currencyfor'][$id] = array();
+ $item['currencyfor'][$id] = [];
$item['currencyfor'][$id] = iteminfo2($row);
$item['currencyfor'][$id]['maxcount'] = $row['drop-maxcount'];
- $item['currencyfor'][$id]['cost'] = array();
+ $item['currencyfor'][$id]['cost'] = [];
if($row['BuyPrice']>0)
$npc['sells'][$id]['cost']['money'] = $row['BuyPrice'];
@@ -740,7 +737,7 @@ if(!$smarty->loadCache($cacheKeyPage, $item))
$item['currencyfor'][$id]['cost']['honor'] =/* ($row['A']==1?1:-1)* */$row['reqhonorpoints']; //FIXME_BUG
if($row['reqarenapoints']>0)
$item['currencyfor'][$id]['cost']['arena'] = $row['reqarenapoints'];
- $item['currencyfor'][$id]['cost']['items'] = array();
+ $item['currencyfor'][$id]['cost']['items'] = [];
for($j=1; $j<=5; $j++)
if(($row['reqitem'.$j]>0) and ($row['reqitemcount'.$j]>0))
{
@@ -758,7 +755,7 @@ if(!$smarty->loadCache($cacheKeyPage, $item))
$drops_sp = drop('spell_loot_template', $item['entry']);
if($drops_sp)
{
- $item['containedinspell'] = array();
+ $item['containedinspell'] = [];
foreach($drops_sp as $lootid => $drop)
{
$rows = $DB->select('
@@ -799,7 +796,7 @@ if(!$smarty->loadCache($cacheKeyPage, $item))
);
if($rows)
{
- $item['criteria_of'] = array();
+ $item['criteria_of'] = [];
foreach($rows as $row)
{
allachievementsinfo2($row['id']);
@@ -809,7 +806,7 @@ if(!$smarty->loadCache($cacheKeyPage, $item))
$item['color'] = colorByQuality($item['quality']);
- $smarty->loadCache($cacheKeyPage, $item);
+ $smarty->saveCache($cacheKeyPage, $item);
}
$page = array(
diff --git a/pages/spell.php b/pages/spell.php
index f696324f..26ed6c84 100644
--- a/pages/spell.php
+++ b/pages/spell.php
@@ -4,12 +4,9 @@ if (!defined('AOWOW_REVISION'))
die('illegal access');
-require 'includes/class.spell.php';
-require 'includes/class.item.php';
// require 'includes/allnpcs.php';
// require 'includes/allquests.php';
// require 'includes/class.community.php'; // not needed .. yet
-// require 'includes/class.achievement.php';
$id = intVal($pageParam);
$spell = new Spell($id);
@@ -108,7 +105,7 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData))
$spell['info'] = $spellObj->parseText('description');
// Инструменты
- $spell['tools'] = array();
+ $spell['tools'] = [];
$i=0;
for ($j=1;$j<=2;$j++)
{
@@ -125,7 +122,7 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData))
}
// Реагенты
- $spell['reagents'] = array();
+ $spell['reagents'] = [];
$i=0;
for ($j=1;$j<=8;$j++)
{
@@ -150,7 +147,7 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData))
// Iterate through all effects:
$i=0;
- $spell['effect'] = array();
+ $spell['effect'] = [];
for ($j=1;$j<=3;$j++)
{
if($row['effect'.$j.'Id'] > 0)
@@ -171,7 +168,7 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData))
//case 106: // "Summon Object (slot 3)" // 0 spells; skipping
//case 107: // "Summon Object (slot 4)" // 0 spells; skipping
{
- $spell['effect'][$i]['object'] = array();
+ $spell['effect'][$i]['object'] = [];
$spell['effect'][$i]['object']['entry'] = $row['effect'.$j.'MiscValue'];
$spell['effect'][$i]['object']['name'] = DB::Aowow()->selectCell("SELECT name FROM gameobject_template WHERE entry = ? LIMIT 1", $spell['effect'][$i]['object']['entry']).' ('.$spell['effect'][$i]['object']['entry'].')';
break;
@@ -240,7 +237,7 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData))
// Создает вещь:
if($row['effect'.$j.'Id'] == 24)
{
- $spell['effect'][$i]['item'] = array();
+ $spell['effect'][$i]['item'] = [];
$spell['effect'][$i]['item']['entry'] = $row['effect'.$j.'CreateItemId'];
$tmpRow = allitemsinfo($spell['effect'][$i]['item']['entry'], 0);
$spell['effect'][$i]['item']['name'] = $tmpRow['name'];
@@ -253,7 +250,7 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData))
// Создает спелл
if($row['effect'.$j.'TriggerSpell'] > 0)
{
- $spell['effect'][$i]['spell'] = array();
+ $spell['effect'][$i]['spell'] = [];
$spell['effect'][$i]['spell']['entry'] = $row['effect'.$j.'TriggerSpell'];
$spell['effect'][$i]['spell']['name'] = DB::Aowow()->selectCell('SELECT spellname_loc'.User::$localeId.' FROM ?_spell WHERE spellID = ?d LIMIT 1', $spell['effect'][$i]['spell']['entry']);
allspellsinfo($spell['effect'][$i]['spell']['entry']);
@@ -292,14 +289,14 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData))
);
if($seealso)
{
- $spell['seealso'] = array();
+ $spell['seealso'] = [];
foreach($seealso as $i => $row)
$spell['seealso'][] = spellinfo2($row);
unset($seealso);
}
*/
// Кто обучает этому спеллу
- $spell['taughtbynpc'] = array();
+ $spell['taughtbynpc'] = [];
// Список тренеров, обучающих нужному спеллу
/*
$trainers = DB::Aowow()->selectCol('SELECT entry FROM npc_trainer WHERE spell = ?d', $spell['entry']);
@@ -328,7 +325,7 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData))
}
*/
// Список книг/рецептов, просто обучающих спеллу
- $spell['taughtbyitem'] = array();
+ $spell['taughtbyitem'] = [];
/*
$taughtbyitem = DB::Aowow()->select('
SELECT ?#, c.entry
@@ -407,7 +404,7 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData))
);
if($taughtbyquest)
{
- $spell['taughtbyquest'] = array();
+ $spell['taughtbyquest'] = [];
foreach($taughtbyquest as $i=>$questrow)
$spell['taughtbyquest'][] = GetQuestInfo($questrow, 0xFFFFFF);
unset($taughtbyquest);
@@ -486,7 +483,7 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData))
);
if($usedbynpc)
{
- $spell['usedbynpc'] = array();
+ $spell['usedbynpc'] = [];
foreach($usedbynpc as $i=>$row)
$spell['usedbynpc'][] = creatureinfo2($row);
unset($usedbynpc);
@@ -510,7 +507,7 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData))
);
if($usedbyitem)
{
- $spell['usedbyitem'] = array();
+ $spell['usedbyitem'] = [];
foreach($usedbyitem as $i => $row)
$spell['usedbyitem'][] = iteminfo2($row, 0);
unset($usedbyitem);
@@ -526,7 +523,7 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData))
);
if($usedbyitemset)
{
- $spell['usedbyitemset'] = array();
+ $spell['usedbyitemset'] = [];
foreach($usedbyitemset as $i => $row)
$spell['usedbyitemset'][] = itemsetinfo2($row);
unset($usedbyitemset);
@@ -550,7 +547,7 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData))
);
if($questreward)
{
- $spell['questreward'] = array();
+ $spell['questreward'] = [];
foreach($questreward as $i => $row)
$spell['questreward'][] = GetQuestInfo($row, 0xFFFFFF);
unset($questreward);
@@ -569,7 +566,7 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData))
FROM ?_spellicons s, ?_achievementcriteria c, ?_achievement a
LEFT JOIN (?_zones z) ON a.map != -1 AND a.map = z.mapID
WHERE
- a.icon = s.id
+ a.iconId = s.id
AND a.id = c.refAchievement
AND c.type IN (?a)
AND c.value1 = ?d
@@ -588,7 +585,7 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData))
);
if($rows)
{
- $spell['criteria_of'] = array();
+ $spell['criteria_of'] = [];
foreach($rows as $row)
{
allachievementsinfo2($row['id']);
diff --git a/pages/title.php b/pages/title.php
index 5233e293..875ef7b0 100644
--- a/pages/title.php
+++ b/pages/title.php
@@ -4,12 +4,6 @@ if (!defined('AOWOW_REVISION'))
die('illegal access');
-require 'includes/class.title.php';
-require 'includes/class.spell.php';
-require 'includes/class.achievement.php';
-require 'includes/class.item.php';
-require 'includes/class.quest.php';
-require 'includes/class.worldevent.php';
require 'includes/class.community.php';
$Id = intVal($pageParam);
@@ -106,10 +100,16 @@ $smarty->updatePageVars(array(
'typeId' => $Id
));
+// Announcements
+$announcements = DB::Aowow()->Select('SELECT * FROM ?_announcements WHERE flags & 0x10 AND (page = "title" OR page = "*")');
+foreach ($announcements as $k => $v)
+ $announcements[$k]['text'] = Util::localizedString($v, 'text');
+
$smarty->assign('community', CommunityContent::getAll(TYPE_TITLE, $Id)); // comments, screenshots, videos
$smarty->assign('lang', array_merge(Lang::$main));
$smarty->assign('data', $pageData);
$smarty->assign('mysql', DB::Aowow()->getStatistics());
+$smarty->assign('announcements', $announcements);
$smarty->display('title.tpl');
?>
diff --git a/pages/titles.php b/pages/titles.php
index 890bc9a1..e9d5f1cb 100644
--- a/pages/titles.php
+++ b/pages/titles.php
@@ -4,10 +4,6 @@ if (!defined('AOWOW_REVISION'))
die('illegal access');
-require 'includes/class.title.php';
-require 'includes/class.achievement.php';
-require 'includes/class.quest.php';
-
$cat = Util::extractURLParams($pageParam)[0];
$path = [0, 10];
$cacheKey = implode('_', [CACHETYPE_PAGE, TYPE_TITLE, -1, isset($cat) ? $cat : -1, User::$localeId]);
@@ -85,6 +81,11 @@ if (!$smarty->loadCache($cacheKey, $pageData))
$smarty->saveCache($cacheKey, $pageData);
}
+// Announcements
+$announcements = DB::Aowow()->Select('SELECT * FROM ?_announcements WHERE flags & 0x10 AND (page = "titles" OR page = "*")');
+foreach ($announcements as $k => $v)
+ $announcements[$k]['text'] = Util::localizedString($v, 'text');
+
$page = array(
'tab' => 0, // for g_initHeader($tab)
'title' => implode(" - ", $title),
@@ -95,6 +96,7 @@ $smarty->updatePageVars($page);
$smarty->assign('lang', Lang::$main);
$smarty->assign('data', $pageData);
$smarty->assign('mysql', DB::Aowow()->getStatistics());
+$smarty->assign('announcements', $announcements);
$smarty->display('titles.tpl');
?>
diff --git a/search.php b/search.php
index 0639da3e..934f6bf7 100644
--- a/search.php
+++ b/search.php
@@ -1,7 +1,7 @@
suche ausm compare heraus (profiler evtl auch noch)
else if &opensearch
@@ -23,17 +23,17 @@
if (isset($_GET['opensearch']) || isset($_GET['json']))
{
- require('opensearch.php');
+ require 'opensearch.php';
die();
}
// Необходима функция iteminfo
-require_once('includes/game.php');
-require_once('includes/allspells.php');
-require_once('includes/allquests.php');
-require_once('includes/allitems.php');
-require_once('includes/allnpcs.php');
-require_once('includes/allobjects.php');
+require 'includes/game.php';
+require 'includes/allspells.php';
+require 'includes/allquests.php';
+require 'includes/allitems.php';
+require 'includes/allnpcs.php';
+require 'includes/allobjects.php';
// Настраиваем Smarty ;)
$smarty->config_load($conf_file, 'search');
@@ -52,7 +52,7 @@ global $npc_cols;
global $spell_cols;
// Массив всего найденного
-$found = array();
+$found = [];
// Ищем вещи:
if($_SESSION['locale']>0)
@@ -216,7 +216,7 @@ else
$smarty->assign('found', $found);
// Параметры страницы
- $page = array();
+ $page = [];
// Номер вкладки меню
$page['tab'] = 0;
// Заголовок страницы
diff --git a/setup/tools/dataset-assembler/enchants.php b/setup/tools/dataset-assembler/enchants.php
index 8e3b39e0..5f497365 100644
--- a/setup/tools/dataset-assembler/enchants.php
+++ b/setup/tools/dataset-assembler/enchants.php
@@ -50,17 +50,14 @@ if (!defined('AOWOW_REVISION'))
},
*/
- require 'includes/class.spell.php';
- require 'includes/class.item.php';
-
set_time_limit(300);
// from g_item_slots: 13:"One-Hand", 26:"Ranged", 17:"Two-Hand",
$slotPointer = [13, 17, 26, 26, 13, 17, 17, 13, 17, null, 17, null, null, 13, null, 13, null, null, null, null, 17];
$locales = [LOCALE_EN, LOCALE_FR, LOCALE_DE, LOCALE_ES, LOCALE_RU];
$enchantSpells = new SpellList([['effect1Id', '=', '53'], ['name_loc0', 'NOT LIKE', 'QA%']]); // enchantItemPermanent && !qualityAssurance
- $castItems = array();
- $jsonEnchants = array();
+ $castItems = [];
+ $jsonEnchants = [];
// check directory-structure
foreach (Util::$localeStrings as $dir)
@@ -73,7 +70,7 @@ if (!defined('AOWOW_REVISION'))
{
User::useLocale($lId);
- $enchantsOut = array();
+ $enchantsOut = [];
foreach ($enchantSpells->spellList as $spl)
{
diff --git a/setup/tools/dataset-assembler/gems.php b/setup/tools/dataset-assembler/gems.php
index 48c51d7d..101d71f0 100644
--- a/setup/tools/dataset-assembler/gems.php
+++ b/setup/tools/dataset-assembler/gems.php
@@ -24,8 +24,6 @@ if (!defined('AOWOW_REVISION'))
// sketchy, but should work
// Id < 36'000 || ilevel < 70 ? BC : WOTLK
- require 'includes/class.spell.php';
-
$gemQuery = "
SELECT
it.entry,
diff --git a/setup/tools/dataset-assembler/glyphs.php b/setup/tools/dataset-assembler/glyphs.php
index 93685940..f0e2c980 100644
--- a/setup/tools/dataset-assembler/glyphs.php
+++ b/setup/tools/dataset-assembler/glyphs.php
@@ -115,8 +115,6 @@ if (!defined('AOWOW_REVISION'))
41108 => 'Lay on Hands'
);
- require 'includes/class.spell.php';
-
set_time_limit(300);
$glyphList = DB::Aowow()->Select($queryGlyphs);
@@ -142,7 +140,7 @@ if (!defined('AOWOW_REVISION'))
$spl = new Spell($pop['glyphEffect']);
- if ($spl->template['effect1Id'] != 6)
+ if ($spl->template['effect1Id'] != 6 && $spl->template['effect2Id'] != 6 && $spl->template['effect3Id'] != 6)
continue;
if ($pop['itemId'] == 42958) // Crippling Poison has no skillLine.. oO => hardcode
diff --git a/setup/tools/dataset-assembler/itemsets.php b/setup/tools/dataset-assembler/itemsets.php
index 5b4a3b5c..777b12dd 100644
--- a/setup/tools/dataset-assembler/itemsets.php
+++ b/setup/tools/dataset-assembler/itemsets.php
@@ -55,8 +55,6 @@ if (!defined('AOWOW_REVISION'))
... onwards!
*/
- require 'includes/class.spell.php';
-
$setList = DB::Aowow()->Select('SELECT * FROM ?_itemset ORDER BY refSetId DESC');
$locales = [LOCALE_EN, LOCALE_FR, LOCALE_DE, LOCALE_ES, LOCALE_RU];
$jsonBonus = [];
diff --git a/setup/tools/dataset-assembler/talents.php b/setup/tools/dataset-assembler/talents.php
index 171bc6f6..53cac8f3 100644
--- a/setup/tools/dataset-assembler/talents.php
+++ b/setup/tools/dataset-assembler/talents.php
@@ -24,8 +24,6 @@ if (!defined('AOWOW_REVISION'))
// t - array of talent-objects
// f - array:int [pets only] creatureFamilies in that category
- require 'includes/class.spell.php';
-
function buildTree($class)
{
global $petFamIcons; // h8!
diff --git a/template/error.tpl b/template/error.tpl
index 0937bbb4..a56a18de 100644
--- a/template/error.tpl
+++ b/template/error.tpl
@@ -3,7 +3,11 @@