* Copyright: See COPYING files that comes with this distribution
********************************************************************************/
-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/misc.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/error.inc.php");
$profile=getprofile();
-require($profile['locale']);
-
-require("include/header.inc.php");
+require_once("include/header.inc.php");
if (isset($_REQUEST['group'])) {
$group=htmlentities(strtolower($_REQUEST['group']));
$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;
-}
-
+//$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 (isset($_REQUEST['first']) && ($_REQUEST['first']>sizeof($spool->overview)))
$_REQUEST['first']=sizeof($spool->overview);
$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']
- ."</p>";
+ $text = "<p class=\"normal\">"._b_('Message annulé')."</p>";
} else {
- $text="<p class=\"error\">".$locale['post']['badcancel']
- ."</p>";
+ $text = "<p class=\"error\">"._b_('Impossible d\'annuler le message')."</p>";
}
} else {
- $text="<p class=\"error\">\n\t".$locale['post']['rghtcancel']
- ."\n</p>";
+ $text="<p class=\"error\">\n\t"._b_('Vous n\'avez pas les permissions pour annuler ce message')."\n</p>";
}
break;
case 'new':
.$news['customhdr']
."\n"
.wrap($body,"",$news['wrap']);
- $result = $mynntp->post($message);
+ $result = $nntp->post($message);
if ($result) {
- $text="<p class=\"normal\">".$locale['post']['posted']."</p>";
+ $text="<p class=\"normal\">"._b_('Message posté')."</p>";
} else {
- $text="<p class=\"error\">".$locale['post']['badpost']."</p>";
+ $text="<p class=\"error\">"._b_('Impossible de poster le message')."</p>";
}
break;
case 'followupok':
- $rq=$mynntp->group($group);
- $post = new post($mynntp,$id);
+ $rq=$nntp->group($group);
+ $post = new NNTPPost($nntp,$id);
if ($post) {
- $refs = (isset($post->headers->references)?
- $post->headers->references." ":"").$post->headers->msgid;
+ $refs = (isset($post->headers['references'])?
+ $post->headers['references']." ":"").$post->headers['message-id'];
}
$body = preg_replace("/\n\.[ \t\r]*\n/m","\n..\n",stripslashes($_REQUEST['body']));
.stripslashes($_REQUEST['followup'])."\n":"")
."References: $refs\n"
.$news['customhdr']
+ .$profile['customhdr']
."\n"
.wrap($body,"",$news['wrap']);
- $result = $mynntp->post($message);
+ $result = $nntp->post($message);
if ($result) {
- $text="<p class=\"normal\">".$locale['post']['posted']."</p>";
+ $text="<p class=\"normal\">"._b_('Message posté')."</p>";
} else {
- $text="<p class=\"error\">".$locale['post']['badpost']."</p>";
+ $text="<p class=\"error\">"._b_('Impossible de poster le message')."</p>";
}
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="<?php echo $css['title']?>">
- <?php echo $locale['thread']['group_b'].$group
- .$locale['thread']['group_a'];?>
-</div>
+<h1>
+ <?php echo $group; ?>
+</h1>
<?php
if (isset($text)) {
echo $text;
?>
-<table class="<?php echo $css['bicol']?>" cellpadding="0" cellspacing="0" border="0"
- summary="<?php echo $locale['thread']['summary'];?>">
+<table class="<?php echo $css['bicol']?>" cellpadding="0" cellspacing="0" border="0">
<tr>
<th class="<?php echo $css['date']?>">
- <?php echo $locale['thread']['date'];?>
+ <?php echo _b_('Date'); ?>
</th>
<th class="<?php echo $css['subject']?>">
- <?php echo $locale['thread']['subject'];?>
+ <?php echo _b_('Sujet'); ?>
</th>
<th class="<?php echo $css['from']?>">
- <?php echo $locale['thread']['author'];?>
+ <?php echo _b_('Auteur'); ?>
</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");
?>