* Foundation, Inc., *
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
***************************************************************************
- $Id: utilisateurs.php,v 1.30 2004-11-17 10:49:50 x2000habouzit Exp $
+ $Id: utilisateurs.php,v 1.31 2004-11-18 13:45:47 x2000habouzit Exp $
***************************************************************************/
require("auto.prepend.inc.php");
perms='{$_REQUEST['permsN']}',
prenom='{$_REQUEST['prenomN']}',
nom='{$_REQUEST['nomN']}',
- promo='{$_REQUEST['promoN']}'
+ promo='{$_REQUEST['promoN']}',
+ comment='{$_REQUEST['commentN']}'
WHERE user_id='{$_REQUEST['user_id']}'";
$globals->db->query($query);
$r=$globals->db->query("SELECT *
. "Opérations effectuées\n\n\"".$query
. "\"\n\nCe rapport a été généré par le script d'administration";
$mailer->addTo("web@polytechnique.org");
- $mailer->setSubject("INTERVENTION ADMIN",$msg);
+ $mailer->setSubject("INTERVENTION ADMIN");
+ $mailer->setTxtBody($msg);
$mailer->send();
break;
// DELETE FROM auth_user_md5
case "u_kill":
-
- $user_id = $_REQUEST['user_id'];
-
- $query = "DELETE FROM auth_user_md5 WHERE user_id='$user_id'";
- $globals->db->query($query);
- $globals->db->query("delete from emails where uid=$user_id");
- $globals->db->query("delete from binets_ins where user_id=$user_id");
- $globals->db->query("delete from groupesx_ins where guid=$user_id");
- $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 ('a_vie','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");
- $globals->db->query("delete from contacts where uid=$user_id");
- $globals->db->query("delete from contacts where contact=$user_id");
- // on purge les entrees dans logger
- $res=$globals->db->query("select id from logger.sessions where uid=$user_id");
- while (list($session_id)=mysql_fetch_row($res))
- $globals->db->query("delete from logger.events where session=$session_id");
- $globals->db->query("delete from logger.sessions where uid=$user_id");
-
- $errors[] = "'$user_id' a été supprimé !";
+ require_once("user.func.inc.php");
+ user_clear_all_subs($_REQUEST['user_id']);
+ $errors[] = "'{$_REQUEST['user_id']}' a été désinscrit !";
require_once("diogenes.hermes.inc.php");
$mailer = new HermesMailer();
$mailer->setFrom("webmaster@polytechnique.org");
$msg = "Intervention manuelle de l'administrateur login=".$_SESSION['forlife']." (UID=".$_SESSION['uid'].")\n\n"
- . "Opérations effectuées\n\n\"".$query
+ . "Opérations effectuées : utilisateur {$_REQUEST['user_id']} effacé\n\n\""
. "\"\n\nCe rapport a été généré par le script d'administration";
$mailer->addTo("web@polytechnique.org");
- $mailer->setSubject("INTERVENTION ADMIN",$msg);
+ $mailer->setSubject("INTERVENTION ADMIN");
+ $mailer->setTxtBody($msg);
$mailer->send();
break;
}
* Foundation, Inc., *
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
***************************************************************************
- $Id: step4.php,v 1.13 2004-11-17 10:49:50 x2000habouzit Exp $
+ $Id: step4.php,v 1.14 2004-11-18 13:45:47 x2000habouzit Exp $
***************************************************************************/
require("auto.prepend.inc.php");
new_skinned_page('inscription/step4.tpl', AUTH_PUBLIC);
-require("inscription_listes_base.inc.php");
-require("inscription_forums_base.inc.php");
+require("user.func.inc.php");
require('tpl.mailer.inc.php');
define("ERROR_REF", 1);
+++ /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: inscription_forums_base.inc.php,v 1.3 2004-10-31 16:12:12 x2000chevalier Exp $
- ***************************************************************************/
-
-
-/** inscrit l'uid donnée au forum promo
- * @param $uid UID
- * @param $promo promo
- * @return la reponse MySQL
- * @see step4.php
- */
-function inscription_forum_promo($uid,$promo) {
- global $globals;
- // récupération de l'id du forum promo
- $result=$globals->db->query("SELECT fid FROM forums.list WHERE nom='xorg.promo.x$promo'");
- if (!list($fid)=mysql_fetch_row($result)) { // pas de forum promo, il faut le créer
- $req_au=$globals->db->query("SELECT count(*) FROM auth_user_md5 WHERE promo='$promo' AND perms!='non-inscrit'");
- list($effau) = mysql_fetch_row($req_au);
- $req_id=$globals->db->query("SELECT count(*) FROM auth_user_md5 WHERE promo='$promo'");
- list($effid) = mysql_fetch_row($req_id);
- if (5*$effau>$effid) { // + de 20% d'inscrits
- $mymail = new TplMailer('forums.promo.tpl');
- $mymail->assign('promo', $promo);
- $mymail->send();
- }
- $fid = false;
- }
- mysql_free_result($result);
- if ($fid) {
- $globals->db->query("INSERT INTO forums.abos (fid,uid) VALUES ('$fid','$uid')");
- $res = !($globals->db->err());
- } else $res = false;
- return $res;
-}
-
-
-/** inscrit UID aux forums par défaut
- * @param $uid UID
- * @return la reponse MySQL globale
- * @see step4.php
- */
-function inscription_forums($uid) {
- global $globals;
- $res = true;
- $cible = array('xorg.general','xorg.pa.emploi','xorg.pa.divers','xorg.pa.logements');
- while (list ($key, $val) = each ($cible)) {
- $result=$globals->db->query("SELECT fid FROM forums.list WHERE nom='$val'");
- list($fid)=mysql_fetch_row($result);
- $globals->db->query("INSERT INTO forums.abos (fid,uid) VALUES ('$fid','$uid')");
- $res = $res and !($globals->db->err());
- }
- return $res;
-}
-
-
-
-?>
+++ /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: inscription_listes_base.inc.php,v 1.5 2004-11-10 10:59:10 x2000habouzit Exp $
- ***************************************************************************/
-
-include('xml-rpc-client.inc.php');
-include('newsletter.inc.php');
-
-/** inscrit l'uid donnée à la promo
- * @param $uid UID
- * @param $promo promo
- * @return reponse MySQL
- * @see admin/RegisterNewUser.php
- * @see step4.php
- */
-function inscription_listes_base($uid,$pass,$promo) {
- global $globals;
- // récupération de l'id de la liste promo
- $client = new xmlrpc_client("http://$uid:$pass@localhost:4949/polytechnique.org");
- $client->subscribe("promo$promo");
- subscribe_nl();
-}
-
-?>
--- /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: user.func.inc.php,v 1.1 2004-11-18 13:45:48 x2000habouzit Exp $
+ ***************************************************************************/
+
+
+/** kills the inscription of a user.
+ * we still keep his birthdate, adresses, and personnal stuff
+ * kills the entreprises, mentor, emails and lists subscription stuff
+ */
+function user_clear_all_subs($user_id) {
+ // keep datas in : aliases, adresses, applis_ins, binets_ins, contacts, groupesx_ins, homonymes, identification_ax, photo
+ // delete in : auth_user_md5, auth_user_quick, competences_ins, emails, entreprises, langues_ins, mentor,
+ // mentor_pays, mentor_secteurs, newsletter_ins, perte_pass, requests, user_changes, virtual_redirect, watch_sub
+ // + delete maillists
+
+ global $globals;
+ $uid=intval($user_id);
+ $res = $globals->db->query("select alias from aliases where type='a_vie' AND id=$uid");
+ list($alias) = mysql_fetch_row($res);
+ mysql_free_result($res);
+ $globals->db->query("delete from virtual_redirect where redirect ='$alias@m4x.org'");
+ $globals->db->query("delete from virtual_redirect where redirect ='$alias@polytechnique.org'");
+
+ $globals->db->query("update auth_user_md5 SET passwd='',perms='non-inscrit' WHERE user_id=$uid");
+ $globals->db->query("update auth_user_quick SET watch_flags='' WHERE user_id=$uid");
+
+ $globals->db->query("delete from competences_ins where uid=$user_id");
+ $globals->db->query("delete from emails where uid=$uid");
+ $globals->db->query("delete from entreprises where uid=$user_id");
+ $globals->db->query("delete from langues_ins where uid=$user_id");
+ $globals->db->query("delete from mentor_pays where uid=$user_id");
+ $globals->db->query("delete from mentor_secteur where uid=$user_id");
+ $globals->db->query("delete from mentor where uid=$user_id");
+ $globals->db->query("delete from newsletter_ins where user_id=$uid");
+ $globals->db->query("delete from perte_pass where uid=$uid");
+ $globals->db->query("delete from requests where user_id=$uid");
+ $globals->db->query("delete from user_changes where user_id=$uid");
+ $globals->db->query("delete from watch_sub where uid=$uid");
+
+ require_once('xml-rpc-client.inc.php');
+ $client = new xmlrpc_client("http://{$_SESSION['uid']}:{$_SESSION['password']}@localhost:4949/polytechnique.org");
+ $client->kill($alias);
+}
+
+/** inscrit l'uid donnée au forum promo
+ * @param $uid UID
+ * @param $promo promo
+ * @return la reponse MySQL
+ * @see step4.php
+ */
+function inscription_forum_promo($uid,$promo) {
+ global $globals;
+ // récupération de l'id du forum promo
+ $result=$globals->db->query("SELECT fid FROM forums.list WHERE nom='xorg.promo.x$promo'");
+ if (!list($fid)=mysql_fetch_row($result)) { // pas de forum promo, il faut le créer
+ $req_au=$globals->db->query("SELECT count(*) FROM auth_user_md5 WHERE promo='$promo' AND perms!='non-inscrit'");
+ list($effau) = mysql_fetch_row($req_au);
+ $req_id=$globals->db->query("SELECT count(*) FROM auth_user_md5 WHERE promo='$promo'");
+ list($effid) = mysql_fetch_row($req_id);
+ if (5*$effau>$effid) { // + de 20% d'inscrits
+ require_once("tpl.mailer.inc.php");
+ $mymail = new TplMailer('forums.promo.tpl');
+ $mymail->assign('promo', $promo);
+ $mymail->send();
+ }
+ $fid = false;
+ }
+ mysql_free_result($result);
+ if ($fid) {
+ $globals->db->query("INSERT INTO forums.abos (fid,uid) VALUES ('$fid','$uid')");
+ $res = !($globals->db->err());
+ } else $res = false;
+ return $res;
+}
+
+/** inscrit UID aux forums par défaut
+ * @param $uid UID
+ * @return la reponse MySQL globale
+ * @see step4.php
+ */
+function inscription_forums($uid) {
+ global $globals;
+ $res = true;
+ $cible = array('xorg.general','xorg.pa.emploi','xorg.pa.divers','xorg.pa.logements');
+ while (list ($key, $val) = each ($cible)) {
+ $result=$globals->db->query("SELECT fid FROM forums.list WHERE nom='$val'");
+ list($fid)=mysql_fetch_row($result);
+ $globals->db->query("INSERT INTO forums.abos (fid,uid) VALUES ('$fid','$uid')");
+ $res = $res and !($globals->db->err());
+ }
+ return $res;
+}
+
+
+/** inscrit l'uid donnée à la promo
+ * @param $uid UID
+ * @param $promo promo
+ * @return reponse MySQL
+ * @see admin/RegisterNewUser.php
+ * @see step4.php
+ */
+function inscription_listes_base($uid,$pass,$promo) {
+ require_once('xml-rpc-client.inc.php');
+ require_once('newsletter.inc.php');
+ global $globals;
+ // récupération de l'id de la liste promo
+ $client = new xmlrpc_client("http://$uid:$pass@localhost:4949/polytechnique.org");
+ $client->subscribe("promo$promo");
+ subscribe_nl();
+}
+
+?>
* Foundation, Inc., *
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
***************************************************************************
- $Id: xorg.misc.inc.php,v 1.8 2004-10-29 14:59:26 x2000habouzit Exp $
+ $Id: xorg.misc.inc.php,v 1.9 2004-11-18 13:45:48 x2000habouzit Exp $
***************************************************************************/
function quoted_printable_encode($input, $line_max = 76) {
$output = "";
foreach ($lines as $j => $line) {
- $linlen = strlen($line);
- $newline = "";
- for($i = 0; $i < $linlen; $i++) {
- $c = $line{$i};
- $dec = ord($c);
- if ( ($dec == 32) && ($i == ($linlen - 1)) ) {
+ $linlen = strlen($line);
+ $newline = "";
+ for($i = 0; $i < $linlen; $i++) {
+ $c = $line{$i};
+ $dec = ord($c);
+ if ( ($dec == 32) && ($i == ($linlen - 1)) ) {
// convert space at eol only
- $c = "=20";
- } elseif ( ($dec == 61) || ($dec < 32 ) || ($dec > 126) ) {
+ $c = "=20";
+ } elseif ( ($dec == 61) || ($dec < 32 ) || ($dec > 126) ) {
// always encode "\t", which is *not* required
- $c = $escape.strtoupper(sprintf("%02x",$dec));
- }
- if ( (strlen($newline) + strlen($c)) >= $line_max ) { // CRLF is not counted
- $output .= $newline.$escape.$eol;
- $newline = " ";
- }
- $newline .= $c;
- } // end of for
- $output .= $newline;
- if ($j<count($lines)-1) $output .= $linebreak;
+ $c = $escape.strtoupper(sprintf("%02x",$dec));
+ }
+ if ( (strlen($newline) + strlen($c)) >= $line_max ) { // CRLF is not counted
+ $output .= $newline.$escape.$eol;
+ $newline = " ";
+ }
+ $newline .= $c;
+ } // end of for
+ $output .= $newline;
+ if ($j<count($lines)-1) $output .= $linebreak;
}
return trim($output);
}
* @return BOOL
*/
function isvalid_email_local($email) {
- global $globals;
-
- $req = $globals->db->query("select count(*) from aliases where alias='$email'");
- list($nb)=mysql_fetch_row($req);
- mysql_free_result($req);
- if ($nb>0) return true;
+ global $globals;
- // reste à vérifier si c'est pas une adresse dans /etc/aliases
- // surement possible en utilisant postmap -q $email hash:/etc/aliases
+ $req = $globals->db->query("select count(*) from aliases where alias='$email'");
+ list($nb)=mysql_fetch_row($req);
+ mysql_free_result($req);
+ if ($nb>0) return true;
- return false;
+ // reste à vérifier si c'est pas une adresse dans /etc/aliases
+ // surement possible en utilisant postmap -q $email hash:/etc/aliases
+
+ return false;
}
/** vérifie si une adresse email convient comme adresse de redirection
* @return BOOL
*/
function isvalid_email_redirection($email) {
- return isvalid_email($email) &&
- !preg_match("/@(polytechnique\.(org|edu)|melix\.(org|net)|m4x\.org)$/", $email);
+ return isvalid_email($email) &&
+ !preg_match("/@(polytechnique\.(org|edu)|melix\.(org|net)|m4x\.org)$/", $email);
}
/* Un soundex en français posté par Frédéric Bouchery
-Voici une adaptation en PHP de la fonction soundex2 francisée de Frédéric BROUARD (http://sqlpro.developpez.com/Soundex/).
-C'est une bonne démonstration de la force des expressions régulières compatible Perl.
-trouvé sur http://expreg.com/voirsource.php?id=40&type=Chaines%20de%20caract%E8res */
+ Voici une adaptation en PHP de la fonction soundex2 francisée de Frédéric BROUARD (http://sqlpro.developpez.com/Soundex/).
+ C'est une bonne démonstration de la force des expressions régulières compatible Perl.
+ trouvé sur http://expreg.com/voirsource.php?id=40&type=Chaines%20de%20caract%E8res */
function soundex_fr($sIn)
{
// Si il n'y a pas de mot, on sort immédiatement
}
function make_forlife($prenom,$nom,$promo) {
- /* on traite le prenom */
- $prenomUS=replace_accent(trim($prenom));
- $prenomUS=stripslashes($prenomUS);
-
- /* on traite le nom */
- $nomUS=replace_accent(trim($nom));
- $nomUS=stripslashes($nomUS);
-
- // calcul du login
- $forlife = strtolower($prenomUS.".".$nomUS.".".$promo);
- $forlife = str_replace(" ","-",$forlife);
- $forlife = str_replace("'","",$forlife);
- return $forlife;
+ /* on traite le prenom */
+ $prenomUS=replace_accent(trim($prenom));
+ $prenomUS=stripslashes($prenomUS);
+
+ /* on traite le nom */
+ $nomUS=replace_accent(trim($nom));
+ $nomUS=stripslashes($nomUS);
+
+ // calcul du login
+ $forlife = strtolower($prenomUS.".".$nomUS.".".$promo);
+ $forlife = str_replace(" ","-",$forlife);
+ $forlife = str_replace("'","",$forlife);
+ return $forlife;
}
?>
#* Foundation, Inc., *
#* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
#***************************************************************************
-# $Id: mailman-rpc.py,v 1.78 2004-11-11 23:08:57 x2000habouzit Exp $
+# $Id: mailman-rpc.py,v 1.79 2004-11-18 13:45:48 x2000habouzit Exp $
#***************************************************************************
import base64, MySQLdb, os, getopt, sys, MySQLdb.converters, sha, signal
return 0
#-------------------------------------------------------------------------------
-# admin procedures [ soptions.php ]
+# super-admin procedures
#
def get_all_lists(userdesc,perms,vhost):
return 0
return 1
+def kill(userdesc,perms,vhost,alias):
+ for list in Utils.list_names():
+ try:
+ mlist = MailList.MailList(list,lock=0)
+ except:
+ continue
+ try:
+ mlist.Lock()
+ mlist.ApprovedDeleteMember(alias+'@polytechnique.org',None,0,0)
+ mlist.Save()
+ mlist.Unlock()
+ print list
+ except:
+ mlist.Unlock()
+ return 1
+
+
#-------------------------------------------------------------------------------
# server
#
# create
server.register_function(get_all_lists)
server.register_function(create_list)
+# utilisateurs.php
+server.register_function(kill)
server.serve_forever()
* Foundation, Inc., *
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
***************************************************************************
- $Id: utilisateurs.tpl,v 1.21 2004-11-17 10:49:52 x2000habouzit Exp $
+ $Id: utilisateurs.tpl,v 1.22 2004-11-18 13:45:49 x2000habouzit Exp $
***************************************************************************}
</tr>
<tr>
<td class="center">
- <input type="text" name="login" size="40" maxlength="255" value="{$smarty.request.login}" />
+ <input type="text" name="login" size="40" maxlength="255" value="{$smarty.request.login|default:$mr.forlife}" />
</td>
</tr>
<tr>
<select name="permsN">
<option value="user" {if $mr.perms eq "user"}selected="selected"{/if}>user</option>
<option value="admin" {if $mr.perms eq "admin"}selected="selected"{/if}>admin</option>
+ <option value="non-inscrit" {if $mr.perms eq "non-inscrit"}selected="selected"{/if}>non-inscrit</option>
+ <option value="disabled" {if $mr.perms eq "disabled"}selected="selected"{/if}>disabled</option>
</select>
</td>
</tr>
<input type="text" name="promoN" size="4" maxlength="4" value="{$mr.promo}" />
</td>
</tr>
+ <tr class="impair">
+ <td class="titre">
+ Commentaire
+ </td>
+ <td>
+ <input type="text" name="commentN" size="40" maxlength="64" value="{$mr.comment}" />
+ </td>
+ </tr>
<tr class="center">
<td>
<a href="{"fiche.php"|url}?user={$mr.forlife}" class="popup2">[Voir fiche]</a>
<a href="admin_trombino.php?uid={$mr.user_id}">[Trombino]</a>
</td>
<td>
- <input type="submit" name="u_kill_conf" value="DELETE" />
+ <input type="submit" name="u_kill_conf" value="Désinscrire" />
</td>
</tr>
</table>