DB/Dependency
* remove unmaintained DbSimple * add package db/dibi as substitute db abstraction
This commit is contained in:
parent
8a404b32aa
commit
69df50619a
254 changed files with 3234 additions and 5566 deletions
|
|
@ -52,7 +52,7 @@ audio processing may require [lame](https://sourceforge.net/projects/lame/files/
|
|||
|
||||
#### 2. Prepare the database
|
||||
Ensure that the account you are going to use has **full** access on the database AoWoW is going to occupy and ideally only **read** access on the world database you are going to reference.
|
||||
Import files 01 - 03 from `setup/sql/` in order into the AoWoW database `mysql -p {your-db-here} < setup/sql/01-db_structure.sql`, etc.
|
||||
Import files 01 - 03 from `setup/sql/` in order into the AoWoW database `mysql --default-character-set=utf8 -p {your-db-here} < setup/sql/01-db_structure.sql`, etc.
|
||||
|
||||
**Optional**: If you are using MySQL ≥ 8.4.0 and want to support fulltext search for locale zhCN, additionally import `setup/sql/04-db_optional_mysql_only.sql`. Enables this in settings after AoWoW has been set up.
|
||||
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@
|
|||
"vendor-dir": "includes/libs"
|
||||
},
|
||||
"require": {
|
||||
"dibi/dibi": "^5.1",
|
||||
"php": "8.2 - 8.4",
|
||||
"ext-mbstring": "*",
|
||||
"ext-simplexml": "*",
|
||||
|
|
@ -23,7 +24,6 @@
|
|||
"ext-intl": "*"
|
||||
},
|
||||
"require-dev": {
|
||||
"dibi/dibi": "^5.1",
|
||||
"jfcherng/php-diff": "6.16",
|
||||
"triggerhappy/mpq": "dev-master"
|
||||
}
|
||||
|
|
|
|||
139
composer.lock
generated
139
composer.lock
generated
|
|
@ -4,75 +4,8 @@
|
|||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
"content-hash": "8b4b9c139ad31fc7b659f11676582cb2",
|
||||
"packages": [],
|
||||
"packages-dev": [
|
||||
{
|
||||
"name": "chdemko/sorted-collections",
|
||||
"version": "1.0.10",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/chdemko/php-sorted-collections.git",
|
||||
"reference": "d9cf7021e6fda1eb68b9f35caf99215327f6db76"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/chdemko/php-sorted-collections/zipball/d9cf7021e6fda1eb68b9f35caf99215327f6db76",
|
||||
"reference": "d9cf7021e6fda1eb68b9f35caf99215327f6db76",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=8.2"
|
||||
},
|
||||
"require-dev": {
|
||||
"php-coveralls/php-coveralls": "^2.7",
|
||||
"phpbench/phpbench": "^1.3",
|
||||
"phpunit/phpunit": "^11.3",
|
||||
"squizlabs/php_codesniffer": "^3.10"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-main": "1.0.x-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"chdemko\\SortedCollection\\": "src/SortedCollection"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"BSD-3-Clause"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Christophe Demko",
|
||||
"email": "chdemko@gmail.com",
|
||||
"homepage": "https://chdemko.pagelab.univ-lr.fr/",
|
||||
"role": "Developer"
|
||||
}
|
||||
],
|
||||
"description": "Sorted Collections for PHP >= 8.1",
|
||||
"homepage": "https://php-sorted-collections.readthedocs.io/en/latest/?badge=latest",
|
||||
"keywords": [
|
||||
"avl",
|
||||
"collection",
|
||||
"iterator",
|
||||
"map",
|
||||
"ordered",
|
||||
"set",
|
||||
"sorted",
|
||||
"tree",
|
||||
"treemap",
|
||||
"treeset"
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/chdemko/php-sorted-collections/issues",
|
||||
"source": "https://github.com/chdemko/php-sorted-collections/tree/1.0.10"
|
||||
},
|
||||
"time": "2024-08-04T14:31:40+00:00"
|
||||
},
|
||||
"content-hash": "25b289a987a7600746f0fd1f2491864b",
|
||||
"packages": [
|
||||
{
|
||||
"name": "dibi/dibi",
|
||||
"version": "v5.1.0",
|
||||
|
|
@ -146,6 +79,74 @@
|
|||
"source": "https://github.com/dg/dibi/tree/v5.1.0"
|
||||
},
|
||||
"time": "2025-08-06T22:26:19+00:00"
|
||||
}
|
||||
],
|
||||
"packages-dev": [
|
||||
{
|
||||
"name": "chdemko/sorted-collections",
|
||||
"version": "1.0.10",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/chdemko/php-sorted-collections.git",
|
||||
"reference": "d9cf7021e6fda1eb68b9f35caf99215327f6db76"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/chdemko/php-sorted-collections/zipball/d9cf7021e6fda1eb68b9f35caf99215327f6db76",
|
||||
"reference": "d9cf7021e6fda1eb68b9f35caf99215327f6db76",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=8.2"
|
||||
},
|
||||
"require-dev": {
|
||||
"php-coveralls/php-coveralls": "^2.7",
|
||||
"phpbench/phpbench": "^1.3",
|
||||
"phpunit/phpunit": "^11.3",
|
||||
"squizlabs/php_codesniffer": "^3.10"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-main": "1.0.x-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"chdemko\\SortedCollection\\": "src/SortedCollection"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"BSD-3-Clause"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Christophe Demko",
|
||||
"email": "chdemko@gmail.com",
|
||||
"homepage": "https://chdemko.pagelab.univ-lr.fr/",
|
||||
"role": "Developer"
|
||||
}
|
||||
],
|
||||
"description": "Sorted Collections for PHP >= 8.1",
|
||||
"homepage": "https://php-sorted-collections.readthedocs.io/en/latest/?badge=latest",
|
||||
"keywords": [
|
||||
"avl",
|
||||
"collection",
|
||||
"iterator",
|
||||
"map",
|
||||
"ordered",
|
||||
"set",
|
||||
"sorted",
|
||||
"tree",
|
||||
"treemap",
|
||||
"treeset"
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/chdemko/php-sorted-collections/issues",
|
||||
"source": "https://github.com/chdemko/php-sorted-collections/tree/1.0.10"
|
||||
},
|
||||
"time": "2024-08-04T14:31:40+00:00"
|
||||
},
|
||||
{
|
||||
"name": "jfcherng/php-color-output",
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ class AccountBaseResponse extends TemplateResponse
|
|||
{
|
||||
array_unshift($this->title, Lang::account('settings'));
|
||||
|
||||
$user = DB::Aowow()->selectRow('SELECT `debug`, `email`, `description`, `avatar`, `wowicon`, `renameCooldown` FROM ?_account WHERE `id` = ?d', User::$id);
|
||||
$user = DB::Aowow()->selectRow('SELECT `debug`, `email`, `description`, `avatar`, `wowicon`, `renameCooldown` FROM ::account WHERE `id` = %i', User::$id);
|
||||
|
||||
Lang::sort('game', 'ra');
|
||||
|
||||
|
|
@ -65,11 +65,11 @@ class AccountBaseResponse extends TemplateResponse
|
|||
/* Ban Popup */
|
||||
/*************/
|
||||
|
||||
$b = DB::Aowow()->select(
|
||||
$b = DB::Aowow()->selectAssoc(
|
||||
'SELECT ab.`end` AS "0", ab.`reason` AS "1", a.`username` AS "2"
|
||||
FROM ?_account_banned ab
|
||||
LEFT JOIN ?_account a ON a.`id` = ab.`staffId`
|
||||
WHERE ab.`userId` = ?d AND ab.`typeMask` & ?d AND (ab.`end` = 0 OR ab.`end` > UNIX_TIMESTAMP())',
|
||||
FROM ::account_banned ab
|
||||
LEFT JOIN ::account a ON a.`id` = ab.`staffId`
|
||||
WHERE ab.`userId` = %i AND ab.`typeMask` & %i AND (ab.`end` = 0 OR ab.`end` > UNIX_TIMESTAMP())',
|
||||
User::$id, ACC_BAN_TEMP | ACC_BAN_PERM
|
||||
);
|
||||
|
||||
|
|
@ -99,7 +99,7 @@ class AccountBaseResponse extends TemplateResponse
|
|||
/* GENERAL */
|
||||
|
||||
// Modelviewer
|
||||
if ($_ = DB::Aowow()->selectCell('SELECT `data` FROM ?_account_cookies WHERE `name` = ? AND `userId` = ?d', 'default_3dmodel', User::$id))
|
||||
if ($_ = DB::Aowow()->selectCell('SELECT `data` FROM ::account_cookies WHERE `name` = %s AND `userId` = %i', 'default_3dmodel', User::$id))
|
||||
[$this->modelrace, $this->modelgender] = explode(',', $_);
|
||||
|
||||
// Lists
|
||||
|
|
@ -115,7 +115,7 @@ class AccountBaseResponse extends TemplateResponse
|
|||
$this->renameCD = DateTime::formatTimeElapsedFloat(Cfg::get('ACC_RENAME_DECAY') * 1000);
|
||||
if ($user['renameCooldown'] > time())
|
||||
{
|
||||
$locCode = implode('_', str_split(Lang::getLocale()->json(), 2)); // ._.
|
||||
$locCode = substr_replace(Lang::getLocale()->json(), '_', 2, 0); // ._.
|
||||
$this->activeCD = (new \IntlDateFormatter($locCode, pattern: Lang::main('dateFmtIntl')))->format($user['renameCooldown']);
|
||||
}
|
||||
|
||||
|
|
@ -145,7 +145,7 @@ class AccountBaseResponse extends TemplateResponse
|
|||
// * 'when': uploaded timestamp expected as msec for some reason
|
||||
// * 'caption': only used for getVisibleText, duplicates name?
|
||||
// * 'type': always 1 ?, Dialog-popup doesn't work without it
|
||||
if ($cuAvatars = DB::Aowow()->select('SELECT `id` AS ARRAY_KEY, `id`, `name`, `name` AS "caption", `current`, `size`, `status`, `when` * 1000 AS "when", 1 AS "type" FROM ?_account_avatars WHERE `userId` = ?d', User::$id))
|
||||
if ($cuAvatars = DB::Aowow()->selectAssoc('SELECT `id` AS ARRAY_KEY, `id`, `name`, `name` AS "caption", `current`, `size`, `status`, `when` * 1000 AS "when", 1 AS "type" FROM ::account_avatars WHERE `userId` = %i', User::$id))
|
||||
{
|
||||
foreach ($cuAvatars as $id => $a)
|
||||
if ($a['status'] != AvatarMgr::STATUS_REJECTED)
|
||||
|
|
|
|||
|
|
@ -52,13 +52,13 @@ class AccountActivateResponse extends TemplateResponse
|
|||
if (!$this->assertGET('key'))
|
||||
return Lang::main('intError');
|
||||
|
||||
if (DB::Aowow()->selectCell('SELECT `id` FROM ?_account WHERE `status` IN (?a) AND `token` = ?', [ACC_STATUS_NONE, ACC_STATUS_NEW], $this->_get['key']))
|
||||
if (DB::Aowow()->selectCell('SELECT `id` FROM ::account WHERE `status` IN %in AND `token` = %s', [ACC_STATUS_NONE, ACC_STATUS_NEW], $this->_get['key']))
|
||||
{
|
||||
// don't remove the token yet. It's needed on signin page.
|
||||
DB::Aowow()->query('UPDATE ?_account SET `status` = ?d, `statusTimer` = 0, `userGroups` = ?d WHERE `token` = ?', ACC_STATUS_NONE, U_GROUP_NONE, $this->_get['key']);
|
||||
DB::Aowow()->qry('UPDATE ::account SET `status` = %i, `statusTimer` = 0, `userGroups` = %i WHERE `token` = %s', ACC_STATUS_NONE, U_GROUP_NONE, $this->_get['key']);
|
||||
|
||||
// fully apply block for further registration attempts from this ip
|
||||
DB::Aowow()->query('REPLACE INTO ?_account_bannedips (`ip`, `type`, `count`, `unbanDate`) VALUES (?, ?d, ?d + 1, UNIX_TIMESTAMP() + ?d)',
|
||||
DB::Aowow()->qry('REPLACE INTO ::account_bannedips (`ip`, `type`, `count`, `unbanDate`) VALUES (%s, %i, %i + 1, UNIX_TIMESTAMP() + %i)',
|
||||
User::$ip, IP_BAN_TYPE_REGISTRATION_ATTEMPT, Cfg::get('ACC_FAILED_AUTH_COUNT'), Cfg::get('ACC_FAILED_AUTH_BLOCK'));
|
||||
|
||||
$this->success = true;
|
||||
|
|
|
|||
|
|
@ -54,14 +54,14 @@ class AccountConfirmdeleteResponse extends TemplateResponse
|
|||
$msg = Lang::account('inputbox', 'error', 'purgeTokenUsed');
|
||||
|
||||
// display default confirm template
|
||||
if ($this->assertGET('key') && DB::Aowow()->selectCell('SELECT 1 FROM ?_account WHERE `status` = ?d AND `statusTimer` > UNIX_TIMESTAMP() AND `token` = ?', ACC_STATUS_PURGING, $this->_get['key']))
|
||||
if ($this->assertGET('key') && DB::Aowow()->selectCell('SELECT 1 FROM ::account WHERE `status` = %i AND `statusTimer` > UNIX_TIMESTAMP() AND `token` = %s', ACC_STATUS_PURGING, $this->_get['key']))
|
||||
{
|
||||
$this->key = $this->_get['key'];
|
||||
return;
|
||||
}
|
||||
|
||||
// perform action and display status
|
||||
if ($this->assertPOST('key') && ($userId = DB::Aowow()->selectCell('SELECT `id` FROM ?_account WHERE `status` = ?d AND `statusTimer` > UNIX_TIMESTAMP() AND `token` = ?', ACC_STATUS_PURGING, $this->_post['key'])))
|
||||
if ($this->assertPOST('key') && ($userId = DB::Aowow()->selectCell('SELECT `id` FROM ::account WHERE `status` = %i AND `statusTimer` > UNIX_TIMESTAMP() AND `token` = %s', ACC_STATUS_PURGING, $this->_post['key'])))
|
||||
{
|
||||
if ($this->_post['cancel'])
|
||||
$msg = $this->cancel($userId);
|
||||
|
|
@ -79,7 +79,7 @@ class AccountConfirmdeleteResponse extends TemplateResponse
|
|||
|
||||
private function cancel(int $userId) : string
|
||||
{
|
||||
if (DB::Aowow()->query('UPDATE ?_account SET `status` = ?d, `statusTimer` = 0, `token` = "" WHERE `id` = ?d', ACC_STATUS_NONE, $userId))
|
||||
if (DB::Aowow()->qry('UPDATE ::account SET `status` = %i, `statusTimer` = 0, `token` = "" WHERE `id` = %i', ACC_STATUS_NONE, $userId))
|
||||
{
|
||||
$this->success = true;
|
||||
return Lang::account('inputbox', 'message', 'deleteCancel');
|
||||
|
|
@ -91,32 +91,32 @@ class AccountConfirmdeleteResponse extends TemplateResponse
|
|||
private function purge(int $userId) : string
|
||||
{
|
||||
// empty all user settings and cookies
|
||||
DB::Aowow()->query('DELETE FROM ?_account_cookies WHERE `userId` = ?d', $userId);
|
||||
DB::Aowow()->query('DELETE FROM ?_account_avatars WHERE `userId` = ?d', $userId);
|
||||
DB::Aowow()->query('DELETE FROM ?_account_excludes WHERE `userId` = ?d', $userId);
|
||||
DB::Aowow()->query('DELETE FROM ?_account_favorites WHERE `userId` = ?d', $userId);
|
||||
DB::Aowow()->query('DELETE FROM ?_account_reputation WHERE `userId` = ?d', $userId);
|
||||
DB::Aowow()->query('DELETE FROM ?_account_weightscales WHERE `userId` = ?d', $userId); // cascades to aowow_account_weightscale_data
|
||||
DB::Aowow()->qry('DELETE FROM ::account_cookies WHERE `userId` = %i', $userId);
|
||||
DB::Aowow()->qry('DELETE FROM ::account_avatars WHERE `userId` = %i', $userId);
|
||||
DB::Aowow()->qry('DELETE FROM ::account_excludes WHERE `userId` = %i', $userId);
|
||||
DB::Aowow()->qry('DELETE FROM ::account_favorites WHERE `userId` = %i', $userId);
|
||||
DB::Aowow()->qry('DELETE FROM ::account_reputation WHERE `userId` = %i', $userId);
|
||||
DB::Aowow()->qry('DELETE FROM ::account_weightscales WHERE `userId` = %i', $userId); // cascades to aowow_account_weightscale_data
|
||||
|
||||
// delete profiles, unlink chars
|
||||
DB::Aowow()->query('DELETE pp FROM ?_profiler_profiles pp JOIN ?_account_profiles ap ON ap.`profileId` = pp.`id` WHERE ap.`accountId` = ?d', $userId);
|
||||
// DB::Aowow()->query('DELETE FROM ?_account_profiles WHERE `accountId` = ?d', $userId); // already deleted via FK?
|
||||
DB::Aowow()->qry('DELETE pp FROM ::profiler_profiles pp JOIN ::account_profiles ap ON ap.`profileId` = pp.`id` WHERE ap.`accountId` = %i', $userId);
|
||||
// DB::Aowow()->qry('DELETE FROM ::account_profiles WHERE `accountId` = %i', $userId); // already deleted via FK?
|
||||
|
||||
// delete all sessions and bans
|
||||
DB::Aowow()->query('DELETE FROM ?_account_banned WHERE `userId` = ?d', $userId);
|
||||
DB::Aowow()->query('DELETE FROM ?_account_sessions WHERE `userId` = ?d', $userId);
|
||||
DB::Aowow()->qry('DELETE FROM ::account_banned WHERE `userId` = %i', $userId);
|
||||
DB::Aowow()->qry('DELETE FROM ::account_sessions WHERE `userId` = %i', $userId);
|
||||
|
||||
// delete forum posts (msg: This post was from a user who has deleted their account. (no translations at src); comments/replies are unaffected)
|
||||
// ...
|
||||
|
||||
// replace username with userId and empty fields
|
||||
DB::Aowow()->query(
|
||||
'UPDATE ?_account SET
|
||||
DB::Aowow()->qry(
|
||||
'UPDATE ::account SET
|
||||
`login` = "", `passHash` = "", `username` = `id`, `email` = NULL, `userGroups` = 0, `userPerms` = 0,
|
||||
`curIp` = "", `prevIp` = "", `curLogin` = 0, `prevLogin` = 0,
|
||||
`locale` = 0, `debug` = 0, `avatar` = 0, `wowicon` = "", `title` = "", `description` = "", `excludeGroups` = 0,
|
||||
`status` = ?d, `statusTimer` = 0, `token` = "", `updateValue` = "", `renameCooldown` = 0
|
||||
WHERE `id` = ?d',
|
||||
`status` = %i, `statusTimer` = 0, `token` = "", `updateValue` = "", `renameCooldown` = 0
|
||||
WHERE `id` = %i',
|
||||
ACC_STATUS_DELETED, $userId
|
||||
);
|
||||
|
||||
|
|
|
|||
|
|
@ -46,12 +46,12 @@ class AccountConfirmemailaddressResponse extends TemplateResponse
|
|||
if (!$this->assertGET('key'))
|
||||
return Lang::main('intError');
|
||||
|
||||
$acc = DB::Aowow()->selectRow('SELECT `updateValue`, `status`, `statusTimer` FROM ?_account WHERE `token` = ?', $this->_get['key']);
|
||||
$acc = DB::Aowow()->selectRow('SELECT `updateValue`, `status`, `statusTimer` FROM ::account WHERE `token` = %s', $this->_get['key']);
|
||||
if (!$acc || $acc['status'] != ACC_STATUS_CHANGE_EMAIL || $acc['statusTimer'] < time())
|
||||
return Lang::account('inputbox', 'error', 'mailTokenUsed');
|
||||
|
||||
// 0 changes == error
|
||||
if (!DB::Aowow()->query('UPDATE ?_account SET `email` = `updateValue`, `status` = ?d, `statusTimer` = 0, `token` = "", `updateValue` = "" WHERE `token` = ?', ACC_STATUS_NONE, $this->_get['key']))
|
||||
if (!DB::Aowow()->qry('UPDATE ::account SET `email` = `updateValue`, `status` = %i, `statusTimer` = 0, `token` = "", `updateValue` = "" WHERE `token` = %s', ACC_STATUS_NONE, $this->_get['key']))
|
||||
return Lang::main('intError');
|
||||
|
||||
$this->success = true;
|
||||
|
|
|
|||
|
|
@ -44,12 +44,12 @@ class AccountConfirmpasswordResponse extends TemplateResponse
|
|||
if (!$this->assertGET('key'))
|
||||
return Lang::main('intError');
|
||||
|
||||
$acc = DB::Aowow()->selectRow('SELECT `updateValue`, `status`, `statusTimer` FROM ?_account WHERE `token` = ?', $this->_get['key']);
|
||||
$acc = DB::Aowow()->selectRow('SELECT `updateValue`, `status`, `statusTimer` FROM ::account WHERE `token` = %s', $this->_get['key']);
|
||||
if (!$acc || $acc['status'] != ACC_STATUS_CHANGE_PASS || $acc['statusTimer'] < time())
|
||||
return Lang::account('inputbox', 'error', 'passTokenUsed');
|
||||
|
||||
// 0 changes == error
|
||||
if (!DB::Aowow()->query('UPDATE ?_account SET `passHash` = `updateValue`, `status` = ?d, `statusTimer` = 0, `token` = "", `updateValue` = "" WHERE `token` = ?', ACC_STATUS_NONE, $this->_get['key']))
|
||||
if (!DB::Aowow()->qry('UPDATE ::account SET `passHash` = `updateValue`, `status` = %i, `statusTimer` = 0, `token` = "", `updateValue` = "" WHERE `token` = %s', ACC_STATUS_NONE, $this->_get['key']))
|
||||
return Lang::main('intError');
|
||||
|
||||
$this->success = true;
|
||||
|
|
|
|||
|
|
@ -28,15 +28,15 @@ class AccountDeleteiconResponse extends TextResponse
|
|||
return;
|
||||
|
||||
// non-int > error
|
||||
$selected = DB::Aowow()->selectCell('SELECT `current` FROM ?_account_avatars WHERE `id` = ?d AND `userId` = ?d', $this->_post['id'], User::$id);
|
||||
$selected = DB::Aowow()->selectCell('SELECT `current` FROM ::account_avatars WHERE `id` = %i AND `userId` = %i', $this->_post['id'], User::$id);
|
||||
if ($selected === null || $selected === false)
|
||||
return;
|
||||
|
||||
DB::Aowow()->query('DELETE FROM ?_account_avatars WHERE `id` = ?d AND `userId` = ?d', $this->_post['id'], User::$id);
|
||||
DB::Aowow()->qry('DELETE FROM ::account_avatars WHERE `id` = %i AND `userId` = %i', $this->_post['id'], User::$id);
|
||||
|
||||
// if deleted avatar is also currently selected, unset
|
||||
if ($selected)
|
||||
DB::Aowow()->query('UPDATE ?_account SET `avatar` = 0 WHERE `id` = ?d', User::$id);
|
||||
DB::Aowow()->qry('UPDATE ::account SET `avatar` = 0 WHERE `id` = %i', User::$id);
|
||||
|
||||
$path = sprintf('static/uploads/avatars/%d.jpg', $this->_post['id']);
|
||||
if (!unlink($path))
|
||||
|
|
|
|||
|
|
@ -47,11 +47,11 @@ class AccountDeleteResponse extends TemplateResponse
|
|||
if ($this->_post['proceed'])
|
||||
{
|
||||
$error = false;
|
||||
if (!DB::Aowow()->selectCell('SELECT 1 FROM ?_account WHERE `status` NOT IN (?a) AND `statusTimer` > UNIX_TIMESTAMP() AND `id` = ?d', [ACC_STATUS_NEW, ACC_STATUS_NONE, ACC_STATUS_PURGING], User::$id))
|
||||
if (!DB::Aowow()->selectCell('SELECT 1 FROM ::account WHERE `status` NOT IN %in AND `statusTimer` > UNIX_TIMESTAMP() AND `id` = %i', [ACC_STATUS_NEW, ACC_STATUS_NONE, ACC_STATUS_PURGING], User::$id))
|
||||
{
|
||||
$token = Util::createHash(40);
|
||||
|
||||
DB::Aowow()->query('UPDATE ?_account SET `status` = ?d, `statusTimer` = UNIX_TIMESTAMP() + ?d, `token` = ? WHERE `id` = ?d',
|
||||
DB::Aowow()->qry('UPDATE ::account SET `status` = %i, `statusTimer` = UNIX_TIMESTAMP() + %i, `token` = %s WHERE `id` = %i',
|
||||
ACC_STATUS_PURGING, Cfg::get('ACC_RECOVERY_DECAY'), $token, User::$id);
|
||||
|
||||
Util::sendMail(User::$email, 'delete-account', [$token, User::$email, User::$username]);
|
||||
|
|
|
|||
|
|
@ -49,12 +49,17 @@ class AccountExcludeResponse extends TextResponse
|
|||
// we don't get signaled whether an id should be added to or removed from either includes or excludes
|
||||
// so we throw everything into one table and toggle the mode if its already in here
|
||||
|
||||
$includes = DB::Aowow()->selectCol('SELECT `typeId` FROM ?_profiler_excludes WHERE `type` = ?d AND `typeId` IN (?a)', $this->_post['type'], $validIds);
|
||||
|
||||
$includes = DB::Aowow()->selectCol('SELECT `typeId` FROM ::profiler_excludes WHERE `type` = %i AND `typeId` IN %in', $this->_post['type'], $validIds);
|
||||
$insert = [];
|
||||
foreach ($validIds as $typeId)
|
||||
DB::Aowow()->query('INSERT INTO ?_account_excludes (`userId`, `type`, `typeId`, `mode`) VALUES (?a) ON DUPLICATE KEY UPDATE `mode` = (`mode` ^ 0x3)',
|
||||
[User::$id, $this->_post['type'], $typeId, in_array($typeId, $includes) ? 2 : 1]
|
||||
);
|
||||
{
|
||||
$insert['userId'][] = User::$id;
|
||||
$insert['type'][] = $this->_post['type'];
|
||||
$insert['typeId'][] = $typeId;
|
||||
$insert['mode'][] = in_array($typeId, $includes) ? Profiler::COMPLETION_INCLUDE : Profiler::COMPLETION_EXCLUDE;
|
||||
};
|
||||
|
||||
DB::Aowow()->qry('INSERT INTO ::account_excludes %m ON DUPLICATE KEY UPDATE `mode` = (`mode` ^ 0x3)', $insert);
|
||||
}
|
||||
else
|
||||
trigger_error('AccountExcludeResponse::excludeById - validation failed [type: '.$this->_post['type'].', typeId: '.implode(',', $this->_post['id']).']', E_USER_NOTICE);
|
||||
|
|
@ -62,14 +67,14 @@ class AccountExcludeResponse extends TextResponse
|
|||
|
||||
private function resetExcludes() : void
|
||||
{
|
||||
DB::Aowow()->query('DELETE FROM ?_account_excludes WHERE `userId` = ?d', User::$id);
|
||||
DB::Aowow()->query('UPDATE ?_account SET `excludeGroups` = ?d WHERE `id` = ?d', PR_EXCLUDE_GROUP_UNAVAILABLE, User::$id);
|
||||
DB::Aowow()->qry('DELETE FROM ::account_excludes WHERE `userId` = %i', User::$id);
|
||||
DB::Aowow()->qry('UPDATE ::account SET `excludeGroups` = %i WHERE `id` = %i', PR_EXCLUDE_GROUP_UNAVAILABLE, User::$id);
|
||||
}
|
||||
|
||||
private function updateGroups() : void
|
||||
{
|
||||
if ($this->assertPOST('groups')) // clamp to real groups
|
||||
DB::Aowow()->query('UPDATE ?_account SET `excludeGroups` = ?d WHERE `id` = ?d', $this->_post['groups'] & PR_EXCLUDE_GROUP_ANY, User::$id);
|
||||
DB::Aowow()->qry('UPDATE ::account SET `excludeGroups` = %i WHERE `id` = %i', $this->_post['groups'] & PR_EXCLUDE_GROUP_ANY, User::$id);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -37,13 +37,13 @@ class AccountFavoritesResponse extends TextResponse
|
|||
private function removeFavorite() : void
|
||||
{
|
||||
if ($this->assertPOST('id', 'remove'))
|
||||
DB::Aowow()->query('DELETE FROM ?_account_favorites WHERE `userId` = ?d AND `type` = ?d AND `typeId` = ?d', User::$id, $this->_post['remove'], $this->_post['id']);
|
||||
DB::Aowow()->qry('DELETE FROM ::account_favorites WHERE `userId` = %i AND `type` = %i AND `typeId` = %i', User::$id, $this->_post['remove'], $this->_post['id']);
|
||||
}
|
||||
|
||||
private function addFavorite() : void
|
||||
{
|
||||
if ($this->assertPOST('id', 'add') && Type::validateIds($this->_post['add'], $this->_post['id']))
|
||||
DB::Aowow()->query('INSERT INTO ?_account_favorites (`userId`, `type`, `typeId`) VALUES (?d, ?d, ?d)', User::$id, $this->_post['add'], $this->_post['id']);
|
||||
DB::Aowow()->qry('INSERT INTO ::account_favorites (`userId`, `type`, `typeId`) VALUES (%i, %i, %i)', User::$id, $this->_post['add'], $this->_post['id']);
|
||||
else
|
||||
trigger_error('AccountFavoritesResponse::addFavorite() - failed to add [userId: '.User::$id.', type: '.$this->_post['add'].', typeId: '.$this->_post['id'], E_USER_NOTICE);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -72,14 +72,14 @@ class AccountforgotpasswordResponse extends TemplateResponse
|
|||
if (!$this->_post['email'])
|
||||
return Lang::account('emailInvalid');
|
||||
|
||||
$timeout = DB::Aowow()->selectCell('SELECT `unbanDate` FROM ?_account_bannedips WHERE `ip` = ? AND `type` = ?d AND `count` > ?d AND `unbanDate` > UNIX_TIMESTAMP()', User::$ip, IP_BAN_TYPE_PASSWORD_RECOVERY, Cfg::get('ACC_FAILED_AUTH_COUNT'));
|
||||
$timeout = DB::Aowow()->selectCell('SELECT `unbanDate` FROM ::account_bannedips WHERE `ip` = %s AND `type` = %i AND `count` > %i AND `unbanDate` > UNIX_TIMESTAMP()', User::$ip, IP_BAN_TYPE_PASSWORD_RECOVERY, Cfg::get('ACC_FAILED_AUTH_COUNT'));
|
||||
|
||||
// on cooldown pretend we dont know the email address
|
||||
if ($timeout && $timeout > time())
|
||||
return Cfg::get('DEBUG') ? 'resend on cooldown: '.DateTime::formatTimeElapsed($timeout * 1000).' remaining' : Lang::account('inputbox', 'error', 'emailNotFound');
|
||||
|
||||
// pretend recovery started
|
||||
if (!DB::Aowow()->selectCell('SELECT 1 FROM ?_account WHERE `email` = ?', $this->_post['email']))
|
||||
if (!DB::Aowow()->selectCell('SELECT 1 FROM ::account WHERE `email` = %s', $this->_post['email']))
|
||||
{
|
||||
// do not confirm or deny existence of email
|
||||
$this->success = !Cfg::get('DEBUG');
|
||||
|
|
@ -90,7 +90,7 @@ class AccountforgotpasswordResponse extends TemplateResponse
|
|||
if ($err = $this->startRecovery(ACC_STATUS_RECOVER_PASS, 'reset-password', $this->_post['email']))
|
||||
return $err;
|
||||
|
||||
DB::Aowow()->query('INSERT INTO ?_account_bannedips (`ip`, `type`, `count`, `unbanDate`) VALUES (?, ?d, ?d, UNIX_TIMESTAMP() + ?d) ON DUPLICATE KEY UPDATE `count` = `count` + ?d, `unbanDate` = UNIX_TIMESTAMP() + ?d',
|
||||
DB::Aowow()->qry('INSERT INTO ::account_bannedips (`ip`, `type`, `count`, `unbanDate`) VALUES (%s, %i, %i, UNIX_TIMESTAMP() + %i) ON DUPLICATE KEY UPDATE `count` = `count` + %i, `unbanDate` = UNIX_TIMESTAMP() + %i',
|
||||
User::$ip, IP_BAN_TYPE_PASSWORD_RECOVERY, Cfg::get('ACC_FAILED_AUTH_COUNT') + 1, Cfg::get('ACC_FAILED_AUTH_COUNT'), Cfg::get('ACC_FAILED_AUTH_BLOCK'), Cfg::get('ACC_FAILED_AUTH_BLOCK'));
|
||||
|
||||
$this->success = true;
|
||||
|
|
|
|||
|
|
@ -71,14 +71,14 @@ class AccountforgotusernameResponse extends TemplateResponse
|
|||
if (!$this->_post['email'])
|
||||
return Lang::account('emailInvalid');
|
||||
|
||||
$timeout = DB::Aowow()->selectCell('SELECT `unbanDate` FROM ?_account_bannedips WHERE `ip` = ? AND `type` = ?d AND `count` > ?d AND `unbanDate` > UNIX_TIMESTAMP()', User::$ip, IP_BAN_TYPE_USERNAME_RECOVERY, Cfg::get('ACC_FAILED_AUTH_COUNT'));
|
||||
$timeout = DB::Aowow()->selectCell('SELECT `unbanDate` FROM ::account_bannedips WHERE `ip` = %s AND `type` = %i AND `count` > %i AND `unbanDate` > UNIX_TIMESTAMP()', User::$ip, IP_BAN_TYPE_USERNAME_RECOVERY, Cfg::get('ACC_FAILED_AUTH_COUNT'));
|
||||
|
||||
// on cooldown pretend we dont know the email address
|
||||
if ($timeout && $timeout > time())
|
||||
return Cfg::get('DEBUG') ? 'resend on cooldown: '.DateTime::formatTimeElapsed($timeout * 1000).' remaining' : Lang::account('inputbox', 'error', 'emailNotFound');
|
||||
|
||||
// pretend recovery started
|
||||
if (!DB::Aowow()->selectCell('SELECT 1 FROM ?_account WHERE `email` = ?', $this->_post['email']))
|
||||
if (!DB::Aowow()->selectCell('SELECT 1 FROM ::account WHERE `email` = %s', $this->_post['email']))
|
||||
{
|
||||
// do not confirm or deny existence of email
|
||||
$this->success = !Cfg::get('DEBUG');
|
||||
|
|
@ -89,7 +89,7 @@ class AccountforgotusernameResponse extends TemplateResponse
|
|||
if ($err = $this->startRecovery(ACC_STATUS_RECOVER_USER, 'recover-user', $this->_post['email']))
|
||||
return $err;
|
||||
|
||||
DB::Aowow()->query('INSERT INTO ?_account_bannedips (`ip`, `type`, `count`, `unbanDate`) VALUES (?, ?d, ?d, UNIX_TIMESTAMP() + ?d) ON DUPLICATE KEY UPDATE `count` = `count` + ?d, `unbanDate` = UNIX_TIMESTAMP() + ?d',
|
||||
DB::Aowow()->qry('INSERT INTO ::account_bannedips (`ip`, `type`, `count`, `unbanDate`) VALUES (%s, %i, %i, UNIX_TIMESTAMP() + %i) ON DUPLICATE KEY UPDATE `count` = `count` + %i, `unbanDate` = UNIX_TIMESTAMP() + %i',
|
||||
User::$ip, IP_BAN_TYPE_USERNAME_RECOVERY, Cfg::get('ACC_FAILED_AUTH_COUNT') + 1, Cfg::get('ACC_FAILED_AUTH_COUNT'), Cfg::get('ACC_FAILED_AUTH_BLOCK'), Cfg::get('ACC_FAILED_AUTH_BLOCK'));
|
||||
|
||||
$this->success = true;
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ class AccountForumavatarResponse extends TextResponse
|
|||
|
||||
private function unset() : string
|
||||
{
|
||||
$x = DB::Aowow()->query('UPDATE ?_account SET `avatar` = 0 WHERE `id` = ?d', User::$id);
|
||||
$x = DB::Aowow()->qry('UPDATE ::account SET `avatar` = 0 WHERE `id` = %i', User::$id);
|
||||
if ($x === null || $x === false)
|
||||
return Lang::main('genericError');
|
||||
|
||||
|
|
@ -64,17 +64,17 @@ class AccountForumavatarResponse extends TextResponse
|
|||
|
||||
$icon = strtolower(trim($this->_post['wowicon']));
|
||||
|
||||
if (!DB::Aowow()->selectCell('SELECT 1 FROM ?_icons WHERE `name` = ?', $icon))
|
||||
if (!DB::Aowow()->selectCell('SELECT 1 FROM ::icons WHERE `name` = %s', $icon))
|
||||
return Lang::account('updateMessage', 'avNotFound');
|
||||
|
||||
$x = DB::Aowow()->query('UPDATE ?_account SET `avatar` = 1, `wowicon` = ? WHERE `id` = ?d', strtolower($icon), User::$id);
|
||||
if ($x === null || $x === false)
|
||||
$x = DB::Aowow()->qry('UPDATE ::account SET `avatar` = 1, `wowicon` = %s WHERE `id` = %i', $icon, User::$id);
|
||||
if (is_null($x))
|
||||
return Lang::main('genericError');
|
||||
|
||||
$this->success = true;
|
||||
|
||||
$msg = Lang::account('updateMessage', $x === 0 ? 'avNoChange' : 'avSuccess');
|
||||
if (($qty = DB::Aowow()->selectCell('SELECT COUNT(1) FROM ?_account WHERE `wowicon` = ?', $icon)) > 1)
|
||||
if (($qty = DB::Aowow()->selectCell('SELECT COUNT(1) FROM ::account WHERE `wowicon` = %s', $icon)) > 1)
|
||||
$msg .= ' '.Lang::account('updateMessage', 'avNthUser', [$qty]);
|
||||
else
|
||||
$msg .= ' '.Lang::account('updateMessage', 'av1stUser');
|
||||
|
|
@ -92,11 +92,11 @@ class AccountForumavatarResponse extends TextResponse
|
|||
|
||||
$customIcon = $this->_post['customicon'] ?? $this->_get['customicon'];
|
||||
|
||||
$x = DB::Aowow()->query('UPDATE ?_account_avatars SET `current` = IF(`id` = ?d, 1, 0) WHERE `userId` = ?d AND `status` <> ?d', $customIcon, User::$id, AvatarMgr::STATUS_REJECTED);
|
||||
$x = DB::Aowow()->qry('UPDATE ::account_avatars SET `current` = IF(`id` = %i, 1, 0) WHERE `userId` = %i AND `status` <> %i', $customIcon, User::$id, AvatarMgr::STATUS_REJECTED);
|
||||
if (!is_int($x))
|
||||
return Lang::main('genericError');
|
||||
|
||||
if (!is_int(DB::Aowow()->query('UPDATE ?_account SET `avatar` = 2 WHERE `id` = ?d', User::$id)))
|
||||
if (!is_int(DB::Aowow()->qry('UPDATE ::account SET `avatar` = 2 WHERE `id` = %i', User::$id)))
|
||||
return Lang::main('intError');
|
||||
|
||||
$this->success = true;
|
||||
|
|
|
|||
|
|
@ -28,8 +28,8 @@ class AccountPremiumborderResponse extends TextResponse
|
|||
if (!$this->assertPOST('avatarborder'))
|
||||
return;
|
||||
|
||||
$x = DB::Aowow()->query('UPDATE ?_account SET `avatarborder` = ?d WHERE `id` = ?d', $this->_post['avatarborder'], User::$id);
|
||||
if (!is_int($x))
|
||||
$x = DB::Aowow()->qry('UPDATE ::account SET `avatarborder` = %i WHERE `id` = %i', $this->_post['avatarborder'], User::$id);
|
||||
if (is_null($x))
|
||||
$_SESSION['msg'] = ['premiumborder', false, Lang::main('genericError')];
|
||||
else if (!$x)
|
||||
$_SESSION['msg'] = ['premiumborder', true, Lang::account('updateMessage', 'avNoChange')];
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ class AccountRenameiconResponse extends TextResponse
|
|||
return;
|
||||
|
||||
// regexp same as in account.js
|
||||
DB::Aowow()->query('UPDATE ?_account_avatars SET `name` = ? WHERE `id` = ?d AND `userId` = ?d', trim($this->_post['name']), $this->_post['id'], User::$id);
|
||||
DB::Aowow()->qry('UPDATE ::account_avatars SET `name` = %s WHERE `id` = %i AND `userId` = %i', trim($this->_post['name']), $this->_post['id'], User::$id);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -69,19 +69,19 @@ class AccountResendResponse extends TemplateResponse
|
|||
if (!$this->_post['email'])
|
||||
return Lang::account('emailInvalid');
|
||||
|
||||
$timeout = DB::Aowow()->selectCell('SELECT `unbanDate` FROM ?_account_bannedips WHERE `ip` = ? AND `type` = ?d AND `count` > ?d AND `unbanDate` > UNIX_TIMESTAMP()', User::$ip, IP_BAN_TYPE_REGISTRATION_ATTEMPT, Cfg::get('ACC_FAILED_AUTH_COUNT'));
|
||||
$timeout = DB::Aowow()->selectCell('SELECT `unbanDate` FROM ::account_bannedips WHERE `ip` = %s AND `type` = %i AND `count` > %i AND `unbanDate` > UNIX_TIMESTAMP()', User::$ip, IP_BAN_TYPE_REGISTRATION_ATTEMPT, Cfg::get('ACC_FAILED_AUTH_COUNT'));
|
||||
|
||||
// on cooldown pretend we dont know the email address
|
||||
if ($timeout && $timeout > time())
|
||||
return Cfg::get('DEBUG') ? 'resend on cooldown: '.DateTime::formatTimeElapsed($timeout * 1000).' remaining' : Lang::account('inputbox', 'error', 'emailNotFound');
|
||||
|
||||
// check email and account status
|
||||
if ($token = DB::Aowow()->selectCell('SELECT `token` FROM ?_account WHERE `email` = ? AND `status` = ?d', $this->_post['email'], ACC_STATUS_NEW))
|
||||
if ($token = DB::Aowow()->selectCell('SELECT `token` FROM ::account WHERE `email` = %s AND `status` = %i', $this->_post['email'], ACC_STATUS_NEW))
|
||||
{
|
||||
if (!Util::sendMail($this->_post['email'], 'activate-account', [$token]))
|
||||
return Lang::main('intError');
|
||||
|
||||
DB::Aowow()->query('INSERT INTO ?_account_bannedips (`ip`, `type`, `count`, `unbanDate`) VALUES (?, ?d, ?d, UNIX_TIMESTAMP() + ?d) ON DUPLICATE KEY UPDATE `count` = `count` + ?d, `unbanDate` = UNIX_TIMESTAMP() + ?d',
|
||||
DB::Aowow()->qry('INSERT INTO ::account_bannedips (`ip`, `type`, `count`, `unbanDate`) VALUES (%s, %i, %i, UNIX_TIMESTAMP() + %i) ON DUPLICATE KEY UPDATE `count` = `count` + %i, `unbanDate` = UNIX_TIMESTAMP() + %i',
|
||||
User::$ip, IP_BAN_TYPE_REGISTRATION_ATTEMPT, Cfg::get('ACC_FAILED_AUTH_COUNT') + 1, Cfg::get('ACC_FAILED_AUTH_COUNT'), Cfg::get('ACC_FAILED_AUTH_BLOCK'), Cfg::get('ACC_FAILED_AUTH_BLOCK'));
|
||||
|
||||
$this->success = true;
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ class AccountresetpasswordResponse extends TemplateResponse
|
|||
$errMsg = '';
|
||||
if (!$this->assertGET('key') && !$this->assertPOST('key'))
|
||||
$errMsg = Lang::account('inputbox', 'error', 'passTokenLost');
|
||||
else if ($this->_get['key'] && !DB::Aowow()->selectCell('SELECT 1 FROM ?_account WHERE `token` = ? AND `status` = ?d AND `statusTimer` > UNIX_TIMESTAMP()', $this->_get['key'], ACC_STATUS_RECOVER_PASS))
|
||||
else if ($this->_get['key'] && !DB::Aowow()->selectCell('SELECT 1 FROM ::account WHERE `token` = %s AND `status` = %i AND `statusTimer` > UNIX_TIMESTAMP()', $this->_get['key'], ACC_STATUS_RECOVER_PASS))
|
||||
$errMsg = Lang::account('inputbox', 'error', 'passTokenUsed');
|
||||
|
||||
if ($errMsg)
|
||||
|
|
@ -99,7 +99,7 @@ class AccountresetpasswordResponse extends TemplateResponse
|
|||
if ($this->_post['password'] != $this->_post['c_password'])
|
||||
return Lang::account('passCheckFail');
|
||||
|
||||
$userData = DB::Aowow()->selectRow('SELECT `id`, `passHash` FROM ?_account WHERE `token` = ? AND `email` = ? AND `status` = ?d AND `statusTimer` > UNIX_TIMESTAMP()',
|
||||
$userData = DB::Aowow()->selectRow('SELECT `id`, `passHash` FROM ::account WHERE `token` = %s AND `email` = %s AND `status` = %i AND `statusTimer` > UNIX_TIMESTAMP()',
|
||||
$this->_post['key'],
|
||||
$this->_post['email'],
|
||||
ACC_STATUS_RECOVER_PASS
|
||||
|
|
@ -110,7 +110,7 @@ class AccountresetpasswordResponse extends TemplateResponse
|
|||
if (!User::verifyCrypt($this->_post['c_password'], $userData['passHash']))
|
||||
return Lang::account('newPassDiff');
|
||||
|
||||
if (!DB::Aowow()->query('UPDATE ?_account SET `passHash` = ?, `status` = ?d WHERE `id` = ?d', User::hashCrypt($this->_post['c_password']), ACC_STATUS_NONE, $userData['id']))
|
||||
if (!DB::Aowow()->qry('UPDATE ::account SET `passHash` = %s, `status` = %i WHERE `id` = %i', User::hashCrypt($this->_post['c_password']), ACC_STATUS_NONE, $userData['id']))
|
||||
return Lang::main('intError');
|
||||
|
||||
$this->success = true;
|
||||
|
|
|
|||
|
|
@ -46,12 +46,12 @@ class AccountRevertemailaddressResponse extends TemplateResponse
|
|||
if (!$this->assertGET('key'))
|
||||
return Lang::main('intError');
|
||||
|
||||
$acc = DB::Aowow()->selectRow('SELECT `updateValue`, `status`, `statusTimer` FROM ?_account WHERE `token` = ?', $this->_get['key']);
|
||||
$acc = DB::Aowow()->selectRow('SELECT `updateValue`, `status`, `statusTimer` FROM ::account WHERE `token` = %s', $this->_get['key']);
|
||||
if (!$acc || $acc['status'] != ACC_STATUS_CHANGE_EMAIL || $acc['statusTimer'] < time())
|
||||
return Lang::account('inputbox', 'error', 'mailTokenUsed');
|
||||
|
||||
// 0 changes == error
|
||||
if (!DB::Aowow()->query('UPDATE ?_account SET `status` = ?d, `statusTimer` = 0, `token` = "", `updateValue` = "" WHERE `token` = ?', ACC_STATUS_NONE, $this->_get['key']))
|
||||
if (!DB::Aowow()->qry('UPDATE ::account SET `status` = %i, `statusTimer` = 0, `token` = "", `updateValue` = "" WHERE `token` = %s', ACC_STATUS_NONE, $this->_get['key']))
|
||||
return Lang::main('intError');
|
||||
|
||||
$this->success = true;
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ class AccountSigninResponse extends TemplateResponse
|
|||
// coming from user recovery or creation, prefill username
|
||||
if ($this->_get['key'])
|
||||
{
|
||||
if ($userData = DB::Aowow()->selectRow('SELECT a.`login` AS "0", IF(s.`expires`, 0, 1) AS "1" FROM ?_account a LEFT JOIN ?_account_sessions s ON a.`id` = s.`userId` AND a.`token` = s.`sessionId` WHERE a.`status` IN (?a) AND a.`token` = ?',
|
||||
if ($userData = DB::Aowow()->selectRow('SELECT a.`login` AS "0", IF(s.`expires`, 0, 1) AS "1" FROM ::account a LEFT JOIN ::account_sessions s ON a.`id` = s.`userId` AND a.`token` = s.`sessionId` WHERE a.`status` IN %in AND a.`token` = %s',
|
||||
[ACC_STATUS_RECOVER_USER, ACC_STATUS_NONE], $this->_get['key']))
|
||||
[$username, $rememberMe] = $userData;
|
||||
}
|
||||
|
|
@ -116,7 +116,7 @@ class AccountSigninResponse extends TemplateResponse
|
|||
}
|
||||
|
||||
// reset account status, update expiration
|
||||
$ok = DB::Aowow()->query('UPDATE ?_account SET `prevIP` = IF(`curIp` = ?, `prevIP`, `curIP`), `curIP` = IF(`curIp` = ?, `curIP`, ?), `status` = IF(`status` = ?d, `status`, 0), `statusTimer` = IF(`status` = ?d, `statusTimer`, 0), `token` = IF(`status` = ?d, `token`, "") WHERE `id` = ?d',
|
||||
$ok = DB::Aowow()->qry('UPDATE ::account SET `prevIP` = IF(`curIp` = %s, `prevIP`, `curIP`), `curIP` = IF(`curIp` = %s, `curIP`, %s), `status` = IF(`status` = %i, `status`, 0), `statusTimer` = IF(`status` = %i, `statusTimer`, 0), `token` = IF(`status` = %i, `token`, "") WHERE `id` = %i',
|
||||
User::$ip, User::$ip, User::$ip,
|
||||
ACC_STATUS_NEW, ACC_STATUS_NEW, ACC_STATUS_NEW,
|
||||
User::$id // available after successful User:authenticate
|
||||
|
|
@ -130,12 +130,12 @@ class AccountSigninResponse extends TemplateResponse
|
|||
|
||||
// DELETE temp session
|
||||
if ($this->_get['key'])
|
||||
DB::Aowow()->query('DELETE FROM ?_account_sessions WHERE `sessionId` = ?', $this->_get['key']);
|
||||
DB::Aowow()->qry('DELETE FROM ::account_sessions WHERE `sessionId` = %s', $this->_get['key']);
|
||||
|
||||
session_regenerate_id(true); // user status changed => regenerate id
|
||||
|
||||
// create new session entry
|
||||
DB::Aowow()->query('INSERT INTO ?_account_sessions (`userId`, `sessionId`, `created`, `expires`, `touched`, `deviceInfo`, `ip`, `status`) VALUES (?d, ?, ?d, ?d, ?d, ?, ?, ?d)',
|
||||
DB::Aowow()->qry('INSERT INTO ::account_sessions (`userId`, `sessionId`, `created`, `expires`, `touched`, `deviceInfo`, `ip`, `status`) VALUES (%i, %s, %i, %i, %i, %s, %s, %i)',
|
||||
User::$id, session_id(), time(), $this->_post['remember_me'] ? 0 : time() + Cfg::get('SESSION_TIMEOUT_DELAY'), time(), User::$agent, User::$ip, SESSION_ACTIVE);
|
||||
|
||||
if (User::init()) // reinitialize the user
|
||||
|
|
|
|||
|
|
@ -27,9 +27,9 @@ class AccountSignoutResponse extends TextResponse
|
|||
protected function generate() : void
|
||||
{
|
||||
if ($this->_get['global'])
|
||||
DB::Aowow()->query('UPDATE ?_account_sessions SET `touched` = ?d, `status` = ?d WHERE `userId` = ?d', time(), SESSION_FORCED_LOGOUT, User::$id);
|
||||
DB::Aowow()->qry('UPDATE ::account_sessions SET `touched` = %i, `status` = %i WHERE `userId` = %i', time(), SESSION_FORCED_LOGOUT, User::$id);
|
||||
else
|
||||
DB::Aowow()->query('UPDATE ?_account_sessions SET `touched` = ?d, `status` = ?d WHERE `sessionId` = ?', time(), SESSION_LOGOUT, session_id());
|
||||
DB::Aowow()->qry('UPDATE ::account_sessions SET `touched` = %i, `status` = %i WHERE `sessionId` = %s', time(), SESSION_LOGOUT, session_id());
|
||||
|
||||
User::destroy();
|
||||
|
||||
|
|
|
|||
|
|
@ -109,24 +109,24 @@ class AccountSignupResponse extends TemplateResponse
|
|||
return Lang::main('intError');
|
||||
|
||||
// limit account creation
|
||||
if (DB::Aowow()->selectRow('SELECT 1 FROM ?_account_bannedips WHERE `type` = ?d AND `ip` = ? AND `count` >= ?d AND `unbanDate` >= UNIX_TIMESTAMP()', IP_BAN_TYPE_REGISTRATION_ATTEMPT, User::$ip, Cfg::get('ACC_FAILED_AUTH_COUNT')))
|
||||
if (DB::Aowow()->selectRow('SELECT 1 FROM ::account_bannedips WHERE `type` = %i AND `ip` = %s AND `count` >= %i AND `unbanDate` >= UNIX_TIMESTAMP()', IP_BAN_TYPE_REGISTRATION_ATTEMPT, User::$ip, Cfg::get('ACC_FAILED_AUTH_COUNT')))
|
||||
{
|
||||
DB::Aowow()->query('UPDATE ?_account_bannedips SET `count` = `count` + 1, `unbanDate` = UNIX_TIMESTAMP() + ?d WHERE `ip` = ? AND `type` = ?d', Cfg::get('ACC_FAILED_AUTH_BLOCK'), User::$ip, IP_BAN_TYPE_REGISTRATION_ATTEMPT);
|
||||
DB::Aowow()->qry('UPDATE ::account_bannedips SET `count` = `count` + 1, `unbanDate` = UNIX_TIMESTAMP() + %i WHERE `ip` = %s AND `type` = %i', Cfg::get('ACC_FAILED_AUTH_BLOCK'), User::$ip, IP_BAN_TYPE_REGISTRATION_ATTEMPT);
|
||||
return Lang::account('inputbox', 'error', 'signupExceeded', [DateTime::formatTimeElapsedFloat(Cfg::get('ACC_FAILED_AUTH_BLOCK') * 1000)]);
|
||||
}
|
||||
|
||||
// username / email taken
|
||||
if ($inUseData = DB::Aowow()->SelectRow('SELECT `id`, `username`, `status` = ?d AND `statusTimer` < UNIX_TIMESTAMP() AS "expired" FROM ?_account WHERE (LOWER(`username`) = LOWER(?) OR LOWER(`email`) = LOWER(?))', ACC_STATUS_NEW, $this->_post['username'], $this->_post['email']))
|
||||
if ($inUseData = DB::Aowow()->SelectRow('SELECT `id`, `username`, `status` = %i AND `statusTimer` < UNIX_TIMESTAMP() AS "expired" FROM ::account WHERE (LOWER(`username`) = LOWER(%s) OR LOWER(`email`) = LOWER(%s))', ACC_STATUS_NEW, $this->_post['username'], $this->_post['email']))
|
||||
{
|
||||
if ($inUseData['expired'])
|
||||
DB::Aowow()->query('DELETE FROM ?_account WHERE `id` = ?d', $inUseData['id']);
|
||||
DB::Aowow()->qry('DELETE FROM ::account WHERE `id` = %i', $inUseData['id']);
|
||||
else
|
||||
return Util::lower($inUseData['username']) == Util::lower($this->_post['username']) ? Lang::account('nameInUse') : Lang::account('mailInUse');
|
||||
}
|
||||
|
||||
// create..
|
||||
$token = Util::createHash();
|
||||
$userId = DB::Aowow()->query('INSERT INTO ?_account (`login`, `passHash`, `username`, `email`, `joindate`, `curIP`, `locale`, `userGroups`, `status`, `statusTimer`, `token`) VALUES (?, ?, ?, ?, UNIX_TIMESTAMP(), ?, ?d, ?d, ?d, UNIX_TIMESTAMP() + ?d, ?)',
|
||||
$userId = DB::Aowow()->qry('INSERT INTO ::account (`login`, `passHash`, `username`, `email`, `joindate`, `curIP`, `locale`, `userGroups`, `status`, `statusTimer`, `token`) VALUES (%s, %s, %s, %s, UNIX_TIMESTAMP(), %s, %i, %i, %i, UNIX_TIMESTAMP() + %i, %s)',
|
||||
$this->_post['username'],
|
||||
User::hashCrypt($this->_post['password']),
|
||||
$this->_post['username'],
|
||||
|
|
@ -143,14 +143,14 @@ class AccountSignupResponse extends TemplateResponse
|
|||
return Lang::main('intError');
|
||||
|
||||
// create session tied to the token to store remember_me status
|
||||
DB::Aowow()->query('INSERT INTO ?_account_sessions (`userId`, `sessionId`, `created`, `expires`, `touched`, `deviceInfo`, `ip`, `status`) VALUES (?d, ?, ?d, ?d, ?d, ?, ?, ?d)',
|
||||
DB::Aowow()->qry('INSERT INTO ::account_sessions (`userId`, `sessionId`, `created`, `expires`, `touched`, `deviceInfo`, `ip`, `status`) VALUES (%i, %s, %i, %i, %i, %s, %s, %i)',
|
||||
$userId, $token, time(), $this->_post['remember_me'] ? 0 : time() + Cfg::get('SESSION_TIMEOUT_DELAY'), time(), User::$agent, User::$ip, SESSION_ACTIVE);
|
||||
|
||||
if (!Util::sendMail($this->_post['email'], 'activate-account', [$token], Cfg::get('ACC_CREATE_SAVE_DECAY')))
|
||||
return Lang::main('intError2', ['send mail']);
|
||||
|
||||
// success: update ip-bans
|
||||
DB::Aowow()->query('INSERT INTO ?_account_bannedips (`ip`, `type`, `count`, `unbanDate`) VALUES (?, ?d, 1, UNIX_TIMESTAMP() + ?d) ON DUPLICATE KEY UPDATE `count` = `count` + 1, `unbanDate` = UNIX_TIMESTAMP() + ?d',
|
||||
DB::Aowow()->qry('INSERT INTO ::account_bannedips (`ip`, `type`, `count`, `unbanDate`) VALUES (%s, %i, 1, UNIX_TIMESTAMP() + %i) ON DUPLICATE KEY UPDATE `count` = `count` + 1, `unbanDate` = UNIX_TIMESTAMP() + %i',
|
||||
User::$ip, IP_BAN_TYPE_REGISTRATION_ATTEMPT, Cfg::get('ACC_FAILED_AUTH_BLOCK'), Cfg::get('ACC_FAILED_AUTH_BLOCK'));
|
||||
|
||||
Util::gainSiteReputation($userId, SITEREP_ACTION_REGISTER);
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ class AccountUpdatecommunitysettingsResponse extends TextResponse
|
|||
return Lang::main('genericError');
|
||||
|
||||
// description - 0 modified rows is still success
|
||||
if (!is_int(DB::Aowow()->query('UPDATE ?_account SET `description` = ? WHERE `id` = ?d', $this->_post['desc'], User::$id)))
|
||||
if (!is_int(DB::Aowow()->qry('UPDATE ::account SET `description` = %s WHERE `id` = %i', $this->_post['desc'], User::$id)))
|
||||
return Lang::main('genericError');
|
||||
|
||||
$this->success = true;
|
||||
|
|
|
|||
|
|
@ -48,21 +48,21 @@ class AccountUpdateemailResponse extends TextResponse
|
|||
if (!$this->_post['newemail'])
|
||||
return Lang::account('emailInvalid');
|
||||
|
||||
if (DB::Aowow()->selectCell('SELECT 1 FROM ?_account WHERE `email` = ? AND `id` <> ?d', $this->_post['newemail'], User::$id))
|
||||
if (DB::Aowow()->selectCell('SELECT 1 FROM ::account WHERE `email` = %s AND `id` <> %i', $this->_post['newemail'], User::$id))
|
||||
return Lang::account('mailInUse');
|
||||
|
||||
$status = DB::Aowow()->selectCell('SELECT `status` FROM ?_account WHERE `statusTimer` > UNIX_TIMESTAMP() AND `id` = ?d', User::$id);
|
||||
$status = DB::Aowow()->selectCell('SELECT `status` FROM ::account WHERE `statusTimer` > UNIX_TIMESTAMP() AND `id` = %i', User::$id);
|
||||
if ($status != ACC_STATUS_NONE && $status != ACC_STATUS_CHANGE_EMAIL)
|
||||
return Lang::account('inputbox', 'error', 'isRecovering', [DateTime::formatTimeElapsedFloat(Cfg::get('ACC_RECOVERY_DECAY') * 1000)]);
|
||||
|
||||
$oldEmail = DB::Aowow()->selectCell('SELECT `email` FROM ?_account WHERE `id` = ?d', User::$id);
|
||||
$oldEmail = DB::Aowow()->selectCell('SELECT `email` FROM ::account WHERE `id` = %i', User::$id);
|
||||
if ($this->_post['newemail'] == $oldEmail)
|
||||
return Lang::account('newMailDiff');
|
||||
|
||||
$token = Util::createHash();
|
||||
|
||||
// store new mail in updateValue field, exchange when confirmation mail gets confirmed
|
||||
if (!DB::Aowow()->query('UPDATE ?_account SET `updateValue` = ?, `status` = ?d, `statusTimer` = UNIX_TIMESTAMP() + ?d, `token` = ? WHERE `id` = ?d',
|
||||
if (!DB::Aowow()->qry('UPDATE ::account SET `updateValue` = %s, `status` = %i, `statusTimer` = UNIX_TIMESTAMP() + %i, `token` = %s WHERE `id` = %i',
|
||||
$this->_post['newemail'], ACC_STATUS_CHANGE_EMAIL, Cfg::get('ACC_RECOVERY_DECAY'), $token, User::$id))
|
||||
return Lang::main('intError');
|
||||
|
||||
|
|
|
|||
|
|
@ -41,15 +41,15 @@ class AccountUpdategeneralsettingsResponse extends TextResponse
|
|||
if ($this->_post['modelrace'] && !ChrRace::tryFrom($this->_post['modelrace']))
|
||||
return Lang::main('genericError');
|
||||
|
||||
// js handles this as cookie, so saved as cookie; Q - also save in ?_account table?
|
||||
if (!DB::Aowow()->query('REPLACE INTO ?_account_cookies (`userId`, `name`, `data`) VALUES (?d, ?, ?)', User::$id, 'default_3dmodel', $this->_post['modelrace']. ',' . $this->_post['modelgender']))
|
||||
// js handles this as cookie, so saved as cookie; Q - also save in ::account table?
|
||||
if (!DB::Aowow()->qry('REPLACE INTO ::account_cookies (`userId`, `name`, `data`) VALUES (%i, %s, %s)', User::$id, 'default_3dmodel', $this->_post['modelrace']. ',' . $this->_post['modelgender']))
|
||||
return Lang::main('genericError');
|
||||
|
||||
if (!setcookie('default_3dmodel', $this->_post['modelrace']. ',' . $this->_post['modelgender'], 0, '/'))
|
||||
return Lang::main('intError');
|
||||
|
||||
// int > number of edited rows > no changes is still success
|
||||
if (!is_int(DB::Aowow()->query('UPDATE ?_account SET `debug` = ?d WHERE `id` = ?d', $this->_post['idsInLists'] ? 1 : 0, User::$id)))
|
||||
if (!is_int(DB::Aowow()->qry('UPDATE ::account SET `debug` = %i WHERE `id` = %i', $this->_post['idsInLists'] ? 1 : 0, User::$id)))
|
||||
return Lang::main('intError');
|
||||
|
||||
$this->success = true;
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ class AccountUpdatepasswordResponse extends TextResponse
|
|||
if ($this->_post['newPassword'] !== $this->_post['confirmPassword'])
|
||||
return Lang::account('passMismatch');
|
||||
|
||||
$userData = DB::Aowow()->selectRow('SELECT `status`, `passHash`, `statusTimer` FROM ?_account WHERE `id` = ?d', User::$id);
|
||||
$userData = DB::Aowow()->selectRow('SELECT `status`, `passHash`, `statusTimer` FROM ::account WHERE `id` = %i', User::$id);
|
||||
if ($userData['status'] != ACC_STATUS_NONE && $userData['status'] != ACC_STATUS_CHANGE_PASS && $userData['statusTimer'] > time())
|
||||
return Lang::account('inputbox', 'error', 'isRecovering', [DateTime::formatTimeElapsedFloat(Cfg::get('ACC_RECOVERY_DECAY') * 1000)]);
|
||||
|
||||
|
|
@ -66,17 +66,17 @@ class AccountUpdatepasswordResponse extends TextResponse
|
|||
$token = Util::createHash();
|
||||
|
||||
// store new hash in updateValue field, exchange when confirmation mail gets confirmed
|
||||
if (!DB::Aowow()->query('UPDATE ?_account SET `updateValue` = ?, `status` = ?d, `statusTimer` = UNIX_TIMESTAMP() + ?d, `token` = ? WHERE `id` = ?d',
|
||||
if (!DB::Aowow()->qry('UPDATE ::account SET `updateValue` = %s, `status` = %i, `statusTimer` = UNIX_TIMESTAMP() + %i, `token` = %s WHERE `id` = %i',
|
||||
User::hashCrypt($this->_post['newPassword']), ACC_STATUS_CHANGE_PASS, Cfg::get('ACC_RECOVERY_DECAY'), $token, User::$id))
|
||||
return Lang::main('intError');
|
||||
|
||||
$email = DB::Aowow()->selectCell('SELECT `email` FROM ?_account WHERE `id` = ?d', User::$id);
|
||||
$email = DB::Aowow()->selectCell('SELECT `email` FROM ::account WHERE `id` = %i', User::$id);
|
||||
if (!Util::sendMail($email, 'update-password', [$token, $email], Cfg::get('ACC_RECOVERY_DECAY')))
|
||||
return Lang::main('intError2', ['send mail']);
|
||||
|
||||
// logout all other active sessions
|
||||
if ($this->_post['globalLogout'])
|
||||
DB::Aowow()->query('UPDATE ?_account_sessions SET `status` = ?d, `touched` = ?d WHERE `userId` = ?d AND `sessionId` <> ? AND `status` = ?d', SESSION_FORCED_LOGOUT, time(), User::$id, session_id(), SESSION_ACTIVE);
|
||||
DB::Aowow()->qry('UPDATE ::account_sessions SET `status` = %i, `touched` = %i WHERE `userId` = %i AND `sessionId` <> ? AND `status` = %i', SESSION_FORCED_LOGOUT, time(), User::$id, session_id(), SESSION_ACTIVE);
|
||||
|
||||
$this->success = true;
|
||||
return Lang::account('updateMessage', 'personal', [User::$email]);
|
||||
|
|
|
|||
|
|
@ -44,14 +44,14 @@ class AccountUpdateusernameResponse extends TextResponse
|
|||
if (!$this->assertPOST('newUsername'))
|
||||
return Lang::main('intError');
|
||||
|
||||
if (DB::Aowow()->selectCell('SELECT `renameCooldown` FROM ?_account WHERE `id` = ?d', User::$id) > time())
|
||||
if (DB::Aowow()->selectCell('SELECT `renameCooldown` FROM ::account WHERE `id` = %i', User::$id) > time())
|
||||
return Lang::main('intError'); // should have grabbed the error response..
|
||||
|
||||
// yes, including your current name. you don't want to change into your current name, right?
|
||||
if (DB::Aowow()->selectCell('SELECT 1 FROM ?_account WHERE LOWER(`username`) = LOWER(?)', $this->_post['newUsername']))
|
||||
if (DB::Aowow()->selectCell('SELECT 1 FROM ::account WHERE LOWER(`username`) = LOWER(%s)', $this->_post['newUsername']))
|
||||
return Lang::account('nameInUse');
|
||||
|
||||
DB::Aowow()->query('UPDATE ?_account SET `username` = ?, `renameCooldown` = ?d WHERE `id` = ?d', $this->_post['newUsername'], time() + Cfg::get('acc_rename_decay'), User::$id);
|
||||
DB::Aowow()->qry('UPDATE ::account SET `username` = %s, `renameCooldown` = %i WHERE `id` = %i', $this->_post['newUsername'], time() + Cfg::get('acc_rename_decay'), User::$id);
|
||||
|
||||
$this->success = true;
|
||||
return Lang::account('updateMessage', 'username', [User::$username, $this->_post['newUsername']]);
|
||||
|
|
|
|||
|
|
@ -46,11 +46,11 @@ class AccountWeightscalesResponse extends TextResponse
|
|||
if (!$this->assertPOST('name', 'scale'))
|
||||
return;
|
||||
|
||||
$nScales = DB::Aowow()->selectCell('SELECT COUNT(`id`) FROM ?_account_weightscales WHERE `userId` = ?d', User::$id);
|
||||
$nScales = DB::Aowow()->selectCell('SELECT COUNT(`id`) FROM ::account_weightscales WHERE `userId` = %i', User::$id);
|
||||
if ($nScales >= self::MAX_SCALES)
|
||||
return;
|
||||
|
||||
if ($id = DB::Aowow()->query('INSERT INTO ?_account_weightscales (`userId`, `name`) VALUES (?d, ?)', User::$id, $this->_post['name']))
|
||||
if ($id = DB::Aowow()->qry('INSERT INTO ::account_weightscales (`userId`, `name`) VALUES (%i, %s)', User::$id, $this->_post['name']))
|
||||
if ($this->storeScaleData($id))
|
||||
$this->result = $id;
|
||||
}
|
||||
|
|
@ -61,13 +61,13 @@ class AccountWeightscalesResponse extends TextResponse
|
|||
return;
|
||||
|
||||
// not in DB or not owned by user
|
||||
if (!DB::Aowow()->selectCell('SELECT 1 FROM ?_account_weightscales WHERE `userId` = ?d AND `id` = ?d', User::$id, $this->_post['id']))
|
||||
if (!DB::Aowow()->selectCell('SELECT 1 FROM ::account_weightscales WHERE `userId` = %i AND `id` = %i', User::$id, $this->_post['id']))
|
||||
{
|
||||
trigger_error('AccountWeightscalesResponse::updateWeights - scale #'.$this->_post['id'].' not in db or not owned by user #'.User::$id, E_USER_ERROR);
|
||||
return;
|
||||
}
|
||||
|
||||
DB::Aowow()->query('UPDATE ?_account_weightscales SET `name` = ? WHERE `id` = ?d', $this->_post['name'], $this->_post['id']);
|
||||
DB::Aowow()->qry('UPDATE ::account_weightscales SET `name` = %s WHERE `id` = %i', $this->_post['name'], $this->_post['id']);
|
||||
$this->storeScaleData($this->_post['id']);
|
||||
|
||||
// return edited id on success
|
||||
|
|
@ -77,20 +77,24 @@ class AccountWeightscalesResponse extends TextResponse
|
|||
private function deleteWeights() : void
|
||||
{
|
||||
if ($this->assertPOST('id'))
|
||||
DB::Aowow()->query('DELETE FROM ?_account_weightscales WHERE `id` = ?d AND `userId` = ?d', $this->_post['id'], User::$id);
|
||||
DB::Aowow()->qry('DELETE FROM ::account_weightscales WHERE `id` = %i AND `userId` = %i', $this->_post['id'], User::$id);
|
||||
|
||||
$this->result = '';
|
||||
}
|
||||
|
||||
private function storeScaleData(int $scaleId) : bool
|
||||
{
|
||||
if (!is_int(DB::Aowow()->query('DELETE FROM ?_account_weightscale_data WHERE `id` = ?d', $scaleId)))
|
||||
if (!is_int(DB::Aowow()->qry('DELETE FROM ::account_weightscale_data WHERE `id` = %i', $scaleId)))
|
||||
return false;
|
||||
|
||||
foreach ($this->_post['scale'] as [$k, $v])
|
||||
if (Stat::getWeightJson($k)) // $v is known to be a positive int due to regex check
|
||||
if (!is_int(DB::Aowow()->query('INSERT INTO ?_account_weightscale_data VALUES (?d, ?, ?d)', $scaleId, $k, $v)))
|
||||
return false;
|
||||
// $x['val'] is known to be a positive int due to regex check
|
||||
$scaleData = array_filter($this->_post['scale'], fn($x) => Stat::getWeightJson($x['field']) && $x['val'] > 0);
|
||||
|
||||
array_walk($scaleData, fn(&$x) => $x['id'] = $scaleId);
|
||||
|
||||
foreach ($scaleData as $sd)
|
||||
if (is_null(DB::Aowow()->qry('INSERT INTO ::account_weightscale_data %v', $sd)))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
@ -103,7 +107,7 @@ class AccountWeightscalesResponse extends TextResponse
|
|||
protected static function checkScale(string $val) : array
|
||||
{
|
||||
if (preg_match('/^((\w+:\d+)(,\w+:\d+)*)$/', $val))
|
||||
return array_map(fn($x) => explode(':', $x), explode(',', $val));
|
||||
return array_map(fn($x) => array_combine(['field', 'val'], explode(':', $x)), explode(',', $val));
|
||||
|
||||
return [];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -73,7 +73,7 @@ class AchievementBaseResponse extends TemplateResponse implements ICache
|
|||
while ($curCat > 0)
|
||||
{
|
||||
$catPath[] = $curCat;
|
||||
$curCat = DB::Aowow()->SelectCell('SELECT `parentCat` FROM ?_achievementcategory WHERE `id` = ?d', $curCat);
|
||||
$curCat = DB::Aowow()->SelectCell('SELECT `parentCat` FROM ::achievementcategory WHERE `id` = %i', $curCat);
|
||||
}
|
||||
|
||||
$this->breadcrumb = array_merge($this->breadcrumb, array_reverse($catPath));
|
||||
|
|
@ -120,8 +120,8 @@ class AchievementBaseResponse extends TemplateResponse implements ICache
|
|||
// profiler relateed (note that this is part of the cache. I don't think this is important enough to calc for every view)
|
||||
if (Cfg::get('PROFILER_ENABLE') && !($this->subject->getField('flags') & ACHIEVEMENT_FLAG_COUNTER))
|
||||
{
|
||||
$x = DB::Aowow()->selectCell('SELECT COUNT(1) FROM ?_profiler_completion_achievements WHERE `achievementId` = ?d', $this->typeId);
|
||||
$y = DB::Aowow()->selectCell('SELECT COUNT(1) FROM ?_profiler_profiles WHERE `custom` = 0 AND `stub` = 0');
|
||||
$x = DB::Aowow()->selectCell('SELECT COUNT(1) FROM ::profiler_completion_achievements WHERE `achievementId` = %i', $this->typeId);
|
||||
$y = DB::Aowow()->selectCell('SELECT COUNT(1) FROM ::profiler_profiles WHERE `custom` = 0 AND `stub` = 0');
|
||||
$infobox[] = Lang::profiler('attainedBy', [round(($x ?: 0) * 100 / ($y ?: 1))]);
|
||||
|
||||
// completion row added by InfoboxMarkup
|
||||
|
|
@ -207,7 +207,7 @@ class AchievementBaseResponse extends TemplateResponse implements ICache
|
|||
$this->rewards = [$rewItems, $rewTitles, $text];
|
||||
|
||||
// factionchange-equivalent
|
||||
if ($pendant = DB::World()->selectCell('SELECT IF(`horde_id` = ?d, `alliance_id`, -`horde_id`) FROM player_factionchange_achievement WHERE `alliance_id` = ?d OR `horde_id` = ?d', $this->typeId, $this->typeId, $this->typeId))
|
||||
if ($pendant = DB::World()->selectCell('SELECT IF(`horde_id` = %i, `alliance_id`, -`horde_id`) FROM player_factionchange_achievement WHERE `alliance_id` = %i OR `horde_id` = %i', $this->typeId, $this->typeId, $this->typeId))
|
||||
{
|
||||
$altAcv = new AchievementList(array(['id', abs($pendant)]));
|
||||
if (!$altAcv->error)
|
||||
|
|
@ -230,7 +230,7 @@ class AchievementBaseResponse extends TemplateResponse implements ICache
|
|||
|
||||
// serverside extra-Data (not sure why ACHIEVEMENT_CRITERIA_DATA_TYPE_NONE is set, let a lone a couple hundred times)
|
||||
if ($crtIds = array_column($this->subject->getCriteria(), 'id'))
|
||||
$crtExtraData = DB::World()->select('SELECT `criteria_id` AS ARRAY_KEY, `type` AS ARRAY_KEY2, `value1`, `value2`, `ScriptName` FROM achievement_criteria_data WHERE `type` <> ?d AND `criteria_id` IN (?a)', ACHIEVEMENT_CRITERIA_DATA_TYPE_NONE, $crtIds);
|
||||
$crtExtraData = DB::World()->selectAssoc('SELECT `criteria_id` AS ARRAY_KEY, `type` AS ARRAY_KEY2, `value1`, `value2`, `ScriptName` FROM achievement_criteria_data WHERE `type` <> %i AND `criteria_id` IN %in', ACHIEVEMENT_CRITERIA_DATA_TYPE_NONE, $crtIds);
|
||||
else
|
||||
$crtExtraData = [];
|
||||
|
||||
|
|
@ -261,7 +261,7 @@ class AchievementBaseResponse extends TemplateResponse implements ICache
|
|||
case ACHIEVEMENT_CRITERIA_TYPE_PLAY_ARENA:
|
||||
case ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_BATTLEGROUND:
|
||||
case ACHIEVEMENT_CRITERIA_TYPE_DEATH_AT_MAP:
|
||||
$zoneId = DB::Aowow()->selectCell('SELECT `id` FROM ?_zones WHERE `mapId` = ?', $obj);
|
||||
$zoneId = DB::Aowow()->selectCell('SELECT `id` FROM ::zones WHERE `mapId` = %s', $obj);
|
||||
$crtIcon = new IconElement(Type::ZONE, $zoneId ?: 0, $crtName ?: ZoneList::getName($zoneId), size: IconElement::SIZE_SMALL, element: 'iconlist-icon');
|
||||
break;
|
||||
// link to area
|
||||
|
|
@ -423,7 +423,7 @@ class AchievementBaseResponse extends TemplateResponse implements ICache
|
|||
}
|
||||
|
||||
// tab: criteria of
|
||||
$refs = DB::Aowow()->SelectCol('SELECT `refAchievementId` FROM ?_achievementcriteria WHERE `type` = ?d AND `value1` = ?d',
|
||||
$refs = DB::Aowow()->SelectCol('SELECT `refAchievementId` FROM ::achievementcriteria WHERE `type` = %i AND `value1` = %i',
|
||||
ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_ACHIEVEMENT,
|
||||
$this->typeId
|
||||
);
|
||||
|
|
@ -463,7 +463,7 @@ class AchievementBaseResponse extends TemplateResponse implements ICache
|
|||
{
|
||||
if ($_ = $this->subject->getField('mailTemplate'))
|
||||
{
|
||||
$letter = DB::Aowow()->selectRow('SELECT * FROM ?_mails WHERE `id` = ?d', $_);
|
||||
$letter = DB::Aowow()->selectRow('SELECT * FROM ::mails WHERE `id` = %i', $_);
|
||||
if (!$letter)
|
||||
return false;
|
||||
|
||||
|
|
@ -502,7 +502,7 @@ class AchievementBaseResponse extends TemplateResponse implements ICache
|
|||
|
||||
$avlb = [];
|
||||
foreach (Profiler::getRealms() AS $rId => $rData)
|
||||
if (!DB::Characters($rId)->selectCell('SELECT 1 FROM character_achievement WHERE `achievement` = ?d', $pt->typeId))
|
||||
if (!DB::Characters($rId)->selectCell('SELECT 1 FROM character_achievement WHERE `achievement` = %i', $pt->typeId))
|
||||
$avlb[] = Util::ucWords($rData['name']);
|
||||
|
||||
if (!$avlb)
|
||||
|
|
|
|||
|
|
@ -123,7 +123,7 @@ class AchievementsBaseResponse extends TemplateResponse implements ICache
|
|||
$conditions = [Listview::DEFAULT_SIZE];
|
||||
if ($fiCnd)
|
||||
$conditions[] = $fiCnd;
|
||||
if ($catList = DB::Aowow()->SelectCol('SELECT `id` FROM ?_achievementcategory WHERE `parentCat` IN (?a) OR `parentCat2` IN (?a) ', $this->category, $this->category))
|
||||
if ($catList = DB::Aowow()->SelectCol('SELECT `id` FROM ::achievementcategory WHERE `parentCat` IN %in OR `parentCat2` IN %in ', $this->category, $this->category))
|
||||
$conditions[] = ['category', $catList];
|
||||
|
||||
$acvList = new AchievementList($conditions, ['calcTotal' => true]);
|
||||
|
|
|
|||
|
|
@ -44,13 +44,13 @@ class AdminAnnouncementsResponse extends TemplateResponse
|
|||
return;
|
||||
}
|
||||
|
||||
if (!DB::Aowow()->selectCell('SELECT 1 FROM ?_announcements WHERE `id` = ?d', $this->_get['id']))
|
||||
if (!DB::Aowow()->selectCell('SELECT 1 FROM ::announcements WHERE `id` = %i', $this->_get['id']))
|
||||
{
|
||||
trigger_error('AdminAnnouncementsResponse::updateStatus - announcement does not exist');
|
||||
return;
|
||||
}
|
||||
|
||||
DB::Aowow()->query('UPDATE ?_announcements SET `status` = ?d WHERE `id` = ?d', $this->_get['status'], $this->_get['id']);
|
||||
DB::Aowow()->qry('UPDATE ::announcements SET `status` = %i WHERE `id` = %i', $this->_get['status'], $this->_get['id']);
|
||||
}
|
||||
|
||||
private function displayEditor() : void
|
||||
|
|
|
|||
|
|
@ -33,13 +33,13 @@ class AdminCommentResponse extends TextResponse
|
|||
$ok = false;
|
||||
if ($this->_post['status']) // outdated, mark as deleted and clear other flags (sticky + outdated)
|
||||
{
|
||||
if ($ok = DB::Aowow()->query('UPDATE ?_comments SET `flags` = ?d, `deleteUserId` = ?d, `deleteDate` = ?d WHERE `id` = ?d', CC_FLAG_DELETED, User::$id, time(), $this->_post['id']))
|
||||
if ($ok = DB::Aowow()->qry('UPDATE ::comments SET `flags` = %i, `deleteUserId` = %i, `deleteDate` = %i WHERE `id` = %i', CC_FLAG_DELETED, User::$id, time(), $this->_post['id']))
|
||||
if ($rep = new Report(Report::MODE_COMMENT, Report::CO_OUT_OF_DATE, $this->_post['id']))
|
||||
$rep->close(Report::STATUS_CLOSED_SOLVED);
|
||||
}
|
||||
else // up to date
|
||||
{
|
||||
if ($ok = DB::Aowow()->query('UPDATE ?_comments SET `flags` = `flags` & ~?d WHERE `id` = ?d', CC_FLAG_OUTDATED, $this->_post['id']))
|
||||
if ($ok = DB::Aowow()->qry('UPDATE ::comments SET `flags` = `flags` & ~%i WHERE `id` = %i', CC_FLAG_OUTDATED, $this->_post['id']))
|
||||
if ($rep = new Report(Report::MODE_COMMENT, Report::CO_OUT_OF_DATE, $this->_post['id']))
|
||||
$rep->close(Report::STATUS_CLOSED_WONTFIX);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ class AdminGuideResponse extends TextResponse
|
|||
return;
|
||||
}
|
||||
|
||||
$guide = DB::Aowow()->selectRow('SELECT `userId`, `status` FROM ?_guides WHERE `id` = ?d', $this->_post['id']);
|
||||
$guide = DB::Aowow()->selectRow('SELECT `userId`, `status` FROM ::guides WHERE `id` = %i', $this->_post['id']);
|
||||
if (!$guide)
|
||||
{
|
||||
trigger_error('AdminGuideResponse - guide #'.$this->_post['id'].' not found', E_USER_ERROR);
|
||||
|
|
@ -63,16 +63,16 @@ class AdminGuideResponse extends TextResponse
|
|||
private function update(int $id, int $status, ?string $msg = null) : bool
|
||||
{
|
||||
if ($status == GuideMgr::STATUS_APPROVED) // set display rev to latest
|
||||
$ok = DB::Aowow()->query('UPDATE ?_guides SET `status` = ?d, `rev` = (SELECT `rev` FROM ?_articles WHERE `type` = ?d AND `typeId` = ?d ORDER BY `rev` DESC LIMIT 1), `approveUserId` = ?d, `approveDate` = ?d WHERE `id` = ?d', $status, Type::GUIDE, $id, User::$id, time(), $id);
|
||||
$ok = DB::Aowow()->qry('UPDATE ::guides SET `status` = %i, `rev` = (SELECT `rev` FROM ::articles WHERE `type` = %i AND `typeId` = %i ORDER BY `rev` DESC LIMIT 1), `approveUserId` = %i, `approveDate` = %i WHERE `id` = %i', $status, Type::GUIDE, $id, User::$id, time(), $id);
|
||||
else
|
||||
$ok = DB::Aowow()->query('UPDATE ?_guides SET `status` = ?d WHERE `id` = ?d', $status, $id);
|
||||
$ok = DB::Aowow()->qry('UPDATE ::guides SET `status` = %i WHERE `id` = %i', $status, $id);
|
||||
|
||||
if (!$ok)
|
||||
return false;
|
||||
|
||||
DB::Aowow()->query('INSERT INTO ?_guides_changelog (`id`, `date`, `userId`, `status`) VALUES (?d, ?d, ?d, ?d)', $id, time(), User::$id, $status);
|
||||
DB::Aowow()->qry('INSERT INTO ::guides_changelog (`id`, `date`, `userId`, `status`) VALUES (%i, %i, %i, %i)', $id, time(), User::$id, $status);
|
||||
if ($msg)
|
||||
DB::Aowow()->query('INSERT INTO ?_guides_changelog (`id`, `date`, `userId`, `msg`) VALUES (?d, ?d, ?d, ?)', $id, time(), User::$id, $msg);
|
||||
DB::Aowow()->qry('INSERT INTO ::guides_changelog (`id`, `date`, `userId`, `msg`) VALUES (%i, %i, %i, %s)', $id, time(), User::$id, $msg);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ class AdminGuidesResponse extends TemplateResponse
|
|||
else
|
||||
{
|
||||
$data = $pending->getListviewData();
|
||||
$latest = DB::Aowow()->selectCol('SELECT `typeId` AS ARRAY_KEY, MAX(`rev`) FROM ?_articles WHERE `type` = ?d AND `typeId` IN (?a) GROUP BY `rev`', Type::GUIDE, $pending->getFoundIDs());
|
||||
$latest = DB::Aowow()->selectCol('SELECT `typeId` AS ARRAY_KEY, MAX(`rev`) FROM ::articles WHERE `type` = %i AND `typeId` IN %in GROUP BY `rev`', Type::GUIDE, $pending->getFoundIDs());
|
||||
foreach ($latest as $id => $rev)
|
||||
$data[$id]['rev'] = $rev;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ class AdminScreenshotsResponse extends TemplateResponse
|
|||
else if ($this->_get['user'])
|
||||
{
|
||||
if (mb_strlen($this->_get['user']) >= 3)
|
||||
if ($uId = DB::Aowow()->selectCell('SELECT `id` FROM ?_account WHERE LOWER(`username`) = LOWER(?)', $this->_get['user']))
|
||||
if ($uId = DB::Aowow()->selectCell('SELECT `id` FROM ::account WHERE LOWER(`username`) = LOWER(%s)', $this->_get['user']))
|
||||
$ssData = ScreenshotMgr::getScreenshots(userId: $uId, nFound: $nMatches);
|
||||
}
|
||||
else
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ class AdminScreenshotsActionApproveResponse extends TextResponse
|
|||
ScreenshotMgr::init();
|
||||
|
||||
// create resized and thumb version of screenshot
|
||||
$ssEntries = DB::Aowow()->select('SELECT `id` AS ARRAY_KEY, `userIdOwner`, `date`, `type`, `typeId` FROM ?_screenshots WHERE (`status` & ?d) = 0 AND `id` IN (?a)', CC_FLAG_APPROVED, $this->_get['id']);
|
||||
$ssEntries = DB::Aowow()->selectAssoc('SELECT `id` AS ARRAY_KEY, `userIdOwner`, `date`, `type`, `typeId` FROM ::screenshots WHERE (`status` & %i) = 0 AND `id` IN %in', CC_FLAG_APPROVED, $this->_get['id']);
|
||||
foreach ($ssEntries as $id => $ssData)
|
||||
{
|
||||
if (!ScreenshotMgr::loadFile(ScreenshotMgr::PATH_PENDING, $id))
|
||||
|
|
@ -42,14 +42,14 @@ class AdminScreenshotsActionApproveResponse extends TextResponse
|
|||
continue;
|
||||
|
||||
// set as approved in DB
|
||||
DB::Aowow()->query('UPDATE ?_screenshots SET `status` = ?d, `userIdApprove` = ?d WHERE `id` = ?d', CC_FLAG_APPROVED, User::$id, $id);
|
||||
DB::Aowow()->qry('UPDATE ::screenshots SET `status` = %i, `userIdApprove` = %i WHERE `id` = %i', CC_FLAG_APPROVED, User::$id, $id);
|
||||
|
||||
// gain siterep
|
||||
Util::gainSiteReputation($ssData['userIdOwner'], SITEREP_ACTION_SUBMIT_SCREENSHOT, ['id' => $id, 'what' => 1, 'date' => $ssData['date']]);
|
||||
|
||||
// flag DB entry as having screenshots
|
||||
if ($tbl = Type::getClassAttrib($ssData['type'], 'dataTable'))
|
||||
DB::Aowow()->query('UPDATE ?# SET `cuFlags` = `cuFlags` | ?d WHERE `id` = ?d', $tbl, CUSTOM_HAS_SCREENSHOT, $ssData['typeId']);
|
||||
DB::Aowow()->qry('UPDATE %n SET `cuFlags` = `cuFlags` | %i WHERE `id` = %i', $tbl, CUSTOM_HAS_SCREENSHOT, $ssData['typeId']);
|
||||
|
||||
unset($ssEntries[$id]);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,9 +26,9 @@ class AdminScreenshotsActionDeleteResponse extends TextResponse
|
|||
foreach ($this->_get['id'] as $id)
|
||||
{
|
||||
// irrevocably purge files already flagged as deleted (should only exist as pending)
|
||||
if (User::isInGroup(U_GROUP_ADMIN) && DB::Aowow()->selectCell('SELECT 1 FROM ?_screenshots WHERE `status` & ?d AND `id` = ?d', CC_FLAG_DELETED, $id))
|
||||
if (User::isInGroup(U_GROUP_ADMIN) && DB::Aowow()->selectCell('SELECT 1 FROM ::screenshots WHERE `status` & %i AND `id` = %i', CC_FLAG_DELETED, $id))
|
||||
{
|
||||
DB::Aowow()->query('DELETE FROM ?_screenshots WHERE `id` = ?d', $id);
|
||||
DB::Aowow()->qry('DELETE FROM ::screenshots WHERE `id` = %i', $id);
|
||||
if (file_exists(sprintf(ScreenshotMgr::PATH_PENDING, $id)))
|
||||
unlink(sprintf(ScreenshotMgr::PATH_PENDING, $id));
|
||||
|
||||
|
|
@ -47,16 +47,16 @@ class AdminScreenshotsActionDeleteResponse extends TextResponse
|
|||
}
|
||||
|
||||
// flag as deleted if not aready
|
||||
$oldEntries = DB::Aowow()->selectCol('SELECT `type` AS ARRAY_KEY, GROUP_CONCAT(`typeId`) FROM ?_screenshots WHERE `id` IN (?a) GROUP BY `type`', $this->_get['id']);
|
||||
DB::Aowow()->query('UPDATE ?_screenshots SET `status` = ?d, `userIdDelete` = ?d WHERE `id` IN (?a)', CC_FLAG_DELETED, User::$id, $this->_get['id']);
|
||||
$oldEntries = DB::Aowow()->selectCol('SELECT `type` AS ARRAY_KEY, GROUP_CONCAT(`typeId`) FROM ::screenshots WHERE `id` IN %in GROUP BY `type`', $this->_get['id']);
|
||||
DB::Aowow()->qry('UPDATE ::screenshots SET `status` = %i, `userIdDelete` = %i WHERE `id` IN %in', CC_FLAG_DELETED, User::$id, $this->_get['id']);
|
||||
|
||||
// deflag db entry as having screenshots
|
||||
foreach ($oldEntries as $type => $typeIds)
|
||||
{
|
||||
$typeIds = explode(',', $typeIds);
|
||||
$toUnflag = DB::Aowow()->selectCol('SELECT `typeId` AS ARRAY_KEY, IF(BIT_OR(`status`) & ?d, 1, 0) AS "hasMore" FROM ?_screenshots WHERE `type` = ?d AND `typeId` IN (?a) GROUP BY `typeId` HAVING `hasMore` = 0', CC_FLAG_APPROVED, $type, $typeIds);
|
||||
$toUnflag = DB::Aowow()->selectCol('SELECT `typeId` AS ARRAY_KEY, IF(BIT_OR(`status`) & %i, 1, 0) AS "hasMore" FROM ::screenshots WHERE `type` = %i AND `typeId` IN %in GROUP BY `typeId` HAVING `hasMore` = 0', CC_FLAG_APPROVED, $type, $typeIds);
|
||||
if ($toUnflag && ($tbl = Type::getClassAttrib($type, 'dataTable')))
|
||||
DB::Aowow()->query('UPDATE ?# SET cuFlags = cuFlags & ~?d WHERE id IN (?a)', $tbl, CUSTOM_HAS_SCREENSHOT, array_keys($toUnflag));
|
||||
DB::Aowow()->qry('UPDATE %n SET cuFlags = cuFlags & ~%i WHERE id IN %in', $tbl, CUSTOM_HAS_SCREENSHOT, array_keys($toUnflag));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ class AdminScreenshotsActionEditaltResponse extends TextResponse
|
|||
if (!$this->assertGET('id'))
|
||||
return;
|
||||
|
||||
DB::Aowow()->query('UPDATE ?_screenshots SET `caption` = ? WHERE `id` = ?d',
|
||||
DB::Aowow()->qry('UPDATE ::screenshots SET `caption` = %s WHERE `id` = %i',
|
||||
$this->handleCaption($this->_post['alt']),
|
||||
$this->_get['id']
|
||||
);
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ class AdminScreenshotsActionManageResponse extends TextResponse
|
|||
if ($this->_get['type'] && $this->_get['typeid'])
|
||||
$res = ScreenshotMgr::getScreenshots($this->_get['type'], $this->_get['typeid']);
|
||||
else if ($this->_get['user'])
|
||||
if ($uId = DB::Aowow()->selectCell('SELECT `id` FROM ?_account WHERE LOWER(`username`) = LOWER(?)', $this->_get['user']))
|
||||
if ($uId = DB::Aowow()->selectCell('SELECT `id` FROM ::account WHERE LOWER(`username`) = LOWER(%s)', $this->_get['user']))
|
||||
$res = ScreenshotMgr::getScreenshots(userId: $uId);
|
||||
|
||||
$this->result = 'ssm_screenshotData = '.Util::toJSON($res);
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ class AdminScreenshotsActionRelocateResponse extends TextResponse
|
|||
return;
|
||||
}
|
||||
|
||||
[$type, $oldTypeId] = array_values(DB::Aowow()->selectRow('SELECT `type`, `typeId` FROM ?_screenshots WHERE `id` = ?d', $this->_get['id']));
|
||||
[$type, $oldTypeId] = array_values(DB::Aowow()->selectRow('SELECT `type`, `typeId` FROM ::screenshots WHERE `id` = %i', $this->_get['id']));
|
||||
$typeId = $this->_get['typeid'];
|
||||
|
||||
if (Type::validateIds($type, $typeId))
|
||||
|
|
@ -32,15 +32,15 @@ class AdminScreenshotsActionRelocateResponse extends TextResponse
|
|||
$tbl = Type::getClassAttrib($type, 'dataTable');
|
||||
|
||||
// move screenshot
|
||||
DB::Aowow()->query('UPDATE ?_screenshots SET `typeId` = ?d WHERE `id` = ?d', $typeId, $this->_get['id']);
|
||||
DB::Aowow()->qry('UPDATE ::screenshots SET `typeId` = %i WHERE `id` = %i', $typeId, $this->_get['id']);
|
||||
|
||||
// flag target as having screenshot
|
||||
DB::Aowow()->query('UPDATE ?# SET `cuFlags` = `cuFlags` | ?d WHERE `id` = ?d', $tbl, CUSTOM_HAS_SCREENSHOT, $typeId);
|
||||
DB::Aowow()->qry('UPDATE %n SET `cuFlags` = `cuFlags` | %i WHERE `id` = %i', $tbl, CUSTOM_HAS_SCREENSHOT, $typeId);
|
||||
|
||||
// deflag source for having had screenshots (maybe)
|
||||
$ssInfo = DB::Aowow()->selectRow('SELECT IF(BIT_OR(~`status`) & ?d, 1, 0) AS "hasMore" FROM ?_screenshots WHERE `status`& ?d AND `type` = ?d AND `typeId` = ?d', CC_FLAG_DELETED, CC_FLAG_APPROVED, $type, $oldTypeId);
|
||||
$ssInfo = DB::Aowow()->selectRow('SELECT IF(BIT_OR(~`status`) & %i, 1, 0) AS "hasMore" FROM ::screenshots WHERE `status`& %i AND `type` = %i AND `typeId` = %i', CC_FLAG_DELETED, CC_FLAG_APPROVED, $type, $oldTypeId);
|
||||
if ($ssInfo || !$ssInfo['hasMore'])
|
||||
DB::Aowow()->query('UPDATE ?# SET `cuFlags` = `cuFlags` & ~?d WHERE `id` = ?d', $tbl, CUSTOM_HAS_SCREENSHOT, $oldTypeId);
|
||||
DB::Aowow()->qry('UPDATE %n SET `cuFlags` = `cuFlags` & ~%i WHERE `id` = %i', $tbl, CUSTOM_HAS_SCREENSHOT, $oldTypeId);
|
||||
}
|
||||
else
|
||||
trigger_error('AdminScreenshotsActionRelocateResponse - invalid typeId #'.$typeId.' for type #'.$type, E_USER_ERROR);
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ class AdminScreenshotsActionStickyResponse extends TextResponse
|
|||
// this one is a bit strange: as far as i've seen, the only thing a 'sticky' screenshot does is show up in the infobox
|
||||
// this also means, that only one screenshot per page should be sticky
|
||||
// so, handle it one by one and the last one affecting one particular type/typId-key gets the cake
|
||||
$ssEntries = DB::Aowow()->select('SELECT `id` AS ARRAY_KEY, `userIdOwner`, `date`, `type`, `typeId`, `status` FROM ?_screenshots WHERE (`status` & ?d) = 0 AND `id` IN (?a)', CC_FLAG_DELETED, $this->_get['id']);
|
||||
$ssEntries = DB::Aowow()->selectAssoc('SELECT `id` AS ARRAY_KEY, `userIdOwner`, `date`, `type`, `typeId`, `status` FROM ::screenshots WHERE (`status` & %i) = 0 AND `id` IN %in', CC_FLAG_DELETED, $this->_get['id']);
|
||||
foreach ($ssEntries as $id => $ssData)
|
||||
{
|
||||
// approve yet unapproved screenshots
|
||||
|
|
@ -47,21 +47,21 @@ class AdminScreenshotsActionStickyResponse extends TextResponse
|
|||
continue;
|
||||
|
||||
// set as approved in DB
|
||||
DB::Aowow()->query('UPDATE ?_screenshots SET `status` = ?d, `userIdApprove` = ?d WHERE `id` = ?d', CC_FLAG_APPROVED, User::$id, $id);
|
||||
DB::Aowow()->qry('UPDATE ::screenshots SET `status` = %i, `userIdApprove` = %i WHERE `id` = %i', CC_FLAG_APPROVED, User::$id, $id);
|
||||
|
||||
// gain siterep
|
||||
Util::gainSiteReputation($ssData['userIdOwner'], SITEREP_ACTION_SUBMIT_SCREENSHOT, ['id' => $id, 'what' => 1, 'date' => $ssData['date']]);
|
||||
|
||||
// flag DB entry as having screenshots
|
||||
if ($tbl = Type::getClassAttrib($ssData['type'], 'dataTable'))
|
||||
DB::Aowow()->query('UPDATE ?# SET `cuFlags` = `cuFlags` | ?d WHERE `id` = ?d', $tbl, CUSTOM_HAS_SCREENSHOT, $ssData['typeId']);
|
||||
DB::Aowow()->qry('UPDATE %n SET `cuFlags` = `cuFlags` | %i WHERE `id` = %i', $tbl, CUSTOM_HAS_SCREENSHOT, $ssData['typeId']);
|
||||
}
|
||||
|
||||
// reset all others
|
||||
DB::Aowow()->query('UPDATE ?_screenshots a, ?_screenshots b SET a.`status` = a.`status` & ~?d WHERE a.`type` = b.`type` AND a.`typeId` = b.`typeId` AND a.`id` <> b.`id` AND b.`id` = ?d', CC_FLAG_STICKY, $id);
|
||||
DB::Aowow()->qry('UPDATE ::screenshots a, ::screenshots b SET a.`status` = a.`status` & ~%i WHERE a.`type` = b.`type` AND a.`typeId` = b.`typeId` AND a.`id` <> b.`id` AND b.`id` = %i', CC_FLAG_STICKY, $id);
|
||||
|
||||
// toggle sticky status
|
||||
DB::Aowow()->query('UPDATE ?_screenshots SET `status` = IF(`status` & ?d, `status` & ~?d, `status` | ?d) WHERE `id` = ?d AND `status` & ?d', CC_FLAG_STICKY, CC_FLAG_STICKY, CC_FLAG_STICKY, $id, CC_FLAG_APPROVED);
|
||||
DB::Aowow()->qry('UPDATE ::screenshots SET `status` = IF(`status` & %i, `status` & ~%i, `status` | %i) WHERE `id` = %i AND `status` & %i', CC_FLAG_STICKY, CC_FLAG_STICKY, CC_FLAG_STICKY, $id, CC_FLAG_APPROVED);
|
||||
|
||||
unset($ssEntries[$id]);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ class AdminSpawnoverrideResponse extends TextResponse
|
|||
return;
|
||||
}
|
||||
|
||||
DB::Aowow()->query('REPLACE INTO ?_spawns_override (`type`, `typeGuid`, `areaId`, `floor`, `revision`) VALUES (?d, ?d, ?d, ?d, ?d)', $type, $guid, $area, $floor, AOWOW_REVISION);
|
||||
DB::Aowow()->qry('REPLACE INTO ::spawns_override (`type`, `typeGuid`, `areaId`, `floor`, `revision`) VALUES (%i, %i, %i, %i, %i)', $type, $guid, $area, $floor, AOWOW_REVISION);
|
||||
|
||||
$wPos = WorldPosition::getForGUID($type, $guid);
|
||||
if (!$wPos)
|
||||
|
|
@ -72,7 +72,7 @@ class AdminSpawnoverrideResponse extends TextResponse
|
|||
// if creature try for waypoints
|
||||
if ($type == Type::NPC)
|
||||
{
|
||||
if ($swp = DB::World()->select('SELECT -w.`id` AS "entry", w.`point` AS "pointId", w.`position_x` AS "posX", w.`position_y` AS "posY" FROM creature_addon ca JOIN waypoint_data w ON w.`id` = ca.`path_id` WHERE ca.`guid` = ?d AND ca.`path_id` <> 0', $guid))
|
||||
if ($swp = DB::World()->selectAssoc('SELECT -w.`id` AS "entry", w.`point` AS "pointId", w.`position_x` AS "posX", w.`position_y` AS "posY" FROM creature_addon ca JOIN waypoint_data w ON w.`id` = ca.`path_id` WHERE ca.`guid` = %i AND ca.`path_id` <> 0', $guid))
|
||||
{
|
||||
foreach ($swp as $w)
|
||||
{
|
||||
|
|
@ -85,17 +85,17 @@ class AdminSpawnoverrideResponse extends TextResponse
|
|||
'floor' => $point[0]['floor']
|
||||
);
|
||||
|
||||
DB::Aowow()->query('UPDATE ?_creature_waypoints SET ?a WHERE `creatureOrPath` = ?d AND `point` = ?d', $p, $w['entry'], $w['pointId']);
|
||||
DB::Aowow()->qry('UPDATE ::creature_waypoints SET %a WHERE `creatureOrPath` = %i AND `point` = %i', $p, $w['entry'], $w['pointId']);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// also move linked vehicle accessories (on the very same position)
|
||||
$updGUIDs = array_merge($updGUIDs, DB::Aowow()->selectCol('SELECT s2.`guid` FROM ?_spawns s1 JOIN ?_spawns s2 ON s1.`posX` = s2.`posX` AND s1.`posY` = s2.`posY` AND
|
||||
s1.`areaId` = s2.`areaId` AND s1.`floor` = s2.`floor` AND s2.`guid` < 0 WHERE s1.`guid` = ?d', $guid));
|
||||
$updGUIDs = array_merge($updGUIDs, DB::Aowow()->selectCol('SELECT s2.`guid` FROM ::spawns s1 JOIN ::spawns s2 ON s1.`posX` = s2.`posX` AND s1.`posY` = s2.`posY` AND
|
||||
s1.`areaId` = s2.`areaId` AND s1.`floor` = s2.`floor` AND s2.`guid` < 0 WHERE s1.`guid` = %i', $guid));
|
||||
}
|
||||
|
||||
if (DB::Aowow()->query('UPDATE ?_spawns SET ?a WHERE `type` = ?d AND `guid` IN (?a)', $newPos, $type, $updGUIDs))
|
||||
if (DB::Aowow()->qry('UPDATE ::spawns SET %a WHERE `type` = %i AND `guid` IN %in', $newPos, $type, $updGUIDs))
|
||||
$this->result = self::ERR_NONE;
|
||||
else
|
||||
$this->result = self::ERR_WRITE_DB;
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ class AdminVideosResponse extends TemplateResponse
|
|||
else if ($this->_get['user'])
|
||||
{
|
||||
if (mb_strlen($this->_get['user']) >= 3)
|
||||
if ($uId = DB::Aowow()->selectCell('SELECT `id` FROM ?_account WHERE LOWER(`username`) = LOWER(?)', $this->_get['user']))
|
||||
if ($uId = DB::Aowow()->selectCell('SELECT `id` FROM ::account WHERE LOWER(`username`) = LOWER(%s)', $this->_get['user']))
|
||||
$viData = VideoMgr::getVideos(userId: $uId, nFound: $nMatches);
|
||||
}
|
||||
else
|
||||
|
|
|
|||
|
|
@ -22,18 +22,18 @@ class AdminVideosActionApproveResponse extends TextResponse
|
|||
return;
|
||||
}
|
||||
|
||||
$viEntries = DB::Aowow()->select('SELECT `id` AS ARRAY_KEY, `userIdOwner`, `date`, `type`, `typeId` FROM ?_videos WHERE (`status` & ?d) = 0 AND `id` IN (?a)', CC_FLAG_APPROVED, $this->_get['id']);
|
||||
$viEntries = DB::Aowow()->selectAssoc('SELECT `id` AS ARRAY_KEY, `userIdOwner`, `date`, `type`, `typeId` FROM ::videos WHERE (`status` & %i) = 0 AND `id` IN %in', CC_FLAG_APPROVED, $this->_get['id']);
|
||||
foreach ($viEntries as $id => $viData)
|
||||
{
|
||||
// set as approved in DB
|
||||
DB::Aowow()->query('UPDATE ?_videos SET `status` = ?d, `userIdApprove` = ?d WHERE `id` = ?d', CC_FLAG_APPROVED, User::$id, $id);
|
||||
DB::Aowow()->qry('UPDATE ::videos SET `status` = %i, `userIdApprove` = %i WHERE `id` = %i', CC_FLAG_APPROVED, User::$id, $id);
|
||||
|
||||
// gain siterep
|
||||
Util::gainSiteReputation($viData['userIdOwner'], SITEREP_ACTION_SUGGEST_VIDEO, ['id' => $id, 'what' => 1, 'date' => $viData['date']]);
|
||||
|
||||
// flag DB entry as having videos
|
||||
if ($tbl = Type::getClassAttrib($viData['type'], 'dataTable'))
|
||||
DB::Aowow()->query('UPDATE ?# SET `cuFlags` = `cuFlags` | ?d WHERE `id` = ?d', $tbl, CUSTOM_HAS_VIDEO, $viData['typeId']);
|
||||
DB::Aowow()->qry('UPDATE %n SET `cuFlags` = `cuFlags` | %i WHERE `id` = %i', $tbl, CUSTOM_HAS_VIDEO, $viData['typeId']);
|
||||
|
||||
unset($viEntries[$id]);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,19 +25,19 @@ class AdminVideosActionDeleteResponse extends TextResponse
|
|||
|
||||
// irrevocably purge files already flagged as deleted (should only exist as pending)
|
||||
if (User::isInGroup(U_GROUP_ADMIN))
|
||||
DB::Aowow()->selectCell('SELECT 1 FROM ?_videos WHERE `status` & ?d AND `id` IN (?a)', CC_FLAG_DELETED, $this->_get['id']);
|
||||
DB::Aowow()->selectCell('SELECT 1 FROM ::videos WHERE `status` & %i AND `id` IN %in', CC_FLAG_DELETED, $this->_get['id']);
|
||||
|
||||
// flag as deleted if not aready
|
||||
$oldEntries = DB::Aowow()->selectCol('SELECT `type` AS ARRAY_KEY, GROUP_CONCAT(`typeId`) FROM ?_videos WHERE `id` IN (?a) GROUP BY `type`', $this->_get['id']);
|
||||
DB::Aowow()->query('UPDATE ?_videos SET `status` = ?d, `userIdDelete` = ?d WHERE (`status` & ?d) = 0 AND `id` IN (?a)', CC_FLAG_DELETED, User::$id, CC_FLAG_DELETED, $this->_get['id']);
|
||||
$oldEntries = DB::Aowow()->selectCol('SELECT `type` AS ARRAY_KEY, GROUP_CONCAT(`typeId`) FROM ::videos WHERE `id` IN %in GROUP BY `type`', $this->_get['id']);
|
||||
DB::Aowow()->qry('UPDATE ::videos SET `status` = %i, `userIdDelete` = %i WHERE (`status` & %i) = 0 AND `id` IN %in', CC_FLAG_DELETED, User::$id, CC_FLAG_DELETED, $this->_get['id']);
|
||||
|
||||
// deflag db entry as having videos
|
||||
foreach ($oldEntries as $type => $typeIds)
|
||||
{
|
||||
$typeIds = explode(',', $typeIds);
|
||||
$toUnflag = DB::Aowow()->selectCol('SELECT `typeId` AS ARRAY_KEY, IF(BIT_OR(`status`) & ?d, 1, 0) AS "hasMore" FROM ?_videos WHERE `type` = ?d AND `typeId` IN (?a) GROUP BY `typeId` HAVING `hasMore` = 0', CC_FLAG_APPROVED, $type, $typeIds);
|
||||
$toUnflag = DB::Aowow()->selectCol('SELECT `typeId` AS ARRAY_KEY, IF(BIT_OR(`status`) & %i, 1, 0) AS "hasMore" FROM ::videos WHERE `type` = %i AND `typeId` IN %in GROUP BY `typeId` HAVING `hasMore` = 0', CC_FLAG_APPROVED, $type, $typeIds);
|
||||
if ($toUnflag && ($tbl = Type::getClassAttrib($type, 'dataTable')))
|
||||
DB::Aowow()->query('UPDATE ?# SET cuFlags = cuFlags & ~?d WHERE id IN (?a)', $tbl, CUSTOM_HAS_VIDEO, array_keys($toUnflag));
|
||||
DB::Aowow()->qry('UPDATE %n SET cuFlags = cuFlags & ~%i WHERE id IN %in', $tbl, CUSTOM_HAS_VIDEO, array_keys($toUnflag));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,6 +26,6 @@ class AdminVideosActionEdittitleResponse extends TextResponse
|
|||
|
||||
$caption = $this->handleCaption($this->_post['title']);
|
||||
|
||||
DB::Aowow()->query('UPDATE ?_videos SET `caption` = ? WHERE `id` = ?d', $caption, $this->_get['id'][0]);
|
||||
DB::Aowow()->qry('UPDATE ::videos SET `caption` = %s WHERE `id` = %i', $caption, $this->_get['id'][0]);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ class AdminVideosActionManageResponse extends TextResponse
|
|||
if ($this->_get['type'] && $this->_get['typeid'])
|
||||
$res = VideoMgr::getVideos($this->_get['type'], $this->_get['typeid']);
|
||||
else if ($this->_get['user'])
|
||||
if ($uId = DB::Aowow()->selectCell('SELECT `id` FROM ?_account WHERE LOWER(`username`) = LOWER(?)', $this->_get['user']))
|
||||
if ($uId = DB::Aowow()->selectCell('SELECT `id` FROM ::account WHERE LOWER(`username`) = LOWER(%s)', $this->_get['user']))
|
||||
$res = VideoMgr::getVideos(userId: $uId);
|
||||
|
||||
$this->result = 'vim_videoData = '.Util::toJSON($res);
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ class AdminVideosActionOrderResponse extends TextResponse
|
|||
|
||||
$id = $this->_get['id'][0];
|
||||
|
||||
$videos = DB::Aowow()->selectCol('SELECT a.`id` AS ARRAY_KEY, a.`pos` FROM ?_videos a, ?_videos b WHERE a.`type` = b.`type` AND a.`typeId` = b.`typeId` AND (a.`status` & ?d) = 0 AND b.`id` = ?d ORDER BY a.`pos` ASC', CC_FLAG_DELETED, $id);
|
||||
$videos = DB::Aowow()->selectCol('SELECT a.`id` AS ARRAY_KEY, a.`pos` FROM ::videos a, ::videos b WHERE a.`type` = b.`type` AND a.`typeId` = b.`typeId` AND (a.`status` & %i) = 0 AND b.`id` = %i ORDER BY a.`pos` ASC', CC_FLAG_DELETED, $id);
|
||||
if (!$videos || count($videos) == 1)
|
||||
{
|
||||
trigger_error('AdminVideosActionOrderResponse - not enough videos to sort', E_USER_WARNING);
|
||||
|
|
@ -52,6 +52,6 @@ class AdminVideosActionOrderResponse extends TextResponse
|
|||
$videos[$id] += $dir;
|
||||
|
||||
foreach ($videos as $id => $pos)
|
||||
DB::Aowow()->query('UPDATE ?_videos SET `pos` = ?d WHERE `id` = ?d', $pos, $id);
|
||||
DB::Aowow()->qry('UPDATE ::videos SET `pos` = %i WHERE `id` = %i', $pos, $id);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ class AdminVideosActionRelocateResponse extends TextResponse
|
|||
}
|
||||
|
||||
$id = $this->_get['id'][0];
|
||||
[$type, $oldTypeId] = array_values(DB::Aowow()->selectRow('SELECT `type`, `typeId` FROM ?_videos WHERE `id` = ?d', $id));
|
||||
[$type, $oldTypeId] = array_values(DB::Aowow()->selectRow('SELECT `type`, `typeId` FROM ::videos WHERE `id` = %i', $id));
|
||||
$typeId = $this->_get['typeid'];
|
||||
|
||||
if (Type::validateIds($type, $typeId))
|
||||
|
|
@ -33,15 +33,15 @@ class AdminVideosActionRelocateResponse extends TextResponse
|
|||
$tbl = Type::getClassAttrib($type, 'dataTable');
|
||||
|
||||
// move video
|
||||
DB::Aowow()->query('UPDATE ?_videos SET `typeId` = ?d WHERE `id` = ?d', $typeId, $id);
|
||||
DB::Aowow()->qry('UPDATE ::videos SET `typeId` = %i WHERE `id` = %i', $typeId, $id);
|
||||
|
||||
// flag target as having video
|
||||
DB::Aowow()->query('UPDATE ?# SET `cuFlags` = `cuFlags` | ?d WHERE `id` = ?d', $tbl, CUSTOM_HAS_VIDEO, $typeId);
|
||||
DB::Aowow()->qry('UPDATE %n SET `cuFlags` = `cuFlags` | %i WHERE `id` = %i', $tbl, CUSTOM_HAS_VIDEO, $typeId);
|
||||
|
||||
// deflag source for having had videos (maybe)
|
||||
$viInfo = DB::Aowow()->selectRow('SELECT IF(BIT_OR(~`status`) & ?d, 1, 0) AS "hasMore" FROM ?_videos WHERE `status`& ?d AND `type` = ?d AND `typeId` = ?d', CC_FLAG_DELETED, CC_FLAG_APPROVED, $type, $oldTypeId);
|
||||
$viInfo = DB::Aowow()->selectRow('SELECT IF(BIT_OR(~`status`) & %i, 1, 0) AS "hasMore" FROM ::videos WHERE `status`& %i AND `type` = %i AND `typeId` = %i', CC_FLAG_DELETED, CC_FLAG_APPROVED, $type, $oldTypeId);
|
||||
if ($viInfo || !$viInfo['hasMore'])
|
||||
DB::Aowow()->query('UPDATE ?# SET `cuFlags` = `cuFlags` & ~?d WHERE `id` = ?d', $tbl, CUSTOM_HAS_VIDEO, $oldTypeId);
|
||||
DB::Aowow()->qry('UPDATE %n SET `cuFlags` = `cuFlags` & ~%i WHERE `id` = %i', $tbl, CUSTOM_HAS_VIDEO, $oldTypeId);
|
||||
}
|
||||
else
|
||||
trigger_error('AdminVideosActionRelocateResponse - invalid typeId #'.$typeId.' for type #'.$type, E_USER_ERROR);
|
||||
|
|
|
|||
|
|
@ -24,28 +24,28 @@ class AdminVideosActionStickyResponse extends TextResponse
|
|||
// this one is a bit strange: as far as i've seen, the only thing a 'sticky' video does is show up in the infobox
|
||||
// this also means, that only one video per page should be sticky
|
||||
// so, handle it one by one and the last one affecting one particular type/typId-key gets the cake
|
||||
$viEntries = DB::Aowow()->select('SELECT `id` AS ARRAY_KEY, `userIdOwner`, `date`, `type`, `typeId`, `status` FROM ?_videos WHERE (`status` & ?d) = 0 AND `id` IN (?a)', CC_FLAG_DELETED, $this->_get['id']);
|
||||
$viEntries = DB::Aowow()->selectAssoc('SELECT `id` AS ARRAY_KEY, `userIdOwner`, `date`, `type`, `typeId`, `status` FROM ::videos WHERE (`status` & %i) = 0 AND `id` IN %in', CC_FLAG_DELETED, $this->_get['id']);
|
||||
foreach ($viEntries as $id => $viData)
|
||||
{
|
||||
// approve yet unapproved videos
|
||||
if (!($viData['status'] & CC_FLAG_APPROVED))
|
||||
{
|
||||
// set as approved in DB
|
||||
DB::Aowow()->query('UPDATE ?_videos SET `status` = ?d, `userIdApprove` = ?d WHERE `id` = ?d', CC_FLAG_APPROVED, User::$id, $id);
|
||||
DB::Aowow()->qry('UPDATE ::videos SET `status` = %i, `userIdApprove` = %i WHERE `id` = %i', CC_FLAG_APPROVED, User::$id, $id);
|
||||
|
||||
// gain siterep
|
||||
Util::gainSiteReputation($viData['userIdOwner'], SITEREP_ACTION_SUGGEST_VIDEO, ['id' => $id, 'what' => 1, 'date' => $viData['date']]);
|
||||
|
||||
// flag DB entry as having videos
|
||||
if ($tbl = Type::getClassAttrib($viData['type'], 'dataTable'))
|
||||
DB::Aowow()->query('UPDATE ?# SET `cuFlags` = `cuFlags` | ?d WHERE `id` = ?d', $tbl, CUSTOM_HAS_VIDEO, $viData['typeId']);
|
||||
DB::Aowow()->qry('UPDATE %n SET `cuFlags` = `cuFlags` | %i WHERE `id` = %i', $tbl, CUSTOM_HAS_VIDEO, $viData['typeId']);
|
||||
}
|
||||
|
||||
// reset all others
|
||||
DB::Aowow()->query('UPDATE ?_videos a, ?_videos b SET a.`status` = a.`status` & ~?d WHERE a.`type` = b.`type` AND a.`typeId` = b.`typeId` AND a.`id` <> b.`id` AND b.`id` = ?d', CC_FLAG_STICKY, $id);
|
||||
DB::Aowow()->qry('UPDATE ::videos a, ::videos b SET a.`status` = a.`status` & ~%i WHERE a.`type` = b.`type` AND a.`typeId` = b.`typeId` AND a.`id` <> b.`id` AND b.`id` = %i', CC_FLAG_STICKY, $id);
|
||||
|
||||
// toggle sticky status
|
||||
DB::Aowow()->query('UPDATE ?_videos SET `status` = IF(`status` & ?d, `status` & ~?d, `status` | ?d) WHERE `id` = ?d AND `status` & ?d', CC_FLAG_STICKY, CC_FLAG_STICKY, CC_FLAG_STICKY, $id, CC_FLAG_APPROVED);
|
||||
DB::Aowow()->qry('UPDATE ::videos SET `status` = IF(`status` & %i, `status` & ~%i, `status` | %i) WHERE `id` = %i AND `status` & %i', CC_FLAG_STICKY, CC_FLAG_STICKY, CC_FLAG_STICKY, $id, CC_FLAG_APPROVED);
|
||||
|
||||
unset($viEntries[$id]);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,8 +27,8 @@ class AdminWeightpresetsResponse extends TemplateResponse
|
|||
|
||||
$head = $body = '';
|
||||
|
||||
$scales = DB::Aowow()->select('SELECT `class` AS ARRAY_KEY, `id` AS ARRAY_KEY2, `name`, `icon` FROM ?_account_weightscales WHERE `userId` = 0');
|
||||
$weights = DB::Aowow()->selectCol('SELECT awd.`id` AS ARRAY_KEY, awd.`field` AS ARRAY_KEY2, awd.`val` FROM ?_account_weightscale_data awd JOIN ?_account_weightscales ad ON awd.`id` = ad.`id` WHERE ad.`userId` = 0');
|
||||
$scales = DB::Aowow()->selectAssoc('SELECT `class` AS ARRAY_KEY, `id` AS ARRAY_KEY2, `name`, `icon` FROM ::account_weightscales WHERE `userId` = 0');
|
||||
$weights = DB::Aowow()->selectCol('SELECT awd.`id` AS ARRAY_KEY, awd.`field` AS ARRAY_KEY2, awd.`val` FROM ::account_weightscale_data awd JOIN ::account_weightscales ad ON awd.`id` = ad.`id` WHERE ad.`userId` = 0');
|
||||
foreach ($scales as $cl => $data)
|
||||
{
|
||||
$ul = '';
|
||||
|
|
|
|||
|
|
@ -30,8 +30,8 @@ class AdminWeightpresetsActionSaveResponse extends TextResponse
|
|||
}
|
||||
|
||||
// save to db
|
||||
DB::Aowow()->query('DELETE FROM ?_account_weightscale_data WHERE `id` = ?d', $this->_post['id']);
|
||||
DB::Aowow()->query('UPDATE ?_account_weightscales SET `icon`= ? WHERE `id` = ?d', $this->_post['__icon'], $this->_post['id']);
|
||||
DB::Aowow()->qry('DELETE FROM ::account_weightscale_data WHERE `id` = %i', $this->_post['id']);
|
||||
DB::Aowow()->qry('UPDATE ::account_weightscales SET `icon`= %s WHERE `id` = %i', $this->_post['__icon'], $this->_post['id']);
|
||||
|
||||
foreach (explode(',', $this->_post['scale']) as $s)
|
||||
{
|
||||
|
|
@ -40,7 +40,7 @@ class AdminWeightpresetsActionSaveResponse extends TextResponse
|
|||
if (!Stat::getWeightJson($k) || $v < 1)
|
||||
continue;
|
||||
|
||||
if (DB::Aowow()->query('INSERT INTO ?_account_weightscale_data VALUES (?d, ?, ?d)', $this->_post['id'], $k, $v) === null)
|
||||
if (DB::Aowow()->qry('INSERT INTO ::account_weightscale_data VALUES (%i, %s, %i)', $this->_post['id'], $k, $v) === null)
|
||||
{
|
||||
trigger_error('AdminWeightpresetsActionSaveResponse - failed to write to database', E_USER_ERROR);
|
||||
$this->result = self::ERR_WRITE_DB;
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ class ArenateamBaseResponse extends TemplateResponse
|
|||
|
||||
// 3 possibilities
|
||||
// 1) already synced to aowow
|
||||
if ($subject = DB::Aowow()->selectRow('SELECT `id`, `realmGUID`, `stub` FROM ?_profiler_arena_team WHERE `realm` = ?d AND `nameUrl` = ?', $this->realmId, Profiler::urlize($this->subjectName)))
|
||||
if ($subject = DB::Aowow()->selectRow('SELECT `id`, `realmGUID`, `stub` FROM ::profiler_arena_team WHERE `realm` = %i AND `nameUrl` = %s', $this->realmId, Profiler::urlize($this->subjectName)))
|
||||
{
|
||||
$this->typeId = $subject['id'];
|
||||
|
||||
|
|
@ -57,16 +57,15 @@ class ArenateamBaseResponse extends TemplateResponse
|
|||
}
|
||||
|
||||
// 2) not yet synced but exists on realm (wont work if we get passed an urlized name, but there is nothing we can do about it)
|
||||
$subjects = DB::Characters($this->realmId)->select('SELECT at.`arenaTeamId` AS "realmGUID", at.`name`, at.`type` FROM arena_team at WHERE at.`name` = ?', $this->subjectName);
|
||||
if ($subject = array_filter($subjects ?: [], fn($x) => Util::lower($x['name']) === Util::lower($this->subjectName)))
|
||||
$subjects = DB::Characters($this->realmId)->selectAssoc('SELECT at.`arenaTeamId` AS "realmGUID", at.`name`, at.`type` FROM arena_team at WHERE at.`name` = %s', $this->subjectName);
|
||||
if ($subject = array_find($subjects ?: [], fn($x) => Util::lower($x['name']) === Util::lower($this->subjectName)))
|
||||
{
|
||||
$subject = array_pop($subject);
|
||||
$subject['realm'] = $this->realmId;
|
||||
$subject['stub'] = 1;
|
||||
$subject['nameUrl'] = Profiler::urlize($subject['name']);
|
||||
|
||||
// create entry from realm with basic info
|
||||
DB::Aowow()->query('INSERT IGNORE INTO ?_profiler_arena_team (?#) VALUES (?a)', array_keys($subject), array_values($subject));
|
||||
DB::Aowow()->qry('INSERT IGNORE INTO ::profiler_arena_team %v', $subject);
|
||||
|
||||
$this->handleIncompleteData(Type::ARENA_TEAM, $subject['realmGUID']);
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -32,12 +32,12 @@ class ArenaTeamResyncResponse extends TextResponse
|
|||
if (!$this->assertGET('id'))
|
||||
return;
|
||||
|
||||
if ($teams = DB::Aowow()->select('SELECT `realm`, `realmGUID` FROM ?_profiler_arena_team WHERE `id` IN (?a)', $this->_get['id']))
|
||||
if ($teams = DB::Aowow()->selectAssoc('SELECT `realm`, `realmGUID` FROM ::profiler_arena_team WHERE `id` IN %in', $this->_get['id']))
|
||||
foreach ($teams as $t)
|
||||
Profiler::scheduleResync(Type::ARENA_TEAM, $t['realm'], $t['realmGUID']);
|
||||
|
||||
if ($this->_get['profile'])
|
||||
if ($chars = DB::Aowow()->select('SELECT `realm`, `realmGUID` FROM ?_profiler_profiles p JOIN ?_profiler_arena_team_member atm ON atm.`profileId` = p.`id` WHERE atm.`arenaTeamId` IN (?a)', $this->_get['id']))
|
||||
if ($chars = DB::Aowow()->selectAssoc('SELECT `realm`, `realmGUID` FROM ::profiler_profiles p JOIN ::profiler_arena_team_member atm ON atm.`profileId` = p.`id` WHERE atm.`arenaTeamId` IN %in', $this->_get['id']))
|
||||
foreach ($chars as $c)
|
||||
Profiler::scheduleResync(Type::PROFILE, $c['realm'], $c['realmGUID']);
|
||||
|
||||
|
|
|
|||
|
|
@ -153,15 +153,15 @@ class ClassBaseResponse extends TemplateResponse implements ICache
|
|||
['s.typeCat', [-13, -11, -2, 7]],
|
||||
[['s.cuFlags', (SPELL_CU_TRIGGERED | CUSTOM_EXCLUDE_FOR_LISTVIEW), '&'], 0],
|
||||
[
|
||||
'OR',
|
||||
DB::OR,
|
||||
// Glyphs, Proficiencies
|
||||
['s.reqClassMask', $cl->toMask(), '&'],
|
||||
// Abilities / Talents
|
||||
['s.skillLine1', $this->subject->getField('skills')],
|
||||
['AND', ['s.skillLine1', 0, '>'], ['s.skillLine2OrMask', $this->subject->getField('skills')]]
|
||||
[DB::AND, ['s.skillLine1', 0, '>'], ['s.skillLine2OrMask', $this->subject->getField('skills')]]
|
||||
],
|
||||
[ // last rank or unranked
|
||||
'OR',
|
||||
DB::OR,
|
||||
['s.cuFlags', SPELL_CU_LAST_RANK, '&'],
|
||||
['s.rankNo', 0]
|
||||
]
|
||||
|
|
@ -268,13 +268,13 @@ class ClassBaseResponse extends TemplateResponse implements ICache
|
|||
|
||||
// tab: criteria-of
|
||||
$conditions = array(
|
||||
'AND',
|
||||
DB::AND,
|
||||
['ac.type', ACHIEVEMENT_CRITERIA_TYPE_HK_CLASS],
|
||||
['ac.value1', $this->typeId]
|
||||
);
|
||||
|
||||
if ($extraCrt = DB::World()->selectCol('SELECT `criteria_id` FROM achievement_criteria_data WHERE `type` IN (?a) AND `value1` = ?d', [ACHIEVEMENT_CRITERIA_DATA_TYPE_S_PLAYER_CLASS_RACE, ACHIEVEMENT_CRITERIA_DATA_TYPE_T_PLAYER_CLASS_RACE], $this->typeId))
|
||||
$conditions = ['OR', $conditions, ['ac.id', $extraCrt]];
|
||||
if ($extraCrt = DB::World()->selectCol('SELECT `criteria_id` FROM achievement_criteria_data WHERE `type` IN %in AND `value1` = %i', [ACHIEVEMENT_CRITERIA_DATA_TYPE_S_PLAYER_CLASS_RACE, ACHIEVEMENT_CRITERIA_DATA_TYPE_T_PLAYER_CLASS_RACE], $this->typeId))
|
||||
$conditions = [DB::OR, $conditions, ['ac.id', $extraCrt]];
|
||||
|
||||
$crtOf = new AchievementList($conditions);
|
||||
if (!$crtOf->error)
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ class CommentAddreplyResponse extends TextResponse
|
|||
if (!User::canReply())
|
||||
$this->generate404(Lang::main('cannotComment'));
|
||||
|
||||
if (!$this->_post['commentId'] || !DB::Aowow()->selectCell('SELECT 1 FROM ?_comments WHERE `id` = ?d', $this->_post['commentId']))
|
||||
if (!$this->_post['commentId'] || !DB::Aowow()->selectCell('SELECT 1 FROM ::comments WHERE `id` = %i', $this->_post['commentId']))
|
||||
{
|
||||
trigger_error('CommentAddreplyResponse - parent comment #'.$this->_post['commentId'].' does not exist', E_USER_ERROR);
|
||||
$this->generate404(Lang::main('intError'));
|
||||
|
|
@ -38,7 +38,7 @@ class CommentAddreplyResponse extends TextResponse
|
|||
if (mb_strlen($this->_post['body']) < CommunityContent::REPLY_LENGTH_MIN || mb_strlen($this->_post['body']) > CommunityContent::REPLY_LENGTH_MAX)
|
||||
$this->generate404(Lang::main('textLength', [mb_strlen($this->_post['body']), CommunityContent::REPLY_LENGTH_MIN, CommunityContent::REPLY_LENGTH_MAX]));
|
||||
|
||||
if (!DB::Aowow()->query('INSERT INTO ?_comments (`userId`, `roles`, `body`, `date`, `replyTo`) VALUES (?d, ?d, ?, UNIX_TIMESTAMP(), ?d)', User::$id, User::$groups, $this->_post['body'], $this->_post['commentId']))
|
||||
if (!DB::Aowow()->qry('INSERT INTO ::comments (`userId`, `roles`, `body`, `date`, `replyTo`) VALUES (%i, %i, %s, UNIX_TIMESTAMP(), %i)', User::$id, User::$groups, $this->_post['body'], $this->_post['commentId']))
|
||||
{
|
||||
trigger_error('CommentAddreplyResponse - write to db failed', E_USER_ERROR);
|
||||
$this->generate404(Lang::main('intError'));
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ class CommentAddResponse extends TextResponse
|
|||
// we now have a valid return target
|
||||
$idOrUrl = $this->_get['typeid'];
|
||||
if ($this->_get['type'] == Type::GUIDE)
|
||||
if ($_ = DB::Aowow()->selectCell('SELECT `url` FROM ?_guides WHERE `id` = ?d', $this->_get['typeid']))
|
||||
if ($_ = DB::Aowow()->selectCell('SELECT `url` FROM ::guides WHERE `id` = %i', $this->_get['typeid']))
|
||||
$idOrUrl = $_;
|
||||
|
||||
$this->redirectTo = '?'.Type::getFileString($this->_get['type']).'='.$idOrUrl.'#comments';
|
||||
|
|
@ -57,16 +57,16 @@ class CommentAddResponse extends TextResponse
|
|||
return;
|
||||
}
|
||||
|
||||
if ($postId = DB::Aowow()->query('INSERT INTO ?_comments (`type`, `typeId`, `userId`, `roles`, `body`, `date`) VALUES (?d, ?d, ?d, ?d, ?, UNIX_TIMESTAMP())', $this->_get['type'], $this->_get['typeid'], User::$id, User::$groups, $this->_post['commentbody']))
|
||||
if ($postId = DB::Aowow()->qry('INSERT INTO ::comments (`type`, `typeId`, `userId`, `roles`, `body`, `date`) VALUES (%i, %i, %i, %i, %s, UNIX_TIMESTAMP())', $this->_get['type'], $this->_get['typeid'], User::$id, User::$groups, $this->_post['commentbody']))
|
||||
{
|
||||
Util::gainSiteReputation(User::$id, SITEREP_ACTION_COMMENT, ['id' => $postId]);
|
||||
|
||||
// every comment starts with a rating of +1 and i guess the simplest thing to do is create a db-entry with the system as owner
|
||||
DB::Aowow()->query('INSERT INTO ?_user_ratings (`type`, `entry`, `userId`, `value`) VALUES (?d, ?d, 0, 1)', RATING_COMMENT, $postId);
|
||||
DB::Aowow()->qry('INSERT INTO ::user_ratings (`type`, `entry`, `userId`, `value`) VALUES (%i, %i, 0, 1)', RATING_COMMENT, $postId);
|
||||
|
||||
// flag target with hasComment
|
||||
if ($tbl = Type::getClassAttrib($this->_get['type'], 'dataTable'))
|
||||
DB::Aowow()->query('UPDATE ?# SET `cuFlags` = `cuFlags` | ?d WHERE `id` = ?d', $tbl, CUSTOM_HAS_COMMENT, $this->_get['typeid']);
|
||||
DB::Aowow()->qry('UPDATE %n SET `cuFlags` = `cuFlags` | %i WHERE `id` = %i', $tbl, CUSTOM_HAS_COMMENT, $this->_get['typeid']);
|
||||
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,16 +23,13 @@ class CommentDeletereplyResponse extends TextResponse
|
|||
$this->generate404(User::isInGroup(U_GROUP_STAFF) ? 'request malformed' : '');
|
||||
}
|
||||
|
||||
// flag as deleted (unset sticky (can a reply even be sticky?)
|
||||
$ok = DB::Aowow()->query('UPDATE ?_comments SET `flags` = `flags` & ~?d | ?d, `deleteUserId` = ?d, `deleteDate` = UNIX_TIMESTAMP() WHERE `id` = ?d { AND `userId` = ?d }',
|
||||
CC_FLAG_STICKY, CC_FLAG_DELETED,
|
||||
User::$id,
|
||||
$this->_post['id'],
|
||||
User::isInGroup(U_GROUP_MODERATOR) ? DBSIMPLE_SKIP : User::$id
|
||||
);
|
||||
$where = [['`id` = %i', $this->_post['id']]];
|
||||
if (!User::isInGroup(U_GROUP_MODERATOR))
|
||||
$where[] = ['`userId` = %i', User::$id];
|
||||
|
||||
if ($ok)
|
||||
DB::Aowow()->query('DELETE FROM ?_user_ratings WHERE `type` = ?d AND `entry` = ?d', RATING_COMMENT, $this->_post['id']);
|
||||
// flag as deleted
|
||||
if (DB::Aowow()->qry('UPDATE ::comments SET `flags` = `flags` | %i, `deleteUserId` = %i, `deleteDate` = UNIX_TIMESTAMP() WHERE %and', CC_FLAG_DELETED, User::$id, $where))
|
||||
DB::Aowow()->qry('DELETE FROM ::user_ratings WHERE `type` = %i AND `entry` = %i', RATING_COMMENT, $this->_post['id']);
|
||||
else
|
||||
{
|
||||
trigger_error('CommentDeletereplyResponse - deleting reply #'.$this->_post['id'].' by user #'.User::$id.' from db failed', E_USER_ERROR);
|
||||
|
|
|
|||
|
|
@ -24,24 +24,21 @@ class CommentDeleteResponse extends TextResponse
|
|||
}
|
||||
|
||||
// in theory, there is a username passed alongside if executed from userpage... lets just use the current user (see user.js)
|
||||
$ok = DB::Aowow()->query('UPDATE ?_comments SET `flags` = `flags` | ?d, `deleteUserId` = ?d, `deleteDate` = UNIX_TIMESTAMP() WHERE `id` IN (?a) { AND `userId` = ?d }',
|
||||
CC_FLAG_DELETED,
|
||||
User::$id,
|
||||
$this->_post['id'],
|
||||
User::isInGroup(U_GROUP_MODERATOR) ? DBSIMPLE_SKIP : User::$id
|
||||
);
|
||||
$where = [['`id` IN %in', $this->_post['id']]];
|
||||
if (!User::isInGroup(U_GROUP_MODERATOR))
|
||||
$where[] = ['`userId` = %i', User::$id];
|
||||
|
||||
// unflag subject: hasComment
|
||||
if ($ok)
|
||||
// flag as deleted; unflag subject: hasComment
|
||||
if (DB::Aowow()->qry('UPDATE ::comments SET `flags` = `flags` | %i, `deleteUserId` = %i, `deleteDate` = UNIX_TIMESTAMP() WHERE %and', CC_FLAG_DELETED, User::$id, $where))
|
||||
{
|
||||
$coInfo = DB::Aowow()->select(
|
||||
'SELECT IF(BIT_OR(~b.`flags`) & ?d, 1, 0) AS "0", b.`type` AS "1", b.`typeId` AS "2" FROM ?_comments a JOIN ?_comments b ON a.`type` = b.`type` AND a.`typeId` = b.`typeId` WHERE a.`id` IN (?a) GROUP BY b.`type`, b.`typeId`',
|
||||
$coInfo = DB::Aowow()->selectAssoc(
|
||||
'SELECT IF(BIT_OR(~b.`flags`) & %i, 1, 0) AS "0", b.`type` AS "1", b.`typeId` AS "2" FROM ::comments a JOIN ::comments b ON a.`type` = b.`type` AND a.`typeId` = b.`typeId` WHERE a.`id` IN %in GROUP BY b.`type`, b.`typeId`',
|
||||
CC_FLAG_DELETED, $this->_post['id']
|
||||
);
|
||||
|
||||
foreach ($coInfo as [$hasMore, $type, $typeId])
|
||||
if (!$hasMore && ($tbl = Type::getClassAttrib($type, 'dataTable')))
|
||||
DB::Aowow()->query('UPDATE ?# SET `cuFlags` = `cuFlags` & ~?d WHERE `id` = ?d', $tbl, CUSTOM_HAS_COMMENT, $typeId);
|
||||
DB::Aowow()->qry('UPDATE %n SET `cuFlags` = `cuFlags` & ~%i WHERE `id` = %i', $tbl, CUSTOM_HAS_COMMENT, $typeId);
|
||||
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ class CommentDetachreplyResponse extends TextResponse
|
|||
$this->generate404(User::isInGroup(U_GROUP_STAFF) ? 'request malformed' : '');
|
||||
}
|
||||
|
||||
DB::Aowow()->query('UPDATE ?_comments c1, ?_comments c2 SET c1.`replyTo` = 0, c1.`type` = c2.`type`, c1.`typeId` = c2.`typeId` WHERE c1.`replyTo` = c2.`id` AND c1.`id` = ?d', $this->_post['id']);
|
||||
DB::Aowow()->qry('UPDATE ::comments c1, ::comments c2 SET c1.`replyTo` = 0, c1.`type` = c2.`type`, c1.`typeId` = c2.`typeId` WHERE c1.`replyTo` = c2.`id` AND c1.`id` = %i', $this->_post['id']);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ class CommentDownvotereplyResponse extends TextResponse
|
|||
if (!User::canDownvote())
|
||||
$this->generate404(User::isInGroup(U_GROUP_STAFF) ? 'cannot downvote' : '');
|
||||
|
||||
$comment = DB::Aowow()->selectRow('SELECT `userId`, IF(`flags` & ?d, 1, 0) AS "deleted" FROM ?_comments WHERE `id` = ?d', CC_FLAG_DELETED, $this->_post['id']);
|
||||
$comment = DB::Aowow()->selectRow('SELECT `userId`, IF(`flags` & %i, 1, 0) AS "deleted" FROM ::comments WHERE `id` = %i', CC_FLAG_DELETED, $this->_post['id']);
|
||||
if (!$comment)
|
||||
{
|
||||
trigger_error('CommentDownvotereplyResponse - comment #'.$this->_post['id'].' not found in db', E_USER_ERROR);
|
||||
|
|
@ -39,15 +39,9 @@ class CommentDownvotereplyResponse extends TextResponse
|
|||
if ($comment['deleted'])
|
||||
$this->generate404('LANG.votedeleted_tip');
|
||||
|
||||
$ok = DB::Aowow()->query(
|
||||
'INSERT INTO ?_user_ratings (`type`, `entry`, `userId`, `value`) VALUES (?d, ?d, ?d, ?d)',
|
||||
RATING_COMMENT,
|
||||
$this->_post['id'],
|
||||
User::$id,
|
||||
User::canSupervote() ? -2 : -1
|
||||
);
|
||||
|
||||
if (!is_int($ok))
|
||||
if (is_null(DB::Aowow()->qry('INSERT INTO ::user_ratings (`type`, `entry`, `userId`, `value`) VALUES (%i, %i, %i, %i)',
|
||||
RATING_COMMENT, $this->_post['id'], User::$id, User::canSupervote() ? -2 : -1
|
||||
)))
|
||||
{
|
||||
trigger_error('CommentDownvotereplyResponse - write to db failed', E_USER_ERROR);
|
||||
$this->generate404(User::isInGroup(U_GROUP_STAFF) ? 'write to db failed' : '');
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ class CommentEditreplyResponse extends TextResponse
|
|||
$this->generate404(User::isInGroup(U_GROUP_STAFF) ? 'request malformed' : '');
|
||||
}
|
||||
|
||||
$ownerId = DB::Aowow()->selectCell('SELECT `userId` FROM ?_comments WHERE `id` = ?d AND `replyTo` = ?d', $this->_post['replyId'], $this->_post['commentId']);
|
||||
$ownerId = DB::Aowow()->selectCell('SELECT `userId` FROM ::comments WHERE `id` = %i AND `replyTo` = %i', $this->_post['replyId'], $this->_post['commentId']);
|
||||
|
||||
if (!User::canReply() || (User::$id != $ownerId && !User::isInGroup(U_GROUP_MODERATOR)))
|
||||
$this->generate404(Lang::main('cannotComment'));
|
||||
|
|
@ -48,8 +48,11 @@ class CommentEditreplyResponse extends TextResponse
|
|||
if (User::$id == $ownerId)
|
||||
$update['roles'] = User::$groups;
|
||||
|
||||
if (!DB::Aowow()->query('UPDATE ?_comments SET `editCount` = `editCount` + 1, ?a WHERE `id` = ?d AND `replyTo` = ?d { AND `userId` = ?d }',
|
||||
$update, $this->_post['replyId'], $this->_post['commentId'], User::isInGroup(U_GROUP_MODERATOR) ? DBSIMPLE_SKIP : User::$id))
|
||||
$where = [['`id` = %i', $this->_post['replyId']], ['`replyTo` = %i', $this->_post['commentId']]];
|
||||
if (!User::isInGroup(U_GROUP_MODERATOR))
|
||||
$where[] = ['`userId` = %i', User::$id];
|
||||
|
||||
if (!DB::Aowow()->qry('UPDATE ::comments SET `editCount` = `editCount` + 1, %a WHERE %and', $update, $where))
|
||||
{
|
||||
trigger_error('CommentEditreplyResponse - write to db failed', E_USER_ERROR);
|
||||
$this->generate404(Lang::main('intError'));
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ class CommentEditResponse extends TextResponse
|
|||
return;
|
||||
}
|
||||
|
||||
$ownerId = DB::Aowow()->selectCell('SELECT `userId` FROM ?_comments WHERE `id` = ?d', $this->_get['id']);
|
||||
$ownerId = DB::Aowow()->selectCell('SELECT `userId` FROM ::comments WHERE `id` = %i', $this->_get['id']);
|
||||
|
||||
if (!User::canComment() || (User::$id != $ownerId && !User::isInGroup(U_GROUP_MODERATOR)))
|
||||
{
|
||||
|
|
@ -56,7 +56,7 @@ class CommentEditResponse extends TextResponse
|
|||
$update['responseRoles'] = User::$groups;
|
||||
}
|
||||
|
||||
DB::Aowow()->query('UPDATE ?_comments SET `editCount` = `editCount` + 1, ?a WHERE `id` = ?d', $update, $this->_get['id']);
|
||||
DB::Aowow()->qry('UPDATE ::comments SET `editCount` = `editCount` + 1, %a WHERE `id` = %i', $update, $this->_get['id']);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ class CommentFlagreplyResponse extends TextResponse
|
|||
$this->generate404(User::isInGroup(U_GROUP_STAFF) ? 'request malformed' : '');
|
||||
}
|
||||
|
||||
$replyOwner = DB::Aowow()->selectCell('SELECT `userId` FROM ?_commments WHERE `id` = ?d', $this->_post['id']);
|
||||
$replyOwner = DB::Aowow()->selectCell('SELECT `userId` FROM ::commments WHERE `id` = %i', $this->_post['id']);
|
||||
if (!$replyOwner)
|
||||
{
|
||||
trigger_error('CommentFlagreplyResponse - reply not found', E_USER_ERROR);
|
||||
|
|
@ -38,7 +38,7 @@ class CommentFlagreplyResponse extends TextResponse
|
|||
if (!$report->create('Report Reply Button Click'))
|
||||
$this->generate404('LANG.ct_resp_error'.$report->getError());
|
||||
else if (count($report->getSimilar()) >= CommunityContent::REPORT_THRESHOLD_AUTO_DELETE)
|
||||
DB::Aowow()->query('UPDATE ?_comments SET `flags` = `flags` | ?d WHERE `id` = ?d', CC_FLAG_DELETED, $this->_post['id']);
|
||||
DB::Aowow()->qry('UPDATE ::comments SET `flags` = `flags` | %i WHERE `id` = %i', CC_FLAG_DELETED, $this->_post['id']);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -30,9 +30,9 @@ class CommentOutofdateResponse extends TextResponse
|
|||
if (User::isInGroup(U_GROUP_MODERATOR)) // directly mark as outdated
|
||||
{
|
||||
if (!$this->_post['remove'])
|
||||
$ok = DB::Aowow()->query('UPDATE ?_comments SET `flags` = `flags` | ?d WHERE `id` = ?d', CC_FLAG_OUTDATED, $this->_post['id']);
|
||||
$ok = DB::Aowow()->qry('UPDATE ::comments SET `flags` = `flags` | %i WHERE `id` = %i', CC_FLAG_OUTDATED, $this->_post['id']);
|
||||
else
|
||||
$ok = DB::Aowow()->query('UPDATE ?_comments SET `flags` = `flags` & ~?d WHERE `id` = ?d', CC_FLAG_OUTDATED, $this->_post['id']);
|
||||
$ok = DB::Aowow()->qry('UPDATE ::comments SET `flags` = `flags` & ~%i WHERE `id` = %i', CC_FLAG_OUTDATED, $this->_post['id']);
|
||||
}
|
||||
else // try to report as outdated
|
||||
{
|
||||
|
|
@ -41,7 +41,7 @@ class CommentOutofdateResponse extends TextResponse
|
|||
$this->result = Lang::main('intError');
|
||||
|
||||
if (count($report->getSimilar()) >= CommunityContent::REPORT_THRESHOLD_AUTO_OUT_OF_DATE)
|
||||
$ok = DB::Aowow()->query('UPDATE ?_comments SET `flags` = `flags` | ?d WHERE `id` = ?d', CC_FLAG_OUTDATED, $this->_post['id']);
|
||||
$ok = DB::Aowow()->qry('UPDATE ::comments SET `flags` = `flags` | %i WHERE `id` = %i', CC_FLAG_OUTDATED, $this->_post['id']);
|
||||
}
|
||||
|
||||
if (!$ok)
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ class CommentRatingResponse extends TextResponse
|
|||
return;
|
||||
}
|
||||
|
||||
if ($votes = DB::Aowow()->selectRow('SELECT 1 AS "success", SUM(IF(`value` > 0, `value`, 0)) AS "up", SUM(IF(`value` < 0, -`value`, 0)) AS "down" FROM ?_user_ratings WHERE `type` = ?d AND `entry` = ?d AND `userId` <> 0 GROUP BY `entry`', RATING_COMMENT, $this->_get['id']))
|
||||
if ($votes = DB::Aowow()->selectRow('SELECT 1 AS "success", SUM(IF(`value` > 0, `value`, 0)) AS "up", SUM(IF(`value` < 0, -`value`, 0)) AS "down" FROM ::user_ratings WHERE `type` = %i AND `entry` = %i AND `userId` <> 0 GROUP BY `entry`', RATING_COMMENT, $this->_get['id']))
|
||||
$this->result = Util::toJSON($votes);
|
||||
else
|
||||
$this->result = Util::toJSON(['success' => 1, 'up' => 0, 'down' => 0]);
|
||||
|
|
|
|||
|
|
@ -25,9 +25,9 @@ class CommentStickyResponse extends TextResponse
|
|||
}
|
||||
|
||||
if ($this->_post['sticky'])
|
||||
DB::Aowow()->query('UPDATE ?_comments SET `flags` = `flags` | ?d WHERE `id` = ?d', CC_FLAG_STICKY, $this->_post['id']);
|
||||
DB::Aowow()->qry('UPDATE ::comments SET `flags` = `flags` | %i WHERE `id` = %i', CC_FLAG_STICKY, $this->_post['id']);
|
||||
else
|
||||
DB::Aowow()->query('UPDATE ?_comments SET `flags` = `flags` & ~?d WHERE `id` = ?d', CC_FLAG_STICKY, $this->_post['id']);
|
||||
DB::Aowow()->qry('UPDATE ::comments SET `flags` = `flags` & ~%i WHERE `id` = %i', CC_FLAG_STICKY, $this->_post['id']);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -24,19 +24,20 @@ class CommentUndeleteResponse extends TextResponse
|
|||
}
|
||||
|
||||
// in theory, there is a username passed alongside if executed from userpage... lets just use the current user (see user.js)
|
||||
$ok = DB::Aowow()->query('UPDATE ?_comments SET `flags` = `flags` & ~?d WHERE `id` IN (?a) { AND `userId` = `deleteUserId` AND `deleteUserId` = ?d }',
|
||||
CC_FLAG_DELETED,
|
||||
$this->_post['id'],
|
||||
User::isInGroup(U_GROUP_MODERATOR) ? DBSIMPLE_SKIP : User::$id
|
||||
);
|
||||
$where = [['`id` IN %in', $this->_post['id']]];
|
||||
if (!User::isInGroup(U_GROUP_MODERATOR))
|
||||
{
|
||||
$where[] = ['`deleteUserId` = `userId'];
|
||||
$where[] = ['`deleteUserId` = %i', User::$id];
|
||||
}
|
||||
|
||||
// unflag subject: hasComment
|
||||
if ($ok)
|
||||
if (DB::Aowow()->qry('UPDATE ::comments SET `flags` = `flags` & ~%i WHERE %and', CC_FLAG_DELETED, $where))
|
||||
{
|
||||
$coInfo = DB::Aowow()->select('SELECT `type` AS "0", `typeId` AS "1" FROM ?_comments WHERE `id` IN (?a) GROUP BY `type`, `typeId`', $this->_post['id']);
|
||||
$coInfo = DB::Aowow()->selectAssoc('SELECT `type` AS "0", `typeId` AS "1" FROM ::comments WHERE `id` IN %in GROUP BY `type`, `typeId`', $this->_post['id']);
|
||||
foreach ($coInfo as [$type, $typeId])
|
||||
if ($tbl = Type::getClassAttrib($type, 'dataTable'))
|
||||
DB::Aowow()->query('UPDATE ?# SET `cuFlags` = `cuFlags` | ?d WHERE `id` = ?d', $tbl, CUSTOM_HAS_COMMENT, $typeId);
|
||||
DB::Aowow()->qry('UPDATE %n SET `cuFlags` = `cuFlags` | %i WHERE `id` = %i', $tbl, CUSTOM_HAS_COMMENT, $typeId);
|
||||
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ class CommentUpvotereplyResponse extends TextResponse
|
|||
if (!User::canUpvote())
|
||||
$this->generate404(User::isInGroup(U_GROUP_STAFF) ? 'cannot upvote' : '');
|
||||
|
||||
$comment = DB::Aowow()->selectRow('SELECT `userId`, IF(`flags` & ?d, 1, 0) AS "deleted" FROM ?_comments WHERE `id` = ?d', CC_FLAG_DELETED, $this->_post['id']);
|
||||
$comment = DB::Aowow()->selectRow('SELECT `userId`, IF(`flags` & %i, 1, 0) AS "deleted" FROM ::comments WHERE `id` = %i', CC_FLAG_DELETED, $this->_post['id']);
|
||||
if (!$comment)
|
||||
{
|
||||
trigger_error('CommentUpvotereplyResponse - comment #'.$this->_post['id'].' not found in db', E_USER_ERROR);
|
||||
|
|
@ -39,15 +39,9 @@ class CommentUpvotereplyResponse extends TextResponse
|
|||
if ($comment['deleted'])
|
||||
$this->generate404('LANG.votedeleted_tip');
|
||||
|
||||
$ok = DB::Aowow()->query(
|
||||
'INSERT INTO ?_user_ratings (`type`, `entry`, `userId`, `value`) VALUES (?d, ?d, ?d, ?d)',
|
||||
RATING_COMMENT,
|
||||
$this->_post['id'],
|
||||
User::$id,
|
||||
User::canSupervote() ? 2 : 1
|
||||
);
|
||||
|
||||
if (!is_int($ok))
|
||||
if (is_null(DB::Aowow()->qry('INSERT INTO ::user_ratings (`type`, `entry`, `userId`, `value`) VALUES (%i, %i, %i, %i)',
|
||||
RATING_COMMENT, $this->_post['id'], User::$id, User::canSupervote() ? 2 : 1
|
||||
)))
|
||||
{
|
||||
trigger_error('CommentUpvotereplyResponse - write to db failed', E_USER_ERROR);
|
||||
$this->generate404(User::isInGroup(U_GROUP_STAFF) ? 'write to db failed' : '');
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ class CommentVoteResponse extends TextResponse
|
|||
}
|
||||
|
||||
$target = DB::Aowow()->selectRow(
|
||||
'SELECT c.`userId` AS "owner", ur.`value`, IF(c.`flags` & ?d, 1, 0) AS "deleted" FROM ?_comments c LEFT JOIN ?_user_ratings ur ON ur.`type` = ?d AND ur.`entry` = c.id AND ur.`userId` = ?d WHERE c.id = ?d',
|
||||
'SELECT c.`userId` AS "owner", ur.`value`, IF(c.`flags` & %i, 1, 0) AS "deleted" FROM ::comments c LEFT JOIN ::user_ratings ur ON ur.`type` = %i AND ur.`entry` = c.id AND ur.`userId` = %i WHERE c.id = %i',
|
||||
CC_FLAG_DELETED, RATING_COMMENT, User::$id, $this->_get['id']
|
||||
);
|
||||
if (!$target)
|
||||
|
|
@ -62,9 +62,9 @@ class CommentVoteResponse extends TextResponse
|
|||
$ok = false;
|
||||
// old and new have same sign; undo vote (user may have gained/lost access to superVote in the meantime)
|
||||
if ($target['value'] && ($target['value'] < 0) == ($val < 0))
|
||||
$ok = DB::Aowow()->query('DELETE FROM ?_user_ratings WHERE `type` = ?d AND `entry` = ?d AND `userId` = ?d', RATING_COMMENT, $this->_get['id'], User::$id);
|
||||
$ok = DB::Aowow()->qry('DELETE FROM ::user_ratings WHERE `type` = %i AND `entry` = %i AND `userId` = %i', RATING_COMMENT, $this->_get['id'], User::$id);
|
||||
else // replace, because we may be overwriting an old, opposing vote
|
||||
if ($ok = DB::Aowow()->query('REPLACE INTO ?_user_ratings (`type`, `entry`, `userId`, `value`) VALUES (?d, ?d, ?d, ?d)', RATING_COMMENT, $this->_get['id'], User::$id, $val))
|
||||
if ($ok = DB::Aowow()->qry('REPLACE INTO ::user_ratings (`type`, `entry`, `userId`, `value`) VALUES (%i, %i, %i, %i)', RATING_COMMENT, $this->_get['id'], User::$id, $val))
|
||||
User::decrementDailyVotes(); // do not refund retracted votes!
|
||||
|
||||
if ($ok)
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ class CookieBaseResponse extends TextResponse
|
|||
{
|
||||
if (!$this->param && $this->_get['purge'])
|
||||
{
|
||||
if (User::$id && DB::Aowow()->query('UPDATE ?_account_cookies SET `data` = "purged" WHERE `userId` = ?d AND `name` LIKE "announcement-%"', User::$id) !== null)
|
||||
if (User::$id && DB::Aowow()->qry('UPDATE ::account_cookies SET `data` = "purged" WHERE `userId` = %i AND `name` LIKE "announcement-%"', User::$id) !== null)
|
||||
$this->result = 0;
|
||||
|
||||
return;
|
||||
|
|
@ -44,7 +44,7 @@ class CookieBaseResponse extends TextResponse
|
|||
return;
|
||||
}
|
||||
|
||||
if (DB::Aowow()->query('REPLACE INTO ?_account_cookies VALUES (?d, ?, ?)', User::$id, $this->param, $this->_get[$this->param]))
|
||||
if (DB::Aowow()->qry('REPLACE INTO ::account_cookies VALUES (%i, %s, %s)', User::$id, $this->param, $this->_get[$this->param]))
|
||||
$this->result = 0;
|
||||
else
|
||||
trigger_error('CookieBaseResponse - write to db failed', E_USER_ERROR);
|
||||
|
|
|
|||
|
|
@ -201,7 +201,7 @@ class CurrencyBaseResponse extends TemplateResponse implements ICache
|
|||
// tab: created by (spell) [for items its handled in LootByItem]
|
||||
if ($this->typeId == CURRENCY_HONOR_POINTS)
|
||||
{
|
||||
$createdBy = new SpellList(array(['effect1Id', SPELL_EFFECT_ADD_HONOR], ['effect2Id', SPELL_EFFECT_ADD_HONOR], ['effect3Id', SPELL_EFFECT_ADD_HONOR], 'OR'));
|
||||
$createdBy = new SpellList(array(['effect1Id', SPELL_EFFECT_ADD_HONOR], ['effect2Id', SPELL_EFFECT_ADD_HONOR], ['effect3Id', SPELL_EFFECT_ADD_HONOR], DB::OR));
|
||||
if (!$createdBy->error)
|
||||
{
|
||||
$this->extendGlobalData($createdBy->getJSGlobals(GLOBALINFO_SELF | GLOBALINFO_RELATED));
|
||||
|
|
@ -237,8 +237,8 @@ class CurrencyBaseResponse extends TemplateResponse implements ICache
|
|||
if (!$n && !is_null(ItemListFilter::getCriteriaIndex(158, $_relItemId)))
|
||||
$n = '?items&filter=cr=158;crs='.$_relItemId.';crv=0';
|
||||
|
||||
$xCosts = DB::Aowow()->selectCol('SELECT `id` FROM ?_itemextendedcost WHERE '.$w);
|
||||
$boughtBy = $xCosts ? DB::World()->selectCol('SELECT `item` FROM npc_vendor WHERE `extendedCost` IN (?a) UNION SELECT `item` FROM game_event_npc_vendor WHERE `extendedCost` IN (?a)', $xCosts, $xCosts) : [];
|
||||
$xCosts = DB::Aowow()->selectCol('SELECT `id` FROM ::itemextendedcost WHERE '.$w);
|
||||
$boughtBy = $xCosts ? DB::World()->selectCol('SELECT `item` FROM npc_vendor WHERE `extendedCost` IN %in UNION SELECT `item` FROM game_event_npc_vendor WHERE `extendedCost` IN %in', $xCosts, $xCosts) : [];
|
||||
if ($boughtBy)
|
||||
{
|
||||
$boughtBy = new ItemList(array(['id', $boughtBy]));
|
||||
|
|
|
|||
|
|
@ -109,7 +109,7 @@ class EmoteBaseResponse extends TemplateResponse implements ICache
|
|||
|
||||
if ($this->subject->getField('cuFlags') & EMOTE_CU_MISSING_CMD)
|
||||
$text .= Lang::emote('noCommand').'[br][br]';
|
||||
else if ($aliasses = DB::Aowow()->selectCol('SELECT `command` FROM ?_emotes_aliasses WHERE `id` = ?d AND `locales` & ?d', $this->typeId, 1 << Lang::getLocale()->value))
|
||||
else if ($aliasses = DB::Aowow()->selectCol('SELECT `command` FROM ::emotes_aliasses WHERE `id` = %i AND `locales` & %i', $this->typeId, 1 << Lang::getLocale()->value))
|
||||
{
|
||||
$text .= '[h3]'.Lang::emote('aliases').'[/h3][ul]';
|
||||
foreach ($aliasses as $a)
|
||||
|
|
@ -184,13 +184,12 @@ class EmoteBaseResponse extends TemplateResponse implements ICache
|
|||
}
|
||||
|
||||
// tab: sound
|
||||
$ems = DB::Aowow()->select(
|
||||
$ems = DB::Aowow()->selectAssoc(
|
||||
'SELECT `soundId` AS ARRAY_KEY, BIT_OR(1 << (`raceId` - 1)) AS "raceMask", BIT_OR(1 << (`gender` - 1)) AS "gender"
|
||||
FROM ?_emotes_sounds
|
||||
WHERE `emoteId` = ?d { OR -`emoteId` = ?d }
|
||||
FROM ::emotes_sounds
|
||||
WHERE %if', $this->typeId < 0, '-`emoteId` = %i OR', $this->subject->getField('parentEmote'), '%end `emoteId` = %i
|
||||
GROUP BY `soundId`',
|
||||
$this->typeId,
|
||||
$this->typeId < 0 ? $this->subject->getField('parentEmote') : DBSIMPLE_SKIP
|
||||
);
|
||||
|
||||
if ($ems)
|
||||
|
|
|
|||
|
|
@ -194,10 +194,10 @@ class EnchantmentBaseResponse extends TemplateResponse implements ICache
|
|||
// used by spell
|
||||
// used by useItem
|
||||
$cnd = array(
|
||||
'OR',
|
||||
['AND', ['effect1Id', SpellList::EFFECTS_ENCHANTMENT], ['effect1MiscValue', $this->typeId]],
|
||||
['AND', ['effect2Id', SpellList::EFFECTS_ENCHANTMENT], ['effect2MiscValue', $this->typeId]],
|
||||
['AND', ['effect3Id', SpellList::EFFECTS_ENCHANTMENT], ['effect3MiscValue', $this->typeId]],
|
||||
DB::OR,
|
||||
[DB::AND, ['effect1Id', SpellList::EFFECTS_ENCHANTMENT], ['effect1MiscValue', $this->typeId]],
|
||||
[DB::AND, ['effect2Id', SpellList::EFFECTS_ENCHANTMENT], ['effect2MiscValue', $this->typeId]],
|
||||
[DB::AND, ['effect3Id', SpellList::EFFECTS_ENCHANTMENT], ['effect3MiscValue', $this->typeId]],
|
||||
);
|
||||
$spellList = new SpellList($cnd);
|
||||
if (!$spellList->error)
|
||||
|
|
@ -207,12 +207,12 @@ class EnchantmentBaseResponse extends TemplateResponse implements ICache
|
|||
|
||||
$spellIds = $spellList->getFoundIDs();
|
||||
$conditions = array(
|
||||
'OR',
|
||||
['AND', ['spellTrigger1', [SPELL_TRIGGER_USE, SPELL_TRIGGER_USE_NODELAY]], ['spellId1', $spellIds]],
|
||||
['AND', ['spellTrigger2', [SPELL_TRIGGER_USE, SPELL_TRIGGER_USE_NODELAY]], ['spellId2', $spellIds]],
|
||||
['AND', ['spellTrigger3', [SPELL_TRIGGER_USE, SPELL_TRIGGER_USE_NODELAY]], ['spellId3', $spellIds]],
|
||||
['AND', ['spellTrigger4', [SPELL_TRIGGER_USE, SPELL_TRIGGER_USE_NODELAY]], ['spellId4', $spellIds]],
|
||||
['AND', ['spellTrigger5', [SPELL_TRIGGER_USE, SPELL_TRIGGER_USE_NODELAY]], ['spellId5', $spellIds]]
|
||||
DB::OR,
|
||||
[DB::AND, ['spellTrigger1', [SPELL_TRIGGER_USE, SPELL_TRIGGER_USE_NODELAY]], ['spellId1', $spellIds]],
|
||||
[DB::AND, ['spellTrigger2', [SPELL_TRIGGER_USE, SPELL_TRIGGER_USE_NODELAY]], ['spellId2', $spellIds]],
|
||||
[DB::AND, ['spellTrigger3', [SPELL_TRIGGER_USE, SPELL_TRIGGER_USE_NODELAY]], ['spellId3', $spellIds]],
|
||||
[DB::AND, ['spellTrigger4', [SPELL_TRIGGER_USE, SPELL_TRIGGER_USE_NODELAY]], ['spellId4', $spellIds]],
|
||||
[DB::AND, ['spellTrigger5', [SPELL_TRIGGER_USE, SPELL_TRIGGER_USE_NODELAY]], ['spellId5', $spellIds]]
|
||||
);
|
||||
|
||||
$ubItems = new ItemList($conditions);
|
||||
|
|
@ -259,13 +259,13 @@ class EnchantmentBaseResponse extends TemplateResponse implements ICache
|
|||
}
|
||||
|
||||
// used by randomAttrItem
|
||||
$ire = DB::Aowow()->select(
|
||||
'SELECT *, ABS(`id`) AS ARRAY_KEY FROM ?_itemrandomenchant WHERE `enchantId1` = ?d OR `enchantId2` = ?d OR `enchantId3` = ?d OR `enchantId4` = ?d OR `enchantId5` = ?d',
|
||||
$ire = DB::Aowow()->selectAssoc(
|
||||
'SELECT *, ABS(`id`) AS ARRAY_KEY FROM ::itemrandomenchant WHERE `enchantId1` = %i OR `enchantId2` = %i OR `enchantId3` = %i OR `enchantId4` = %i OR `enchantId5` = %i',
|
||||
$this->typeId, $this->typeId, $this->typeId, $this->typeId, $this->typeId
|
||||
);
|
||||
if ($ire)
|
||||
{
|
||||
if ($iet = DB::World()->select('SELECT `entry` AS ARRAY_KEY, `ench`, `chance` FROM item_enchantment_template WHERE `ench` IN (?a)', array_keys($ire)))
|
||||
if ($iet = DB::World()->selectAssoc('SELECT `entry` AS ARRAY_KEY, `ench`, `chance` FROM item_enchantment_template WHERE `ench` IN %in', array_keys($ire)))
|
||||
{
|
||||
$randIds = []; // transform back to signed format
|
||||
foreach ($iet as $tplId => $data)
|
||||
|
|
|
|||
|
|
@ -114,7 +114,7 @@ class EventBaseResponse extends TemplateResponse implements ICache
|
|||
/* Main Content */
|
||||
/****************/
|
||||
|
||||
// no entry in ?_articles? use default HolidayDescription
|
||||
// no entry in ::articles? use default HolidayDescription
|
||||
if ($_holidayId && empty($this->article))
|
||||
$this->article = new Markup($this->subject->getField('description', true), ['dbpage' => true]);
|
||||
|
||||
|
|
@ -137,7 +137,7 @@ class EventBaseResponse extends TemplateResponse implements ICache
|
|||
$this->lvTabs = new Tabs(['parent' => "\$\$WH.ge('tabs-generic')"], 'tabsRelated', true);
|
||||
|
||||
// tab: npcs
|
||||
if ($npcIds = DB::World()->selectCol('SELECT `id` AS ARRAY_KEY, IF(ec.`eventEntry` > 0, 1, 0) AS "added" FROM creature c, game_event_creature ec WHERE ec.`guid` = c.`guid` AND ABS(ec.`eventEntry`) = ?d', $this->typeId))
|
||||
if ($npcIds = DB::World()->selectCol('SELECT `id` AS ARRAY_KEY, IF(ec.`eventEntry` > 0, 1, 0) AS "added" FROM creature c, game_event_creature ec WHERE ec.`guid` = c.`guid` AND ABS(ec.`eventEntry`) = %i', $this->typeId))
|
||||
{
|
||||
$creatures = new CreatureList(array(['id', array_keys($npcIds)]));
|
||||
if (!$creatures->error)
|
||||
|
|
@ -157,7 +157,7 @@ class EventBaseResponse extends TemplateResponse implements ICache
|
|||
}
|
||||
|
||||
// tab: objects
|
||||
if ($objectIds = DB::World()->selectCol('SELECT `id` AS ARRAY_KEY, IF(eg.`eventEntry` > 0, 1, 0) AS "added" FROM gameobject g, game_event_gameobject eg WHERE eg.`guid` = g.`guid` AND ABS(eg.`eventEntry`) = ?d', $this->typeId))
|
||||
if ($objectIds = DB::World()->selectCol('SELECT `id` AS ARRAY_KEY, IF(eg.`eventEntry` > 0, 1, 0) AS "added" FROM gameobject g, game_event_gameobject eg WHERE eg.`guid` = g.`guid` AND ABS(eg.`eventEntry`) = %i', $this->typeId))
|
||||
{
|
||||
$objects = new GameObjectList(array(['id', array_keys($objectIds)]));
|
||||
if (!$objects->error)
|
||||
|
|
@ -205,7 +205,7 @@ class EventBaseResponse extends TemplateResponse implements ICache
|
|||
if ($_holidayId)
|
||||
{
|
||||
// tab: criteria-of
|
||||
if ($extraCrt = DB::World()->selectCol('SELECT `criteria_id` FROM achievement_criteria_data WHERE `type` = ?d AND `value1` = ?d', ACHIEVEMENT_CRITERIA_DATA_TYPE_HOLIDAY, $_holidayId))
|
||||
if ($extraCrt = DB::World()->selectCol('SELECT `criteria_id` FROM achievement_criteria_data WHERE `type` = %i AND `value1` = %i', ACHIEVEMENT_CRITERIA_DATA_TYPE_HOLIDAY, $_holidayId))
|
||||
{
|
||||
$condition = array(['ac.id', $extraCrt]);
|
||||
if ($exclAcvs)
|
||||
|
|
@ -260,9 +260,9 @@ class EventBaseResponse extends TemplateResponse implements ICache
|
|||
// vendor
|
||||
$cIds = $creatures->getFoundIDs();
|
||||
if ($sells = DB::World()->selectCol(
|
||||
'SELECT `item` FROM npc_vendor nv WHERE `entry` IN (?a) UNION
|
||||
SELECT nv1.`item` FROM npc_vendor nv1 JOIN npc_vendor nv2 ON -nv1.`entry` = nv2.`item` WHERE nv2.`entry` IN (?a) UNION
|
||||
SELECT `item` FROM game_event_npc_vendor genv JOIN creature c ON genv.`guid` = c.`guid` WHERE c.`id` IN (?a)',
|
||||
'SELECT `item` FROM npc_vendor nv WHERE `entry` IN %in UNION
|
||||
SELECT nv1.`item` FROM npc_vendor nv1 JOIN npc_vendor nv2 ON -nv1.`entry` = nv2.`item` WHERE nv2.`entry` IN %in UNION
|
||||
SELECT `item` FROM game_event_npc_vendor genv JOIN creature c ON genv.`guid` = c.`guid` WHERE c.`id` IN %in',
|
||||
$cIds, $cIds, $cIds
|
||||
))
|
||||
$itemCnd[] = ['id', $sells];
|
||||
|
|
@ -272,7 +272,7 @@ class EventBaseResponse extends TemplateResponse implements ICache
|
|||
// not checking for loot ... cant distinguish between eventLoot and fillerCrapLoot
|
||||
if ($itemCnd)
|
||||
{
|
||||
array_unshift($itemCnd, 'OR');
|
||||
array_unshift($itemCnd, DB::OR);
|
||||
$eventItems = new ItemList($itemCnd);
|
||||
if (!$eventItems->error)
|
||||
{
|
||||
|
|
@ -288,7 +288,7 @@ class EventBaseResponse extends TemplateResponse implements ICache
|
|||
}
|
||||
|
||||
// tab: see also (event conditions)
|
||||
if ($rel = DB::World()->selectCol('SELECT IF(`eventEntry` = `prerequisite_event`, NULL, IF(`eventEntry` = ?d, `prerequisite_event`, -`eventEntry`)) FROM game_event_prerequisite WHERE `prerequisite_event` = ?d OR `eventEntry` = ?d', $this->typeId, $this->typeId, $this->typeId))
|
||||
if ($rel = DB::World()->selectCol('SELECT IF(`eventEntry` = `prerequisite_event`, NULL, IF(`eventEntry` = %i, `prerequisite_event`, -`eventEntry`)) FROM game_event_prerequisite WHERE `prerequisite_event` = %i OR `eventEntry` = %i', $this->typeId, $this->typeId, $this->typeId))
|
||||
{
|
||||
if (array_filter($rel, fn($x) => $x === null))
|
||||
trigger_error('game_event_prerequisite: this event has itself as prerequisite', E_USER_WARNING);
|
||||
|
|
|
|||
|
|
@ -102,8 +102,8 @@ class FactionBaseResponse extends TemplateResponse implements ICache
|
|||
// profiler relateed (note that this is part of the cache. I don't think this is important enough to calc for every view)
|
||||
if (Cfg::get('PROFILER_ENABLE') && !($this->subject->getField('cuFlags') & CUSTOM_EXCLUDE_FOR_LISTVIEW))
|
||||
{
|
||||
$x = DB::Aowow()->selectCell('SELECT COUNT(1) FROM ?_profiler_completion_reputation WHERE `exalted` = 1 AND `factionId` = ?d', $this->typeId);
|
||||
$y = DB::Aowow()->selectCell('SELECT COUNT(1) FROM ?_profiler_profiles WHERE `custom` = 0 AND `stub` = 0');
|
||||
$x = DB::Aowow()->selectCell('SELECT COUNT(1) FROM ::profiler_completion_reputation WHERE `exalted` = 1 AND `factionId` = %i', $this->typeId);
|
||||
$y = DB::Aowow()->selectCell('SELECT COUNT(1) FROM ::profiler_profiles WHERE `custom` = 0 AND `stub` = 0');
|
||||
$infobox[] = Lang::profiler('attainedBy', [round(($x ?: 0) * 100 / ($y ?: 1))]);
|
||||
|
||||
// completion row added by InfoboxMarkup
|
||||
|
|
@ -132,7 +132,7 @@ class FactionBaseResponse extends TemplateResponse implements ICache
|
|||
CONCAT_WS(" ", faction1, faction2, faction3, faction4) AS faction,
|
||||
CONCAT_WS(" ", rate_1, rate_2, rate_3, rate_4) AS rate,
|
||||
CONCAT_WS(" ", rank_1, rank_2, rank_3, rank_4) AS rank
|
||||
FROM reputation_spillover_template WHERE faction = ?d', $this->typeId);
|
||||
FROM reputation_spillover_template WHERE faction = %i', $this->typeId);
|
||||
*/
|
||||
|
||||
|
||||
|
|
@ -142,7 +142,7 @@ class FactionBaseResponse extends TemplateResponse implements ICache
|
|||
);
|
||||
|
||||
if ($p = $this->subject->getField('parentFactionId')) // linked via parent
|
||||
$conditions[] = ['OR', ['id', $p], ['parentFactionId', $p]];
|
||||
$conditions[] = [DB::OR, ['id', $p], ['parentFactionId', $p]];
|
||||
else // self as parent
|
||||
$conditions[] = ['parentFactionId', $this->typeId];
|
||||
|
||||
|
|
@ -162,7 +162,7 @@ class FactionBaseResponse extends TemplateResponse implements ICache
|
|||
);
|
||||
|
||||
// reward rates (ultimately this should be calculated into each reward display)
|
||||
if ($rates = DB::World()->selectRow('SELECT `quest_rate`, `quest_daily_rate`, `quest_weekly_rate`, `quest_monthly_rate`, `quest_repeatable_rate`, `creature_rate`, `spell_rate` FROM reputation_reward_rate WHERE `faction` = ?d', $this->typeId))
|
||||
if ($rates = DB::World()->selectRow('SELECT `quest_rate`, `quest_daily_rate`, `quest_weekly_rate`, `quest_monthly_rate`, `quest_repeatable_rate`, `creature_rate`, `spell_rate` FROM reputation_reward_rate WHERE `faction` = %i', $this->typeId))
|
||||
{
|
||||
$buff = '';
|
||||
foreach ($rates as $k => $v)
|
||||
|
|
@ -191,7 +191,7 @@ class FactionBaseResponse extends TemplateResponse implements ICache
|
|||
}
|
||||
|
||||
// factionchange-equivalent
|
||||
if ($pendant = DB::World()->selectCell('SELECT IF(`horde_id` = ?d, `alliance_id`, -`horde_id`) FROM player_factionchange_reputations WHERE `alliance_id` = ?d OR `horde_id` = ?d', $this->typeId, $this->typeId, $this->typeId))
|
||||
if ($pendant = DB::World()->selectCell('SELECT IF(`horde_id` = %i, `alliance_id`, -`horde_id`) FROM player_factionchange_reputations WHERE `alliance_id` = %i OR `horde_id` = %i', $this->typeId, $this->typeId, $this->typeId))
|
||||
{
|
||||
$altFac = new FactionList(array(['id', abs($pendant)]));
|
||||
if (!$altFac->error)
|
||||
|
|
@ -237,11 +237,11 @@ class FactionBaseResponse extends TemplateResponse implements ICache
|
|||
{
|
||||
// inherit siblings/children from $spillover
|
||||
$cRep = DB::World()->selectCol('SELECT DISTINCT `creature_id` AS ARRAY_KEY, `qty` FROM (
|
||||
SELECT `creature_id`, `RewOnKillRepValue1` as "qty" FROM creature_onkill_reputation WHERE `RewOnKillRepValue1` > 0 AND (`RewOnKillRepFaction1` = ?d { OR (`RewOnKillRepFaction1` IN (?a) AND `IsTeamAward1` <> 0) } ) UNION
|
||||
SELECT `creature_id`, `RewOnKillRepValue2` as "qty" FROM creature_onkill_reputation WHERE `RewOnKillRepValue2` > 0 AND (`RewOnKillRepFaction2` = ?d { OR (`RewOnKillRepFaction2` IN (?a) AND `IsTeamAward2` <> 0) } )
|
||||
SELECT `creature_id`, `RewOnKillRepValue1` as "qty" FROM creature_onkill_reputation WHERE `RewOnKillRepValue1` > 0 AND (`RewOnKillRepFaction1` = %i OR (`RewOnKillRepFaction1` IN %in AND `IsTeamAward1` <> 0) ) UNION
|
||||
SELECT `creature_id`, `RewOnKillRepValue2` as "qty" FROM creature_onkill_reputation WHERE `RewOnKillRepValue2` > 0 AND (`RewOnKillRepFaction2` = %i OR (`RewOnKillRepFaction2` IN %in AND `IsTeamAward2` <> 0) )
|
||||
) x',
|
||||
$this->typeId, $spillover->getFoundIDs() ?: DBSIMPLE_SKIP,
|
||||
$this->typeId, $spillover->getFoundIDs() ?: DBSIMPLE_SKIP
|
||||
$this->typeId, $spillover->getFoundIDs() ?: [0],
|
||||
$this->typeId, $spillover->getFoundIDs() ?: [0]
|
||||
);
|
||||
|
||||
if ($cRep)
|
||||
|
|
@ -303,13 +303,13 @@ class FactionBaseResponse extends TemplateResponse implements ICache
|
|||
|
||||
// tab: quests
|
||||
$conditions = array(
|
||||
'OR',
|
||||
DB::OR,
|
||||
Listview::DEFAULT_SIZE,
|
||||
['AND', ['rewardFactionId1', $this->typeId], ['rewardFactionValue1', 0, '>']],
|
||||
['AND', ['rewardFactionId2', $this->typeId], ['rewardFactionValue2', 0, '>']],
|
||||
['AND', ['rewardFactionId3', $this->typeId], ['rewardFactionValue3', 0, '>']],
|
||||
['AND', ['rewardFactionId4', $this->typeId], ['rewardFactionValue4', 0, '>']],
|
||||
['AND', ['rewardFactionId5', $this->typeId], ['rewardFactionValue5', 0, '>']]
|
||||
[DB::AND, ['rewardFactionId1', $this->typeId], ['rewardFactionValue1', 0, '>']],
|
||||
[DB::AND, ['rewardFactionId2', $this->typeId], ['rewardFactionValue2', 0, '>']],
|
||||
[DB::AND, ['rewardFactionId3', $this->typeId], ['rewardFactionValue3', 0, '>']],
|
||||
[DB::AND, ['rewardFactionId4', $this->typeId], ['rewardFactionValue4', 0, '>']],
|
||||
[DB::AND, ['rewardFactionId5', $this->typeId], ['rewardFactionValue5', 0, '>']]
|
||||
);
|
||||
$quests = new QuestList($conditions, ['calcTotal' => true]);
|
||||
if (!$quests->error)
|
||||
|
|
|
|||
|
|
@ -81,11 +81,11 @@ class FactionsBaseResponse extends TemplateResponse implements ICache
|
|||
else if (isset($this->category[0]))
|
||||
{
|
||||
if ($this->category[0])
|
||||
$subs = DB::Aowow()->selectCol('SELECT `id` FROM ?_factions WHERE `parentFactionId` = ?d', $this->category[0]);
|
||||
$subs = DB::Aowow()->selectCol('SELECT `id` FROM ::factions WHERE `parentFactionId` = %i', $this->category[0]);
|
||||
else
|
||||
$subs = [0];
|
||||
|
||||
$conditions[] = ['OR', ['parentFactionId', $subs], ['id', $subs]];
|
||||
$conditions[] = [DB::OR, ['parentFactionId', $subs], ['id', $subs]];
|
||||
}
|
||||
|
||||
$data = [];
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ class GotocommentBaseResponse extends TextResponse
|
|||
|
||||
// the reputation-history listview only creates go-to-comment links. So either upvoting replies does not grant reputation, or.... bug.?
|
||||
|
||||
$comment = DB::Aowow()->selectRow('SELECT IFNULL(c2.`id`, c1.`id`) AS "id", IFNULL(c2.`type`, c1.`type`) AS "type", IFNULL(c2.`typeId`, c1.`typeId`) AS "typeId" FROM ?_comments c1 LEFT JOIN ?_comments c2 ON c1.`replyTo` = c2.`id` WHERE c1.`id` = ?d', $this->_get['id']);
|
||||
$comment = DB::Aowow()->selectRow('SELECT IFNULL(c2.`id`, c1.`id`) AS "id", IFNULL(c2.`type`, c1.`type`) AS "type", IFNULL(c2.`typeId`, c1.`typeId`) AS "typeId" FROM ::comments c1 LEFT JOIN ::comments c2 ON c1.`replyTo` = c2.`id` WHERE c1.`id` = %i', $this->_get['id']);
|
||||
if (!$comment)
|
||||
{
|
||||
trigger_error('GotocommentBaseResponse - comment #'.$this->_get['id'].' not found', E_USER_ERROR);
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ class GotoreplyBaseResponse extends TextResponse
|
|||
}
|
||||
|
||||
// type = typeId = 0 AND replyTo <> 0 for replies
|
||||
$reply = DB::Aowow()->selectRow('SELECT c.`id`, r.`id` AS "reply", c.`type`, c.`typeId` FROM ?_comments r JOIN ?_comments c ON r.`replyTo` = c.`id` WHERE r.`id` = ?d', $this->_get['id']);
|
||||
$reply = DB::Aowow()->selectRow('SELECT c.`id`, r.`id` AS "reply", c.`type`, c.`typeId` FROM ::comments r JOIN ::comments c ON r.`replyTo` = c.`id` WHERE r.`id` = %i', $this->_get['id']);
|
||||
if (!$reply)
|
||||
{
|
||||
trigger_error('GotoreplyBaseResponse - reply #'.$this->_get['id'].' not found', E_USER_ERROR);
|
||||
|
|
|
|||
|
|
@ -81,7 +81,7 @@ class GuideChangelogResponse extends TemplateResponse
|
|||
$inp = fn($rev) => User::isInGroup(U_GROUP_STAFF) && false ? ($rev !== null ? '<input name="a" value="'.$rev.'" type="radio"/><input name="b" value="'.$rev.'" type="radio"/><b>' : '<b style="margin-left:38px;">') : '';
|
||||
$now = new DateTime();
|
||||
|
||||
$logEntries = DB::Aowow()->select('SELECT a.`username` AS `name`, gcl.`date`, gcl.`status`, gcl.`msg`, gcl.`rev` FROM ?_guides_changelog gcl JOIN ?_account a ON a.`id` = gcl.`userId` WHERE gcl.`id` = ?d ORDER BY gcl.`date` DESC', $this->_get['id']);
|
||||
$logEntries = DB::Aowow()->selectAssoc('SELECT a.`username` AS `name`, gcl.`date`, gcl.`status`, gcl.`msg`, gcl.`rev` FROM ::guides_changelog gcl JOIN ::account a ON a.`id` = gcl.`userId` WHERE gcl.`id` = %i ORDER BY gcl.`date` DESC', $this->_get['id']);
|
||||
foreach ($logEntries as $log)
|
||||
{
|
||||
if ($log['status'] != GuideMgr::STATUS_NONE)
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@ class GuideEditResponse extends TemplateResponse
|
|||
return;
|
||||
|
||||
$this->typeId = $this->_get['id']; // just to display sensible not-found msg
|
||||
$status = DB::Aowow()->selectCell('SELECT `status` FROM ?_guides WHERE `id` = ?d AND `status` <> ?d { AND `userId` = ?d }', $this->typeId, GuideMgr::STATUS_ARCHIVED, User::isInGroup(U_GROUP_STAFF) ? DBSIMPLE_SKIP : User::$id);
|
||||
$status = DB::Aowow()->selectCell('SELECT `status` FROM ::guides WHERE %if', !User::isInGroup(U_GROUP_STAFF), '`userId` = %i AND', User::$id, '%end `id` = %i AND `status` <> %i', $this->typeId, GuideMgr::STATUS_ARCHIVED);
|
||||
if (!$status && $this->typeId)
|
||||
$this->generateNotFound(Lang::game('guide'), Lang::guide('notFound'));
|
||||
else if (!$this->typeId)
|
||||
|
|
@ -75,7 +75,7 @@ class GuideEditResponse extends TemplateResponse
|
|||
// just so we don't have to access GuideMgr from template
|
||||
$this->isDraft = $status == GuideMgr::STATUS_DRAFT;
|
||||
$this->editStatus = $status;
|
||||
$this->editRev = DB::Aowow()->selectCell('SELECT `rev` FROM ?_articles WHERE `type` = ?d AND `typeId` = ?d ORDER BY `rev` DESC', Type::GUIDE, $this->typeId);
|
||||
$this->editRev = DB::Aowow()->selectCell('SELECT `rev` FROM ::articles WHERE `type` = %i AND `typeId` = %i ORDER BY `rev` DESC', Type::GUIDE, $this->typeId);
|
||||
}
|
||||
|
||||
protected function generate() : void
|
||||
|
|
@ -157,15 +157,15 @@ class GuideEditResponse extends TemplateResponse
|
|||
if ($this->_get['id'] === 0)
|
||||
{
|
||||
$guideData += ['userId' => User::$id];
|
||||
if (!($this->typeId = (int)DB::Aowow()->query('INSERT INTO ?_guides (?#) VALUES (?a)', array_keys($guideData), array_values($guideData))))
|
||||
if (!($this->typeId = (int)DB::Aowow()->qry('INSERT INTO ::guides %v', $guideData)))
|
||||
{
|
||||
trigger_error('GuideEditResponse::saveGuide - failed to save guide to db', E_USER_ERROR);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
// existing guide > :shrug:
|
||||
else if (DB::Aowow()->query('UPDATE ?_guides SET ?a WHERE `id` = ?d', $guideData, $this->typeId))
|
||||
DB::Aowow()->query('INSERT INTO ?_guides_changelog (`id`, `rev`, `date`, `userId`, `msg`) VALUES (?d, ?d, ?d, ?d, ?)', $this->typeId, $this->editRev, time(), User::$id, $this->_post['changelog']);
|
||||
else if (DB::Aowow()->qry('UPDATE ::guides SET %a WHERE `id` = %i', $guideData, $this->typeId))
|
||||
DB::Aowow()->qry('INSERT INTO ::guides_changelog (`id`, `rev`, `date`, `userId`, `msg`) VALUES (%i, %i, %i, %i, %s)', $this->typeId, $this->editRev, time(), User::$id, $this->_post['changelog']);
|
||||
else
|
||||
{
|
||||
trigger_error('GuideEditResponse::saveGuide - failed to update guide in db', E_USER_ERROR);
|
||||
|
|
@ -173,8 +173,8 @@ class GuideEditResponse extends TemplateResponse
|
|||
}
|
||||
|
||||
// insert Article
|
||||
$articleId = DB::Aowow()->query(
|
||||
'INSERT INTO ?_articles (`type`, `typeId`, `locale`, `rev`, `editAccess`, `article`) VALUES (?d, ?d, ?d, ?d, ?d, ?)',
|
||||
$articleId = DB::Aowow()->qry(
|
||||
'INSERT INTO ::articles (`type`, `typeId`, `locale`, `rev`, `editAccess`, `article`) VALUES (%i, %i, %i, %i, %i, %s)',
|
||||
Type::GUIDE,
|
||||
$this->typeId,
|
||||
$this->_post['locale']->value,
|
||||
|
|
@ -186,14 +186,14 @@ class GuideEditResponse extends TemplateResponse
|
|||
if (!is_int($articleId))
|
||||
{
|
||||
if ($this->_get['id'] === 0)
|
||||
DB::Aowow()->query('DELETE FROM ?_guides WHERE `id` = ?d', $this->typeId);
|
||||
DB::Aowow()->qry('DELETE FROM ::guides WHERE `id` = %i', $this->typeId);
|
||||
|
||||
trigger_error('GuideEditResponse::saveGuide - failed to save article to db', E_USER_ERROR);
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($this->_post['submit'] && $this->editStatus != GuideMgr::STATUS_REVIEW)
|
||||
DB::Aowow()->query('INSERT INTO ?_guides_changelog (`id`, `date`, `userId`, `status`) VALUES (?d, ?d, ?d, ?d)', $this->typeId, time(), User::$id, GuideMgr::STATUS_REVIEW);
|
||||
DB::Aowow()->qry('INSERT INTO ::guides_changelog (`id`, `date`, `userId`, `status`) VALUES (%i, %i, %i, %i)', $this->typeId, time(), User::$id, GuideMgr::STATUS_REVIEW);
|
||||
|
||||
$this->editStatus = $guideData['status'];
|
||||
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ class GuideBaseResponse extends TemplateResponse implements ICache
|
|||
$this->typeId = $nameOrId;
|
||||
else if (preg_match(GuideMgr::VALID_URL, $nameOrId))
|
||||
{
|
||||
if ($id = DB::Aowow()->selectCell('SELECT `id` FROM ?_guides WHERE `url` = ?', Util::lower($nameOrId)))
|
||||
if ($id = DB::Aowow()->selectCell('SELECT `id` FROM ::guides WHERE `url` = %s', Util::lower($nameOrId)))
|
||||
{
|
||||
$this->typeId = intVal($id);
|
||||
$this->articleUrl = Util::lower($nameOrId);
|
||||
|
|
@ -215,9 +215,9 @@ class GuideBaseResponse extends TemplateResponse implements ICache
|
|||
return;
|
||||
|
||||
// increment and display views
|
||||
DB::Aowow()->query('UPDATE ?_guides SET `views` = `views` + 1 WHERE `id` = ?d', $pt->typeId);
|
||||
DB::Aowow()->qry('UPDATE ::guides SET `views` = `views` + 1 WHERE `id` = %i', $pt->typeId);
|
||||
|
||||
$nViews = DB::Aowow()->selectCell('SELECT `views` FROM ?_guides WHERE `id` = ?d', $pt->typeId);
|
||||
$nViews = DB::Aowow()->selectCell('SELECT `views` FROM ::guides WHERE `id` = %i', $pt->typeId);
|
||||
|
||||
$infobox->addItem(Lang::guide('views').'[n5='.$nViews.']');
|
||||
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ class GuidePowerResponse extends TextResponse implements ICache
|
|||
|
||||
if (Util::checkNumeric($idOrName, NUM_CAST_INT))
|
||||
$this->typeId = $idOrName;
|
||||
else if ($id = DB::Aowow()->selectCell('SELECT `id` FROM ?_guides WHERE `url` = ?', Util::lower($idOrName)))
|
||||
else if ($id = DB::Aowow()->selectCell('SELECT `id` FROM ::guides WHERE `url` = %s', Util::lower($idOrName)))
|
||||
{
|
||||
$this->typeId = intVal($id);
|
||||
$this->url = Util::lower($idOrName);
|
||||
|
|
|
|||
|
|
@ -29,18 +29,18 @@ class GuideVoteResponse extends TextResponse
|
|||
|
||||
// by id, not own, published
|
||||
$points = $votes = 0;
|
||||
if ($g = DB::Aowow()->selectRow('SELECT `userId`, `cuFlags` FROM ?_guides WHERE `id` = ?d AND (`status` = ?d OR `rev` > 0)', $this->_post['id'], GuideMgr::STATUS_APPROVED))
|
||||
if ($g = DB::Aowow()->selectRow('SELECT `userId`, `cuFlags` FROM ::guides WHERE `id` = %i AND (`status` = %i OR `rev` > 0)', $this->_post['id'], GuideMgr::STATUS_APPROVED))
|
||||
{
|
||||
// apparently you are allowed to vote on your own guide
|
||||
if ($g['cuFlags'] & GUIDE_CU_NO_RATING)
|
||||
$this->generate403();
|
||||
|
||||
if (!$this->_post['rating'])
|
||||
DB::Aowow()->query('DELETE FROM ?_user_ratings WHERE `type` = ?d AND `entry` = ?d AND `userId` = ?d', RATING_GUIDE, $this->_post['id'], User::$id);
|
||||
DB::Aowow()->qry('DELETE FROM ::user_ratings WHERE `type` = %i AND `entry` = %i AND `userId` = %i', RATING_GUIDE, $this->_post['id'], User::$id);
|
||||
else
|
||||
DB::Aowow()->query('REPLACE INTO ?_user_ratings (`type`, `entry`, `userId`, `value`) VALUES (?d, ?d, ?d, ?d)', RATING_GUIDE, $this->_post['id'], User::$id, $this->_post['rating']);
|
||||
DB::Aowow()->qry('REPLACE INTO ::user_ratings (`type`, `entry`, `userId`, `value`) VALUES (%i, %i, %i, %i)', RATING_GUIDE, $this->_post['id'], User::$id, $this->_post['rating']);
|
||||
|
||||
[$points, $votes] = DB::Aowow()->selectRow('SELECT IFNULL(SUM(`value`), 0) AS "0", IFNULL(COUNT(*), 0) AS "1" FROM ?_user_ratings WHERE `type` = ?d AND `entry` = ?d', RATING_GUIDE, $this->_post['id']);
|
||||
[$points, $votes] = DB::Aowow()->selectRow('SELECT IFNULL(SUM(`value`), 0) AS "0", IFNULL(COUNT(*), 0) AS "1" FROM ::user_ratings WHERE `type` = %i AND `entry` = %i', RATING_GUIDE, $this->_post['id']);
|
||||
}
|
||||
|
||||
$this->result = Util::toJSON($votes ? ['rating' => $points / $votes, 'nvotes' => $votes] : ['rating' => 0, 'nvotes' => 0]);
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ class GuidesBaseResponse extends TemplateResponse // implements ICache
|
|||
['locale', Lang::getLocale()->value],
|
||||
['status', GuideMgr::STATUS_ARCHIVED, '!'], // never archived guides
|
||||
[
|
||||
'OR',
|
||||
DB::OR,
|
||||
['status', GuideMgr::STATUS_APPROVED], // currently approved
|
||||
['rev', 0, '>'] // has previously approved revision
|
||||
]
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ class GuildBaseResponse extends TemplateResponse
|
|||
|
||||
// 3 possibilities
|
||||
// 1) already synced to aowow
|
||||
if ($subject = DB::Aowow()->selectRow('SELECT `id`, `realmGUID`, `stub` FROM ?_profiler_guild WHERE `realm` = ?d AND `nameUrl` = ?', $this->realmId, Profiler::urlize($this->subjectName)))
|
||||
if ($subject = DB::Aowow()->selectRow('SELECT `id`, `realmGUID`, `stub` FROM ::profiler_guild WHERE `realm` = %i AND `nameUrl` = %s', $this->realmId, Profiler::urlize($this->subjectName)))
|
||||
{
|
||||
$this->typeId = $subject['id'];
|
||||
|
||||
|
|
@ -57,16 +57,15 @@ class GuildBaseResponse extends TemplateResponse
|
|||
}
|
||||
|
||||
// 2) not yet synced but exists on realm (wont work if we get passed an urlized name, but there is nothing we can do about it)
|
||||
$subjects = DB::Characters($this->realmId)->select('SELECT `guildid` AS "realmGUID", `name` FROM guild WHERE `name` = ?', $this->subjectName);
|
||||
if ($subject = array_filter($subjects ?: [], fn($x) => Util::lower($x['name']) === Util::lower($this->subjectName)))
|
||||
$subjects = DB::Characters($this->realmId)->selectAssoc('SELECT `guildid` AS "realmGUID", `name` FROM guild WHERE `name` = %s', $this->subjectName);
|
||||
if ($subject = array_find($subjects ?: [], fn($x) => Util::lower($x['name']) === Util::lower($this->subjectName)))
|
||||
{
|
||||
$subject = array_pop($subject);
|
||||
$subject['realm'] = $this->realmId;
|
||||
$subject['stub'] = 1;
|
||||
$subject['nameUrl'] = Profiler::urlize($subject['name']);
|
||||
|
||||
// create entry from realm with basic info
|
||||
DB::Aowow()->query('INSERT IGNORE INTO ?_profiler_guild (?#) VALUES (?a)', array_keys($subject), array_values($subject));
|
||||
DB::Aowow()->qry('INSERT IGNORE INTO ::profiler_guild %v', $subject);
|
||||
|
||||
$this->handleIncompleteData(Type::GUILD, $subject['realmGUID']);
|
||||
return;
|
||||
|
|
@ -122,7 +121,7 @@ class GuildBaseResponse extends TemplateResponse
|
|||
// statistic calculations here
|
||||
|
||||
// smuggle the guild ranks into the html
|
||||
if ($ranks = DB::Aowow()->selectCol('SELECT `rank` AS ARRAY_KEY, `name` FROM ?_profiler_guild_rank WHERE `guildId` = ?d', $this->typeId))
|
||||
if ($ranks = DB::Aowow()->selectCol('SELECT `rank` AS ARRAY_KEY, `name` FROM ::profiler_guild_rank WHERE `guildId` = %i', $this->typeId))
|
||||
$this->extraHTML = '<script type="text/javascript">var guild_ranks = '.Util::toJSON($ranks).';</script>';
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -32,12 +32,12 @@ class GuildResyncResponse extends TextResponse
|
|||
if (!$this->assertGET('id'))
|
||||
return;
|
||||
|
||||
if ($guilds = DB::Aowow()->select('SELECT `realm`, `realmGUID` FROM ?_profiler_guild WHERE `id` IN (?a)', $this->_get['id']))
|
||||
if ($guilds = DB::Aowow()->selectAssoc('SELECT `realm`, `realmGUID` FROM ::profiler_guild WHERE `id` IN %in', $this->_get['id']))
|
||||
foreach ($guilds as $g)
|
||||
Profiler::scheduleResync(Type::GUILD, $g['realm'], $g['realmGUID']);
|
||||
|
||||
if ($this->_get['profile'])
|
||||
if ($chars = DB::Aowow()->select('SELECT `realm`, `realmGUID` FROM ?_profiler_profiles WHERE `guild` IN (?a)', $this->_get['id']))
|
||||
if ($chars = DB::Aowow()->selectAssoc('SELECT `realm`, `realmGUID` FROM ::profiler_profiles WHERE `guild` IN %in', $this->_get['id']))
|
||||
foreach ($chars as $c)
|
||||
Profiler::scheduleResync(Type::PROFILE, $c['realm'], $c['realmGUID']);
|
||||
|
||||
|
|
|
|||
|
|
@ -25,18 +25,18 @@ class HomeBaseResponse extends TemplateResponse
|
|||
protected function generate() : void
|
||||
{
|
||||
// set <title> element
|
||||
if ($_ = DB::Aowow()->selectCell('SELECT `title` FROM ?_home_titles WHERE `active` = 1 AND `locale` = ?d ORDER BY RAND()', Lang::getLocale()->value))
|
||||
if ($_ = DB::Aowow()->selectCell('SELECT `title` FROM ::home_titles WHERE `active` = 1 AND `locale` = %i ORDER BY RAND()', Lang::getLocale()->value))
|
||||
$this->homeTitle = Util::jsEscape(Cfg::get('NAME').Lang::main('colon').$_);
|
||||
|
||||
// load oneliner
|
||||
if ($_ = DB::Aowow()->selectRow('SELECT * FROM ?_home_oneliner WHERE `active` = 1 ORDER BY RAND() LIMIT 1'))
|
||||
if ($_ = DB::Aowow()->selectRow('SELECT * FROM ::home_oneliner WHERE `active` = 1 ORDER BY RAND() LIMIT 1'))
|
||||
$this->oneliner = new Markup(new LocString($_, 'text'), [], 'home-oneliner');
|
||||
|
||||
if ($_ = $this->oneliner?->getJsGlobals())
|
||||
$this->extendGlobalData($_);
|
||||
|
||||
// load featuredBox (user web server time)
|
||||
if ($box = DB::Aowow()->selectRow('SELECT * FROM ?_home_featuredbox WHERE ?d BETWEEN `startDate` AND `endDate` ORDER BY `id` DESC', time()))
|
||||
if ($box = DB::Aowow()->selectRow('SELECT * FROM ::home_featuredbox WHERE %i BETWEEN `startDate` AND `endDate` ORDER BY `id` DESC', time()))
|
||||
{
|
||||
// define text constants for all fields (STATIC_URL, HOST_URL, etc.)
|
||||
$box = Util::defStatic($box);
|
||||
|
|
@ -55,9 +55,9 @@ class HomeBaseResponse extends TemplateResponse
|
|||
$this->extendGlobalData($_);
|
||||
|
||||
// load overlay links
|
||||
foreach (DB::Aowow()->select('SELECT * FROM ?_home_featuredbox_overlay WHERE `featureId` = ?d', $box['id']) as $ovl)
|
||||
foreach (DB::Aowow()->selectAssoc('SELECT * FROM ::home_featuredbox_overlay WHERE `featureId` = %i', $box['id']) as $ovl)
|
||||
{
|
||||
$ovl = Util::defStatic($ovl);
|
||||
$ovl = Util::defStatic((array)$ovl);
|
||||
|
||||
$this->featuredBox['overlays'][] = array(
|
||||
'url' => $ovl['url'],
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ class IconGetidfromnameResponse extends TextResponse
|
|||
}
|
||||
|
||||
$this->result = 0;
|
||||
if ($id = DB::Aowow()->selectCell('SELECT `id` FROM ?_icons WHERE `name` = ?', $this->_get['name']))
|
||||
if ($id = DB::Aowow()->selectCell('SELECT `id` FROM ::icons WHERE `name` = %s', $this->_get['name']))
|
||||
$this->result = $id;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -144,7 +144,7 @@ class ItemBaseResponse extends TemplateResponse implements ICache
|
|||
|
||||
// tool
|
||||
if ($tId = $this->subject->getField('totemCategory'))
|
||||
if ($tName = DB::Aowow()->selectRow('SELECT * FROM ?_totemcategory WHERE `id` = ?d', $tId))
|
||||
if ($tName = DB::Aowow()->selectRow('SELECT * FROM ::totemcategory WHERE `id` = %i', $tId))
|
||||
$infobox[] = Lang::item('tool').'[url=?items&filter=cr=91;crs='.$tId.';crv=0]'.Util::localizedString($tName, 'name').'[/url]';
|
||||
|
||||
// extendedCost
|
||||
|
|
@ -396,7 +396,7 @@ class ItemBaseResponse extends TemplateResponse implements ICache
|
|||
}
|
||||
|
||||
// factionchange-equivalent
|
||||
if ($pendant = DB::World()->selectCell('SELECT IF(`horde_id` = ?d, `alliance_id`, -`horde_id`) FROM player_factionchange_items WHERE `alliance_id` = ?d OR `horde_id` = ?d', $this->typeId, $this->typeId, $this->typeId))
|
||||
if ($pendant = DB::World()->selectCell('SELECT IF(`horde_id` = %i, `alliance_id`, -`horde_id`) FROM player_factionchange_items WHERE `alliance_id` = %i OR `horde_id` = %i', $this->typeId, $this->typeId, $this->typeId))
|
||||
{
|
||||
$altItem = new ItemList(array(['id', abs($pendant)]));
|
||||
if (!$altItem->error)
|
||||
|
|
@ -420,7 +420,7 @@ class ItemBaseResponse extends TemplateResponse implements ICache
|
|||
$this->lvTabs = new Tabs(['parent' => "\$\$WH.ge('tabs-generic')"], 'tabsRelated', true);
|
||||
|
||||
// tab: createdBy (perfect item specific)
|
||||
if ($perfItem = DB::World()->select('SELECT *, `spellId` AS ARRAY_KEY FROM skill_perfect_item_template WHERE `perfectItemType` = ?d', $this->typeId))
|
||||
if ($perfItem = DB::World()->selectAssoc('SELECT *, `spellId` AS ARRAY_KEY FROM skill_perfect_item_template WHERE `perfectItemType` = %i', $this->typeId))
|
||||
{
|
||||
$perfSpells = new SpellList(array(['id', array_column($perfItem, 'spellId')]));
|
||||
if (!$perfSpells->error)
|
||||
|
|
@ -630,7 +630,7 @@ class ItemBaseResponse extends TemplateResponse implements ICache
|
|||
|
||||
// tab: reagent for
|
||||
$conditions = array(
|
||||
'OR',
|
||||
DB::OR,
|
||||
['reagent1', $this->typeId], ['reagent2', $this->typeId], ['reagent3', $this->typeId], ['reagent4', $this->typeId],
|
||||
['reagent5', $this->typeId], ['reagent6', $this->typeId], ['reagent7', $this->typeId], ['reagent8', $this->typeId]
|
||||
);
|
||||
|
|
@ -650,9 +650,9 @@ class ItemBaseResponse extends TemplateResponse implements ICache
|
|||
|
||||
// tab: unlocks (object or item)
|
||||
$lockIds = DB::Aowow()->selectCol(
|
||||
'SELECT `id` FROM ?_lock WHERE (`type1` = ?d AND `properties1` = ?d) OR
|
||||
(`type2` = ?d AND `properties2` = ?d) OR (`type3` = ?d AND `properties3` = ?d) OR
|
||||
(`type4` = ?d AND `properties4` = ?d) OR (`type5` = ?d AND `properties5` = ?d)',
|
||||
'SELECT `id` FROM ::lock WHERE (`type1` = %i AND `properties1` = %i) OR
|
||||
(`type2` = %i AND `properties2` = %i) OR (`type3` = %i AND `properties3` = %i) OR
|
||||
(`type4` = %i AND `properties4` = %i) OR (`type5` = %i AND `properties5` = %i)',
|
||||
LOCK_TYPE_ITEM, $this->typeId, LOCK_TYPE_ITEM, $this->typeId,
|
||||
LOCK_TYPE_ITEM, $this->typeId, LOCK_TYPE_ITEM, $this->typeId,
|
||||
LOCK_TYPE_ITEM, $this->typeId
|
||||
|
|
@ -704,7 +704,7 @@ class ItemBaseResponse extends TemplateResponse implements ICache
|
|||
|
||||
// tab: objective of (quest)
|
||||
$conditions = array(
|
||||
'OR',
|
||||
DB::OR,
|
||||
['reqItemId1', $this->typeId], ['reqItemId2', $this->typeId], ['reqItemId3', $this->typeId],
|
||||
['reqItemId4', $this->typeId], ['reqItemId5', $this->typeId], ['reqItemId6', $this->typeId]
|
||||
);
|
||||
|
|
@ -722,7 +722,7 @@ class ItemBaseResponse extends TemplateResponse implements ICache
|
|||
|
||||
// tab: provided for (quest)
|
||||
$conditions = array(
|
||||
'OR', ['sourceItemId', $this->typeId],
|
||||
DB::OR, ['sourceItemId', $this->typeId],
|
||||
['reqSourceItemId1', $this->typeId], ['reqSourceItemId2', $this->typeId],
|
||||
['reqSourceItemId3', $this->typeId], ['reqSourceItemId4', $this->typeId]
|
||||
);
|
||||
|
|
@ -838,8 +838,8 @@ class ItemBaseResponse extends TemplateResponse implements ICache
|
|||
if (!$n && !is_null(ItemListFilter::getCriteriaIndex(158, $this->typeId)))
|
||||
$n = '?items&filter=cr=158;crs='.$this->typeId.';crv=0';
|
||||
|
||||
$xCosts = DB::Aowow()->selectCol('SELECT `id` FROM ?_itemextendedcost WHERE '.$w);
|
||||
$boughtBy = $xCosts ? DB::World()->selectCol('SELECT `item` FROM npc_vendor WHERE `extendedCost` IN (?a) UNION SELECT `item` FROM game_event_npc_vendor WHERE `extendedCost` IN (?a)', $xCosts, $xCosts) : null;
|
||||
$xCosts = DB::Aowow()->selectCol('SELECT `id` FROM ::itemextendedcost WHERE '.$w);
|
||||
$boughtBy = $xCosts ? DB::World()->selectCol('SELECT `item` FROM npc_vendor WHERE `extendedCost` IN %in UNION SELECT `item` FROM game_event_npc_vendor WHERE `extendedCost` IN %in', $xCosts, $xCosts) : null;
|
||||
if ($boughtBy)
|
||||
{
|
||||
$boughtBy = new ItemList(array(['id', $boughtBy]));
|
||||
|
|
@ -910,10 +910,10 @@ class ItemBaseResponse extends TemplateResponse implements ICache
|
|||
$conditions = array(
|
||||
['id', $this->typeId, '!'],
|
||||
[
|
||||
'OR',
|
||||
DB::OR,
|
||||
['name_loc'.Lang::getLocale()->value, $this->subject->getField('name', true)],
|
||||
[
|
||||
'AND',
|
||||
DB::AND,
|
||||
['class', $_class],
|
||||
['subClass', $_subClass],
|
||||
['slot', $_slot],
|
||||
|
|
@ -926,7 +926,7 @@ class ItemBaseResponse extends TemplateResponse implements ICache
|
|||
);
|
||||
|
||||
if ($_ = $this->subject->getField('itemset'))
|
||||
$conditions[1][] = ['AND', ['slot', $_slot], ['itemset', $_]];
|
||||
$conditions[1][] = [DB::AND, ['slot', $_slot], ['itemset', $_]];
|
||||
|
||||
$saItems = new ItemList($conditions);
|
||||
if (!$saItems->error)
|
||||
|
|
@ -972,7 +972,7 @@ class ItemBaseResponse extends TemplateResponse implements ICache
|
|||
$useSpells[] = $this->subject->getField('spellId'.$i);
|
||||
}
|
||||
if ($useSpells)
|
||||
if ($_ = DB::Aowow()->selectCol('SELECT `category` FROM ?_spell WHERE `id` IN (?a) AND `recoveryCategory` > 0', $useSpells))
|
||||
if ($_ = DB::Aowow()->selectCol('SELECT `category` FROM ::spell WHERE `id` IN %in AND `recoveryCategory` > 0', $useSpells))
|
||||
$cdCats += $_;
|
||||
|
||||
if ($cdCats)
|
||||
|
|
@ -980,7 +980,7 @@ class ItemBaseResponse extends TemplateResponse implements ICache
|
|||
$conditions = array(
|
||||
['id', $this->typeId, '!'],
|
||||
[
|
||||
'OR',
|
||||
DB::OR,
|
||||
['spellCategory1', $cdCats],
|
||||
['spellCategory2', $cdCats],
|
||||
['spellCategory3', $cdCats],
|
||||
|
|
@ -989,7 +989,7 @@ class ItemBaseResponse extends TemplateResponse implements ICache
|
|||
]
|
||||
);
|
||||
|
||||
if ($spellsByCat = DB::Aowow()->selectCol('SELECT `id` FROM ?_spell WHERE `category` IN (?a)', $cdCats))
|
||||
if ($spellsByCat = DB::Aowow()->selectCol('SELECT `id` FROM ::spell WHERE `category` IN %in', $cdCats))
|
||||
for ($i = 1; $i < 6; $i++)
|
||||
$conditions[1][] = ['spellId'.$i, $spellsByCat];
|
||||
|
||||
|
|
@ -1014,7 +1014,7 @@ class ItemBaseResponse extends TemplateResponse implements ICache
|
|||
if ($this->subject->getField('soundOverrideSubclass') > 0)
|
||||
$scm = (1 << $this->subject->getField('soundOverrideSubclass'));
|
||||
|
||||
$soundIds = DB::Aowow()->selectCol('SELECT `soundId` FROM ?_items_sounds WHERE `subClassMask` & ?d', $scm);
|
||||
$soundIds = DB::Aowow()->selectCol('SELECT `soundId` FROM ::items_sounds WHERE `subClassMask` & %i', $scm);
|
||||
}
|
||||
|
||||
$fields = ['pickUpSoundId', 'dropDownSoundId', 'sheatheSoundId', 'unsheatheSoundId'];
|
||||
|
|
@ -1024,7 +1024,7 @@ class ItemBaseResponse extends TemplateResponse implements ICache
|
|||
|
||||
if ($x = $this->subject->getField('spellVisualId'))
|
||||
{
|
||||
if ($spellSounds = DB::Aowow()->selectRow('SELECT * FROM ?_spell_sounds WHERE `id` = ?d', $x))
|
||||
if ($spellSounds = DB::Aowow()->selectRow('SELECT * FROM ::spell_sounds WHERE `id` = %i', $x))
|
||||
{
|
||||
array_shift($spellSounds); // bye 'id'-field
|
||||
foreach ($spellSounds as $ss)
|
||||
|
|
|
|||
|
|
@ -148,10 +148,10 @@ class ItemXmlResponse extends TextResponse implements ICache
|
|||
|
||||
// reagents
|
||||
$cnd = array(
|
||||
'OR',
|
||||
['AND', ['effect1CreateItemId', $this->typeId], ['OR', ['effect1Id', SpellList::EFFECTS_ITEM_CREATE], ['effect1AuraId', SpellList::AURAS_ITEM_CREATE]]],
|
||||
['AND', ['effect2CreateItemId', $this->typeId], ['OR', ['effect2Id', SpellList::EFFECTS_ITEM_CREATE], ['effect2AuraId', SpellList::AURAS_ITEM_CREATE]]],
|
||||
['AND', ['effect3CreateItemId', $this->typeId], ['OR', ['effect3Id', SpellList::EFFECTS_ITEM_CREATE], ['effect3AuraId', SpellList::AURAS_ITEM_CREATE]]],
|
||||
DB::OR,
|
||||
[DB::AND, ['effect1CreateItemId', $this->typeId], [DB::OR, ['effect1Id', SpellList::EFFECTS_ITEM_CREATE], ['effect1AuraId', SpellList::AURAS_ITEM_CREATE]]],
|
||||
[DB::AND, ['effect2CreateItemId', $this->typeId], [DB::OR, ['effect2Id', SpellList::EFFECTS_ITEM_CREATE], ['effect2AuraId', SpellList::AURAS_ITEM_CREATE]]],
|
||||
[DB::AND, ['effect3CreateItemId', $this->typeId], [DB::OR, ['effect3Id', SpellList::EFFECTS_ITEM_CREATE], ['effect3AuraId', SpellList::AURAS_ITEM_CREATE]]],
|
||||
);
|
||||
|
||||
$spellSource = new SpellList($cnd);
|
||||
|
|
|
|||
|
|
@ -289,7 +289,7 @@ class ItemsBaseResponse extends TemplateResponse implements ICache
|
|||
case ItemListFilter::GROUP_BY_LEVEL: // itemlevel: first, try to find 10 level steps within range (if given) as tabs
|
||||
// ohkayy, maybe i need to rethink $this
|
||||
$this->filterOpts = $this->filter->extraOpts;
|
||||
$this->filterOpts['is']['o'] = [null]; // remove 'order by' from ?_item_stats
|
||||
$this->filterOpts['is']['o'] = [null]; // remove 'order by' from ::item_stats
|
||||
$extraOpts = array_merge($this->filterOpts, ['i' => ['g' => ['itemlevel'], 'o' => ['itemlevel DESC']]]);
|
||||
|
||||
$levelRef = new ItemList(array_merge($conditions, [10]), ['extraOpts' => $extraOpts]);
|
||||
|
|
|
|||
|
|
@ -63,13 +63,13 @@ class MailBaseResponse extends TemplateResponse implements ICache
|
|||
// sender + delay
|
||||
if ($this->typeId < 0) // def. achievement
|
||||
{
|
||||
if ($npcId = DB::World()->selectCell('SELECT `Sender` FROM achievement_reward WHERE `ID` = ?d', -$this->typeId))
|
||||
if ($npcId = DB::World()->selectCell('SELECT `Sender` FROM achievement_reward WHERE `ID` = %i', -$this->typeId))
|
||||
{
|
||||
$infobox[] = Lang::mail('sender', ['[npc='.$npcId.']']);
|
||||
$this->extendGlobalIds(Type::NPC, $npcId);
|
||||
}
|
||||
}
|
||||
else if ($mlr = DB::World()->selectRow('SELECT * FROM mail_level_reward WHERE `mailTemplateId` = ?d', $this->typeId)) // level rewards
|
||||
else if ($mlr = DB::World()->selectRow('SELECT * FROM mail_level_reward WHERE `mailTemplateId` = %i', $this->typeId)) // level rewards
|
||||
{
|
||||
if ($mlr['level'])
|
||||
$infobox[] = Lang::game('level').Lang::main('colon').$mlr['level'];
|
||||
|
|
@ -87,14 +87,14 @@ class MailBaseResponse extends TemplateResponse implements ICache
|
|||
}
|
||||
else // achievement or quest
|
||||
{
|
||||
if ($q = DB::Aowow()->selectRow('SELECT `id`, `rewardMailDelay` FROM ?_quests WHERE `rewardMailTemplateId` = ?d', $this->typeId))
|
||||
if ($q = DB::Aowow()->selectRow('SELECT `id`, `rewardMailDelay` FROM ::quests WHERE `rewardMailTemplateId` = %i', $this->typeId))
|
||||
{
|
||||
if ($npcId= DB::World()->selectCell('SELECT `RewardMailSenderEntry` FROM quest_mail_sender WHERE `QuestId` = ?d', $q['id']))
|
||||
if ($npcId= DB::World()->selectCell('SELECT `RewardMailSenderEntry` FROM quest_mail_sender WHERE `QuestId` = %i', $q['id']))
|
||||
{
|
||||
$infobox[] = Lang::mail('sender', ['[npc='.$npcId.']']);
|
||||
$this->extendGlobalIds(Type::NPC, $npcId);
|
||||
}
|
||||
else if ($npcId = DB::Aowow()->selectCell('SELECT `typeId` FROM ?_quests_startend WHERE `questId` = ?d AND `type` = ?d AND `method` & ?d', $q['id'], Type::NPC, 0x2))
|
||||
else if ($npcId = DB::Aowow()->selectCell('SELECT `typeId` FROM ::quests_startend WHERE `questId` = %i AND `type` = %i AND `method` & %i', $q['id'], Type::NPC, 0x2))
|
||||
{
|
||||
$infobox[] = Lang::mail('sender', ['[npc='.$npcId.']']);
|
||||
$this->extendGlobalIds(Type::NPC, $npcId);
|
||||
|
|
@ -103,7 +103,7 @@ class MailBaseResponse extends TemplateResponse implements ICache
|
|||
if ($q['rewardMailDelay'] > 0)
|
||||
$infobox[] = Lang::mail('delay', [DateTime::formatTimeElapsed($q['rewardMailDelay'] * 1000)]);
|
||||
}
|
||||
else if ($npcId = DB::World()->selectCell('SELECT `Sender` FROM achievement_reward WHERE `MailTemplateId` = ?d', $this->typeId))
|
||||
else if ($npcId = DB::World()->selectCell('SELECT `Sender` FROM achievement_reward WHERE `MailTemplateId` = %i', $this->typeId))
|
||||
{
|
||||
$infobox[] = Lang::mail('sender', ['[npc='.$npcId.']']);
|
||||
$this->extendGlobalIds(Type::NPC, $npcId);
|
||||
|
|
@ -151,7 +151,7 @@ class MailBaseResponse extends TemplateResponse implements ICache
|
|||
}
|
||||
|
||||
if ($this->typeId < 0 || // used by: achievement
|
||||
($acvId = DB::World()->selectCell('SELECT `ID` FROM achievement_reward WHERE `MailTemplateId` = ?d', $this->typeId)))
|
||||
($acvId = DB::World()->selectCell('SELECT `ID` FROM achievement_reward WHERE `MailTemplateId` = %i', $this->typeId)))
|
||||
{
|
||||
$ubAchievements = new AchievementList(array(['id', $this->typeId < 0 ? -$this->typeId : $acvId]));
|
||||
if (!$ubAchievements->error)
|
||||
|
|
|
|||
|
|
@ -68,8 +68,8 @@ class MostcommentsBaseResponse extends TemplateResponse
|
|||
foreach (Type::getClassesFor() as $type => $classStr)
|
||||
{
|
||||
$comments = DB::Aowow()->selectCol(
|
||||
'SELECT `typeId` AS ARRAY_KEY, COUNT(1) FROM ?_comments
|
||||
WHERE `replyTo` = 0 AND (`flags` & ?d) = 0 AND `type`= ?d AND `date` > (UNIX_TIMESTAMP() - ?d)
|
||||
'SELECT `typeId` AS ARRAY_KEY, COUNT(1) FROM ::comments
|
||||
WHERE `replyTo` = 0 AND (`flags` & %i) = 0 AND `type`= %i AND `date` > (UNIX_TIMESTAMP() - %i)
|
||||
GROUP BY `type`, `typeId`
|
||||
LIMIT 100',
|
||||
CC_FLAG_DELETED,
|
||||
|
|
|
|||
|
|
@ -27,8 +27,8 @@ class MostcommentsRssResponse extends TextResponse
|
|||
foreach (Type::getClassesFor() as $type => $classStr)
|
||||
{
|
||||
$comments = DB::Aowow()->selectCol(
|
||||
'SELECT `typeId` AS ARRAY_KEY, COUNT(1) FROM ?_comments
|
||||
WHERE `replyTo` = 0 AND (`flags` & ?d) = 0 AND `type`= ?d AND `date` > (UNIX_TIMESTAMP() - ?d)
|
||||
'SELECT `typeId` AS ARRAY_KEY, COUNT(1) FROM ::comments
|
||||
WHERE `replyTo` = 0 AND (`flags` & %i) = 0 AND `type`= %i AND `date` > (UNIX_TIMESTAMP() - %i)
|
||||
GROUP BY `type`, `typeId`
|
||||
LIMIT 100',
|
||||
CC_FLAG_DELETED,
|
||||
|
|
|
|||
|
|
@ -90,7 +90,7 @@ class NpcBaseResponse extends TemplateResponse implements ICache
|
|||
$this->altNPCs = new CreatureList(array(['id', array_keys($_altIds)]));
|
||||
}
|
||||
|
||||
if ($_ = DB::World()->selectCol('SELECT DISTINCT `entry` FROM vehicle_template_accessory WHERE `accessory_entry` = ?d', $this->typeId))
|
||||
if ($_ = DB::World()->selectCol('SELECT DISTINCT `entry` FROM vehicle_template_accessory WHERE `accessory_entry` = %i', $this->typeId))
|
||||
{
|
||||
$vehicles = new CreatureList(array(['id', $_]));
|
||||
foreach ($vehicles->iterate() as $id => $__)
|
||||
|
|
@ -103,9 +103,9 @@ class NpcBaseResponse extends TemplateResponse implements ICache
|
|||
/**********************/
|
||||
|
||||
$mapType = 0;
|
||||
if ($maps = DB::Aowow()->selectCell('SELECT IF(COUNT(DISTINCT `areaId`) > 1, 0, `areaId`) FROM ?_spawns WHERE `type` = ?d AND `typeId` = ?d', Type::NPC, $this->typeId))
|
||||
if ($maps = DB::Aowow()->selectCell('SELECT IF(COUNT(DISTINCT `areaId`) > 1, 0, `areaId`) FROM ::spawns WHERE `type` = %i AND `typeId` = %i', Type::NPC, $this->typeId))
|
||||
{
|
||||
$mapType = match ((int)DB::Aowow()->selectCell('SELECT `type` FROM ?_zones WHERE `id` = ?d', $maps[0]))
|
||||
$mapType = match (DB::Aowow()->selectCell('SELECT `type` FROM ::zones WHERE `id` = %i', $maps))
|
||||
{
|
||||
// MAP_TYPE_DUNGEON,
|
||||
MAP_TYPE_DUNGEON_HC => 1,
|
||||
|
|
@ -116,13 +116,13 @@ class NpcBaseResponse extends TemplateResponse implements ICache
|
|||
};
|
||||
}
|
||||
// npc is difficulty dummy: get max difficulty from parent npc
|
||||
if ($this->placeholder && ($mt = DB::Aowow()->selectCell('SELECT IF(`difficultyEntry1` = ?d, 1, 2) FROM ?_creature WHERE `difficultyEntry1` = ?d OR `difficultyEntry2` = ?d OR `difficultyEntry3` = ?d', $this->typeId, $this->typeId, $this->typeId, $this->typeId)))
|
||||
if ($this->placeholder && ($mt = DB::Aowow()->selectCell('SELECT IF(`difficultyEntry1` = %i, 1, 2) FROM ::creature WHERE `difficultyEntry1` = %i OR `difficultyEntry2` = %i OR `difficultyEntry3` = %i', $this->typeId, $this->typeId, $this->typeId, $this->typeId)))
|
||||
$mapType = max($mapType, $mt);
|
||||
// npc has difficulty dummys: 2+ dummies -> definitely raid (10/25 + hc); 1 dummy -> may be heroic (used here), but may also be 10/25-raid
|
||||
if ($_altIds)
|
||||
$mapType = max($mapType, count($_altIds) > 1 ? 2 : 1);
|
||||
// for event encounters a single npc may be reused over multiple difficulties but have different chests assigned
|
||||
if ($d = DB::Aowow()->selectCell('SELECT MAX(`difficulty`) FROM ?_loot_link WHERE `npcId` IN (?a)', array_merge($_altIds, [$this->typeId])))
|
||||
if ($d = DB::Aowow()->selectCell('SELECT MAX(`difficulty`) FROM ::loot_link WHERE `npcId` IN %in', array_merge($_altIds, [$this->typeId])))
|
||||
$mapType = max($mapType, $d > 2 ? 2 : 1);
|
||||
|
||||
|
||||
|
|
@ -133,7 +133,7 @@ class NpcBaseResponse extends TemplateResponse implements ICache
|
|||
$infobox = Lang::getInfoBoxForFlags($this->subject->getField('cuFlags'));
|
||||
|
||||
// Event (ignore events, where the object only gets removed)
|
||||
if ($_ = DB::World()->selectCol('SELECT DISTINCT ge.`eventEntry` FROM game_event ge, game_event_creature gec, creature c WHERE ge.`eventEntry` = gec.`eventEntry` AND c.`guid` = gec.`guid` AND c.`id` = ?d', $this->typeId))
|
||||
if ($_ = DB::World()->selectCol('SELECT DISTINCT ge.`eventEntry` FROM game_event ge, game_event_creature gec, creature c WHERE ge.`eventEntry` = gec.`eventEntry` AND c.`guid` = gec.`guid` AND c.`id` = %i', $this->typeId))
|
||||
{
|
||||
$this->extendGlobalIds(Type::WORLDEVENT, ...$_);
|
||||
$ev = [];
|
||||
|
|
@ -202,7 +202,7 @@ class NpcBaseResponse extends TemplateResponse implements ICache
|
|||
|
||||
if (User::isInGroup(U_GROUP_EMPLOYEE))
|
||||
{
|
||||
$spawnData = DB::Aowow()->select('SELECT `guid` AS "0", `ScriptName` AS "1", `StringId` AS "2" FROM ?_spawns WHERE `type` = ?d AND `typeId` = ?d AND `ScriptName` IS NOT NULL ORDER BY `guid` ASC', Type::NPC, $this->typeId);
|
||||
$spawnData = DB::Aowow()->selectAssoc('SELECT `guid` AS "0", `ScriptName` AS "1", `StringId` AS "2" FROM ::spawns WHERE `type` = %i AND `typeId` = %i AND `ScriptName` IS NOT NULL ORDER BY `guid` ASC', Type::NPC, $this->typeId);
|
||||
|
||||
// AI
|
||||
$scripts = null;
|
||||
|
|
@ -318,7 +318,7 @@ class NpcBaseResponse extends TemplateResponse implements ICache
|
|||
if (!$sai->prepare()) // no smartAI found .. check per guid
|
||||
{
|
||||
// at least one of many
|
||||
$guids = DB::World()->selectCol('SELECT `guid` FROM creature WHERE `id` = ?d', $this->typeId);
|
||||
$guids = DB::World()->selectCol('SELECT `guid` FROM creature WHERE `id` = %i', $this->typeId);
|
||||
while ($_ = array_pop($guids))
|
||||
{
|
||||
$sai = new SmartAI(SmartAI::SRC_TYPE_CREATURE, -$_, ['baseEntry' => $this->typeId, 'title' => ' [small](for GUID: '.$_.')[/small]']);
|
||||
|
|
@ -359,7 +359,7 @@ class NpcBaseResponse extends TemplateResponse implements ICache
|
|||
$tplSpells = [];
|
||||
$genSpells = [];
|
||||
$spellClick = [];
|
||||
$conditions = ['OR'];
|
||||
$conditions = [DB::OR];
|
||||
|
||||
for ($i = 1; $i < 9; $i++)
|
||||
if ($_ = $this->subject->getField('spell'.$i))
|
||||
|
|
@ -371,7 +371,7 @@ class NpcBaseResponse extends TemplateResponse implements ICache
|
|||
if ($smartSpells = SmartAI::getSpellCastsForOwner($this->typeId, SmartAI::SRC_TYPE_CREATURE))
|
||||
$genSpells = $smartSpells;
|
||||
|
||||
if ($auras = DB::World()->selectCell('SELECT `auras` FROM creature_template_addon WHERE `entry` = ?d', $this->typeId))
|
||||
if ($auras = DB::World()->selectCell('SELECT `auras` FROM creature_template_addon WHERE `entry` = %i', $this->typeId))
|
||||
{
|
||||
$auras = preg_replace('/[^\d ]/', ' ', $auras); // remove erroneous chars from string
|
||||
$genSpells = array_merge($genSpells, array_filter(explode(' ', $auras)));
|
||||
|
|
@ -380,7 +380,7 @@ class NpcBaseResponse extends TemplateResponse implements ICache
|
|||
if ($genSpells)
|
||||
$conditions[] = ['id', $genSpells];
|
||||
|
||||
if ($spellClick = DB::World()->select('SELECT `spell_id` AS ARRAY_KEY, `cast_flags` AS "0", `user_type` AS "1" FROM npc_spellclick_spells WHERE `npc_entry` = ?d', $this->typeId))
|
||||
if ($spellClick = DB::World()->selectAssoc('SELECT `spell_id` AS ARRAY_KEY, `cast_flags` AS "0", `user_type` AS "1" FROM npc_spellclick_spells WHERE `npc_entry` = %i', $this->typeId))
|
||||
{
|
||||
$genSpells = array_merge($genSpells, array_keys($spellClick));
|
||||
$conditions[] = ['id', array_keys($spellClick)];
|
||||
|
|
@ -401,13 +401,13 @@ class NpcBaseResponse extends TemplateResponse implements ICache
|
|||
break;
|
||||
}
|
||||
$conditions[] = [
|
||||
'AND',
|
||||
DB::AND,
|
||||
['s.typeCat', -3],
|
||||
[
|
||||
'OR',
|
||||
DB::OR,
|
||||
['skillLine1', $skill],
|
||||
['AND', ['skillLine1', 0, '>'], ['skillLine2OrMask', $skill]],
|
||||
['AND', ['skillLine1', -1], ['skillLine2OrMask', $mask, '&']]
|
||||
[DB::AND, ['skillLine1', 0, '>'], ['skillLine2OrMask', $skill]],
|
||||
[DB::AND, ['skillLine1', -1], ['skillLine2OrMask', $mask, '&']]
|
||||
]
|
||||
];
|
||||
}
|
||||
|
|
@ -458,10 +458,10 @@ class NpcBaseResponse extends TemplateResponse implements ICache
|
|||
|
||||
// tab: summoned by [spell]
|
||||
$conditions = array(
|
||||
'OR',
|
||||
['AND', ['effect1Id', [SPELL_EFFECT_SUMMON, SPELL_EFFECT_SUMMON_PET, SPELL_EFFECT_SUMMON_DEMON]], ['effect1MiscValue', $this->typeId]],
|
||||
['AND', ['effect2Id', [SPELL_EFFECT_SUMMON, SPELL_EFFECT_SUMMON_PET, SPELL_EFFECT_SUMMON_DEMON]], ['effect2MiscValue', $this->typeId]],
|
||||
['AND', ['effect3Id', [SPELL_EFFECT_SUMMON, SPELL_EFFECT_SUMMON_PET, SPELL_EFFECT_SUMMON_DEMON]], ['effect3MiscValue', $this->typeId]]
|
||||
DB::OR,
|
||||
[DB::AND, ['effect1Id', [SPELL_EFFECT_SUMMON, SPELL_EFFECT_SUMMON_PET, SPELL_EFFECT_SUMMON_DEMON]], ['effect1MiscValue', $this->typeId]],
|
||||
[DB::AND, ['effect2Id', [SPELL_EFFECT_SUMMON, SPELL_EFFECT_SUMMON_PET, SPELL_EFFECT_SUMMON_DEMON]], ['effect2MiscValue', $this->typeId]],
|
||||
[DB::AND, ['effect3Id', [SPELL_EFFECT_SUMMON, SPELL_EFFECT_SUMMON_PET, SPELL_EFFECT_SUMMON_DEMON]], ['effect3MiscValue', $this->typeId]]
|
||||
);
|
||||
|
||||
$sbSpell = new SpellList($conditions);
|
||||
|
|
@ -518,9 +518,9 @@ class NpcBaseResponse extends TemplateResponse implements ICache
|
|||
'SELECT ts.`SpellId` AS ARRAY_KEY, ts.`MoneyCost` AS "cost", ts.`ReqSkillLine` AS "reqSkillId", ts.`ReqSkillRank` AS "reqSkillValue", ts.`ReqLevel` AS "reqLevel", ts.`ReqAbility1` AS "reqSpellId1", ts.`reqAbility2` AS "reqSpellId2"
|
||||
FROM trainer_spell ts
|
||||
JOIN creature_default_trainer cdt ON cdt.`TrainerId` = ts.`TrainerId`
|
||||
WHERE cdt.`Creatureid` = ?d';
|
||||
WHERE cdt.`Creatureid` = %i';
|
||||
|
||||
if ($tSpells = DB::World()->select($teachQuery, $this->typeId))
|
||||
if ($tSpells = DB::World()->selectAssoc($teachQuery, $this->typeId))
|
||||
{
|
||||
$teaches = new SpellList(array(['id', array_keys($tSpells)]));
|
||||
if (!$teaches->error)
|
||||
|
|
@ -573,9 +573,9 @@ class NpcBaseResponse extends TemplateResponse implements ICache
|
|||
|
||||
// tab: sells
|
||||
if ($sells = DB::World()->selectCol(
|
||||
'SELECT nv.`item` FROM npc_vendor nv WHERE nv.`entry` = ?d UNION
|
||||
SELECT nv1.`item` FROM npc_vendor nv1 JOIN npc_vendor nv2 ON -nv1.`entry` = nv2.`item` WHERE nv2.`entry` = ?d UNION
|
||||
SELECT genv.`item` FROM game_event_npc_vendor genv JOIN creature c ON genv.`guid` = c.`guid` WHERE c.`id` = ?d',
|
||||
'SELECT nv.`item` FROM npc_vendor nv WHERE nv.`entry` = %i UNION
|
||||
SELECT nv1.`item` FROM npc_vendor nv1 JOIN npc_vendor nv2 ON -nv1.`entry` = nv2.`item` WHERE nv2.`entry` = %i UNION
|
||||
SELECT genv.`item` FROM game_event_npc_vendor genv JOIN creature c ON genv.`guid` = c.`guid` WHERE c.`id` = %i',
|
||||
$this->typeId, $this->typeId, $this->typeId)
|
||||
)
|
||||
{
|
||||
|
|
@ -650,7 +650,7 @@ class NpcBaseResponse extends TemplateResponse implements ICache
|
|||
return 4; // generic case
|
||||
};
|
||||
|
||||
foreach (DB::Aowow()->select('SELECT l.`difficulty` AS ARRAY_KEY, o.`id`, o.`lootId`, o.`name_loc0`, o.`name_loc2`, o.`name_loc3`, o.`name_loc4`, o.`name_loc6`, o.`name_loc8` FROM ?_loot_link l JOIN ?_objects o ON o.`id` = l.`objectId` WHERE l.`npcId` = ?d ORDER BY `difficulty` ASC', $this->typeId) as $difficulty => $lgo)
|
||||
foreach (DB::Aowow()->selectAssoc('SELECT l.`difficulty` AS ARRAY_KEY, o.`id`, o.`lootId`, o.`name_loc0`, o.`name_loc2`, o.`name_loc3`, o.`name_loc4`, o.`name_loc6`, o.`name_loc8` FROM ::loot_link l JOIN ::objects o ON o.`id` = l.`objectId` WHERE l.`npcId` = %i ORDER BY `difficulty` ASC', $this->typeId) as $difficulty => $lgo)
|
||||
{
|
||||
$sourceFor[1][1][$getBit($mapType, $difficulty)] = $lgo['lootId'];
|
||||
$sourceFor[1][5] = $sourceFor[1][5] ?: '$$WH.sprintf(LANG.lvnote_npcobjectsource, '.$lgo['id'].', "'.Util::localizedString($lgo, 'name').'")';
|
||||
|
|
@ -673,7 +673,7 @@ class NpcBaseResponse extends TemplateResponse implements ICache
|
|||
|
||||
foreach ($this->altNPCs->iterate() as $id => $__)
|
||||
{
|
||||
foreach (DB::Aowow()->select('SELECT l.`difficulty` AS ARRAY_KEY, o.`id`, o.`lootId`, o.`name_loc0`, o.`name_loc2`, o.`name_loc3`, o.`name_loc4`, o.`name_loc6`, o.`name_loc8` FROM ?_loot_link l JOIN ?_objects o ON o.`id` = l.`objectId` WHERE l.`npcId` = ?d ORDER BY `difficulty` ASC', $id) as $difficulty => $lgo)
|
||||
foreach (DB::Aowow()->selectAssoc('SELECT l.`difficulty` AS ARRAY_KEY, o.`id`, o.`lootId`, o.`name_loc0`, o.`name_loc2`, o.`name_loc3`, o.`name_loc4`, o.`name_loc6`, o.`name_loc8` FROM ::loot_link l JOIN ::objects o ON o.`id` = l.`objectId` WHERE l.`npcId` = %i ORDER BY `difficulty` ASC', $id) as $difficulty => $lgo)
|
||||
{
|
||||
$sourceFor[1][1][$getBit($mapType, $difficulty)] = $lgo['lootId'];
|
||||
$sourceFor[1][5] = $sourceFor[1][5] ?: '$$WH.sprintf(LANG.lvnote_npcobjectsource, '.$lgo['id'].', "'.Util::localizedString($lgo, 'name').'")';
|
||||
|
|
@ -757,11 +757,11 @@ class NpcBaseResponse extends TemplateResponse implements ICache
|
|||
|
||||
// tab: objective of quest
|
||||
$conditions = array(
|
||||
'OR',
|
||||
['AND', ['reqNpcOrGo1', [$this->typeId]], ['reqNpcOrGoCount1', 0, '>']],
|
||||
['AND', ['reqNpcOrGo2', [$this->typeId]], ['reqNpcOrGoCount2', 0, '>']],
|
||||
['AND', ['reqNpcOrGo3', [$this->typeId]], ['reqNpcOrGoCount3', 0, '>']],
|
||||
['AND', ['reqNpcOrGo4', [$this->typeId]], ['reqNpcOrGoCount4', 0, '>']]
|
||||
DB::OR,
|
||||
[DB::AND, ['reqNpcOrGo1', [$this->typeId]], ['reqNpcOrGoCount1', 0, '>']],
|
||||
[DB::AND, ['reqNpcOrGo2', [$this->typeId]], ['reqNpcOrGoCount2', 0, '>']],
|
||||
[DB::AND, ['reqNpcOrGo3', [$this->typeId]], ['reqNpcOrGoCount3', 0, '>']],
|
||||
[DB::AND, ['reqNpcOrGo4', [$this->typeId]], ['reqNpcOrGoCount4', 0, '>']]
|
||||
);
|
||||
foreach ([1, 2] as $i)
|
||||
if (($_ = $this->subject->getField('KillCredit'.$i)) > 0)
|
||||
|
|
@ -782,13 +782,13 @@ class NpcBaseResponse extends TemplateResponse implements ICache
|
|||
|
||||
// tab: criteria of [ACHIEVEMENT_CRITERIA_TYPE_KILL_CREATURE_TYPE have no data set to check for]
|
||||
$conditions = array(
|
||||
'AND',
|
||||
DB::AND,
|
||||
['ac.type', [ACHIEVEMENT_CRITERIA_TYPE_KILL_CREATURE, ACHIEVEMENT_CRITERIA_TYPE_KILLED_BY_CREATURE]],
|
||||
['ac.value1', $this->typeId]
|
||||
);
|
||||
|
||||
if ($extraCrt = DB::World()->selectCol('SELECT `criteria_id` FROM achievement_criteria_data WHERE `type` = ?d AND `value1` = ?d', ACHIEVEMENT_CRITERIA_DATA_TYPE_T_CREATURE, $this->typeId))
|
||||
$conditions = ['OR', $conditions, ['ac.id', $extraCrt]];
|
||||
if ($extraCrt = DB::World()->selectCol('SELECT `criteria_id` FROM achievement_criteria_data WHERE `type` = %i AND `value1` = %i', ACHIEVEMENT_CRITERIA_DATA_TYPE_T_CREATURE, $this->typeId))
|
||||
$conditions = [DB::OR, $conditions, ['ac.id', $extraCrt]];
|
||||
|
||||
$crtOf = new AchievementList($conditions);
|
||||
if (!$crtOf->error)
|
||||
|
|
@ -803,7 +803,7 @@ class NpcBaseResponse extends TemplateResponse implements ICache
|
|||
}
|
||||
|
||||
// tab: passengers
|
||||
if ($_ = DB::World()->selectCol('SELECT `accessory_entry` AS ARRAY_KEY, GROUP_CONCAT(`seat_id` SEPARATOR ", ") FROM vehicle_template_accessory WHERE `entry` = ?d GROUP BY `accessory_entry`', $this->typeId))
|
||||
if ($_ = DB::World()->selectCol('SELECT `accessory_entry` AS ARRAY_KEY, GROUP_CONCAT(`seat_id` SEPARATOR ", ") FROM vehicle_template_accessory WHERE `entry` = %i GROUP BY `accessory_entry`', $this->typeId))
|
||||
{
|
||||
$passengers = new CreatureList(array(['id', array_keys($_)]));
|
||||
if (!$passengers->error)
|
||||
|
|
@ -839,7 +839,7 @@ class NpcBaseResponse extends TemplateResponse implements ICache
|
|||
$this->soundIds = array_merge($this->soundIds, SmartAI::getSoundsPlayedForOwner($this->typeId, SmartAI::SRC_TYPE_CREATURE));
|
||||
|
||||
// up to 4 possible displayIds .. for the love of things betwixt, just use the first!
|
||||
$activitySounds = DB::Aowow()->selectRow('SELECT * FROM ?_creature_sounds WHERE `id` = ?d', $this->subject->getField('displayId1'));
|
||||
$activitySounds = DB::Aowow()->selectRow('SELECT * FROM ::creature_sounds WHERE `id` = %i', $this->subject->getField('displayId1'));
|
||||
array_shift($activitySounds); // remove id-column
|
||||
$this->soundIds = array_merge($this->soundIds, array_values($activitySounds));
|
||||
|
||||
|
|
@ -878,11 +878,11 @@ class NpcBaseResponse extends TemplateResponse implements ICache
|
|||
|
||||
private function getRepForId(array $entries, array &$spillover) : array
|
||||
{
|
||||
$rows = DB::World()->select(
|
||||
$rows = DB::World()->selectAssoc(
|
||||
'SELECT `creature_id` AS "npc", `RewOnKillRepFaction1` AS "faction", `RewOnKillRepValue1` AS "qty", `MaxStanding1` AS "maxRank", `isTeamAward1` AS "spillover"
|
||||
FROM creature_onkill_reputation WHERE `creature_id` IN (?a) AND `RewOnKillRepFaction1` > 0 UNION
|
||||
FROM creature_onkill_reputation WHERE `creature_id` IN %in AND `RewOnKillRepFaction1` > 0 UNION
|
||||
SELECT `creature_id` AS "npc", `RewOnKillRepFaction2` AS "faction", `RewOnKillRepValue2` AS "qty", `MaxStanding2` AS "maxRank", `isTeamAward2` AS "spillover"
|
||||
FROM creature_onkill_reputation WHERE `creature_id` IN (?a) AND `RewOnKillRepFaction2` > 0',
|
||||
FROM creature_onkill_reputation WHERE `creature_id` IN %in AND `RewOnKillRepFaction2` > 0',
|
||||
$entries, $entries
|
||||
);
|
||||
|
||||
|
|
@ -903,7 +903,7 @@ class NpcBaseResponse extends TemplateResponse implements ICache
|
|||
0 // spilloverCat
|
||||
);
|
||||
|
||||
$cuRate = DB::World()->selectCell('SELECT `creature_rate` FROM reputation_reward_rate WHERE `creature_rate` <> 1 AND `faction` = ?d', $row['faction']);
|
||||
$cuRate = DB::World()->selectCell('SELECT `creature_rate` FROM reputation_reward_rate WHERE `creature_rate` <> 1 AND `faction` = %i', $row['faction']);
|
||||
if ($cuRate && User::isInGroup(U_GROUP_EMPLOYEE))
|
||||
$set[1][1] = $set[1][0] . sprintf(Util::$dfnString, Lang::faction('customRewRate'), ($set[1][0] > 0 ? '+' : '').($set[1][0] * ($cuRate - 1)));
|
||||
else if ($cuRate)
|
||||
|
|
|
|||
|
|
@ -68,22 +68,22 @@ class ObjectBaseResponse extends TemplateResponse implements ICache
|
|||
/* Determine Map Type */
|
||||
/**********************/
|
||||
|
||||
if ($objectdifficulty = DB::Aowow()->select( // has difficulty versions of itself
|
||||
if ($objectdifficulty = DB::Aowow()->selectAssoc( // has difficulty versions of itself
|
||||
'SELECT `normal10` AS "0", `normal25` AS "1",
|
||||
`heroic10` AS "2", `heroic25` AS "3",
|
||||
`mapType` AS ARRAY_KEY
|
||||
FROM ?_objectdifficulty
|
||||
WHERE `normal10` = ?d OR `normal25` = ?d OR
|
||||
`heroic10` = ?d OR `heroic25` = ?d',
|
||||
FROM ::objectdifficulty
|
||||
WHERE `normal10` = %i OR `normal25` = %i OR
|
||||
`heroic10` = %i OR `heroic25` = %i',
|
||||
$this->typeId, $this->typeId, $this->typeId, $this->typeId
|
||||
))
|
||||
{
|
||||
$this->mapType = key($objectdifficulty);
|
||||
$this->difficulties = array_pop($objectdifficulty);
|
||||
}
|
||||
else if ($maps = DB::Aowow()->selectCell('SELECT IF(COUNT(DISTINCT `areaId`) > 1, 0, `areaId`) FROM ?_spawns WHERE `type` = ?d AND `typeId` = ?d', Type::OBJECT, $this->typeId))
|
||||
else if ($maps = DB::Aowow()->selectCell('SELECT IF(COUNT(DISTINCT `areaId`) > 1, 0, `areaId`) FROM ::spawns WHERE `type` = %i AND `typeId` = %i', Type::OBJECT, $this->typeId))
|
||||
{
|
||||
$this->mapType = match ((int)DB::Aowow()->selectCell('SELECT `type` FROM ?_zones WHERE `id` = ?d', $maps))
|
||||
$this->mapType = match ((int)DB::Aowow()->selectCell('SELECT `type` FROM ::zones WHERE `id` = %i', $maps))
|
||||
{
|
||||
// MAP_TYPE_DUNGEON,
|
||||
MAP_TYPE_DUNGEON_HC => 1,
|
||||
|
|
@ -102,7 +102,7 @@ class ObjectBaseResponse extends TemplateResponse implements ICache
|
|||
$infobox = Lang::getInfoBoxForFlags($this->subject->getField('cuFlags'));
|
||||
|
||||
// Event (ignore events, where the object only gets removed)
|
||||
if ($_ = DB::World()->selectCol('SELECT DISTINCT ge.`eventEntry` FROM game_event ge, game_event_gameobject geg, gameobject g WHERE ge.`eventEntry` = geg.`eventEntry` AND g.`guid` = geg.`guid` AND g.`id` = ?d', $this->typeId))
|
||||
if ($_ = DB::World()->selectCol('SELECT DISTINCT ge.`eventEntry` FROM game_event ge, game_event_gameobject geg, gameobject g WHERE ge.`eventEntry` = geg.`eventEntry` AND g.`guid` = geg.`guid` AND g.`id` = %i', $this->typeId))
|
||||
{
|
||||
$this->extendGlobalIds(Type::WORLDEVENT, ...$_);
|
||||
$ev = [];
|
||||
|
|
@ -113,7 +113,7 @@ class ObjectBaseResponse extends TemplateResponse implements ICache
|
|||
}
|
||||
|
||||
// Faction
|
||||
if ($_ = DB::Aowow()->selectCell('SELECT `factionId` FROM ?_factiontemplate WHERE `id` = ?d', $this->subject->getField('faction')))
|
||||
if ($_ = DB::Aowow()->selectCell('SELECT `factionId` FROM ::factiontemplate WHERE `id` = %i', $this->subject->getField('faction')))
|
||||
{
|
||||
$this->extendGlobalIds(Type::FACTION, $_);
|
||||
$infobox[] = Util::ucFirst(Lang::game('faction')).Lang::main('colon').'[faction='.$_.']';
|
||||
|
|
@ -176,7 +176,7 @@ class ObjectBaseResponse extends TemplateResponse implements ICache
|
|||
// SpellFocus
|
||||
if ($_ = $this->subject->getField('spellFocusId'))
|
||||
{
|
||||
if ($sfo = DB::Aowow()->selectRow('SELECT * FROM ?_spellfocusobject WHERE `id` = ?d', $_))
|
||||
if ($sfo = DB::Aowow()->selectRow('SELECT * FROM ::spellfocusobject WHERE `id` = %i', $_))
|
||||
{
|
||||
$n = Util::localizedString($sfo, 'name');
|
||||
if (!is_null(GameObjectListFilter::getCriteriaIndex(50, $_)))
|
||||
|
|
@ -242,7 +242,7 @@ class ObjectBaseResponse extends TemplateResponse implements ICache
|
|||
|
||||
if (User::isInGroup(U_GROUP_EMPLOYEE))
|
||||
{
|
||||
$spawnData = DB::Aowow()->select('SELECT `guid` AS "0", `ScriptName` AS "1", `StringId` AS "2" FROM ?_spawns WHERE `type` = ?d AND `typeId` = ?d AND `ScriptName` IS NOT NULL ORDER BY `guid` ASC', Type::OBJECT, $this->typeId);
|
||||
$spawnData = DB::Aowow()->selectAssoc('SELECT `guid` AS "0", `ScriptName` AS "1", `StringId` AS "2" FROM ::spawns WHERE `type` = %i AND `typeId` = %i AND `ScriptName` IS NOT NULL ORDER BY `guid` ASC', Type::OBJECT, $this->typeId);
|
||||
|
||||
// AI
|
||||
$scripts = null;
|
||||
|
|
@ -311,16 +311,16 @@ class ObjectBaseResponse extends TemplateResponse implements ICache
|
|||
// todo (low): consider pooled spawns
|
||||
|
||||
|
||||
if ($ll = DB::Aowow()->selectRow('SELECT * FROM ?_loot_link WHERE `objectId` = ?d ORDER BY `priority` DESC LIMIT 1', $this->typeId))
|
||||
if ($ll = DB::Aowow()->selectRow('SELECT * FROM ::loot_link WHERE `objectId` = %i ORDER BY `priority` DESC LIMIT 1', $this->typeId))
|
||||
{
|
||||
// group encounter
|
||||
if ($ll['encounterId'])
|
||||
$this->relBoss = [$ll['npcId'], Lang::profiler('encounterNames', $ll['encounterId'])];
|
||||
// difficulty dummy
|
||||
else if ($c = DB::Aowow()->selectRow('SELECT `id`, `name_loc0`, `name_loc2`, `name_loc3`, `name_loc4`, `name_loc6`, `name_loc8` FROM ?_creature WHERE `difficultyEntry1` = ?d OR `difficultyEntry2` = ?d OR `difficultyEntry3` = ?d', $ll['npcId'], $ll['npcId'], $ll['npcId']))
|
||||
else if ($c = DB::Aowow()->selectRow('SELECT `id`, `name_loc0`, `name_loc2`, `name_loc3`, `name_loc4`, `name_loc6`, `name_loc8` FROM ::creature WHERE `difficultyEntry1` = %i OR `difficultyEntry2` = %i OR `difficultyEntry3` = %i', $ll['npcId'], $ll['npcId'], $ll['npcId']))
|
||||
$this->relBoss = [$c['id'], Util::localizedString($c, 'name')];
|
||||
// base creature
|
||||
else if ($c = DB::Aowow()->selectRow('SELECT `id`, `name_loc0`, `name_loc2`, `name_loc3`, `name_loc4`, `name_loc6`, `name_loc8` FROM ?_creature WHERE `id` = ?d', $ll['npcId']))
|
||||
else if ($c = DB::Aowow()->selectRow('SELECT `id`, `name_loc0`, `name_loc2`, `name_loc3`, `name_loc4`, `name_loc6`, `name_loc8` FROM ::creature WHERE `id` = %i', $ll['npcId']))
|
||||
$this->relBoss = [$c['id'], Util::localizedString($c, 'name')];
|
||||
}
|
||||
|
||||
|
|
@ -332,7 +332,7 @@ class ObjectBaseResponse extends TemplateResponse implements ICache
|
|||
if (!$sai->prepare()) // no smartAI found .. check per guid
|
||||
{
|
||||
// at least one of many
|
||||
$guids = DB::World()->selectCol('SELECT `guid` FROM gameobject WHERE `id` = ?d', $this->typeId);
|
||||
$guids = DB::World()->selectCol('SELECT `guid` FROM gameobject WHERE `id` = %i', $this->typeId);
|
||||
while ($_ = array_pop($guids))
|
||||
{
|
||||
$sai = new SmartAI(SmartAI::SRC_TYPE_OBJECT, -$_, ['title' => ' [small](for GUID: '.$_.')[/small]']);
|
||||
|
|
@ -373,10 +373,10 @@ class ObjectBaseResponse extends TemplateResponse implements ICache
|
|||
SPELL_EFFECT_SUMMON_OBJECT_SLOT4
|
||||
);
|
||||
$conditions = array(
|
||||
'OR',
|
||||
['AND', ['effect1Id', $summonEffects], ['effect1MiscValue', $this->typeId]],
|
||||
['AND', ['effect2Id', $summonEffects], ['effect2MiscValue', $this->typeId]],
|
||||
['AND', ['effect3Id', $summonEffects], ['effect3MiscValue', $this->typeId]]
|
||||
DB::OR,
|
||||
[DB::AND, ['effect1Id', $summonEffects], ['effect1MiscValue', $this->typeId]],
|
||||
[DB::AND, ['effect2Id', $summonEffects], ['effect2MiscValue', $this->typeId]],
|
||||
[DB::AND, ['effect3Id', $summonEffects], ['effect3MiscValue', $this->typeId]]
|
||||
);
|
||||
|
||||
$summons = new SpellList($conditions);
|
||||
|
|
@ -478,15 +478,15 @@ class ObjectBaseResponse extends TemplateResponse implements ICache
|
|||
if ($_ = $this->subject->getField('lootId'))
|
||||
{
|
||||
// check if loot_link entry exists (only difficulty: 1)
|
||||
if ($npcId = DB::Aowow()->selectCell('SELECT `npcId` FROM ?_loot_link WHERE `objectId` = ?d AND `difficulty` = 1', $this->typeId))
|
||||
if ($npcId = DB::Aowow()->selectCell('SELECT `npcId` FROM ::loot_link WHERE `objectId` = %i AND `difficulty` = 1', $this->typeId))
|
||||
{
|
||||
// get id set of npc
|
||||
$lootEntries = DB::Aowow()->selectCol(
|
||||
'SELECT ll.`difficulty` AS ARRAY_KEY, o.`lootId`
|
||||
FROM ?_creature c
|
||||
LEFT JOIN ?_loot_link ll ON ll.`npcId` IN (c.`id`, c.`difficultyEntry1`, c.`difficultyEntry2`, c.`difficultyEntry3`)
|
||||
LEFT JOIN ?_objects o ON o.`id` = ll.`objectId`
|
||||
WHERE c.`id` = ?d
|
||||
FROM ::creature c
|
||||
LEFT JOIN ::loot_link ll ON ll.`npcId` IN (c.`id`, c.`difficultyEntry1`, c.`difficultyEntry2`, c.`difficultyEntry3`)
|
||||
LEFT JOIN ::objects o ON o.`id` = ll.`objectId`
|
||||
WHERE c.`id` = %i
|
||||
ORDER BY ll.`difficulty` ASC',
|
||||
$npcId
|
||||
);
|
||||
|
|
@ -579,7 +579,7 @@ class ObjectBaseResponse extends TemplateResponse implements ICache
|
|||
if ($this->difficulties)
|
||||
{
|
||||
$conditions = array(
|
||||
'AND',
|
||||
DB::AND,
|
||||
['id', $this->difficulties],
|
||||
['id', $this->typeId, '!']
|
||||
);
|
||||
|
|
|
|||
|
|
@ -116,7 +116,7 @@ class PetBaseResponse extends TemplateResponse implements ICache
|
|||
['ct.typeFlags', NPC_TYPEFLAG_TAMEABLE, '&'],
|
||||
['ct.family', $this->typeId], // displayed petType
|
||||
[
|
||||
'OR', // at least neutral to at least one faction
|
||||
DB::OR, // at least neutral to at least one faction
|
||||
['ft.A', 1, '<'],
|
||||
['ft.H', 1, '<']
|
||||
]
|
||||
|
|
@ -166,13 +166,13 @@ class PetBaseResponse extends TemplateResponse implements ICache
|
|||
$conditions = [
|
||||
['s.typeCat', -3], // Pet-Ability
|
||||
[
|
||||
'OR',
|
||||
DB::OR,
|
||||
// match: first skillLine
|
||||
['skillLine1', $this->subject->getField('skillLineId')],
|
||||
// match: second skillLine (if not mask)
|
||||
['AND', ['skillLine1', 0, '>'], ['skillLine2OrMask', $this->subject->getField('skillLineId')]],
|
||||
[DB::AND, ['skillLine1', 0, '>'], ['skillLine2OrMask', $this->subject->getField('skillLineId')]],
|
||||
// match: skillLineMask (if mask)
|
||||
['AND', ['skillLine1', -1], ['skillLine2OrMask', $mask, '&']]
|
||||
[DB::AND, ['skillLine1', -1], ['skillLine2OrMask', $mask, '&']]
|
||||
]
|
||||
];
|
||||
|
||||
|
|
@ -190,7 +190,7 @@ class PetBaseResponse extends TemplateResponse implements ICache
|
|||
$conditions = array(
|
||||
['s.typeCat', -7],
|
||||
[ // last rank or unranked
|
||||
'OR',
|
||||
DB::OR,
|
||||
['s.cuFlags', SPELL_CU_LAST_RANK, '&'],
|
||||
['s.rankNo', 0]
|
||||
]
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ class ProfileAvatarResponse extends TextResponse
|
|||
|
||||
$profileId = substr($this->_get['id'], 0, -4);
|
||||
|
||||
$charData = DB::Aowow()->selectRow('SELECT `race`, `gender` FROM ?_profiler_profiles WHERE id = ?d', $profileId);
|
||||
$charData = DB::Aowow()->selectRow('SELECT `race`, `gender` FROM ::profiler_profiles WHERE id = %i', $profileId);
|
||||
if (!$charData)
|
||||
$this->generate404();
|
||||
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue