config.inc.php is now a REAL file of the package
[banana.git] / install.d / format.inc.php
CommitLineData
6ab9c313 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
6ab9c313 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
17function formatDisplayHeader($_header,$_text,$_spool) {
dd7d1c59 18 switch ($_header) {
19 case "date":
e2cae7e3 20 return formatDate($_text);
dd7d1c59 21
01681efd 22 case "followup-to":
dd7d1c59 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);
6ab9c313 30
dd7d1c59 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
01681efd 50 case "x-face":
dd7d1c59 51 return '<img src="xface.php?face='.base64_encode($_text)
52 .'" alt="x-face" />';
53
54 default:
55 return htmlentities($_text);
56 }
6ab9c313 57}
58
59/** contextual links
60 * @return STRING HTML output
61 */
62function displayshortcuts() {
e2cae7e3 63 global $news,$first,$spool,$group,$post,$id;
dd7d1c59 64 $sname = basename($_SERVER['SCRIPT_NAME']);
6ab9c313 65
dd7d1c59 66 echo '<div class="shortcuts">';
0a65ec9d 67 echo '[<a href="disconnect.php">'._b_('Déconnexion').'</a>] ';
dd7d1c59 68
69 switch ($sname) {
70 case 'thread.php' :
0a65ec9d 71 echo '[<a href="index.php">'._b_('Liste des forums').'</a>] ';
72 echo "[<a href=\"post.php?group=$group\">"._b_('Nouveau message')."</a>] ";
dd7d1c59 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' :
0a65ec9d 86 echo '[<a href="index.php">'._b_('Liste des forums').'</a>] ';
e2cae7e3 87 echo "[<a href=\"thread.php?group=$group\">$group</a>] ";
0a65ec9d 88 echo "[<a href=\"post.php?group=$group&amp;id=$id&amp;type=followup\">"._b_('Répondre')."</a>] ";
dd7d1c59 89 if (checkcancel($post->headers)) {
0a65ec9d 90 echo "[<a href=\"article.php?group=$group&amp;id=$id&amp;type=cancel\">"._b_('Annuler ce message')."</a>] ";
dd7d1c59 91 }
92 break;
93 case 'post.php' :
0a65ec9d 94 echo '[<a href="index.php">'._b_('Liste des forums').'</a>] ';
e2cae7e3 95 echo "[<a href=\"thread.php?group=$group\">$group</a>]";
dd7d1c59 96 break;
97 }
98 echo '</div>';
6ab9c313 99}
100
101?>
102