90962c86 |
1 | <?php |
2 | /******************************************************************************** |
3 | * thread.php : group overview |
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/format.inc.php"); |
13 | require("include/config.inc.php"); |
14 | require("include/NetNNTP.inc.php"); |
15 | include("include/post.inc.php"); |
16 | require("include/spool.inc.php"); |
17 | require("include/password.inc.php"); |
18 | require("include/profile.inc.php"); |
19 | include("include/wrapper.inc.php"); |
20 | |
e2625e72 |
21 | $profile=getprofile(); |
22 | require($profile['locale']); |
90962c86 |
23 | |
e2625e72 |
24 | require("include/header.inc.php"); |
90962c86 |
25 | |
26 | if (isset($_REQUEST['group'])) { |
27 | $group=htmlentities(strtolower($_REQUEST['group'])); |
28 | } else { |
29 | $group=htmlentities(strtolower(strtok(str_replace(" ","",$_REQUEST['newsgroups']),","))); |
30 | } |
5c33c608 |
31 | |
32 | if (isset($_REQUEST['id'])) { |
33 | $id=htmlentities(strtolower($_REQUEST['id'])); |
34 | } |
90962c86 |
35 | |
36 | //$mynntp = new nntp($news['server'],120,1); |
37 | $mynntp = new nntp($news['server']); |
38 | if (!$mynntp) { |
39 | echo "<p class=\"error\">\n\t".$locale['error']['connect']."\n</p>"; |
40 | require("include/footer.inc.php"); |
41 | exit; |
42 | } |
43 | |
44 | if ($news['user']!="anonymous") { |
45 | $result = $mynntp->authinfo($news["user"],$news["pass"]); |
46 | if (!$result) { |
47 | echo "<p class=\"error\">\n\t".$locale['error']['credentials'] |
48 | ."\n</p>"; |
49 | require("include/footer.inc.php"); |
50 | exit; |
51 | } |
52 | } |
53 | $spool = new spool($mynntp,$group,$profile['display'], |
54 | $profile['lastnews']); |
55 | if (!$spool) { |
56 | echo "<p class=\"error\">\n\t".$locale['error']['group']."\n</p>"; |
57 | require("footer.inc.php"); |
58 | exit; |
59 | } |
60 | $max = 50; |
5c33c608 |
61 | if (isset($_REQUEST['first']) && ($_REQUEST['first']>sizeof($spool->overview))) |
90962c86 |
62 | $_REQUEST['first']=sizeof($spool->overview); |
63 | $first = (isset($_REQUEST['first'])? |
64 | (floor($_REQUEST['first']/$max)*$max+1):1); |
65 | $last = (isset($_REQUEST['first'])? |
66 | (floor($_REQUEST['first']/$max+1)*$max):$max); |
67 | |
68 | if (isset($_REQUEST['action']) && (isset($_REQUEST['type']))) { |
69 | switch ($_REQUEST['type']) { |
70 | case 'cancel': |
71 | $mid = array_search($id,$spool->ids); |
72 | $mynntp->group($group); |
73 | $post = new post($mynntp,$id); |
74 | |
75 | if (checkcancel($post->headers)) { |
76 | $message = 'From: '.$profile['name']."\n" |
77 | ."Newsgroups: $group\n" |
78 | ."Subject: cmsg $mid\n" |
79 | .$news['customhdr'] |
80 | ."Control: cancel $mid\n" |
81 | ."\n" |
82 | ."Message canceled with Banana"; |
83 | $result = $mynntp->post($message); |
84 | if ($result) { |
85 | $spool->delid($id); |
86 | $text="<p class=\"normal\">".$locale['post']['canceled'] |
87 | ."</p>"; |
88 | } else { |
89 | $text="<p class=\"error\">".$locale['post']['badcancel'] |
90 | ."</p>"; |
91 | } |
92 | } else { |
93 | $text="<p class=\"error\">\n\t".$locale['post']['rghtcancel'] |
94 | ."\n</p>"; |
95 | } |
96 | break; |
97 | case 'new': |
98 | $message = 'From: '.$profile['name']."\n" |
99 | ."Newsgroups: ".stripslashes(str_replace(" ","", |
100 | $_REQUEST['newsgroups']))."\n" |
101 | ."Subject: ".stripslashes($_REQUEST['subject'])."\n" |
102 | .($_REQUEST['followup']!=''?'Followup-To: ' |
103 | .stripslashes($_REQUEST['followup'])."\n":"") |
104 | .$news['customhdr'] |
105 | ."\n" |
106 | .wrap(stripslashes($_REQUEST['body']),"",$news['wrap']); |
107 | $result = $mynntp->post($message); |
108 | if ($result) { |
109 | $text="<p class=\"normal\">".$locale['post']['posted']."</p>"; |
110 | } else { |
111 | $text="<p class=\"error\">".$locale['post']['badpost']."</p>"; |
112 | } |
113 | break; |
114 | case 'followupok': |
115 | $rq=$mynntp->group($group); |
116 | $post = new post($mynntp,$id); |
117 | if ($post) { |
118 | $refs = $post->headers->references." ".$post->headers->msgid; |
119 | } |
120 | |
121 | $message = 'From: '.$profile['name']."\n" |
122 | ."Newsgroups: ".stripslashes($_REQUEST['newsgroups'])."\n" |
123 | ."Subject: ".stripslashes($_REQUEST['subject'])."\n" |
124 | .($_REQUEST['followup']!=''?'Followup-To: ' |
125 | .stripslashes($_REQUEST['followup'])."\n":"") |
126 | ."References: $refs\n" |
127 | .$news['customhdr'] |
128 | ."\n" |
129 | .wrap(stripslashes($_REQUEST['body']),"",$news['wrap']); |
130 | $result = $mynntp->post($message); |
131 | if ($result) { |
132 | $text="<p class=\"normal\">".$locale['post']['posted']."</p>"; |
133 | } else { |
134 | $text="<p class=\"error\">".$locale['post']['badpost']."</p>"; |
135 | } |
136 | break; |
137 | } |
138 | $spool = new spool($mynntp,$group,$profile['display'], |
139 | $profile['lastnews']); |
140 | if (!$spool) { |
141 | echo "<p class=\"error\">\n\t".$locale['error']['group']."\n</p>"; |
142 | require("include/footer.inc.php"); |
143 | exit; |
144 | } |
145 | } |
146 | |
147 | |
148 | ?> |
149 | <div class="title"> |
150 | <?php echo $locale['thread']['group_b'].$group |
151 | .$locale['thread']['group_a'];?> |
152 | </div> |
153 | <?php |
5c33c608 |
154 | if (isset($text)) { |
155 | echo $text; |
156 | } |
90962c86 |
157 | displayshortcuts(); |
158 | |
159 | ?> |
160 | |
161 | <table class="bicol" cellpadding="0" cellspacing="0" border="0" |
162 | summary="<?php echo $locale['thread']['summary'];?>"> |
163 | <tr> |
164 | <th class="date"> |
165 | <?php echo $locale['thread']['date'];?> |
166 | </th> |
167 | <th class="subject"> |
168 | <?php echo $locale['thread']['subject'];?> |
169 | </th> |
170 | <th class="from"> |
171 | <?php echo $locale['thread']['author'];?> |
172 | </th> |
173 | </tr> |
174 | <?php |
175 | $spool->disp($first,$last); |
176 | $mynntp->quit(); |
177 | echo "</table>"; |
178 | |
179 | displayshortcuts(); |
180 | |
181 | require("include/footer.inc.php"); |
182 | ?> |