mirror of
https://github.com/Sarjuuk/aowow.git
synced 2025-11-29 15:58:16 +08:00
Weight Scales/Presets:
* moved wt_presets to DB * scales are now saved sensibly instead of just being dumped as is (also, tables have now constrains) * added admin=weight-presets to edit presets * added an internal user on id:0 who 'owns' the wt-presets and the +1 rates on new comments * consequently added constraints to comment-related tables Misc: * Util::toJSON() priorizes its flags over CFG_DEBUG, wich fixes the modelviewer-redButton * moved terrible javascript-dump from admin-page to template
This commit is contained in:
@@ -521,31 +521,17 @@ class User
|
||||
|
||||
public static function getWeightScales()
|
||||
{
|
||||
$data = [];
|
||||
$result = [];
|
||||
|
||||
$res = DB::Aowow()->select('SELECT * FROM ?_account_weightscales WHERE userId = ?d', self::$id);
|
||||
foreach ($res as $i)
|
||||
{
|
||||
$set = array (
|
||||
'name' => $i['name'],
|
||||
'id' => $i['id']
|
||||
);
|
||||
$res = DB::Aowow()->selectCol('SELECT id AS ARRAY_KEY, name FROM ?_account_weightscales WHERE userId = ?d', self::$id);
|
||||
if (!$res)
|
||||
return $result;
|
||||
|
||||
$weights = explode(',', $i['weights']);
|
||||
foreach ($weights as $weight)
|
||||
{
|
||||
$w = explode(':', $weight);
|
||||
$weights = DB::Aowow()->selectCol('SELECT id AS ARRAY_KEY, `field` AS ARRAY_KEY2, val FROM ?_account_weightscale_data WHERE id IN (?a)', array_keys($res));
|
||||
foreach ($weights as $id => $data)
|
||||
$result[] = array_merge(['name' => $res[$id], 'id' => $id], $data);
|
||||
|
||||
if ($w[1] === 'undefined')
|
||||
$w[1] = 0;
|
||||
|
||||
$set[$w[0]] = $w[1];
|
||||
}
|
||||
|
||||
$data[] = $set;
|
||||
}
|
||||
|
||||
return $data;
|
||||
return $result;
|
||||
}
|
||||
|
||||
public static function getCharacters()
|
||||
|
||||
Reference in New Issue
Block a user