Cleanup, use PlDict and last core.
authorFlorent Bruneau <florent.bruneau@polytechnique.org>
Tue, 27 Jan 2009 21:48:16 +0000 (22:48 +0100)
committerFlorent Bruneau <florent.bruneau@polytechnique.org>
Tue, 27 Jan 2009 21:48:16 +0000 (22:48 +0100)
Signed-off-by: Florent Bruneau <florent.bruneau@polytechnique.org>
core
modules/xnetgrp.php
plugins/function.profile.php
templates/skin/common.bandeau.tpl
templates/xnet/skin.tpl
templates/xnetgrp/form.announce.tpl
templates/xnetlists/sync.tpl

diff --git a/core b/core
index e25ddad..f4e68a7 160000 (submodule)
--- a/core
+++ b/core
@@ -1 +1 @@
-Subproject commit e25ddad9784ef9e8e4de1847b50207f88622a165
+Subproject commit f4e68a785c9cd69abf70db02944eb9422fef6414
index 32f7118..e2fcdc4 100644 (file)
@@ -89,10 +89,9 @@ class XnetGrpModule extends PLModule
                             Env::i('unread'), S::i('uid'));
                 pl_redirect("#art" . Env::i('unread'));
             }
-            $arts = XDB::iterator("SELECT a.*, u.nom, u.prenom, u.promo, u.hruid,
-                                          FIND_IN_SET('photo', a.flags) AS photo
+            // XXX: Fix promo_min; promo_max
+            $arts = XDB::iterator("SELECT a.*, FIND_IN_SET('photo', a.flags) AS photo
                                      FROM groupex.announces AS a
-                               INNER JOIN auth_user_md5 AS u USING(user_id)
                                 LEFT JOIN groupex.announces_read AS r ON (r.user_id = {?} AND r.announce_id = a.id)
                                     WHERE asso_id = {?} AND peremption >= CURRENT_DATE()
                                           AND (promo_min = 0 OR promo_min <= {?})
@@ -110,11 +109,10 @@ class XnetGrpModule extends PLModule
                                    S::i('uid'), $globals->asso('id'), S::i('promo'), S::i('promo'));
             $page->assign('article_index', $index);
         } else {
-            $arts = XDB::iterator("SELECT a.*, u.nom, u.prenom, u.promo, FIND_IN_SET('photo', a.flags) AS photo
+            $arts = XDB::iterator("SELECT a.*, FIND_IN_SET('photo', a.flags) AS photo
                                      FROM groupex.announces AS a
-                               INNER JOIN auth_user_md5 AS u USING(user_id)
                                     WHERE asso_id = {?} AND peremption >= CURRENT_DATE()
-                                          AND FIND_IN_SET('public', u.flags)",
+                                          AND FIND_IN_SET('public', a.flags)",
                                   $globals->asso('id'));
         }
         if (may_update()) {
index d686b1c..be02e7b 100644 (file)
 
 function smarty_function_profile($params, &$smarty)
 {
-    $with_promo = isset($params['with_promo']) ? $params['with_promo'] : false;
-    $with_sex   = isset($params['with_sex']) ? $params['with_sex'] : true;
-    $with_link  = isset($params['with_link']) ? $params['with_link'] : true;
-    $with_groupperms = isset($params['with_groupperms']) ? $params['with_groupperms'] : true;
-    $user = $params['user'];
+    $params = new PlDict($params);
+    $with_promo = $params->b('promo', false);
+    $with_sex   = $params->b('sex', true);
+    $with_link  = $params->b('link', true);
+    $with_groupperms = $params->b('groupperms', true);
+    $user = $params->v('user');
+    if (ctype_digit($user)) {
+        $user = User::getWithUID($user);
+    }
 
     $name = pl_entities($user->fullName());
     if ($with_sex && $user->isFemale()) {
index 26e242b..71d84e5 100644 (file)
 
 <!-- Don't copy this list of emails!!!
 
+{if !t($login)}
+  {if t($smarty.session.auth)}
+  {assign var="login" value="true"}
+  {/if}
+{/if}
+
   {poison seed=$login}
 
   -->
 
-{if !$login && $smarty.session.auth}
-  {assign var="login" value="true"}
-{/if}
 
 <div id="bandeau-X">
   <img src="bandeau/icone.png" alt=""/>
@@ -49,9 +52,9 @@
   <a href="http://www.polytechniciens.com/">AX</a>
   &tilde;&tilde;
   <a href="https://www.polytechnique.org">Polytechnique.org</a> &middot;
-  <a href="http://www.polytechnique.net{if $login}/login{/if}">Associations polytechniciennes</a> &middot;
+  <a href="http://www.polytechnique.net{if t($login)}/login{/if}">Associations polytechniciennes</a> &middot;
   <a href="http://www.polytechnique.fr/eleves/">&Eacute;l&egrave;ves</a> &middot;
-  <a href="http://www.manageurs.com/{if $login}anciens_accueil.php?asso=X.org{/if}">Manageurs</a>
+  <a href="http://www.manageurs.com/{if t($login)}anciens_accueil.php?asso=X.org{/if}">Manageurs</a>
 </div>
 
 {* vim:set et sw=2 sts=2 sws=2 enc=utf8: *}
index 805db2b..d8fbc0b 100644 (file)
   </head>
   <body>
     {include core=plpage.devel.tpl}
-    {if !$simple}
+    {if !t($simple)}
       {include file=skin/common.bandeau.tpl}
     {/if}
 
     <table id="layout" cellspacing="0" cellpadding="0">
-    {if !$simple}
+    {if !t($simple)}
       <tr>
         <td colspan="2">
         <table cellspacing="0" cellpadding="0" id="top">
@@ -78,7 +78,7 @@
             </td>
             {if $xnet_type}
             <td style="width: 280px">
-              <a href="{if $xnet_type eq plan}plan{else}groups/{$xnet_type}{/if}"><img src="images/texte_{$xnet_type}.jpg" alt="{$xnet_type}" width="280" height="96" /></a>
+              <a href="{if $xnet_type eq 'plan'}plan{else}groups/{$xnet_type}{/if}"><img src="images/texte_{$xnet_type}.jpg" alt="{$xnet_type}" width="280" height="96" /></a>
             </td>
             {if $asso}
             <td class="logo">
       </tr>
     {/if}{* fin simple *}
 
-      {if $menu && !$simple}
+      {if $menu && !t($simple)}
       <tr>
         <td id="menu">
           {foreach from=$menu key=title item=submenu}
           {include core=plpage.content.tpl}
         </td>
       </tr>
-      {if !$simple}
+      {if !t($simple)}
       <tr class="hideable"><td colspan="2"><img src="images/barre.png" alt="----------" width="100%" /></td></tr>
 
       <tr class="hideable">
       </tr>
       {/if}
       {/if}
-    {if !$simple}
+    {if !t($simple)}
       <tr class="hideable"><td colspan="2"><img src="images/barre.png" alt="----------" width="100%" /></td></tr>
 
       <tr class="hideable">
index 554cbdc..3975155 100644 (file)
     <td {if $art.photo}colspan="2"{/if}>
       <div style="float: right">
       <small>
-        Annonce proposée par
-        <a class="popup2" href="https://www.polytechnique.org/profile/{$art.hruid}">
-          {$art.prenom} {$art.nom} (X{$art.promo})
-        </a>
+        Annonce proposée par {profile user=$art.user_id sex=false promo=true groupperms=false}
       </small>
       </div>
       <small>
index a92d7aa..48437ad 100644 (file)
@@ -34,7 +34,7 @@
     </tr>
     {foreach from=$not_in_list item=u}
     <tr>
-      <td class='checkboxToggle'>{profile user=$u with_promo=false}</td>
+      <td class='checkboxToggle'>{profile user=$u promo=false}</td>
       <td class='checkboxToggle'>{$u->promo()}</td>
       <td class='checkboxToggle'><input type="checkbox" class="moderate_email" name="add[{$u->forlifeEmail()}]" id="add{$u->forlifeEmail()}"/></td>
     </tr>