mirror of
https://github.com/PrivateBin/PrivateBin.git
synced 2026-04-19 21:58:08 -04:00
use more straight forward in_array check
kudos @Ribas160 for the suggestion
This commit is contained in:
+7
-10
@@ -52,18 +52,15 @@ class View
|
|||||||
{
|
{
|
||||||
$dir = PATH . 'tpl' . DIRECTORY_SEPARATOR;
|
$dir = PATH . 'tpl' . DIRECTORY_SEPARATOR;
|
||||||
$file = substr($template, 0, 10) === 'bootstrap-' ? 'bootstrap' : $template;
|
$file = substr($template, 0, 10) === 'bootstrap-' ? 'bootstrap' : $template;
|
||||||
$path = realpath($dir . $file . '.php');
|
$path = $dir . $file . '.php';
|
||||||
if ($path === false) {
|
if (!is_file($path)) {
|
||||||
throw new Exception('Template ' . $template . ' not found!', 80);
|
throw new Exception('Template ' . $template . ' not found in file ' . $path . '!', 80);
|
||||||
}
|
}
|
||||||
foreach (new GlobIterator($dir . '*.php') as $tplFile) {
|
if (!in_array($path, glob($dir . '*.php', GLOB_NOSORT | GLOB_ERR), true)) {
|
||||||
if ($tplFile->getRealPath() === $path) {
|
throw new Exception('Template ' . $file . '.php not found in ' . $dir . '!', 81);
|
||||||
extract($this->_variables);
|
|
||||||
include $path;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
throw new Exception('Template ' . $file . '.php not found in ' . $dir . '!', 81);
|
extract($this->_variables);
|
||||||
|
include $path;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user