* Copyright: See COPYING files that comes with this distribution
********************************************************************************/
-require("locales/locales.inc.php");
-require("include/session.inc.php");
-require("include/encoding.inc.php");
-require("include/format.inc.php");
-require("include/config.inc.php");
-require("include/NetNNTP.inc.php");
-include("include/post.inc.php");
-require("include/spool.inc.php");
-require("include/password.inc.php");
-require("include/profile.inc.php");
-include("include/wrapper.inc.php");
+require_once("include/session.inc.php");
+require_once("include/encoding.inc.php");
+require_once("include/format.inc.php");
+require_once("include/config.inc.php");
+require_once("include/NetNNTP.inc.php");
+require_once("include/post.inc.php");
+require_once("include/spool.inc.php");
+require_once("include/password.inc.php");
+require_once("include/profile.inc.php");
+require_once("include/wrapper.inc.php");
+require_once("include/error.inc.php");
-require("include/header.inc.php");
+$profile=getprofile();
+require_once($profile['locale']);
-$profile = getprofile();
+require_once("include/header.inc.php");
if (isset($_REQUEST['group'])) {
$group=htmlentities(strtolower($_REQUEST['group']));
} else {
$group=htmlentities(strtolower(strtok(str_replace(" ","",$_REQUEST['newsgroups']),",")));
}
-$id=htmlentities(strtolower($_REQUEST['id']));
-//$mynntp = new nntp($news['server'],120,1);
-$mynntp = new nntp($news['server']);
-if (!$mynntp) {
- echo "<p class=\"error\">\n\t".$locale['error']['connect']."\n</p>";
- require("include/footer.inc.php");
- exit;
+if (isset($_REQUEST['id'])) {
+ $id=htmlentities(strtolower($_REQUEST['id']));
}
+//$nntp = new nntp($news['server'],120,1);
+$nntp = new nntp($news['server']);
+if (!$nntp) error("nntpsock");
if ($news['user']!="anonymous") {
- $result = $mynntp->authinfo($news["user"],$news["pass"]);
- if (!$result) {
- echo "<p class=\"error\">\n\t".$locale['error']['credentials']
- ."\n</p>";
- require("include/footer.inc.php");
- exit;
- }
+ $result = $nntp->authinfo($news["user"],$news["pass"]);
+ if (!$result) error("nntpauth");
}
-$spool = new spool($mynntp,$group,$profile['display'],
+$spool = new spool($nntp,$group,$profile['display'],
$profile['lastnews']);
-if (!$spool) {
- echo "<p class=\"error\">\n\t".$locale['error']['group']."\n</p>";
- require("footer.inc.php");
- exit;
-}
+if (!$spool) error("nntpspool");
$max = 50;
-if ($_REQUEST['first']>sizeof($spool->overview))
+if (isset($_REQUEST['first']) && ($_REQUEST['first']>sizeof($spool->overview)))
$_REQUEST['first']=sizeof($spool->overview);
$first = (isset($_REQUEST['first'])?
(floor($_REQUEST['first']/$max)*$max+1):1);
$last = (isset($_REQUEST['first'])?
(floor($_REQUEST['first']/$max+1)*$max):$max);
-if (isset($_REQUEST['action']) && (isset($_REQUEST['type']))) {
+if (isset($_REQUEST['action']) && (isset($_REQUEST['type'])) &&
+(isset($_SESSION['bananapostok'])) && ($_SESSION['bananapostok'])) {
switch ($_REQUEST['type']) {
case 'cancel':
$mid = array_search($id,$spool->ids);
- $mynntp->group($group);
- $post = new post($mynntp,$id);
+ $nntp->group($group);
+ $post = new NNTPPost($nntp,$id);
if (checkcancel($post->headers)) {
$message = 'From: '.$profile['name']."\n"
."Control: cancel $mid\n"
."\n"
."Message canceled with Banana";
- $result = $mynntp->post($message);
+ $result = $nntp->post($message);
if ($result) {
$spool->delid($id);
$text="<p class=\"normal\">".$locale['post']['canceled']
}
break;
case 'new':
+ $body = preg_replace("/\n\.[ \t\r]*\n/m","\n..\n",stripslashes($_REQUEST['body']));
$message = 'From: '.$profile['name']."\n"
."Newsgroups: ".stripslashes(str_replace(" ","",
$_REQUEST['newsgroups']))."\n"
."Subject: ".stripslashes($_REQUEST['subject'])."\n"
+ .(isset($profile['org'])?"Organization: ".$profile['org']."\n":"")
.($_REQUEST['followup']!=''?'Followup-To: '
.stripslashes($_REQUEST['followup'])."\n":"")
.$news['customhdr']
."\n"
- .wrap(stripslashes($_REQUEST['body']),"",$news['wrap']);
- $result = $mynntp->post($message);
+ .wrap($body,"",$news['wrap']);
+ $result = $nntp->post($message);
if ($result) {
$text="<p class=\"normal\">".$locale['post']['posted']."</p>";
} else {
}
break;
case 'followupok':
- $rq=$mynntp->group($group);
- $post = new post($mynntp,$id);
+ $rq=$nntp->group($group);
+ $post = new NNTPPost($nntp,$id);
if ($post) {
- $refs = $post->headers->references." ".$post->headers->msgid;
+ $refs = (isset($post->headers->references)?
+ $post->headers->references." ":"").$post->headers->msgid;
}
+ $body = preg_replace("/\n\.[ \t\r]*\n/m","\n..\n",stripslashes($_REQUEST['body']));
$message = 'From: '.$profile['name']."\n"
."Newsgroups: ".stripslashes($_REQUEST['newsgroups'])."\n"
."Subject: ".stripslashes($_REQUEST['subject'])."\n"
+ .(isset($profile['org'])?"Organization: ".$profile['org']."\n":"")
.($_REQUEST['followup']!=''?'Followup-To: '
.stripslashes($_REQUEST['followup'])."\n":"")
."References: $refs\n"
.$news['customhdr']
+ .$profile['customhdr']
."\n"
- .wrap(stripslashes($_REQUEST['body']),"",$news['wrap']);
- $result = $mynntp->post($message);
+ .wrap($body,"",$news['wrap']);
+ $result = $nntp->post($message);
if ($result) {
$text="<p class=\"normal\">".$locale['post']['posted']."</p>";
} else {
}
break;
}
- $spool = new spool($mynntp,$group,$profile['display'],
+ $_SESSION['bananapostok']=false;
+ $spool = new spool($nntp,$group,$profile['display'],
$profile['lastnews']);
- if (!$spool) {
- echo "<p class=\"error\">\n\t".$locale['error']['group']."\n</p>";
- require("include/footer.inc.php");
- exit;
- }
+ if (!$spool) error("nntpspool");
}
?>
-<div class="title">
+<h1>
<?php echo $locale['thread']['group_b'].$group
.$locale['thread']['group_a'];?>
-</div>
+</h1>
<?php
-echo $text;
+if (isset($text)) {
+ echo $text;
+}
displayshortcuts();
?>
-<table class="bicol" cellpadding="0" cellspacing="0" border="0"
+<table class="<?php echo $css['bicol']?>" cellpadding="0" cellspacing="0" border="0"
summary="<?php echo $locale['thread']['summary'];?>">
<tr>
- <th class="date">
+ <th class="<?php echo $css['date']?>">
<?php echo $locale['thread']['date'];?>
</th>
- <th class="subject">
+ <th class="<?php echo $css['subject']?>">
<?php echo $locale['thread']['subject'];?>
</th>
- <th class="from">
+ <th class="<?php echo $css['from']?>">
<?php echo $locale['thread']['author'];?>
</th>
</tr>
<?php
$spool->disp($first,$last);
-$mynntp->quit();
+$nntp->quit();
echo "</table>";
displayshortcuts();
-require("include/footer.inc.php");
+require_once("include/footer.inc.php");
?>