case "from":
return formatFrom($_text);
-
+
case "references":
$rsl = "";
$ndx = 1;
function makeTable($text)
{
+ $links = null;
+ if (function_exists('hook_browsingAction')) {
+ $links = hook_browsingAction();
+ }
+
return '<table class="cadre_a_onglet" cellpadding="0" cellspacing="0" width="100%">'
. '<tr><td>'
. displayTabs()
. '</td></tr>'
. '<tr><td class="conteneur_tab">'
+ . $links
. $text
. '</td></tr>'
. '</table>';
* FORMATTING STUFF : BODY
*/
-function autoformat($text)
+function autoformat($text, $force = 0)
{
global $banana;
$length = $banana->wrap;
-
+ $force = $force ? 1 : 0;
$cmd = 'echo ' . escapeshellarg($text)
- . ' | perl -MText::Autoformat -e \'autoformat {left=>1, right=>' . $length . ', all=>1 };\'';
+ . ' | perl -MText::Autoformat -e \'autoformat {left=>1, right=>' . $length . ', all=>' . $force . ' };\'';
exec($cmd, $result, $ret);
if ($ret != 0) {
return $result;
}
-function wrap($text, $_prefix="", $_force=false)
+function wrap($text, $_prefix="", $_force=false, $firstpass = true)
{
$parts = preg_split("/\n-- ?\n/", $text);
if (count($parts) >1) {
}
if ($format) {
- $result = array_merge($result, autoformat(join("\n", $next)));
+ $result = array_merge($result, autoformat(join("\n", $next), $firstpass));
} else {
$result = array_merge($result, $next);
}
}
}
if ($format) {
- $result = array_merge($result, autoformat(join("\n", $next)));
+ $result = array_merge($result, autoformat(join("\n", $next), $firstpass));
} else {
$result = array_merge($result, $next);
}
- return $_prefix.join("\n$_prefix", $result).($_prefix ? '' : $sign);
+ $break = "\n";
+ $prefix = null;
+ if (!$firstpass) {
+ $break .= $_prefix;
+ $prefix = $_prefix;
+ }
+ $result = $prefix.join($break, $result).($prefix ? '' : $sign);
+ if ($firstpass) {
+ return wrap($result, $_prefix, $_force, false);
+ }
+ return $result;
}
function cutlink($link)
function catchMailLink($email)
{
- if (strpos($email, '$') !== false) {
+ global $banana;
+ $mid = '<' . $email . '>';
+ if (isset($banana->spool->ids[$mid])) {
+ return makeHREF(Array('group' => $banana->state['group'],
+ 'artid' => $banana->spool->ids[$mid]),
+ $email);
+ } elseif (strpos($email, '$') !== false) {
return $email;
}
return '<a href="mailto:' . $email . '">' . $email . '</a>';
$url = $banana->url_regexp;
$res = preg_replace("/(<|>|")/", " \\1 ", $res);
$res = preg_replace("!$url!ie", "'\\1'.cleanurl('\\2').'\\3'", $res);
- $res = preg_replace('/(["\[])?(?:mailto:)?([a-z0-9.\-+_\$]+@[a-z0-9.\-+_]+)(["\]])?/ie',
- "'\\1' . catchMailLink('\\2') . '\\3'",
+ $res = preg_replace('/(["\[])?(?:mailto:|news:)?([a-z0-9.\-+_\$]+@([\-.+_]?[a-z0-9])+)(["\]])?/ie',
+ "'\\1' . catchMailLink('\\2') . '\\4'",
$res);
$res = preg_replace("/ (<|>|") /", "\\1", $res);
$sign = '<hr style="width: 100%; margin: 1em 0em; " />';
} else {
while (preg_match("@(^|<pre>|\n)>@i", $res)) {
- $res = preg_replace("@(^|<pre>|\n)((>[^\n]*\n)+)@ie",
+ $res = preg_replace("@(^|<pre>|\n)((>[^\n]*(?:\n|$))+)@ie",
"'\\1</pre><blockquote><pre>'"
." . replaceQuotes('\\2')"
." . '</pre></blockquote><pre>'",