git-archimport-id: opensource@polytechnique.org--2005/platal--mainline--0.9--patch-517
* Profile :
- One can choose precisely which fields appear on his public fiche. -Car
- Accents and special chars in name and first name -Car
+ - Spouse name extended to usage name -Car
* Register :
- Already subscribed members now have a warning. -MC
check("SELECT a.*
FROM aliases AS a
LEFT JOIN auth_user_md5 AS u ON u.user_id=a.id
- WHERE (a.type='alias' OR a.type='epouse' OR a.type='a_vie') AND u.prenom is null");
+ WHERE (a.type='alias' OR a.type='a_vie') AND u.prenom is null");
/* validite de applis_ins */
check("select a.* from applis_ins as a left join auth_user_md5 as u on u.user_id=a.uid where u.prenom is null");
INNER JOIN aliases AS a2 ON(a2.id=e2.uid AND a2.type='a_vie')
INNER JOIN auth_user_md5 AS u1 ON(a1.id=u1.user_id)
INNER JOIN auth_user_md5 AS u2 ON(a2.id=u2.user_id)
- WHERE FIND_IN_SET(e1.flags,'active') AND u1.nom!=u2.epouse AND u2.nom!=u1.epouse
+ WHERE FIND_IN_SET(e1.flags,'active') AND u1.nom!=u2.nom_usage AND u2.nom!=u1.nom_usage
ORDER BY a1.alias",
"donne la liste des emails qui apparaissent 2 fois dans la table emails pour des personnes différentes");
USE x4dat;
DROP TABLE IF EXISTS recherche;
CREATE TABLE recherche SELECT matricule AS matricule,LOWER(REPLACE(nom_ini,'-',' ')) AS nom1,
-LOWER(REPLACE(nom,'-',' ')) AS nom2, LOWER(REPLACE(epouse,'-',' ')) AS nom3,
+LOWER(REPLACE(nom,'-',' ')) AS nom2, LOWER(REPLACE(nom_usage,'-',' ')) AS nom3,
LOWER(REPLACE(prenom_ini,'-',' ')) AS prenom1, LOWER(REPLACE(prenom,'-',' ')) AS prenom2, promo AS
promo FROM auth_user_md5;
DROP TABLE IF EXISTS recherche_soundex;
while(true) {
$res = $globals->xdb->iterRow(
"SELECT ni.user_id, a.alias,
- u.prenom, IF(u.epouse='', u.nom, u.epouse),
+ u.prenom, IF(u.nom_usage='', u.nom, u.nom_usage),
FIND_IN_SET('femme', u.flags),
q.core_mail_fmt AS pref
FROM newsletter_ins AS ni
}
}
- import_from_ax($userax, Env::has('epouse'), Env::has('mobile'), $adr_dels, $adr_adds, $pro_dels, $pro_adds, Env::has('nationalite'));
+ import_from_ax($userax, Env::has('nom_usage'), Env::has('mobile'), $adr_dels, $adr_adds, $pro_dels, $pro_adds, Env::has('nationalite'));
}
$user['matricule_ax'] = $userax['matricule_ax'];
unset($userax['matricule_ax']);
$user['nom'] = ucwords(strtolower($user['nom']));
- $user['epouse'] = ucwords(strtolower($user['epouse']));
+ $user['nom_usage'] = ucwords(strtolower($user['nom_usage']));
}
- $page->assign('watch_champs',array('nom', 'epouse', 'prenom', 'nationalite', 'mobile'));
+ $page->assign('watch_champs',array('nom', 'nom_usage', 'prenom', 'nationalite', 'mobile'));
$page->assign('modifiables', array(0,1,0,1,1));
$page->assign('x', $user);
break;
case "best":
- $globals->xdb->execute("UPDATE aliases SET flags='' WHERE flags='bestalias' AND id={?}", $mr['user_id']);
- $globals->xdb->execute("UPDATE aliases SET flags='epouse' WHERE flags='epouse,bestalias' AND id={?}", $mr['user_id']);
+ // 'bestalias' is the first bit of the set : 1
+ // 255 is the max for flags (8 sets max)
+ $globals->xdb->execute("UPDATE aliases SET flags= flags & (255 - 1) WHERE id={?}", $mr['user_id']);
$globals->xdb->execute("UPDATE aliases
- SET flags=CONCAT(flags,',','bestalias')
+ SET flags= flags | 1
WHERE id={?} AND alias={?}", $mr['user_id'], $val);
break;
$nameField = new RefWithSoundexSField('name',array('rn.nom1_soundex','rn.nom2_soundex','rn.nom3_soundex'),'recherche_soundex','rn','u.matricule = rn.matricule');
$firstnameField = new RefWithSoundexSField('firstname',array('rp.prenom1_soundex','rp.prenom2_soundex'),'recherche_soundex','rp','u.matricule = rp.matricule');
} else {
- $nameField = new NameSField('name',array('u.nom','u.epouse'),'');
+ $nameField = new NameSField('name',array('u.nom','u.nom_usage'),'');
$firstnameField = new StringSField('firstname',array('u.prenom'),'');
}
$nicknameField = new StringSField('nickname',array('q.profile_nick'),'');
$order = str_replace(" DESC,", ",", $order);
$res = $globals->xdb->query("
- SELECT u.prenom, IF(u.epouse='',u.nom,u.epouse) AS nom, a.alias AS forlife, u.promo
+ SELECT u.prenom, IF(u.nom_usage='',u.nom,u.nom_usage) AS nom, a.alias AS forlife, u.promo
FROM contacts AS c
INNER JOIN auth_user_md5 AS u ON (u.user_id = c.contact)
INNER JOIN aliases AS a ON (u.user_id = a.id AND a.type='a_vie')
ad0.text AS app0text, ad0.url AS app0url, ai0.type AS app0type,
ad1.text AS app1text, ad1.url AS app1url, ai1.type AS app1type,
adr.ville, gp.a2, gp.pays, gr.name AS region,
- IF(a.epouse<>'',a.epouse,a.nom) AS sortkey
+ IF(a.nom_usage<>'',a.nom_usage,a.nom) AS sortkey
FROM contacts AS c
INNER JOIN auth_user_md5 AS a ON (a.user_id = c.contact)
INNER JOIN aliases AS l ON (a.user_id = l.id AND l.type='a_vie')
$uid = Session::getInt('uid');
if (Post::has('best')) {
- $globals->xdb->execute("UPDATE aliases SET flags='' WHERE flags='bestalias' AND id={?}", $uid);
- $globals->xdb->execute("UPDATE aliases SET flags='epouse' WHERE flags='epouse,bestalias' AND id={?}", $uid);
- $globals->xdb->execute("UPDATE aliases SET flags=CONCAT(flags,',','bestalias') WHERE id={?} AND alias={?}", $uid, Post::get('best'));
+ // bestalias is the first bit : 1
+ // there will be maximum 8 bits in flags : 255
+ $globals->xdb->execute("UPDATE aliases SET flags=flags & (255 - 1) WHERE id={?}", $uid);
+ $globals->xdb->execute("UPDATE aliases SET flags=flags | 1 WHERE id={?} AND alias={?}", $uid, Post::get('best'));
}
// on regarde si on a affaire à un homonyme
"SELECT alias,expire
FROM aliases
WHERE id={?} AND (type='a_vie' OR type='alias')
- ORDER BY !FIND_IN_SET('epouse',flags), LENGTH(alias)", $uid);
+ ORDER BY !FIND_IN_SET('usage',flags), LENGTH(alias)", $uid);
$page->assign('alias', $res->fetchAllAssoc());
$page->assign('emails',$redirect->emails);
$new = Env::get('modif') == 'new';
$user = get_user_details($login, Session::getInt('uid'));
-$title = $user['prenom'] . ' ' . empty($user['epouse']) ? $user['nom'] : $user['epouse'];
+$title = $user['prenom'] . ' ' . empty($user['nom_usage']) ? $user['nom'] : $user['nom_usage'];
$page->assign('xorg_title', $title);
// photo
$membres = Array();
foreach ($members as $member) {
list($m) = split('@',$member[1]);
- $res = $globals->xdb->query("SELECT prenom,IF(epouse='', nom, epouse) AS nom, promo, a.alias AS forlife
+ $res = $globals->xdb->query("SELECT prenom,IF(nom_usage='', nom, nom_usage) AS nom, promo, a.alias AS forlife
FROM auth_user_md5 AS u
INNER JOIN aliases AS a ON u.user_id = a.id
WHERE a.alias = {?}", $m);
require_once("validations.inc.php");
require_once("xorg.misc.inc.php");
-new_skinned_page('epouse.tpl', AUTH_MDP);
+new_skinned_page('nomusage.tpl', AUTH_MDP);
$res = $globals->xdb->query(
- "SELECT u.nom,u.epouse,u.flags,e.alias
+ "SELECT u.nom,u.nom_usage,u.flags,e.alias
FROM auth_user_md5 AS u
LEFT JOIN aliases AS e ON(u.user_id = e.id)
- WHERE user_id={?}", Session::getInt('uid'));
+ WHERE user_id={?} AND FIND_IN_SET('usage', e.flags)", Session::getInt('uid'));
-list($nom,$epouse_old,$flags,$alias_old) = $res->fetchOneRow();
+list($nom,$usage_old,$flags,$alias_old) = $res->fetchOneRow();
$flags = new flagset($flags);
-$page->assign('is_femme', $flags->hasflag("femme"));
-$page->assign('epouse_old', $epouse_old);
+$page->assign('usage_old', $usage_old);
$page->assign('alias_old', $alias_old);
-$epouse = replace_accent(trim(Env::get('epouse')));
-$epouse = strtoupper($epouse);
-$page->assign('epouse_req', $epouse);
+$nom_usage = replace_accent(trim(Env::get('nom_usage')));
+$nom_usage = strtoupper($nom_usage);
+$page->assign('usage_req', $nom_usage);
-if (Env::has('submit') && ($epouse != $epouse_old)) {
- // on vient de recevoir une requete, differente de l'ancien nom de mariage
- if ($epouse == $nom) {
+if (Env::has('submit') && ($nom_usage != $usage_old)) {
+ // on vient de recevoir une requete, differente de l'ancien nom d'usage
+ if ($nom_usage == $nom) {
$page->assign('same', true);
} else { // le nom de mariage est distinct du nom à l'X
// on calcule l'alias pour l'afficher
- $myepouse = new EpouseReq(Session::getInt('uid'), $epouse);
- $myepouse->submit();
- $page->assign('myepouse', $myepouse);
+ $myusage = new UsageReq(Session::getInt('uid'), $nom_usage);
+ $myusage->submit();
+ $page->assign('myusage', $myusage);
}
}
-$page->run($flags->hasflag('femme') ? '' : 'not_femme');
+$page->run();
?>
$this->SetFillColor(245, 248, 252);
$this->SetLineWidth(0.4);
- $nom = $x['prenom'].' '.($x['epouse'] ? "{$x['epouse']} - née {$x['nom']}" : $x['nom'])." ({$x['promo']})";
+ $nom = $x['prenom'].' '.($x['nom_usage'] ? "{$x['nom_usage']} ({$x['nom']})" : $x['nom'])." ({$x['promo']})";
$ok = false;
if ($wp) {
$globals->xdb->execute("UPDATE aliases
SET flags=CONCAT(flags,',','bestalias')
WHERE id={?} AND type!='homonyme'
- ORDER BY !FIND_IN_SET('epouse',flags),alias LIKE '%.%', LENGTH(alias)
+ ORDER BY !FIND_IN_SET('usage',flags),alias LIKE '%.%', LENGTH(alias)
LIMIT 1", $uid);
}
$res = $globals->xdb->query("SELECT alias FROM aliases WHERE id = {?} AND alias != {?} AND expire IS NULL ORDER BY LENGTH(alias) LIMIT 1", $uid, $loginbis);
$newbest = $res->fetchOneCell();
// change the bestalias flag
- $globals->xdb->execute("UPDATE aliases SET flags = CONCAT(IF(FIND_IN_SET('epouse', flags), 'epouse', ''), ',' , IF(alias = {?}, 'bestalias', '')) WHERE id = {?}", $newbest, $uid);
+ $globals->xdb->execute("UPDATE aliases SET flags = (flags & (255 - 1)) | IF(alias = {?}, 1, 0) WHERE id = {?}", $newbest, $uid);
return $newbest;
}
foreach($members as $mem) {
list($m, $dom) = split('@',$mem);
if ($dom == $globals->mail->domain || $dom == $globals->mail->domain2) {
- $res = $globals->xdb->query('SELECT prenom,IF(epouse="", nom, epouse), promo
+ $res = $globals->xdb->query('SELECT prenom,IF(nom_usage="", nom, nom_udage), promo
FROM auth_user_md5 AS u
INNER JOIN aliases AS a ON u.user_id = a.id
WHERE a.alias = {?}', $m);
$our = $cases[$table];
$sql = "
(
- SELECT u.promo, u.prenom, IF(u.epouse='',u.nom,u.epouse) AS nom,
+ SELECT u.promo, u.prenom, IF(u.nom_usage='',u.nom,u.nom_usage) AS nom,
a.alias AS bestalias,
wo.*,
{$our['contact_sql']} AS contact,
(u.perms IN('admin','user')) AS inscrit";
if ($mail) {
$sql.=",
- w.uid AS aid, v.prenom AS aprenom, IF(v.epouse='',v.nom,v.prenom) AS anom,
+ w.uid AS aid, v.prenom AS aprenom, IF(v.nom_usage='',v.nom,v.nom_usage) AS anom,
b.alias AS abestalias, (v.flags='femme') AS sexe, q.core_mail_fmt AS mail_fmt";
}
function NoninsNotifs($uid) {
global $globals;
$this->_uid = $uid;
- $res = $globals->xdb->iterator("SELECT u.prenom,IF(u.epouse='',u.nom,u.epouse) AS nom, u.promo, u.user_id
+ $res = $globals->xdb->iterator("SELECT u.prenom,IF(u.nom_usage='',u.nom,u.nom_usage) AS nom, u.promo, u.user_id
FROM watch_nonins AS w
INNER JOIN auth_user_md5 AS u ON (u.user_id = w.ni_id)
WHERE w.uid = {?}
function add($p) {
global $globals;
$globals->xdb->execute('INSERT INTO watch_nonins (uid,ni_id) VALUES({?},{?})', $this->_uid, $p);
- $res = $globals->xdb->query('SELECT prenom,IF(epouse="",nom,epouse) AS nom,promo,user_id
+ $res = $globals->xdb->query('SELECT prenom,IF(nom_usage="",nom,nom_usage) AS nom,promo,user_id
FROM auth_user_md5
WHERE user_id={?}', $p);
$this->_data["$p"] = $res->fetchOneAssoc();
$page->assign('nom', $nom);
$page->assign('prenom', $prenom);
$page->assign('promo', $promo);
-$page->assign('epouse', $epouse);
-$page->assign('femme', $femme);
+$page->assign('nom_usage', $nom_usage);
$page->assign('nationalite',$nationalite);
***************************************************************************/
// on ramène les données du profil connecté (uid paramètre de session)
-$sql = "SELECT u.nom, u.prenom, u.nom_ini, u.prenom_ini, u.promo, u.epouse, FIND_IN_SET('femme',u.flags), u.nationalite,
+$sql = "SELECT u.nom, u.prenom, u.nom_ini, u.prenom_ini, u.promo, u.nom_usage, u.nationalite,
q.profile_mobile, q.profile_mobile_pub, q.profile_web, q.profile_web_pub, q.profile_freetext, q.profile_freetext_pub, q.profile_nick,
a1.aid, a1.type, a2.aid, a2.type
FROM auth_user_md5 AS u
WHERE u.user_id = {?}";
$result = $globals->xdb->query($sql, Session::getInt('uid', -1));
-list($nom, $prenom, $nom_ini, $prenom_ini, $promo, $epouse, $femme, $nationalite,
+list($nom, $prenom, $nom_ini, $prenom_ini, $promo, $nom_usage, $nationalite,
$mobile, $mobile_pub, $web, $web_pub, $freetext, $freetext_pub, $nickname,
$appli_id1,$appli_type1, $appli_id2,$appli_type2) = $result->fetchOneRow();
//declaration des fonctions msarty pour les binets et groupex
-$sql = "SELECT u.nom, u.prenom".
- ", u.promo, epouse, u.flags, section".
+$sql = "SELECT section".
" FROM auth_user_md5 AS u".
" WHERE user_id = {?}";
$result = $globals->xdb->query($sql, Session::getInt('uid', -1));
-list($nom, $prenom, $promo, $epouse, $flags, $section) = $result->fetchOneRow();
+$section = $result->fetchOneCell();
replace_ifset($section,'section');
$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,
+ if(u.nom_usage=\'\', u.nom, u.nom_usage) AS NomSortKey,
+ u.nom_usage,u.date,
u.deces!=0 AS dcd,u.deces,
u.perms IN (\'admin\',\'user\') AS inscrit,
u.perms != \'pending\' AS wasinscrit,
foreach ($this->strings as $s) {
$t = '%'.str_replace('*', '%', $s).'%';
$t = str_replace('%%', '%', $t);
- $where[] = "(u.nom LIKE '$t' OR u.epouse LIKE '$t' OR u.prenom LIKE '$t')";
+ $where[] = "(u.nom LIKE '$t' OR u.nom_usage LIKE '$t' OR u.prenom LIKE '$t')";
}
$wherep = Array();
$order = "0";
$sep = "[ \\'\\-]";
foreach ($this->strings as $s) {
- $order .= " + ( (u.nom='$s' OR u.epouse='$s') + (CONCAT(' ',u.nom,' ',u.epouse,' ') RLIKE '$sep{$s}$sep') )*1000
- + ( CONCAT(' ',u.nom,' ',u.epouse,' ') RLIKE '$sep{$s}' )*100
+ $order .= " + ( (u.nom='$s' OR u.nom_usage='$s') + (CONCAT(' ',u.nom,' ',u.nom_usage,' ') RLIKE '$sep{$s}$sep') )*1000
+ + ( CONCAT(' ',u.nom,' ',u.nom_usage,' ') RLIKE '$sep{$s}' )*100
+ ( (u.prenom = '$s') + (CONCAT(' ',u.prenom,' ') RLIKE '$sep{$s}$sep') )*10
+ ( u.prenom RLIKE '(^|$sep){$s}' )";
}
$ancien = $array['dump']['ancien'];
$userax['nom'] = $ancien[0];
// ancien1 = ?
- $userax['epouse'] = ($ancien[2] != $ancien[0])?$ancien[2]:"";
+ $userax['nom_usage'] = ($ancien[2] != $ancien[0])?$ancien[2]:"";
// ancien3 = ?
$userax['prenom'] = $ancien[4];
$userax['sexe'] = ($ancien[5] != 'M')?1:0;
return $userax;
}
-function import_from_ax($userax, $epouse=false, $mobile=false, $del_address=null, $add_address=null, $del_pro=null, $add_pro=null, $nationalite=false)
+function import_from_ax($userax, $nom_usage=false, $mobile=false, $del_address=null, $add_address=null, $del_pro=null, $add_pro=null, $nationalite=false)
{
global $globals;
- if ($epouse) {
- $globals->xdb->execute("UPDATE auth_user_md5 SET epouse = {?} WHERE user_id = {?}", strtoupper($userax['epouse']), $userax['uid']);
+ if ($nom_usage) {
+ $globals->xdb->execute("UPDATE auth_user_md5 SET nom_usage = {?} WHERE user_id = {?}", strtoupper($userax['nom_usage']), $userax['uid']);
}
if ($mobile) {
function &get_user_details($login, $from_uid = '')
{
global $globals;
- $reqsql = "SELECT u.user_id, u.promo, u.prenom, u.nom, u.epouse, u.date, u.cv,
+ $reqsql = "SELECT u.user_id, u.promo, u.prenom, u.nom, u.nom_usage, u.date, u.cv,
u.perms IN ('admin','user') AS inscrit, FIND_IN_SET('femme', u.flags) AS sexe, u.deces != 0 AS dcd, u.deces,
q.profile_nick AS nickname, q.profile_from_ax, q.profile_mobile AS mobile, q.profile_web AS web, q.profile_freetext AS freetext,
q.profile_mobile_pub AS mobile_pub, q.profile_web_pub AS web_pub, q.profile_freetext_pub AS freetext_pub,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
***************************************************************************/
-// {{{ class EpouseReq
+// {{{ class UsageReq
-class EpouseReq extends Validate
+class UsageReq extends Validate
{
// {{{ properties
var $unique = true;
- var $epouse;
+ var $nom_usage;
var $alias = '';
- var $oldepouse;
+ var $oldusage;
var $oldalias;
var $homonyme;
var $rules = "Refuser
tout ce qui n'est visiblement pas un nom de famille (ce qui est
- extrmement rare car à peu près n'importe quoi peut être un nom de
+ extremement rare car à peu près n'importe quoi peut être un nom de
famille...)";
// }}}
// {{{ constructor
- function EpouseReq($_uid, $_epouse)
+ function UsageReq($_uid, $_usage)
{
global $globals;
- $this->Validate($_uid, true, 'epouse');
- $this->epouse = $_epouse;
- $this->alias = make_username($this->prenom, $this->epouse);
+ $this->Validate($_uid, true, 'usage');
+ $this->nom_usage = $_usage;
+ $this->alias = make_username($this->prenom, $this->nom_usage);
+ if (!$this->nom_usage) $this->alias = "";
$res = $globals->xdb->query("
- SELECT e.alias, u.epouse, a.id
+ SELECT e.alias, u.nom_usage, a.id
FROM auth_user_md5 as u
- LEFT JOIN aliases as e ON(e.type='alias' AND FIND_IN_SET('epouse',e.flags) AND e.id = u.user_id)
+ LEFT JOIN aliases as e ON(e.type='alias' AND FIND_IN_SET('usage',e.flags) AND e.id = u.user_id)
LEFT JOIN aliases as a ON(a.alias = {?} AND a.id != u.user_id)
WHERE u.user_id = {?}", $this->alias, $this->uid);
- list($this->oldalias, $this->oldepouse, $this->homonyme) = $res->fetchOneRow();
+ list($this->oldalias, $this->oldusage, $this->homonyme) = $res->fetchOneRow();
}
// }}}
function get_request($uid)
{
- return parent::get_request($uid,'epouse');
+ return parent::get_request($uid,'usage');
}
// }}}
// {{{ function formu()
function formu()
- { return 'include/form.valid.epouses.tpl'; }
+ { return 'include/form.valid.nomusage.tpl'; }
// }}}
// {{{ function _mail_subj()
function _mail_subj()
{
- return "[Polytechnique.org/EPOUSE] Changement de nom de mariage";
+ return "[Polytechnique.org/USAGE] Changement de nom d'usage";
}
// }}}
{
global $globals;
if ($isok) {
- $res = " La demande de changement de nom de mariage que tu as demandée vient d'être effectuée.";
+ $res = " La demande de changement de nom d'usage que tu as demandée vient d'être effectuée.";
if ($this->oldalias) {
$res .= "\n\n Les alias {$this->oldalias}@{$globals->mail->domain} et @{$globals->mail->domain2} ont été supprimés.";
}
- $res .= "\n\n Les alias {$this->alias}@{$globals->mail->domain} et @{$globals->mail->domain2} sont maintenant à ta disposition !";
+ if ($nom_usage) {
+ $res .= "\n\n Les alias {$this->alias}@{$globals->mail->domain} et @{$globals->mail->domain2} sont maintenant à ta disposition !";
+ }
return $res;
} else {
- return " La demande de changement de nom de mariage que tu avais faite a été refusée.";
+ return " La demande de changement de nom d'usage que tu avais faite a été refusée.";
}
}
{
global $globals;
- $globals->xdb->execute("UPDATE auth_user_md5 set epouse={?} WHERE user_id={?}",$this->epouse ,$this->uid);
- $globals->xdb->execute("DELETE FROM aliases WHERE FIND_IN_SET('epouse',flags) AND id={?}", $this->uid);
- $globals->xdb->execute("UPDATE aliases SET flags='' WHERE flags='bestalias' AND id={?}", $this->uid);
- $globals->xdb->execute("INSERT INTO aliases VALUES({?}, 'alias', 'epouse,bestalias', {?}, null)",
+ $globals->xdb->execute("UPDATE auth_user_md5 set nom_usage={?} WHERE user_id={?}",$this->nom_usage ,$this->uid);
+ $globals->xdb->execute("DELETE FROM aliases WHERE FIND_IN_SET('usage',flags) AND id={?}", $this->uid);
+ if ($this->alias) {
+ $globals->xdb->execute("UPDATE aliases SET flags=flags & 255-1 WHERE id={?}", $this->uid);
+ $globals->xdb->execute("INSERT INTO aliases VALUES({?}, 'alias', 'usage,bestalias', {?}, null)",
$this->alias, $this->uid);
+ }
+ $r = $globals->xdb->query("SELECT alias FROM aliases WHERE FIND_IN_SET('bestalias', flags) AND id = {?}", $this->uid);
+ if ($r->fetchOneCell() == "") {
+ $globals->xdb->execute("UPDATE aliases SET flags = 1 | flags WHERE id = {?} LIMIT 1", $this->uid);
+ }
$f = fopen("/tmp/flag_recherche","w");
fputs($f,"1");
fclose($f);
$res = $globals->xdb->query(
"SELECT redirecturl
FROM auth_user_quick AS a
- INNER JOIN aliases AS al ON (al.id = a.user_id AND (al.type='a_vie' OR al.type='alias' OR al.type='epouse'))
+ INNER JOIN aliases AS al ON (al.id = a.user_id AND (al.type='a_vie' OR al.type='alias'))
WHERE al.alias = {?}", $username);
if ($url = $res->fetchOneCell()) {
+++ /dev/null
-{***************************************************************************
- * 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 *
- ***************************************************************************}
-
-
-<h1>
- Nom de mariage
-</h1>
-
-{if !$is_femme}
-
-<p class="erreur">
- Tu n'es pas autorisé à avoir accès à cette page !
-</p>
-
-{else}
-
- {if $same}
- <p class="erreur">
- Si ton nom de mariage est identique à ton nom à l'X, il n'est pas
- nécessaire de le saisir ici!
- </p>
- {else}
- {if $myepouse}
- {if $epouse_old}
- <p>
- Ta demande de suppression de ton nom de mariage ainsi que de tes
- alias {$alias_old}@polytechnique.org et
- {$alias_old}@m4x.org a bien été enregistrée.
- </p>
- {/if}
-
- {if $myepouse->alias}
- <p>
- Ta demande d'ajout de ton nom de mariage a bien été enregistrée. Sa
- validation engendrera la création des alias
- <strong>{$myepouse->alias}@polytechnique.org</strong> et
- <strong>{$myepouse->alias}@m4x.org</strong>.
- </p>
- {/if}
-
- <p>
- Tu recevras un mail dès que les changements demandés auront été effectués.
- Encore merci de nous faire confiance pour tes e-mails !
- </p>
-
- {else}
-
- <p>
- Afin d'être joignable à la fois sous ton nom à l'X et sous ton nom de mariage, tu peux
- saisir ici ce dernier. Il apparaîtra alors dans l'annuaire et tu disposeras
- des adresses correspondantes @m4x.org et @polytechnique.org, en plus de
- celles que tu possèdes déjà.
- </p>
-
- <br />
-
- <form action="{$smarty.server.PHP_SELF}" method="post">
- <table class="bicol" cellpadding="4" summary="Nom d'epouse">
- <tr>
- <th>Nom de mariage</th>
- </tr>
- <tr>
- <td class="center"><input type="text" name="epouse" value="{$epouse_old}" /></td>
- </tr>
- <tr>
- <td class="center"><input type="submit" name="submit" value="Envoyer" /></td>
- </tr>
- </table>
- </form>
- {/if}
- {/if}
-{/if}
-
-
-{* vim:set et sw=2 sts=2 sws=2: *}
<td id="fiche_identite">
<div class="civilite">
{if $x.sexe}•{/if}
- {$x.prenom} {if $x.epouse eq ""}{$x.nom}{else}{$x.epouse} ({$x.nom}){/if}
+ {$x.prenom} {if $x.nom_usage eq ""}{$x.nom}{else}{$x.nom_usage} ({$x.nom}){/if}
{min_auth level="cookie"}
{if $x.nickname} (aka {$x.nickname}){/if}
<a href="vcard.php/{$x.forlife}.vcf?x={$x.forlife}">
<tr class="impair">
- <td class="titre">Épouse :</td>
- <td>{$valid->epouse}</td>
+ <td class="titre">Nom d'usage :</td>
+ <td>{$valid->nom_usage}</td>
</tr>
<tr class="impair">
<td class="titre">Nouvel alias :</td>
{only_public}
{if !$c.dcd && $c.inscrit}<a href="{"fiche.php"|url}?user={$c.user_id}" class="popup2">{/if}
{/only_public}
- {if $c.epouse}{$c.epouse} {$c.prenom}<br />(née {$c.nom}){else}{$c.nom} {$c.prenom}{/if}
+ {if $c.nom_usage}{$c.nom_usage} {$c.prenom}<br />({$c.nom}){else}{$c.nom} {$c.prenom}{/if}
{if !$c.dcd && $c.inscrit}</a>{/if}
</div>
--- /dev/null
+{***************************************************************************
+ * 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 *
+ ***************************************************************************}
+
+
+<h1>
+ Nom d'usage
+</h1>
+
+{if $same}
+<p class="erreur">
+ Si ton nom d'usage est identique à ton nom à l'X, il n'est pas
+ nécessaire de le saisir ici!
+</p>
+{else}
+ {if $myusage}
+ {if $usage_old}
+ <p>
+ Ta demande de suppression de ton nom d'usage ainsi que de tes
+ alias {$alias_old}@polytechnique.org et
+ {$alias_old}@m4x.org a bien été enregistrée.
+ </p>
+ {/if}
+
+ {if $myusage->alias}
+ <p>
+ Ta demande d'ajout de ton nom d'usage a bien été enregistrée. Sa
+ validation engendrera la création des alias
+ <strong>{$myusage->alias}@polytechnique.org</strong> et
+ <strong>{$myusage->alias}@m4x.org</strong>.
+ </p>
+ {/if}
+
+ <p>
+ Tu recevras un mail dès que les changements demandés auront été effectués.
+ Encore merci de nous faire confiance pour tes e-mails !
+ </p>
+
+{else}
+
+ <p>
+ Afin d'être joignable à la fois sous ton nom à l'X et sous ton nom d'usage, tu peux
+ saisir ici ce dernier. Il apparaîtra alors dans l'annuaire et tu disposeras
+ des adresses correspondantes @m4x.org et @polytechnique.org, en plus de
+ celles que tu possèdes déjà.
+ </p>
+
+ <br />
+
+ <form action="{$smarty.server.PHP_SELF}" method="post">
+ <table class="bicol" cellpadding="4" summary="Nom d'usage">
+ <tr>
+ <th>Nom d'usage</th>
+ </tr>
+ <tr>
+ <td class="center"><input type="text" name="nom_usage" value="{$usage_old}" /></td>
+ </tr>
+ <tr>
+ <td class="center"><input type="submit" name="submit" value="Envoyer" /></td>
+ </tr>
+ </table>
+ </form>
+ {/if}
+{/if}
+
+
+{* vim:set et sw=2 sts=2 sws=2: *}
<span class="nom">X{$promo}</span>
</td>
</tr>
- {if $femme}
<tr>
<td class="colg">
- <span class="titre">Nom de mariage</span><br />
+ <span class="titre">Nom d'usage</span><br />
<span class="comm">(si différent de {$nom} seulement)</span>
</td>
<td class="cold">
- <span class="nom">{$epouse|default:"Aucun"}</span>
- <span class="lien"><a href="epouse.php">modifier</a></span>
+ <span class="nom">{$nom_usage|default:"Aucun"}</span>
+ <span class="lien"><a href="nomusage.php">modifier</a></span>
</td>
</tr>
- {/if}
<tr>
<td class="colg">
<span class="titre">Nationalité</span>
***************************************************************************}
BEGIN:VCARD
VERSION:3.0
-{if $vcard.epouse}
-FN;ENCODING=QUOTED-PRINTABLE:{"`$vcard.prenom` `$vcard.epouse` (`$vcard.nom`)"|qp_enc}
+{if $vcard.nom_usage}
+FN;ENCODING=QUOTED-PRINTABLE:{"`$vcard.prenom` `$vcard.nom_usage` (`$vcard.nom`)"|qp_enc}
{else}
FN;ENCODING=QUOTED-PRINTABLE:{"`$vcard.prenom` `$vcard.nom`"|qp_enc}
{/if}
-N;ENCODING=QUOTED-PRINTABLE:{$vcard.nom|qp_enc};{$vcard.prenom|qp_enc};{$vcard.epouse|qp_enc};;
+N;ENCODING=QUOTED-PRINTABLE:{$vcard.nom|qp_enc};{$vcard.prenom|qp_enc};{$vcard.nom_usage|qp_enc};;
EMAIL;TYPE=internet:{$vcard.bestalias}@polytechnique.org
{if $vcard.bestalias neq $vcard.forlife}
EMAIL;TYPE=internet:{$vcard.forlife}@polytechnique.org
--- /dev/null
+ALTER TABLE aliases CHANGE flags flags SET('bestalias','usage','epouse') NOT NULL;
+UPDATE aliases SET flags = 'usage,epouse' WHERE flags='epouse';
+UPDATE aliases SET flags = 'usage,epouse,bestalias' WHERE flags='epouse,bestalias';
+
--- /dev/null
+ALTER TABLE auth_user_md5 CHANGE epouse nom_usage VARCHAR(255) NOT NULL;
+