From bd4d80f0846bcc0dd943bd561c77680f18bae831 Mon Sep 17 00:00:00 2001 From: Florent Bruneau Date: Sun, 30 Sep 2007 12:40:56 +0200 Subject: [PATCH] Show poster photo in banana headers Signed-off-by: Florent Bruneau --- ChangeLog | 3 ++ include/banana/hooks.inc.php | 27 ++++++++++++++++ modules/banana.php | 53 ++++++++++++++++++------------ templates/banana/profile.tpl | 76 ++++++++++++++++++++------------------------ upgrade/0.9.15/07_forums.sql | 5 +++ 5 files changed, 101 insertions(+), 63 deletions(-) create mode 100644 upgrade/0.9.15/07_forums.sql diff --git a/ChangeLog b/ChangeLog index 578720c..9de2333 100644 --- a/ChangeLog +++ b/ChangeLog @@ -3,6 +3,9 @@ VERSION 0.9.15 XX XX 2007 New: + * Banana: + - Show poster photo -FRU + * Core: - Auto-redirect HTML pages to HTTPS -FRU diff --git a/include/banana/hooks.inc.php b/include/banana/hooks.inc.php index 54c5f53..f996497 100644 --- a/include/banana/hooks.inc.php +++ b/include/banana/hooks.inc.php @@ -170,6 +170,33 @@ function hook_makeLink($params) } } +function hook_hasXFace($headers) +{ + return isset($headers['x-org-id']) || isset($headers['x-org-mail']); +} + +function hook_getXFace($headers) +{ + $login = @$headers['x-org-id']; + if (!$login) { + @list($login, ) = explode('@', $headers['x-org-mail']); + } + if (!$login) { + return false; + } + if (isset($headers['x-face'])) { + $res = XDB::query("SELECT p.uid + FROM forums.profils AS p + INNER JOIN aliases AS a ON (p.uid = a.id) + WHERE FIND_IN_SET('xface', p.flags) AND a.alias = {?}", + $login); + if ($res->numRows()) { + return false; + } + } + pl_redirect('photo/' . $login); +} + function hook_makeJs($src) { global $page; diff --git a/modules/banana.php b/modules/banana.php index 891b505..640012d 100644 --- a/modules/banana.php +++ b/modules/banana.php @@ -82,31 +82,42 @@ class BananaModule extends PLModule && Post::has('bananaupdate') && Post::v('action')=="OK" )) { $req = XDB::query(" - SELECT nom,mail,sig,if(FIND_IN_SET('threads',flags),'1','0'), - IF(FIND_IN_SET('automaj',flags),'1','0') + SELECT nom, mail, sig, + FIND_IN_SET('threads', flags), + FIND_IN_SET('automaj', flags), + FIND_IN_SET('xface', flags) FROM forums.profils WHERE uid = {?}", S::v('uid')); - if (!(list($nom,$mail,$sig,$disp,$maj) = $req->fetchOneRow())) { - $nom = S::v('prenom').' '.S::v('nom'); - $mail = S::v('forlife').'@'.$globals->mail->domain; - $sig = $nom.' ('.S::v('promo').')'; - $disp = 0; - $maj = 0; + if (!(list($nom, $mail, $sig, $disp, $maj, $xface) = $req->fetchOneRow())) { + $nom = S::v('prenom').' '.S::v('nom'); + $mail = S::v('forlife').'@'.$globals->mail->domain; + $sig = $nom.' ('.S::v('promo').')'; + $disp = 0; + $maj = 0; + $xface = 0; } - $page->assign('nom' , $nom); - $page->assign('mail', $mail); - $page->assign('sig' , $sig); - $page->assign('disp', $disp); - $page->assign('maj' , $maj); + $page->assign('nom' , $nom); + $page->assign('mail', $mail); + $page->assign('sig', $sig); + $page->assign('disp', $disp); + $page->assign('maj', $maj); + $page->assign('xface', $xface); } else { - XDB::execute( - 'REPLACE INTO forums.profils (uid,sig,mail,nom,flags) - VALUES ({?},{?},{?},{?},{?})', - S::v('uid'), Post::v('bananasig'), - Post::v('bananamail'), Post::v('banananame'), - (Post::b('bananadisplay') ? 'threads,' : '') . - (Post::b('bananaupdate') ? 'automaj' : '') - ); + $flags = array(); + if (Post::b('bananadisplay')) { + $flags[] = 'threads'; + } + if (Post::b('bananaupdate')) { + $flags[] = 'automaj'; + } + if (Post::b('bananaxface')) { + $flags[] = 'xface'; + } + XDB::execute("REPLACE INTO forums.profils (uid, sig, mail, nom, flags) + VALUES ({?}, {?}, {?}, {?}, {?})", + S::v('uid'), Post::v('bananasig'), + Post::v('bananamail'), Post::v('banananame'), + implode(',', $flags)); } } diff --git a/templates/banana/profile.tpl b/templates/banana/profile.tpl index 4298195..bb97abd 100644 --- a/templates/banana/profile.tpl +++ b/templates/banana/profile.tpl @@ -38,7 +38,7 @@ {if !$smarty.post.action}

- Tu peux régler quelques paramètres qui apparaîtront sur les messages lorsque + Tu peux régler quelques paramètres qui apparaîtront sur les messages lorsque tu posteras sur les forums. Cela ne te permettra pas d'être anonyme, puisque tout le monde pourra remonter à ton identité en regardant ta fiche. L'objectif est simplement de permettre plus de convivialité. @@ -53,66 +53,50 @@

- + - - - + + + - - - + + + - - - + + + - - + + - + - - +
- Profil Banana - Profil Banana
- Nom - - -
Nom
- Adresse électronique - - -
Adresse électronique
- Signature - - -
Signature
- Affichage des fils de discussion -
Affichage des fils de discussion - Afficher tous + Afficher tous les messages
- Afficher - seulement les fils de discussion contenant des messages non lus + Afficher + seulement les fils de discussion contenant des messages non lus
- Mise à jour des messages non lus - Mise à jour des messages non lus - Automatique
- Manuelle
- +
+ +
+
{else} @@ -125,4 +109,12 @@ +

+ {icon name="lightbulb" title="Astuce"}Astuce : + Tu peux également consulter les fora en utilisant un client NNTP tel que + Outlook Express ou Thunderbird.
N'hésite pas à + consulter la documentation et à activer ton accès pour utiliser ce service. +

+ + {* vim:set et sw=2 sts=2 sws=2 enc=utf-8: *} diff --git a/upgrade/0.9.15/07_forums.sql b/upgrade/0.9.15/07_forums.sql new file mode 100644 index 0000000..86419fc --- /dev/null +++ b/upgrade/0.9.15/07_forums.sql @@ -0,0 +1,5 @@ +use forums; +alter table profils change flags flags set('threads','automaj','xface') not null; +use x4dat; + +# vim:set syntax=mysql: -- 2.1.4