From 0cc4c07df8bc6a10c893d0f91aae02e4856f3123 Mon Sep 17 00:00:00 2001 From: x2003bruneau Date: Fri, 28 Jul 2006 14:36:06 +0000 Subject: [PATCH] #380: add sex for external members && forgotten files from previous commits git-svn-id: svn+ssh://murphy/home/svn/platal/trunk@692 839d8a87-29fc-0310-9880-83ba4fa771e5 --- ChangeLog | 1 + include/lists.inc.php | 14 ++++++++++++++ include/xnet/mail.inc.php | 4 ++-- modules/xnetgrp.php | 19 ++++++++++--------- templates/xnet/groupe/mail.tpl | 2 +- templates/xnet/groupe/membres-edit.tpl | 21 ++++++++++++++++----- upgrade/0.9.11/03_xnet.sql | 1 + 7 files changed, 45 insertions(+), 17 deletions(-) diff --git a/ChangeLog b/ChangeLog index 7befda6..442f0f3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -96,6 +96,7 @@ Bug/Wish: * Xnet: - #426: Add an identification header in mails. -FRU - #384: substitution of non-X's names in mail from web interface -FRU + - #380: Add sex for non-X -FRU From 0.9.10 Branch: diff --git a/include/lists.inc.php b/include/lists.inc.php index a670cce..9857d3e 100644 --- a/include/lists.inc.php +++ b/include/lists.inc.php @@ -82,5 +82,19 @@ function list_sort_members(&$members, $tri_promo = true) { } // }}} +// {{{ function list_header_decode + +function _list_header_decode($charset, $c, $str) { + $s = ($c == 'Q' || $c == 'q') ? quoted_printable_decode($str) : base64_decode($str); + $s = iconv($charset, 'iso-8859-15', $s); + return str_replace('_', ' ', $s); +} + +function list_header_decode($value) { + $val = preg_replace('/(=\?[^?]*\?[BQbq]\?[^?]*\?=) (=\?[^?]*\?[BQbq]\?[^?]*\?=)/', '\1\2', $value); + return preg_replace('/=\?([^?]*)\?([BQbq])\?([^?]*)\?=/e', '_list_header_decode("\1", "\2", "\3")', $val); +} + +// }}} // vim:set et sw=4 sts=4 sws=4 foldmethod=marker: ?> diff --git a/include/xnet/mail.inc.php b/include/xnet/mail.inc.php index cb196cc..43b87bd 100644 --- a/include/xnet/mail.inc.php +++ b/include/xnet/mail.inc.php @@ -34,7 +34,7 @@ function get_all_redirects($membres, $mls, &$client) 'SELECT IF(u.nom <> "", u.nom, m.nom) AS nom, IF(u.prenom <> "", u.prenom, m.prenom) AS prenom, IF(m.email <> "", m.email, CONCAT(a.alias, "@polytechnique.org")) as email, - FIND_IN_SET("femme", u.flags) AS sexe + IF(m.sexe IS NULL, FIND_IN_SET("femme", u.flags), m.sexe) AS sexe FROM groupex.membres AS m LEFT JOIN auth_user_md5 AS u ON (m.uid=u.user_id AND m.uid<50000) LEFT JOIN aliases AS a ON (a.id=u.user_id and a.type="a_vie") @@ -56,7 +56,7 @@ function get_all_redirects($membres, $mls, &$client) $tos[] = $person; } } else { - $res = XDB::query('SELECT prenom, nom FROM groupex.membres WHERE email={?}', $mem[1]); + $res = XDB::query('SELECT prenom, nom, sexe FROM groupex.membres WHERE email={?}', $mem[1]); if ($person = $res->fetchOneAssoc()) { $person['email'] = $mem[1]; $tos[] = $person; diff --git a/modules/xnetgrp.php b/modules/xnetgrp.php index dc41ccd..a45d370 100644 --- a/modules/xnetgrp.php +++ b/modules/xnetgrp.php @@ -309,7 +309,7 @@ class XnetGrpModule extends PLModule IF(m.origine='X',u.promo,'extérieur') AS promo, IF(m.origine='X',u.promo,'') AS promo_o, IF(m.origine='X',a.alias,m.email) AS email, - IF(m.origine='X',FIND_IN_SET('femme', u.flags),0) AS femme, + IF(m.origine='X',FIND_IN_SET('femme', u.flags), m.sexe) AS femme, m.perms='admin' AS admin, m.origine='X' AS x, m.uid @@ -682,13 +682,14 @@ class XnetGrpModule extends PLModule if (Post::has('change')) { if ($user['origine'] != 'X') { XDB::query('UPDATE groupex.membres - SET prenom={?}, nom={?}, email={?} - WHERE uid={?} AND asso_id={?}', - Post::v('prenom'), Post::v('nom'), - Post::v('email'), $user['uid'], - $globals->asso('id')); + SET prenom={?}, nom={?}, email={?}, sexe={?} + WHERE uid={?} AND asso_id={?}', + Post::v('prenom'), Post::v('nom'), + Post::v('email'), Post::v('sexe'), + $user['uid'], $globals->asso('id')); $user['nom'] = Post::v('nom'); $user['prenom'] = Post::v('prenom'); + $user['sexe'] = Post::v('sexe'); $user['email'] = Post::v('email'); $user['email2'] = Post::v('email'); } @@ -696,9 +697,9 @@ class XnetGrpModule extends PLModule $perms = Post::i('is_admin'); if ($user['perms'] != $perms) { XDB::query('UPDATE groupex.membres SET perms={?} - WHERE uid={?} AND asso_id={?}', - $perms ? 'admin' : 'membre', - $user['uid'], $globals->asso('id')); + WHERE uid={?} AND asso_id={?}', + $perms ? 'admin' : 'membre', + $user['uid'], $globals->asso('id')); $user['perms'] = $perms; $page->trig('permissions modifiées'); } diff --git a/templates/xnet/groupe/mail.tpl b/templates/xnet/groupe/mail.tpl index d12aeea..1779ccc 100644 --- a/templates/xnet/groupe/mail.tpl +++ b/templates/xnet/groupe/mail.tpl @@ -42,7 +42,7 @@ masculin ou f - Reply-To : + Répondre à : diff --git a/templates/xnet/groupe/membres-edit.tpl b/templates/xnet/groupe/membres-edit.tpl index a30bf8c..b30780a 100644 --- a/templates/xnet/groupe/membres-edit.tpl +++ b/templates/xnet/groupe/membres-edit.tpl @@ -37,8 +37,8 @@
- - +
+ @@ -50,7 +50,7 @@ {if $user.origine neq X} - + @@ -58,7 +58,7 @@ - + @@ -66,7 +66,18 @@ - + + + + + diff --git a/upgrade/0.9.11/03_xnet.sql b/upgrade/0.9.11/03_xnet.sql index fad1950..a044a85 100644 --- a/upgrade/0.9.11/03_xnet.sql +++ b/upgrade/0.9.11/03_xnet.sql @@ -1,5 +1,6 @@ use groupex alter table evenements drop column advertise; alter table evenements drop column membres_only; +alter table membres add column sexe bool default null; use x4dat -- 2.1.4
Permissions:
Prénom:
Nom:
+ Sexe: + + +
Email: