identification disappeared, now auth_user_md5 only
authorx2000chevalier <x2000chevalier>
Sun, 31 Oct 2004 16:12:12 +0000 (16:12 +0000)
committerx2000chevalier <x2000chevalier>
Sun, 31 Oct 2004 16:12:12 +0000 (16:12 +0000)
include/identification.inc.php
include/inscription_forums_base.inc.php
include/profil/get_general.inc.php
include/profil/get_poly.inc.php
include/select_user.inc.php
include/xorg.session.inc.php
scripts/cron/checkdb.php

index 969cce6..d7bf74f 100644 (file)
@@ -18,7 +18,7 @@
  *  Foundation, Inc.,                                                      *
  *  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                *
  ***************************************************************************
-        $Id: identification.inc.php,v 1.10 2004-10-09 15:00:11 x2000habouzit Exp $
+        $Id: identification.inc.php,v 1.11 2004-10-31 16:12:12 x2000chevalier Exp $
  ***************************************************************************/
 
 require_once('xorg.misc.inc.php');
@@ -87,7 +87,7 @@ if ($promo > 1995)  {
     // sinon le même X pourrait s'inscrire deux fois avec le même matricule
     // exemple yann.buril et yann.buril-dupont seraient acceptés ! alors que
     // le matricule est unique
-    $result=$globals->db->query("SELECT user_id FROM auth_user_md5 where matricule=$matricule");
+    $result=$globals->db->query("SELECT user_id FROM auth_user_md5 WHERE matricule=$matricule AND user != 'non-inscrit'");
     if (mysql_num_rows($result))  {
        $str="Matricule déjà existant. Causes possibles\n"
            ."- tu t'es trompé de matricule\n"
@@ -97,7 +97,7 @@ if ($promo > 1995)  {
 
     // promotion jeune
     $result=$globals->db->query("SELECT  nom, prenom
-                                  FROM  identification
+                                  FROM  auth_user_md5
                                  WHERE  matricule='$matricule' AND promo='$promo' AND deces=0");
     list($mynom, $myprenom) = mysql_fetch_row($result);
     $mynomup=strtoupper(replace_accent($mynom));
@@ -119,7 +119,7 @@ if ($promo > 1995)  {
 
 } else {
     // CODE SPECIAL POUR LES X DES PROMOTIONS AVANT 1996
-    $sql = "SELECT nom,prenom,matricule FROM identification WHERE promo='$promo' AND deces=0";
+    $sql = "SELECT nom,prenom,matricule FROM auth_user_md5 WHERE promo='$promo' AND deces=0";
     $result = $globals->db->query($sql);
     $autorisation = FALSE;
     
@@ -156,7 +156,7 @@ if ($promo > 1995)  {
     // exemple yann.buril et yan.buril seraient acceptés ! alors que le matricule
     // est unique
     if (! empty($matricule)) { 
-       $result=$globals->db->query("SELECT * FROM auth_user_md5 where matricule='".$matricule."'");
+       $result=$globals->db->query("SELECT * FROM auth_user_md5 WHERE matricule='".$matricule."' AND perms != 'non-inscrit'");
        if ($myrow = mysql_fetch_array($result))  {
            $str="Tu t'es déjà inscrit une fois.\n"
                ."Ecris à <a href=\"mailto:support@polytechnique.org\">support@polytechnique.org</a> pour tout problème.";
index bb00251..0a92d7b 100644 (file)
@@ -18,7 +18,7 @@
  *  Foundation, Inc.,                                                      *
  *  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                *
  ***************************************************************************
-        $Id: inscription_forums_base.inc.php,v 1.2 2004-08-31 11:16:48 x2000habouzit Exp $
+        $Id: inscription_forums_base.inc.php,v 1.3 2004-10-31 16:12:12 x2000chevalier Exp $
  ***************************************************************************/
 
 
@@ -33,9 +33,9 @@ function inscription_forum_promo($uid,$promo) {
   // 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'");
+    $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 identification WHERE promo='$promo'");
+    $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');
index a6ed7d2..cfe6939 100644 (file)
  *  Foundation, Inc.,                                                      *
  *  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                *
  ***************************************************************************
-        $Id: get_general.inc.php,v 1.5 2004-09-02 23:25:30 x2000habouzit Exp $
+        $Id: get_general.inc.php,v 1.6 2004-10-31 16:12:14 x2000chevalier Exp $
  ***************************************************************************/
 
 // on ramène les données du profil connecté (uid paramètre de session)
 $sql = "SELECT u.nom, u.prenom".
-        ", u.promo, u.epouse, FIND_IN_SET('femme',i.flags), nationalite".
+        ", u.promo, u.epouse, FIND_IN_SET('femme',u.flags), nationalite".
        ", mobile".
        ", web".
         ", libre".
@@ -32,7 +32,6 @@ $sql = "SELECT u.nom, u.prenom".
        " FROM auth_user_md5 AS u".
        " LEFT  JOIN applis_ins AS a1 ON(a1.uid = u.user_id and a1.ordre = 0)".
        " LEFT  JOIN applis_ins AS a2 ON(a2.uid = u.user_id and a2.ordre = 1)".
-       " LEFT  JOIN identification AS i ON(u.matricule = i.matricule) ".
        " WHERE user_id=".$_SESSION['uid'];
 
 $result = $globals->db->query($sql);
index 0caedbc..4d1a6fd 100644 (file)
  *  Foundation, Inc.,                                                      *
  *  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                *
  ***************************************************************************
-        $Id: get_poly.inc.php,v 1.3 2004-09-01 22:15:54 x2000habouzit Exp $
+        $Id: get_poly.inc.php,v 1.4 2004-10-31 16:12:14 x2000chevalier Exp $
  ***************************************************************************/
 
 
 //declaration des fonctions msarty pour les binets et groupex
 
 $sql = "SELECT u.nom, u.prenom".
-    ", u.promo, epouse, i.flags, section".
+    ", u.promo, epouse, u.flags, section".
     " FROM auth_user_md5 AS u".
-    " LEFT  JOIN identification AS i ON(u.matricule = i.matricule) ".
     " WHERE user_id=".$_SESSION['uid'];
 
 $result = $globals->db->query($sql);
index f57d058..338f57b 100644 (file)
@@ -18,7 +18,7 @@
  *  Foundation, Inc.,                                                      *
  *  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                *
  ***************************************************************************
-        $Id: select_user.inc.php,v 1.3 2004-09-05 22:58:46 x2000habouzit Exp $
+        $Id: select_user.inc.php,v 1.4 2004-10-31 16:12:12 x2000chevalier Exp $
  ***************************************************************************/
 
 if(empty($_REQUEST["xmat"]) || empty($_REQUEST["submit"])) {
@@ -29,7 +29,7 @@ if(empty($_REQUEST["xmat"]) || empty($_REQUEST["submit"])) {
 
     if (!empty($_REQUEST["xmat"])) {
        // on a un matricule, on affiche juste l'entrée correspondante
-       $where = "id.matricule={$_REQUEST['xmat']}";
+       $where = "matricule={$_REQUEST['xmat']}";
     } else {
        // on n'a pas le matricule, essayer de le trouver moi-meme, de le proposer
        // et de reafficher le formulaire avec les propositions de matricules
@@ -52,18 +52,17 @@ if(empty($_REQUEST["xmat"]) || empty($_REQUEST["submit"])) {
        }
 
        if(strlen($_REQUEST["promoR"])==4) {
-           $rq="AND id.promo=".$_REQUEST["promoR"];
+           $rq="AND promo=".$_REQUEST["promoR"];
        } else {
            $rq="";
        }
 
-       $where = "id.prenom LIKE '%{$_REQUEST['prenomR']}%' AND id.nom LIKE '%$chaine%' $rq ORDER BY id.promo,id.nom";
+       $where = "prenom LIKE '%{$_REQUEST['prenomR']}%' AND nom LIKE '%$chaine%' $rq ORDER BY promo,nom";
     } // a-t-on xmat
 
-    $sql = "SELECT  id.*,user_id
-              FROM  identification AS id
-         LEFT JOIN  auth_user_md5 USING(matricule)
-             WHERE  user_id IS NULL AND deces=0 AND $where";
+    $sql = "SELECT  matricule,matricule_ax,promo,nom,prenom,comment,appli,flags,last_known_email,deces,user_id
+              FROM  auth_user_md5
+             WHERE  perms = 'non-inscrit' AND deces=0 AND $where";
 
     new_admin_page('marketing/utilisateurs_select.tpl');
     $page->mysql_assign($sql, 'nonins');
index bf2b71f..9053544 100644 (file)
@@ -18,7 +18,7 @@
  *  Foundation, Inc.,                                                      *
  *  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                *
  ***************************************************************************
-        $Id: xorg.session.inc.php,v 1.34 2004-10-30 15:45:40 x2000habouzit Exp $
+        $Id: xorg.session.inc.php,v 1.35 2004-10-31 16:12:12 x2000chevalier Exp $
  ***************************************************************************/
 
 require("diogenes.core.session.inc.php");
@@ -221,7 +221,7 @@ function start_connexion ($uid, $identified) {
     global $globals;
     $result=$globals->db->query("
        SELECT  prenom, nom, perms, promo, matricule, UNIX_TIMESTAMP(s.start) AS lastlogin, s.host,
-               a.alias, UNIX_TIMESTAMP(u.lastnewslogin), a2.alias, password
+               a.alias, UNIX_TIMESTAMP(u.lastnewslogin), a2.alias, password, FIND_IN_SET('femme', flags)
           FROM  auth_user_md5   AS u
     INNER JOIN aliases         AS a ON (u.user_id = a.id AND a.type='a_vie')
     INNER JOIN  aliases                AS a2 ON (u.user_id = a2.id AND (a2.type='a_vie' OR a2.type='alias' OR a2.type='epouse') AND a2.alias LIKE '%.%')
@@ -230,7 +230,7 @@ function start_connexion ($uid, $identified) {
       ORDER BY  s.start DESC, a2.type != 'epouse', length(a2.alias)
          LIMIT  1");
     list($prenom, $nom, $perms, $promo, $matricule, $lastlogin, $host,
-        $forlife, $lastnewslogin, $bestalias, $password) = mysql_fetch_row($result);
+        $forlife, $lastnewslogin, $bestalias, $password, $femme) = mysql_fetch_row($result);
     mysql_free_result($result);
    
     // on garde le logger si il existe (pour ne pas casser les sessions lors d'une
@@ -267,9 +267,7 @@ function start_connexion ($uid, $identified) {
     $_SESSION['bestalias'] = $bestalias;
     $_SESSION['matricule'] = $matricule;
     $_SESSION['password'] = $password;
-    $res = $globals->db->query("SELECT flags FROM identification WHERE matricule = '$matricule' AND FIND_IN_SET(flags, 'femme')");
-    $_SESSION['femme'] = mysql_num_rows($res) > 0;
-    mysql_free_result($res);
+    $_SESSION['femme'] = $femme;
     // on récupère le logger si il existe, sinon, on logge la connexion
     set_skin();
 }
index cc00c1b..94b8053 100755 (executable)
  *  Foundation, Inc.,                                                      *
  *  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                *
  ***************************************************************************
-        $Id: checkdb.php,v 1.9 2004-10-17 20:15:42 x2000habouzit Exp $
+        $Id: checkdb.php,v 1.10 2004-10-31 16:15:19 x2000chevalier Exp $
  ***************************************************************************/
 /*
  * verifie qu'il n'y a pas d'incoherences dans les tables de jointures
  * 
- * $Id: checkdb.php,v 1.9 2004-10-17 20:15:42 x2000habouzit Exp $
+ * $Id: checkdb.php,v 1.10 2004-10-31 16:15:19 x2000chevalier Exp $
 */ 
 
 require('./connect.db.inc.php');
@@ -121,9 +121,6 @@ check("select p.* from photo as p left join auth_user_md5 as u on u.user_id=p.ui
 check("SELECT a.uid, a.pays FROM adresses AS a LEFT JOIN geoloc_pays AS gp ON a.pays = gp.a2 WHERE gp.pays IS NULL","donne la liste des pays dans les profils qui n'ont pas d'entree correspondante dans geoloc_pays");
 check("SELECT a.uid, a.pays, a.region FROM adresses AS a LEFT JOIN geoloc_region AS gr ON (a.pays = gr.a2 AND a.region = gr.region) WHERE a.region != '' AND gr.name IS NULL","donne la liste des regions dans les profils qui n'ont pas d'entree correspondante dans geoloc_region");
 
-/* vérifie que les champs promos d'identification et auth_user_md5 coïncident */
-check("select a.promo as promo_ok,i.promo as promo_bad,a.matricule,a.nom,a.prenom from auth_user_md5 as a inner join identification as i on a.matricule = i.matricule where a.promo != i.promo", "vérifie que les champs promos d'identification et auth_user_md5 coïncident");
-
 /* donne la liste des gens pour qui on a fait du marketing mais qui se sont inscrits depuis (nettoyage de envoidirect) */
 info("select e.matricule,e.nom,e.prenom,e.promo from envoidirect as e inner join auth_user_md5 as a on e.matricule = a.matricule order by promo,nom;");
 
@@ -145,9 +142,8 @@ info("SELECT  a1.alias, a2.alias, e1.email, e2.flags
 check("SELECT  u.user_id, a.alias
         FROM  auth_user_md5  AS u 
    INNER JOIN  aliases        AS a ON (u.user_id = a.id AND a.type='a_vie')
-   INNER JOIN  identification AS i ON (i.matricule = u.matricule AND i.deces = 0)
     LEFT JOIN  emails         AS e ON(u.user_id=e.uid AND FIND_IN_SET('active',e.flags))
-        WHERE  e.uid IS NULL",
+        WHERE  e.uid IS NULL AND u.deces = 0",
 "donne les inscrits qui n'ont pas d'email actif");
 
 /* donne la liste des homonymes qui ont un alias égal à leur loginbis depuis plus d'un mois */
@@ -167,7 +163,7 @@ check("SELECT  a.alias AS a_un_pb, email, rewrite AS broken
 
 /* validite du champ matricule_ax de la table identification */
 check("SELECT  matricule,nom,prenom,matricule_ax,COUNT(matricule_ax) AS c
-         FROM  identification
+         FROM  auth_user_md5
        WHERE  matricule_ax != '0'
      GROUP BY  matricule_ax
        having  c > 1", "à chaque personne de l'annuaire de l'AX (identification_ax) doit correspondre AU PLUS UNE personne de notre annuaire (identification) -> si ce n'est pas le cas il faut regarder en manuel ce qui ne va pas !");