move to require_once everywhere
[banana.git] / article.php
CommitLineData
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
0d407ce1 10require_once("include/session.inc.php");
11require_once("include/encoding.inc.php");
12require_once("include/wrapper.inc.php");
13require_once("include/format.inc.php");
14require_once("include/config.inc.php");
15require_once("include/NetNNTP.inc.php");
16require_once("include/spool.inc.php");
17require_once("include/post.inc.php");
18require_once("include/profile.inc.php");
19require_once("include/password.inc.php");
20require_once("include/error.inc.php");
90962c86 21
90962c86 22$profile=getprofile();
0d407ce1 23require_once($profile['locale']);
e2625e72 24
0d407ce1 25require_once("include/header.inc.php");
90962c86 26
84ca00bc 27if (isset($_REQUEST['group'])) {
28 $group=htmlentities(strtolower($_REQUEST['group']));
29}
30if (isset($_REQUEST['id'])) {
31 $id=htmlentities(strtolower($_REQUEST['id']));
32}
90962c86 33
a3b667fe 34$nntp = new nntp($news['server']);
35if (!$nntp) error("nntpsock");
90962c86 36if ($news['user']!="anonymous") {
a3b667fe 37 $result = $nntp->authinfo($news["user"],$news["pass"]);
66583932 38 if (!$result) error("nntpauth");
90962c86 39}
a3b667fe 40$spool = new spool($nntp,$group,$profile['display'],$profile['lastnews']);
41if (!$spool) error("nntpspool");
42$nntp->group($group);
90962c86 43
a3b667fe 44$post = new post($nntp,$id);
90962c86 45if (!$post) {
a3b667fe 46 if ($nntp->lasterrorcode == "423") {
84ca00bc 47 $spool->delid($id);
90962c86 48 }
a3b667fe 49 error("nntpart");
90962c86 50}
51
84ca00bc 52$ndx = $spool->getndx($id);
90962c86 53
54?>
40e27a11 55<h1>
90962c86 56 <?php echo $locale['article']['message'];?>
40e27a11 57</h1>
90962c86 58
59<?php
5c33c608 60if (isset($_GET['type']) && ($_GET['type']=='cancel') && (checkcancel($post->headers))) {
90962c86 61?>
84ca00bc 62<p class="<?php echo $css['error']?>">
90962c86 63 <?php echo $locale['article']['cancel'];?>
90962c86 64</p>
641bfc1e 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>
90962c86 73<?
74}
75
76displayshortcuts();
77?>
78
84ca00bc 79<table class="<?php echo $css['bicol']?>" cellpadding="0" cellspacing="0"
90962c86 80summary="<?php echo $locale['article']['summary'];?>">
81 <tr>
82 <th colspan="2">
83 <?php echo $locale['article']['headers'];?>
84 </th>
85 </tr>
86<?php
23148be4 87foreach ($news['headdisp'] as $nick) {
90962c86 88 if (isset($post->headers->$nick))
23148be4 89 echo "<tr><td class=\"{$css['bicoltitre']}\">{$locale['headers'][$nick]}</td>"
90962c86 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>
84ca00bc 110 <td class="<?php echo $css['nopadd']?>" colspan="2">
111 <table class="<?php echo $css['overview']?>" cellpadding="0"
112 cellspacing="0" summary="overview">
90962c86 113<?php
114$spool->disp($ndx-$news['threadtop'],$ndx+$news['threadbottom'],$ndx);
115?>
116 </table>
117 </td>
118 </tr>
119</table>
120<?php
121displayshortcuts();
122
0d407ce1 123require_once("include/footer.inc.php");
90962c86 124?>