substr_compare()에서 문제를 일으킬 수 있는 부분 보완.

This commit is contained in:
bnu 2013-11-27 15:16:26 +09:00
parent 3430d4fae5
commit e9dacc6cdf
5 changed files with 8 additions and 7 deletions

View file

@ -2209,11 +2209,11 @@ class Context
$filename = substr($filename, 2); $filename = substr($filename, 2);
} }
if(substr_compare($filename, '.js', -3, 3, TRUE) === 0) if(substr_compare($filename, '.js', -3) === 0)
{ {
$result->jsList[] = $plugin_path . $filename; $result->jsList[] = $plugin_path . $filename;
} }
elseif(substr_compare($filename, '.css', -4, 4, TRUE) === 0) elseif(substr_compare($filename, '.css', -4) === 0)
{ {
$result->cssList[] = $plugin_path . $filename; $result->cssList[] = $plugin_path . $filename;
} }

View file

@ -38,7 +38,8 @@ class HTMLDisplayHandler
if(count($theme_skin) == 2) if(count($theme_skin) == 2)
{ {
$theme_path = sprintf('./themes/%s', $theme_skin[0]); $theme_path = sprintf('./themes/%s', $theme_skin[0]);
if(substr_compare($theme_path, $theme_path, 0, strlen($theme_path)) !== 0) // FIXME $theme_path $theme_path $theme_path ??
if(substr($theme_path, 0, strlen($theme_path)) != $theme_path)
{ {
$template_path = sprintf('%s/modules/%s/', $theme_path, $theme_skin[1]); $template_path = sprintf('%s/modules/%s/', $theme_path, $theme_skin[1]);
} }

View file

@ -17,7 +17,7 @@ class FileHandler
*/ */
function getRealPath($source) function getRealPath($source)
{ {
if(isset($source) && substr_compare($source, './', 0, 2) === 0) if(strlen($source) >= 2 && substr_compare($source, './', 0, 2) === 0)
{ {
return _XE_PATH_ . substr($source, 2); return _XE_PATH_ . substr($source, 2);
} }

View file

@ -278,7 +278,7 @@ class ModuleObject extends Object
{ {
if(!$path) return; if(!$path) return;
if(substr_compare($path, '/', 0, 1) !== 0 && substr_compare($path, './', 0, 2) !== 0) if((strlen($path) >= 1 && substr_compare($path, '/', 0, 1) !== 0) && (strlen($path) >= 2 && substr_compare($path, './', 0, 2) !== 0))
{ {
$path = './' . $path; $path = './' . $path;
} }
@ -357,7 +357,7 @@ class ModuleObject extends Object
{ {
if(!$path) return; if(!$path) return;
if(substr_compare($path, '/', 0, 1) !== 0 && substr_compare($path, './', 0, 2) !== 0) if((strlen($path) >= 1 && substr_compare($path, '/', 0, 1) !== 0) && (strlen($path) >= 2 && substr_compare($path, './', 0, 2) !== 0))
{ {
$path = './' . $path; $path = './' . $path;
} }

View file

@ -1015,7 +1015,7 @@ function removeSrcHack($match)
{ {
foreach($m[1] as $idx => $name) foreach($m[1] as $idx => $name)
{ {
if(isset($name) && substr_compare($name, 'on', 0, 2) === 0) if(strlen($name) >= 2 && substr_compare($name, 'on', 0, 2) === 0)
{ {
continue; continue;
} }