From: x2003bruneau Date: Sun, 9 Jul 2006 19:21:03 +0000 (+0000) Subject: Add vim modeline and retab sources.. X-Git-Tag: 1.8~223 X-Git-Url: http://git.polytechnique.org/?a=commitdiff_plain;h=d55883182213760e1938fca4970fb693b6512d62;p=banana.git Add vim modeline and retab sources.. git-svn-id: svn+ssh://murphy/home/svn/banana/trunk@72 9869982d-c50d-0410-be91-f2a2ec7c7c7b --- diff --git a/banana/NetNNTP.inc.php b/banana/NetNNTP.inc.php index f15b6b1..c6d5c4e 100644 --- a/banana/NetNNTP.inc.php +++ b/banana/NetNNTP.inc.php @@ -507,4 +507,5 @@ class nntp } } +// vim:set et sw=4 sts=4 ts=4 ?> diff --git a/banana/banana.inc.php.in b/banana/banana.inc.php.in index f7ed9e3..b1ec2b2 100644 --- a/banana/banana.inc.php.in +++ b/banana/banana.inc.php.in @@ -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 = '

'._b_('Voulez-vous vraiment annuler ce message ?').'

' . '

' + . htmlentities(makeLink(Array('group' => $group, + 'artid' => $artid))) + . '" method="post">

' . '' . '' . '

'; @@ -311,7 +311,7 @@ class Banana $this->spool->delid($id); $this->nntp->quit(); redirectInBanana(Array('group' => $group, - 'first' => $id)); + 'first' => $id)); } else { return '

'._b_('Impossible d\'annuler le message').'

'; } @@ -336,8 +336,8 @@ class Banana $cuts = displayshortcuts(); $html = '

'._b_('Nouveau message').'

'.$cuts; $html .= '
'; + . htmlentities(makeLink(Array('group' => $group))) + .'" method="post" accept-charset="utf-8">'; $html .= ''; $html .= ''; $html .= ''; @@ -349,16 +349,16 @@ class Banana $html .= ''; if ($this->can_attach) { - $html .= ''; + $html .= ''; $html .= ''; } - $html .= ''; + $html .= ''; $html .= '
'._b_('En-têtes').'
'._b_('Nom').''.htmlentities($this->profile['name']).'
'._b_('Pièce jointe').'
'._b_('Pièce jointe').'
'; $html .= '
'; + $html .= '
'; if ($id > 0) { $html .= ''; } $html .= ''; - $html .= '
'; 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 '

'._b_('Impossible charger la liste des messages').'

'; } - + $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 "

"._b_('Impossible de poster le message')."

".$this->action_showThread($group, $artid); @@ -538,4 +538,5 @@ class Banana } } +// vim:set et sw=4 sts=4 ts=4 ?> diff --git a/banana/groups.inc.php b/banana/groups.inc.php index 36a0e3b..d3293d3 100644 --- a/banana/groups.inc.php +++ b/banana/groups.inc.php @@ -126,7 +126,7 @@ class BananaGroups { if ($show_form) { return '
' - . '
' + . '
' . $html . '
'; } @@ -134,4 +134,5 @@ class BananaGroups { } } +// vim:set et sw=4 sts=4 ts=4 ?> diff --git a/banana/misc.inc.php b/banana/misc.inc.php index 3230618..3a086cf 100644 --- a/banana/misc.inc.php +++ b/banana/misc.inc.php @@ -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 '' . $text . ''; + $link = makeLink($params); + if (is_null($text)) { + $text = $link; + } + $target = null; + if (isset($params['action']) && $params['action'] == 'view') { + $target = ' target="_blank"'; + } + return '' . $text . ''; } /******************************************************************************** @@ -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 .= '
'; $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.''; @@ -463,7 +463,7 @@ function formatbody($_text, $format='plain', $flowed=false) foreach ($formatting as $limit=>$mark) { $res = preg_replace('@' . $limit . '([^\s]+)' . $limit . '@', "<$mark>\\1", $res); } - } + } if ($format != 'html') { global $banana; @@ -487,11 +487,11 @@ function formatbody($_text, $format='plain', $flowed=false) while (preg_match("@(^|
|\n)>@i", $res)) {
             $res  = preg_replace("@(^|
|\n)((>[^\n]*\n)+)@ie",
                 "'\\1
'"
-    		    .".stripslashes(preg_replace('@(^|
|\n)>[ \\t\\r]*@i', '\\1', '\\2'))"
-	    	    .".'
'",
-	            $res);
+                .".stripslashes(preg_replace('@(^|
|\n)>[ \\t\\r]*@i', '\\1', '\\2'))"
+                .".'
'",
+                $res);
         }
-		$res = preg_replace("@
-- ?\n@", "
\n-- \n", $res);
+        $res = preg_replace("@
-- ?\n@", "
\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
 ?>
diff --git a/banana/post.inc.php b/banana/post.inc.php
index 996e9ca..b85f23d 100644
--- a/banana/post.inc.php
+++ b/banana/post.inc.php
@@ -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 .=  '
'; $i++; @@ -427,4 +427,5 @@ class BananaPost } } +// vim:set et sw=4 sts=4 ts=4 ?> diff --git a/banana/spool.inc.php b/banana/spool.inc.php index c7a7dae..e681a40 100644 --- a/banana/spool.inc.php +++ b/banana/spool.inc.php @@ -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 .= ''.htmlentities($subject).''; } else { $res .= makeHREF(Array('group' => $this->group, - 'artid' => $_id), - htmlentities($subject)); + 'artid' => $_id), + htmlentities($subject)); } $res .= "\n".formatFrom($this->overview[$_id]->from)."\n"; @@ -438,4 +438,5 @@ class BananaSpool } } +// vim:set et sw=4 sts=4 ts=4 ?> diff --git a/banana/utf8.php b/banana/utf8.php index c847bdd..586bc31 100644 --- a/banana/utf8.php +++ b/banana/utf8.php @@ -82,4 +82,5 @@ function utf8entities($source) return $encodedString; } +// vim:set et sw=4 sts=4 ts=4 ?> diff --git a/examples/index.php b/examples/index.php index 1fd3455..30983df 100644 --- a/examples/index.php +++ b/examples/index.php @@ -36,4 +36,6 @@ if ($res != "") { diff --git a/examples/spoolgen.php b/examples/spoolgen.php index fad7ef5..0ad6b52 100644 --- a/examples/spoolgen.php +++ b/examples/spoolgen.php @@ -51,4 +51,6 @@ class MyBanana extends Banana $banana = new MyBanana(); $banana->createAllSpool(); + +// vim:set et sw=4 sts=4 ts=4 ?> diff --git a/examples/xface.php b/examples/xface.php index 16d0332..5e69c89 100644 --- a/examples/xface.php +++ b/examples/xface.php @@ -1,6 +1,9 @@