From 5350d75199c4f10940ce8954c1bb302f8a49ead9 Mon Sep 17 00:00:00 2001 From: Florent Bruneau Date: Fri, 28 Mar 2008 10:33:59 +0100 Subject: [PATCH] Fix profile link in public search for unregistered users. Signed-off-by: Florent Bruneau --- modules/profile.php | 8 ++++++-- plugins/function.make_forlife.php | 29 +++++++++++++++++++++++++++++ templates/include/minifiche.tpl | 5 ++--- 3 files changed, 37 insertions(+), 5 deletions(-) create mode 100644 plugins/function.make_forlife.php diff --git a/modules/profile.php b/modules/profile.php index d8780f2..a8d2c57 100644 --- a/modules/profile.php +++ b/modules/profile.php @@ -190,11 +190,15 @@ class ProfileModule extends PLModule WHERE matricule={?}", $x); $login = $res->fetchOneCell(); } else { - $login = get_user_forlife($x); + $login = get_user_forlife($x, S::logged() ? '_default_user_callback' + : '_silent_user_callback'); } if (empty($login)) { - if (preg_match('/([-a-z]+)\.([-a-z]+)\.([0-9]{4})/i', $x, $matches)) { + if (!S::logged()) { + $page->kill("Ce camarade n'a pas de fiche publique."); + return; + } else if (preg_match('/([-a-z]+)\.([-a-z]+)\.([0-9]{4})/i', $x, $matches)) { $matches = str_replace('-', '_', $matches); $res = XDB::query("SELECT user_id FROM auth_user_md5 diff --git a/plugins/function.make_forlife.php b/plugins/function.make_forlife.php new file mode 100644 index 0000000..8578f90 --- /dev/null +++ b/plugins/function.make_forlife.php @@ -0,0 +1,29 @@ + diff --git a/templates/include/minifiche.tpl b/templates/include/minifiche.tpl index 959f017..66ecc64 100644 --- a/templates/include/minifiche.tpl +++ b/templates/include/minifiche.tpl @@ -20,15 +20,14 @@ {* *} {**************************************************************************} - {if (!$c.inscrit && $smarty.session.auth ge AUTH_COOKIE) || $c.dcd}
{/if}
{if $c.sexe}•{/if} - {if !$c.dcd && $c.inscrit}{/if} + {if !$c.dcd && ($c.inscrit || $smarty.session.auth eq AUTH_PUBLIC)}{/if} {if $c.nom_usage}{$c.nom_usage} {$c.prenom}
({$c.nom}){else}{$c.nom} {$c.prenom}{/if} - {if !$c.dcd && $c.inscrit}
{/if} + {if !$c.dcd && ($c.inscrit || $smarty.session.auth eq AUTH_PUBLIC)}{/if}
-- 2.1.4