d20c0a132366c97688922bb75a0a21572eeb2ef9
[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("include/session.inc.php");
11 require("include/encoding.inc.php");
12 require("include/wrapper.inc.php");
13 require("include/format.inc.php");
14 require("include/config.inc.php");
15 require("include/NetNNTP.inc.php");
16 require("include/spool.inc.php");
17 require("include/post.inc.php");
18 require("include/profile.inc.php");
19 require("include/password.inc.php");
20 require("include/error.inc.php");
21
22 $profile=getprofile();
23 require($profile['locale']);
24
25 require("include/header.inc.php");
26
27 if (isset($_REQUEST['group'])) {
28 $group=htmlentities(strtolower($_REQUEST['group']));
29 }
30 if (isset($_REQUEST['id'])) {
31 $id=htmlentities(strtolower($_REQUEST['id']));
32 }
33
34 $nntp = new nntp($news['server']);
35 if (!$nntp) error("nntpsock");
36 if ($news['user']!="anonymous") {
37 $result = $nntp->authinfo($news["user"],$news["pass"]);
38 if (!$result) error("nntpauth");
39 }
40 $spool = new spool($nntp,$group,$profile['display'],$profile['lastnews']);
41 if (!$spool) error("nntpspool");
42 $nntp->group($group);
43
44 $post = new post($nntp,$id);
45 if (!$post) {
46 if ($nntp->lasterrorcode == "423") {
47 $spool->delid($id);
48 }
49 error("nntpart");
50 }
51
52 $ndx = $spool->getndx($id);
53
54 ?>
55 <div class="<?php echo $css['title']?>">
56 <?php echo $locale['article']['message'];?>
57 </div>
58
59 <?php
60 if (isset($_GET['type']) && ($_GET['type']=='cancel') && (checkcancel($post->headers))) {
61 ?>
62 <p class="<?php echo $css['error']?>">
63 <?php echo $locale['article']['cancel'];?>
64 </p>
65 <form action="thread.php" method="post">
66 <input type="hidden" name="group" value="<?php echo $group;?>" />
67 <input type="hidden" name="id" value="<?php
68 echo $id;?>" />
69 <input type="hidden" name="type" value="cancel" />
70 <input type="submit" name="action" value="<?php echo
71 $locale['article']['okbtn'];?>" />
72 </form>
73 <?
74 }
75
76 displayshortcuts();
77 ?>
78
79 <table class="<?php echo $css['bicol']?>" cellpadding="0" cellspacing="0"
80 summary="<?php echo $locale['article']['summary'];?>">
81 <tr>
82 <th colspan="2">
83 <?php echo $locale['article']['headers'];?>
84 </th>
85 </tr>
86 <?php
87 foreach ($news['headdisp'] as $nick) {
88 if (isset($post->headers->$nick))
89 echo "<tr><td class=\"{$css['bicoltitre']}\">{$locale['headers'][$nick]}</td>"
90 ."<td>".formatdisplayheader($nick,$post->headers->$nick,$spool)
91 ."</td></tr>\n";
92 }
93 ?>
94 <tr>
95 <th colspan="2">
96 <?php echo $locale['article']['body'];?>
97 </th>
98 </tr>
99 <tr>
100 <td colspan="2">
101 <pre><?php echo formatbody($post->body); ?></pre>
102 </td>
103 </tr>
104 <tr>
105 <th colspan="2">
106 <?php echo $locale['article']['overview'];?>
107 </th>
108 </tr>
109 <tr>
110 <td class="<?php echo $css['nopadd']?>" colspan="2">
111 <table class="<?php echo $css['overview']?>" cellpadding="0"
112 cellspacing="0" summary="overview">
113 <?php
114 $spool->disp($ndx-$news['threadtop'],$ndx+$news['threadbottom'],$ndx);
115 ?>
116 </table>
117 </td>
118 </tr>
119 </table>
120 <?php
121 displayshortcuts();
122
123 require("include/footer.inc.php");
124 ?>