Misc/Misc

* fixed auth against TCs auth table
 * check for real paths when creating emote aliasses
 * races page no longer identifies as classes
 * fixed item comparison tool
 * fixed js error when trying to display spawn maps
This commit is contained in:
Sarjuuk
2016-02-27 23:15:54 +01:00
parent 741ebf38f9
commit 71e44e572a
9 changed files with 64 additions and 40 deletions

View File

@@ -572,13 +572,16 @@ trait spawnHelper
if ($p['wait'])
$label[] = Lang::npc('wait').Lang::main('colon').Util::formatTime($p['wait'], false);
$set = ['label' => '$<br><span class="q0">'.implode('<br>', $label).'</span>', 'type' => $wpIdx];
$opts = array( // \0 doesn't get printed and tricks Util::toJSON() into handling this as a string .. i feel slightly dirty now
'label' => "\0$<br><span class=\"q0\">".implode('<br>', $label).'</span>',
'type' => $wpIdx
);
// connective line
if ($i > 0)
$set['lines'] = [[$wPoints[$i - 1]['posX'], $wPoints[$i - 1]['posY']]];
$opts['lines'] = [[$wPoints[$i - 1]['posX'], $wPoints[$i - 1]['posY']]];
$data[$s['areaId']][$s['floor']]['coords'][] = [$p['posX'], $p['posY'], $set];
$data[$s['areaId']][$s['floor']]['coords'][] = [$p['posX'], $p['posY'], $opts];
if (empty($wpSum[$s['areaId']][$s['floor']]))
$wpSum[$s['areaId']][$s['floor']] = 1;
else
@@ -588,21 +591,21 @@ trait spawnHelper
}
}
$label = [];
if (User::isInGroup(U_GROUP_STAFF))
$label[] = $s['guid'] < 0 ? 'Vehicle Accessory' : 'GUID'.Lang::main('colon').$s['guid'];
$opts = $menu = $tt = $info = [];
$footer = '';
if ($s['respawn'])
$label[] = Lang::npc('respawnIn').Lang::main('colon').Util::formatTime($s['respawn'] * 1000, false);
$info[1] = '<span class="q0">'.Lang::npc('respawnIn').Lang::main('colon').Util::formatTime($s['respawn'] * 1000, false).'</span>';
if (User::isInGroup(U_GROUP_STAFF))
{
$info[0] = $s['guid'] < 0 ? 'Vehicle Accessory' : 'GUID'.Lang::main('colon').$s['guid'];
if ($s['phaseMask'] > 1 && ($s['phaseMask'] & 0xFFFF) != 0xFFFF)
$label[] = Lang::game('phases').Lang::main('colon').Util::asHex($s['phaseMask']);
$info[2] = Lang::game('phases').Lang::main('colon').Util::asHex($s['phaseMask']);
if ($s['spawnMask'] == 15)
$label[] = Lang::game('mode').Lang::main('colon').Lang::game('modes', -1);
$info[3] = Lang::game('mode').Lang::main('colon').Lang::game('modes', -1);
else if ($s['spawnMask'])
{
$_ = [];
@@ -610,11 +613,25 @@ trait spawnHelper
if ($s['spawnMask'] & 1 << $i)
$_[] = Lang::game('modes', $i);
$label[] = Lang::game('mode').Lang::main('colon').implode(', ', $_);
$info[4] = Lang::game('mode').Lang::main('colon').implode(', ', $_);
}
$footer = '<span class="q2">Click to move to different floor</span>';
}
$data[$s['areaId']] [$s['floor']] ['coords'] [] = [$s['posX'], $s['posY'], ['label' => '$<br><span class="q0">'.implode('<br>', $label).'</span>']];
if ($info)
$tt['info'] = $info;
if ($footer)
$tt['footer'] = $footer;
if ($tt)
$opts['tooltip'] = [$this->getField('name', true) => $tt];
if ($menu)
$opts['menu'] = $menu;
$data[$s['areaId']] [$s['floor']] ['coords'] [] = [$s['posX'], $s['posY'], $opts];
}
foreach ($data as $a => &$areas)
foreach ($areas as $f => &$floor)

View File

@@ -36,6 +36,10 @@ class DB
if ($options['prefix'])
$interface->setIdentPrefix($options['prefix']);
// kill STRICT_TRANS_TABLES and STRICT_ALL_TABLES off. It prevents usage of implicit default values.
if ($idx == DB_AOWOW)
$interface->query('SET SESSION sql_mode = \'NO_ENGINE_SUBSTITUTION\'');
self::$interfaceCache[$idx] = &$interface;
self::$connectionCache[$idx] = true;
}

View File

@@ -1,6 +1,6 @@
<?php
define('AOWOW_REVISION', 17);
define('AOWOW_REVISION', 18);
define('CLI', PHP_SAPI === 'cli');

View File

@@ -140,11 +140,11 @@ class User
$rawIp = explode(',', $rawIp)[0]; // [ip, proxy1, proxy2]
// check IPv4
if ($ipAddr = filter_var($rawIp, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4 | FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE))
if ($ipAddr = filter_var($rawIp, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4 | FILTER_FLAG_NO_RES_RANGE))
break;
// check IPv6
if ($ipAddr = filter_var($rawIp, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6 | FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE))
if ($ipAddr = filter_var($rawIp, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6 | FILTER_FLAG_NO_RES_RANGE))
break;
}
}
@@ -349,7 +349,7 @@ class User
public static function verifyCrypt($pass, $hash = '')
{
$_ = $hash ?: self::$passHash;
return $_ == crypt($pass, $_);
return $_ === crypt($pass, $_);
}
// sha1 used by TC / MaNGOS
@@ -360,7 +360,7 @@ class User
private static function verifySHA1($name, $pass)
{
return self::$passHash == self::hashSHA1($name, $pass);
return strtoupper(self::$passHash) === strtoupper(self::hashSHA1($name, $pass));
}
public static function isValidName($name, &$errCode = 0)
@@ -369,7 +369,7 @@ class User
if (mb_strlen($name) < 4 || mb_strlen($name) > 16)
$errCode = 1;
else if (preg_match('/[^\w\d]/i', $name))
else if (preg_match('/[^\w\d\-]/i', $name))
$errCode = 2;
return $errCode == 0;