}
}
+// vim:set et sw=4 sts=4 ts=4
?>
var $post;
var $spool;
- var $get;
+ var $get;
function 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;
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>';
$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>';
}
$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>';
$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;
}
}
- $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"
$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);
}
}
+// vim:set et sw=4 sts=4 ts=4
?>
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>';
}
}
}
+// vim:set et sw=4 sts=4 ts=4
?>
*/
function redirectInBanana($params)
{
- header('Location: ' . makeLink($params));
+ header('Location: ' . makeLink($params));
}
/** Make a link using the given parameters
*/
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
*/
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>';
}
/********************************************************************************
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;
$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>';
foreach ($formatting as $limit=>$mark) {
$res = preg_replace('@' . $limit . '([^\s]+)' . $limit . '@', "<$mark>\\1</$mark>", $res);
}
- }
+ }
if ($format != 'html') {
global $banana;
while (preg_match("@(^|<pre>|\n)>@i", $res)) {
$res = preg_replace("@(^|<pre>|\n)((>[^\n]*\n)+)@ie",
"'\\1</pre><blockquote><pre>'"
- .".stripslashes(preg_replace('@(^|<pre>|\n)>[ \\t\\r]*@i', '\\1', '\\2'))"
- .".'</pre></blockquote><pre>'",
- $res);
+ .".stripslashes(preg_replace('@(^|<pre>|\n)>[ \\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);
}
}
}
+// vim:set et sw=4 sts=4 ts=4
?>
$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;
}
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++;
}
}
+// vim:set et sw=4 sts=4 ts=4
?>
$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;
$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>";
}
}
+// vim:set et sw=4 sts=4 ts=4
?>
return $encodedString;\r
}\r
\r
+// vim:set et sw=4 sts=4 ts=4\r
?>\r
</html>
<?php
}
+
+// vim:set et sw=4 sts=4 ts=4
?>
$banana = new MyBanana();
$banana->createAllSpool();
+
+// vim:set et sw=4 sts=4 ts=4
?>
<?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
?>