From e0ca46288cc416a7de4f5738b94741de395a81cb Mon Sep 17 00:00:00 2001 From: garvinhicking Date: Fri, 6 Jan 2006 17:19:22 +0000 Subject: [PATCH] Abstraction to allow live comments --- docs/NEWS | 3 +++ include/functions_comments.inc.php | 7 ++++--- include/functions_smarty.inc.php | 6 +++++- include/genpage.inc.php | 3 ++- templates/default/commentform.tpl | 5 +++-- templates/default/comments.tpl | 5 +++-- templates/kubrick/comments.tpl | 5 +++-- 7 files changed, 23 insertions(+), 11 deletions(-) diff --git a/docs/NEWS b/docs/NEWS index 8eba31e..0bf4601 100644 --- a/docs/NEWS +++ b/docs/NEWS @@ -78,6 +78,9 @@ Version 1.0 () Version 0.9.2 () ------------------------------------------------------------------------ + * Fix server locale order to always first use the charset locale + instead of a generic locale. Fixes bug #1384978 (garvinhicking) + * Fix entry quicksearch on postgresql, where it returned the same entry multiple times if it was contained in multiple categories. Fix by Robert Treat, many thanks! diff --git a/include/functions_comments.inc.php b/include/functions_comments.inc.php index 5611c3d..3003d3c 100644 --- a/include/functions_comments.inc.php +++ b/include/functions_comments.inc.php @@ -188,7 +188,8 @@ function serendipity_generateCommentList($id, $comments = NULL, $selected = 0, $ } } - $retval = $parent ? '' : ''; + $i = 0; foreach ($comments as $comment) { if ($comment['parent_id'] == $parent) { @@ -243,14 +244,14 @@ function serendipity_printComments($comments, $parentid = 0, $depth = 0, $trace if (!empty($comment['url']) && substr($comment['url'], 0, 7) != 'http://' && substr($comment['url'], 0, 8) != 'https://') { $comment['url'] = 'http://' . $comment['url']; } - + if (!empty($comment['url'])) { if (!@parse_url($comment['url'])) { $comment['url'] = ''; } $comment['url'] = htmlspecialchars($comment['url'], ENT_QUOTES); } - + serendipity_plugin_api::hook_event('frontend_display', $comment); if (isset($comment['no_email']) && $comment['no_email']) { diff --git a/include/functions_smarty.inc.php b/include/functions_smarty.inc.php index 0063013..3db39da 100644 --- a/include/functions_smarty.inc.php +++ b/include/functions_smarty.inc.php @@ -523,7 +523,7 @@ function &serendipity_replaceSmartyVars(&$tpl_source, &$smarty) { * @access public * @return null */ -function serendipity_smarty_init() { +function serendipity_smarty_init($vars = array()) { global $serendipity; if (!isset($serendipity['smarty'])) { @@ -633,6 +633,10 @@ function serendipity_smarty_init() { ) ); + if (count($vars) > 0) { + $serendipity['smarty']->assign($vars); + } + // For advanced usage, we allow template authors to create a file 'config.inc.php' where they can // setup custom smarty variables, modifiers etc. to use in their templates. @include_once $serendipity['smarty']->config_dir . '/config.inc.php'; diff --git a/include/genpage.inc.php b/include/genpage.inc.php index da4b32a..8e156ea 100644 --- a/include/genpage.inc.php +++ b/include/genpage.inc.php @@ -14,8 +14,9 @@ if ((empty($uri_addData['uriargs']) || trim($uri_addData['uriargs']) == $serendi $uri_addData['startpage'] = true; } +$serendipity['plugindata']['smartyvars'] = array(); // Plugins can change this global variable serendipity_plugin_api::hook_event('genpage', $uri, $uri_addData); -serendipity_smarty_init(); +serendipity_smarty_init($serendipity['plugindata']['smartyvars']); $serendipity['smarty']->assign( array( diff --git a/templates/default/commentform.tpl b/templates/default/commentform.tpl index b00dd89..071af1c 100644 --- a/templates/default/commentform.tpl +++ b/templates/default/commentform.tpl @@ -1,4 +1,5 @@ -
+
+
@@ -52,7 +53,7 @@   - +
diff --git a/templates/default/comments.tpl b/templates/default/comments.tpl index c3d82b0..e8873f3 100644 --- a/templates/default/comments.tpl +++ b/templates/default/comments.tpl @@ -1,6 +1,6 @@ {foreach from=$comments item=comment} -
+
{$comment.body}
#{$comment.trace} @@ -18,7 +18,8 @@ (delete) {/if} {if $entry.allow_comments} - ({$CONST.REPLY}) + ({$CONST.REPLY}) +
{/if}
diff --git a/templates/kubrick/comments.tpl b/templates/kubrick/comments.tpl index 97375e5..d600f93 100644 --- a/templates/kubrick/comments.tpl +++ b/templates/kubrick/comments.tpl @@ -6,14 +6,15 @@ {else} {$comment.author|@default:$CONST.ANONYMOUS} {/if} {$CONST.SAYS}:
-