mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-04 01:01:41 +09:00
Fix random content being replaced for widget output if skin path does not exist
This commit is contained in:
parent
06f23f3b3b
commit
827499bee3
2 changed files with 27 additions and 6 deletions
|
|
@ -63,6 +63,24 @@ class TemplateHandler
|
|||
return $oTemplate;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reset all instance properties to the default state.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function resetState()
|
||||
{
|
||||
$this->path = null;
|
||||
$this->web_path = null;
|
||||
$this->filename = null;
|
||||
$this->file = null;
|
||||
$this->compiled_file = null;
|
||||
$this->config = new stdClass;
|
||||
$this->skipTags = null;
|
||||
$this->compiled_file = null;
|
||||
self::$rootTpl = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* set variables for template compile
|
||||
* @param string $tpl_path
|
||||
|
|
@ -76,6 +94,7 @@ class TemplateHandler
|
|||
$tpl_path = trim(preg_replace('@^' . preg_quote(\RX_BASEDIR, '@') . '|\./@', '', str_replace('\\', '/', $tpl_path)), '/') . '/';
|
||||
if($tpl_path === '/' || !is_dir($tpl_path))
|
||||
{
|
||||
$this->resetState();
|
||||
return;
|
||||
}
|
||||
if(!file_exists(\RX_BASEDIR . $tpl_path . $tpl_filename) && file_exists(\RX_BASEDIR . $tpl_path . $tpl_filename . '.html'))
|
||||
|
|
@ -122,8 +141,8 @@ class TemplateHandler
|
|||
// if target file does not exist exit
|
||||
if(!$this->file || !file_exists($this->file))
|
||||
{
|
||||
$tpl_path = str_replace('\\', '/', $tpl_path);
|
||||
$error_message = "Template not found: ${tpl_path}${tpl_filename}" . ($tpl_file ? " (${tpl_file})" : '');
|
||||
$tpl_path = rtrim(str_replace('\\', '/', $tpl_path), '/') . '/';
|
||||
$error_message = "Template not found: ${tpl_path}${tpl_filename}.html" . ($tpl_file ? " (${tpl_file})" : '');
|
||||
trigger_error($error_message, \E_USER_WARNING);
|
||||
return escape($error_message);
|
||||
}
|
||||
|
|
@ -145,7 +164,9 @@ class TemplateHandler
|
|||
$tmpfilename = tempnam(sys_get_temp_dir(), 'rx-compiled');
|
||||
if($tmpfilename === false || Rhymix\Framework\Storage::write($tmpfilename, $buff) === false)
|
||||
{
|
||||
return 'Fatal Error : Cannot create temporary file. Please check permissions.';
|
||||
$error_message = 'Template compile failed: Cannot create temporary file. Please check permissions.';
|
||||
trigger_error($error_message, \E_USER_WARNING);
|
||||
return escape($error_message);
|
||||
}
|
||||
|
||||
$this->compiled_file = $tmpfilename;
|
||||
|
|
@ -189,8 +210,8 @@ class TemplateHandler
|
|||
// if target file does not exist exit
|
||||
if(!$this->file || !file_exists($this->file))
|
||||
{
|
||||
$tpl_path = str_replace('\\', '/', $tpl_path);
|
||||
$error_message = "Template not found: ${tpl_path}${tpl_filename}";
|
||||
$tpl_path = rtrim(str_replace('\\', '/', $tpl_path), '/') . '/';
|
||||
$error_message = "Template not found: ${tpl_path}${tpl_filename}.html";
|
||||
trigger_error($error_message, \E_USER_WARNING);
|
||||
return escape($error_message);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -736,7 +736,7 @@ class content extends WidgetHandler
|
|||
|
||||
function _compile($args,$content_items)
|
||||
{
|
||||
$oTemplate = &TemplateHandler::getInstance();
|
||||
$oTemplate = TemplateHandler::getInstance();
|
||||
// Set variables for widget
|
||||
$widget_info = new stdClass();
|
||||
$widget_info->modules_info = $args->modules_info;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue