various updates
authorx2000habouzit <x2000habouzit>
Tue, 4 Jan 2005 17:54:55 +0000 (17:54 +0000)
committerx2000habouzit <x2000habouzit>
Tue, 4 Jan 2005 17:54:55 +0000 (17:54 +0000)
article.php
css/banana.css [new file with mode: 0644]
css/style.css
include/NetNNTP.inc.php
include/banana.inc.php.in
include/misc.inc.php
post.php
subscribe.php
xface.php

index ed10a48..d30e4c4 100644 (file)
@@ -21,7 +21,7 @@ echo $banana->action_showArticle($group, $id);
 
 if (isset($_GET['type']) && $_GET['type']=='cancel' && $banana->post->checkcancel()) {
 ?>
-<p class="<?php echo $css['error']?>">
+<p class="error">
   <?php echo _b_('Voulez-vous vraiment annuler ce message ?'); ?>
 </p>
 <form action="thread.php" method="post">
diff --git a/css/banana.css b/css/banana.css
new file mode 100644 (file)
index 0000000..cf1940b
--- /dev/null
@@ -0,0 +1,67 @@
+/***************************************************************************
+ *  Copyright (C) 2003-2004 Polytechnique.org                              *
+ *  http://opensource.polytechnique.org/                                   *
+ *                                                                         *
+ *  This program is free software; you can redistribute it and/or modify   *
+ *  it under the terms of the GNU General Public License as published by   *
+ *  the Free Software Foundation; either version 2 of the License, or      *
+ *  (at your option) any later version.                                    *
+ *                                                                         *
+ *  This program is distributed in the hope that it will be useful,        *
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of         *
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the          *
+ *  GNU General Public License for more details.                           *
+ *                                                                         *
+ *  You should have received a copy of the GNU General Public License      *
+ *  along with this program; if not, write to the Free Software            *
+ *  Foundation, Inc.,                                                      *
+ *  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                *
+ ***************************************************************************/
+
+body {
+    font-family:"Trebuchet MS",Verdana,Geneva,Arial,Helvetica,sans-serif;
+    margin:2em 1%;
+    padding:0;
+}
+
+div.bloc { width: 800px; margin-left: auto; margin-right: auto; }
+
+div.foot {
+    border-top: 1px solid #a2c2e1;
+    padding-top: 1em;
+    margin-top: 1em;
+}
+
+a:link, a:visited { color: #f60; background: transparent; }
+a:active, a:hover { color: #369; background: transparent; }
+
+hr { border: none; border-top: 1px dotted #a2c2e1; }
+
+h1 {
+    color: #369;
+    background: inherit;
+    font-size: 200%;
+    text-align: center;
+    margin: 0em;
+    border-bottom: 2px solid #369;
+    padding: 4px;
+    margin: 1em 0em;
+}
+
+table.bicol {
+    border-collapse: collapse;
+    border: 1px solid #a2c2e1;
+    width: 100%;
+}
+
+table.bicol tr.impair { }
+table.bicol tr.pair   { color: inherit; background: #eee; }
+
+table.bicol th {
+    color: #369;
+    background: #d6e1ec;
+    padding: 0px 4px;
+}
+
+table.bicol td { padding: 0px 4px; }
+
index 0b698c9..68afe1d 100644 (file)
@@ -21,7 +21,7 @@ table.banana_thread td { white-space: nowrap; height: 100%; vertical-align: midd
 
 table.banana_thread tr.new { font-weight: bold; }
 
-table.banana_thread td.date { text-align: center; }
+table.banana_thread td.date { width: 15%; text-align: center; }
 table.banana_thread td.subj { text-align: left; overflow: hidden; }
 table.banana_thread td.from { text-align: left; }
 
@@ -30,6 +30,8 @@ table.banana_thread span.cur { font-style: italic; font-size: 90%; }
 
 /** MESSAGE VIEW **/
 
+table.banana_msg .hdr { width: 15%; text-align: right; font-weight: bold; padding-right: 1em; }
+
 table.banana_msg td.thrd { padding: 0px; }
 table.banana_msg table { border: 0px; padding: 0px; margin: 0px; width: 100%; }
 
index c5c62de..13e574a 100644 (file)
@@ -179,10 +179,9 @@ class nntp
             $this->lasterrortext = substr($result, 4);
             return false;
         }
-        $result = $this->gline();
-        while ($result != ".") {
+        $array = Array();
+        while (($result = $this->gline()) != ".") {
             $array[] = $result;
-            $result  = $this->gline();
         }
         return $array;
     }
index 1411566..454e063 100644 (file)
@@ -116,7 +116,6 @@ class Banana
     function newSpool($group, $disp=0, $since='') {
         require_once('include/spool.inc.php');
         $this->spool = new BananaSpool($group, $disp, $since);
-        if (!$this->spool) { error('nntpspool'); }
     }
 
     function newPost($id)
@@ -142,8 +141,6 @@ class Banana
     {
         if (function_exists('hook_getprofile')) {
             $this->profile = hook_getprofile();
-        } else {
-            session_start();
         }
         
         setlocale(LC_ALL,  $this->profile['locale']);
@@ -152,40 +149,4 @@ class Banana
 
 $banana = new Banana;
 
-switch (basename($_SERVER['SCRIPT_NAME'])) {
-    case "thread.php":
-        if (!isset($_SESSION['bananapostok'])) {
-            $_SESSION['bananapostok']=true;
-        }
-        break;
-
-    default:
-        $_SESSION['bananapostok']=true;
-        break;
-}
-
-if (empty($css)) {
-$css = array(
-        'bananashortcuts' => 'bananashortcuts',
-        'bicol' => 'bicol',
-        'bicoltitre' => 'bicoltitre',
-        'bicolvpadd' => 'bicolvpadd',
-        'pair' => 'pair',
-        'impair' => 'impair',
-        'bouton' => 'bouton',
-        'error' => 'error',
-        'normal' => 'normal',
-        'total' => 'total',
-        'unread' => 'unread',
-        'group' => 'group',
-        'description' => 'description',
-        'date' => 'date',
-        'subject' => 'subject',
-        'from' => 'from',
-        'author' => 'author',
-        'nopadd' => 'nopadd',
-        'overview' => 'overview',
-        'tree' => 'tree'
-        );
-}
 ?>
index b20fce5..dafc163 100644 (file)
@@ -147,7 +147,7 @@ function formatFrom($text) {
 }
 
 function displayshortcuts($first = -1) {
-    global $banana, $css;
+    global $banana;
     $sname = basename($_SERVER['SCRIPT_NAME']);
 
     $res = '<div class="banana_scuts">';
index c3e87dc..d76909b 100644 (file)
--- a/post.php
+++ b/post.php
@@ -22,6 +22,7 @@ if (isset($group)) {
 }
 
 if (isset($group) && isset($id) && isset($_REQUEST['type']) && ($_REQUEST['type']=='followup')) {
+    $banana->nntp->group($group);
     $banana->newPost($id);
     $body = '';
     if ($banana->post) {
@@ -38,92 +39,92 @@ $banana->nntp->quit();
 </h1>
 <?php
 
-displayshortcuts();
+echo displayshortcuts();
 
 ?>
 
 <form action="thread.php" method="post">
-<table class="<?php echo $css['bicol']?>" cellpadding="0" cellspacing="0" border="0">
-  <tr>
-    <th colspan="2">
-      <?php echo _b_('En-têtes'); ?>
-    </th>
-  </tr>
-  <tr>
-    <td class="<?php echo $css['bicoltitre'];?>">
-      <?php echo _b_('Nom'); ?>
-    </td>
-    <td>
-      <?php echo htmlentities($banana->profile['name']); ?>
-    </td>
-  </tr>
-  <tr>
-    <td class="<?php echo $css['bicoltitre'];?>">
-      <?php echo _b_('Sujet'); ?>
-    </td>
-    <td>
-      <input type="text" name="subject" value="<?php if (isset($subject)) echo $subject; ?>" />
-    </td>
-  </tr>
-  <tr>
-    <td class="<?php echo $css['bicoltitre'];?>">
-      <?php echo _b_('Forums'); ?>
-    </td>
-    <td>
-      <input type="text" name="newsgroups" value="<?php if (isset($target)) echo $target; ?>" />
-    </td>
-  </tr>
-  <tr>
-    <td class="<?php echo $css['bicoltitre'];?>">
-      <?php echo _b_('Suivi-à'); ?>
-    </td>
-    <td>
-      <input type="text" name="followup" value="" />
-    </td>
-  </tr>
-  <tr>
-    <td class="<?php echo $css['bicoltitre'];?>">
-      <?php echo _b_('Organisation'); ?>
-    </td>
-    <td>
-      <?php echo $banana->profile['org']; ?>
-    </td>
-  </tr>
-  <tr>
-    <th colspan="2">
-      <?php echo _b_('Corps'); ?>
-    </th>
-  </tr>
-  <tr>
-    <td class="<?php echo $css['bicolvpadd'];?>" colspan="2">
-      <textarea name="body" cols="90" rows="16"><?php
-      echo htmlentities($body);
-      if ($banana->profile['sig']) echo "\n\n-- \n".htmlentities($banana->profile['sig']);
-      ?></textarea>
-    </td>
-  </tr>
-  <tr>
-    <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;?>" />
-<?php
-} else {
-?>
-      <input type="hidden" name="type" value="new" />
-<?php
-}
-?>
-      <input type="submit" name="action" value="OK" />
-    </td>
-  </tr>
-</table>
+  <table class="bicol" cellpadding="0" cellspacing="0" border="0">
+    <tr>
+      <th colspan="2">
+        <?php echo _b_('En-têtes'); ?>
+      </th>
+    </tr>
+    <tr>
+      <td class="<?php echo $css['bicoltitre'];?>">
+        <?php echo _b_('Nom'); ?>
+      </td>
+      <td>
+        <?php echo htmlentities($banana->profile['name']); ?>
+      </td>
+    </tr>
+    <tr>
+      <td class="<?php echo $css['bicoltitre'];?>">
+        <?php echo _b_('Sujet'); ?>
+      </td>
+      <td>
+        <input type="text" name="subject" value="<?php if (isset($subject)) echo $subject; ?>" />
+      </td>
+    </tr>
+    <tr>
+      <td class="<?php echo $css['bicoltitre'];?>">
+        <?php echo _b_('Forums'); ?>
+      </td>
+      <td>
+        <input type="text" name="newsgroups" value="<?php if (isset($target)) echo $target; ?>" />
+      </td>
+    </tr>
+    <tr>
+      <td class="<?php echo $css['bicoltitre'];?>">
+        <?php echo _b_('Suivi-à'); ?>
+      </td>
+      <td>
+        <input type="text" name="followup" value="" />
+      </td>
+    </tr>
+    <tr>
+      <td class="<?php echo $css['bicoltitre'];?>">
+        <?php echo _b_('Organisation'); ?>
+      </td>
+      <td>
+        <?php echo $banana->profile['org']; ?>
+      </td>
+    </tr>
+    <tr>
+      <th colspan="2">
+        <?php echo _b_('Corps'); ?>
+      </th>
+    </tr>
+    <tr>
+      <td class="<?php echo $css['bicolvpadd'];?>" colspan="2">
+        <textarea name="body" cols="90" rows="16"><?php
+        echo htmlentities($body);
+        if ($banana->profile['sig']) echo "\n\n-- \n".htmlentities($banana->profile['sig']);
+        ?></textarea>
+      </td>
+    </tr>
+    <tr>
+      <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;?>" />
+  <?php
+  } else {
+  ?>
+        <input type="hidden" name="type" value="new" />
+  <?php
+  }
+  ?>
+        <input type="submit" name="action" value="OK" />
+      </td>
+    </tr>
+  </table>
 </form>
 <?php
-displayshortcuts();
+echo displayshortcuts();
 require_once("include/footer.inc.php");
 ?>
index 1c7063d..110d65b 100644 (file)
@@ -30,7 +30,7 @@ displayshortcuts();
 ?>
 
 <form method="post" action="<?php echo $_SERVER['PHP_SELF'];?>">
-<table class="<?php echo $css["bicol"];?>" cellspacing="0" cellpadding="2">
+<table class="bicol" cellspacing="0" cellpadding="2">
   <tr>
     <th>
       <?php echo _b_('Total'); ?>
@@ -52,25 +52,25 @@ foreach ($groups->overview as $g => $d) {
   $groupinfo = $banana->nntp->group($g);
   $newarts = $banana->nntp->newnews($banana->profile['lastnews'], $g);
 ?>
-  <tr class="<?php echo ($pair?$css["pair"]:$css["impair"]);?>" >
-    <td class="<?php echo $css["total"]; ?>">
+  <tr class="<?php echo ($pair?"pair":"impair");?>" >
+    <td class="tot">
       <?php echo $groupinfo[0]; ?>
     </td>
-    <td class="<?php echo $css["unread"]; ?>">
+    <td class="new">
       <input type="checkbox" name="subscribe[]" value="<?php echo $g;?>"
       <?php if (in_array($g, $banana->profile['subscribe'])) echo 'checked="checked"'; ?> />
     </td>
-    <td class="<?php echo $css["group"]; ?>">
+    <td class="grp">
       <?php echo "<a href=\"thread.php?group=$g\">$g</a>";?>
     </td>
-    <td class="<?php echo $css["description"]; ?>">
+    <td class="dsc">
       <?php echo $d[0];?>
     </td>
   </tr>
 <?php
 }
 ?>
-  <tr class="<?php echo (!$pair?$css["pair"]:$css["impair"]); ?>">
+  <tr class="<?php echo (!$pair?"pair":"impair"); ?>">
     <td colspan="4" class="bouton">
       <input type="submit" name="action" value="OK" />
     </td>
index 802254e..16d0332 100644 (file)
--- a/xface.php
+++ b/xface.php
@@ -1,5 +1,6 @@
 <?php
 
-passthru('echo '.escapeshellarg(base64_decode($_REQUEST['face'])).'|uncompface -X |convert xbm:- png:-');
+header('Content-Type: image/jpeg');
+passthru('echo '.escapeshellarg(base64_decode($_REQUEST['face'])).'|uncompface -X |convert xbm:- jpg:-');
 
 ?>