Add vim modeline and retab sources..
authorx2003bruneau <x2003bruneau@9869982d-c50d-0410-be91-f2a2ec7c7c7b>
Sun, 9 Jul 2006 19:21:03 +0000 (19:21 +0000)
committerFlorent Bruneau <florent.bruneau@polytechnique.org>
Fri, 4 Jan 2008 23:34:50 +0000 (00:34 +0100)
git-svn-id: svn+ssh://murphy/home/svn/banana/trunk@72 9869982d-c50d-0410-be91-f2a2ec7c7c7b

banana/NetNNTP.inc.php
banana/banana.inc.php.in
banana/groups.inc.php
banana/misc.inc.php
banana/post.inc.php
banana/spool.inc.php
banana/utf8.php
examples/index.php
examples/spoolgen.php
examples/xface.php

index f15b6b1..c6d5c4e 100644 (file)
@@ -507,4 +507,5 @@ class nntp
     }
 }
 
+// vim:set et sw=4 sts=4 ts=4 
 ?>
index f7ed9e3..b1ec2b2 100644 (file)
@@ -82,7 +82,7 @@ class Banana
     var $post;
     var $spool;
 
-       var $get;
+    var $get;
 
     function Banana()
     {
@@ -94,10 +94,10 @@ class Banana
         }
     }
 
-       /** Run Banana
-        * @param STRING class Name of the class to use
-        * @param ARRAY  myget If defined is used instead of get
-        */
+    /** Run Banana
+     * @param STRING class Name of the class to use
+     * @param ARRAY  myget If defined is used instead of get
+     */
     function run($class = 'Banana', $myget = null)
     {
         global $banana;
@@ -152,9 +152,9 @@ class Banana
                         if ($banana->post->checkcancel()) {
                             $form = '<p class="error">'._b_('Voulez-vous vraiment annuler ce message ?').'</p>'
                                   . '<form action="' 
-                                                                 . htmlentities(makeLink(Array('group' => $group,
-                                                                                                                               'artid' => $artid)))
-                                                                 . '" method="post"><p>'
+                                  . htmlentities(makeLink(Array('group' => $group,
+                                                                'artid' => $artid)))
+                                  . '" method="post"><p>'
                                   . '<input type="hidden" name="action" value="cancel" />'
                                   . '<input type="submit" value="Annuler !" />'
                                   . '</p></form>';
@@ -311,7 +311,7 @@ class Banana
             $this->spool->delid($id);
             $this->nntp->quit();
             redirectInBanana(Array('group' => $group,
-                                                  'first' => $id));
+                           'first' => $id));
         } else {
             return '<p class="error">'._b_('Impossible d\'annuler le message').'</p>';
         }
@@ -336,8 +336,8 @@ class Banana
         $cuts  = displayshortcuts();
         $html  = '<h1>'._b_('Nouveau message').'</h1>'.$cuts;
         $html .= '<form enctype="multipart/form-data" action="'
-                          . htmlentities(makeLink(Array('group' => $group)))
-                          .'" method="post" accept-charset="utf-8">';
+               . htmlentities(makeLink(Array('group' => $group)))
+               .'" method="post" accept-charset="utf-8">';
         $html .= '<table class="bicol" cellpadding="0" cellspacing="0">';
         $html .= '<tr><th colspan="2">'._b_('En-têtes').'</th></tr>';
         $html .= '<tr><td>'._b_('Nom').'</td><td>'.htmlentities($this->profile['name']).'</td></tr>';
@@ -349,16 +349,16 @@ class Banana
         $html .= '<tr><td colspan="2"><textarea name="body" cols="74" rows="16">'
               .  to_entities($body).($this->profile['sig'] ? "\n\n-- \n".htmlentities($this->profile['sig']) : '').'</textarea></td></tr>';
         if ($this->can_attach) {
-               $html .= '<tr><th colspan="2">'._b_('Pièce jointe').'</th></tr>';
+            $html .= '<tr><th colspan="2">'._b_('Pièce jointe').'</th></tr>';
             $html .= '<tr><td colspan="2"><input type="hidden" name="MAX_FILE_SIZE" value="'.$this->maxfilesize.'" />';
             $html .= '<input type="file" name="newpj" size="40"/></td></tr>';
         }
-           $html .= '<tr><th colspan="2">';
+        $html .= '<tr><th colspan="2">';
         if ($id > 0) {
             $html .= '<input type="hidden" name="artid" value="'.$id.'" />';
         }
         $html .= '<input type="hidden" name="action" value="new" />';
-       $html .= '<input type="submit" value="Envoyer le message" /></th></tr>';
+        $html .= '<input type="submit" value="Envoyer le message" /></th></tr>';
         $html .= '</table></form>';
 
         return $html.$cuts;
@@ -374,19 +374,19 @@ class Banana
             }
         }
        
-               $forums = preg_split('/\s*(,|;)\s*/', $_POST['newsgroups']);
-               $fup    = $_POST['followup'];
-               if (sizeof($forums) > 1) {
-                       if (empty($fup)) {
-                               $fup = $forums[0];
-                       }
-               }
-               $to     = implode(',', $forums);
-               
+        $forums = preg_split('/\s*(,|;)\s*/', $_POST['newsgroups']);
+        $fup    = $_POST['followup'];
+        if (sizeof($forums) > 1) {
+            if (empty($fup)) {
+                $fup = $forums[0];
+            }
+        }
+        $to     = implode(',', $forums);
+        
         if (!$this->_newSpool($group, $this->profile['display'], $this->profile['lastnews'])) {
             return '<p class="error">'._b_('Impossible charger la liste des messages').'</p>';
         }
-               
+        
         $body = preg_replace("/\n\.[ \t\r]*\n/m", "\n..\n", $_POST['body']);
         $msg  = 'From: ' . $this->profile['name'] . "\n"
               . "Newsgroups: ". $to . "\n"
@@ -444,10 +444,10 @@ class Banana
         $msg .= $this->custom.$this->profile['customhdr']."\n".$body;
 
         if ($this->nntp->post($msg)) {
-                       $dir = Array('group' => $group);
-                       if ($artid != -1) {
-                               $dir['first'] = $artid;
-                       }
+            $dir = Array('group' => $group);
+            if ($artid != -1) {
+                $dir['first'] = $artid;
+            }
             redirectInBanana($dir);
         } else {
             return "<p class=\"error\">"._b_('Impossible de poster le message')."</p>".$this->action_showThread($group, $artid);
@@ -538,4 +538,5 @@ class Banana
     }
 }
 
+// vim:set et sw=4 sts=4 ts=4
 ?>
index 36a0e3b..d3293d3 100644 (file)
@@ -126,7 +126,7 @@ class BananaGroups {
 
         if ($show_form) {
             return '<form method="post" action="' . htmlentities(makeLink(Array())) . '">'
-                               . '<div class="center"><input type="submit" value="Valider" name="validsubs" /></div>'
+                . '<div class="center"><input type="submit" value="Valider" name="validsubs" /></div>'
                 . $html . '<div class="center"><input type="submit" value="Valider" name="validsubs" /></div></form>';
         }
         
@@ -134,4 +134,5 @@ class BananaGroups {
     }
 }
 
+// vim:set et sw=4 sts=4 ts=4
 ?>
index 3230618..3a086cf 100644 (file)
@@ -35,7 +35,7 @@ function textFormat_translate($format)
  */
 function redirectInBanana($params)
 {
-       header('Location: ' . makeLink($params));
+    header('Location: ' . makeLink($params));
 }
 
 /** Make a link using the given parameters
@@ -53,27 +53,27 @@ function redirectInBanana($params)
  */
 function makeLink($params)
 {
-       if (function_exists('hook_makeLink')
-                       && $res = hook_makeLink($params)) {
-               return $res;
-       }
+    if (function_exists('hook_makeLink')
+            && $res = hook_makeLink($params)) {
+        return $res;
+    }
     $proto = empty($_SERVER['HTTPS']) ? 'http://' : 'https://';
     $host  = $_SERVER['HTTP_HOST'];
     $file  = $_SERVER['PHP_SELF'];
 
-       if (count($params) != 0) {
-               $get = '?';
-               foreach ($params as $key=>$value) {
-                       if (strlen($get) != 1) {
-                               $get .= '&';
-                       }
-                       $get .= $key . '=' . $value;
-               }
-       } else {
-               $get = '';
-       }
-
-       return $proto . $host . $file . $get;
+    if (count($params) != 0) {
+        $get = '?';
+        foreach ($params as $key=>$value) {
+            if (strlen($get) != 1) {
+                $get .= '&';
+            }
+            $get .= $key . '=' . $value;
+        }
+    } else {
+        $get = '';
+    }
+
+    return $proto . $host . $file . $get;
 }
 
 /** Format a link to be use in a link
@@ -81,15 +81,15 @@ function makeLink($params)
  */
 function makeHREF($params, $text = null)
 {
-       $link = makeLink($params);
-       if (is_null($text)) {
-               $text = $link;
-       }
-       $target = null;
-       if (isset($params['action']) && $params['action'] == 'view') {
-               $target = ' target="_blank"';
-       }
-       return '<a href="' . htmlentities($link) . $target . '">' . $text . '</a>';
+    $link = makeLink($params);
+    if (is_null($text)) {
+        $text = $link;
+    }
+    $target = null;
+    if (isset($params['action']) && $params['action'] == 'view') {
+        $target = ' target="_blank"';
+    }
+    return '<a href="' . htmlentities($link) . $target . '">' . $text . '</a>';
 }
 
 /********************************************************************************
@@ -321,9 +321,9 @@ function displayshortcuts($first = -1) {
 
     if (is_null($artid)) {
         $res .= '[' . makeHREF(Array('group'  => $group,
-                                                                        'action' => 'new'),
-                                                          _b_('Nouveau message'))
-                         . '] ';
+                                     'action' => 'new'),
+                               _b_('Nouveau message'))
+              . '] ';
         if (sizeof($banana->spool->overview)>$banana->tmax) {
             $res .= '<br />';
             $n = intval(log(count($banana->spool->overview), 10))+1;
@@ -332,25 +332,25 @@ function displayshortcuts($first = -1) {
                     $fmt = "[%0{$n}u-%0{$n}u] ";
                 } else {
                     $fmt = '[' . makeHREF(Array('group' => $group,
-                                                                   'first' => $ndx),
-                                                                                 '%0' . $n . 'u-%0' . $n . 'u')
-                                                . '] ';
+                                                'first' => $ndx),
+                                          '%0' . $n . 'u-%0' . $n . 'u')
+                         . '] ';
                 }
                 $res .= sprintf($fmt, $ndx, min($ndx+$banana->tmax-1,sizeof($banana->spool->overview)));
             }
         }
     } else {
         $res .= '[' . makeHREF(Array('group'  => $group,
-                                            'artid'  => $artid,
-                                                                        'action' => 'new'),
-                                                          _b_('Répondre'))
-                         . '] ';
+                                     'artid'  => $artid,
+                                     'action' => 'new'),
+                               _b_('Répondre'))
+              . '] ';
         if ($banana->post && $banana->post->checkcancel()) {
             $res .= '[' . makeHREF(Array('group'  => $group,
-                                                    'artid'  => $artid,
-                                                                                'action' => 'cancel'), 
-                                                                  _b_('Annuler ce message'))
-                                 . '] ';
+                                         'artid'  => $artid,
+                                         'action' => 'cancel'), 
+                                   _b_('Annuler ce message'))
+                  . '] ';
         }
     }
     return $res.'</div>';
@@ -463,7 +463,7 @@ function formatbody($_text, $format='plain', $flowed=false)
         foreach ($formatting as $limit=>$mark) {
             $res = preg_replace('@' . $limit . '([^\s]+)' . $limit . '@', "<$mark>\\1</$mark>", $res);
         }
-       }
+    }
 
     if ($format != 'html') {
         global $banana;
@@ -487,11 +487,11 @@ function formatbody($_text, $format='plain', $flowed=false)
         while (preg_match("@(^|<pre>|\n)&gt;@i", $res)) {
             $res  = preg_replace("@(^|<pre>|\n)((&gt;[^\n]*\n)+)@ie",
                 "'\\1</pre><blockquote><pre>'"
-                   .".stripslashes(preg_replace('@(^|<pre>|\n)&gt;[ \\t\\r]*@i', '\\1', '\\2'))"
-                   .".'</pre></blockquote><pre>'",
-                   $res);
+                .".stripslashes(preg_replace('@(^|<pre>|\n)&gt;[ \\t\\r]*@i', '\\1', '\\2'))"
+                .".'</pre></blockquote><pre>'",
+                $res);
         }
-               $res = preg_replace("@<pre>-- ?\n@", "<pre>\n-- \n", $res);
+        $res = preg_replace("@<pre>-- ?\n@", "<pre>\n-- \n", $res);
         $parts = preg_split("/\n-- ?\n/", $res);
     }
 
@@ -510,4 +510,5 @@ function formatbody($_text, $format='plain', $flowed=false)
     }
 }
 
+// vim:set et sw=4 sts=4 ts=4
 ?>
index 996e9ca..b85f23d 100644 (file)
@@ -374,9 +374,9 @@ class BananaPost
                 $format = textFormat_translate($format[1]);
                 if ($i != $partid) {
                     $res .= makeHREF(Array('group' => $banana->state['group'],
-                                                                                  'artid' => $this->id,
-                                                                                  'part'  => $i),
-                                                                        $format);
+                                           'artid' => $this->id,
+                                           'part'  => $i),
+                                     $format);
                 } else {
                     $res .= $format;
                 }
@@ -404,14 +404,14 @@ class BananaPost
             foreach ($this->pj as $file) {
                 $res .= $file['filename'].' ('.$file['MIME'].') : ';
                 $res .= makeHREF(Array('group' => $banana->state['group'],
-                                                      'artid' => $this->id,
-                                                                          'pj'    => $i),
-                                                                _b_('télécharger'));
-                               $res .= ' . ';
+                                       'artid' => $this->id,
+                                       'pj'    => $i),
+                                 _b_('télécharger'));
+                $res .= ' . ';
                 $res .= makeHREF(Array('group' => $banana->state['group'],
                                        'artid' => $this->id,
                                        'pj'    => $i,
-                                                                          'action'=> 'view'),
+                                       'action'=> 'view'),
                                  _b_('aperçu'));
                 $res .=  '<br/>';
                 $i++;
@@ -427,4 +427,5 @@ class BananaPost
     }
 }
 
+// vim:set et sw=4 sts=4 ts=4
 ?>
index c7a7dae..e681a40 100644 (file)
@@ -107,19 +107,19 @@ class BananaSpool
         $first   = $banana->maxspool ? max($groupinfo[2] - $banana->maxspool, $groupinfo[1]) : $groupinfo[1];
         $last    = $groupinfo[2]; 
 
-               if ($this->version == BANANA_SPOOL_VERSION && is_array($this->overview)) {
-                       $mids = array_keys($this->overview);
-                       foreach ($mids as $id) {
-                               if (($first <= $last && ($id < $first || $id > $last))
-                                               || ($first > $last && $id < $first && $id > $last))
-                               {
+        if ($this->version == BANANA_SPOOL_VERSION && is_array($this->overview)) {
+            $mids = array_keys($this->overview);
+            foreach ($mids as $id) {
+                if (($first <= $last && ($id < $first || $id > $last))
+                        || ($first > $last && $id < $first && $id > $last))
+                {
                     $this->delid($id, false);
                     $do_save = true;
                 }
             }
             if (!empty($this->overview)) {
                 $first = max(array_keys($this->overview))+1;
-                       }
+            }
         } else {
             unset($this->overview, $this->ids);
             $this->version = BANANA_SPOOL_VERSION;
@@ -346,8 +346,8 @@ class BananaSpool
                 $res .= '<span class="cur">'.htmlentities($subject).'</span>';
             } else {
                 $res .= makeHREF(Array('group' => $this->group,
-                                                                          'artid' => $_id),
-                                                                htmlentities($subject));
+                                       'artid' => $_id),
+                                 htmlentities($subject));
             }
             $res .= "</td>\n<td class='from'>".formatFrom($this->overview[$_id]->from)."</td>\n</tr>";
 
@@ -438,4 +438,5 @@ class BananaSpool
     }
 }
 
+// vim:set et sw=4 sts=4 ts=4
 ?>
index c847bdd..586bc31 100644 (file)
@@ -82,4 +82,5 @@ function utf8entities($source)
    return $encodedString;\r
 }\r
 \r
+// vim:set et sw=4 sts=4 ts=4\r
 ?>\r
index 1fd3455..30983df 100644 (file)
@@ -36,4 +36,6 @@ if ($res != "") {
 </html>
 <?php
 }
+
+// vim:set et sw=4 sts=4 ts=4
 ?>
index fad7ef5..0ad6b52 100644 (file)
@@ -51,4 +51,6 @@ class MyBanana extends Banana
 
 $banana = new MyBanana();
 $banana->createAllSpool();
+
+// vim:set et sw=4 sts=4 ts=4
 ?>
index 16d0332..5e69c89 100644 (file)
@@ -1,6 +1,9 @@
 <?php
 
 header('Content-Type: image/jpeg');
-passthru('echo '.escapeshellarg(base64_decode($_REQUEST['face'])).'|uncompface -X |convert xbm:- jpg:-');
+passthru('echo ' . escapeshellarg(base64_decode($_REQUEST['face']))
+        . '| uncompface -X '
+        . '| convert xbm:- jpg:-');
 
+// vim:set et sw=4 sts=4 ts=4
 ?>