90962c86 |
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 | |
90962c86 |
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 | |
90962c86 |
21 | $profile=getprofile(); |
e2625e72 |
22 | require($profile['locale']); |
23 | |
24 | require("include/header.inc.php"); |
90962c86 |
25 | |
84ca00bc |
26 | if (isset($_REQUEST['group'])) { |
27 | $group=htmlentities(strtolower($_REQUEST['group'])); |
28 | } |
29 | if (isset($_REQUEST['id'])) { |
30 | $id=htmlentities(strtolower($_REQUEST['id'])); |
31 | } |
90962c86 |
32 | |
33 | $mynntp = new nntp($news['server']); |
34 | if (!$mynntp) { |
35 | echo "<p class=\"error\">\n\t".$locale['error']['connect']."\n</p>"; |
36 | require("include/footer.inc.php"); |
37 | exit; |
38 | } |
39 | |
40 | if ($news['user']!="anonymous") { |
41 | $result = $mynntp->authinfo($news["user"],$news["pass"]); |
42 | if (!$result) { |
43 | echo "<p class=\"error\">\n\tYou have provided bad credentials to " |
44 | ."the server. Good bye !\n</p>"; |
45 | require("include/footer.inc.php"); |
46 | exit; |
47 | } |
48 | } |
49 | $spool = new spool($mynntp,$group,$profile['display'],$profile['lastnews']); |
50 | if (!$spool) { |
51 | echo "<p class=\"error\">\n\tError while accessing group.\n</p>"; |
52 | require("include/footer.inc.php"); |
53 | exit; |
54 | } |
55 | $mynntp->group($group); |
56 | |
84ca00bc |
57 | $post = new post($mynntp,$id); |
90962c86 |
58 | if (!$post) { |
59 | if ($mynntp->lasterrorcode == "423") { |
84ca00bc |
60 | $spool->delid($id); |
90962c86 |
61 | } |
62 | echo "<p class=\"error\">\n\tError while reading message.\n</p>"; |
63 | require("include/footer.inc.php"); |
64 | exit; |
65 | } |
66 | |
84ca00bc |
67 | $ndx = $spool->getndx($id); |
90962c86 |
68 | |
69 | ?> |
84ca00bc |
70 | <div class="<?php echo $css['title']?>"> |
90962c86 |
71 | <?php echo $locale['article']['message'];?> |
72 | </div> |
73 | |
74 | <?php |
5c33c608 |
75 | if (isset($_GET['type']) && ($_GET['type']=='cancel') && (checkcancel($post->headers))) { |
90962c86 |
76 | ?> |
84ca00bc |
77 | <p class="<?php echo $css['error']?>"> |
90962c86 |
78 | <?php echo $locale['article']['cancel'];?> |
79 | <form action="thread.php" method="post"> |
80 | <input type="hidden" name="group" value="<?php echo $group;?>" /> |
81 | <input type="hidden" name="id" value="<?php |
84ca00bc |
82 | echo $id;?>" /> |
90962c86 |
83 | <input type="hidden" name="type" value="cancel" /> |
84 | <input type="submit" name="action" value="<?php echo |
85 | $locale['article']['okbtn'];?>" /> |
86 | </form> |
87 | </p> |
88 | <? |
89 | } |
90 | |
91 | displayshortcuts(); |
92 | ?> |
93 | |
84ca00bc |
94 | <table class="<?php echo $css['bicol']?>" cellpadding="0" cellspacing="0" |
90962c86 |
95 | summary="<?php echo $locale['article']['summary'];?>"> |
96 | <tr> |
97 | <th colspan="2"> |
98 | <?php echo $locale['article']['headers'];?> |
99 | </th> |
100 | </tr> |
101 | <?php |
102 | foreach ($news['head'] as $real => $nick) { |
103 | if (isset($post->headers->$nick)) |
84ca00bc |
104 | echo "<tr><td class=\"{$css['bicoltitre']}\">$real</td>" |
90962c86 |
105 | ."<td>".formatdisplayheader($nick,$post->headers->$nick,$spool) |
106 | ."</td></tr>\n"; |
107 | } |
108 | ?> |
109 | <tr> |
110 | <th colspan="2"> |
111 | <?php echo $locale['article']['body'];?> |
112 | </th> |
113 | </tr> |
114 | <tr> |
115 | <td colspan="2"> |
116 | <pre><?php echo formatbody($post->body); ?></pre> |
117 | </td> |
118 | </tr> |
119 | <tr> |
120 | <th colspan="2"> |
121 | <?php echo $locale['article']['overview'];?> |
122 | </th> |
123 | </tr> |
124 | <tr> |
84ca00bc |
125 | <td class="<?php echo $css['nopadd']?>" colspan="2"> |
126 | <table class="<?php echo $css['overview']?>" cellpadding="0" |
127 | cellspacing="0" summary="overview"> |
90962c86 |
128 | <?php |
129 | $spool->disp($ndx-$news['threadtop'],$ndx+$news['threadbottom'],$ndx); |
130 | ?> |
131 | </table> |
132 | </td> |
133 | </tr> |
134 | </table> |
135 | <?php |
136 | displayshortcuts(); |
137 | |
138 | require("include/footer.inc.php"); |
139 | ?> |