_(...) -> _b_(...)
[banana.git] / install.d / format.inc.php
1 <?php
2 /********************************************************************************
3 * install.d/format.inc.php : HTML output subroutines
4 * --------------------------
5 *
6 * This file is part of the banana distribution
7 * Copyright: See COPYING files that comes with this distribution
8 ********************************************************************************/
9
10 /** produces HTML ouput for header section in post.php
11 * @param $_header STRING name of the header
12 * @param $_text STRING value of the header
13 * @param $_spool OBJECT spool object for building references
14 * @return STRING HTML output
15 */
16
17 function formatDisplayHeader($_header,$_text,$_spool) {
18 switch ($_header) {
19 case "date":
20 return formatDate($_text);
21
22 case "followup":
23 case "newsgroups":
24 $res = "";
25 $groups = preg_split("/(\t| )*,(\t| )*/",$_text);
26 foreach ($groups as $g) {
27 $res.='<a href="thread.php?group='.$g.'">'.$g.'</a>, ';
28 }
29 return substr($res,0, -2);
30
31 case "from":
32 return formatFrom($_text);
33
34 case "references":
35 $rsl = "";
36 $ndx = 1;
37 $text=str_replace("><","> <",$_text);
38 $text=preg_split("/( |\t)/",strtr($text,$_spool->ids));
39 $parents=preg_grep("/^\d+$/",$text);
40 $p=array_pop($parents);
41 while ($p) {
42 $rsl .= "<a href=\"article.php?group={$_spool->group}"
43 ."&amp;id=$p\">$ndx</a> ";
44 $_spool->overview[$p]->desc++;
45 $p = $_spool->overview[$p]->parent;
46 $ndx++;
47 }
48 return $rsl;
49
50 case "xface":
51 return '<img src="xface.php?face='.base64_encode($_text)
52 .'" alt="x-face" />';
53
54 default:
55 return htmlentities($_text);
56 }
57 }
58
59 /** contextual links
60 * @return STRING HTML output
61 */
62 function displayshortcuts() {
63 global $news,$first,$spool,$group,$post,$id;
64 $sname = basename($_SERVER['SCRIPT_NAME']);
65
66 echo '<div class="shortcuts">';
67 echo '[<a href="disconnect.php">'._b_('Déconnexion').'</a>] ';
68
69 switch ($sname) {
70 case 'thread.php' :
71 echo '[<a href="index.php">'._b_('Liste des forums').'</a>] ';
72 echo "[<a href=\"post.php?group=$group\">"._b_('Nouveau message')."</a>] ";
73 if (sizeof($spool->overview)>$news['max']) {
74 for ($ndx=1; $ndx<=sizeof($spool->overview); $ndx += $news['max']) {
75 if ($first==$ndx) {
76 echo "[$ndx-".min($ndx+$news['max']-1,sizeof($spool->overview))."] ";
77 } else {
78 echo "[<a href=\"".$_SERVER['PHP_SELF']."?group=$group&amp;first="
79 ."$ndx\">$ndx-".min($ndx+$news['max']-1,sizeof($spool->overview))
80 ."</a>] ";
81 }
82 }
83 }
84 break;
85 case 'article.php' :
86 echo '[<a href="index.php">'._b_('Liste des forums').'</a>] ';
87 echo "[<a href=\"thread.php?group=$group\">$group</a>] ";
88 echo "[<a href=\"post.php?group=$group&amp;id=$id&amp;type=followup\">"._b_('Répondre')."</a>] ";
89 if (checkcancel($post->headers)) {
90 echo "[<a href=\"article.php?group=$group&amp;id=$id&amp;type=cancel\">"._b_('Annuler ce message')."</a>] ";
91 }
92 break;
93 case 'post.php' :
94 echo '[<a href="index.php">'._b_('Liste des forums').'</a>] ';
95 echo "[<a href=\"thread.php?group=$group\">$group</a>]";
96 break;
97 }
98 echo '</div>';
99 }
100
101 ?>
102