now every page that uses aliases discard homonymes entries, and prints expire date if appliable
* Foundation, Inc., *
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
***************************************************************************
- $Id: utilisateurs.php,v 1.21 2004-09-04 20:14:30 x2000habouzit Exp $
+ $Id: utilisateurs.php,v 1.22 2004-09-05 12:54:18 x2000habouzit Exp $
***************************************************************************/
require("auto.prepend.inc.php");
$login = $_REQUEST['login'];
$r=$globals->db->query("SELECT *
FROM auth_user_md5 AS u
- INNER JOIN aliases AS a ON ( a.id = u.user_id AND a.alias='$login' )");
+ INNER JOIN aliases AS a ON ( a.id = u.user_id AND a.alias='$login' AND type!='homonyme' )");
if($tmp = mysql_fetch_assoc($r)) $mr=$tmp;
mysql_free_result($r);
}
case "del_alias":
if(empty($val)) break;
- $globals->db->query("DELETE FROM aliases WHERE id='{$_REQUEST['user_id']}' AND alias='$val' AND type!='a_vie'");
+ $globals->db->query("DELETE FROM aliases WHERE id='{$_REQUEST['user_id']}' AND alias='$val'
+ AND type!='a_vie' AND type!='homonyme'");
$errors[] = $val." a été supprimé";
break;
$globals->db->query("delete from photo where uid=$user_id");
$globals->db->query("delete from perte_pass where uid=$user_id");
$globals->db->query("delete from user_changes where user_id=$user_id");
- $globals->db->query("delete from aliases where id=$user_id and type in ('login','epouse','alias')");
+ $globals->db->query("delete from aliases where id=$user_id and type in ('a_vie','epouse','alias')");
$globals->db->query("delete from listes_ins where idu=$user_id");
$globals->db->query("delete from listes_mod where idu=$user_id");
$globals->db->query("delete from applis_ins where uid=$user_id");
$page->assign('lastlogin', $lastlogin);
$page->assign('host', $host);
- $page->mysql_assign("SELECT alias, type='a_vie' AS for_life
+ $page->mysql_assign("SELECT alias, type='a_vie' AS for_life,expire
FROM aliases
- WHERE id = {$mr["user_id"]}
+ WHERE id = {$mr["user_id"]} AND type!='homonyme'
ORDER BY type!= 'a_vie'", 'aliases');
$page->assign_by_ref('xorgmails', $xorgmails);
$page->assign_by_ref('email_panne', $email_panne);
* Foundation, Inc., *
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
***************************************************************************
- $Id: emails.php,v 1.6 2004-09-04 14:40:02 x2000habouzit Exp $
+ $Id: emails.php,v 1.7 2004-09-05 12:54:18 x2000habouzit Exp $
***************************************************************************/
require("auto.prepend.inc.php");
new_skinned_page('emails.tpl',AUTH_COOKIE);
// on regarde si on a affaire à un homonyme
-$sql = "SELECT alias, (type='a_vie') AS a_vie
+$sql = "SELECT alias, (type='a_vie') AS a_vie, expire
FROM aliases
- WHERE id='{$_SESSION['uid']}'
+ WHERE id='{$_SESSION['uid']}' AND type!='homonyme'
ORDER BY type!='a_vie'";
$page->mysql_assign($sql, 'aliases');
* Foundation, Inc., *
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
***************************************************************************
- $Id: fiche.php,v 1.7 2004-09-02 23:25:30 x2000habouzit Exp $
+ $Id: fiche.php,v 1.8 2004-09-05 12:54:18 x2000habouzit Exp $
***************************************************************************/
}
if (isset($_REQUEST['user']))
- $where_clause = "INNER JOIN aliases AS a1 ON (a1.id=u.user_id AND a1.alias = '{$_REQUEST['user']}')";
+ $where_clause = "INNER JOIN aliases AS a1 ON (a1.id=u.user_id AND a1.alias = '{$_REQUEST['user']}' AND type!='homonyne')";
else
$where_clause = " WHERE u.matricule = '{$_REQUEST['mat']}'";
* Foundation, Inc., *
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
***************************************************************************
- $Id: fiche_referent.php,v 1.7 2004-09-03 00:28:18 x2000habouzit Exp $
+ $Id: fiche_referent.php,v 1.8 2004-09-05 12:54:18 x2000habouzit Exp $
***************************************************************************/
$reqsql = "SELECT prenom, nom, user_id, promo, cv, a.alias AS forlife
FROM auth_user_md5 AS u
INNER JOIN aliases AS a ON (u.user_id=a.id AND a.type='a_vie')
- INNER JOIN aliases AS a1 ON (u.user_id=a1.id AND a1.alias = '{$_REQUEST['user']}')";
+ INNER JOIN aliases AS a1 ON (u.user_id=a1.id AND a1.alias = '{$_REQUEST['user']}' AND a1.type!='homonyme')";
$result = $globals->db->query($reqsql);
if (mysql_num_rows($result)!=1)
exit;
+++ /dev/null
-<?php
-/***************************************************************************
- * Copyright (C) 2003-2004 Polytechnique.org *
- * http://opensource.polytechnique.org/ *
- * *
- * This program is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU General Public License as published by *
- * the Free Software Foundation; either version 2 of the License, or *
- * (at your option) any later version. *
- * *
- * This program is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
- * GNU General Public License for more details. *
- * *
- * You should have received a copy of the GNU General Public License *
- * along with this program; if not, write to the Free Software *
- * Foundation, Inc., *
- * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
- ***************************************************************************
- $Id: utilisateurs_identification.php,v 1.5 2004-09-03 00:15:49 x2000bedo Exp $
- ***************************************************************************/
-
-require("auto.prepend.inc.php");
-$id_actions = array('Editer','Inscrire');
-require("select_user.inc.php");
-require("inscription_listes_base.inc.php");
-
-//actions possible une fois un X désigné par son matricule
-switch ($_REQUEST["submit"]) {
-case "Editer":
- $result=$globals->db->query("SELECT user_id FROM auth_user_md5 where matricule=".$_REQUEST["xmat"]);
- if ($myrow = mysql_fetch_array($result))
- exit_error(">Le matricule existe déjà dans la table auth_user_md5, refus d'édition.");
- $result = $globals->db->query("select * from identification where matricule=".$_REQUEST["xmat"]);
- $myrow = mysql_fetch_array($result);
- new_admin_page('marketing/utilisateurs_edit.tpl');
- $page->assign('row', $myrow);
- $page->run();
- break;
-
-case "Modifier la base":
- // gestion des flags
- $flags = (empty($_REQUEST['flag_femmeN']))?"":"femme";
- // on fait la requete
- $sql="update identification set prenom='".$_REQUEST["prenomN"]."',nom='".$_REQUEST["nomN"]."',promo=".$_REQUEST["promoN"].",deces='".$_REQUEST["decesN"]."',flags='".$flags."' where matricule=".$_REQUEST["xmat"];
- $globals->db->query($sql);
- new_admin_page('marketing/utilisateurs_edit.tpl');
- $page->assign('success',1);
- $page->run();
- break;
-
-case "Inscrire":
- $result=$globals->db->query("SELECT user_id FROM auth_user_md5 where matricule=".$_REQUEST["xmat"]);
- if ($myrow = mysql_fetch_array($result))
- exit_error("Le matricule existe déjà dans la table auth_user_md5.");
-
- $result = $globals->db->query("select * from identification where matricule=".$_REQUEST["xmat"]);
- $myrow = mysql_fetch_array($result);
- new_admin_page('marketing/utilisateurs_inscrire.tpl');
- $page->assign('row', $myrow);
- //calcul du login de l'inscrit
- $page->assign('mailorg',make_forlife($myrow['prenom'],$myrow['nom'],$myrow['promo']));
- $page->run();
- break;
-
-case "Creer le login":
- //on commence par vérifier:
- // - que le matricule n'existe pas parmi les inscrits
- // - que le login n'existe pas déjà
- // - que la date de naissance est bien remplie
-
- $result=$globals->db->query("SELECT user_id FROM auth_user_md5 where matricule='".$_REQUEST["xmat"]."'");
- if ($myrow = mysql_fetch_array($result))
- exit_error("Le matricule existe déjà dans la table auth_user_md5.");
-
- $result=$globals->db->query("SELECT user_id FROM aliases AS a
- WHERE a.type='a_vie' AND a.alias='".$_REQUEST["mailorg"]."'");
- if ($myrow = mysql_fetch_array($result))
- exit_error("Le login existe déjà dans la table auth_user_md5.");
-
- $naissance=(isset($_REQUEST['naissance']))?$naissance:0;
-
- // tirage aléatoire de UID et mot de passe
- $pass_clair=rand_pass();
- $password=md5($pass_clair);
- $date=date("Y-m-j");
-
- $sql = "INSERT INTO auth_user_md5 SET matricule='".$_REQUEST['xmat']."',promo='".$_REQUEST['promoN']."',password='$password',nom='".$_REQUEST['nomN']."',prenom='".$_REQUEST['prenomN']."',date='$date',naissance='$naissance', date_ins = NULL";
- $result=$globals->db->query($sql);
-
- if (!$globals->db->err()) {
- $newuid = mysql_insert_id();
- $sql = "INSERT INTO aliases SET alias='".$_REQUEST['mailorg']."',type='a_vie',id='$newuid'";
- $result=$globals->db->query($sql);
- /** inscription à la liste promo ****************/
- $inspromo = inscription_liste_promo($newuid,$_REQUEST['promoN']);
- /** inscription à la newsletter ***************/
- $insnewsletter = inscription_newsletter($newuid);
-
- // pas d'erreur pour l'insert
- new_admin_page('marketing/utilisateurs_inscrire.tpl');
- $page->assign('mailorg',$_REQUEST['mailorg']);
- $page->assign('pass_clair',$pass_clair);
- $page->assign('success',1);
- $page->run();
- } else {
- exit_error("Une erreur s'est produite lors de la tentative d'insertion.");
- }
- break;
-}
-?>
* Foundation, Inc., *
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
***************************************************************************
- $Id: mescontacts.php,v 1.9 2004-09-02 23:25:30 x2000habouzit Exp $
+ $Id: mescontacts.php,v 1.10 2004-09-05 12:54:18 x2000habouzit Exp $
***************************************************************************/
require("auto.prepend.inc.php");
// si l'utilisateur demande l'ajout de qqun à sa liste
} elseif ($_REQUEST["action"]=="ajouter") {
- if (($res = $globals->db->query("SELECT id FROM aliases WHERE alias='{$_REQUEST['user']}'")) && mysql_num_rows($res)==1) {
+ if (($res = $globals->db->query("SELECT id FROM aliases WHERE alias='{$_REQUEST['user']}' AND type!='homonyme'")) && mysql_num_rows($res)==1) {
list($cont_user_id) = mysql_fetch_row($res);
if ($globals->db->query("INSERT INTO contacts set uid = '{$_SESSION['uid']}', contact = '$cont_user_id'")) {
$page->assign('erreur', 'Contact ajouté !');
* Foundation, Inc., *
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
***************************************************************************
- $Id: mescontacts_ldif.php,v 1.9 2004-09-02 23:55:56 x2000habouzit Exp $
+ $Id: mescontacts_ldif.php,v 1.10 2004-09-05 12:54:18 x2000habouzit Exp $
***************************************************************************/
require("auto.prepend.inc.php");
$req = $globals->db->query("SELECT a.id,a.alias
FROM aliases AS a
INNER JOIN contacts AS c ON a.id=c.contact
- WHERE c.uid='{$_SESSION['uid']}' AND a.type!='a_vie'");
+ WHERE c.uid='{$_SESSION['uid']}' AND a.type!='a_vie' AND a.type!='homonyme'");
while(list($id,$alias) = mysql_fetch_row($req)) {
$contacts[$id]['aliases'][] = $alias;
}
* Foundation, Inc., *
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
***************************************************************************
- $Id: cyberpaiement_retour.php,v 1.4 2004-09-02 21:22:19 x2000habouzit Exp $
+ $Id: cyberpaiement_retour.php,v 1.5 2004-09-05 12:54:20 x2000habouzit Exp $
***************************************************************************/
require("auto.prepend.inc.php");
$res = $globals->db->query("
SELECT a.prenom,a.nom,a.promo,l.alias,FIND_IN_SET(i.flags,'femme')
FROM auth_user_md5 AS a
-INNER JOIN aliases AS l ON a.user_id=l.id
+INNER JOIN aliases AS l ON (a.user_id=l.id AND type!='homonyme')
INNER JOIN identification AS i ON a.matricule=i.matricule
WHERE a.user_id='$uid'");
if (!list($prenom,$nom,$promo,$forlife,$femme) = mysql_fetch_row($res))
* Foundation, Inc., *
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
***************************************************************************
- $Id: pattecassee.php,v 1.8 2004-09-04 14:40:02 x2000habouzit Exp $
+ $Id: pattecassee.php,v 1.9 2004-09-05 12:54:18 x2000habouzit Exp $
***************************************************************************/
require("auto.prepend.inc.php");
"SELECT e.uid, a.alias
FROM emails AS e
INNER JOIN auth_user_md5 AS u ON e.uid = u.user_id
- INNER JOIN aliases AS a ON e.uid = a.id
+ INNER JOIN aliases AS a ON (e.uid = a.id AND type!='homonyme')
WHERE e.email='$email'");
if (list($uid, $dest) = mysql_fetch_row($sel)) {
// envoi du mail
* Foundation, Inc., *
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
***************************************************************************
- $Id: recovery.php,v 1.3 2004-09-02 23:55:56 x2000habouzit Exp $
+ $Id: recovery.php,v 1.4 2004-09-05 12:54:18 x2000habouzit Exp $
***************************************************************************/
require("auto.prepend.inc.php");
$sql="SELECT user_id, naissance
FROM auth_user_md5 AS u
- INNER JOIN aliases AS a ON u.user_id=a.id
+ INNER JOIN aliases AS a ON (u.user_id=a.id AND type!='homonyme')
WHERE a.alias='$mailorg'";
$result=$globals->db->query($sql);
if (list($uid,$naissance)=mysql_fetch_array($result)) {
* Foundation, Inc., *
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
***************************************************************************
- $Id: redirect.php,v 1.4 2004-09-02 23:55:57 x2000habouzit Exp $
+ $Id: redirect.php,v 1.5 2004-09-05 12:54:20 x2000habouzit Exp $
***************************************************************************/
$result = $globals->db->query("
SELECT redirecturl
FROM auth_user_md5 AS u
-INNER JOIN aliases AS a ON u.user_id=a.id
+INNER JOIN aliases AS a ON (u.user_id=a.id AND type!='homonyme')
WHERE a.alias='$user'");
if ($result and list($url) = mysql_fetch_row($result) and $url != '') {
// on envoie un redirect (PHP met automatiquement le code de retour 302
* Foundation, Inc., *
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
***************************************************************************
- $Id: routage-mail.php,v 1.6 2004-09-04 14:40:02 x2000habouzit Exp $
+ $Id: routage-mail.php,v 1.7 2004-09-05 12:54:18 x2000habouzit Exp $
***************************************************************************/
require("auto.prepend.inc.php");
$page->assign('grx',$grx);
$page->assign('domaine',substr($grx,0,-3));
-$page->mysql_assign("SELECT alias FROM aliases WHERE id=".$_SESSION["uid"], 'alias');
+$page->mysql_assign("SELECT alias,expire FROM aliases WHERE id='{$_SESSION['uid']}' AND type!='homonyme'", 'alias');
$page->assign('emails',$redirect->emails);
$page->run();
* Foundation, Inc., *
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
***************************************************************************
- $Id: vcard.php,v 1.9 2004-09-02 23:36:57 x2000habouzit Exp $
+ $Id: vcard.php,v 1.10 2004-09-05 12:54:18 x2000habouzit Exp $
***************************************************************************/
require("auto.prepend.inc.php");
$page->assign_by_ref('vcard', $vcard);
mysql_free_result($result);
-$page->mysql_assign("SELECT alias FROM aliases WHERE id={$vcard['user_id']} AND type!='a_vie'",'aliases');
+$page->mysql_assign("SELECT alias FROM aliases WHERE id={$vcard['user_id']} AND type!='a_vie' AND type!='homonyme'",'aliases');
$adr = $globals->db->query(
"SELECT statut,adr1,adr2,adr3,cp,ville,gp.pays,gr.name,tel,fax,
* Foundation, Inc., *
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
***************************************************************************
- $Id: utilisateurs.tpl,v 1.14 2004-09-04 20:14:31 x2000habouzit Exp $
+ $Id: utilisateurs.tpl,v 1.15 2004-09-05 12:54:20 x2000habouzit Exp $
***************************************************************************}
</tr>
{foreach from=$aliases item=a}
<tr class="{cycle values="impair,pair"}">
- <td>{if $a.for_life}<strong>{$a.alias}</strong>{else}{$a.alias}{/if}</td>
+ <td>
+ {if $a.for_life}<strong>{$a.alias}</strong>{else}{$a.alias}{/if}
+ {if $a.expire}<span class='erreur'>(expire {$a.expire|date_format:"%d %b %Y"})</span>{/if}
+ </td>
{if $a.for_life}
<td>garanti à vie*</td>
{else}
* Foundation, Inc., *
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
***************************************************************************
- $Id: emails.tpl,v 1.4 2004-09-02 22:27:06 x2000habouzit Exp $
+ $Id: emails.tpl,v 1.5 2004-09-05 12:54:20 x2000habouzit Exp $
***************************************************************************}
Tes adresses polytechniciennes sont :
<ul>
{foreach from=$aliases item=a}
- <li>{if $a.a_vie}(*){/if} <strong>{$a.alias}</strong>@polytechnique.org</li>
- <li>{if $a.a_vie}(*){/if} <strong>{$a.alias}</strong>@m4x.org</li>
+ <li>
+ {if $a.a_vie}(*){/if} <strong>{$a.alias}</strong>@polytechnique.org
+ {if $a.expire}<span class='erreur'>(expire le {$a.expire|date_format:"%d %b %Y"})</span>{/if}
+ </li>
+ <li>
+ {if $a.a_vie}(*){/if} <strong>{$a.alias}</strong>@m4x.org
+ {if $a.expire}<span class='erreur'>(expire le {$a.expire|date_format:"%d %b %Y"})</span>{/if}
+ </li>
{/foreach}
</ul>
</td>
* Foundation, Inc., *
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
***************************************************************************
- $Id: routage-mail.tpl,v 1.7 2004-09-04 14:40:03 x2000habouzit Exp $
+ $Id: routage-mail.tpl,v 1.8 2004-09-05 12:54:20 x2000habouzit Exp $
***************************************************************************}
{dynamic}
<ul>
{if $grx neq ""}<li><strong>{$grx}</strong>, <strong>{$domaine}org</strong></li>{/if}
{foreach from=$alias item=a}
- <li><strong>{$a.alias}@polytechnique.org</strong></li>
+ <li>
+ <strong>{$a.alias}@polytechnique.org</strong>
+ {if $a.expire}<span class='erreur'>(expire le {$a.expire|date_format:"%d %b %Y"})</span>{/if}
+ </li>
{/foreach}
</ul>
<p>