mirror of
https://github.com/Sarjuuk/aowow.git
synced 2025-11-29 15:58:16 +08:00
moved config to databse (except databse credentials of course)
added overlooked changes to template or typos
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@@ -1,5 +1,5 @@
|
||||
# smarty cache
|
||||
/cache/*index.html
|
||||
/cache/*.tmp
|
||||
/cache/*.php
|
||||
|
||||
# generated files
|
||||
|
||||
@@ -46,23 +46,4 @@ $AoWoWconf['characters'][0] = array(
|
||||
// add other realms if necessary
|
||||
// $AoWoWconf['characters'][] = [];
|
||||
|
||||
// -- Site Configuration --
|
||||
$AoWoWconf['ttl'] = 1 * MINUTE; // default: 60 - time to live for RSS
|
||||
$AoWoWconf['cacheTimer'] = 1 * WEEK; // default: 60 * 60 * 7 - Time to keep cache in seconds (Default: 1 week)
|
||||
$AoWoWconf['sessionTimeout'] = 1 * HOUR; // default: 60 * 60 - non-permanent session times out in time() + X
|
||||
$AoWoWconf['loginFailTime'] = 15 * MINUTE; // default: 15 * 60 - how long an account is closed after exceeding above limit
|
||||
$AoWoWconf['loginFailCount'] = 5; // default: 5 - how often invalid passwords are tollerated
|
||||
$AoWoWconf['defaultLimit'] = 300; // default: 300 - Limit of some SQL queries
|
||||
$AoWoWconf['searchLimit'] = 500; // default: 500 - Limit of some SQL queries
|
||||
$AoWoWconf['quickSearchLimit'] = 15; // default: 10 - Limit of some SQL queries
|
||||
$AoWoWconf['debug'] = true; // default: false - Disable cache, show smarty console panel, enable sql-errors
|
||||
$AoWoWconf['map_grouping'] = 0; // default: 1 - Map object grouping factor. Meters = 10^param. 0:disabled; 1|2|3:enabled (1:recommended)
|
||||
$AoWoWconf['register'] = true; // Allow account creating
|
||||
$AoWoWconf['boardUrl'] = "http://www.wowhead.com/forums?board="; // a javascript thing..
|
||||
// $AoWoWconf['contactEmail'] = "feedback@aowow.org"; // ah well...
|
||||
$AoWoWconf['name'] = 'Aowow Database Viewer (ADV)'; // Title of the website
|
||||
$AoWoWconf['shortName'] = 'Aowow'; // used in Feeds
|
||||
$AoWoWconf['battlegroup'] = 'Pure Pwnage'; // pretend, we belong to a battlegroup to satisfy profiler-related Jscripts; region can be determined from realmlist.timezone
|
||||
$AoWoWconf['maintenance'] = false; // brb gnomes say hi
|
||||
|
||||
?>
|
||||
|
||||
4
data.php
4
data.php
@@ -43,7 +43,7 @@ foreach ($datasets as $data)
|
||||
case 'statistics':
|
||||
if (file_exists('datasets/'.$data))
|
||||
echo file_get_contents('datasets/'.$data);
|
||||
else if ($AoWoWconf['debug'])
|
||||
else if (CFG_DEBUG)
|
||||
echo "alert('could not fetch static data: ".$data."');";
|
||||
echo "\n\n";
|
||||
break;
|
||||
@@ -67,7 +67,7 @@ foreach ($datasets as $data)
|
||||
echo file_get_contents('datasets/enus/'.$data.$params);
|
||||
else if (file_exists('datasets/'.$data.$params))
|
||||
echo file_get_contents('datasets/'.$data.$params);
|
||||
else if ($AoWoWconf['debug'])
|
||||
else if (CFG_DEBUG)
|
||||
echo "alert('could not fetch static data: ".$data.$params." for locale: ".User::$localeString."');";
|
||||
echo "\n\n";
|
||||
break;
|
||||
|
||||
@@ -8,18 +8,6 @@ ini_set('serialize_precision', 4);
|
||||
|
||||
require 'includes/defines.php';
|
||||
require 'config/config.php';
|
||||
|
||||
$e = !!$AoWoWconf['debug'] ? (E_ALL & ~(E_DEPRECATED|E_USER_DEPRECATED|E_STRICT)) : 0;
|
||||
error_reporting($e);
|
||||
|
||||
define('STATIC_URL', substr('http://'.$_SERVER['SERVER_NAME'].strtr($_SERVER['SCRIPT_NAME'], ['index.php' => '']), 0, -1).'/static'); // points js to images & scripts (change here if you want to use a separate subdomain)
|
||||
define('HOST_URL', substr('http://'.$_SERVER['SERVER_NAME'].strtr($_SERVER['SCRIPT_NAME'], ['index.php' => '']), 0, -1)); // points js to executable files
|
||||
|
||||
define('SQL_LIMIT_NONE', 0);
|
||||
define('SQL_LIMIT_SEARCH', $AoWoWconf['searchLimit']);
|
||||
define('SQL_LIMIT_QUCKSEARCH', $AoWoWconf['quickSearchLimit']);
|
||||
define('SQL_LIMIT_DEFAULT', $AoWoWconf['defaultLimit']);
|
||||
|
||||
require 'includes/libs/Smarty-2.6.26/libs/Smarty.class.php'; // Libraray: http://www.smarty.net/
|
||||
require 'includes/libs/DbSimple/Generic.php'; // Libraray: http://en.dklab.ru/lib/DbSimple (using mysqli variant: https://bitbucket.org/brainreaver/dbsimple/src)
|
||||
require 'includes/utilities.php';
|
||||
@@ -38,8 +26,6 @@ spl_autoload_register(function ($class) {
|
||||
}
|
||||
});
|
||||
|
||||
// debug: measure execution times
|
||||
Util::execTime(!!$AoWoWconf['debug']);
|
||||
|
||||
// Setup DB-Wrapper
|
||||
if (!empty($AoWoWconf['aowow']['db']))
|
||||
@@ -57,12 +43,31 @@ foreach ($AoWoWconf['characters'] as $realm => $charDBInfo)
|
||||
if (!empty($charDBInfo))
|
||||
DB::load(DB_CHARACTERS + $realm, $charDBInfo);
|
||||
|
||||
|
||||
// load config to constants
|
||||
$sets = DB::Aowow()->select('SELECT `key` AS ARRAY_KEY, intValue as i, strValue as s FROM ?_config');
|
||||
foreach ($sets as $k => $v)
|
||||
define('CFG_'.strtoupper($k), $v['i'] ? intVal($v['i']) : $v['s']);
|
||||
|
||||
define('STATIC_URL', substr('http://'.$_SERVER['SERVER_NAME'].strtr($_SERVER['SCRIPT_NAME'], ['index.php' => '']), 0, -1).'/static'); // points js to images & scripts (change here if you want to use a separate subdomain)
|
||||
define('HOST_URL', substr('http://'.$_SERVER['SERVER_NAME'].strtr($_SERVER['SCRIPT_NAME'], ['index.php' => '']), 0, -1)); // points js to executable files
|
||||
|
||||
$e = CFG_DEBUG ? (E_ALL & ~(E_DEPRECATED | E_USER_DEPRECATED | E_STRICT)) : 0;
|
||||
error_reporting($e);
|
||||
|
||||
|
||||
// debug: measure execution times
|
||||
Util::execTime(CFG_DEBUG);
|
||||
|
||||
|
||||
// create Template-Object
|
||||
$smarty = new SmartyAoWoW($AoWoWconf);
|
||||
|
||||
|
||||
// attach template to util (yes bandaid, shut up and code me a fix)
|
||||
Util::$pageTemplate = &$smarty;
|
||||
|
||||
|
||||
// Setup Session
|
||||
if (isset($_COOKIE[COOKIE_AUTH]))
|
||||
{
|
||||
@@ -90,9 +95,11 @@ else
|
||||
|
||||
User::setLocale();
|
||||
|
||||
|
||||
// assign lang/locale, userdata, characters and custom profiles
|
||||
User::assignUserToTemplate($smarty, true);
|
||||
|
||||
|
||||
// parse page-parameters .. sanitize before use!
|
||||
@list($str, $trash) = explode('&', $_SERVER['QUERY_STRING'], 2);
|
||||
@list($pageCall, $pageParam) = explode('=', $str, 2);
|
||||
|
||||
@@ -54,7 +54,7 @@ abstract class BaseType
|
||||
{
|
||||
$where = [];
|
||||
$linking = ' AND ';
|
||||
$limit = SQL_LIMIT_DEFAULT;
|
||||
$limit = CFG_SQL_LIMIT_DEFAULT;
|
||||
$className = get_class($this);
|
||||
|
||||
if (!$this->queryBase || $conditions === null)
|
||||
|
||||
@@ -11,12 +11,12 @@ class GameObjectList extends BaseType
|
||||
public static $type = TYPE_OBJECT;
|
||||
public static $brickFile = 'object';
|
||||
|
||||
protected $queryBase = 'SELECT *, o.id AS ARRAY_KEY FROM ?_objects o';
|
||||
protected $queryBase = 'SELECT o.*, o.id AS ARRAY_KEY FROM ?_objects o';
|
||||
protected $queryOpts = array(
|
||||
'o' => [['ft']],
|
||||
'ft' => ['j' => ['?_factiontemplate ft ON ft.id = o.faction', true], 's' => ', ft.*'],
|
||||
'qr' => ['j' => ['gameobject_questrelation qr ON qr.id = o.id', true]], // started by GO
|
||||
'ir' => ['j' => ['gameobject_involvedrelation ir ON ir.id = o.id', true]], // ends at GO
|
||||
'o' => [['ft', 'qr']],
|
||||
'ft' => ['j' => ['?_factiontemplate ft ON ft.id = o.faction', true], 's' => ', ft.factionId, ft.A, ft.H'],
|
||||
'qr' => ['j' => ['gameobject_questrelation qr ON qr.id = o.id', true], 's' => ', qr.quest', 'g' => 'o.id'], // started by GO
|
||||
'ir' => ['j' => ['gameobject_involvedrelation ir ON ir.id = o.id', true]] // ends at GO
|
||||
);
|
||||
|
||||
public function __construct($conditions = [], $applyFilter = false)
|
||||
@@ -32,7 +32,6 @@ class GameObjectList extends BaseType
|
||||
// unpack miscInfo:
|
||||
$curTpl['lootStack'] = [];
|
||||
$curTpl['spells'] = [];
|
||||
$curTpl['spellFocusId'] = 0;
|
||||
|
||||
if (in_array($curTpl['type'], [OBJECT_GOOBER, OBJECT_RITUAL, OBJECT_SPELLCASTER, OBJECT_FLAGSTAND, OBJECT_FLAGDROP, OBJECT_AURA_GENERATOR, OBJECT_TRAP]))
|
||||
$curTpl['spells'] = array_combine(['onUse', 'onSuccess', 'aura', 'triggered'], [$curTpl['onUseSpell'], $curTpl['onSuccessSpell'], $curTpl['auraSpell'], $curTpl['triggeredSpell']]);
|
||||
@@ -87,6 +86,10 @@ class GameObjectList extends BaseType
|
||||
|
||||
if (!empty($this->curTpl['reqSkill']))
|
||||
$data[$this->id]['skill'] = $this->curTpl['reqSkill'];
|
||||
|
||||
if ($this->curTpl['quest'])
|
||||
$data[$this->id]['hasQuests'] = 1;
|
||||
|
||||
}
|
||||
|
||||
return $data;
|
||||
|
||||
@@ -54,7 +54,7 @@ class User
|
||||
$_SERVER['REMOTE_ADDR']
|
||||
);
|
||||
// explicit " > "; incremented first, checked after
|
||||
self::$bannedIP = $ipBan && $ipBan['count'] > $GLOBALS['AoWoWconf']['loginFailCount'] && $ipBan['unbanDateIP'] > time();
|
||||
self::$bannedIP = $ipBan && $ipBan['count'] > CFG_FAILED_AUTH_COUNT && $ipBan['unbanDateIP'] > time();
|
||||
|
||||
$query = !$userId ? null : DB::Aowow()->SelectRow('
|
||||
SELECT
|
||||
@@ -176,7 +176,7 @@ class User
|
||||
|
||||
if (self::$timeout > 0)
|
||||
DB::Aowow()->query('UPDATE ?_account SET timeout = ?d WHERE id = ?d',
|
||||
time() + $GLOBALS['AoWoWconf']['sessionTimeout'],
|
||||
time() + CFG_SESSION_TIMEOUT_DELAY,
|
||||
self::$id
|
||||
);
|
||||
}
|
||||
|
||||
@@ -5,22 +5,20 @@ if (!defined('AOWOW_REVISION'))
|
||||
|
||||
class SmartyAoWoW extends Smarty
|
||||
{
|
||||
private $config = [];
|
||||
private $jsGlobals = [];
|
||||
private $notices = [];
|
||||
|
||||
public function __construct($config)
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
$cwd = str_replace("\\", "/", getcwd());
|
||||
|
||||
$this->config = $config;
|
||||
$this->template_dir = $cwd.'/template/';
|
||||
$this->compile_dir = $cwd.'/cache/template/';
|
||||
$this->config_dir = $cwd.'/configs/';
|
||||
$this->cache_dir = $cwd.'/cache/';
|
||||
$this->debugging = $config['debug'];
|
||||
$this->debugging = CFG_DEBUG;
|
||||
$this->left_delimiter = '{';
|
||||
$this->right_delimiter = '}';
|
||||
$this->caching = false; // Total Cache, this site does not work
|
||||
@@ -36,7 +34,7 @@ class SmartyAoWoW extends Smarty
|
||||
'redButtons' => [],
|
||||
'headIcons' => [], // icons in front of title
|
||||
);
|
||||
$this->assign('appName', $config['name']);
|
||||
$this->assign('appName', CFG_NAME);
|
||||
$this->assign('AOWOW_REVISION', AOWOW_REVISION);
|
||||
}
|
||||
|
||||
@@ -271,7 +269,7 @@ class SmartyAoWoW extends Smarty
|
||||
$cache = explode("\n", $cache);
|
||||
|
||||
@list($time, $rev) = explode(' ', $cache[0]);
|
||||
$expireTime = $time + $this->config['cacheTimer'];
|
||||
$expireTime = $time + CFG_CACHE_DECAY;
|
||||
if ($expireTime <= time() || $rev < AOWOW_REVISION)
|
||||
return false;
|
||||
|
||||
@@ -1751,7 +1749,7 @@ class Util
|
||||
if (!$struct)
|
||||
return $lv;
|
||||
|
||||
$items = new ItemList(array(['i.id', $struct[1]], SQL_LIMIT_NONE));
|
||||
$items = new ItemList(array(['i.id', $struct[1]], CFG_SQL_LIMIT_NONE));
|
||||
$items->addGlobalsToJscript(Util::$pageTemplate, GLOBALINFO_SELF | GLOBALINFO_RELATED);
|
||||
$foo = $items->getListviewData();
|
||||
|
||||
@@ -1852,7 +1850,7 @@ class Util
|
||||
return $lv;
|
||||
}
|
||||
|
||||
public static function getLootSource($itemId, $maxResults = SQL_LIMIT_DEFAULT)
|
||||
public static function getLootSource($itemId, $maxResults = CFG_SQL_LIMIT_DEFAULT)
|
||||
{
|
||||
if (!$itemId)
|
||||
return [];
|
||||
|
||||
@@ -20,9 +20,9 @@ if (version_compare(PHP_VERSION, '5.4.0') <= 0)
|
||||
$smarty->brb();
|
||||
}
|
||||
|
||||
if ($AoWoWconf['maintenance'] && !User::isInGroup(U_GROUP_EMPLOYEE))
|
||||
if (CFG_MAINTENANCE && !User::isInGroup(U_GROUP_EMPLOYEE))
|
||||
$smarty->brb();
|
||||
else if ($AoWoWconf['maintenance'] && User::isInGroup(U_GROUP_EMPLOYEE))
|
||||
else if (CFG_MAINTENANCE && User::isInGroup(U_GROUP_EMPLOYEE))
|
||||
$smarty->internalNotice(U_GROUP_EMPLOYEE, 'Maintenance mode enabled!');
|
||||
|
||||
switch ($pageCall)
|
||||
|
||||
@@ -46,16 +46,16 @@ function signin()
|
||||
if (!$ipBan) // no entry exists; set count to 1
|
||||
DB::Aowow()->query('INSERT INTO ?_account_bannedIPs VALUES (?, 0, 1, FROM_UNIXTIME(?))',
|
||||
$_SERVER['REMOTE_ADDR'],
|
||||
time() + $GLOBALS['AoWoWconf']['loginFailTime']
|
||||
time() + CFG_FAILED_AUTH_EXCLUSION
|
||||
);
|
||||
else if ($ipBan['unbanDate'] < time()) // ip has accumulated counts but time expired; reset count to 1
|
||||
DB::Aowow()->query('INSERT IGNORE INTO ?_account_bannedIPs VALUES (?, 0, 1, ?)',
|
||||
$_SERVER['REMOTE_ADDR'],
|
||||
time() + $GLOBALS['AoWoWconf']['loginFailTime']
|
||||
time() + CFG_FAILED_AUTH_EXCLUSION
|
||||
);
|
||||
else // entry already exists; increment count
|
||||
DB::Aowow()->query('UPDATE ?_account_bannedIPs SET count = count + 1, unbanDate = FROM_UNIXTIME(?) WHERE ip = ?',
|
||||
time() + $GLOBALS['AoWoWconf']['loginFailTime'],
|
||||
time() + CFG_FAILED_AUTH_EXCLUSION,
|
||||
$_SERVER['REMOTE_ADDR']
|
||||
);
|
||||
|
||||
@@ -76,7 +76,7 @@ function signin()
|
||||
);
|
||||
DB::Aowow()->query('UPDATE ?_account SET lastLogin = FROM_UNIXTIME(?), timeout = FROM_UNIXTIME(?) WHERE id = ?',
|
||||
time(),
|
||||
$remember ? 0 : time() + $GLOBALS['AoWoWconf']['sessionTimeout'],
|
||||
$remember ? 0 : time() + CFG_SESSION_TIMEOUT_DELAY,
|
||||
$id
|
||||
);
|
||||
User::writeCookie(); // overwrites the current user
|
||||
@@ -89,7 +89,7 @@ function signin()
|
||||
return Lang::$account['wrongPass'];
|
||||
case AUTH_IPBANNED:
|
||||
User::destroy();
|
||||
return sprintf(Lang::$account['loginsExceeded'], round($GLOBALS['AoWoWconf']['loginFailTime'] / 60));
|
||||
return sprintf(Lang::$account['loginsExceeded'], round(CFG_FAILED_AUTH_EXCLUSION / 60));
|
||||
default:
|
||||
return;
|
||||
}
|
||||
@@ -97,7 +97,7 @@ function signin()
|
||||
|
||||
function signup()
|
||||
{
|
||||
global $AoWoWconf, $smarty;
|
||||
global $smarty;
|
||||
|
||||
/*
|
||||
$username = Get(GET_STRING, 'username', 'POST');
|
||||
@@ -207,7 +207,7 @@ function signup()
|
||||
*/
|
||||
|
||||
// Account creation
|
||||
if (isset($_POST['username']) && isset($_POST['password']) && isset($_POST['c_password']) && $AoWoWconf['register'] == true)
|
||||
if (isset($_POST['username']) && isset($_POST['password']) && isset($_POST['c_password']) && CFG_ALLOW_REGISTER)
|
||||
{
|
||||
// password mismatch
|
||||
if ($_POST['password'] != $_POST['c_password'])
|
||||
@@ -322,7 +322,7 @@ else
|
||||
else
|
||||
$smarty->assign('next', $_GET['next']);
|
||||
|
||||
$smarty->assign('register', $AoWoWconf['register']);
|
||||
$smarty->assign('register', CFG_ALLOW_REGISTER);
|
||||
$smarty->display('signin.tpl');
|
||||
break;
|
||||
case 'signup_do':
|
||||
|
||||
@@ -98,9 +98,9 @@ if (!$smarty->loadCache($cacheKey, $pageData, $filter))
|
||||
$pageData['lv']['params']['extraCols'] = '$fi_getExtraCols(fi_extraCols, 0, 0)';
|
||||
|
||||
// create note if search limit was exceeded
|
||||
if ($acvList->getMatches() > SQL_LIMIT_DEFAULT)
|
||||
if ($acvList->getMatches() > CFG_SQL_LIMIT_DEFAULT)
|
||||
{
|
||||
$pageData['lv']['params']['note'] = sprintf(Util::$tryFilteringString, 'LANG.lvnote_achievementsfound', $acvList->getMatches(), SQL_LIMIT_DEFAULT);
|
||||
$pageData['lv']['params']['note'] = sprintf(Util::$tryFilteringString, 'LANG.lvnote_achievementsfound', $acvList->getMatches(), CFG_SQL_LIMIT_DEFAULT);
|
||||
$pageData['lv']['params']['_truncated'] = 1;
|
||||
}
|
||||
|
||||
|
||||
@@ -79,7 +79,7 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData))
|
||||
BUTTON_LINKS => ['color' => '', 'linkId' => ''],
|
||||
BUTTON_WOWHEAD => true,
|
||||
BUTTON_TALENT => ['href' => '?talent#'.Util::$tcEncoding[$tcClassId[$_id] * 3], 'pet' => false],
|
||||
BUTTON_FORUM => false // doto (low): $GLOBALS['AoWoWconf']['boardUrl'] + X
|
||||
BUTTON_FORUM => false // doto (low): CFG_BOARD_URL + X
|
||||
)
|
||||
),
|
||||
'relTabs' => [],
|
||||
|
||||
@@ -340,9 +340,9 @@ if (!$smarty->loadCache($cacheKey, $pageData, $filter))
|
||||
}
|
||||
|
||||
// create note if search limit was exceeded; overwriting 'note' is intentional
|
||||
if ($items->getMatches() > SQL_LIMIT_DEFAULT && empty($filter['upg']))
|
||||
if ($items->getMatches() > CFG_SQL_LIMIT_DEFAULT && empty($filter['upg']))
|
||||
{
|
||||
$pageData['lv']['params']['note'] = sprintf(Util::$tryFilteringString, 'LANG.lvnote_itemsfound', $items->getMatches(), SQL_LIMIT_DEFAULT);
|
||||
$pageData['lv']['params']['note'] = sprintf(Util::$tryFilteringString, 'LANG.lvnote_itemsfound', $items->getMatches(), CFG_SQL_LIMIT_DEFAULT);
|
||||
$pageData['lv']['params']['_truncated'] = 1;
|
||||
}
|
||||
|
||||
|
||||
@@ -47,9 +47,9 @@ if (!$smarty->loadCache($cacheKey, $pageData, $filter))
|
||||
$lv['params']['extraCols'] = '$fi_getExtraCols(fi_extraCols, 0, 0)';
|
||||
|
||||
// create note if search limit was exceeded
|
||||
if ($itemsets->getMatches() > SQL_LIMIT_DEFAULT)
|
||||
if ($itemsets->getMatches() > CFG_SQL_LIMIT_DEFAULT)
|
||||
{
|
||||
$lv['params']['note'] = sprintf(Util::$tryFilteringString, 'LANG.lvnote_itemsetsfound', $itemsets->getMatches(), SQL_LIMIT_DEFAULT);
|
||||
$lv['params']['note'] = sprintf(Util::$tryFilteringString, 'LANG.lvnote_itemsetsfound', $itemsets->getMatches(), CFG_SQL_LIMIT_DEFAULT);
|
||||
$lv['params']['_truncated'] = 1;
|
||||
}
|
||||
|
||||
|
||||
@@ -126,11 +126,11 @@ if (strstr($pageCall, 'latest') || $pageCall == 'most-comments')
|
||||
|
||||
$xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n".
|
||||
"<rss version=\"2.0\">\n\t<channel>\n".
|
||||
"\t\t<title>".$AoWoWconf['shortName'].' - '.Lang::$main['utilities'][$menu] . ($_title ? Lang::$colon . $_title : null)."</title>\n".
|
||||
"\t\t<title>".CFG_NAME_SHORT.' - '.Lang::$main['utilities'][$menu] . ($_title ? Lang::$colon . $_title : null)."</title>\n".
|
||||
"\t\t<link>".STATIC_URL.'?'.$pageCall . ($pageParam ? '='.$pageParam : null)."</link>\n".
|
||||
"\t\t<description>".$AoWoWconf['name']."</description>\n".
|
||||
"\t\t<description>".CFG_NAME."</description>\n".
|
||||
"\t\t<language>".implode('-', str_split(User::$localeString, 2))."</language>\n".
|
||||
"\t\t<ttl>".$AoWoWconf['ttl']."</ttl>\n".
|
||||
"\t\t<ttl>".CFG_TTL_RSS."</ttl>\n".
|
||||
// <lastBuildDate>Sat, 31 Aug 2013 15:33:16 -0500</lastBuildDate>
|
||||
"\t</channel>\n";
|
||||
|
||||
|
||||
@@ -77,18 +77,12 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData))
|
||||
}
|
||||
|
||||
$mapType = 0;
|
||||
if (count($_altIds) > 1) // temp until zones..
|
||||
$mapType = 2;
|
||||
else if (count($_altIds) == 1)
|
||||
$mapType = 1;
|
||||
|
||||
// map mode
|
||||
// $maps = DB::Aowow()->selectCol('SELECT DISTINCT map from creature WHERE id = ?d', $_id);
|
||||
// if (count($maps) == 1) // should only exist in one instance
|
||||
// {
|
||||
// $map = new ZoneList(array(1, ['mapId', $maps[0]]));
|
||||
// $mapType = $map->getField('areaType'); //NYI
|
||||
// }
|
||||
$maps = DB::Aowow()->selectCol('SELECT DISTINCT map from creature WHERE id = ?d', $_id);
|
||||
if (count($maps) == 1) // should only exist in one instance
|
||||
{
|
||||
$map = new ZoneList(array(1, ['mapId', $maps[0]]));
|
||||
$mapType = $map->getField('areaType'); //NYI
|
||||
}
|
||||
|
||||
/***********/
|
||||
/* Infobox */
|
||||
@@ -96,6 +90,16 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData))
|
||||
|
||||
$infobox = [];
|
||||
|
||||
// Event
|
||||
if ($_ = DB::Aowow()->selectRow('SELECT e.id, holidayId FROM ?_events e, game_event_creature gec, creature c WHERE e.id = ABS(gec.eventEntry) AND c.guid = gec.guid AND c.id = ?d', $_id))
|
||||
{
|
||||
if ($h = $_['holidayId'])
|
||||
{
|
||||
Util::$pageTemplate->extendGlobalIds(TYPE_WORLDEVENT, $_['id']);
|
||||
$infobox[] = Util::ucFirst(Lang::$game['eventShort']).Lang::$colon.'[event='.$h.']';
|
||||
}
|
||||
}
|
||||
|
||||
// Level
|
||||
if ($npc->getField('rank') != NPC_RANK_BOSS)
|
||||
{
|
||||
@@ -112,7 +116,7 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData))
|
||||
// Classification
|
||||
if ($_ = $npc->getField('rank')) // != NPC_RANK_NORMAL
|
||||
{
|
||||
$str = $_typeFlags & 0x4 ? '[span class=boss-icon]'.Lang::$npc['rank'][$_].'[/span]' : Lang::$npc['rank'][$_];
|
||||
$str = $_typeFlags & 0x4 ? '[span class=icon-boss]'.Lang::$npc['rank'][$_].'[/span]' : Lang::$npc['rank'][$_];
|
||||
$infobox[] = Lang::$npc['classification'].Lang::$colon.$str;
|
||||
}
|
||||
|
||||
@@ -363,6 +367,11 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData))
|
||||
// get spawns and such
|
||||
|
||||
|
||||
// consider phaseMasks
|
||||
|
||||
// consider pooled spawns
|
||||
|
||||
|
||||
// menuId 4: NPC g_initPath()
|
||||
// tabId 0: Database g_initHeader()
|
||||
$pageData = array(
|
||||
@@ -380,7 +389,7 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData))
|
||||
'tab' => 0,
|
||||
'type' => TYPE_NPC,
|
||||
'typeId' => $_id,
|
||||
'reqJS' => ['template/js/swfobject.js'],
|
||||
'reqJS' => ['static/js/swfobject.js'],
|
||||
'redButtons' => array(
|
||||
BUTTON_WOWHEAD => true,
|
||||
BUTTON_LINKS => true,
|
||||
|
||||
@@ -45,7 +45,7 @@ if (!$smarty->loadCache($cacheKey, $pageData, $filter))
|
||||
'tab' => 0,
|
||||
'subCat' => $pageParam ? '='.$pageParam : '',
|
||||
'reqJS' => array(
|
||||
'template/js/filters.js'
|
||||
'static/js/filters.js'
|
||||
)
|
||||
),
|
||||
'lv' => []
|
||||
@@ -60,9 +60,9 @@ if (!$smarty->loadCache($cacheKey, $pageData, $filter))
|
||||
$lv['params']['extraCols'] = '$fi_getExtraCols(fi_extraCols, 0, 0)';
|
||||
|
||||
// create note if search limit was exceeded
|
||||
if ($npcs->getMatches() > SQL_LIMIT_DEFAULT)
|
||||
if ($npcs->getMatches() > CFG_SQL_LIMIT_DEFAULT)
|
||||
{
|
||||
$lv['params']['note'] = sprintf(Util::$tryFilteringString, 'LANG.lvnote_npcsfound', $npcs->getMatches(), SQL_LIMIT_DEFAULT);
|
||||
$lv['params']['note'] = sprintf(Util::$tryFilteringString, 'LANG.lvnote_npcsfound', $npcs->getMatches(), CFG_SQL_LIMIT_DEFAULT);
|
||||
$lv['params']['_truncated'] = 1;
|
||||
}
|
||||
|
||||
|
||||
@@ -63,6 +63,16 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData))
|
||||
|
||||
$infobox = [];
|
||||
|
||||
// Event
|
||||
if ($_ = DB::Aowow()->selectRow('SELECT e.id, holidayId FROM ?_events e, game_event_gameobject geg, gameobject g WHERE e.id = ABS(geg.eventEntry) AND g.guid = geg.guid AND g.id = ?d', $_id))
|
||||
{
|
||||
if ($h = $_['holidayId'])
|
||||
{
|
||||
Util::$pageTemplate->extendGlobalIds(TYPE_WORLDEVENT, $_['id']);
|
||||
$infobox[] = Util::ucFirst(Lang::$game['eventShort']).Lang::$colon.'[event='.$h.']';
|
||||
}
|
||||
}
|
||||
|
||||
// Reaction
|
||||
$_ = function ($r)
|
||||
{
|
||||
@@ -217,6 +227,12 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData))
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
// consider phaseMasks
|
||||
|
||||
// consider pooled spawns
|
||||
|
||||
|
||||
// menuId 5: Object g_initPath()
|
||||
// tabId 0: Database g_initHeader()
|
||||
$pageData = array(
|
||||
@@ -236,14 +252,14 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData))
|
||||
BUTTON_VIEW3D => ['displayId' => $object->getField('displayId'), 'type' => TYPE_OBJECT, 'typeId' => $_id]
|
||||
),
|
||||
'reqCSS' => array(
|
||||
$pageText ? ['path' => 'template/css/Book.css'] : null,
|
||||
// ['path' => 'template/css/Mapper.css'],
|
||||
// ['path' => 'template/css/Mapper_ie6.css', 'ieCond' => 'lte IE 6']
|
||||
$pageText ? ['path' => 'static/css/Book.css'] : null,
|
||||
// ['path' => 'static/css/Mapper.css'],
|
||||
// ['path' => 'static/css/Mapper_ie6.css', 'ieCond' => 'lte IE 6']
|
||||
),
|
||||
'reqJS' => array(
|
||||
$pageText ? 'template/js/Book.js' : null,
|
||||
// 'template/js/Mapper.js',
|
||||
'template/js/swfobject.js'
|
||||
$pageText ? 'static/js/Book.js' : null,
|
||||
// 'static/js/Mapper.js',
|
||||
'static/js/swfobject.js'
|
||||
)
|
||||
),
|
||||
'relTabs' => []
|
||||
|
||||
@@ -55,9 +55,9 @@ if (!$smarty->loadCache($cacheKey, $pageData, $filter))
|
||||
);
|
||||
|
||||
// create note if search limit was exceeded
|
||||
if ($objects->getMatches() > SQL_LIMIT_DEFAULT)
|
||||
if ($objects->getMatches() > CFG_SQL_LIMIT_DEFAULT)
|
||||
{
|
||||
$lv['params']['note'] = sprintf(Util::$tryFilteringString, 'LANG.lvnote_objectsfound', $objects->getMatches(), SQL_LIMIT_DEFAULT);
|
||||
$lv['params']['note'] = sprintf(Util::$tryFilteringString, 'LANG.lvnote_objectsfound', $objects->getMatches(), CFG_SQL_LIMIT_DEFAULT);
|
||||
$lv['params']['_truncated'] = 1;
|
||||
}
|
||||
|
||||
|
||||
@@ -366,7 +366,7 @@ function handleLoad()
|
||||
// by locale and faction
|
||||
|
||||
// buffer title
|
||||
$titlez = new TitleList(array(SQL_LIMIT_NONE, [['cuFlags', CUSTOM_EXCLUDE_FOR_LISTVIEW, '&'], 0])); // all available
|
||||
$titlez = new TitleList(array(CFG_SQL_LIMIT_NONE, [['cuFlags', CUSTOM_EXCLUDE_FOR_LISTVIEW, '&'], 0])); // all available
|
||||
$dataz = $titlez->getListviewData();
|
||||
|
||||
$buff .= "\r\n\r\nvar _ = g_titles;";
|
||||
@@ -378,7 +378,7 @@ function handleLoad()
|
||||
|
||||
// buffer achievements / statistics
|
||||
$cnd = array(
|
||||
SQL_LIMIT_NONE,
|
||||
CFG_SQL_LIMIT_NONE,
|
||||
[['cuFlags', CUSTOM_EXCLUDE_FOR_LISTVIEW, '&'], 0], // no unachievable
|
||||
[['flags', 1, '&'], 0], // no statistics
|
||||
// [faction matches our faction]
|
||||
|
||||
@@ -405,9 +405,9 @@ if (!$smarty->loadCache($cacheKey, $pageData, $filter))
|
||||
$lv['params']['extraCols'] = '$fi_getExtraCols(fi_extraCols, 0, 0)';
|
||||
|
||||
// create note if search limit was exceeded; overwriting 'note' is intentional
|
||||
if ($spells->getMatches() > SQL_LIMIT_DEFAULT)
|
||||
if ($spells->getMatches() > CFG_SQL_LIMIT_DEFAULT)
|
||||
{
|
||||
$lv['params']['note'] = sprintf(Util::$tryFilteringString, 'LANG.lvnote_spellsfound', $spells->getMatches(), SQL_LIMIT_DEFAULT);
|
||||
$lv['params']['note'] = sprintf(Util::$tryFilteringString, 'LANG.lvnote_spellsfound', $spells->getMatches(), CFG_SQL_LIMIT_DEFAULT);
|
||||
$lv['params']['_truncated'] = 1;
|
||||
}
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@ $type = @intVal($_GET['type']);
|
||||
$searchMask = 0x0;
|
||||
$found = [];
|
||||
$cndBase = ['AND'];
|
||||
$maxResults = SQL_LIMIT_SEARCH;
|
||||
$maxResults = CFG_SQL_LIMIT_SEARCH;
|
||||
|
||||
$_wt = isset($_GET['wt']) ? explode(':', $_GET['wt']) : null;
|
||||
$_wtv = isset($_GET['wtv']) ? explode(':', $_GET['wtv']) : null;
|
||||
@@ -60,7 +60,7 @@ if (isset($_GET['json']))
|
||||
}
|
||||
else if (isset($_GET['opensearch']))
|
||||
{
|
||||
$maxResults = SQL_LIMIT_QUCKSEARCH;
|
||||
$maxResults = CFG_SQL_LIMIT_QUCKSEARCH;
|
||||
$searchMask |= SEARCH_TYPE_OPEN | SEARCH_MASK_OPEN;
|
||||
}
|
||||
else
|
||||
@@ -328,7 +328,7 @@ if (!$smarty->loadCache($cacheKey, $found))
|
||||
|
||||
if (($searchMask & SEARCH_TYPE_JSON) && $type == TYPE_ITEMSET && isset($found['itemset']))
|
||||
{
|
||||
$cnd = [['i.id', array_keys($found['itemset']['pcsToSet'])], SQL_LIMIT_NONE];
|
||||
$cnd = [['i.id', array_keys($found['itemset']['pcsToSet'])], CFG_SQL_LIMIT_NONE];
|
||||
$miscData = ['pcsToSet' => @$found['itemset']['pcsToSet']];
|
||||
}
|
||||
else if (($searchMask & SEARCH_TYPE_JSON) && ($type == TYPE_ITEM || $_slots))
|
||||
|
||||
51
setup/tools/database/config.sql
Normal file
51
setup/tools/database/config.sql
Normal file
@@ -0,0 +1,51 @@
|
||||
-- --------------------------------------------------------
|
||||
-- Host: 127.0.0.1
|
||||
-- Server Version: 5.6.14 - MySQL Community Server (GPL)
|
||||
-- Server Betriebssystem: Win32
|
||||
-- HeidiSQL Version: 8.3.0.4694
|
||||
-- --------------------------------------------------------
|
||||
|
||||
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
|
||||
/*!40101 SET NAMES utf8 */;
|
||||
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
|
||||
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
|
||||
|
||||
-- Exportiere Datenbank Struktur für world
|
||||
CREATE DATABASE IF NOT EXISTS `world` /*!40100 DEFAULT CHARACTER SET utf8 */;
|
||||
USE `world`;
|
||||
|
||||
|
||||
-- Exportiere Struktur von Tabelle world.aowow_config
|
||||
CREATE TABLE IF NOT EXISTS `aowow_config` (
|
||||
`key` varchar(25) NOT NULL,
|
||||
`intValue` mediumint(9) DEFAULT NULL,
|
||||
`strValue` varchar(255) DEFAULT NULL,
|
||||
`comment` varchar(255) NOT NULL,
|
||||
PRIMARY KEY (`key`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
|
||||
|
||||
-- Exportiere Daten aus Tabelle world.aowow_config: 16 rows
|
||||
DELETE FROM `aowow_config`;
|
||||
/*!40000 ALTER TABLE `aowow_config` DISABLE KEYS */;
|
||||
INSERT INTO `aowow_config` (`key`, `intValue`, `strValue`, `comment`) VALUES
|
||||
('sql_limit_search', 500, NULL, 'default: 500 - Limit of some SQL queries'),
|
||||
('sql_limit_default', 300, NULL, 'default: 300 - Limit of some SQL queries'),
|
||||
('sql_limit_quicksearch', 15, NULL, 'default: 10 - Limit of some SQL queries'),
|
||||
('sql_limit_none', 0, NULL, 'default: 0 - Limit of some SQL queries (yes, i\'m lazy)'),
|
||||
('ttl_rss', 60, NULL, 'default: 60 - time to live for RSS'),
|
||||
('cache_decay', 604800, NULL, 'default: 60 * 60 * 7 - Time to keep cache in seconds'),
|
||||
('session_timeout_delay', 3600, NULL, 'default: 60 * 60 - non-permanent session times out in time() + X'),
|
||||
('failed_auth_exclusion', 900, NULL, 'default: 15 * 60 - how long an account is closed after exceeding failed_auth_count'),
|
||||
('failed_auth_count', 5, NULL, 'default: 5 - how often invalid passwords are tolerated'),
|
||||
('name', NULL, 'Aowow Database Viewer (ADV)', 'website title'),
|
||||
('shortname', NULL, 'Aowow', 'feed title'),
|
||||
('boardurl', NULL, 'http://www.wowhead.com/forums?board=', 'a javascript thing..'),
|
||||
('contact_email', NULL, 'feedback@aowow.org', 'ah well...'),
|
||||
('battlegroup', NULL, 'Pure Pwnage', 'pretend, we belong to a battlegroup to satisfy profiler-related Jscripts; region can be determined from realmlist.timezone'),
|
||||
('allow_register', 1, NULL, 'default: 1 - Allow account creating'),
|
||||
('debug', 1, NULL, 'default: 0 - Disable cache, show smarty console panel, enable sql-errors'),
|
||||
('maintenance', 0, NULL, 'default: 0 - brb gnomes say hi');
|
||||
/*!40000 ALTER TABLE `aowow_config` ENABLE KEYS */;
|
||||
/*!40101 SET SQL_MODE=IFNULL(@OLD_SQL_MODE, '') */;
|
||||
/*!40014 SET FOREIGN_KEY_CHECKS=IF(@OLD_FOREIGN_KEY_CHECKS IS NULL, 1, @OLD_FOREIGN_KEY_CHECKS) */;
|
||||
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
|
||||
@@ -55,7 +55,7 @@ if (!defined('AOWOW_REVISION'))
|
||||
// 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', 'QA%', '!'], SQL_LIMIT_NONE]); // enchantItemPermanent && !qualityAssurance
|
||||
$enchantSpells = new SpellList([['effect1Id', 53], ['name_loc0', 'QA%', '!'], CFG_SQL_LIMIT_NONE]); // enchantItemPermanent && !qualityAssurance
|
||||
$castItems = [];
|
||||
|
||||
// check directory-structure
|
||||
|
||||
@@ -74,15 +74,15 @@ if (!defined('AOWOW_REVISION'))
|
||||
die('profile_all source file is missing; cannot create realm file');
|
||||
|
||||
$menu = [
|
||||
["us","US & Oceanic", null,[
|
||||
[urlize($AoWoWconf['battlegroup']),$AoWoWconf['battlegroup'],null,[]]
|
||||
["us", "US & Oceanic", null,[
|
||||
[urlize(CFG_BATTLEGROUP), CFG_BATTLEGROUP, null, []]
|
||||
]],
|
||||
["eu","Europe", null,[
|
||||
[urlize($AoWoWconf['battlegroup']),$AoWoWconf['battlegroup'],null,[]]
|
||||
["eu", "Europe", null,[
|
||||
[urlize(CFG_BATTLEGROUP), CFG_BATTLEGROUP, null, []]
|
||||
]]
|
||||
];
|
||||
|
||||
$rows = DB::Auth()->select('SELECT id AS ARRAY_KEY, name, ? AS battlegroup, IF(timezone IN (8, 9, 10, 11, 12), "eu", "us") AS region FROM realmlist WHERE allowedSecurityLevel = 0', $AoWoWconf['battlegroup']);
|
||||
$rows = DB::Auth()->select('SELECT id AS ARRAY_KEY, name, ? AS battlegroup, IF(timezone IN (8, 9, 10, 11, 12), "eu", "us") AS region FROM realmlist WHERE allowedSecurityLevel = 0', CFG_BATTLEGROUP);
|
||||
$str = 'var g_realms = '.json_encode($rows, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE).';';
|
||||
|
||||
$handle = fOpen('datasets\\realms', "w");
|
||||
|
||||
@@ -1065,7 +1065,7 @@ var Markup = {
|
||||
if(g_items[id] && g_items[id][nameCol])
|
||||
{
|
||||
var item = g_items[id];
|
||||
var str = '<a' + Markup._addGlobalAttributes(attr) + ' href="' + url + '?item=' + id + '" class="q' + item.quality + (!attr.icon ? ' icontiny"><img src="' + g_staticUrl + '/images/iwow/cons/tiny/' + item.icon.toLowerCase() + '.gif"' : '') + ' align="absmiddle" /> <span class="tinyicontxt">';
|
||||
var str = '<a' + Markup._addGlobalAttributes(attr) + ' href="' + url + '?item=' + id + '" class="q' + item.quality + (!attr.icon ? ' icontiny"><img src="' + g_staticUrl + '/images/wow/icons/tiny/' + item.icon.toLowerCase() + '.gif"' : '') + ' align="absmiddle" /> <span class="tinyicontxt">';
|
||||
str += Markup._safeHtml(item[nameCol]) + '</span></a>';
|
||||
return str;
|
||||
}
|
||||
@@ -1739,7 +1739,7 @@ var Markup = {
|
||||
if(g_quests[id] && g_quests[id][nameCol])
|
||||
{
|
||||
var quest = g_quests[id];
|
||||
return '<a href="' + url + '?quest=' + id + '"' + (!attr.icon ? ' class="icontiny"><img src="' + g_staticUrl + '/images/wow/icons/' + (quest.daily ? 'quest_start_daily' : 'quest_start') + '.gif"' : '') + Markup._addGlobalAttributes(attr) + ' align="absmiddle" /> <span class="tinyicontxt">' + Markup._safeHtml(quest[nameCol]) + '</span></a>';
|
||||
return '<a href="' + url + '?quest=' + id + '"' + (!attr.icon ? ' class="icontiny"><img src="' + g_staticUrl + '/images/wow/icons/tiny/' + (quest.daily ? 'quest_start_daily' : 'quest_start') + '.gif"' : '') + Markup._addGlobalAttributes(attr) + ' align="absmiddle" /> <span class="tinyicontxt">' + Markup._safeHtml(quest[nameCol]) + '</span></a>';
|
||||
}
|
||||
return '<a href="' + url + '?quest=' + id + '"' + Markup._addGlobalAttributes(attr) + '>(' + LANG.types[5][0] + ' #' + id + ')</a>';
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user