mirror of
https://github.com/Sarjuuk/aowow.git
synced 2025-11-29 15:58:16 +08:00
@@ -190,7 +190,7 @@ class CommunityContent
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Util::logError('Comment '.$c['id'].' belongs to nonexistant subject.', E_USER_NOTICE);
|
trigger_error('Comment '.$c['id'].' belongs to nonexistant subject.', E_USER_NOTICE);
|
||||||
unset($comments[$idx]);
|
unset($comments[$idx]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -341,7 +341,7 @@ class CommunityContent
|
|||||||
{
|
{
|
||||||
if (empty($p['name']))
|
if (empty($p['name']))
|
||||||
{
|
{
|
||||||
Util::logError('Screenshot linked to nonexistant type/typeId combination: '.$p['type'].'/'.$p['typeId'], E_USER_NOTICE);
|
trigger_error('Screenshot linked to nonexistant type/typeId combination: '.$p['type'].'/'.$p['typeId'], E_USER_NOTICE);
|
||||||
unset($p);
|
unset($p);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -73,7 +73,7 @@ foreach ($sets as $k => $v)
|
|||||||
// this should not have been possible
|
// this should not have been possible
|
||||||
if (!strlen($v['value']) && !($v['flags'] & CON_FLAG_TYPE_STRING) && !$php)
|
if (!strlen($v['value']) && !($v['flags'] & CON_FLAG_TYPE_STRING) && !$php)
|
||||||
{
|
{
|
||||||
Util::logError('Aowow config value CFG_'.strtoupper($k).' is empty - config will not be used!', E_USER_ERROR);
|
trigger_error('Aowow config value CFG_'.strtoupper($k).' is empty - config will not be used!', E_USER_ERROR);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -87,12 +87,12 @@ foreach ($sets as $k => $v)
|
|||||||
$val = preg_replace('/[^\p{L}0-9~\s_\-\'\/\.:,]/ui', '', $v['value']);
|
$val = preg_replace('/[^\p{L}0-9~\s_\-\'\/\.:,]/ui', '', $v['value']);
|
||||||
else if ($php)
|
else if ($php)
|
||||||
{
|
{
|
||||||
Util::logError('PHP config value '.strtolower($k).' has no type set - config will not be used!', E_USER_ERROR);
|
trigger_error('PHP config value '.strtolower($k).' has no type set - config will not be used!', E_USER_ERROR);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
else // if (!$php)
|
else // if (!$php)
|
||||||
{
|
{
|
||||||
Util::logError('Aowow config value CFG_'.strtoupper($k).' has no type set - value forced to 0!', E_USER_ERROR);
|
trigger_error('Aowow config value CFG_'.strtoupper($k).' has no type set - value forced to 0!', E_USER_ERROR);
|
||||||
$val = 0;
|
$val = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -120,8 +120,10 @@ set_error_handler(function($errNo, $errStr, $errFile, $errLine) {
|
|||||||
else if ($errNo == E_USER_WARNING) // 0x0200
|
else if ($errNo == E_USER_WARNING) // 0x0200
|
||||||
$errName = 'E_USER_WARNING';
|
$errName = 'E_USER_WARNING';
|
||||||
else if ($errNo == E_USER_NOTICE) // 0x0400
|
else if ($errNo == E_USER_NOTICE) // 0x0400
|
||||||
|
{
|
||||||
$errName = 'E_USER_NOTICE';
|
$errName = 'E_USER_NOTICE';
|
||||||
$uGroup = U_GROUP_STAFF;
|
$uGroup = U_GROUP_STAFF;
|
||||||
|
}
|
||||||
else if ($errNo == E_RECOVERABLE_ERROR) // 0x1000
|
else if ($errNo == E_RECOVERABLE_ERROR) // 0x1000
|
||||||
$errName = 'E_RECOVERABLE_ERROR';
|
$errName = 'E_RECOVERABLE_ERROR';
|
||||||
|
|
||||||
@@ -151,7 +153,7 @@ if (!CLI)
|
|||||||
|
|
||||||
// Setup Session
|
// Setup Session
|
||||||
if (CFG_SESSION_CACHE_DIR && Util::checkOrCreateDirectory(CFG_SESSION_CACHE_DIR))
|
if (CFG_SESSION_CACHE_DIR && Util::checkOrCreateDirectory(CFG_SESSION_CACHE_DIR))
|
||||||
session_save_path(CFG_SESSION_CACHE_DIR);
|
session_save_path(getcwd().'/'.CFG_SESSION_CACHE_DIR);
|
||||||
|
|
||||||
session_set_cookie_params(15 * YEAR, '/', '', $secure, true);
|
session_set_cookie_params(15 * YEAR, '/', '', $secure, true);
|
||||||
session_cache_limiter('private');
|
session_cache_limiter('private');
|
||||||
|
|||||||
@@ -175,7 +175,7 @@ class Loot
|
|||||||
}
|
}
|
||||||
else // shouldn't have happened
|
else // shouldn't have happened
|
||||||
{
|
{
|
||||||
Util::logError('Unhandled case in calculating chance for item '.$entry['Item'].'!');
|
trigger_error('Unhandled case in calculating chance for item '.$entry['Item'].'!', E_USER_WARNING);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -189,7 +189,7 @@ class Loot
|
|||||||
$sum = 0;
|
$sum = 0;
|
||||||
else if ($sum >= 100.01)
|
else if ($sum >= 100.01)
|
||||||
{
|
{
|
||||||
Util::logError('Loot entry '.$lootId.' / group '.$k.' has a total chance of '.number_format($sum, 2).'%. Some items cannot drop!');
|
trigger_error('Loot entry '.$lootId.' / group '.$k.' has a total chance of '.number_format($sum, 2).'%. Some items cannot drop!', E_USER_WARNING);
|
||||||
$sum = 100;
|
$sum = 100;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -378,13 +378,13 @@ class Loot
|
|||||||
{
|
{
|
||||||
// check for possible database inconsistencies
|
// check for possible database inconsistencies
|
||||||
if (!$ref['chance'] && !$ref['isGrouped'])
|
if (!$ref['chance'] && !$ref['isGrouped'])
|
||||||
Util::logError('Loot by Item: Ungrouped Item/Ref '.$ref['item'].' has 0% chance assigned!');
|
trigger_error('Loot by Item: Ungrouped Item/Ref '.$ref['item'].' has 0% chance assigned!', E_USER_WARNING);
|
||||||
|
|
||||||
if ($ref['isGrouped'] && $ref['sumChance'] > 100)
|
if ($ref['isGrouped'] && $ref['sumChance'] > 100)
|
||||||
Util::logError('Loot by Item: Group with Item/Ref '.$ref['item'].' has '.number_format($ref['sumChance'], 2).'% total chance! Some items cannot drop!');
|
trigger_error('Loot by Item: Group with Item/Ref '.$ref['item'].' has '.number_format($ref['sumChance'], 2).'% total chance! Some items cannot drop!', E_USER_WARNING);
|
||||||
|
|
||||||
if ($ref['isGrouped'] && $ref['sumChance'] >= 100 && !$ref['chance'])
|
if ($ref['isGrouped'] && $ref['sumChance'] >= 100 && !$ref['chance'])
|
||||||
Util::logError('Loot by Item: Item/Ref '.$ref['item'].' with adaptive chance cannot drop. Group already at 100%!');
|
trigger_error('Loot by Item: Item/Ref '.$ref['item'].' with adaptive chance cannot drop. Group already at 100%!', E_USER_WARNING);
|
||||||
|
|
||||||
$chance = abs($ref['chance'] ?: (100 - $ref['sumChance']) / $ref['nZeroItems']) / 100;
|
$chance = abs($ref['chance'] ?: (100 - $ref['sumChance']) / $ref['nZeroItems']) / 100;
|
||||||
|
|
||||||
|
|||||||
@@ -698,12 +698,6 @@ class Util
|
|||||||
public static $wowheadLink = '';
|
public static $wowheadLink = '';
|
||||||
private static $notes = [];
|
private static $notes = [];
|
||||||
|
|
||||||
public static function logError($errStr, $mode = E_USER_WARNING)
|
|
||||||
{
|
|
||||||
// handled by set_error_handler
|
|
||||||
trigger_error($errStr, $mode);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function addNote($uGroupMask, $str)
|
public static function addNote($uGroupMask, $str)
|
||||||
{
|
{
|
||||||
self::$notes[] = [$uGroupMask, $str];
|
self::$notes[] = [$uGroupMask, $str];
|
||||||
@@ -1712,9 +1706,9 @@ class Util
|
|||||||
$path = preg_replace('|/+|', '/', $path);
|
$path = preg_replace('|/+|', '/', $path);
|
||||||
|
|
||||||
if (!is_dir($path) && !@mkdir($path, self::FILE_ACCESS, true))
|
if (!is_dir($path) && !@mkdir($path, self::FILE_ACCESS, true))
|
||||||
self::logError('Could not create directory: '.$path, E_USER_ERROR);
|
trigger_error('Could not create directory: '.$path, E_USER_ERROR);
|
||||||
else if (!is_writable($path) && !@chmod($path, self::FILE_ACCESS))
|
else if (!is_writable($path) && !@chmod($path, self::FILE_ACCESS))
|
||||||
self::logError('Cannot write into directory: '.$path, E_USER_ERROR);
|
trigger_error('Cannot write into directory: '.$path, E_USER_ERROR);
|
||||||
else
|
else
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ class Lang
|
|||||||
{
|
{
|
||||||
if (!isset(self::$$prop))
|
if (!isset(self::$$prop))
|
||||||
{
|
{
|
||||||
Util::logError('Lang - tried to use undefined property Lang::$'.$prop);
|
trigger_error('Lang - tried to use undefined property Lang::$'.$prop, E_USER_WARNING);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -58,7 +58,7 @@ class Lang
|
|||||||
{
|
{
|
||||||
if (!isset($var[$key]))
|
if (!isset($var[$key]))
|
||||||
{
|
{
|
||||||
Util::logError('Lang - undefined key "'.$key.'" in property Lang::$'.$prop.'[\''.implode('\'][\'', $args).'\']');
|
trigger_error('Lang - undefined key "'.$key.'" in property Lang::$'.$prop.'[\''.implode('\'][\'', $args).'\']', E_USER_WARNING);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -73,14 +73,14 @@ class Lang
|
|||||||
|
|
||||||
if (!isset(self::$$prop))
|
if (!isset(self::$$prop))
|
||||||
{
|
{
|
||||||
Util::logError('Lang::sort - tried to use undefined property Lang::$'.$prop);
|
trigger_error('Lang::sort - tried to use undefined property Lang::$'.$prop, E_USER_WARNING);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
$var = &self::$$prop;
|
$var = &self::$$prop;
|
||||||
if (!isset($var[$group]))
|
if (!isset($var[$group]))
|
||||||
{
|
{
|
||||||
Util::logError('Lang::sort - tried to use undefined property Lang::$'.$prop.'[\''.$group.'\']');
|
trigger_error('Lang::sort - tried to use undefined property Lang::$'.$prop.'[\''.$group.'\']', E_USER_WARNING);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -218,7 +218,7 @@ class EventPage extends GenericPage
|
|||||||
if ($v > 0)
|
if ($v > 0)
|
||||||
$list[] = $v;
|
$list[] = $v;
|
||||||
else if ($v === null)
|
else if ($v === null)
|
||||||
Util::logError('game_event_prerequisite: this event has itself as prerequisite');
|
trigger_error('game_event_prerequisite: this event has itself as prerequisite', E_USER_WARNING);
|
||||||
});
|
});
|
||||||
|
|
||||||
if ($list)
|
if ($list)
|
||||||
|
|||||||
@@ -355,7 +355,7 @@ class ItemPage extends genericPage
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Util::logError('Referenced PageTextId #'.$next.' is not in DB');
|
trigger_error('Referenced PageTextId #'.$next.' is not in DB', E_USER_WARNING);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -509,7 +509,7 @@ class NpcPage extends GenericPage
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
Util::logError('NPC '.$this->typeId.' is flagged as trainer, but doesn\'t have any spells set');
|
trigger_error('NPC '.$this->typeId.' is flagged as trainer, but doesn\'t have any spells set', E_USER_WARNING);
|
||||||
}
|
}
|
||||||
|
|
||||||
// tab: sells
|
// tab: sells
|
||||||
|
|||||||
@@ -213,7 +213,7 @@ class ObjectPage extends GenericPage
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Util::logError('Referenced PageTextId #'.$next.' is not in DB');
|
trigger_error('Referenced PageTextId #'.$next.' is not in DB', E_USER_WARNING);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ class ScreenshotPage extends GenericPage
|
|||||||
|
|
||||||
if ($this->minSize <= 0)
|
if ($this->minSize <= 0)
|
||||||
{
|
{
|
||||||
Util::logError('config error: dimensions for uploaded screenshots equal or less than zero. Value forced to 200');
|
trigger_error('config error: dimensions for uploaded screenshots equal or less than zero. Value forced to 200', E_USER_WARNING);
|
||||||
$this->minSize = 200;
|
$this->minSize = 200;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -276,26 +276,26 @@ class ScreenshotPage extends GenericPage
|
|||||||
switch ($_FILES['screenshotfile']['error'])
|
switch ($_FILES['screenshotfile']['error'])
|
||||||
{
|
{
|
||||||
case 1:
|
case 1:
|
||||||
Util::logError('validateScreenshot - the file exceeds the maximum size of '.ini_get('upload_max_filesize'));
|
trigger_error('validateScreenshot - the file exceeds the maximum size of '.ini_get('upload_max_filesize'), E_USER_WARNING);
|
||||||
return Lang::screenshot('error', 'selectSS');
|
return Lang::screenshot('error', 'selectSS');
|
||||||
case 3:
|
case 3:
|
||||||
Util::logError('validateScreenshot - upload was interrupted');
|
trigger_error('validateScreenshot - upload was interrupted');
|
||||||
return Lang::screenshot('error', 'selectSS');
|
return Lang::screenshot('error', 'selectSS');
|
||||||
case 4:
|
case 4:
|
||||||
Util::logError('validateScreenshot() - no file was received');
|
trigger_error('validateScreenshot() - no file was received', E_USER_WARNING);
|
||||||
return Lang::screenshot('error', 'selectSS');
|
return Lang::screenshot('error', 'selectSS');
|
||||||
case 6:
|
case 6:
|
||||||
Util::logError('validateScreenshot - temporary upload directory is not set');
|
trigger_error('validateScreenshot - temporary upload directory is not set', E_USER_WARNING);
|
||||||
return Lang::main('intError');
|
return Lang::main('intError');
|
||||||
case 7:
|
case 7:
|
||||||
Util::logError('validateScreenshot - could not write temporary file to disk');
|
trigger_error('validateScreenshot - could not write temporary file to disk', E_USER_WARNING);
|
||||||
return Lang::main('intError');
|
return Lang::main('intError');
|
||||||
}
|
}
|
||||||
|
|
||||||
// points to invalid file (hack attempt)
|
// points to invalid file (hack attempt)
|
||||||
if (!is_uploaded_file($_FILES['screenshotfile']['tmp_name']))
|
if (!is_uploaded_file($_FILES['screenshotfile']['tmp_name']))
|
||||||
{
|
{
|
||||||
Util::logError('validateScreenshot - uploaded file not in upload directory');
|
trigger_error('validateScreenshot - uploaded file not in upload directory', E_USER_WARNING);
|
||||||
return Lang::main('intError');
|
return Lang::main('intError');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user