2 /********************************************************************************
3 * thread.php : group overview
6 * This file is part of the banana distribution
7 * Copyright: See COPYING files that comes with this distribution
8 ********************************************************************************/
10 require_once("include/session.inc.php");
11 require_once("include/misc.inc.php");
12 require_once("include/format.inc.php");
13 require_once("include/config.inc.php");
14 require_once("include/NetNNTP.inc.php");
15 require_once("include/post.inc.php");
16 require_once("include/spool.inc.php");
17 require_once("include/password.inc.php");
18 require_once("include/profile.inc.php");
19 require_once("include/error.inc.php");
21 $profile=getprofile();
22 require_once($profile['locale']);
24 require_once("include/header.inc.php");
26 if (isset($_REQUEST['group'])) {
27 $group=htmlentities(strtolower($_REQUEST['group']));
29 $group=htmlentities(strtolower(strtok(str_replace(" ","",$_REQUEST['newsgroups']),",")));
32 if (isset($_REQUEST['id'])) {
33 $id=htmlentities(strtolower($_REQUEST['id']));
36 //$nntp = new nntp($news['server'],120,1);
37 $nntp = new nntp($news['server']);
38 if (!$nntp) error("nntpsock");
39 if ($news['user']!="anonymous") {
40 $result = $nntp->authinfo($news["user"],$news["pass"]);
41 if (!$result) error("nntpauth");
43 $spool = new spool($nntp,$group,$profile['display'],
44 $profile['lastnews']);
45 if (!$spool) error("nntpspool");
47 if (isset($_REQUEST['first']) && ($_REQUEST['first']>sizeof($spool->overview
)))
48 $_REQUEST['first']=sizeof($spool->overview
);
49 $first = (isset($_REQUEST['first'])?
50 (floor($_REQUEST['first']/$max)*$max+
1):1);
51 $last = (isset($_REQUEST['first'])?
52 (floor($_REQUEST['first']/$max+
1)*$max):$max);
54 if (isset($_REQUEST['action']) && (isset($_REQUEST['type'])) &&
55 (isset($_SESSION['bananapostok'])) && ($_SESSION['bananapostok'])) {
56 switch ($_REQUEST['type']) {
58 $mid = array_search($id,$spool->ids
);
60 $post = new NNTPPost($nntp,$id);
62 if (checkcancel($post->headers
)) {
63 $message = 'From: '.$profile['name']."\n"
64 ."Newsgroups: $group\n"
65 ."Subject: cmsg $mid\n"
67 ."Control: cancel $mid\n"
69 ."Message canceled with Banana";
70 $result = $nntp->post($message);
73 $text="<p class=\"normal\">".$locale['post']['canceled']
76 $text="<p class=\"error\">".$locale['post']['badcancel']
80 $text="<p class=\"error\">\n\t".$locale['post']['rghtcancel']
85 $body = preg_replace("/\n\.[ \t\r]*\n/m","\n..\n",stripslashes($_REQUEST['body']));
86 $message = 'From: '.$profile['name']."\n"
87 ."Newsgroups: ".stripslashes(str_replace(" ","",
88 $_REQUEST['newsgroups']))."\n"
89 ."Subject: ".stripslashes($_REQUEST['subject'])."\n"
90 .(isset($profile['org'])?
"Organization: ".$profile['org']."\n":"")
91 .($_REQUEST['followup']!=''?
'Followup-To: '
92 .stripslashes($_REQUEST['followup'])."\n":"")
95 .wrap($body,"",$news['wrap']);
96 $result = $nntp->post($message);
98 $text="<p class=\"normal\">".$locale['post']['posted']."</p>";
100 $text="<p class=\"error\">".$locale['post']['badpost']."</p>";
104 $rq=$nntp->group($group);
105 $post = new NNTPPost($nntp,$id);
107 $refs = (isset($post->headers
->references
)?
108 $post->headers
->references
." ":"").$post->headers
->msgid
;
111 $body = preg_replace("/\n\.[ \t\r]*\n/m","\n..\n",stripslashes($_REQUEST['body']));
112 $message = 'From: '.$profile['name']."\n"
113 ."Newsgroups: ".stripslashes($_REQUEST['newsgroups'])."\n"
114 ."Subject: ".stripslashes($_REQUEST['subject'])."\n"
115 .(isset($profile['org'])?
"Organization: ".$profile['org']."\n":"")
116 .($_REQUEST['followup']!=''?
'Followup-To: '
117 .stripslashes($_REQUEST['followup'])."\n":"")
118 ."References: $refs\n"
120 .$profile['customhdr']
122 .wrap($body,"",$news['wrap']);
123 $result = $nntp->post($message);
125 $text="<p class=\"normal\">".$locale['post']['posted']."</p>";
127 $text="<p class=\"error\">".$locale['post']['badpost']."</p>";
131 $_SESSION['bananapostok']=false
;
132 $spool = new spool($nntp,$group,$profile['display'],
133 $profile['lastnews']);
134 if (!$spool) error("nntpspool");
140 <?php
echo $locale['thread']['group_b'].$group
141 .$locale['thread']['group_a'];?
>
151 <table
class="<?php echo $css['bicol']?>" cellpadding
="0" cellspacing
="0" border
="0"
152 summary
="<?php echo $locale['thread']['summary'];?>">
154 <th
class="<?php echo $css['date']?>">
155 <?php
echo $locale['thread']['date'];?
>
157 <th
class="<?php echo $css['subject']?>">
158 <?php
echo $locale['thread']['subject'];?
>
160 <th
class="<?php echo $css['from']?>">
161 <?php
echo $locale['thread']['author'];?
>
165 $spool->disp($first,$last);
171 require_once("include/footer.inc.php");