From c46d07cde5e74da47b3aafc773a340368483e814 Mon Sep 17 00:00:00 2001 From: Ian <aristophian@googlemail.com> Date: Sat, 24 May 2014 19:41:40 +0200 Subject: [PATCH] fixes entry preview exception - fixes #119 --- include/functions_smarty.inc.php | 10 ++++++++-- include/serendipity_smarty_class.inc.php | 4 +++- templates/2k11/admin/entries.inc.tpl | 2 +- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/include/functions_smarty.inc.php b/include/functions_smarty.inc.php index 447fe4b3..0fb27983 100644 --- a/include/functions_smarty.inc.php +++ b/include/functions_smarty.inc.php @@ -928,6 +928,11 @@ function serendipity_smarty_init($vars = array()) { #echo '<pre>';print_r($serendipity['smarty']);echo '</pre>';#exit; #$serendipity['smarty']->testInstall();exit; + // since 2k11/admin/entries.tpl is the default fallback for preview cases, we need to register that missing modifier for templates without tpls. + if (!function_exists('serendipity_smarty_html5time')) { + function serendipity_smarty_html5time($timestamp) { return date("c", $timestamp); } + $serendipity['smarty']->registerPlugin('modifier', 'serendipity_html5time', 'serendipity_smarty_html5time'); + } /** * ToDo: Check for possible API changes in Smarty 3.2 [smarty_modifier_foobar, --> [smarty_modifier_foobar, smarty_function_foobar, smarty_block_foobar] (in class)] * smarty_modifier_foobar(Smarty $smarty, $string, �) vs. smarty_modifier_foobar($string, �) @@ -1132,10 +1137,11 @@ function serendipity_smarty_shutdown($serendipity_directory = '') { $serendipity['smarty']->display(serendipity_getTemplateFile($serendipity['smarty_file'], 'serendipityPath')); } -/* Render a smarty-template +/** + * Render a smarty-template * $template: path to the template-file * $data: map with the variables to assign - * */ + */ function serendipity_smarty_show($template, $data = null) { global $serendipity; diff --git a/include/serendipity_smarty_class.inc.php b/include/serendipity_smarty_class.inc.php index a2d37f07..3223abd3 100644 --- a/include/serendipity_smarty_class.inc.php +++ b/include/serendipity_smarty_class.inc.php @@ -126,8 +126,10 @@ class Serendipity_Smarty extends Smarty foreach($p AS $te) { $template_dirs[] = $serendipity['serendipityPath'] . $serendipity['templatePath'] . trim($te) . '/'; } + } else { + // this is tested without need actually, but it makes the directory setter fallback chain a little more precise + $template_dirs[] = $serendipity['serendipityPath'] . $serendipity['templatePath'] . $serendipity['template']; } - $template_dirs[] = $serendipity['serendipityPath'] . $serendipity['templatePath'] . $serendipity['defaultTemplate']; $template_dirs[] = $serendipity['serendipityPath'] . $serendipity['templatePath'] . $serendipity['template_backend']; diff --git a/templates/2k11/admin/entries.inc.tpl b/templates/2k11/admin/entries.inc.tpl index d6833813..092b2d4c 100644 --- a/templates/2k11/admin/entries.inc.tpl +++ b/templates/2k11/admin/entries.inc.tpl @@ -1,5 +1,5 @@ {if $drawList} -<div class="has_toolbar"> +<div class="has_toolbar"> <h2>{$CONST.EDIT_ENTRIES}</h2> <form action="?" method="get">