fixed some issues:

- allowed colons in config strings
 - setup for tpl-files that only have const text
This commit is contained in:
Sarjuuk
2015-05-18 16:18:08 +02:00
parent e2a0558a0a
commit 1d6ecc86d7
3 changed files with 11 additions and 11 deletions

View File

@@ -81,7 +81,7 @@ foreach ($sets as $k => $v)
else if ($v['flags'] & CON_FLAG_TYPE_BOOL) else if ($v['flags'] & CON_FLAG_TYPE_BOOL)
$val = (bool)$v['value']; $val = (bool)$v['value'];
else if ($v['flags'] & CON_FLAG_TYPE_STRING) else if ($v['flags'] & CON_FLAG_TYPE_STRING)
$val = preg_replace('/[^\p{L}0-9~\s_\-\'\/\.,]/ui', '', $v['value']); $val = preg_replace('/[^\p{L}0-9~\s_\-\'\/\.:,]/ui', '', $v['value']);
else else
{ {
Util::addNote(U_GROUP_ADMIN | U_GROUP_DEV, 'Kernel: '.($php ? 'PHP' : 'Aowow').' config value '.($php ? strtolower($k) : 'CFG_'.strtoupper($k)).' has no type set. Value forced to 0!'); Util::addNote(U_GROUP_ADMIN | U_GROUP_DEV, 'Kernel: '.($php ? 'PHP' : 'Aowow').' config value '.($php ? strtolower($k) : 'CFG_'.strtoupper($k)).' has no type set. Value forced to 0!');

View File

@@ -42,12 +42,7 @@ function build()
if (file_exists('setup/tools/filegen/'.$name.'.func.php')) if (file_exists('setup/tools/filegen/'.$name.'.func.php'))
require_once 'setup/tools/filegen/'.$name.'.func.php'; require_once 'setup/tools/filegen/'.$name.'.func.php';
else // else not necessarily an error, may only need replacement of const text
{
CLISetup::log(sprintf(ERR_MISSING_INCL, $name, 'setup/tools/filegen/'.$name.'.func.php'), CLISetup::LOG_ERROR);
$allOk = false;
continue;
}
if (!CLISetup::writeDir($destPath)) if (!CLISetup::writeDir($destPath))
continue; continue;
@@ -74,14 +69,19 @@ function build()
if (function_exists($func)) if (function_exists($func))
$content = str_replace('/*setup:'.$func.'*/', $func(), $content); $content = str_replace('/*setup:'.$func.'*/', $func(), $content);
else else
CLISetup::log('Placeholder in template file does not match any known function name.', CLISetup::LOG_ERROR); {
$allOk = false;
CLISetup::log('No function for was registered for placeholder '.$func.'().', CLISetup::LOG_ERROR);
if (!array_reduce(get_included_files(), function ($inArray, $itr) use ($func) { return $inArray || false !== strpos($itr, $func); }, false))
CLISetup::log('Also, expected include setup/tools/filegen/'.$name.'.func.php was not found.');
}
} }
} }
if (fWrite($dest, $content)) if (fWrite($dest, $content))
{ {
CLISetup::log(sprintf(ERR_NONE, CLISetup::bold($destPath.$file)), CLISetup::LOG_OK); CLISetup::log(sprintf(ERR_NONE, CLISetup::bold($destPath.$file)), CLISetup::LOG_OK);
if ($content) if ($content && $allOk)
$ok = true; $ok = true;
} }
else else

View File

@@ -59,12 +59,12 @@ if (!CLI)
$data = $ratings; $data = $ratings;
$offsets = array_map(function ($v) { // LookupEntry(cr*GT_MAX_LEVEL+level-1) $offsets = array_map(function ($v) { // LookupEntry(cr*GT_MAX_LEVEL+level-1)
return abs($v) * 100 + 60 - 1; return $v * 100 + 60 - 1;
}, $ratings); }, $ratings);
$base = DB::Aowow()->selectCol('SELECT CAST((idx + 1 - 60) / 100 AS UNSIGNED) AS ARRAY_KEY, ratio FROM dbc_gtcombatratings WHERE idx IN (?a)', $offsets); $base = DB::Aowow()->selectCol('SELECT CAST((idx + 1 - 60) / 100 AS UNSIGNED) AS ARRAY_KEY, ratio FROM dbc_gtcombatratings WHERE idx IN (?a)', $offsets);
$offsets = array_map(function ($v) { // LookupEntry((getClass()-1)*GT_MAX_RATING+cr+1) $offsets = array_map(function ($v) { // LookupEntry((getClass()-1)*GT_MAX_RATING+cr+1)
return (CLASS_WARRIOR - 1) * 32 + abs($v) + 1; return (CLASS_WARRIOR - 1) * 32 + $v + 1;
}, $ratings); }, $ratings);
$mods = DB::Aowow()->selectCol('SELECT idx - 1 AS ARRAY_KEY, ratio FROM dbc_gtoctclasscombatratingscalar WHERE idx IN (?a)', $offsets); $mods = DB::Aowow()->selectCol('SELECT idx - 1 AS ARRAY_KEY, ratio FROM dbc_gtoctclasscombatratingscalar WHERE idx IN (?a)', $offsets);