20 tons of bugfixes this time
authorx2000habouzit <x2000habouzit>
Thu, 2 Sep 2004 23:25:30 +0000 (23:25 +0000)
committerx2000habouzit <x2000habouzit>
Thu, 2 Sep 2004 23:25:30 +0000 (23:25 +0000)
htdocs/fiche.php
htdocs/mescontacts.php
include/profil/assign_general.inc.php
include/profil/get_general.inc.php
include/profil/update_general.inc.php
templates/fiche.tpl
templates/profil.tpl
templates/profil/general.tpl

index 840ab8c..d9b7732 100644 (file)
@@ -18,7 +18,7 @@
  *  Foundation, Inc.,                                                      *
  *  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                *
  ***************************************************************************
-        $Id: fiche.php,v 1.6 2004-08-31 13:59:42 x2000habouzit Exp $
+        $Id: fiche.php,v 1.7 2004-09-02 23:25:30 x2000habouzit Exp $
  ***************************************************************************/
 
 
@@ -39,47 +39,42 @@ if (isset($_REQUEST["modif"]) && $_REQUEST["modif"]=="new") {
 }
 
 if (isset($_REQUEST['user']))
-    $where_clause = " WHERE username = '{$_REQUEST['user']}'";
+    $where_clause = "INNER JOIN aliases AS a1 ON (a1.id=u.user_id AND a1.alias = '{$_REQUEST['user']}')";
 else
     $where_clause = " WHERE u.matricule = '{$_REQUEST['mat']}'";
 
-$reqsql = "SELECT u.prenom, u.nom, u.epouse, nationalites.text"
-  .", u.user_id, u.username, u.alias, u.matricule, i.deces != 0 as dcd"
-  .", i.deces"
-  .", u.date"
-  .", u.cv, sections.text"
-  .", u.mobile, u.web, u.libre, u.promo"
-  .", c.uid IS NOT NULL"
-  .", p.x, p.y"
-  ." FROM auth_user_md5 as u"
-  ." LEFT JOIN contacts as c ON (c.uid = {$_SESSION['uid']} and c.contact = u.user_id)"
-  ." INNER JOIN nationalites ON(nationalites.id = u.nationalite)"
-  ." INNER JOIN sections ON(sections.id = u.section)"
-  ." INNER JOIN identification AS i ON(u.matricule = i.matricule)"
-  ." LEFT  JOIN photo as p ON(p.uid = u.user_id)"
-// conversion du username en user_id si nécessaire
-  .$where_clause;
+$reqsql = "SELECT  u.prenom, u.nom, u.epouse, nationalites.text,
+                  u.user_id, a.alias, u.matricule, i.deces != 0 as dcd,
+                  i.deces, u.date, u.cv, sections.text, u.mobile, u.web,
+                  u.libre, u.promo, c.uid IS NOT NULL, p.x, p.y
+            FROM  auth_user_md5 AS u
+       INNER JOIN  aliases       AS a ON (u.user_id=a.id AND a.type='a_vie')
+        LEFT JOIN  contacts      AS c ON (c.uid = {$_SESSION['uid']} and c.contact = u.user_id)
+       INNER JOIN  nationalites ON(nationalites.id = u.nationalite)
+       INNER JOIN  sections ON(sections.id = u.section)
+       INNER JOIN  identification AS i ON(u.matricule = i.matricule)
+        LEFT JOIN  photo as p ON(p.uid = u.user_id)".$where_clause;
 $result = $globals->db->query($reqsql);
 
 if (mysql_num_rows($result)!=1)
         exit;
 
 if (list($prenom, $nom, $epouse, $nationalite, 
-        $user_id, $username, $alias, $matricule, $dcd, $deces, 
+        $user_id, $forlife, $matricule, $dcd, $deces, 
         $date,
         $cv, $section, 
         $mobile, $web, $libre, $promo,
         $is_contact, $size_x, $size_y) = mysql_fetch_row($result)) {
 
+$page->assign('user_id', $user_id);
 $page->assign('prenom', $prenom);
 $page->assign('nom', $nom);
 $page->assign('promo', $promo);
 $page->assign('cv', $cv);
-$page->assign('username', $username);
+$page->assign('forlife', $forlife);
 $page->assign('epouse', $epouse);
 $page->assign('nationalite', $nationalite);
 $page->assign('user_id', $user_id);
-$page->assign('alias', $alias);
 $page->assign('matricule', $matricule);
 $page->assign('dcd', $dcd);
 $page->assign('deces', $deces);
index 1fba971..eab27ce 100644 (file)
@@ -18,7 +18,7 @@
  *  Foundation, Inc.,                                                      *
  *  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                *
  ***************************************************************************
-        $Id: mescontacts.php,v 1.8 2004-09-02 23:06:10 x2000habouzit Exp $
+        $Id: mescontacts.php,v 1.9 2004-09-02 23:25:30 x2000habouzit Exp $
  ***************************************************************************/
 
 require("auto.prepend.inc.php");
@@ -49,7 +49,7 @@ if (isset($_REQUEST['action'])) {
 }
 
 $sql = "SELECT contact AS id,
-               a.*, l.alias AS forlife
+               a.*, l.alias AS forlife,
                i.deces != 0 AS dcd, i.matricule_ax,
                e.entreprise, es.label AS secteur, ef.label AS fonction,
                n.text AS nat,
index 50ab041..c565057 100644 (file)
@@ -18,7 +18,7 @@
  *  Foundation, Inc.,                                                      *
  *  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                *
  ***************************************************************************
-        $Id: assign_general.inc.php,v 1.1 2004-08-31 15:03:33 x2000habouzit Exp $
+        $Id: assign_general.inc.php,v 1.2 2004-09-02 23:25:30 x2000habouzit Exp $
  ***************************************************************************/
 
 $page->assign('mobile_public',$mobile_public);
@@ -31,7 +31,6 @@ $page->assign('prenom', $prenom);
 $page->assign('promo', $promo);
 $page->assign('epouse', $epouse);
 $page->assign('femme', $femme);
-$page->assign('alias', $alias);
 
 $page->assign('nationalite',$nationalite);
 
index c568d77..a6ed7d2 100644 (file)
@@ -18,7 +18,7 @@
  *  Foundation, Inc.,                                                      *
  *  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                *
  ***************************************************************************
-        $Id: get_general.inc.php,v 1.4 2004-09-01 22:17:52 x2000habouzit Exp $
+        $Id: get_general.inc.php,v 1.5 2004-09-02 23:25:30 x2000habouzit Exp $
  ***************************************************************************/
 
 // on ramène les données du profil connecté (uid paramètre de session)
@@ -27,7 +27,6 @@ $sql = "SELECT u.nom, u.prenom".
        ", mobile".
        ", web".
         ", libre".
-       ", alias".
        ", a1.aid, a1.type".
        ", a2.aid, a2.type".
        " FROM auth_user_md5 AS u".
@@ -39,8 +38,7 @@ $sql = "SELECT u.nom, u.prenom".
 $result = $globals->db->query($sql);
 list($nom, $prenom,
      $promo, $epouse, $femme, $nationalite,
-     $mobile, $web,
-     $libre, $alias,
+     $mobile, $web, $libre,
      $appli_id1,$appli_type1,
      $appli_id2,$appli_type2) = mysql_fetch_row($result);
 
index b244712..194bb66 100644 (file)
@@ -18,7 +18,7 @@
  *  Foundation, Inc.,                                                      *
  *  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                *
  ***************************************************************************
-        $Id: update_general.inc.php,v 1.3 2004-08-31 13:59:43 x2000habouzit Exp $
+        $Id: update_general.inc.php,v 1.4 2004-09-02 23:25:30 x2000habouzit Exp $
  ***************************************************************************/
 
 if ($appli_id1>0)
@@ -31,12 +31,8 @@ if ($appli_id2>0)
 else
      $globals->db->query("delete from applis_ins where uid={$_SESSION['uid']} and ordre=1");
 
-$sql = "UPDATE auth_user_md5 SET ".
-// champs calculés ou vérifés
-"alias='$alias',nationalite=$nationalite,web='$web',".
-"mobile='$mobile',".
-// champs libres, on ajoute les slashes
-"libre='".put_in_db($libre)."' WHERE user_id={$_SESSION['uid']}";
+$sql = "UPDATE auth_user_md5
+          SET nationalite=$nationalite,web='$web',mobile='$mobile',libre='".put_in_db($libre)."' WHERE user_id={$_SESSION['uid']}";
 
 
 $globals->db->query($sql);
index 15c904f..0b0aa70 100644 (file)
@@ -17,7 +17,7 @@
  *  Foundation, Inc.,                                                      *
  *  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                *
  ***************************************************************************
-        $Id: fiche.tpl,v 1.6 2004-08-31 11:25:38 x2000habouzit Exp $
+        $Id: fiche.tpl,v 1.7 2004-09-02 23:25:31 x2000habouzit Exp $
  ***************************************************************************}
 
 
     <span>X {$promo}&nbsp;-&nbsp;{$applis|smarty:nodefaults}</span><br />
     <span style="font-size: small;">(Fiche mise à jour le {$date|date_format:"%d/%m/%Y"})</span><br />
     <span>
-      <a href="vcard.php/{$username}.vcf?x={$username}"><img src="images/vcard.png" alt="Afficher la carte de visite" /></a>&nbsp;
+      <a href="vcard.php/{$forlife}.vcf?x={$user_id}"><img src="images/vcard.png" alt="Afficher la carte de visite" /></a>&nbsp;
       {if !$is_contact}
-      <a href="javascript:x()"  onclick="popWin('mescontacts.php?action=ajouter&amp;user={$username}')"><img src="images/ajouter.gif" alt="Ajouter parmi mes contacts" /></a>&nbsp;
+      <a href="javascript:x()"  onclick="popWin('mescontacts.php?action=ajouter&amp;user={$forlife}')"><img src="images/ajouter.gif" alt="Ajouter parmi mes contacts" /></a>&nbsp;
       {/if}
-      <a href="sendmail.php?contenu=Tu%20trouveras%20ci-apres%20la%20fiche%20de%20{$prenom}%20{$nom}%20https://www.polytechnique.org/fiche.php?x={$username}"  onclick="return popup(this)">
+      <a
+        href="sendmail.php?contenu=Tu%20trouveras%20ci-apres%20la%20fiche%20de%20{$prenom}%20{$nom}%20https://www.polytechnique.org/fiche.php?user={$forlife}"  onclick="return popup(this)">
         <img src="images/mail.png" alt="Envoyer l'URL" />
       </a>
     </span>
     <br />
-    <a href="mailto:{$username}@polytechnique.org">{$username}@polytechnique.org</a><br />
+    <a href="mailto:{$forlife}@polytechnique.org">{$forlife}@polytechnique.org</a><br />
     <span><em>Section</em> : {$section}</span><br />
     <span><em>Binet(s)</em> : {$binets}</span><br />
     <span><em>Groupe(s) X</em> : {$groupes}</span><br />
@@ -46,7 +47,7 @@
     {if $libre}<br /><span><em>Commentaires</em> :</span><br /><span>{$libre|nl2br}</span>{/if}
   </div>
   <div class="item">
-    <img alt="Photo de {$username}" src="{$photo_url}" width="{$size_x}" height="{$size_y}" />
+    <img alt="Photo de {$forlife}" src="{$photo_url}" width="{$size_x}" height="{$size_y}" />
   </div>
   <div class="spacer">&nbsp;</div>
 </div>
index 1603ca4..c00af8d 100644 (file)
@@ -17,7 +17,7 @@
  *  Foundation, Inc.,                                                      *
  *  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                *
  ***************************************************************************
-        $Id: profil.tpl,v 1.10 2004-08-31 21:39:01 x2000habouzit Exp $
+        $Id: profil.tpl,v 1.11 2004-09-02 23:25:31 x2000habouzit Exp $
  ***************************************************************************}
 
 
@@ -32,7 +32,7 @@
 <p class="erreur">{$e}</p>
 {/foreach}
 
-<p>Tu peux consulter <a href="javascript:x()" onclick="popWin('fiche.php?user={$smarty.session.username}','_blank','toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,width=620,height=370')">l'état actuel de ta fiche</a> tel qu'elle apparaîtra pour un camarade.</p>
+<p>Tu peux consulter <a href="javascript:x()" onclick="popWin('fiche.php?user={$smarty.session.forlife}','_blank','toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,width=620,height=370')">l'état actuel de ta fiche</a> tel qu'elle apparaîtra pour un camarade.</p>
 
 <form action="{$smarty.server.PHP_SELF}" method="post" id="prof_annu">
   <table class="cadre_a_onglet" cellpadding="0" cellspacing="0">
index 14cd508..c3a84a0 100644 (file)
@@ -17,7 +17,7 @@
  *  Foundation, Inc.,                                                      *
  *  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                *
  ***************************************************************************
-        $Id: general.tpl,v 1.11 2004-09-02 21:09:33 x2000habouzit Exp $
+        $Id: general.tpl,v 1.12 2004-09-02 23:25:31 x2000habouzit Exp $
  ***************************************************************************}
 
 
               Voilà la photo qui apparaîtra sur la fiche de ton profil (si tu viens
               de changer ta photo, la photo affichée peut correspondre à ton ancien
               profil : c'est le cas si elle n'a pas encore été validée par un administrateur du site !
-              <a href="javascript:x()" onclick="popWin('fiche.php?user={$smarty.session.username}&amp;modif=new','_blank','toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,width=620,height=370')">nouvelle photo</a>).
+              <a href="javascript:x()" onclick="popWin('fiche.php?user={$smarty.session.forlife}&amp;modif=new','_blank','toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,width=620,height=370')">nouvelle photo</a>).
             </td>
             <td class="dcolg">
               <img src="getphoto.php?x={$smarty.session.uid}{*{if $smarty.cookies|@count == 0}&amp;{php}echo SID;{/php}{/if}*}" alt=" [ PHOTO ] " />