page.inc.php | 14 ++++++++------
spool.inc.php | 6 +++---
templates/banana-base.tpl | 4 ++--
templates/banana-message.inc.tpl | 6 +++---
templates/banana-newmessage.inc.tpl | 4 ++--
templates/banana-thread.inc.tpl | 24 ++++++++----------------
text.func.inc.php | 9 +++++++++
7 files changed, 35 insertions(+), 32 deletions(-)
git-svn-id: svn+ssh://murphy/home/svn/banana/trunk@249
9869982d-c50d-0410-be91-
f2a2ec7c7c7b
$this->register_function('imglink', array($this, 'makeImgLink'));
$this->register_function('img', array($this, 'makeImg'));
$this->register_modifier('b', '_b_');
- $this->register_modifier('htmlentities', 'banana_htmlentities');
$this->assign('errors', $this->error);
$this->assign('page', $this->page);
$this->assign('pages', $this->pages);
$this->assign('actions', $this->actions);
+ $this->register_modifier('banana_utf8entities', 'banana_utf8entities');
+ $this->register_modifier('banana_entities', 'banana_entities');
+
+ if ($ent) {
+ $this->default_modifiers = Array('@banana_entities');
+ }
if (!Banana::$debug_smarty) {
$error_level = error_reporting(0);
}
$text = $this->fetch($tpl);
- if ($ent) {
- $text = banana_utf8entities($text);
- }
if (!Banana::$debug_smarty) {
error_reporting($error_level);
}
$popup .= ' (raccourci : ' . $accesskey . ')';
}
if (!is_null($popup)) {
- $popup = ' title="' . banana_htmlentities($popup) . '"';
+ $popup = ' title="' . banana_entities($popup) . '"';
}
if (!is_null($class)) {
$class = ' class="' . $class . '"';
if (!is_null($accesskey)) {
$accesskey = ' accesskey="' . $accesskey . '"';
}
- return '<a href="' . banana_htmlentities($link) . '"'
+ return '<a href="' . banana_entities($link) . '"'
. $popup . $class . $accesskey
. '>' . $text . '</a>';
}
$res .= '<td class="subj' . ($_index == $_ref ? ' cur' : '') . '"><div class="tree">'
. $_pfx_node .($hc ? ($_head ? $spfx_f : ($overview->parent_direct ? $spfx_s : $spfx_snd)) : $spfx_n)
. '</div>';
- $subject = $overview->subject;
+ $popup = $subject = $overview->subject;
if (function_exists('hook_formatDisplayHeader')) {
list($subject, $link) = hook_formatDisplayHeader('subject', $subject, true);
} else {
- $subject = banana_catchFormats(banana_htmlentities(stripslashes($subject)));
+ $subject = banana_catchFormats(banana_entities(stripslashes($subject)));
$link = null;
}
if (empty($subject)) {
}
if ($_index != $_ref) {
$subject = Banana::$page->makeLink(Array('group' => $this->group, 'artid' => $_id,
- 'text' => $subject, 'popup' => $subject));
+ 'text' => $subject, 'popup' => $popup));
}
$res .= ' ' . $subject . $link;
$res .= "</td>\n<td class='from'>" . BananaMessage::formatFrom($overview->from) . "</td>\n</tr>";
<div class="banana">
{/if}
{foreach from=$errors item=error}
- <p class="error">{$error}</p>
+ <p class="error">{$error|smarty:nodefaults}</p>
{/foreach}
{if !$killed}
{foreach from=$actions item=act}
- <p class="center" style="padding: 0; margin: 0 0 1em 0">{$act.text}</p>
+ <p class="center" style="padding: 0; margin: 0 0 1em 0">{$act.text|smarty:nodefaults}</p>
{/foreach}
{if $page eq 'forums'}
{include file="banana-boxlist.inc.tpl" grouplist=$groups withstats=true withfeed=$feed_active}
{/if}
</div>
{/if}
- {$message->translateHeaderValue('subject')}
+ {$message->translateHeaderValue('subject')|smarty:nodefaults}
</th>
</tr>
{foreach from=$headers name=headers item=hdr}
<tr class="pair">
<td class="hdr">{$message->translateHeaderName($hdr)}</td>
- <td>{$message->translateHeaderValue($hdr)}</td>
+ <td>{$message->translateHeaderValue($hdr)|smarty:nodefaults}</td>
{if $smarty.foreach.headers.first}
<td class="xface" rowspan="{$headers|@count}">
{if $message->hasXFace()}
{/if}
<tr>
<td colspan="3" class="body">
- {$body}
+ {$body|banana_utf8entities|smarty:nodefaults}
</td>
</tr>
</table>
{foreach from=$headers key=header item=values}
<tr class="pair">
<td>
- {$values.name|htmlentities}
+ {$values.name}
</td>
<td>
{if $values.fixed}
- {$values.fixed|htmlentities}
+ {$values.fixed}
{else}
<input type="text" name="{$header}" value="{$values.user|default:$smarty.request.$header}" size="50" />
{/if}
+{capture name=pages}
{if $withtitle}
<div class="pages">
-{if $spool->overview|@count > $msgbypage}
+{if $spool->overview|@count gt $msgbypage}
{section name=pages loop=$spool->overview step=$msgbypage}
- {if $first >= $smarty.section.pages.index && $first < $smarty.section.pages.index_next}
+ {if $first ge $smarty.section.pages.index && $first lt $smarty.section.pages.index_next}
<strong>{$smarty.section.pages.iteration}</strong>
{else}
{link group=$group first=$smarty.section.pages.index text=$smarty.section.pages.iteration}
{/if}
</div>
{/if}
+{/capture}
+
+{$smarty.capture.pages|smarty:nodefaults}
<table class="bicol thread">
<tr>
{if $withtitle}
{/if}
</tr>
{if $spool->overview|@count}
- {if $artid}{$spool->toHtml($artid, true)}{else}{$spool->toHtml($first)}{/if}
+ {if $artid}{$spool->toHtml($artid, true)|smarty:nodefaults}{else}{$spool->toHtml($first)|smarty:nodefaults}{/if}
{else}
<tr>
<td colspan="3">
{if $showboxlist}
{include file="banana-boxlist.inc.tpl" grouplist=$groups withstats=true}
{/if}
-{if $withtitle}
-<div class="pages">
-{if $spool->overview|@count > $msgbypage}
-{section name=pages loop=$spool->overview step=$msgbypage}
- {if $first >= $smarty.section.pages.index && $first < $smarty.section.pages.index_next}
- <strong>{$smarty.section.pages.iteration}</strong>
- {else}
- {link group=$group first=$smarty.section.pages.index text=$smarty.section.pages.iteration}
- {/if}
-{/section}
-{/if}
-</div>
-{/if}
+{$smarty.capture.pages|smarty:nodefaults}
{* vim:set et sw=2 sts=2 ts=2 enc=utf-8: *}
}\r
}\r
\r
+function banana_entities($source)\r
+{\r
+ if (is_string($source) || is_numeric($source)) {\r
+ return banana_htmlentities($source);\r
+ } else {\r
+ return $source;\r
+ }\r
+}\r
+\r
function banana_utf8entities($source)\r
{\r
// array used to figure what number to decrement from character order value \r