* Core:
- Work hard to add nice URI's into Platal. -MC
+ * Banana:
+ - Switch to the new URI scheme. -MC
+
* Emails:
- Switch to the new URI scheme. -MC
+++ /dev/null
-<?php
-/********************************************************************************
-* index.php : main page (newsgroups list)
-* -----------
-*
-* This file is part of the banana distribution
-* Copyright: See COPYING files that comes with this distribution
-********************************************************************************/
-
-require_once('xorg.inc.php');
-new_skinned_page('banana/index.tpl', AUTH_COOKIE);
-$page->addCssLink('css/banana/style.css');
-$page->assign('xorg_title','Polytechnique.org - Forums & PA');
-require_once('banana.inc.php');
-
-$res = PlatalBanana::run();
-$page->assign_by_ref('banana', $banana);
-$page->assign('banana_res', $res);
-$page->run();
-?>
+++ /dev/null
-<?php
-/***************************************************************************
- * Copyright (C) 2003-2006 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 *
- ***************************************************************************/
-
-require_once("xorg.inc.php");
-new_skinned_page('banana/profile.tpl', AUTH_MDP);
-
-if (!(Post::has('action') && Post::has('banananame') && Post::has('bananasig') && Post::has('bananadisplay')
- && Post::has('bananamail') && Post::has('bananaupdate') && Post::get('action')=="OK" ))
-{
- $req = $globals->xdb->query("
- SELECT nom,mail,sig,if(FIND_IN_SET('threads',flags),'1','0'),
- IF(FIND_IN_SET('automaj',flags),'1','0')
- FROM forums.profils
- WHERE uid = {?}", Session::getInt('uid'));
- if (!(list($nom,$mail,$sig,$disp,$maj) = $req->fetchOneRow())) {
- $nom = Session::get('prenom').' '.Session::get('nom');
- $mail = Session::get('forlife').'@'.$globals->mail->domain;
- $sig = $nom.' ('.Session::getInt('promo').')';
- $disp = 0;
- $maj = 0;
- }
- $page->assign('nom' , $nom);
- $page->assign('mail', $mail);
- $page->assign('sig' , $sig);
- $page->assign('disp', $disp);
- $page->assign('maj' , $maj);
-} else {
- $globals->xdb->execute(
- 'REPLACE INTO forums.profils (uid,sig,mail,nom,flags)
- VALUES ({?},{?},{?},{?},{?})',
- Session::getInt('uid'), Post::get('bananasig'), Post::get('bananamail'), Post::get('banananame'),
- (Post::getBool('bananadisplay') ? 'threads,' : '') . (Post::getBool('bananaupdate') ? 'automaj' : '')
- );
-}
-
-$page->run();
-?>
+++ /dev/null
-<?php
-
-header('Content-Type: image/jpeg');
-passthru('echo '.escapeshellarg(base64_decode($_REQUEST['face'])).'|uncompface -X |convert xbm:- jpg:-');
-
-?>
$globals->xdb->execute("UPDATE auth_user_quick SET banana_last={?} WHERE user_id={?}", gmdate("YmdHis"), $uid);
}
- $req = $globals->xdb->query(
- "SELECT nom
+ $req = $globals->xdb->query("
+ SELECT nom
FROM {$globals->banana->table_prefix}abos
LEFT JOIN {$globals->banana->table_prefix}list ON list.fid=abos.fid
WHERE uid={?}", $uid);
bin/banana.spoolgen.php
hooks/banana.inc.php
-htdocs/banana/index.php
-htdocs/banana/profile.php
-htdocs/banana/xface.php
include/banana.inc.php
-templates/banana/index.tpl
-templates/banana/profile.tpl
--- /dev/null
+<?php
+/***************************************************************************
+ * Copyright (C) 2003-2006 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 *
+ ***************************************************************************/
+
+class BananaModule extends PLModule
+{
+ function handlers()
+ {
+ return array(
+ 'banana' => $this->make_hook('banana', AUTH_COOKIE),
+ 'banana/profile' => $this->make_hook('profile', AUTH_MDP),
+ 'banana/xface' => $this->make_hook('xface', AUTH_PUBLIC),
+ );
+ }
+
+ function handler_banana(&$page)
+ {
+ $page->changeTpl('banana/index.tpl');
+ $page->addCssLink('css/banana/style.css');
+ $page->assign('xorg_title','Polytechnique.org - Forums & PA');
+
+ require_once 'banana.inc.php';
+
+ $res = PlatalBanana::run();
+ $page->assign_by_ref('banana', $banana);
+ $page->assign('banana_res', $res);
+
+ return PL_OK;
+ }
+
+ function handler_profile(&$page)
+ {
+ global $globals;
+
+ $page->changeTpl('banana/profile.tpl');
+
+ if (!(Post::has('action') && Post::has('banananame') && Post::has('bananasig')
+ && Post::has('bananadisplay') && Post::has('bananamail')
+ && Post::has('bananaupdate') && Post::get('action')=="OK" ))
+ {
+ $req = $globals->xdb->query("
+ SELECT nom,mail,sig,if(FIND_IN_SET('threads',flags),'1','0'),
+ IF(FIND_IN_SET('automaj',flags),'1','0')
+ FROM forums.profils
+ WHERE uid = {?}", Session::getInt('uid'));
+ if (!(list($nom,$mail,$sig,$disp,$maj) = $req->fetchOneRow())) {
+ $nom = Session::get('prenom').' '.Session::get('nom');
+ $mail = Session::get('forlife').'@'.$globals->mail->domain;
+ $sig = $nom.' ('.Session::getInt('promo').')';
+ $disp = 0;
+ $maj = 0;
+ }
+ $page->assign('nom' , $nom);
+ $page->assign('mail', $mail);
+ $page->assign('sig' , $sig);
+ $page->assign('disp', $disp);
+ $page->assign('maj' , $maj);
+ } else {
+ $globals->xdb->execute(
+ 'REPLACE INTO forums.profils (uid,sig,mail,nom,flags)
+ VALUES ({?},{?},{?},{?},{?})',
+ Session::getInt('uid'), Post::get('bananasig'), Post::get('bananamail'), Post::get('banananame'),
+ (Post::getBool('bananadisplay') ? 'threads,' : '') . (Post::getBool('bananaupdate') ? 'automaj' : '')
+ );
+ }
+
+ return PL_OK;
+ }
+
+ function handler_xface(&$page)
+ {
+ header('Content-Type: image/jpeg');
+ passthru('echo '.escapeshellarg(base64_decode($_REQUEST['face'])).
+ '|uncompface -X |convert xbm:- jpg:-');
+ exit;
+ }
+}
+
+?>
{if !$banana->profile.autoup}
[<a href="?banana=updateall">Mettre à jour</a>]
{/if}
-[<a href="profile.php">Profil</a>]
+[<a href="{rel}/banana/profile">Profil</a>]
<br />
n'afficher que les fils de discussion contenant des messages lus.
</p>
<p class="normal">
-Retour aux <a href="{rel}/banana/">forums</a>
+Retour aux <a href="{rel}/banana">forums</a>
</p>
-<form action="{$smarty.server.PHP_SELF}" method="post">
+<form action="{rel}/banana/profile" method="post">
<table class="bicol" cellpadding="3" cellspacing="0" summary="Configuration de Banana">
<tr>
<th colspan="2">
Ton profil est enregistré !!!
</p>
<p class="normal">
-Retour aux <a href="{rel}/banana/">forums</a>
+Retour aux <a href="{rel}/banana">forums</a>
</p>
{/if}
<li>
<ul>
- {page title="Configuration de Banana" url="confbanana.php"|url}
+ {page title="Configuration de Banana" url="banana/profile"|url}
Pour configurer les paramètres de l'interface web Banana de lecture de forums.
{/page}