Commit | Line | Data |
---|---|---|
3ee590a9 | 1 | <?php |
2 | /******************************************************************************** | |
73d5bf46 | 3 | * include/misc.inc.php : Misc functions |
4 | * ------------------------- | |
5 | * | |
6 | * This file is part of the banana distribution | |
7 | * Copyright: See COPYING files that comes with this distribution | |
8 | ********************************************************************************/ | |
9 | ||
10 | /******************************************************************************** | |
2dbc0167 | 11 | * MISC |
73d5bf46 | 12 | */ |
13 | ||
0ca6e016 | 14 | function _b_($str) { return utf8_decode(dgettext('banana', utf8_encode($str))); } |
0a65ec9d | 15 | |
987299b4 | 16 | function to_entities($str) { |
6918d66a | 17 | require_once dirname(__FILE__).'/utf8.php'; |
987299b4 | 18 | return utf8entities(htmlentities($str, ENT_NOQUOTES, 'UTF-8')); |
382606fb PHM |
19 | } |
20 | ||
c42efe2f PHM |
21 | function is_utf8($s) { return iconv('utf-8', 'utf-8', $s) == $s; } |
22 | ||
8f6f50fb | 23 | function textFormat_translate($format) |
24 | { | |
25 | switch (strtolower($format)) { | |
26 | case 'plain': return _b_('Texte brut'); | |
27 | case 'richtext': return _b_('Texte enrichi'); | |
28 | case 'html': return _b_('HTML'); | |
29 | default: return $format; | |
30 | } | |
31 | } | |
32 | ||
0eb1e7ef | 33 | /** Redirect to the page with the given parameter |
34 | * @ref makeLink | |
35 | */ | |
e8de34ae | 36 | function redirectInBanana($params) |
9cac5c87 | 37 | { |
38 | header('Location: ' . makeLink($params)); | |
39 | } | |
40 | ||
0eb1e7ef | 41 | /** Make a link using the given parameters |
42 | * @param ARRAY params, the parameters with | |
43 | * key => value | |
44 | * Known key are: | |
45 | * - group = group name | |
46 | * - artid/first = article id the the group | |
47 | * - subscribe = to show the subscription page | |
48 | * - action = action to do (new, cancel, view) | |
49 | * - part = to show the given MIME part of the article | |
50 | * - pj = to get the given attachment | |
51 | * | |
52 | * Can be overloaded by defining a hook_makeLink function | |
53 | */ | |
9cac5c87 | 54 | function makeLink($params) |
55 | { | |
0eb1e7ef | 56 | if (function_exists('hook_makeLink') |
57 | && $res = hook_makeLink($params)) { | |
58 | return $res; | |
59 | } | |
60 | $proto = empty($_SERVER['HTTPS']) ? 'http://' : 'https://'; | |
9cac5c87 | 61 | $host = $_SERVER['HTTP_HOST']; |
62 | $file = $_SERVER['PHP_SELF']; | |
63 | ||
0eb1e7ef | 64 | if (count($params) != 0) { |
65 | $get = '?'; | |
66 | foreach ($params as $key=>$value) { | |
67 | if (strlen($get) != 1) { | |
68 | $get .= '&'; | |
69 | } | |
70 | $get .= $key . '=' . $value; | |
71 | } | |
72 | } else { | |
73 | $get = ''; | |
74 | } | |
75 | ||
76 | return $proto . $host . $file . $get; | |
77 | } | |
78 | ||
79 | /** Format a link to be use in a link | |
80 | * @ref makeLink | |
81 | */ | |
82 | function makeHREF($params, $text = null) | |
83 | { | |
84 | $link = makeLink($params); | |
85 | if (is_null($text)) { | |
86 | $text = $link; | |
87 | } | |
5d58099e | 88 | $target = null; |
89 | if (isset($params['action']) && $params['action'] == 'view') { | |
0eb1e7ef | 90 | $target = ' target="_blank"'; |
91 | } | |
92 | return '<a href="' . htmlentities($link) . $target . '">' . $text . '</a>'; | |
9cac5c87 | 93 | } |
94 | ||
8f6f50fb | 95 | /******************************************************************************** |
96 | * HTML STUFF | |
97 | * Taken from php.net | |
98 | */ | |
99 | ||
5d133234 | 100 | /** |
8f6f50fb | 101 | * @return string |
102 | * @param string | |
103 | * @desc Strip forbidden tags and delegate tag-source check to removeEvilAttributes() | |
104 | */ | |
105 | function removeEvilTags($source) | |
106 | { | |
73ab762c | 107 | $allowedTags = '<h1><b><i><a><ul><li><pre><hr><blockquote><img><br><font><p><small><big><sup><sub><code><em>'; |
76032c26 | 108 | $source = preg_replace('|</div>|i', '<br />', $source); |
8f6f50fb | 109 | $source = strip_tags($source, $allowedTags); |
110 | return preg_replace('/<(.*?)>/ie', "'<'.removeEvilAttributes('\\1').'>'", $source); | |
111 | } | |
112 | ||
113 | /** | |
114 | * @return string | |
115 | * @param string | |
116 | * @desc Strip forbidden attributes from a tag | |
117 | */ | |
118 | function removeEvilAttributes($tagSource) | |
119 | { | |
120 | $stripAttrib = 'javascript:|onclick|ondblclick|onmousedown|onmouseup|onmouseover|'. | |
121 | 'onmousemove|onmouseout|onkeypress|onkeydown|onkeyup'; | |
122 | return stripslashes(preg_replace("/$stripAttrib/i", '', $tagSource)); | |
123 | } | |
124 | ||
5d133234 | 125 | /** Convert html to plain text |
126 | */ | |
127 | function htmlToPlainText($res) | |
128 | { | |
76032c26 | 129 | $res = trim(html_entity_decode(strip_tags($res, '<div><br><p>'))); |
130 | $res = preg_replace("@</?(br|p|div)[^>]*>@i", "\n", $res); | |
e27ae1a3 | 131 | if (!is_utf8($res)) { |
132 | $res = utf8_encode($res); | |
133 | } | |
5d133234 | 134 | return $res; |
135 | } | |
136 | ||
137 | /******************************************************************************** | |
138 | * RICHTEXT STUFF | |
139 | */ | |
140 | ||
141 | /** Convert richtext to html | |
142 | */ | |
143 | function richtextToHtml($source) | |
144 | { | |
145 | $tags = Array('bold' => 'b', | |
146 | 'italic' => 'i', | |
147 | 'smaller' => 'small', | |
148 | 'bigger' => 'big', | |
149 | 'underline' => 'u', | |
150 | 'subscript' => 'sub', | |
151 | 'superscript' => 'sup', | |
152 | 'excerpt' => 'blockquote', | |
153 | 'paragraph' => 'p', | |
154 | 'nl' => 'br' | |
155 | ); | |
156 | ||
157 | // clean unsupported tags | |
158 | $protectedTags = '<signature><lt><comment><'.join('><', array_keys($tags)).'>'; | |
159 | $source = strip_tags($source, $protectedTags); | |
160 | ||
161 | // convert richtext tags to html | |
162 | foreach (array_keys($tags) as $tag) { | |
163 | $source = preg_replace('@(</?)'.$tag.'([^>]*>)@i', '\1'.$tags[$tag].'\2', $source); | |
164 | } | |
165 | ||
166 | // some special cases | |
167 | $source = preg_replace('@<signature>@i', '<br>-- <br>', $source); | |
168 | $source = preg_replace('@</signature>@i', '', $source); | |
169 | $source = preg_replace('@<lt>@i', '<', $source); | |
170 | $source = preg_replace('@<comment[^>]*>((?:[^<]|<(?!/comment>))*)</comment>@i', '<!-- \1 -->', $source); | |
171 | return removeEvilAttributes($source); | |
172 | } | |
173 | ||
73d5bf46 | 174 | /******************************************************************************** |
175 | * HEADER STUFF | |
176 | */ | |
177 | ||
dd7d1c59 | 178 | function _headerdecode($charset, $c, $str) { |
67d2dcfc | 179 | $s = ($c == 'Q' || $c == 'q') ? quoted_printable_decode($str) : base64_decode($str); |
dd7d1c59 | 180 | $s = iconv($charset, 'iso-8859-15', $s); |
181 | return str_replace('_', ' ', $s); | |
182 | } | |
183 | ||
184 | function headerDecode($value) { | |
67d2dcfc | 185 | $val = preg_replace('/(=\?[^?]*\?[BQbq]\?[^?]*\?=) (=\?[^?]*\?[BQbq]\?[^?]*\?=)/', '\1\2', $value); |
186 | return preg_replace('/=\?([^?]*)\?([BQbq])\?([^?]*)\?=/e', '_headerdecode("\1", "\2", "\3")', $val); | |
dd7d1c59 | 187 | } |
188 | ||
9cf3f056 PHM |
189 | function headerEncode($value, $trim = 0) { |
190 | if ($trim) { | |
d752880f PHM |
191 | if (strlen($value) > $trim) { |
192 | $value = substr($value, 0, $trim) . "[...]"; | |
193 | } | |
9cf3f056 PHM |
194 | } |
195 | return "=?UTF-8?B?".base64_encode($value)."?="; | |
196 | } | |
197 | ||
e2cae7e3 | 198 | function header_translate($hdr) { |
d4c19591 | 199 | switch ($hdr) { |
0a65ec9d | 200 | case 'from': return _b_('De'); |
201 | case 'subject': return _b_('Sujet'); | |
202 | case 'newsgroups': return _b_('Forums'); | |
d4c19591 | 203 | case 'followup-to': return _b_('Suivi-à'); |
0a65ec9d | 204 | case 'date': return _b_('Date'); |
205 | case 'organization': return _b_('Organisation'); | |
206 | case 'references': return _b_('Références'); | |
d4c19591 | 207 | case 'x-face': return _b_('Image'); |
e2cae7e3 | 208 | default: |
559be3d6 | 209 | if (function_exists('hook_headerTranslate') |
210 | && $res = hook_headerTranslate($hdr)) { | |
211 | return $res; | |
2dbc0167 | 212 | } |
e2cae7e3 | 213 | return $hdr; |
214 | } | |
215 | } | |
216 | ||
2dbc0167 | 217 | function formatDisplayHeader($_header,$_text) { |
218 | global $banana; | |
219 | switch ($_header) { | |
220 | case "date": | |
221 | return formatDate($_text); | |
222 | ||
223 | case "followup-to": | |
224 | case "newsgroups": | |
225 | $res = ""; | |
226 | $groups = preg_split("/[\t ]*,[\t ]*/",$_text); | |
227 | foreach ($groups as $g) { | |
0eb1e7ef | 228 | $res .= makeHREF(Array('group' => $g), $g) . ', '; |
2dbc0167 | 229 | } |
230 | return substr($res,0, -2); | |
231 | ||
232 | case "from": | |
233 | return formatFrom($_text); | |
234 | ||
235 | case "references": | |
236 | $rsl = ""; | |
237 | $ndx = 1; | |
238 | $text = str_replace("><","> <",$_text); | |
239 | $text = preg_split("/[ \t]/",strtr($text,$banana->spool->ids)); | |
240 | $parents = preg_grep("/^\d+$/",$text); | |
241 | $p = array_pop($parents); | |
58d1740e | 242 | $par_ok = Array(); |
2dbc0167 | 243 | |
244 | while ($p) { | |
58d1740e | 245 | $par_ok[]=$p; |
2dbc0167 | 246 | $p = $banana->spool->overview[$p]->parent; |
247 | } | |
58d1740e | 248 | foreach (array_reverse($par_ok) as $p) { |
0eb1e7ef | 249 | $rsl .= makeHREF(Array('group' => $banana->spool->group), $ndx); |
2dbc0167 | 250 | $ndx++; |
251 | } | |
252 | return $rsl; | |
253 | ||
254 | case "x-face": | |
09a8b2b0 | 255 | return '<img src="xface.php?face='.urlencode(base64_encode($_text)).'" alt="x-face" />'; |
2dbc0167 | 256 | |
257 | default: | |
559be3d6 | 258 | if (function_exists('hook_formatDisplayHeader') |
259 | && $res = hook_formatDisplayHeader($_header, $_text)) | |
260 | { | |
261 | return $res; | |
2dbc0167 | 262 | } |
263 | return htmlentities($_text); | |
264 | } | |
265 | } | |
266 | ||
73d5bf46 | 267 | /******************************************************************************** |
268 | * FORMATTING STUFF | |
269 | */ | |
270 | ||
e2cae7e3 | 271 | function formatDate($_text) { |
272 | return strftime("%A %d %B %Y, %H:%M (fuseau serveur)", strtotime($_text)); | |
273 | } | |
274 | ||
275 | function fancyDate($stamp) { | |
276 | $today = intval(time() / (24*3600)); | |
277 | $dday = intval($stamp / (24*3600)); | |
278 | ||
279 | if ($today == $dday) { | |
280 | $format = "%H:%M"; | |
281 | } elseif ($today == 1 + $dday) { | |
0a65ec9d | 282 | $format = _b_('hier')." %H:%M"; |
e2cae7e3 | 283 | } elseif ($today < 7 + $dday) { |
1248ebac | 284 | $format = '%a %H:%M'; |
e2cae7e3 | 285 | } else { |
286 | $format = '%a %e %b'; | |
287 | } | |
288 | return strftime($format, $stamp); | |
289 | } | |
290 | ||
dd7d1c59 | 291 | function formatFrom($text) { |
292 | # From: mark@cbosgd.ATT.COM | |
293 | # From: mark@cbosgd.ATT.COM (Mark Horton) | |
294 | # From: Mark Horton <mark@cbosgd.ATT.COM> | |
295 | $mailto = '<a href="mailto:'; | |
296 | ||
297 | $result = htmlentities($text); | |
298 | if (preg_match("/^([^ ]+)@([^ ]+)$/",$text,$regs)) { | |
299 | $result="$mailto{$regs[1]}@{$regs[2]}\">".htmlentities($regs[1]."@".$regs[2])."</a>"; | |
300 | } | |
301 | if (preg_match("/^([^ ]+)@([^ ]+) \((.*)\)$/",$text,$regs)) { | |
302 | $result="$mailto{$regs[1]}@{$regs[2]}\">".htmlentities($regs[3])."</a>"; | |
303 | } | |
304 | if (preg_match("/^\"?([^<>\"]+)\"? +<(.+)@(.+)>$/",$text,$regs)) { | |
305 | $result="$mailto{$regs[2]}@{$regs[3]}\">".htmlentities($regs[1])."</a>"; | |
306 | } | |
307 | return preg_replace("/\\\(\(|\))/","\\1",$result); | |
308 | } | |
309 | ||
f78f34d2 | 310 | function displayshortcuts($first = -1) { |
41cf00eb | 311 | global $banana; |
8d99c683 | 312 | extract($banana->state); |
313 | ||
559be3d6 | 314 | $res = '<div class="banana_scuts">'; |
0eb1e7ef | 315 | $res .= '[' . makeHREF(Array(), _b_('Liste des forums')) . '] '; |
8d99c683 | 316 | if (is_null($group)) { |
0eb1e7ef | 317 | return $res.'[' . makeHREF(Array('subscribe' => 1), _b_('Abonnements')) . ']</div>'; |
8d99c683 | 318 | } |
319 | ||
0eb1e7ef | 320 | $res .= '[' . makeHREF(Array('group' => $group), $group) . '] '; |
8d99c683 | 321 | |
322 | if (is_null($artid)) { | |
0eb1e7ef | 323 | $res .= '[' . makeHREF(Array('group' => $group, |
324 | 'action' => 'new'), | |
325 | _b_('Nouveau message')) | |
326 | . '] '; | |
8d99c683 | 327 | if (sizeof($banana->spool->overview)>$banana->tmax) { |
328 | $res .= '<br />'; | |
329 | $n = intval(log(count($banana->spool->overview), 10))+1; | |
330 | for ($ndx=1; $ndx <= sizeof($banana->spool->overview); $ndx += $banana->tmax) { | |
331 | if ($first==$ndx) { | |
332 | $fmt = "[%0{$n}u-%0{$n}u] "; | |
333 | } else { | |
0eb1e7ef | 334 | $fmt = '[' . makeHREF(Array('group' => $group, |
335 | 'first' => $ndx), | |
336 | '%0' . $n . 'u-%0' . $n . 'u') | |
337 | . '] '; | |
f78f34d2 | 338 | } |
8d99c683 | 339 | $res .= sprintf($fmt, $ndx, min($ndx+$banana->tmax-1,sizeof($banana->spool->overview))); |
f78f34d2 | 340 | } |
8d99c683 | 341 | } |
342 | } else { | |
0eb1e7ef | 343 | $res .= '[' . makeHREF(Array('group' => $group, |
344 | 'artid' => $artid, | |
345 | 'action' => 'new'), | |
346 | _b_('Répondre')) | |
347 | . '] '; | |
940ae667 | 348 | if ($banana->post && $banana->post->checkcancel()) { |
0eb1e7ef | 349 | $res .= '[' . makeHREF(Array('group' => $group, |
350 | 'artid' => $artid, | |
351 | 'action' => 'cancel'), | |
352 | _b_('Annuler ce message')) | |
353 | . '] '; | |
8d99c683 | 354 | } |
f78f34d2 | 355 | } |
8d99c683 | 356 | return $res.'</div>'; |
f78f34d2 | 357 | } |
358 | ||
359 | /******************************************************************************** | |
360 | * FORMATTING STUFF : BODY | |
361 | */ | |
362 | ||
28fb1083 | 363 | function autoformat($text) |
364 | { | |
365 | global $banana; | |
366 | $length = $banana->wrap; | |
367 | ||
368 | $cmd = "echo ".escapeshellarg($text)." | perl -MText::Autoformat -e 'autoformat {left=>1, right=>$length, all=>1 };'"; | |
369 | exec($cmd, $result, $ret); | |
370 | if ($ret != 0) { | |
9ee36ea4 | 371 | $result = split("\n", $text); |
28fb1083 | 372 | } |
373 | return $result; | |
374 | } | |
375 | ||
e04e6059 | 376 | function wrap($text, $_prefix="", $_force=false) |
cced14b6 | 377 | { |
dd7d1c59 | 378 | $parts = preg_split("/\n-- ?\n/", $text); |
276debfc | 379 | if (count($parts) >1) { |
380 | $sign = "\n-- \n" . array_pop($parts); | |
381 | $text = join("\n-- \n", $parts); | |
3ee590a9 | 382 | } else { |
276debfc | 383 | $sign = ''; |
3ee590a9 | 384 | } |
2dbc0167 | 385 | |
386 | global $banana; | |
e04e6059 | 387 | $url = $banana->url_regexp; |
2dbc0167 | 388 | $length = $banana->wrap; |
e04e6059 | 389 | $max = $length + ($length/10); |
390 | $splits = split("\n", $text); | |
28fb1083 | 391 | $result = array(); |
392 | $next = array(); | |
393 | $format = false; | |
e04e6059 | 394 | foreach ($splits as $line) { |
395 | if ($_force || strlen($line) > $max) { | |
28fb1083 | 396 | if (preg_match("!^(.*)($url)(.*)!i", $line, $matches) && strlen($matches[2]) > $length && strlen($matches) < 900) { |
397 | if (strlen($matches[1]) != 0) { | |
398 | array_push($next, rtrim($matches[1])); | |
399 | if (strlen($matches[1]) > $max) { | |
400 | $format = true; | |
401 | } | |
402 | } | |
403 | ||
404 | if ($format) { | |
405 | $result = array_merge($result, autoformat(join("\n", $next))); | |
406 | } else { | |
407 | $result = array_merge($result, $next); | |
408 | } | |
409 | $format = false; | |
410 | $next = array(); | |
411 | array_push($result, $matches[2]); | |
412 | ||
413 | if (strlen($matches[6]) != 0) { | |
414 | array_push($next, ltrim($matches[6])); | |
415 | if (strlen($matches[6]) > $max) { | |
416 | $format = true; | |
417 | } | |
418 | } | |
419 | } else { | |
420 | $format = true; | |
421 | array_push($next, $line); | |
e04e6059 | 422 | } |
28fb1083 | 423 | } else { |
424 | array_push($next, $line); | |
e04e6059 | 425 | } |
426 | } | |
28fb1083 | 427 | if ($format) { |
428 | $result = array_merge($result, autoformat(join("\n", $next))); | |
429 | } else { | |
430 | $result = array_merge($result, $next); | |
ee4709c7 | 431 | } |
3ee590a9 | 432 | |
f8e23519 | 433 | return $_prefix.join("\n$_prefix", $result).($_prefix ? '' : $sign); |
3ee590a9 | 434 | } |
435 | ||
e04e6059 | 436 | function cutlink($link) |
437 | { | |
438 | global $banana; | |
439 | ||
440 | if (strlen($link) > $banana->wrap) { | |
441 | $link = substr($link, 0, $banana->wrap - 3)."..."; | |
442 | } | |
443 | return $link; | |
444 | } | |
445 | ||
4c921acf | 446 | function cleanurl($url) |
447 | { | |
448 | $url = str_replace('@', '%40', $url); | |
449 | return '<a href="'.$url.'" title="'.$url.'">'.cutlink($url).'</a>'; | |
450 | } | |
451 | ||
e04e6059 | 452 | function formatbody($_text, $format='plain', $flowed=false) |
8f6f50fb | 453 | { |
454 | if ($format == 'html') { | |
76032c26 | 455 | $res = '<br/>'.html_entity_decode(to_entities(removeEvilTags($_text))).'<br/>'; |
5d133234 | 456 | } else if ($format == 'richtext') { |
09f71105 | 457 | $res = '<br/>'.html_entity_decode(to_entities(richtextToHtml($_text))).'<br/>'; |
8f6f50fb | 458 | } else { |
e04e6059 | 459 | $res = "\n\n" . to_entities(wrap($_text, "", $flowed))."\n\n"; |
03851c08 | 460 | $formatting = Array('\*' => 'strong', |
461 | '_' => 'u', | |
462 | '/' => 'em'); | |
463 | foreach ($formatting as $limit=>$mark) { | |
464 | $res = preg_replace('@' . $limit . '([^\s]+)' . $limit . '@', "<$mark>\\1</$mark>", $res); | |
465 | } | |
466 | } | |
8f6f50fb | 467 | |
09f71105 | 468 | if ($format != 'html') { |
469 | global $banana; | |
470 | $url = $banana->url_regexp; | |
471 | $res = preg_replace("/(<|>|")/", " \\1 ", $res); | |
4c921acf | 472 | $res = preg_replace("!$url!ie", "'\\1'.cleanurl('\\2').'\\3'", $res); |
09f71105 | 473 | $res = preg_replace('/(["\[])?(?:mailto:)?([a-z0-9.\-+_]+@[a-z0-9.\-+_]+)(["\]])?/i', '\1<a href="mailto:\2">\2</a>\3', $res); |
474 | $res = preg_replace("/ (<|>|") /", "\\1", $res); | |
475 | ||
476 | if ($format == 'richtext') { | |
477 | $format = 'html'; | |
478 | } | |
479 | } | |
e04e6059 | 480 | |
8f6f50fb | 481 | if ($format == 'html') { |
9c192e03 | 482 | $res = preg_replace("@(</p>)\n?-- ?\n?(<p[^>]*>|<br[^>]*>)@", "\\1<br/>-- \\2", $res); |
483 | $res = preg_replace("@<br[^>]*>\n?-- ?\n?(<p[^>]*>)@", "<br/>-- <br/>\\2", $res); | |
484 | $res = preg_replace("@(<pre[^>]*>)\n?-- ?\n@", "<br/>-- <br/>\\1", $res); | |
485 | $parts = preg_split("@(:?<p[^>]*>\n?-- ?\n?</p>|<br[^>]*>\n?-- ?\n?<br[^>]*>)@", $res); | |
f5eb6c66 | 486 | } else { |
9ee36ea4 | 487 | while (preg_match("@(^|<pre>|\n)>@i", $res)) { |
b7a8ff33 | 488 | $res = preg_replace("@(^|<pre>|\n)((>[^\n]*\n)+)@ie", |
9ee36ea4 | 489 | "'\\1</pre><blockquote><pre>'" |
4c1df590 | 490 | .".stripslashes(preg_replace('@(^|<pre>|\n)>[ \\t\\r]*@i', '\\1', '\\2'))" |
491 | .".'</pre></blockquote><pre>'", | |
492 | $res); | |
73afa785 | 493 | } |
73dfe367 | 494 | $res = preg_replace("@<pre>-- ?\n@", "<pre>\n-- \n", $res); |
f5eb6c66 | 495 | $parts = preg_split("/\n-- ?\n/", $res); |
8f6f50fb | 496 | } |
497 | ||
dd7d1c59 | 498 | if (count($parts) > 1) { |
f5eb6c66 | 499 | $sign = array_pop($parts); |
500 | if ($format == 'html') { | |
501 | $res = join('<br/>-- <br/>', $parts); | |
73afa785 | 502 | $sign = '<hr style="width: 100%; margin: 1em 0em; " />'.$sign.'<br/>'; |
f5eb6c66 | 503 | } else { |
504 | $res = join('\n-- \n', $parts); | |
505 | $sign = '</pre><hr style="width: 100%; margin: 1em 0em; " /><pre>'.$sign; | |
506 | } | |
507 | return $res.$sign; | |
dd7d1c59 | 508 | } else { |
509 | return $res; | |
510 | } | |
cced14b6 | 511 | } |
512 | ||
3ee590a9 | 513 | ?> |