subscriptions form
[banana.git] / post.php
index 7d0f019..2a00705 100644 (file)
--- a/post.php
+++ b/post.php
@@ -1,4 +1,12 @@
 <?php
+/********************************************************************************
+* post.php : posting page
+* ----------
+*
+* This file is part of the banana distribution
+* Copyright: See COPYING files that comes with this distribution
+********************************************************************************/
+
 require("include/session.inc.php");
 require("include/encoding.inc.php");
 require("include/format.inc.php");
@@ -9,38 +17,34 @@ require("include/spool.inc.php");
 require("include/password.inc.php");
 require("include/profile.inc.php");
 require("include/wrapper.inc.php");
+require("include/error.inc.php");
 
 $profile = getprofile();
 require($profile['locale']);
 
 require("include/header.inc.php");
-$group=htmlentities(strtolower($_REQUEST['group']));
-$id=htmlentities(strtolower($_REQUEST['id']));
+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 post($nntp,$id);
   if ($post) {
     $subject = (preg_match("/^re:/i",$post->headers->subject)?"":"Re: ")
       .$post->headers->subject;
@@ -52,9 +56,9 @@ if (isset($group) && isset($id) && isset($_REQUEST['type']) &&
   }
 }
 
-$mynntp->quit();
+$nntp->quit();
 ?>
-<div class="title">
+<div class="<?php echo $css['title']?>">
   <?php echo $locale['post']['title'];?>
 </div>
 <?php
@@ -64,14 +68,14 @@ displayshortcuts();
 ?>
 
 <form action="thread.php" method="POST">
-<table class="bicol" cellpadding="0" cellspacing="0" border="0">
+<table class="<?php echo $css['bicol']?>" cellpadding="0" cellspacing="0" border="0">
   <tr>
     <th colspan="2">
       <?php echo $locale['post']['headers'];?>
     </th>
   </tr>
   <tr>
-    <td>
+    <td class="<?php echo $css['bicoltitre'];?>">
       <?php echo $locale['post']['name'];?>
     </td>
     <td>
@@ -79,7 +83,7 @@ displayshortcuts();
     </td>
   </tr>
   <tr>
-    <td>
+    <td class="<?php echo $css['bicoltitre'];?>">
       <?php echo $locale['post']['subject'];?>
     </td>
     <td>
@@ -88,7 +92,7 @@ displayshortcuts();
     </td>
   </tr>
   <tr>
-    <td>
+    <td class="<?php echo $css['bicoltitre'];?>">
       <?php echo $locale['post']['newsgroups'];?>
     </td>
     <td>
@@ -97,7 +101,7 @@ displayshortcuts();
     </td>
   </tr>
   <tr>
-    <td>
+    <td class="<?php echo $css['bicoltitre'];?>">
       <?php echo $locale['post']['fu2'];?>
     </td>
     <td>
@@ -105,7 +109,7 @@ displayshortcuts();
     </td>
   </tr>
   <tr>
-    <td>
+    <td class="<?php echo $css['bicoltitre'];?>">
       <?php echo $locale['post']['organization'];?>
     </td>
     <td>
@@ -118,21 +122,21 @@ displayshortcuts();
     </th>
   </tr>
   <tr>
-    <td colspan="2">
+    <td class="<?php echo $css['bicolvpadd'];?>" colspan="2">
       <textarea name="body" cols="90" rows="10"><?php echo 
       (isset($body)?$body:"").($profile['sig']!=''?"\n\n-- \n"
       .$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 {
 ?>