Merge branch 'profile_edit'
authorFlorent Bruneau <florent.bruneau@polytechnique.org>
Sun, 9 Sep 2007 17:43:07 +0000 (19:43 +0200)
committerFlorent Bruneau <florent.bruneau@polytechnique.org>
Sun, 9 Sep 2007 17:43:07 +0000 (19:43 +0200)
Conflicts:

htdocs/css/default.css
htdocs/css/keynote.css
htdocs/css/openweb.css
include/platal.inc.php
modules/profile/assign_adresses.inc.php
modules/profile/assign_poly.inc.php
modules/profile/get_adresses.inc.php
modules/profile/get_deco.inc.php
modules/profile/get_general.inc.php
modules/profile/get_mentor.inc.php
modules/profile/update_adresses.inc.php
modules/profile/verif_adresses.inc.php
modules/profile/verif_general.inc.php

Signed-off-by: Florent Bruneau <florent.bruneau@polytechnique.org>
ChangeLog
bin/marketPromo.php [new file with mode: 0755]
include/platal.inc.php
modules/email.php
modules/marketing.php
templates/banana/index.tpl
templates/marketing/broken.tpl
templates/search/quick.tpl
templates/survey/show_root.tpl

index e37c52a..47b3242 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -20,6 +20,7 @@ Bug/Wish:
     * Core:
         - #674: MiniWiki xhtml validation                                  -FRU
         - #678: PlUpload filename detection                                -FRU
+        - #717: Allow TLD with length up to 6 characters in emails         -FRU
 
     * Emails:
         - #687: Don't lose authentication when editing a long mail         -FRU
diff --git a/bin/marketPromo.php b/bin/marketPromo.php
new file mode 100755 (executable)
index 0000000..036449e
--- /dev/null
@@ -0,0 +1,49 @@
+#!/usr/bin/php5 -q
+<?php
+
+ini_set('include_path', '.:../include:/usr/share/php');
+require_once('connect.db.inc.php');
+require_once('marketing.inc.php');
+
+$opts = getopt('f:l:m:');
+if (($opts['f'] && $opts['f'] == '-') || empty($opts['f'])) { 
+    $file = 'php://stdin'; 
+} else {
+    $file = $opts['f'];
+}
+if (empty($opts['l']) || empty($opts['m'])) {
+    exit;
+}
+$matcol = intval($opts['m']);
+$logcol = intval($opts['l']);
+$handle = fopen($file, 'r');
+
+while ($data = fgetcsv($handle)) {
+    $login = $data[$logcol];
+    $matri = preg_replace('/1(\d{2})(\d{3})/', '20${1}0\2', $data[$matcol]);
+    if (!is_numeric($matri)) {
+        echo "ERROR The matricule ($matri) is not a numerical value\n";
+        break;
+    }
+    $query = XDB::query("SELECT  user_id
+                           FROM  auth_user_md5
+                          WHERE  matricule = {?}",
+                        $matri);
+    $uid = $query->fetchOneCell();
+    if (!$uid) {
+        echo "WARNING Can't find uid for matricule $matri (login $login)\n";
+        continue;
+    }
+    $market = Marketing::get($uid, "$login@poly.polytechnique.fr");
+    if (!is_null($market)) {
+        echo "WARNING A marketing has already been to $matri on $login\n";
+        continue;
+    }
+    $market = new Marketing($uid, "$login@poly.polytechnique.fr", 'default', null, 'staff');
+    $market->add(false);
+    $market->send();
+}
+
+// vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8:
+?>
+
index 7ab9ef8..ad6bbe9 100644 (file)
@@ -134,7 +134,7 @@ function isvalid_email($email)
     // la rfc2822 authorise les caractères "a-z", "0-9", "!", "#", "$", "%", "&", "'", "*", "+", "-", "/", "=", "?", "^",  `", "{", "|", "}", "~" aussi bien dans la partie locale que dans le domaine.
     // Pour la partie locale, on réduit cet ensemble car il n'est pas utilisé.
     // Pour le domaine, le système DNS limite à [a-z0-9.-], on y ajoute le "_" car il est parfois utilisé.
-    return preg_match("/^[a-z0-9_.'+-]+@[a-z0-9._-]+\.[a-z]{2,4}$/i", $email);
+    return preg_match("/^[a-z0-9_.'+-]+@[a-z0-9._-]+\.[a-z]{2,6}$/i", $email);
 }
 
 function pl_url($path, $query = null, $fragment = null)
index 356d32c..9648534 100644 (file)
@@ -154,7 +154,7 @@ class EmailModule extends PLModule
                 //vérifier que l'alias n'est pas déja en demande
                 $it = new ValidateIterator ();
                 while($req = $it->next()) {
-                    if ($req->type == "alias" and $req->alias == $alias) {
+                    if ($req->type == "alias" and $req->alias == $alias . '@' . $globals->mail->alias_dom) {
                         $page->trig("L'alias $alias@{$globals->mail->alias_dom} a déja été demandé.
                                     Tu ne peux donc pas l'obtenir pour l'instant.");
                         return ;
index b967df7..8c648d0 100644 (file)
@@ -178,7 +178,8 @@ class MarketingModule extends PLModule
         }
 
         $res = Xdb::query("SELECT  u.nom, u.prenom, u.promo, FIND_IN_SET('femme', u.flags) AS sexe,
-                                   a.alias AS forlife, b.alias AS bestalias, e.email, e.last
+                                   u.deces = '0000-00-00' AS alive, a.alias AS forlife, b.alias AS bestalias,
+                                   e.email, e.last
                              FROM  auth_user_md5 AS u
                        INNER JOIN  aliases       AS a ON (a.id = u.user_id AND a.type = 'a_vie')
                        INNER JOIN  aliases       AS b ON (b.id = u.user_id AND FIND_IN_SET('bestalias', b.flags))
index 153cf7a..fd6691b 100644 (file)
 
 <br />
 {$banana|smarty:nodefaults}
+
+<p class="smaller">
+  {icon name="lightbulb" title="Astuce"}Astuce&nbsp;:
+  Tu peux également consulter les fora en utilisant un client NNTP tel que
+  Outlook Express ou Thunderbird.<br />N'hésite pas à <a href="password/smtp?doc=nntp">
+  consulter la documentation et à activer ton accès</a> pour utiliser ce service.
+</p>
+
 {* vim:set et sw=2 sts=2 sws=2 enc=utf-8: *}
index 9a314f4..80266d5 100644 (file)
   Merci de nous avoir communiqué cette information !
 </p>
 
-{elseif $user}
+{elseif $user && !$user.alive}
+<p class="erreur">
+  {$user.prenom} {$user.nom} (X{$user.promo}) est malheureusement décédé{if $user.sexe}e{/if}.
+  Nous ne réaliserons maintenance sur son adresse Polytechnique.org qu'à la demande explicite
+  de sa famille. Pour tout renseignement, merci de <a href="mailto:contact@polytechnique.org">
+  contacter le support</a>.
+</p>
 
+{elseif $user}
 <h1>
   Recherche d'adresses pour {$user.nom} {$user.prenom} (X{$user.promo})
 </h1>
index 16639fd..25a4b1b 100644 (file)
@@ -47,7 +47,7 @@
 <form action="" method="post" onsubmit="return showPromo();">
 <table class="tinybicol" style="width: 35%; margin-right: auto; margin-left: auto">
   <tr>
-    <td class="titre">Promotion :</td>
+    <td class="titre">Promotion&nbsp;:</td>
     <td>
       <input type="text" name="promo" id="promo" size="4" value="" />
       <input type="submit" name="submit_promo" value="Voir" />
index 909e2ee..5a91c95 100644 (file)
@@ -67,7 +67,7 @@
       {assign var="survey_editallmode" value=true}
     {/if}
     {if $survey_editmode}
-    <td>
+    <td class="smaller" style="width: 30%">
       <a href='survey/edit/question/root'>{icon name=page_edit} Modifier la description</a>
       {if $survey_editallmode}<br /><a href='survey/edit/add/0'>{icon name=add} Ajouter une question au d&#233;but</a>{/if}
     </td>
@@ -80,7 +80,7 @@
       {include file='survey/show_question.tpl' squestion=$squestion}
     </td>
     {if $survey_editallmode}
-    <td>
+    <td class="smaller" style="width: 30%; vertical-align: middle">
       <a href='survey/edit/question/{$squestion.id}'>{icon name=page_edit} Modifier cette question</a><br />
       <a href='survey/edit/del/{$squestion.id}'>{icon name=delete} Supprimer cette question</a><br />
       <a href='survey/edit/add/{$squestion.id+1}'>{icon name=add} Ajouter une question apr&#232;s</a>