From f7c8773bd0a80a0021dae9173e8cff02dafad753 Mon Sep 17 00:00:00 2001 From: x2000habouzit Date: Thu, 2 Sep 2004 23:25:30 +0000 Subject: [PATCH] 20 tons of bugfixes this time --- htdocs/fiche.php | 37 +++++++++++++++-------------------- htdocs/mescontacts.php | 4 ++-- include/profil/assign_general.inc.php | 3 +-- include/profil/get_general.inc.php | 6 ++---- include/profil/update_general.inc.php | 10 +++------- templates/fiche.tpl | 13 ++++++------ templates/profil.tpl | 4 ++-- templates/profil/general.tpl | 4 ++-- 8 files changed, 35 insertions(+), 46 deletions(-) diff --git a/htdocs/fiche.php b/htdocs/fiche.php index 840ab8c..d9b7732 100644 --- a/htdocs/fiche.php +++ b/htdocs/fiche.php @@ -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); diff --git a/htdocs/mescontacts.php b/htdocs/mescontacts.php index 1fba971..eab27ce 100644 --- a/htdocs/mescontacts.php +++ b/htdocs/mescontacts.php @@ -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, diff --git a/include/profil/assign_general.inc.php b/include/profil/assign_general.inc.php index 50ab041..c565057 100644 --- a/include/profil/assign_general.inc.php +++ b/include/profil/assign_general.inc.php @@ -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); diff --git a/include/profil/get_general.inc.php b/include/profil/get_general.inc.php index c568d77..a6ed7d2 100644 --- a/include/profil/get_general.inc.php +++ b/include/profil/get_general.inc.php @@ -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); diff --git a/include/profil/update_general.inc.php b/include/profil/update_general.inc.php index b244712..194bb66 100644 --- a/include/profil/update_general.inc.php +++ b/include/profil/update_general.inc.php @@ -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); diff --git a/templates/fiche.tpl b/templates/fiche.tpl index 15c904f..0b0aa70 100644 --- a/templates/fiche.tpl +++ b/templates/fiche.tpl @@ -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 $ ***************************************************************************} @@ -28,16 +28,17 @@ X {$promo} - {$applis|smarty:nodefaults}
(Fiche mise à jour le {$date|date_format:"%d/%m/%Y"})
- Afficher la carte de visite  + Afficher la carte de visite  {if !$is_contact} - Ajouter parmi mes contacts  + Ajouter parmi mes contacts  {/if} - + Envoyer l'URL
- {$username}@polytechnique.org
+ {$forlife}@polytechnique.org
Section : {$section}
Binet(s) : {$binets}
Groupe(s) X : {$groupes}
@@ -46,7 +47,7 @@ {if $libre}
Commentaires :
{$libre|nl2br}{/if}
- Photo de {$username} + Photo de {$forlife}
 
diff --git a/templates/profil.tpl b/templates/profil.tpl index 1603ca4..c00af8d 100644 --- a/templates/profil.tpl +++ b/templates/profil.tpl @@ -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 @@

{$e}

{/foreach} -

Tu peux consulter l'état actuel de ta fiche tel qu'elle apparaîtra pour un camarade.

+

Tu peux consulter l'état actuel de ta fiche tel qu'elle apparaîtra pour un camarade.

diff --git a/templates/profil/general.tpl b/templates/profil/general.tpl index 14cd508..c3a84a0 100644 --- a/templates/profil/general.tpl +++ b/templates/profil/general.tpl @@ -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 $ ***************************************************************************} @@ -146,7 +146,7 @@ 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 ! - nouvelle photo). + nouvelle photo).
 [ PHOTO ] -- 2.1.4