Prevents users with Google Apps storage as only email redirection to be considered...
authorVincent Zanotti <vincent.zanotti@polytechnique.org>
Sat, 22 Mar 2008 23:55:44 +0000 (00:55 +0100)
committerVincent Zanotti <vincent.zanotti@polytechnique.org>
Sat, 22 Mar 2008 23:55:44 +0000 (00:55 +0100)
Signed-off-by: Vincent Zanotti <vincent.zanotti@polytechnique.org>
include/user.func.inc.php
include/userset.inc.php
modules/email.php
modules/lists/lists.inc.php
modules/marketing.php
modules/search/classes.inc.php
modules/xnetgrp.php

index 05da262..8a53e76 100644 (file)
@@ -48,7 +48,7 @@ function user_clear_all_subs($user_id, $really_del=true)
         $tables_to_clear['contact'] = array('contacts');
         XDB::execute("UPDATE auth_user_md5
                          SET date_ins = 0, promo_sortie = 0, nom_usage = '',  password = '', perms = 'pending',
-                             nationalite = '', cv = '', section = 0, date = 0, smtppass = ''
+                             nationalite = '', cv = '', section = 0, date = 0, smtppass = '', mail_storage = ''
                        WHERE user_id = {?}", $uid);
         XDB::execute("DELETE virtual.* FROM virtual INNER JOIN virtual_redirect AS r USING(vid) WHERE redirect = {?}",
                      $alias.'@'.$globals->mail->domain);
@@ -397,7 +397,7 @@ function &get_user_details($login, $from_uid = '', $view = 'private')
                        s.text AS section, p.x, p.y, p.pub AS photo_pub,
                        u.matricule_ax,
                        m.expertise != '' AS is_referent,
-                       COUNT(e.email) > 0 AS actif
+                       (COUNT(e.email) > 0 OR FIND_IN_SET('googleapps', u.mail_storage) > 0) AS actif
                  FROM  auth_user_md5   AS u
            INNER JOIN  auth_user_quick AS q  USING(user_id)
            INNER JOIN  aliases         AS a  ON (u.user_id=a.id AND a.type='a_vie')
index 6392160..3829090 100644 (file)
@@ -186,7 +186,8 @@ class MinificheView extends MultipageView
                 ad1.text AS app1text, ad1.url AS app1url, ai1.type AS app1type,
                 adr.city, gp.a2, gp.pays AS countrytxt, gr.name AS region,
                 IF(u.nom_usage<>'',u.nom_usage,u.nom) AS sortkey,
-                COUNT(em.email) > 0 AS actif" . (S::logged() ? ", c.contact AS contact" : '');
+                (COUNT(em.email) > 0 OR FIND_IN_SET('googleapps', u.mail_storage) > 0) AS actif" .
+                (S::logged() ? ", c.contact AS contact" : '');
     }
 
     public function joins()
index 24a37fd..c01b079 100644 (file)
@@ -637,12 +637,14 @@ L'équipe d'administration <support@" . $globals->mail->domain . '>';
         $page->changeTpl('emails/lost.tpl');
 
         $page->assign('lost_emails', XDB::iterator('
-          SELECT u.user_id, a.alias
-          FROM auth_user_md5 AS u
-            INNER JOIN aliases AS a ON (a.id = u.user_id AND a.type = "a_vie")
-            LEFT JOIN emails AS e ON (u.user_id=e.uid AND FIND_IN_SET("active",e.flags))
-          WHERE e.uid IS NULL AND u.deces = 0
-          ORDER BY u.promo DESC, u.nom, u.prenom'));
+            SELECT  u.user_id, a.alias
+              FROM  auth_user_md5 AS u
+        INNER JOIN  aliases AS a ON (a.id = u.user_id AND a.type = "a_vie")
+         LEFT JOIN  emails  AS e ON (u.user_id=e.uid AND FIND_IN_SET("active",e.flags))
+             WHERE  e.uid IS NULL AND
+                    FIND_IN_SET("googleapps", u.mail_storage) = 0 AND
+                    u.deces = 0
+          ORDER BY  u.promo DESC, u.nom, u.prenom'));
     }
 }
 
index 15858ce..c3a5abf 100644 (file)
@@ -29,10 +29,11 @@ function list_sort_owners(&$members, $tri_promo = true) {
     foreach($members as $mem) {
         list($m, $dom) = explode('@',$mem);
         if ($dom == $globals->mail->domain || $dom == $globals->mail->domain2) {
-            $res = XDB::query('SELECT  prenom, IF(nom_usage="", nom, nom_usage), promo, e.uid IS NULL
+            $res = XDB::query('SELECT  prenom, IF(nom_usage="", nom, nom_usage), promo,
+                                       (e.uid IS NULL AND FIND_IN_SET("googleapps", u.mail_storage) = 0)
                                  FROM  auth_user_md5 AS u
                            INNER JOIN  aliases AS a ON u.user_id = a.id
-                            LEFT JOIN  emails AS e ON ( e.flags = \'active\' AND e.uid = u.user_id)
+                            LEFT JOIN  emails AS e ON (e.flags = "active" AND e.uid = u.user_id)
                                 WHERE  a.alias = {?}
                              GROUP BY  u.user_id', $m);
             if(list($prenom, $nom, $promo, $broken) = $res->fetchOneRow()) {
index 997865e..23593c0 100644 (file)
@@ -179,7 +179,7 @@ class MarketingModule extends PLModule
 
         $res = Xdb::query("SELECT  u.nom, u.prenom, u.promo, FIND_IN_SET('femme', u.flags) AS sexe,
                                    u.deces = '0000-00-00' AS alive, a.alias AS forlife, b.alias AS bestalias,
-                                   e.email, e.last
+                                   IF(e.email IS NOT NULL, e.email, IF(FIND_IN_SET('googleapps', u.mail_storage), 'googleapps', NULL)) AS 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 ea58298..49cb896 100644 (file)
@@ -36,7 +36,7 @@ require_once("xorg.misc.inc.php");
     ad1.text AS app1text, ad1.url AS app1url, ai1.type AS app1type,
     es.label AS secteur, ef.fonction_fr AS fonction,
     IF(n.nat=\'\',n.pays,n.nat) AS nat, n.a2 AS iso3166,
-    COUNT(em.email) > 0 AS actif,';
+    (COUNT(em.email) > 0 OR FIND_IN_SET("googleapps", u.mail_storage) > 0) AS actif,';
 // hide private information if not logged
 if (S::logged())
     $globals->search->result_fields .='
index 794fdc7..4868d3f 100644 (file)
@@ -432,7 +432,7 @@ class XnetGrpModule extends PLModule
                            m.perms='admin' AS admin,
                            m.origine='X' AS x,
                            u.perms!='pending' AS inscrit,
-                           m.uid, IF(e.email IS NULL,NULL,1) AS actif
+                           m.uid, IF(e.email IS NULL AND FIND_IN_SET('googleapps', u.mail_storage) = 0, NULL, 1) AS actif
                      FROM  groupex.membres AS m
                 LEFT JOIN  auth_user_md5   AS u ON ( u.user_id = m.uid )
                 LEFT JOIN  aliases         AS a ON ( a.id = m.uid AND a.type='a_vie' )