big banana update
[banana.git] / post.php
index 7d0f019..a3273ce 100644 (file)
--- a/post.php
+++ b/post.php
@@ -1,50 +1,61 @@
 <?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");
-require("include/post.inc.php");
-require("include/spool.inc.php");
-require("include/password.inc.php");
-require("include/profile.inc.php");
-require("include/wrapper.inc.php");
+/********************************************************************************
+* post.php : posting page
+* ----------
+*
+* This file is part of the banana distribution
+* Copyright: See COPYING files that comes with this distribution
+********************************************************************************/
 
-$profile = getprofile();
-require($profile['locale']);
+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");
 
-require("include/header.inc.php");
-$group=htmlentities(strtolower($_REQUEST['group']));
-$id=htmlentities(strtolower($_REQUEST['id']));
+$profile = getprofile();
+require_once("include/header.inc.php");
+if (isset($_REQUEST['group'])) {
+  $group=htmlentities(strtolower($_REQUEST['group']));
+}
+if (isset($_REQUEST['id'])) {
+  $id=htmlentities(strtolower($_REQUEST['id']));
+}
 
 if (isset($group)) {
   $target = $group;
 }
 
-$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']);
+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");
 }
 
 if (isset($group) && isset($id) && isset($_REQUEST['type']) && 
   ($_REQUEST['type']=='followup')) {
-  $rq=$mynntp->group($group);
-  $post = new post($mynntp,$id);
+  $rq=$nntp->group($group);
+  $post = new NNTPPost($nntp,$id);
   if ($post) {
     $subject = (preg_match("/^re:/i",$post->headers->subject)?"":"Re: ")
       .$post->headers->subject;
-    $body = $post->headers->name." wrote :\n".wrap($post->body, ">");
+       if ($profile['dropsig']) {
+      $cutoff=strpos($post->body,"\n-- \n");
+      if ($cutoff) {
+           $quotetext = substr($post->body,0,strpos($post->body,"\n-- \n"));
+      } else {
+           $quotetext = $post->body;
+      }
+       } else {
+         $quotetext = $post->body;
+       }
+    $body = $post->headers->name." wrote :\n".wrap($quotetext, "> ");
     if (isset($post->headers->followup))
       $target=$post->headers->followup;
     else
@@ -52,35 +63,35 @@ if (isset($group) && isset($id) && isset($_REQUEST['type']) &&
   }
 }
 
-$mynntp->quit();
+$nntp->quit();
 ?>
-<div class="title">
-  <?php echo $locale['post']['title'];?>
-</div>
+<h1>
+  <?php echo _('Nouveau message'); ?>
+</h1>
 <?php
 
 displayshortcuts();
 
 ?>
 
-<form action="thread.php" method="POST">
-<table class="bicol" cellpadding="0" cellspacing="0" border="0">
+<form action="thread.php" method="post">
+<table class="<?php echo $css['bicol']?>" cellpadding="0" cellspacing="0" border="0">
   <tr>
     <th colspan="2">
-      <?php echo $locale['post']['headers'];?>
+      <?php echo _('En-têtes'); ?>
     </th>
   </tr>
   <tr>
-    <td>
-      <?php echo $locale['post']['name'];?>
+    <td class="<?php echo $css['bicoltitre'];?>">
+      <?php echo _('Nom'); ?>
     </td>
     <td>
       <?php echo htmlentities($profile['name']); ?>
     </td>
   </tr>
   <tr>
-    <td>
-      <?php echo $locale['post']['subject'];?>
+    <td class="<?php echo $css['bicoltitre'];?>">
+      <?php echo _('Sujet'); ?>
     </td>
     <td>
       <input type="text" name="subject" value="<?php echo 
@@ -88,8 +99,8 @@ displayshortcuts();
     </td>
   </tr>
   <tr>
-    <td>
-      <?php echo $locale['post']['newsgroups'];?>
+    <td class="<?php echo $css['bicoltitre'];?>">
+      <?php echo _('Forums'); ?>
     </td>
     <td>
       <input type="text" name="newsgroups" value="<?php echo
@@ -97,16 +108,16 @@ displayshortcuts();
     </td>
   </tr>
   <tr>
-    <td>
-      <?php echo $locale['post']['fu2'];?>
+    <td class="<?php echo $css['bicoltitre'];?>">
+      <?php echo _('Suivi-à'); ?>
     </td>
     <td>
       <input type="text" name="followup" value="" />
     </td>
   </tr>
   <tr>
-    <td>
-      <?php echo $locale['post']['organization'];?>
+    <td class="<?php echo $css['bicoltitre'];?>">
+      <?php echo _('Organisation'); ?>
     </td>
     <td>
       <?php echo $profile['org']; ?>
@@ -114,25 +125,25 @@ displayshortcuts();
   </tr>
   <tr>
     <th colspan="2">
-      <?php echo $locale['post']['body'];?>
+      <?php echo _('Corps'); ?>
     </th>
   </tr>
   <tr>
-    <td colspan="2">
-      <textarea name="body" cols="90" rows="10"><?php echo 
-      (isset($body)?$body:"").($profile['sig']!=''?"\n\n-- \n"
-      .$profile['sig']:"");?></textarea>
+    <td class="<?php echo $css['bicolvpadd'];?>" colspan="2">
+      <textarea name="body" cols="90" rows="16"><?php echo 
+      (isset($body)?htmlentities($body):"").
+      ($profile['sig']!=''?"\n\n-- \n".htmlentities($profile['sig']):"");?></textarea>
     </td>
   </tr>
   <tr>
-    <td class="bouton" colspan="2">
+    <td class="<?php echo $css['bouton']?>" colspan="2">
 <?php
 if (isset($group) && isset($id) && isset($_REQUEST['type']) 
   && ($_REQUEST['type']=='followup')) {
 ?>
       <input type="hidden" name="type" value="followupok" />
       <input type="hidden" name="group" value="<?php echo $group;?>" />
-      <input type="hidden" name="id" value="<?php echo $id;?> " />
+      <input type="hidden" name="id" value="<?php echo $id;?>" />
 <?php
 } else {
 ?>
@@ -142,9 +153,10 @@ if (isset($group) && isset($id) && isset($_REQUEST['type'])
 ?>
       <input type="submit" name="action" value="OK" />
     </td>
+  </tr>
 </table>
 </form>
 <?php
 displayshortcuts();
-require("include/footer.inc.php");
+require_once("include/footer.inc.php");
 ?>