bug 270 : affichage des infos publiques dans la recherche publique
authorPascal Corpet <pascal.corpet@m4x.org>
Tue, 1 Feb 2005 16:09:50 +0000 (16:09 +0000)
committerFlorent Bruneau <florent.bruneau@polytechnique.org>
Thu, 26 Jun 2008 21:27:58 +0000 (23:27 +0200)
git-archimport-id: opensource@polytechnique.org--2005/platal--mainline--0.9--patch-423

include/search.classes.inc.php
templates/include/minifiche.tpl
templates/include/minifiche_pvt.tpl

index d8f5e7e..f6e41f7 100644 (file)
@@ -26,7 +26,7 @@ require_once("xorg.misc.inc.php");
 $globals->search->result_fields = '
                 u.user_id, u.promo, u.matricule, u.matricule_ax,
                if(u.epouse=\'\', u.nom, u.epouse) AS NomSortKey,
-                u.epouse,u.date,q.profile_web AS web,q.profile_mobile AS mobile,
+                u.epouse,u.date,
                 u.deces!=0 AS dcd,u.deces,
                u.perms IN (\'admin\',\'user\') AS inscrit,
                u.perms != \'pending\' AS wasinscrit,
@@ -34,9 +34,25 @@ $globals->search->result_fields = '
                 a.alias AS forlife,
                 ad0.text AS app0text, ad0.url AS app0url, ai0.type AS app0type,
                 ad1.text AS app1text, ad1.url AS app1url, ai1.type AS app1type,
-                e.entreprise, es.label AS secteur, ef.fonction_fr AS fonction,
-                IF(n.nat=\'\',n.pays,n.nat) AS nat, n.a2 AS iso3166,
-                adr.ville, gp.pays, gr.name AS region,';
+                es.label AS secteur, ef.fonction_fr AS fonction,
+                IF(n.nat=\'\',n.pays,n.nat) AS nat, n.a2 AS iso3166,';
+// hide private information if not logged
+if (logged()) 
+       $globals->search->result_fields .='
+               q.profile_web AS web,
+               q.profile_mobile AS mobile,
+               q.profile_freetext AS freetext,
+                adr.ville, gp.pays, gr.name AS region,
+               e.entreprise,';
+else
+       $globals->search->result_fields .="
+               IF(q.profile_web_pub='public', q.profile_web, '') AS web,
+               IF(q.profile_mobile_pub='public', q.profile_mobile, '') AS mobile,
+               IF(q.profile_freetext_pub='public', q.profile_freetext, '') AS freetext,
+               IF(adr.pub='public', adr.ville, '') AS ville,
+               IF(adr.pub='public', gp.pays, '') AS pays,
+               IF(adr.pub='public', gr.name, '') AS region,
+               IF(e.pub='public', e.entreprise, '') AS entreprise,";
 $globals->search->result_where_statement = '
                 LEFT JOIN  applis_ins     AS ai0 ON (u.user_id = ai0.uid AND ai0.ordre = 0)
                 LEFT JOIN  applis_def     AS ad0 ON (ad0.id = ai0.aid)
index 069c98b..b6702ab 100644 (file)
@@ -48,8 +48,7 @@
     {/if}
     {/min_auth}
   </div>
-  {min_auth level="cookie"}{include file="include/minifiche_pvt.tpl"}{/min_auth}
-  {only_public}<div class="long"></div>{/only_public}
+  {include file="include/minifiche_pvt.tpl"}
 </div>
 {if !$c.inscrit || $c.dcd}</div>{/if}
 
index e01717e..35048b0 100644 (file)
@@ -20,6 +20,7 @@
 
 
 {if !$c.wasinscrit}
+  {min_auth level="cookie"}
   {if !$c.dcd}
   <div class='bits'>
     {if $show_action eq ajouter}
     {/perms}
   </div>
   {/if}
+  {/min_auth}
   <div class="long"></div>
 {else}
+  {min_auth level="cookie"}
   <div class="bits">
     <a href="{rel}/fiche.php?user={$c.forlife}" class="popup2">{*
       *}<img src="{rel}/images/loupe.gif" alt="Afficher la fiche" title="Afficher la fiche" /></a>
@@ -54,8 +57,9 @@
       *}<img src="{rel}/images/ax.png" alt='AX' title="fiche AX" /></a>
     {/perms}
   </div>
+  {/min_auth}
   <div class="long">
-    {if $c.web || $c.mobile || $c.pays || $c.ville || $c.region || $c.entreprise || $c.libre}
+    {if $c.web || $c.mobile || $c.pays || $c.ville || $c.region || $c.entreprise || $c.freetext}
     <table cellspacing="0" cellpadding="0">
       {if $c.web}
       <tr>
         </td>
       </tr>
       {/if}
-      {if $c.libre}
+      {if $c.freetext}
       <tr>
         <td class="lt">Commentaire:</td>
-        <td class="rt">{$c.libre|nl2br}</td>
+        <td class="rt">{$c.freetext|nl2br}</td>
       </tr>
       {/if}
     </table>