web pages
[banana.git] / article.php
1 <?php
2 /********************************************************************************
3 * article.php : article page
4 * -------------
5 *
6 * This file is part of the banana distribution
7 * Copyright: See COPYING files that comes with this distribution
8 ********************************************************************************/
9
10 require("locales/locales.inc.php");
11 require("include/session.inc.php");
12 require("include/encoding.inc.php");
13 require("include/wrapper.inc.php");
14 require("include/format.inc.php");
15 require("include/config.inc.php");
16 require("include/NetNNTP.inc.php");
17 require("include/spool.inc.php");
18 require("include/post.inc.php");
19 require("include/profile.inc.php");
20 require("include/password.inc.php");
21
22 require("include/header.inc.php");
23
24 $profile=getprofile();
25
26 $group=strtolower(htmlentities($_REQUEST['group']));
27
28 $mynntp = new nntp($news['server']);
29 if (!$mynntp) {
30 echo "<p class=\"error\">\n\t".$locale['error']['connect']."\n</p>";
31 require("include/footer.inc.php");
32 exit;
33 }
34
35 if ($news['user']!="anonymous") {
36 $result = $mynntp->authinfo($news["user"],$news["pass"]);
37 if (!$result) {
38 echo "<p class=\"error\">\n\tYou have provided bad credentials to "
39 ."the server. Good bye !\n</p>";
40 require("include/footer.inc.php");
41 exit;
42 }
43 }
44 $spool = new spool($mynntp,$group,$profile['display'],$profile['lastnews']);
45 if (!$spool) {
46 echo "<p class=\"error\">\n\tError while accessing group.\n</p>";
47 require("include/footer.inc.php");
48 exit;
49 }
50 $mynntp->group($group);
51
52 $post = new post($mynntp,$_REQUEST['id']);
53 if (!$post) {
54 if ($mynntp->lasterrorcode == "423") {
55 $spool->delid($_REQUEST['id']);
56 }
57 echo "<p class=\"error\">\n\tError while reading message.\n</p>";
58 require("include/footer.inc.php");
59 exit;
60 }
61
62 $ndx = $spool->getndx($_REQUEST['id']);
63
64 ?>
65 <div class="title">
66 <?php echo $locale['article']['message'];?>
67 </div>
68
69 <?php
70 if (($_GET['type']=='cancel') && (checkcancel($post->headers))) {
71 ?>
72 <p class="error">
73 <?php echo $locale['article']['cancel'];?>
74 <form action="thread.php" method="post">
75 <input type="hidden" name="group" value="<?php echo $group;?>" />
76 <input type="hidden" name="id" value="<?php
77 echo $_REQUEST['id'];?>" />
78 <input type="hidden" name="type" value="cancel" />
79 <input type="submit" name="action" value="<?php echo
80 $locale['article']['okbtn'];?>" />
81 </form>
82 </p>
83 <?
84 }
85
86 displayshortcuts();
87 ?>
88
89 <table class="bicol" cellpadding="0" cellspacing="0"
90 summary="<?php echo $locale['article']['summary'];?>">
91 <tr>
92 <th colspan="2">
93 <?php echo $locale['article']['headers'];?>
94 </th>
95 </tr>
96 <?php
97 foreach ($news['head'] as $real => $nick) {
98 if (isset($post->headers->$nick))
99 echo "<tr><td class=\"bicoltitre\">$real</td>"
100 ."<td>".formatdisplayheader($nick,$post->headers->$nick,$spool)
101 ."</td></tr>\n";
102 }
103 ?>
104 <tr>
105 <th colspan="2">
106 <?php echo $locale['article']['body'];?>
107 </th>
108 </tr>
109 <tr>
110 <td colspan="2">
111 <pre><?php echo formatbody($post->body); ?></pre>
112 </td>
113 </tr>
114 <tr>
115 <th colspan="2">
116 <?php echo $locale['article']['overview'];?>
117 </th>
118 </tr>
119 <tr>
120 <td class="nopadd" colspan="2">
121 <table class="overview" cellpadding="0" cellspacing="0" summary="overview">
122 <?php
123 $spool->disp($ndx-$news['threadtop'],$ndx+$news['threadbottom'],$ndx);
124 ?>
125 </table>
126 </td>
127 </tr>
128 </table>
129 <?php
130 displayshortcuts();
131
132 require("include/footer.inc.php");
133 ?>