From: Pierre Habouzit (MadCoder Date: Thu, 28 Apr 2005 11:09:05 +0000 (+0000) Subject: add new members is now OK X-Git-Tag: xorg/old~161 X-Git-Url: http://git.polytechnique.org/?a=commitdiff_plain;h=5f0f47ee11abf82561e9303a82da449b23967ee7;p=platal.git add new members is now OK git-archimport-id: opensource@polytechnique.org--2005/platal--mainline--0.9--patch-601 --- diff --git a/htdocs.net/groupe/membres-edit.php b/htdocs.net/groupe/membres-edit.php index 064d6bc..37c728a 100644 --- a/htdocs.net/groupe/membres-edit.php +++ b/htdocs.net/groupe/membres-edit.php @@ -35,7 +35,38 @@ return $user; } - if (Env::has('edit')) + if (Env::has('new')) + { + new_groupadmin_page('xnet/groupe/membres-add.tpl'); + $x = (Env::get('new') == 'x'); + + if (Post::has('email')) { + if ($x) { + require_once 'user.func.inc.php'; + if ($forlife = get_user_forlife(Post::get('email'))) { + $globals->xdb->execute( + 'INSERT INTO groupex.membres (uid,asso_id,origine) + SELECT user_id,{?},"X" + FROM auth_user_md5 AS u + INNER JOIN aliases AS a ON (u.user_id = a.id) + WHERE a.alias={?}', $globals->asso('id'), $forlife); + header('Location: ?edit='.$forlife); + } + } else { + $email = Post::get('email'); + if (isvalid_email($email)) { + $res = $globals->xdb->query('SELECT MAX(uid)+1 FROM groupex.membres'); + $uid = max(intval($res->fetchOneCell()), 50001); + $globals->xdb->execute('INSERT INTO groupex.membres (uid,asso_id,origine,email) VALUES({?},{?},"ext",{?})', + $uid, $globals->asso('id'), $email); + header('Location: ?edit='.$email); + } else { + $page->trig("« $email » n'est pas une adresse mail valide"); + } + } + } + } + elseif (Env::has('edit')) { new_groupadmin_page('xnet/groupe/membres-edit.tpl');