homonymes done
authorx2000habouzit <x2000habouzit>
Thu, 8 Jul 2004 14:37:12 +0000 (14:37 +0000)
committerx2000habouzit <x2000habouzit>
Thu, 8 Jul 2004 14:37:12 +0000 (14:37 +0000)
etat_migration
htdocs/admin/homonymes.php [new file with mode: 0644]
templates/admin/homonymes.tpl [new file with mode: 0644]

index adc3491..b4a69f6 100644 (file)
@@ -20,8 +20,7 @@ Etat  | Ancien nom                                                              | Nouveau nom
 ;!       | admin/comptesPOP.php                                          | ???
 ;        | admin/correction_adr.php                              | 
 ;        | admin/evenements.php                                          | 
-;        | admin/homonymes.php                                           | 
-;        | admin/pg.php                                                          | 
+;!       | admin/pg.php                                                          | 
 ------+-[ marketing ]-----------------------------+----------------
 ;        | admin/marketing.php                                           | marketing/
 ;        | admin/envoidirect.php                                         | 
@@ -37,11 +36,6 @@ Etat  | Ancien nom                                                             | Nouveau nom
 ;        | info-groupesx.php                                             | docs/info-groupesx.php
 ;        | plan.php                                                              | ? docs/plan.php
 ;        | services.php                                                          | docs/services.php
-------+-[ stats ]---------------------------------+----------------
-;        | parselogD.php                                                         | stats/...
-;        | parselogN.php                                                         | stats/...
-;        | parselogR.php                                                         | stats/...
-;        | stats.php                                                             | stats/index.php
 ------+-[ emails ... ]----------------------------+----------------
 ;        | routage-mail.php                                              | 
 ------+-[ inscription + mdp ]---------------------+----------------
@@ -70,6 +64,11 @@ Etat  | Ancien nom                                                             | Nouveau nom
 ;        | listes/liste.php                                              |  |
 ;        | listes/mailtoins.inc.php                              |  |
 ;        | listes/trombiliste.php                                        | /
+------+-[ stats ]---------------------------------+----------------
+;!       | parselogD.php                                                         | stats/...
+;!       | parselogN.php                                                         | stats/...
+;!       | parselogR.php                                                         | stats/...
+;!       | stats.php                                                             | stats/index.php
 ------+-[ sondages ]------------------------------+----------------
 ;!       | admin/gerer_sondages.php                              | \
 ;!       | sondage/accueil.php                                           |  |
@@ -100,9 +99,6 @@ x      | admin/utilisateurs.php                                        | - y'a encore du boulot pour que ca valide !
 x        | epouse.php                                                            | - non testé (flemme de faire des su ...)
 x        | parselog.php                                                          | stats/... (non testé, pas de logs sous la main)
 xx       | AccesPermanentOff.php                                         | cookie_off.php
-xx       | paiement/cyberpaiement.inc.php                        | dans include/
-xx       | paiement/cyberpaiement_retour.php             | -
-xx       | paiement/index.php                                            | -
 xx       | AccesPermanentOn.php                                          | cookie_on.php
 xx       | acces_redirect.php                                            | carva_redirect.php
 xx       | acces_smtp.php                                                        | -
@@ -120,6 +116,7 @@ xx    | admin/gerer_listes.php                                        | -
 xx       | admin/gerer_paiement.php                              | -
 xx       | admin/gerer_skins.php                                         | -
 xx       | admin/graph_promo.php                                         | stats/graph_promo.php
+xx       | admin/homonymes.php                                           | 
 xx       | admin/index.php                                                       | -
 xx       | admin/ins_confirmees.php                              | -
 xx       | admin/logger_actions.php                              | -
@@ -171,6 +168,9 @@ xx    | motdepassemd5.php                                             | -
 xx       | nbpromo2.php                                                          | stats/nb_by_promo.php
 xx       | newsletter.php                                                        | -
 xx       | newsletter_req.php                                            | -
+xx       | paiement/cyberpaiement.inc.php                        | dans include/
+xx       | paiement/cyberpaiement_retour.php             | -
+xx       | paiement/index.php                                            | -
 xx       | pattecassee.php                                                       | -
 xx       | preferences.php                                                       | -
 xx       | profil.php                                                            | TODO : reste 2-3 trucs comme popWin() a changer
diff --git a/htdocs/admin/homonymes.php b/htdocs/admin/homonymes.php
new file mode 100644 (file)
index 0000000..1399186
--- /dev/null
@@ -0,0 +1,64 @@
+<?php
+require("auto.prepend.inc.php");
+new_admin_page('admin/homonymes.tpl',true);
+require("diogenes.mailer.inc.php");
+
+$op =  isset($_REQUEST['op']) ? $_REQUEST['op'] : 'list';
+
+
+$target = isset($_REQUEST['target']) ? $_REQUEST['target'] : 0;
+if ($target) {
+    $res = $globals->db->query("SELECT prenom,username,loginbis FROM auth_user_md5 WHERE user_id='$target'");
+    if (! list($prenom,$username,$loginbis) = mysql_fetch_row($res)) {
+        $target=0;
+    } else {
+        $page->assign('prenom',$prenom);
+        $page->assign('username',$username);
+        $page->assign('loginbis',$loginbis);
+    }
+}
+
+$page->assign('op',$op);
+$page->assign('target',$target);
+$page->assign('baseurl',$baseurl);
+
+// on a un $target valide, on prepare les mails
+if ($target) {
+  // from
+  $cc = "support+homonyme@polytechnique.org";
+  $FROM = "From: Support Polytechnique.org <$cc>";
+  
+  // on examine l'op a effectuer
+  switch ($op) {
+      case 'mail':
+          $mymail = new DiogenesMailer($cc,$username,"Dans 2 semaines, suppression de $loginbis@polytechnique.org",false,$cc);
+          $mymail->addHeader($FROM);
+          $mymail->setBody(stripslashes($_REQUEST['mailbody']));
+          $mymail->send();
+          $op = 'list';
+          break;
+      case 'correct':
+          $globals->db->query("update auth_user_md5 set alias='' where user_id=$target");
+          $mymail = new DiogenesMailer($cc,$username,"Mise en place du robot $loginbis@polytechnique.org",false,$cc);
+          $mymail->addHeader($FROM);
+          $mymail->setBody(stripslashes($_REQUEST['mailbody']));
+          $mymail->send(); 
+          $op = 'list';
+          break;
+  }
+}
+if ($op == 'list') {
+    $res = $globals->db->query("SELECT loginbis FROM auth_user_md5 WHERE loginbis!='' GROUP BY loginbis ORDER BY loginbis");
+    $hnymes = Array();
+    while (list($loginbis) = mysql_fetch_row($res)) $hnymes[$loginbis] = Array();
+    mysql_free_result($res);
+
+    $res = $globals->db->query("SELECT loginbis,user_id,username,promo,prenom,nom,alias,date_mise_alias_temp AS date FROM auth_user_md5 WHERE loginbis!='' ORDER BY promo");
+    while ($tab = mysql_fetch_assoc($res)) $hnymes[$tab['loginbis']][] = $tab;
+    mysql_free_result($res);
+
+    $page->assign_by_ref('hnymes',$hnymes);
+}
+
+$page->run();
+?>
diff --git a/templates/admin/homonymes.tpl b/templates/admin/homonymes.tpl
new file mode 100644 (file)
index 0000000..f60214d
--- /dev/null
@@ -0,0 +1,135 @@
+{* $Id: homonymes.tpl,v 1.1 2004-07-08 14:37:13 x2000habouzit Exp $ *}
+
+<div class="rubrique">
+  Gestion des homonymes
+</div>
+
+{dynamic}
+
+{if $op eq 'mail'}
+<p class="erreur">mail envoyé à {$username}</p>
+{elseif $op eq 'correct'}
+<p class="erreur">mail envoyé à {$username}, alias supprimé</p>
+{/if}
+
+{if $op eq 'list' || $op eq 'mail' || $op eq 'correct'}
+
+<p class="normal">
+  Les utilisateurs signalés en rouge sont ceux qui conservent actuellement
+  l'alias prenom.nom et empêchent donc la mise en place du robot détrompeur.
+</p>
+
+<table class="bicol">
+  <tr>
+    <th>username</th>
+    <th>date de l'alias</th>
+    <th>op</th>
+  </tr>
+  {foreach from=$hnymes key=login item=row}
+  <tr class="pair">
+    <td colspan="3">
+      <strong>{$login}</strong>
+    </td>
+  </tr>
+  {foreach from=$row item=user}
+  <tr class="impair">
+    <td>&nbsp;&nbsp;
+      {if $user.alias eq $login}
+      <span class="erreur"><strong>{$user.username}</strong></span>
+      {else}
+      {$user.username}
+      {/if}
+    </td>
+    <td>{$user.date}</td>
+    <td>
+      <a href="javascript:x()" onclick="popWin('../x.php?x={$user.username}">fiche</a>
+      <a href="javascript:x()" onclick="popWin('utilisateurs.php?login={$user.username}&amp;select=1')">edit</a>
+      {if $user.alias eq $login}
+      <a href="?op=mail-conf&target={$user.user_id}">mailer</a>
+      <a href="?op=correct-conf&target={$user.user_id}">corriger</a>
+      {/if}
+    </td>
+  </tr>
+  {/foreach}
+  {/foreach}
+</table>
+
+{elseif $op eq 'mail-conf'}
+
+<form method="post" action="{$smarty.server.PHP_SELF}">
+  <input type="hidden" name="target" value="{$target}">
+  <input type="hidden" name="op" value="mail">
+  <table class="bicol">
+    <tr>
+      <th>Envoyer un mail pour prévenir l'utilisateur</th>
+    </tr>
+    <tr>
+      <td>
+        <textarea cols="80" rows="20" name="mailbody">
+{$prenom},
+
+
+Comme nous t'en avons informé par mail il y a quelques temps,
+pour respecter nos engagements en terme d'adresses e-mail devinables,
+tu te verras bientôt attribuer de façon définitive l'adresse
+{$username}@polytechnique.org.
+
+Toute personne qui écrira à {$loginbis}@polytechnique.org recevra la
+réponse d'un robot qui l'informera que {$loginbis}@polytechnique.org
+est ambigu pour des raisons d'homonymie et signalera ton email exact.
+
+L'équipe Polytechnique.org
+{$baseurl}
+        </textarea>
+      </td>
+    </tr>
+    <tr>
+      <td>
+        <input type="submit" value="Envoyer">
+      </td>
+    </tr>
+  </table>
+</form>
+
+{elseif $op eq 'correct-conf'}
+
+<form method="post" action="{$smarty.server.PHP_SELF}">
+  <input type="hidden" name="target" value="{$target}">
+  <input type="hidden" name="op" value="correct">
+  <table class="bicol">
+    <tr>
+      <th>Mettre en place le robot {$loginbis}@polytechnique.org</th>
+    </tr>
+    <tr>
+      <td>
+        <textarea cols="80" rows="20" name="mailbody">
+{$prenom},
+          
+Comme nous t'en avons informé par mail il y a quelques temps,
+nous t'avons attribué de façon définitive l'adresse
+{$username}@polytechnique.org.
+
+Toute personne qui écrit à {$loginbis}@polytechnique.org reçoit la
+réponse d'un robot qui l'informe que {$loginbis}@polytechnique.org
+est ambigu pour des raisons d'homonymie et signale ton email exact
+
+Tu peux faire l'essai toi-même en écrivant à {$loginbis}@polytechnique.org.
+
+L'équipe Polytechnique.org
+{$baseurl}
+        </textarea>
+      </td>
+    </tr>
+    <tr>
+      <td>
+        <input type="submit" value="Envoyer et corriger">
+      </td>
+    </tr>
+  </table>
+</form>
+
+{/if}
+
+{/dynamic}
+
+{* vim:set et sw=2 sts=2 sws=2: *}