3 tons or rewrite
[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_once("include/banana.inc.php");
11 require_once("include/header.inc.php");
12
13 if (isset($_REQUEST['group'])) {
14 $group = htmlentities(strtolower($_REQUEST['group']));
15 }
16 if (isset($_REQUEST['id'])) {
17 $id = htmlentities(strtolower($_REQUEST['id']));
18 }
19
20 $banana->newSpool($group, $banana->profile['display'], $banana->profile['lastnews']);
21 $banana->nntp->group($group);
22
23 $post = new BananaPost($id);
24 if (!$post) {
25 if ($banana->nntp->lasterrorcode == "423") {
26 $banana->spool->delid($id);
27 }
28 error("nntpart");
29 }
30
31 $ndx = $banana->spool->getndx($id);
32
33 ?>
34 <h1><?php echo _b_('Message'); ?></h1>
35
36 <?php
37 if (isset($_GET['type']) && ($_GET['type']=='cancel') && (checkcancel($post->headers))) {
38 ?>
39 <p class="<?php echo $css['error']?>">
40 <?php echo _b_('Voulez-vous vraiment annuler ce message ?'); ?>
41 </p>
42 <form action="thread.php" method="post">
43 <input type="hidden" name="group" value="<?php echo $group; ?>" />
44 <input type="hidden" name="id" value="<?php echo $id; ?>" />
45 <input type="hidden" name="type" value="cancel" />
46 <input type="submit" name="action" value="<?php echo _b_('OK'); ?>" />
47 </form>
48 <?
49 }
50
51 displayshortcuts();
52 ?>
53
54 <table class="<?php echo $css['bicol']?>" cellpadding="0" cellspacing="0"
55 summary="<?php echo _b_('Contenu du message'); ?>">
56 <tr>
57 <th colspan="2">
58 <?php echo _b_('En-têtes'); ?>
59 </th>
60 </tr>
61 <?php
62 foreach ($banana->show_hdr as $hdr) {
63 if (isset($post->headers[$hdr])) {
64 $res = formatdisplayheader($hdr, $post->headers[$hdr]);
65 if ($res)
66 echo "<tr><td class=\"{$css['bicoltitre']}\">".header_translate($hdr)."</td>"
67 ."<td>$res</td></tr>\n";
68 }
69 }
70 ?>
71 <tr>
72 <th colspan="2">
73 <?php echo _b_('Corps'); ?>
74 </th>
75 </tr>
76 <tr>
77 <td colspan="2">
78 <pre><?php echo formatbody($post->body); ?></pre>
79 </td>
80 </tr>
81 <tr>
82 <th colspan="2">
83 <?php echo _b_('Aperçu'); ?>
84 </th>
85 </tr>
86 <tr>
87 <td class="<?php echo $css['nopadd']?>" colspan="2">
88 <table class="<?php echo $css['overview']?>" cellpadding="0"
89 cellspacing="0" summary="overview">
90 <?php
91 $banana->spool->disp($ndx-$banana->tbefore,$ndx+$banana->tafter,$ndx);
92 ?>
93 </table>
94 </td>
95 </tr>
96 </table>
97 <?php
98 displayshortcuts();
99
100 require_once("include/footer.inc.php");
101 ?>