so .. basicly everything was wrong with this one
This commit is contained in:
Sarjuuk
2015-07-20 11:33:48 +02:00
parent 5b8a862df9
commit 022ceba20d
10 changed files with 30 additions and 34 deletions

View File

@@ -190,7 +190,7 @@ class CommunityContent
}
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]);
}
}
@@ -341,7 +341,7 @@ class CommunityContent
{
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);
}
else

View File

@@ -73,7 +73,7 @@ foreach ($sets as $k => $v)
// this should not have been possible
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;
}
@@ -87,12 +87,12 @@ foreach ($sets as $k => $v)
$val = preg_replace('/[^\p{L}0-9~\s_\-\'\/\.:,]/ui', '', $v['value']);
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;
}
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;
}
@@ -120,8 +120,10 @@ set_error_handler(function($errNo, $errStr, $errFile, $errLine) {
else if ($errNo == E_USER_WARNING) // 0x0200
$errName = 'E_USER_WARNING';
else if ($errNo == E_USER_NOTICE) // 0x0400
{
$errName = 'E_USER_NOTICE';
$uGroup = U_GROUP_STAFF;
}
else if ($errNo == E_RECOVERABLE_ERROR) // 0x1000
$errName = 'E_RECOVERABLE_ERROR';
@@ -151,7 +153,7 @@ if (!CLI)
// Setup Session
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_cache_limiter('private');

View File

@@ -175,7 +175,7 @@ class Loot
}
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;
}
@@ -189,7 +189,7 @@ class Loot
$sum = 0;
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;
}
@@ -378,13 +378,13 @@ class Loot
{
// check for possible database inconsistencies
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)
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'])
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;

View File

@@ -698,12 +698,6 @@ class Util
public static $wowheadLink = '';
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)
{
self::$notes[] = [$uGroupMask, $str];
@@ -1712,9 +1706,9 @@ class Util
$path = preg_replace('|/+|', '/', $path);
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))
self::logError('Cannot write into directory: '.$path, E_USER_ERROR);
trigger_error('Cannot write into directory: '.$path, E_USER_ERROR);
else
return true;

View File

@@ -49,7 +49,7 @@ class Lang
{
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;
}
@@ -58,7 +58,7 @@ class Lang
{
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;
}
@@ -73,14 +73,14 @@ class Lang
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;
}
$var = &self::$$prop;
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;
}

View File

@@ -218,7 +218,7 @@ class EventPage extends GenericPage
if ($v > 0)
$list[] = $v;
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)

View File

@@ -355,7 +355,7 @@ class ItemPage extends genericPage
}
else
{
Util::logError('Referenced PageTextId #'.$next.' is not in DB');
trigger_error('Referenced PageTextId #'.$next.' is not in DB', E_USER_WARNING);
break;
}
}

View File

@@ -509,7 +509,7 @@ class NpcPage extends GenericPage
}
}
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

View File

@@ -213,7 +213,7 @@ class ObjectPage extends GenericPage
}
else
{
Util::logError('Referenced PageTextId #'.$next.' is not in DB');
trigger_error('Referenced PageTextId #'.$next.' is not in DB', E_USER_WARNING);
break;
}
}

View File

@@ -35,7 +35,7 @@ class ScreenshotPage extends GenericPage
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;
}
@@ -276,26 +276,26 @@ class ScreenshotPage extends GenericPage
switch ($_FILES['screenshotfile']['error'])
{
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');
case 3:
Util::logError('validateScreenshot - upload was interrupted');
trigger_error('validateScreenshot - upload was interrupted');
return Lang::screenshot('error', 'selectSS');
case 4:
Util::logError('validateScreenshot() - no file was received');
trigger_error('validateScreenshot() - no file was received', E_USER_WARNING);
return Lang::screenshot('error', 'selectSS');
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');
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');
}
// points to invalid file (hack attempt)
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');
}