Merge commit 'origin/master' into fusionax
authorStéphane Jacob <sj@m4x.org>
Fri, 13 Nov 2009 19:24:01 +0000 (20:24 +0100)
committerStéphane Jacob <sj@m4x.org>
Fri, 13 Nov 2009 19:24:01 +0000 (20:24 +0100)
86 files changed:
ChangeLog
Makefile
bin/cron/checkdb.php
bin/cron/compliance.php
bin/cron/cron_validations.php
bin/cron/notifs.send.php
classes/platalglobals.php.in
classes/platallogger.php
classes/xnetpage.php
classes/xnetsession.php
classes/xorgpage.php
classes/xorgsession.php
configs/platal.ini
core
htdocs/.htaccess.in
htdocs/index.html
htdocs/javascript/.gitignore
htdocs/javascript/md5.js [deleted file]
htdocs/javascript/xorg.js
htdocs/listes_redirect.php
include/banana/forum.inc.php
include/banana/hooks.inc.php
include/newsletter.inc.php
include/notifs.inc.php
include/reminder.inc.php
include/reminder/promotion_ml.inc.php
include/rss.inc.php
include/user.func.inc.php
include/userset.inc.php
include/validations/listes.inc.php
include/validations/paiements.inc.php
modules/admin.php
modules/auth.php
modules/auth/auth.inc.php
modules/bandeau.php
modules/carnet.php
modules/email.php
modules/events.php
modules/forums.php
modules/gadgets/gadgets.inc.php
modules/lists.php
modules/lists/lists.inc.php
modules/newsletter.php
modules/openid/openid.inc.php
modules/payment.php
modules/payment/money.inc.php
modules/platal.php
modules/profile.php
modules/profile/groups.inc.php
modules/register.php
modules/search.php
modules/search/classes.inc.php
modules/search/search.inc.php
modules/stats.php
modules/survey.php
modules/survey/survey.inc.php
modules/xnet.php
modules/xnetevents.php
modules/xnetevents/xnetevents.inc.php
modules/xnetgrp.php
modules/xnetgrp/feed.inc.php
modules/xnetgrp/mail.inc.php
modules/xnetlists.php
templates/admin/deces_promo.tpl
templates/carnet/mescontacts.tpl
templates/emails/broken_addr.tpl
templates/emails/send.tpl
templates/include/form.valid.surveys.tpl
templates/lists/create.tpl
templates/payment/index.tpl
templates/search/quick.tpl
templates/skin/common.bandeau.head.tpl
templates/skin/common.header.tpl
templates/survey/edit_newsurvey.tpl
templates/survey/edit_root.tpl
templates/survey/edit_survey.tpl
templates/survey/error.tpl
templates/survey/show_root.tpl
templates/survey/show_text.tpl
templates/survey/show_textarea.tpl
templates/survey/success.tpl
templates/xnet/skin.tpl
templates/xnetevents/edit.tpl
upgrade/0.10.2/update.sh [new file with mode: 0755]
upgrade/0.10.3/update.sh [new file with mode: 0755]
upgrade/inc/pervasive.sh

index ad52697..5ec8bf6 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -17,7 +17,12 @@ Bug/Wish:
         - #891: Improves education display                                 -JAC
 
 ================================================================================
-VERSION 0.10.2                                                        XX XX XXXX
+VERSION 0.10.3                                                        XX XX XXXX
+
+New:
+
+================================================================================
+VERSION 0.10.2                                                        13 11 2009
 
 New:
 
@@ -26,6 +31,7 @@ New:
 
     * Core:
         - Prunes old sessions/events logs after 12 months                  -VZA
+        - Adds proper content caching for static and semi-static content   -VZA
 
 Bug/Wish:
 
@@ -34,6 +40,7 @@ Bug/Wish:
 
     * Carnet:
         - #975: Cleans up watch_nonins when someone dies                   -JAC
+        - #1000: Notifies her contacts when a user has no redirection left -JAC
 
     * Core:
         - #984: Properly upper/lowercases accented letters when necessary  -JAC
index ba24d7e..3233b9f 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -26,7 +26,7 @@ endef
 
 all: build
 
-build: core conf banana wiki openid medals jquery
+build: core conf static banana wiki openid medals jquery
 
 q:
        @echo -e "Code statistics\n"
@@ -62,6 +62,14 @@ htdocs/.htaccess: htdocs/.htaccess.in Makefile
        sed -e "s,@REWRITE_BASE@,$$REWRITE_BASE,g" $< > $@
 
 ##
+## static content
+##
+static: htdocs/javascript@VERSION
+
+%@VERSION: % Makefile ChangeLog
+       cd $< && rm -f $(VERSION) && ln -sf . $(VERSION)
+
+##
 ## wiki
 ##
 
index ea1fdb7..98a22e7 100755 (executable)
@@ -113,10 +113,10 @@ check("select c.* from contacts as c left join auth_user_md5 as u on u.user_id=c
 check("select e.* from emails as e left join auth_user_md5 as u on u.user_id=e.uid where e.uid and u.prenom is null");
 
 /* validite de forums */
-check("select f.* from forums.abos as f left join auth_user_md5 as u on u.user_id=f.uid where u.prenom is null");
-check("select f.* from forums.abos as f left join forums.list as fd on fd.fid=f.fid where fd.nom is null");
-check("select f.* from forums.respofaqs as f left join forums.list as fd on fd.fid=f.fid where fd.nom is null");
-check("select f.* from forums.respofaqs as f left join auth_user_md5 as u on u.user_id=f.uid where u.prenom is null");
+check("select f.* from #forums#.abos as f left join #x4dat#.auth_user_md5 as u on u.user_id=f.uid where u.prenom is null");
+check("select f.* from #forums#.abos as f left join #forums#.list as fd on fd.fid=f.fid where fd.nom is null");
+check("select f.* from #forums#.respofaqs as f left join #forums#.list as fd on fd.fid=f.fid where fd.nom is null");
+check("select f.* from #forums#.respofaqs as f left join #x4dat#.auth_user_md5 as u on u.user_id=f.uid where u.prenom is null");
 
 /* validite de groupesx_ins */
 check("select g.* from groupesx_ins as g left join auth_user_md5 as u on u.user_id=g.guid where u.prenom is null");
index 0a07a15..4879770 100755 (executable)
@@ -32,15 +32,15 @@ require('./connect.db.inc.php');
  */
 function discardExpiredSessions($userPerms, $retentionPeriod, $minimalBacklog) {
     XDB::execute(
-        "DELETE  logger.s
-           FROM  logger.sessions AS s
+        "DELETE  #logger#.s
+           FROM  #logger#.sessions AS s
            JOIN  (SELECT  u.user_id,
                           (SELECT  us.start
-                             FROM  logger.sessions AS us
+                             FROM  #logger#.sessions AS us
                             WHERE  us.uid = u.user_id
                          ORDER BY  us.start DESC
                             LIMIT  {?}, 1) AS no_discard_limit
-                    FROM  x4dat.auth_user_md5 AS u
+                    FROM  #x4dat#.auth_user_md5 AS u
                    WHERE  u.perms = {?}
                 ORDER BY  u.user_id ASC) AS ut ON (ut.user_id = s.uid)
           WHERE  s.start < DATE_SUB(NOW(), INTERVAL {?} MONTH)
@@ -57,8 +57,8 @@ function discardExpiredSessions($userPerms, $retentionPeriod, $minimalBacklog) {
 function checkOrphanedSessions() {
     $res = XDB::query(
         "SELECT  COUNT(*)
-           FROM  logger.sessions AS s
-      LEFT JOIN  x4dat.auth_user_md5 AS u ON (u.user_id = s.uid)
+           FROM  #logger#.sessions AS s
+      LEFT JOIN  #x4dat#.auth_user_md5 AS u ON (u.user_id = s.uid)
           WHERE  u.user_id IS NULL");
     if (($count = $res->fetchOneCell())) {
         echo "Orphaned sessions: found $count orphaned sessions. Please fix that.\n";
@@ -70,9 +70,9 @@ function checkOrphanedSessions() {
  */
 function purgeOrphanedEvents() {
     XDB::execute(
-        "DELETE  logger.e
-           FROM  logger.events AS e
-      LEFT JOIN  logger.sessions AS s ON (s.id = e.session)
+        "DELETE  #logger#.e
+           FROM  #logger#.events AS e
+      LEFT JOIN  #logger#.sessions AS s ON (s.id = e.session)
           WHERE  s.id IS NULL");
     $affectedRows = XDB::affectedRows();
     echo "Orphaned events: removed $affectedRows events.\n";
@@ -93,8 +93,8 @@ checkOrphanedSessions();
 purgeOrphanedEvents();
 
 // Many rows have been removed from the two logger tables. Let's optimize them.
-XDB::execute("OPTIMIZE TABLE logger.events");
-XDB::execute("OPTIMIZE TABLE logger.sessions");
+XDB::execute("OPTIMIZE TABLE #logger#.events");
+XDB::execute("OPTIMIZE TABLE #logger#.sessions");
 
 // vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8:
 ?>
index bdf7330..3948493 100755 (executable)
@@ -31,7 +31,7 @@ require('plmailer.php');
 
 $res = XDB::query("SELECT  count(r.stamp), UNIX_TIMESTAMP(MIN(r.stamp)),
                            sum(r.stamp < NOW() - $M_PERIOD), sum(r.stamp < NOW() - $R_PERIOD)
-                     FROM  x4dat.requests AS r");
+                     FROM  requests AS r");
 list($nb, $age, $nbold, $nbveryold) = $res->fetchOneRow();
 
 $age = (time() - intval($age)) / 86400;
@@ -70,7 +70,7 @@ $message =
        ."https://www.polytechnique.org/admin/validate\n\n"
         ."Par catégorie :\n";
 $res = XDB::iterRow("SELECT  type, count(*)
-                       FROM  x4dat.requests
+                       FROM  requests
                    GROUP BY  type
                    ORDER BY  type");
 while (list($type, $nb) = $res->next()) {
index 1d5ceca..abaa47d 100755 (executable)
@@ -36,8 +36,11 @@ foreach ($all->_data as $u) {
     $mailer->send($u['mail_fmt'] == 'html');
 }
 
-XDB::execute("DELETE FROM  watch_profile
-                    WHERE  ts < DATE_SUB(CURRENT_DATE, INTERVAL 15 DAY)");
+XDB::execute("UPDATE  watch_profile
+                 SET  ts = NOW()
+               WHERE  field = 'broken'");
+XDB::execute('DELETE FROM  watch_profile
+                    WHERE  ts < DATE_SUB(CURRENT_DATE, INTERVAL 15 DAY)');
 
 // vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8:
 ?>
index a35c3c1..0fb6e6f 100644 (file)
@@ -26,6 +26,7 @@ class PlatalGlobals extends PlGlobals
 
     /** db params */
     public $dbdb               = 'x4dat';
+    public $dbprefix           = '';
     public $dbhost             = 'localhost';
     public $dbuser             = 'x4dat';
     public $dbpwd              = 'x4dat';
@@ -63,8 +64,8 @@ class PlatalGlobals extends PlGlobals
                 $res = XDB::query("SELECT  a.*, d.nom AS domnom,
                                            FIND_IN_SET('notif_unsub', a.flags) AS notif_unsub,
                                            FIND_IN_SET('has_ml', a.flags) AS has_ml
-                                     FROM  groupex.asso AS a
-                                LEFT JOIN  groupex.dom  AS d ON d.id = a.dom
+                                     FROM  #groupex#.asso AS a
+                                LEFT JOIN  #groupex#.dom  AS d ON d.id = a.dom
                                     WHERE  diminutif = {?}",
                                   $gp);
                 if (!($aid = $res->fetchOneAssoc())) {
index 7ebdab0..9e9e535 100644 (file)
@@ -45,7 +45,7 @@ class PlatalLogger extends PlLogger
         $this->session = $this->writeSession($uid, $suid);
 
         // retrieve available actions
-        $res = XDB::iterRow("SELECT id, text FROM logger.actions");
+        $res = XDB::iterRow("SELECT id, text FROM #logger#.actions");
 
         while (list($action_id, $action_text) = $res->next()) {
             $this->actions[$action_text] = $action_id;
@@ -74,7 +74,7 @@ class PlatalLogger extends PlLogger
             $proxy = 'proxy';
         }
 
-        XDB::execute("INSERT INTO logger.sessions
+        XDB::execute("INSERT INTO #logger#.sessions
                          SET uid={?}, host={?}, ip={?}, forward_ip={?}, forward_host={?}, browser={?}, suid={?}, flags={?}",
                      $uid, $host, ip_to_uint($ip), ip_to_uint($forward_ip), $forward_host, $browser, $suid, $proxy);
         if ($forward_ip) {
@@ -91,7 +91,7 @@ class PlatalLogger extends PlLogger
     }
 
     public function saveLastSession() {
-        XDB::execute('REPLACE INTO  logger.last_sessions (uid, id)
+        XDB::execute('REPLACE INTO  #logger#.last_sessions (uid, id)
                             VALUES  ({?}, {?})',
                      $this->uid, $this->session);
     }
@@ -109,7 +109,7 @@ class PlatalLogger extends PlLogger
     public function log($action, $data = null)
     {
         if (isset($this->actions[$action])) {
-            XDB::execute("INSERT INTO logger.events
+            XDB::execute("INSERT INTO #logger#.events
                              SET session={?}, action={?}, data={?}",
                          $this->session, $this->actions[$action], $data);
         } else {
index bd3e1eb..1cff3c8 100644 (file)
@@ -41,6 +41,9 @@ class XnetPage extends PlPage
             $this->assign('is_admin', may_update());
             $this->assign('is_member', is_member());
         }
+        $this->addJsLink('jquery.js');
+        $this->addJsLink('overlib.js');
+        $this->addJsLink('wiki.js');
         $this->addJsLink('xorg.js');
         $this->setTitle('Les associations polytechniciennes');
     }
@@ -140,8 +143,8 @@ function list_all_my_groups($params)
     }
     $res = XDB::iterRow(
             "SELECT  a.nom, a.diminutif
-               FROM  groupex.asso    AS a
-         INNER JOIN  groupex.membres AS m ON m.asso_id = a.id
+               FROM  #groupex#.asso    AS a
+         INNER JOIN  #groupex#.membres AS m ON m.asso_id = a.id
               WHERE  m.uid={?}", S::v('uid'));
     $links = '<a href="exit">déconnexion</a>';
     $html = '<div>Mes groupes (' . $links . ') :</div>';
index e69e6eb..1fffc9b 100644 (file)
@@ -166,7 +166,7 @@ function may_update($force = false, $lose = false)
         $may_update[$asso_id] = true;
     } elseif (!isset($may_update[$asso_id]) || $force) {
         $res = XDB::query("SELECT  perms
-                             FROM  groupex.membres
+                             FROM  #groupex#.membres
                             WHERE  uid={?} AND asso_id={?}",
                           S::v('uid'), $asso_id);
         $may_update[$asso_id] = ($res->fetchOneCell() == 'admin');
@@ -198,7 +198,7 @@ function is_member($force = false, $lose = false)
         $is_member[$asso_id] = true;
     } elseif (!isset($is_member[$asso_id]) || $force) {
         $res = XDB::query("SELECT  COUNT(*)
-                             FROM  groupex.membres
+                             FROM  #groupex#.membres
                             WHERE  uid={?} AND asso_id={?}",
                 S::v('uid'), $asso_id);
         $is_member[$asso_id] = ($res->fetchOneCell() == 1);
index ad73b1d..072f0f4 100644 (file)
@@ -27,6 +27,11 @@ class XorgPage extends PlPage
 
         // Set the default page
         $this->changeTpl('platal/index.tpl');
+        $this->addJsLink('jquery.js');
+        $this->addJsLink('overlib.js');
+        $this->addJsLink('secure_hash.js');
+        $this->addJsLink('sha1.js');
+        $this->addJsLink('wiki.js');
         $this->addJsLink('xorg.js');
         $this->setTitle('le site des élèves et anciens élèves de l\'École polytechnique');
     }
index 0e55c97..e46be2c 100644 (file)
@@ -214,8 +214,8 @@ class XorgSession extends PlSession
                               FROM  auth_user_md5   AS u
                         INNER JOIN  auth_user_quick AS q  USING(user_id)
                          LEFT JOIN  gapps_accounts  AS g  ON (u.user_id = g.l_userid AND g.g_status = 'active')
-                         LEFT JOIN  logger.last_sessions AS ls ON (ls.uid = u.user_id)
-                         LEFT JOIN  logger.sessions AS s  ON(s.id = ls.id)
+                         LEFT JOIN  #logger#.last_sessions AS ls ON (ls.uid = u.user_id)
+                         LEFT JOIN  #logger#.sessions AS s  ON(s.id = ls.id)
                              WHERE  u.user_id = {?} AND u.perms IN('admin', 'user')", $uid);
         if ($res->numRows() != 1) {
             return false;
index 7df0a70..1c89daf 100644 (file)
@@ -47,6 +47,7 @@ alias_dom2 = ""
 
 blacklist_check_url = ""
 blacklist_host_resolution_limit =
+domain_whitelist = ""
 
 [MailStorage]
 imap_active = 0
diff --git a/core b/core
index 2386dca..d38df00 160000 (submodule)
--- a/core
+++ b/core
@@ -1 +1 @@
-Subproject commit 2386dca38cb8aea249b3de8cc075a857498b7292
+Subproject commit d38df00e1a642351bf5db2eec61a86adf2052361
index 8d2c3bf..d404569 100644 (file)
@@ -2,7 +2,16 @@ RewriteEngine on
 
 RewriteBase @REWRITE_BASE@
 
-# Rewrite URLs of the form 'index.php?q=x':
+# Rewrites URLs of the form 'index.php?q=x'.
 RewriteCond %{REQUEST_FILENAME} !-f
 RewriteCond %{REQUEST_FILENAME} !-d
 RewriteRule ^(.*)$ ?n=$1 [L,QSA]
+
+# Caches the immutable resources for seven days. Generated files (images and JS
+# served by PHP) are not affected.
+ExpiresActive On
+ExpiresByType application/x-javascript "access plus 7 days"
+ExpiresByType image/gif "access plus 7 days"
+ExpiresByType image/jpeg "access plus 7 days"
+ExpiresByType image/png "access plus 7 days"
+ExpiresByType text/css "access plus 7 days"
index 1d34714..7df214a 100644 (file)
@@ -2,7 +2,7 @@
 <html>
   <head>
     <title>Polytechnique.org : le site des élèves et anciens élèves de l'École polytechnique</title>
-    <meta http-equiv="content-type" CONTENT="text/html; charset=utf-8">
+    <meta http-equiv="content-type" content="text/html; charset=utf-8">
   </head>
   <body>
     <table align="center" border=0 width=600>
@@ -28,7 +28,7 @@
           <p>Nous vous remercions de votre compr&eacute;hension.
          </p>
           <p>Avec toutes nos excuses pour le d&eacute;rangement occasionn&eacute; et
-          &agrave; bient&ocirc;t !</p>
+          &agrave; bient&ocirc;t&nbsp;!</p>
           <p align="right"><b>L'&eacute;quipe de Polytechnique.org</b></p>
         </td>
       </tr>
index 7fa306b..10a9591 100644 (file)
@@ -1,3 +1,6 @@
+# Versioning links
+/0.10.*
+
 # jQuery and its plugins are downloaded by the Makefile
 /jquery.*js
 !/jquery.autocomplete.js
diff --git a/htdocs/javascript/md5.js b/htdocs/javascript/md5.js
deleted file mode 100644 (file)
index bd4ba66..0000000
+++ /dev/null
@@ -1,379 +0,0 @@
-/*
- *  md5.jvs 1.0b 27/06/96
- *
- * Javascript implementation of the RSA Data Security, Inc. MD5
- * Message-Digest Algorithm.
- *
- * Copyright (c) 1996 Henri Torgemane. All Rights Reserved.
- *
- * Permission to use, copy, modify, and distribute this software
- * and its documentation for any purposes and without
- * fee is hereby granted provided that this copyright notice
- * appears in all copies. 
- *
- * Of course, this soft is provided "as is" without express or implied
- * warranty of any kind.
- *
- */
-
-function array(n) {
-  for(i=0;i<n;i++) this[i]=0;
-  this.length=n;
-}
-
-/* Some basic logical functions had to be rewritten because of a bug in
- * Javascript.. Just try to compute 0xffffffff >> 4 with it..
- * Of course, these functions are slower than the original would be, but
- * at least, they work!
- */
-
-function integer(n) { return n%(0xffffffff+1); }
-
-function shr(a,b) {
-  a=integer(a);
-  b=integer(b);
-  if (a-0x80000000>=0) {
-    a=a%0x80000000;
-    a>>=b;
-    a+=0x40000000>>(b-1);
-  } else
-    a>>=b;
-  return a;
-}
-
-function shl1(a) {
-  a=a%0x80000000;
-  if (a&0x40000000==0x40000000)
-  {
-    a-=0x40000000;  
-    a*=2;
-    a+=0x80000000;
-  } else
-    a*=2;
-  return a;
-}
-
-function shl(a,b) {
-  a=integer(a);
-  b=integer(b);
-  for (var i=0;i<b;i++) a=shl1(a);
-  return a;
-}
-
-function and(a,b) {
-  a=integer(a);
-  b=integer(b);
-  var t1=(a-0x80000000);
-  var t2=(b-0x80000000);
-  if (t1>=0) 
-    if (t2>=0) 
-      return ((t1&t2)+0x80000000);
-    else
-      return (t1&b);
-  else
-    if (t2>=0)
-      return (a&t2);
-    else
-      return (a&b);  
-}
-
-function or(a,b) {
-  a=integer(a);
-  b=integer(b);
-  var t1=(a-0x80000000);
-  var t2=(b-0x80000000);
-  if (t1>=0) 
-    if (t2>=0) 
-      return ((t1|t2)+0x80000000);
-    else
-      return ((t1|b)+0x80000000);
-  else
-    if (t2>=0)
-      return ((a|t2)+0x80000000);
-    else
-      return (a|b);  
-}
-
-function xor(a,b) {
-  a=integer(a);
-  b=integer(b);
-  var t1=(a-0x80000000);
-  var t2=(b-0x80000000);
-  if (t1>=0) 
-    if (t2>=0) 
-      return (t1^t2);
-    else
-      return ((t1^b)+0x80000000);
-  else
-    if (t2>=0)
-      return ((a^t2)+0x80000000);
-    else
-      return (a^b);  
-}
-
-function not(a) {
-  a=integer(a);
-  return (0xffffffff-a);
-}
-
-/* Here begin the real algorithm */
-
-    var state = new array(4); 
-    var count = new array(2);
-       count[0] = 0;
-       count[1] = 0;                     
-    var buffer = new array(64); 
-    var transformBuffer = new array(16); 
-    var digestBits = new array(16);
-
-    var S11 = 7;
-    var S12 = 12;
-    var S13 = 17;
-    var S14 = 22;
-    var S21 = 5;
-    var S22 = 9;
-    var S23 = 14;
-    var S24 = 20;
-    var S31 = 4;
-    var S32 = 11;
-    var S33 = 16;
-    var S34 = 23;
-    var S41 = 6;
-    var S42 = 10;
-    var S43 = 15;
-    var S44 = 21;
-
-    function F(x,y,z) {
-       return or(and(x,y),and(not(x),z));
-    }
-
-    function G(x,y,z) {
-       return or(and(x,z),and(y,not(z)));
-    }
-
-    function H(x,y,z) {
-       return xor(xor(x,y),z);
-    }
-
-    function I(x,y,z) {
-       return xor(y ,or(x , not(z)));
-    }
-
-    function rotateLeft(a,n) {
-       return or(shl(a, n),(shr(a,(32 - n))));
-    }
-
-    function FF(a,b,c,d,x,s,ac) {
-        a = a+F(b, c, d) + x + ac;
-       a = rotateLeft(a, s);
-       a = a+b;
-       return a;
-    }
-
-    function GG(a,b,c,d,x,s,ac) {
-       a = a+G(b, c, d) +x + ac;
-       a = rotateLeft(a, s);
-       a = a+b;
-       return a;
-    }
-
-    function HH(a,b,c,d,x,s,ac) {
-       a = a+H(b, c, d) + x + ac;
-       a = rotateLeft(a, s);
-       a = a+b;
-       return a;
-    }
-
-    function II(a,b,c,d,x,s,ac) {
-       a = a+I(b, c, d) + x + ac;
-       a = rotateLeft(a, s);
-       a = a+b;
-       return a;
-    }
-
-    function transform(buf,offset) { 
-       var a=0, b=0, c=0, d=0; 
-       var x = transformBuffer;
-       
-       a = state[0];
-       b = state[1];
-       c = state[2];
-       d = state[3];
-       
-       for (i = 0; i < 16; i++) {
-           x[i] = and(buf[i*4+offset],0xff);
-           for (j = 1; j < 4; j++) {
-               x[i]+=shl(and(buf[i*4+j+offset] ,0xff), j * 8);
-           }
-       }
-
-       /* Round 1 */
-       a = FF ( a, b, c, d, x[ 0], S11, 0xd76aa478); /* 1 */
-       d = FF ( d, a, b, c, x[ 1], S12, 0xe8c7b756); /* 2 */
-       c = FF ( c, d, a, b, x[ 2], S13, 0x242070db); /* 3 */
-       b = FF ( b, c, d, a, x[ 3], S14, 0xc1bdceee); /* 4 */
-       a = FF ( a, b, c, d, x[ 4], S11, 0xf57c0faf); /* 5 */
-       d = FF ( d, a, b, c, x[ 5], S12, 0x4787c62a); /* 6 */
-       c = FF ( c, d, a, b, x[ 6], S13, 0xa8304613); /* 7 */
-       b = FF ( b, c, d, a, x[ 7], S14, 0xfd469501); /* 8 */
-       a = FF ( a, b, c, d, x[ 8], S11, 0x698098d8); /* 9 */
-       d = FF ( d, a, b, c, x[ 9], S12, 0x8b44f7af); /* 10 */
-       c = FF ( c, d, a, b, x[10], S13, 0xffff5bb1); /* 11 */
-       b = FF ( b, c, d, a, x[11], S14, 0x895cd7be); /* 12 */
-       a = FF ( a, b, c, d, x[12], S11, 0x6b901122); /* 13 */
-       d = FF ( d, a, b, c, x[13], S12, 0xfd987193); /* 14 */
-       c = FF ( c, d, a, b, x[14], S13, 0xa679438e); /* 15 */
-       b = FF ( b, c, d, a, x[15], S14, 0x49b40821); /* 16 */
-
-       /* Round 2 */
-       a = GG ( a, b, c, d, x[ 1], S21, 0xf61e2562); /* 17 */
-       d = GG ( d, a, b, c, x[ 6], S22, 0xc040b340); /* 18 */
-       c = GG ( c, d, a, b, x[11], S23, 0x265e5a51); /* 19 */
-       b = GG ( b, c, d, a, x[ 0], S24, 0xe9b6c7aa); /* 20 */
-       a = GG ( a, b, c, d, x[ 5], S21, 0xd62f105d); /* 21 */
-       d = GG ( d, a, b, c, x[10], S22,  0x2441453); /* 22 */
-       c = GG ( c, d, a, b, x[15], S23, 0xd8a1e681); /* 23 */
-       b = GG ( b, c, d, a, x[ 4], S24, 0xe7d3fbc8); /* 24 */
-       a = GG ( a, b, c, d, x[ 9], S21, 0x21e1cde6); /* 25 */
-       d = GG ( d, a, b, c, x[14], S22, 0xc33707d6); /* 26 */
-       c = GG ( c, d, a, b, x[ 3], S23, 0xf4d50d87); /* 27 */
-       b = GG ( b, c, d, a, x[ 8], S24, 0x455a14ed); /* 28 */
-       a = GG ( a, b, c, d, x[13], S21, 0xa9e3e905); /* 29 */
-       d = GG ( d, a, b, c, x[ 2], S22, 0xfcefa3f8); /* 30 */
-       c = GG ( c, d, a, b, x[ 7], S23, 0x676f02d9); /* 31 */
-       b = GG ( b, c, d, a, x[12], S24, 0x8d2a4c8a); /* 32 */
-
-       /* Round 3 */
-       a = HH ( a, b, c, d, x[ 5], S31, 0xfffa3942); /* 33 */
-       d = HH ( d, a, b, c, x[ 8], S32, 0x8771f681); /* 34 */
-       c = HH ( c, d, a, b, x[11], S33, 0x6d9d6122); /* 35 */
-       b = HH ( b, c, d, a, x[14], S34, 0xfde5380c); /* 36 */
-       a = HH ( a, b, c, d, x[ 1], S31, 0xa4beea44); /* 37 */
-       d = HH ( d, a, b, c, x[ 4], S32, 0x4bdecfa9); /* 38 */
-       c = HH ( c, d, a, b, x[ 7], S33, 0xf6bb4b60); /* 39 */
-       b = HH ( b, c, d, a, x[10], S34, 0xbebfbc70); /* 40 */
-       a = HH ( a, b, c, d, x[13], S31, 0x289b7ec6); /* 41 */
-       d = HH ( d, a, b, c, x[ 0], S32, 0xeaa127fa); /* 42 */
-       c = HH ( c, d, a, b, x[ 3], S33, 0xd4ef3085); /* 43 */
-       b = HH ( b, c, d, a, x[ 6], S34,  0x4881d05); /* 44 */
-       a = HH ( a, b, c, d, x[ 9], S31, 0xd9d4d039); /* 45 */
-       d = HH ( d, a, b, c, x[12], S32, 0xe6db99e5); /* 46 */
-       c = HH ( c, d, a, b, x[15], S33, 0x1fa27cf8); /* 47 */
-       b = HH ( b, c, d, a, x[ 2], S34, 0xc4ac5665); /* 48 */
-
-       /* Round 4 */
-       a = II ( a, b, c, d, x[ 0], S41, 0xf4292244); /* 49 */
-       d = II ( d, a, b, c, x[ 7], S42, 0x432aff97); /* 50 */
-       c = II ( c, d, a, b, x[14], S43, 0xab9423a7); /* 51 */
-       b = II ( b, c, d, a, x[ 5], S44, 0xfc93a039); /* 52 */
-       a = II ( a, b, c, d, x[12], S41, 0x655b59c3); /* 53 */
-       d = II ( d, a, b, c, x[ 3], S42, 0x8f0ccc92); /* 54 */
-       c = II ( c, d, a, b, x[10], S43, 0xffeff47d); /* 55 */
-       b = II ( b, c, d, a, x[ 1], S44, 0x85845dd1); /* 56 */
-       a = II ( a, b, c, d, x[ 8], S41, 0x6fa87e4f); /* 57 */
-       d = II ( d, a, b, c, x[15], S42, 0xfe2ce6e0); /* 58 */
-       c = II ( c, d, a, b, x[ 6], S43, 0xa3014314); /* 59 */
-       b = II ( b, c, d, a, x[13], S44, 0x4e0811a1); /* 60 */
-       a = II ( a, b, c, d, x[ 4], S41, 0xf7537e82); /* 61 */
-       d = II ( d, a, b, c, x[11], S42, 0xbd3af235); /* 62 */
-       c = II ( c, d, a, b, x[ 2], S43, 0x2ad7d2bb); /* 63 */
-       b = II ( b, c, d, a, x[ 9], S44, 0xeb86d391); /* 64 */
-
-       state[0] +=a;
-       state[1] +=b;
-       state[2] +=c;
-       state[3] +=d;
-
-    }
-
-    function init() {
-       count[0]=count[1] = 0;
-       state[0] = 0x67452301;
-       state[1] = 0xefcdab89;
-       state[2] = 0x98badcfe;
-       state[3] = 0x10325476;
-       for (i = 0; i < digestBits.length; i++)
-           digestBits[i] = 0;
-    }
-
-    function update(b) { 
-       var index,i;
-       
-       index = and(shr(count[0],3) , 0x3f);
-       if (count[0]<0xffffffff-7) 
-         count[0] += 8;
-        else {
-         count[1]++;
-         count[0]-=0xffffffff+1;
-          count[0]+=8;
-        }
-       buffer[index] = and(b,0xff);
-       if (index  >= 63) {
-           transform(buffer, 0);
-       }
-    }
-
-    function finish() {
-       var bits = new array(8);
-       var     padding; 
-       var     i=0, index=0, padLen=0;
-
-       for (i = 0; i < 4; i++) {
-           bits[i] = and(shr(count[0],(i * 8)), 0xff);
-       }
-        for (i = 0; i < 4; i++) {
-           bits[i+4]=and(shr(count[1],(i * 8)), 0xff);
-       }
-       index = and(shr(count[0], 3) ,0x3f);
-       padLen = (index < 56) ? (56 - index) : (120 - index);
-       padding = new array(64); 
-       padding[0] = 0x80;
-        for (i=0;i<padLen;i++)
-         update(padding[i]);
-        for (i=0;i<8;i++) 
-         update(bits[i]);
-
-       for (i = 0; i < 4; i++) {
-           for (j = 0; j < 4; j++) {
-               digestBits[i*4+j] = and(shr(state[i], (j * 8)) , 0xff);
-           }
-       } 
-    }
-
-/* End of the MD5 algorithm */
-
-function hexa(n) {
- var hexa_h = "0123456789abcdef";
- var hexa_c=""; 
- var hexa_m=n;
- for (hexa_i=0;hexa_i<8;hexa_i++) {
-   hexa_c=hexa_h.charAt(Math.abs(hexa_m)%16)+hexa_c;
-   hexa_m=Math.floor(hexa_m/16);
- }
- return hexa_c;
-}
-
-
-var ascii="01234567890123456789012345678901" +
-          " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ"+
-          "[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~";
-
-function MD5(entree) 
-{
- var l,s,k,ka,kb,kc,kd;
-
- init();
- for (k=0;k<entree.length;k++) {
-   l=entree.charAt(k);
-   update(ascii.lastIndexOf(l));
- }
- finish();
- ka=kb=kc=kd=0;
- for (i=0;i<4;i++) ka+=shl(digestBits[15-i], (i*8));
- for (i=4;i<8;i++) kb+=shl(digestBits[15-i], ((i-4)*8));
- for (i=8;i<12;i++) kc+=shl(digestBits[15-i], ((i-8)*8));
- for (i=12;i<16;i++) kd+=shl(digestBits[15-i], ((i-12)*8));
- s=hexa(kd)+hexa(kc)+hexa(kb)+hexa(ka);
- return s; 
-}
-// vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8:
index 2a4a19c..5542498 100644 (file)
@@ -259,12 +259,12 @@ function auto_links() {
 
 // {{{ function checkPassword
 
-function getType(char) {
-    if (char >= 'a' && char <= 'z') {
+function getType(c) {
+    if (c >= 'a' && c <= 'z') {
         return 1;
-    } else if (char >= 'A' && char <= 'Z') {
+    } else if (c >= 'A' && c <= 'Z') {
         return 2;
-    } else if (char >= '0' && char <= '9') {
+    } else if (c >= '0' && c <= '9') {
         return 3;
     } else {
         return 4;
index 29ad13f..42a7dd9 100644 (file)
@@ -35,7 +35,7 @@ if ($matches) {
         http_redirect("https://www.polytechnique.org/lists/$action/$mbox$sup");
     }
 
-    $res = XDB::query("select diminutif from groupex.asso where mail_domain = {?}", $fqdn);
+    $res = XDB::query("SELECT diminutif FROM #groupex#.asso WHERE mail_domain = {?}", $fqdn);
     if ($gpx = $res->fetchOneCell()) {
         http_redirect("http://www.polytechnique.net/$gpx/lists/$action/$mbox$sup");
     }
index 7ccabd7..e3998c2 100644 (file)
@@ -203,7 +203,7 @@ class ForumsBanana extends Banana
             $read = Post::s('read');
             if (!in_array($unread, $colors) || !in_array($read, $colors)) {
                 $page->trigError('Le choix de type pour l\'arborescence est invalide');
-            } elseif (XDB::execute("REPLACE INTO  forums.profils (uid, sig, mail, nom, flags, tree_unread, tree_read)
+            } elseif (XDB::execute("REPLACE INTO  #forums#.profils (uid, sig, mail, nom, flags, tree_unread, tree_read)
                                            VALUES  ({?}, {?}, {?}, {?}, {?}, {?}, {?})",
                                     S::v('uid'), Post::v('bananasig'),
                                     Post::v('bananamail'), Post::v('banananame'),
@@ -221,7 +221,7 @@ class ForumsBanana extends Banana
                     FIND_IN_SET('xface', flags),
                     tree_unread,
                     tree_read
-              FROM  forums.profils
+              FROM  #forums#.profils
              WHERE  uid = {?}", S::v('uid'));
         if (!(list($nom, $mail, $sig, $disp, $maj, $xface, $unread, $read) = $req->fetchOneRow())) {
             $nom   = S::v('prenom').' '.S::v('nom');
index ebd913c..703df77 100644 (file)
@@ -186,8 +186,8 @@ function hook_getXFace($headers)
     }
     if (isset($headers['x-face'])) {
         $res = XDB::query("SELECT  p.uid
-                             FROM  forums.profils AS p
-                       INNER JOIN  aliases AS a ON (p.uid = a.id)
+                             FROM  #forums#.profils AS p
+                       INNER JOIN  #x4dat#.aliases  AS a ON (p.uid = a.id)
                             WHERE  FIND_IN_SET('xface', p.flags) AND a.alias = {?}",
                           $login);
         if ($res->numRows()) {
index b03b419..e8cc260 100644 (file)
@@ -308,7 +308,7 @@ class NLArticle
     // }}}
     // {{{ function getLinkIps()
 
-    public function getLinkIps(&$gethostbyname_count)
+    public function getLinkIps(&$blacklist_host_resolution_count)
     {
         $matches = $this->parseUrlsFromArticle();
         $article_ips = array();
@@ -322,14 +322,13 @@ class NLArticle
                     list(, $host) = explode('@', $match);
                 }
 
-                if ($gethostbyname_count < $globals->mail->blacklist_host_resolution_limit) {
+                if ($blacklist_host_resolution_count >= $globals->mail->blacklist_host_resolution_limit) {
                    break;
                 }
 
-                if ($host != $globals->mail->alias_dom && $host != $globals->mail->alias_dom2
-                    && $host != $globals->mail->domain && $host != $globals->mail->domain2) {
+                if (!preg_match('/^(' . str_replace(' ', '|', $globals->mail->domain_whitelist) . ')$/i', $host)) {
                     $article_ips = array_merge($article_ips, array(gethostbyname($host) => $host));
-                    ++$gethostbyname_count;
+                    ++$blacklist_host_resolution_count;
                 }
             }
         }
index cf3023d..efa2abc 100644 (file)
@@ -147,22 +147,23 @@ function select_notifs($mail, $uid=null, $last=null, $iterator=true)
 
 global $prf_desc;
 $prf_desc = array('search_names' => 'L\'un de ses noms',
-                  'freetext' => 'Le texte libre',
-                  'mobile' => 'Son numéro de téléphone portable',
-                  'nationalite' => 'Sa nationalité',
+                  'freetext'     => 'Le texte libre',
+                  'mobile'       => 'Son numéro de téléphone portable',
+                  'nationalite'  => 'Sa nationalité',
                   'nationalite2' => 'Sa seconde nationalité',
                   'nationalite3' => 'Sa troisième nationalité',
-                  'nick' => 'Son surnom',
-                  'networking' => 'La liste de ses adresses de networking',
-                  'edus' => 'Ses formations',
-                  'addresses' => 'Ses adresses',
-                  'section' => 'Sa section sportive',
-                  'binets' => 'La liste de ses binets',
-                  'medals' => 'Ses décorations',
-                  'cv' => 'Son Curriculum Vitae',
-                  'corps' => 'Son Corps d\'État',
-                  'jobs' => 'Ses informations professionnelles',
-                  'photo' => 'Sa photographie');
+                  'nick'         => 'Son surnom',
+                  'networking'   => 'La liste de ses adresses de networking',
+                  'edus'         => 'Ses formations',
+                  'addresses'    => 'Ses adresses',
+                  'section'      => 'Sa section sportive',
+                  'binets'       => 'La liste de ses binets',
+                  'medals'       => 'Ses décorations',
+                  'cv'           => 'Son Curriculum Vitae',
+                  'corps'        => 'Son Corps d\'État',
+                  'jobs'         => 'Ses informations professionnelles',
+                  'photo'        => 'Sa photographie',
+                  'broken'      => "Il n'a plus d'adresse de redirection valide");
 
 function get_profile_change_details($event, $limit) {
     global $prf_desc;
index cede617..a2fedc2 100644 (file)
@@ -105,7 +105,7 @@ abstract class Reminder
     // has been taken into account.
     public function NotifiesAction(&$page)
     {
-        header('Content-Type: text/html; charset=utf-8');
+        pl_content_headers("text/html");
         $page->changeTpl('reminder/notification.tpl', NO_SKIN);
         $page->assign('previous_reminder', $this->title());
     }
@@ -114,7 +114,7 @@ abstract class Reminder
     // when the reminder is the only output of a page.
     public function DisplayStandalone(&$page, $previous_reminder = null)
     {
-        header('Content-Type: text/html; charset=utf-8');
+        pl_content_headers("text/html");
         $page->changeTpl('reminder/base.tpl', NO_SKIN);
         $this->Prepare($page);
         if ($previous_reminder) {
index b67b59b..ec1b0c5 100644 (file)
@@ -26,11 +26,11 @@ class ReminderPromotionMl extends Reminder
         switch ($action) {
           case 'yes':
             $res = XDB::query('SELECT  id
-                                 FROM  groupex.asso
+                                 FROM  #groupex#.asso
                                 WHERE  diminutif = {?}',
                             S::v('promo'));
             $asso_id = $res->fetchOneCell();
-            XDB::execute('REPLACE INTO  groupex.membres (uid, asso_id)
+            XDB::execute('REPLACE INTO  #groupex#.membres (uid, asso_id)
                                 VALUES  ({?}, {?})',
                          S::v('uid'), $asso_id);
             $mmlist = new MMList(S::v('uid'), S::v('password'));
@@ -67,9 +67,9 @@ class ReminderPromotionMl extends Reminder
         // We only test if the user is in her promotion group for it is too
         // expensive to check if she is in the corresponding ML as well.
         $res = XDB::query('SELECT  COUNT(*)
-                             FROM  groupex.membres
+                             FROM  #groupex#.membres
                             WHERE  uid = {?} AND asso_id = (SELECT  id
-                                                              FROM  groupex.asso
+                                                              FROM  #groupex#.asso
                                                              WHERE  diminutif = {?})',
                           $user->id(), S::v('promo'));
 
index eb78f63..f292fe8 100644 (file)
@@ -34,7 +34,7 @@ function init_rss($template, $alias, $hash, $require_uid = true)
 
     if ($template) {
         $page->assign('rss_hash', $hash);
-        header('Content-Type: application/rss+xml; charset=utf8');
+        pl_content_headers("application/rss+xml");
     }
     return is_null($user) ? null : $user->id();
 }
index 2e30213..2bc3ad6 100644 (file)
@@ -41,8 +41,8 @@ function user_clear_all_subs($user_id, $really_del=true)
                              'user_id' => array('requests', 'user_changes'));
 
     if ($really_del) {
-        array_push($tables_to_clear['uid'], 'emails', 'groupex.membres', 'contacts', 'adresses', 'profile_phones',
-                                            'photo', 'perte_pass', 'langues_ins', 'forums.abos', 'forums.profils');
+        array_push($tables_to_clear['uid'], 'emails', '#groupex#.membres', 'contacts', 'adresses', 'profile_phones',
+                                            'photo', 'perte_pass', 'langues_ins', '#forums#.abos', 'forums.profils');
         array_push($tables_to_clear['user_id'], 'newsletter_ins', 'auth_user_quick', 'binets_ins');
         $tables_to_clear['id'] = array('aliases');
         $tables_to_clear['contact'] = array('contacts');
@@ -336,8 +336,8 @@ function &get_user_details($login, $from_uid = '', $view = 'private')
         $user['binets_join'] = join(', ', $user['binets']);
 
         $res  = XDB::iterRow("SELECT  a.diminutif, a.nom, a.site
-                                FROM  groupex.asso    AS a
-                           LEFT JOIN  groupex.membres AS m ON (m.asso_id = a.id)
+                                FROM  #groupex#.asso    AS a
+                           LEFT JOIN  #groupex#.membres AS m ON (m.asso_id = a.id)
                                WHERE  m.uid = {?} AND (a.cat = 'GroupesX' OR a.cat = 'Institutions')
                                       AND pub = 'public'", $uid);
         $user['gpxs'] = Array();
index b824fc7..354c21e 100644 (file)
@@ -47,7 +47,7 @@ class UserSet extends PlSet
         global $globals;
         parent::__construct('auth_user_md5 AS u',
                             (!empty($GLOBALS['IS_XNET_SITE']) ?
-                                'INNER JOIN groupex.membres AS gxm ON (u.user_id = gxm.uid
+                                'INNER JOIN #groupex#.membres AS gxm ON (u.user_id = gxm.uid
                                                                        AND gxm.asso_id = ' . $globals->asso('id') . ') ' : '')
                            . 'LEFT JOIN auth_user_quick AS q USING (user_id)' . $joins,
                             $where,
index 9dd97c0..07003d8 100644 (file)
@@ -125,14 +125,14 @@ class ListeReq extends Validate
 
         if ($this->asso == "alias") {
             $new = $this->liste . '@' . $this->domain;
-            XDB::query('INSERT INTO x4dat.virtual (alias, type) VALUES({?}, "user")', $new);
+            XDB::query('INSERT INTO virtual (alias, type) VALUES({?}, "user")', $new);
             foreach ($this->members as $member) {
                 $user = User::get($member);
                 if ($user != null) {
                     XDB::query(
-                        "INSERT INTO  x4dat.virtual_redirect (vid, redirect)
+                        "INSERT INTO  virtual_redirect (vid, redirect)
                               SELECT  vid, {?}
-                                FROM  x4dat.virtual
+                                FROM  virtual
                                WHERE  alias = {?}", $user->forlifeEmail(), $new);
                 }
             }
@@ -155,9 +155,9 @@ class ListeReq extends Validate
                     $app  = '-' . $app;
                 }
                 $red = $this->domain . '_' . $liste;
-                XDB::execute('INSERT INTO x4dat.virtual (alias, type)
+                XDB::execute('INSERT INTO virtual (alias, type)
                                         VALUES({?}, {?})', $liste . $app . '@' . $this->domain, 'list');
-                XDB::execute('INSERT INTO x4dat.virtual_redirect (vid, redirect)
+                XDB::execute('INSERT INTO virtual_redirect (vid, redirect)
                                         VALUES ({?}, {?})', XDB::insertId(),
                                        $red . $mdir . '@listes.polytechnique.org');
                 $list->mass_subscribe($liste, join(' ', $this->members));
index 01d3f25..0942529 100644 (file)
@@ -60,11 +60,11 @@ Si le télépaiement n'est pas lié à un groupe ou supérieur à 51 euros, lais
         $this->montant_max  = $_montantmax;
 
         if ($_asso_id) {
-            $res = XDB::query("SELECT nom FROM groupex.asso WHERE id = {?}", $_asso_id);
+            $res = XDB::query("SELECT nom FROM #groupex#.asso WHERE id = {?}", $_asso_id);
             $this->asso = $res->fetchOneCell();
         }
         if ($_asso_id && $_evt) {
-            $res = XDB::query("SELECT intitule FROM groupex.evenements WHERE asso_id = {?} AND eid = {?}", $_asso_id, $_evt);
+            $res = XDB::query("SELECT intitule FROM #groupex#.evenements WHERE asso_id = {?} AND eid = {?}", $_asso_id, $_evt);
             $this->evt_intitule = $res->fetchOneCell();
         }
     }
@@ -165,9 +165,9 @@ Si le télépaiement n'est pas lié à un groupe ou supérieur à 51 euros, lais
 
     public function commit()
     {
-        $res = XDB::query("SELECT MAX(id) FROM paiement.paiements");
+        $res = XDB::query("SELECT MAX(id) FROM #paiement#.paiements");
         $id = $res->fetchOneCell()+1;
-        $ret = XDB::execute("INSERT INTO paiement.paiements VALUES
+        $ret = XDB::execute("INSERT INTO #paiement#.paiements VALUES
             ( {?}, {?}, {?}, '',
             {?}, {?}, {?},
             {?}, {?}, {?} )
@@ -176,13 +176,13 @@ Si le télépaiement n'est pas lié à un groupe ou supérieur à 51 euros, lais
             $this->montant, $this->montant_min, $this->montant_max,
             $this->user->bestEmail(), $this->msg_reponse, $this->asso_id);
         if ($this->asso_id && $this->evt) {
-            XDB::execute("UPDATE  groupex.evenements
+            XDB::execute("UPDATE  #groupex#.evenements
                              SET  paiement_id = {?}
                            WHERE  asso_id = {?} AND eid = {?}",
                          $id, $this->asso_id, $this->evt);
             $res = XDB::query("SELECT  a.nom, a.diminutif, e.intitule
-                                 FROM  groupex.asso AS a
-                           INNER JOIN  groupex.evenements AS e ON (a.id = e.asso_id)
+                                 FROM  #groupex#.asso AS a
+                           INNER JOIN  #groupex#.evenements AS e ON (a.id = e.asso_id)
                                 WHERE  e.eid = {?}",
                               $this->evt);
             list($nom, $diminutif, $evt) = $res->fetchOneRow();
index 4ab3e13..af06bef 100644 (file)
@@ -130,7 +130,7 @@ class AdminModule extends PLModule
                                       MONTH(MAX(start)), MONTH(MIN(start)),
                                       DAYOFMONTH(MAX(start)),
                                       DAYOFMONTH(MIN(start))
-                                 FROM logger.sessions");
+                                 FROM #logger#.sessions");
             list($ymax, $ymin, $mmax, $mmin, $dmax, $dmin) = $res->fetchOneRow();
 
             if (($year < $ymin) || ($year == $ymin && $month < $mmin)) {
@@ -168,7 +168,7 @@ class AdminModule extends PLModule
         if ($year) {
             $res = XDB::query("SELECT YEAR (MAX(start)), YEAR (MIN(start)),
                                       MONTH(MAX(start)), MONTH(MIN(start))
-                                 FROM logger.sessions");
+                                 FROM #logger#.sessions");
             list($ymax, $ymin, $mmax, $mmin) = $res->fetchOneRow();
 
             if (($year < $ymin) || ($year > $ymax)) {
@@ -198,7 +198,7 @@ class AdminModule extends PLModule
         $years[0] = "----";
 
         // retrieve available years
-        $res = XDB::query("select YEAR(MAX(start)), YEAR(MIN(start)) FROM logger.sessions");
+        $res = XDB::query("select YEAR(MAX(start)), YEAR(MIN(start)) FROM #logger#.sessions");
         list($max, $min) = $res->fetchOneRow();
 
         for($i = intval($min); $i<=$max; $i++) {
@@ -258,16 +258,16 @@ class AdminModule extends PLModule
 
             // we are viewing a session
             $res = XDB::query("SELECT  ls.*, a.alias AS username, sa.alias AS suer
-                                 FROM  logger.sessions AS ls
-                            LEFT JOIN  aliases         AS a  ON (a.id = ls.uid AND a.type='a_vie')
-                            LEFT JOIN  aliases         AS sa ON (sa.id = ls.suid AND sa.type='a_vie')
+                                 FROM  #logger#.sessions AS ls
+                            LEFT JOIN  #x4dat#.aliases   AS a  ON (a.id = ls.uid AND a.type='a_vie')
+                            LEFT JOIN  #x4dat#.aliases   AS sa ON (sa.id = ls.suid AND sa.type='a_vie')
                                 WHERE  ls.id = {?}", $arg);
 
             $page->assign('session', $a = $res->fetchOneAssoc());
 
             $res = XDB::iterator('SELECT  a.text, e.data, e.stamp
-                                    FROM  logger.events  AS e
-                               LEFT JOIN  logger.actions AS a ON e.action=a.id
+                                    FROM  #logger#.events  AS e
+                               LEFT JOIN  #logger#.actions AS a ON e.action=a.id
                                    WHERE  e.session={?}', $arg);
             while ($myarr = $res->next()) {
                $page->append('events', $myarr);
@@ -317,8 +317,8 @@ class AdminModule extends PLModule
                 $where  = $this->_makeWhere($year, $month, $day, $loguid);
                 $select = "SELECT  s.id, s.start, s.uid,
                                    a.alias as username
-                             FROM  logger.sessions AS s
-                        LEFT JOIN  aliases         AS a  ON (a.id = s.uid AND a.type='a_vie')
+                             FROM  #logger#.sessions AS s
+                        LEFT JOIN  #x4dat#.aliases   AS a  ON (a.id = s.uid AND a.type='a_vie')
                     $where
                     ORDER BY start DESC";
                 $res = XDB::iterator($select);
@@ -332,9 +332,9 @@ class AdminModule extends PLModule
 
                 // attach events
                 $sql = "SELECT  s.id, a.text
-                          FROM  logger.sessions AS s
-                    LEFT  JOIN  logger.events   AS e ON(e.session=s.id)
-                    INNER JOIN  logger.actions  AS a ON(a.id=e.action)
+                          FROM  #logger#.sessions AS s
+                    LEFT  JOIN  #logger#.events   AS e ON(e.session=s.id)
+                    INNER JOIN  #logger#.actions  AS a ON(a.id=e.action)
                         $where";
 
                 $res = XDB::iterator($sql);
@@ -641,9 +641,9 @@ class AdminModule extends PLModule
 
                 // Forum ban update.
                 case "b_edit":
-                    XDB::execute("DELETE FROM forums.innd WHERE uid = {?}", $user->id());
+                    XDB::execute("DELETE FROM #forums#.innd WHERE uid = {?}", $user->id());
                     if (Env::v('write_perm') != "" || Env::v('read_perm') != ""  || Env::v('commentaire') != "" ) {
-                        XDB::execute("INSERT INTO  forums.innd
+                        XDB::execute("INSERT INTO  #forums#.innd
                                               SET  ipmin = '0', ipmax = '4294967295',
                                                    write_perm = {?}, read_perm = {?},
                                                    comment = {?}, priority = '200', uid = {?}",
@@ -655,7 +655,7 @@ class AdminModule extends PLModule
 
         // Displays last login and last host information.
         $res = XDB::query("SELECT  start, host
-                             FROM  logger.sessions
+                             FROM  #logger#.sessions
                             WHERE  uid = {?} AND suid = 0
                          ORDER BY  start DESC
                             LIMIT  1", $user->id());
@@ -690,7 +690,7 @@ class AdminModule extends PLModule
 
         // Displays forum bans.
         $res = XDB::query("SELECT  write_perm, read_perm, comment
-                             FROM  forums.innd
+                             FROM  #forums#.innd
                             WHERE  uid = {?}", $user->id());
         $bans = $res->fetchOneAssoc();
         $page->assign('bans', $bans);
@@ -895,8 +895,8 @@ class AdminModule extends PLModule
 
         $res = XDB::iterator(
                 "SELECT  u.promo, u.nom, u.prenom, u.deces, u.hruid, DATE(MAX(s.start)) AS last
-                   FROM  auth_user_md5 AS u
-              LEFT JOIN  logger.sessions AS s ON (s.uid = u.user_id AND suid = 0)
+                   FROM  #x4dat#.auth_user_md5 AS u
+              LEFT JOIN  #logger#.sessions     AS s ON (s.uid = u.user_id AND suid = 0)
                   WHERE  perms IN ('admin', 'user') AND deces <> 0
                GROUP BY  u.user_id
                ORDER BY  u.promo, u.nom");
@@ -1043,7 +1043,7 @@ class AdminModule extends PLModule
     function handler_logger_actions(&$page, $action = 'list', $id = null) {
         $page->setTitle('Administration - Actions');
         $page->assign('title', 'Gestion des actions de logger');
-        $table_editor = new PLTableEditor('admin/logger/actions','logger.actions','id');
+        $table_editor = new PLTableEditor('admin/logger/actions','#logger#.actions','id');
         $table_editor->describe('text','intitulé',true);
         $table_editor->describe('description','description',true);
         $table_editor->apply($page, $action, $id);
@@ -1124,7 +1124,6 @@ class AdminModule extends PLModule
         }
 
         $page->changeTpl('admin/wiki.tpl');
-        $page->addJsLink('jquery.js');
         $page->assign('wiki_pages', $wiki_tree);
         $page->assign('perms_opts', $perms);
     }
@@ -1174,10 +1173,10 @@ class AdminModule extends PLModule
                                      IF(w.ip = s2.ip, s2.host, s2.forward_host),
                                      IF(w.ip = s.ip, s.host, s.forward_host)),
                             w.mask, w.detection, w.state, u.hruid
-                      FROM  ip_watch        AS w
-                 LEFT JOIN  logger.sessions AS s  ON (s.ip = w.ip)
-                 LEFT JOIN  logger.sessions AS s2 ON (s2.forward_ip = w.ip)
-                 LEFT JOIN  auth_user_md5   AS u  ON (u.user_id = s.uid)
+                      FROM  #x4dat#.ip_watch      AS w
+                 LEFT JOIN  #logger#.sessions     AS s  ON (s.ip = w.ip)
+                 LEFT JOIN  #logger#.sessions     AS s2 ON (s2.forward_ip = w.ip)
+                 LEFT JOIN  #x4dat#.auth_user_md5 AS u  ON (u.user_id = s.uid)
                   GROUP BY  w.ip, u.hruid
                   ORDER BY  w.state, w.ip, u.hruid";
             $it = Xdb::iterRow($sql);
@@ -1208,10 +1207,10 @@ class AdminModule extends PLModule
         } elseif ($action == 'edit') {
             $sql = "SELECT  w.detection, w.state, w.last, w.description, w.mask,
                             u1.hruid AS edit, u2.hruid AS hruid, s.host
-                      FROM  ip_watch        AS w
-                 LEFT JOIN  auth_user_md5   AS u1 ON (u1.user_id = w.uid)
-                 LEFT JOIN  logger.sessions AS s  ON (w.ip = s.ip)
-                 LEFT JOIN  auth_user_md5   AS u2 ON (u2.user_id = s.uid)
+                      FROM  #x4dat#.ip_watch      AS w
+                 LEFT JOIN  #x4dat#.auth_user_md5 AS u1 ON (u1.user_id = w.uid)
+                 LEFT JOIN  #logger#.sessions     AS s  ON (w.ip = s.ip)
+                 LEFT JOIN  #x4dat#.auth_user_md5 AS u2 ON (u2.user_id = s.uid)
                      WHERE  w.ip = {?}
                   GROUP BY  u2.hruid
                   ORDER BY  u2.hruid";
index 424361c..99bce24 100644 (file)
@@ -88,7 +88,7 @@ class AuthModule extends PLModule
 
             $res .= "</membres>\n\n";
 
-            header('Content-Type: text/xml; charset="UTF-8"');
+            pl_content_headers("text/xml");
             echo $res;
         }
         exit;
@@ -109,7 +109,7 @@ class AuthModule extends PLModule
 
             $request  = @$GLOBALS['HTTP_RAW_POST_DATA'];
             $response = xmlrpc_server_call_method($server, $request, null);
-            header('Content-Type: text/xml');
+            pl_content_headers("text/xml");
             print $response;
             xmlrpc_server_destroy($server);
         }
index c2b5737..ac5e41a 100644 (file)
@@ -59,8 +59,8 @@ function gpex_make($chlg, $privkey, $datafields, $charset)
         } else if ($val == 'grpauth') {
             if (isset($_GET['group'])) {
                 $res = XDB::query("SELECT  perms
-                                     FROM  groupex.membres
-                               INNER JOIN  groupex.asso ON(id = asso_id)
+                                     FROM  #groupex#.membres
+                               INNER JOIN  #groupex#.asso ON(id = asso_id)
                                     WHERE  uid = {?} AND diminutif = {?}",
                                   S::v('uid'), $_GET['group']);
                 $perms = $res->fetchOneCell();
index 4a226ac..012281e 100644 (file)
@@ -32,13 +32,14 @@ class BandeauModule extends PLModule
 
     function handler_icone(&$page)
     {
-        header("Content-Type: image/png");
+        pl_cached_content_headers("image/png");
         readfile('../htdocs/images/x.png');
         exit();
     }
 
     function handler_html(&$page, $login = '')
     {
+        pl_cached_content_headers("text/html");
         $page->changeTpl('skin/common.bandeau.tpl', NO_SKIN);
         $page->assign('login', $login == 'login');
         $page->assign('seed', $login);
@@ -46,7 +47,7 @@ class BandeauModule extends PLModule
 
     function handler_css(&$page)
     {
-        header("Content-Type: text/css");
+        pl_cached_content_headers("text/css");
         readfile('../htdocs/css/bandeau.css');
         exit();
     }
index 54a118d..e6ca6a6 100644 (file)
@@ -307,7 +307,7 @@ class CarnetModule extends PLModule
         }
         $page->assign('events', $annivs);
 
-        header('Content-Type: text/calendar; charset=utf-8');
+        pl_content_headers("text/calendar");
     }
 
     function handler_vcard(&$page, $photos = null)
index 80dda05..8c363a8 100644 (file)
@@ -429,14 +429,26 @@ class EmailModule extends PLModule
                 $to2  = getEmails(Env::v('to_contacts'));
                 $cc2  = getEmails(Env::v('cc_contacts'));
                 $txt  = str_replace('^M', '', Env::v('contenu'));
-                $to   = Env::v('to');
-                $subj = Env::v('sujet');
-                $from = Env::v('from');
-                $cc   = trim(Env::v('cc'));
-                $bcc  = trim(Env::v('bcc'));
-
+                $to   = str_replace(';', ',', Env::t('to'));
+                $subj = Env::t('sujet');
+                $from = Env::t('from');
+                $cc   = str_replace(';', ',', Env::t('cc'));
+                $bcc  = str_replace(';', ',', Env::t('bcc'));
+
+                $email_regex = '/^[a-z0-9.\-+_\$]+@([\-.+_]?[a-z0-9])+$/i';
+                foreach (explode(',', $to . ',' . $cc . ',' . $bcc) as $email) {
+                    $email = trim($email);
+                    if ($email != '' && !preg_match($email_regex, $email)) {
+                        $page->trigError("L'adresse email " . $email  . ' est erronée.');
+                        $error = true;
+                    }
+                }
                 if (empty($to) && empty($cc) && empty($to2) && empty($bcc) && empty($cc2)) {
                     $page->trigError("Indique au moins un destinataire.");
+                    $error = true;
+                }
+
+                if ($error) {
                     $page->assign('uploaded_f', PlUpload::listFilenames(S::user()->login(), 'emails.send'));
                 } else {
                     $mymail = new PlMailer();
@@ -835,8 +847,8 @@ L'équipe d'administration <support@" . $globals->mail->domain . '>';
                 foreach ($broken_list as $orig_email) {
                     $email = valide_email(trim($orig_email));
                     if (empty($email) || $email == '@') {
-                        $invalid_emails[] = "$orig_email: invalid email";
-                    } else {
+                        $invalid_emails[] = trim($orig_email) . ': invalid email';
+                    } elseif (!in_array($email, $valid_emails)) {
                         $res = XDB::query('SELECT  COUNT(*)
                                              FROM  emails
                                             WHERE  email = {?}', $email);
@@ -924,11 +936,11 @@ L'équipe d'administration <support@" . $globals->mail->domain . '>';
 
                 // Output the list of users with recently broken addresses,
                 // along with the count of valid redirections.
-                header('Content-Type: text/x-csv; charset=utf-8;');
-                header('Cache-Control: no-cache');
+                require_once 'include/notifs.inc.php';
+                pl_content_headers("text/x-csv");
 
                 $csv = fopen('php://output', 'w');
-                fputcsv($csv, array('nom', 'prenom', 'alias', 'bounce', 'nbmails', 'url'), ';');
+                fputcsv($csv, array('nom', 'prenom', 'promo', 'alias', 'bounce', 'nbmails', 'url'), ';');
                 foreach ($broken_user_list as $alias => $mails) {
                     $sel = Xdb::query(
                         "SELECT  u.user_id, count(e.email) AS nb_mails, u.nom, u.prenom, u.promo
@@ -940,9 +952,12 @@ L'équipe d'administration <support@" . $globals->mail->domain . '>';
                        GROUP BY  u.user_id", $alias);
 
                     if ($x = $sel->fetchOneAssoc()) {
+                        if ($x['nb_mails'] == 0) {
+                            register_profile_update($x['user_id'], 'broken');
+                        }
                         fputcsv($csv, array($x['nom'], $x['prenom'], $x['promo'], $alias,
-                                            join(',', $mails), $x['nb_mails']),
-                                            'https://www.polytechnique.org/marketing/broken/' . $alias, ';');
+                                            join(',', $mails), $x['nb_mails'],
+                                            'https://www.polytechnique.org/marketing/broken/' . $alias), ';');
                     }
                 }
                 fclose($csv);
index e49dc70..c40e75e 100644 (file)
@@ -193,7 +193,7 @@ class EventsModule extends PLModule
             $res = XDB::query("SELECT * FROM evenements_photo WHERE eid = {?}", $eid);
             if ($res->numRows()) {
                 $photo = $res->fetchOneAssoc();
-                header('Content-Type: image/' . $photo['attachmime']);
+                pl_cached_dynamic_content_headers("image/" . $photo['attachmime']);
                 echo $photo['attach'];
                 exit;
             }
@@ -201,20 +201,20 @@ class EventsModule extends PLModule
             require_once 'validations.inc.php';
             $valid = Validate::get_request_by_id($valid);
             if ($valid && $valid->img) {
-                header('Content-Type: image/' . $valid->imgtype);
+                pl_cached_dynamic_content_headers("image/" . $valid->imgtype);
                 echo $valid->img;
                 exit;
             }
         } else {
             $upload = new PlUpload(S::user()->login(), 'event');
             if ($upload->exists() && $upload->isType('image')) {
-                header('Content-Type: ' . $upload->contentType());
+                pl_cached_dynamic_content_headers($upload->contentType());
                 echo $upload->getContents();
                 exit;
             }
         }
         global $globals;
-        header('Content-Type: image/png');
+        pl_cached_dynamic_content_headers("image/png");
         echo file_get_contents($globals->spoolroot . '/htdocs/images/logo.png');
         exit;
     }
@@ -239,7 +239,7 @@ class EventsModule extends PLModule
         }
         $page->assign('texte', $texte);
         $page->assign('titre', $titre);
-        header('Content-Type: text/html; charset=utf-8');
+        pl_content_headers("text/html");
     }
 
     function handler_ev_submit(&$page)
@@ -297,7 +297,7 @@ class EventsModule extends PLModule
 
     function handler_tips(&$page, $tips = null)
     {
-        header('Content-Type: text/html; charset="UTF-8"');
+        pl_content_headers("text/html");
         $page->changeTpl('include/tips.tpl', NO_SKIN);
         $page->assign('tips', $this->get_tips($tips));
     }
index bccc607..3890004 100644 (file)
@@ -73,7 +73,7 @@ class ForumsModule extends PLModule
     {
         $page->setTitle('Administration - Bannissements des forums');
         $page->assign('title', 'Gestion des mises au ban');
-        $table_editor = new PLTableEditor('admin/forums','forums.innd','id_innd');
+        $table_editor = new PLTableEditor('admin/forums','#forums#.innd','id_innd');
         $table_editor->add_sort_field('priority', true, true);
         $table_editor->describe('read_perm','lecture',true);
         $table_editor->describe('write_perm','écriture',true);
@@ -81,7 +81,6 @@ class ForumsModule extends PLModule
         $table_editor->describe('comment','commentaire',true);
         $table_editor->apply($page, $action, $id);
         $page->changeTpl('forums/admin.tpl');
-        $page->addJsLink('jquery.js');
     }
 
     static function run_banana(&$page, $params = null)
index f668fb4..81a8bd4 100644 (file)
@@ -23,8 +23,7 @@
 function init_igoogle_xml($template)
 {
     Platal::page()->changeTpl($template, NO_SKIN);
-
-    header('Content-Type: application/xml; charset=utf-8');
+    pl_cached_content_headers("application/xml", "utf-8");
 }
 
 function init_igoogle_html($template, $auth = AUTH_PUBLIC)
index d00bae9..02e119e 100644 (file)
@@ -131,7 +131,7 @@ class ListsModule extends PLModule
 
     function handler_ajax(&$page, $list = null)
     {
-        header('Content-Type: text/html; charset="UTF-8"');
+        pl_content_headers("text/html");
         $domain = $this->prepare_client($page);
         $page->changeTpl('lists/liste.inc.tpl', NO_SKIN);
         S::assert_xsrf_token();
@@ -249,13 +249,13 @@ class ListsModule extends PLModule
             }
 
             $new = $liste . '@' . $domain;
-            $res = XDB::query('SELECT COUNT(*) FROM x4dat.virtual WHERE alias={?}', $new);
+            $res = XDB::query('SELECT COUNT(*) FROM virtual WHERE alias={?}', $new);
 
         } else {
             if ($asso == "groupex") {
                 $groupex_name = Post::v('groupex_name');
 
-                $res_groupe = XDB::query('SELECT mail_domain FROM groupex.asso WHERE nom={?}', $groupex_name);
+                $res_groupe = XDB::query('SELECT mail_domain FROM #groupex#.asso WHERE nom={?}', $groupex_name);
                 $domain = $res_groupe->fetchOneCell();
 
                 if (!$domain) {
@@ -263,7 +263,7 @@ class ListsModule extends PLModule
                 }
 
                 $new = $liste . '@' . $domain;
-                $res = XDB::query('SELECT COUNT(*) FROM x4dat.virtual WHERE alias={?}', $new);
+                $res = XDB::query('SELECT COUNT(*) FROM virtual WHERE alias={?}', $new);
             } else {
                 $res = XDB::query("SELECT COUNT(*) FROM aliases WHERE alias={?}", $liste);
                 $domain = $globals->mail->domain;
@@ -289,6 +289,7 @@ class ListsModule extends PLModule
         }
 
         if (!$page->nb_errs()) {
+            $page->trigSuccess('Demande de création envoyée&nbsp;!');
             $page->assign('created', true);
             require_once 'validations.inc.php';
             $req = new ListeReq(S::user(), $asso, $liste, $domain,
@@ -346,9 +347,7 @@ class ListsModule extends PLModule
         $this->prepare_client($page);
         $members = $this->client->get_members($liste);
         $list = list_fetch_names(list_extract_members($members[1]));
-        header('Content-Type: text/x-csv; charset=utf-8;');
-        header('Pragma: ');
-        header('Cache-Control: ');
+        pl_content_headers("text/x-csv");
 
         echo "email,nom,prenom,promo\n";
         foreach ($list as $member) {
@@ -660,7 +659,7 @@ class ListsModule extends PLModule
             S::assert_xsrf_token();
 
             $members = User::getBulkForlifeEmails(Env::v('add_member'),
-                                                  false,
+                                                  true,
                                                   array('ListsModule', 'no_login_callback'));
             $arr = $this->client->mass_subscribe($liste, $members);
             if (is_array($arr)) {
@@ -678,7 +677,7 @@ class ListsModule extends PLModule
                 $page->trigError('Une erreur s\'est produite lors du téléchargement du fichier');
             } else {
                 $members = User::getBulkForlifeEmails($upload->getContents(),
-                                                      false,
+                                                      true,
                                                       array('ListsModule', 'no_login_callback'));
                 $arr = $this->client->mass_subscribe($liste, $members);
                 if (is_array($arr)) {
index 8c9e81c..a6dc53a 100644 (file)
@@ -94,9 +94,9 @@ function list_fetch_name($member)
                                   IF(m2.origine="X", u.nom, m1.nom) AS nom,
                                   IF(m2.origine="X", u.promo, "non-X") AS promo,
                                   0 AS lost
-                             FROM groupex.membres AS m1
-                        LEFT JOIN groupex.membres AS m2 ON(m1.email=m2.email AND m2.asso_id={?})
-                        LEFT JOIN auth_user_md5   AS u  ON(m2.origine = "X" AND m2.uid = u.user_id)
+                             FROM #groupex#.membres     AS m1
+                        LEFT JOIN #groupex#.membres     AS m2 ON(m1.email=m2.email AND m2.asso_id={?})
+                        LEFT JOIN #x4dat#.auth_user_md5 AS u  ON(m2.origine = "X" AND m2.uid = u.user_id)
                             WHERE m1.email={?}', $globals->asso('id'), $member);
     }
     if ($res->numRows() == 0) {
index f7afc21..908f1bf 100644 (file)
@@ -164,12 +164,13 @@ class NewsletterModule extends PLModule
         }
 
         if ($aid == 'blacklist_check') {
+            global $globals;
             $ips_to_check = array();
-            $gethostbyname_count = 0;
+            $blacklist_host_resolution_count = 0;
 
             foreach ($nl->_arts as $key => $articles) {
                 foreach ($articles as $article) {
-                    $article_ips = $article->getLinkIps($gethostbyname_count);
+                    $article_ips = $article->getLinkIps($blacklist_host_resolution_count);
                     if (!empty($article_ips)) {
                         $ips_to_check[$article->title()] = $article_ips;
                     }
@@ -177,8 +178,8 @@ class NewsletterModule extends PLModule
             }
 
             $page->assign('ips_to_check', $ips_to_check);
-            if ($gethostbyname_count >= $globals->mail->blacklist_host_resolution_limit) {
-                $page-trigError("Toutes les url et adresses emails de la lettre"
+            if ($blacklist_host_resolution_count >= $globals->mail->blacklist_host_resolution_limit) {
+                $page->trigError("Toutes les url et adresses emails de la lettre"
                                 . " n'ont pas été prises en compte car la"
                                 . " limite du nombre de résolutions DNS"
                                 . " autorisée a été atteinte.");
index c8c5bf7..5075084 100644 (file)
@@ -177,7 +177,7 @@ class OpenId
     // Renders the main XRDS page.
     public function RenderMainXrdsPage(&$page)
     {
-        header('Content-type: application/xrds+xml');
+        pl_content_headers("application/xrds+xml");
         $page->changeTpl('openid/idp_xrds.tpl', NO_SKIN);
         $page->assign('type2', Auth_OpenID_TYPE_2_0_IDP);
         $page->assign('sreg', Auth_OpenID_SREG_URI);
@@ -187,7 +187,7 @@ class OpenId
     // Renders the XRDS page of |user|.
     public function RenderUserXrdsPage(&$page, User &$user)
     {
-        header('Content-type: application/xrds+xml');
+        pl_content_headers("application/xrds+xml");
         $page->changeTpl('openid/user_xrds.tpl', NO_SKIN);
         $page->assign('type2', Auth_OpenID_TYPE_2_0);
         $page->assign('type1', Auth_OpenID_TYPE_1_1);
index 415b607..84a285e 100644 (file)
@@ -112,7 +112,7 @@ class PaymentModule extends PLModule
                 return PL_NOT_FOUND;
             }
             $res = XDB::query("SELECT asso_id
-                                 FROM paiement.paiements
+                                 FROM #paiement#.paiements
                                 WHERE asso_id = {?} AND id = {?}",
                               $globals->asso('id'), $ref);
             if (!$res->numRows()) {
@@ -142,7 +142,7 @@ class PaymentModule extends PLModule
             $pay->prepareform($pay);
         } else {
             $res = XDB::iterator("SELECT  timestamp, montant
-                                    FROM  paiement.transactions
+                                    FROM  #paiement#.transactions
                                    WHERE  uid = {?} AND ref = {?}
                                 ORDER BY  timestamp DESC",
                                  S::v('uid', -1), $ref);
@@ -197,7 +197,7 @@ class PaymentModule extends PLModule
 
         echo ($ref = $matches[1]);
         $res = XDB::query("SELECT  mail,text,confirmation
-                             FROM  paiement.paiements
+                             FROM  #paiement#.paiements
                             WHERE  id={?}", $ref);
         if (!list($conf_mail,$conf_title,$conf_text) = $res->fetchOneRow()) {
             cb_erreur("référence de commande inconnue");
@@ -206,8 +206,8 @@ class PaymentModule extends PLModule
         /* on extrait le code de retour */
         if ($champ906 != "0000") {
             $res = XDB::query("SELECT  rcb.text,c.id,c.text
-                                 FROM  paiement.codeRCB AS rcb
-                            LEFT JOIN  paiement.codeC   AS c ON rcb.codeC=c.id
+                                 FROM  #paiement#.codeRCB AS rcb
+                            LEFT JOIN  #paiement#.codeC   AS c ON rcb.codeC=c.id
                                 WHERE  rcb.id={?}", $champ906);
             if (list($rcb_text, $c_id, $c_text) = $res->fetchOneRow()) {
                 cb_erreur("erreur lors du paiement : $c_text ($c_id)");
@@ -217,13 +217,13 @@ class PaymentModule extends PLModule
         }
 
         /* on fait l'insertion en base de donnees */
-        XDB::execute("INSERT INTO  paiement.transactions (id,uid,ref,fullref,montant,cle,comment)
+        XDB::execute("INSERT INTO  #paiement#.transactions (id,uid,ref,fullref,montant,cle,comment)
                            VALUES  ({?},{?},{?},{?},{?},{?},{?})",
                      $champ901, $uid, $ref, $champ200, $montant, $champ905,Env::v('comment'));
 
         // We check if it is an Xnet payment and then update the related ML.
         $res = XDB::query('SELECT  eid
-                             FROM  groupex.evenements
+                             FROM  #groupex#.evenements
                             WHERE  paiement_id = {?}', $ref);
         if ($eid = $res->fetchOneCell()) {
             $this->load('xnetevents.inc.php');
@@ -311,20 +311,20 @@ class PaymentModule extends PLModule
 
         $ref = $matches[1];
         $res = XDB::query("SELECT  mail,text,confirmation
-                             FROM  paiement.paiements
+                             FROM  #paiement#.paiements
                             WHERE  id={?}", $ref);
         if (!list($conf_mail,$conf_title,$conf_text) = $res->fetchOneRow()) {
             paypal_erreur("référence de commande inconnue");
         }
 
         /* on fait l'insertion en base de donnees */
-        XDB::execute("INSERT INTO  paiement.transactions (id,uid,ref,fullref,montant,cle,comment)
+        XDB::execute("INSERT INTO  #paiement#.transactions (id,uid,ref,fullref,montant,cle,comment)
                            VALUES  ({?},{?},{?},{?},{?},{?},{?})",
                     $no_transaction, $uid, $ref, $fullref, $montant, $clef, Env::v('comment'));
 
         // We check if it is an Xnet payment and then update the related ML.
         $res = XDB::query('SELECT  eid
-                             FROM  groupex.evenements
+                             FROM  #groupex#.evenements
                             WHERE  paiement_id = {?}', $ref);
         if ($eid = $res->fetchOneCell()) {
             $this->load('xnetevents.inc.php');
@@ -378,8 +378,8 @@ class PaymentModule extends PLModule
                 return PL_FORBIDDEN;
             }
             $res = XDB::query("SELECT  1
-                                 FROM  groupex.evenements AS e
-                           INNER JOIN  groupex.evenements_participants AS ep ON (ep.eid = e.eid AND uid = {?})
+                                 FROM  #groupex#.evenements AS e
+                           INNER JOIN  #groupex#.evenements_participants AS ep ON (ep.eid = e.eid AND uid = {?})
                                 WHERE  e.paiement_id = {?} AND e.asso_id = {?}",
                               S::i('uid'), $pid, $globals->asso('id'));
             if ($res->numRows() == 0) {
@@ -454,9 +454,9 @@ class PaymentModule extends PLModule
                                            'montant' => strtr($sum, '.', ',').' €');
             }
             $res = XDB::iterRow("SELECT e.eid, e.short_name, e.intitule, ep.nb, ei.montant, ep.paid
-                                   FROM groupex.evenements AS e
-                              LEFT JOIN groupex.evenements_participants AS ep ON (ep.eid = e.eid AND uid = {?})
-                             INNER JOIN groupex.evenements_items AS ei ON (ep.eid = ei.eid AND ep.item_id = ei.item_id)
+                                   FROM #groupex#.evenements AS e
+                              LEFT JOIN #groupex#.evenements_participants AS ep ON (ep.eid = e.eid AND uid = {?})
+                             INNER JOIN #groupex#.evenements_items AS ei ON (ep.eid = ei.eid AND ep.item_id = ei.item_id)
                                   WHERE e.paiement_id = {?}",
                                  S::v('uid'), $pid);
             $event[$pid] = array();
@@ -490,11 +490,11 @@ class PaymentModule extends PLModule
     function handler_admin(&$page, $action = 'list', $id = null) {
         $page->setTitle('Administration - Paiements');
         $page->assign('title', 'Gestion des télépaiements');
-        $table_editor = new PLTableEditor('admin/payments','paiement.paiements','id');
-        $table_editor->add_join_table('paiement.transactions','ref',true);
+        $table_editor = new PLTableEditor('admin/payments','#paiement#.paiements','id');
+        $table_editor->add_join_table('#paiement#.transactions','ref',true);
         $table_editor->add_sort_field('flags');
         $table_editor->add_sort_field('id', true, true);
-        $table_editor->on_delete("UPDATE paiement.paiements SET flags = 'old' WHERE id = {?}", "Le paiement a été archivé");
+        $table_editor->on_delete("UPDATE #paiement#.paiements SET flags = 'old' WHERE id = {?}", "Le paiement a été archivé");
         $table_editor->describe('text','intitulé',true);
         $table_editor->describe('url','site web',false);
         $table_editor->describe('montant_def','montant par défaut',false);
index a5aae56..bb0f8f1 100644 (file)
@@ -88,9 +88,9 @@ class Payment
     {
         if ($this->asso_id) {
             $res = XDB::query("SELECT  e.eid, a.diminutif
-                                 FROM  groupex.evenements AS e
-                           INNER JOIN  groupex.asso AS a ON (e.asso_id = a.id)
-                            LEFT JOIN  groupex.evenements_participants AS p ON (p.eid = e.eid AND p.uid = {?})
+                                 FROM  #groupex#.evenements AS e
+                           INNER JOIN  #groupex#.asso AS a ON (e.asso_id = a.id)
+                            LEFT JOIN  #groupex#.evenements_participants AS p ON (p.eid = e.eid AND p.uid = {?})
                                 WHERE  e.paiement_id = {?} AND p.uid IS NULL", S::i('uid'), $this->id);
             if ($res->numRows()) {
                 return $res->fetchOneAssoc();
index 1279260..068ff05 100644 (file)
@@ -75,14 +75,8 @@ class PlatalModule extends PLModule
 
     function handler_cacert(&$page)
     {
-        $data = file_get_contents("/etc/ssl/xorgCA/cacert.pem","r");
-        header("Pragma:");
-        header("Set-Cookie:");
-        header("Cache-Control:");
-        header("Expires:");
-        header("Content-Type: application/x-x509-ca-cert");
-        header("Content-Length: ".strlen($data));
-        echo $data;
+        pl_cached_content_headers("application/x-x509-ca-cert");
+        readfile("/etc/ssl/xorgCA/cacert.pem");
         exit;
     }
 
index f64d8c7..7783972 100644 (file)
@@ -112,10 +112,10 @@ class ProfileModule extends PLModule
 
         // Display the photo, or a default one when not available.
         if ($photo_type && $photo_data != null) {
-            header('Content-type: image/' . $photo_type);
+            pl_cached_dynamic_content_headers("image/$photo_type");
             echo $photo_data;
         } else {
-            header('Content-type: image/png');
+            pl_cached_dynamic_content_headers("image/png");
             echo file_get_contents(dirname(__FILE__).'/../htdocs/images/none.png');
         }
         exit;
@@ -133,8 +133,7 @@ class ProfileModule extends PLModule
         $img  = $thumb ?
             dirname(__FILE__).'/../htdocs/images/medals/thumb/' . $res->fetchOneCell() :
             dirname(__FILE__).'/../htdocs/images/medals/' . $res->fetchOneCell();
-        $type = mime_content_type($img);
-        header("Content-Type: $type");
+        pl_cached_content_headers(mime_content_type($img));
         echo file_get_contents($img);
         exit;
     }
@@ -399,22 +398,14 @@ class ProfileModule extends PLModule
 
     function handler_education_js(&$page)
     {
-        header('Content-Type: text/javascript; charset=utf-8');
-        header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
-        header('Last-Modified:' . gmdate('D, d M Y H:i:s') . ' GMT');
-        header('Cache-Control: no-cache, must-revalidate');
-        header('Pragma: no-cache');
+        pl_cached_content_headers("text/javascript", "utf-8");
         $page->changeTpl('profile/education.js.tpl', NO_SKIN);
-        require_once "education.func.inc.php";
+        require_once 'education.func.inc.php';
     }
 
     function handler_grades_js(&$page)
     {
-        header('Content-Type: text/javascript; charset=utf-8');
-        header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
-        header('Last-Modified:' . gmdate('D, d M Y H:i:s') . ' GMT');
-        header('Cache-Control: no-cache, must-revalidate');
-        header('Pragma: no-cache');
+        pl_cached_content_headers("text/javascript", "utf-8");
         $page->changeTpl('profile/grades.js.tpl', NO_SKIN);
         $res    = XDB::iterator("SELECT  *
                                    FROM  profile_medals_grades
@@ -437,7 +428,7 @@ class ProfileModule extends PLModule
 
     function handler_ajax_address(&$page, $id)
     {
-        header('Content-Type: text/html; charset=utf-8');
+        pl_content_headers("text/html");
         $page->changeTpl('profile/adresses.address.tpl', NO_SKIN);
         $page->assign('i', $id);
         $page->assign('address', array());
@@ -445,7 +436,7 @@ class ProfileModule extends PLModule
 
     function handler_ajax_tel(&$page, $prefid, $prefname, $telid)
     {
-        header('Content-Type: text/html; charset=utf-8');
+        pl_content_headers("text/html");
         $page->changeTpl('profile/phone.tpl', NO_SKIN);
         $page->assign('prefid', $prefid);
         $page->assign('prefname', $prefname);
@@ -468,7 +459,7 @@ class ProfileModule extends PLModule
 
     function handler_ajax_medal(&$page, $id)
     {
-        header('Content-Type: text/html; charset=utf-8');
+        pl_content_headers("text/html");
         $page->changeTpl('profile/deco.medal.tpl', NO_SKIN);
         $page->assign('id', $id);
         $page->assign('medal', array('valid' => 0, 'grade' => 0));
@@ -476,7 +467,7 @@ class ProfileModule extends PLModule
 
     function handler_ajax_job(&$page, $id)
     {
-        header('Content-Type: text/html; charset=utf-8');
+        pl_content_headers("text/html");
         $page->changeTpl('profile/jobs.job.tpl', NO_SKIN);
         $page->assign('i', $id);
         $page->assign('job', array());
@@ -490,7 +481,7 @@ class ProfileModule extends PLModule
 
     function handler_ajax_sector(&$page, $id, $jobid, $jobpref, $sect, $ssect = -1)
     {
-        header('Content-Type: text/html; charset=utf-8');
+        pl_content_headers("text/html");
         $res = XDB::iterator("SELECT  id, name, FIND_IN_SET('optgroup', flags) AS optgroup
                                 FROM  profile_job_subsector_enum
                                WHERE  sectorid = {?}", $sect);
@@ -536,7 +527,7 @@ class ProfileModule extends PLModule
 
     function handler_ajax_skill(&$page, $cat, $id)
     {
-        header('Content-Type: text/html; charset=utf-8');
+        pl_content_headers("text/html");
         $page->changeTpl('profile/skill.skill.tpl', NO_SKIN);
         $page->assign('cat', $cat);
         $page->assign('id', $id);
@@ -734,7 +725,7 @@ class ProfileModule extends PLModule
 
     function handler_ref_sect(&$page, $sect)
     {
-        header('Content-Type: text/html; charset=utf-8');
+        pl_content_headers("text/html");
         $page->changeTpl('include/field.select.tpl', NO_SKIN);
         $page->assign('onchange', 'setSSectors()');
         $page->assign('id', 'ssect_field');
@@ -747,7 +738,7 @@ class ProfileModule extends PLModule
 
     function handler_ref_country(&$page, $sect, $ssect = '')
     {
-        header('Content-Type: text/html; charset=utf-8');
+        pl_content_headers("text/html");
         $page->changeTpl('include/field.select.tpl', NO_SKIN);
         $page->assign('name', 'pays_sel');
         $where = ($ssect ? ' AND ms.subsectorid = {?}' : '');
@@ -769,9 +760,9 @@ class ProfileModule extends PLModule
         $req = XDB::query('
             SELECT m.asso_id, a.nom, diminutif, a.logo IS NOT NULL AS has_logo,
                    COUNT(e.eid) AS events, mail_domain AS lists
-              FROM groupex.membres AS m
-        INNER JOIN groupex.asso AS a ON(m.asso_id = a.id)
-         LEFT JOIN groupex.evenements AS e ON(e.asso_id = m.asso_id AND e.archive = 0)
+              FROM #groupex#.membres AS m
+        INNER JOIN #groupex#.asso AS a ON(m.asso_id = a.id)
+         LEFT JOIN #groupex#.evenements AS e ON(e.asso_id = m.asso_id AND e.archive = 0)
              WHERE uid = {?} GROUP BY m.asso_id ORDER BY a.nom', S::i('uid'));
         $page->assign('assos', $req->fetchAllAssoc());
     }
@@ -783,15 +774,15 @@ class ProfileModule extends PLModule
         }
 
         $res = XDB::query('SELECT  logo, logo_mime
-                             FROM  groupex.asso
+                             FROM  #groupex#.asso
                             WHERE  id = {?}', $id);
         list($logo, $logo_mime) = $res->fetchOneRow();
 
         if (!empty($logo)) {
-            header("Content-type: $mime");
+            pl_cached_dynamic_content_headers($logo_mime);
             echo $logo;
         } else {
-            header('Content-type: image/jpeg');
+            pl_cached_dynamic_content_headers("image/jpeg");
             readfile(dirname(__FILE__) . '/../htdocs/images/dflt_carre.jpg');
         }
 
@@ -827,10 +818,9 @@ class ProfileModule extends PLModule
 
         switch ($action) {
             case "original":
-                header("Content-type: image/jpeg");
+                pl_cached_content_headers("image/jpeg");
                readfile("/home/web/trombino/photos" . $user->promo() . "/" . $user->login() . ".jpg");
                 exit;
-               break;
 
             case "new":
                 S::assert_xsrf_token();
index 5fb7b45..1b11e8d 100644 (file)
@@ -109,14 +109,14 @@ class ProfileGroups extends ProfilePage
     public function _prepare(PlPage &$page, $id)
     {
         $page->assign('mygroups', XDB::iterator("SELECT  a.nom, a.site, a.diminutif, a.unsub_url, a.pub, m.perms
-                                                   FROM  groupex.asso    AS a
-                                             INNER JOIN  groupex.membres AS m ON (m.asso_id = a.id)
+                                                   FROM  #groupex#.asso    AS a
+                                             INNER JOIN  #groupex#.membres AS m ON (m.asso_id = a.id)
                                                   WHERE  m.uid = {?} AND (a.cat = 'GroupesX' OR a.cat = 'Institutions')",
                                                   S::i('uid')));
         $page->assign('listgroups', XDB::iterator("SELECT  a.nom, a.diminutif, a.sub_url,
                                                            IF (a.cat = 'Institutions', a.cat, d.nom) AS dom
-                                                     FROM  groupex.asso  AS a
-                                                LEFT JOIN  groupex.dom   AS d ON (d.id = a.dom)
+                                                     FROM  #groupex#.asso  AS a
+                                                LEFT JOIN  #groupex#.dom   AS d ON (d.id = a.dom)
                                                     WHERE  a.inscriptible != 0
                                                            AND (a.cat = 'GroupesX' OR a.cat = 'Institutions')
                                                  ORDER BY  a.cat, a.dom, a.nom"));
index ef194c9..7e2d4bb 100644 (file)
@@ -348,10 +348,10 @@ class RegisterModule extends PLModule
                     $storage->activate();
                     break;
                 case 'ml_promo':
-                    $r = XDB::query('SELECT id FROM groupex.asso WHERE diminutif = {?}', S::user()->promo());
+                    $r = XDB::query('SELECT id FROM #groupex#.asso WHERE diminutif = {?}', S::user()->promo());
                     if ($r->numRows()) {
                         $asso_id = $r->fetchOneCell();
-                        XDB::execute('REPLACE INTO  groupex.membres (uid, asso_id)
+                        XDB::execute('REPLACE INTO  #groupex#.membres (uid, asso_id)
                                             VALUES  ({?}, {?})',
                                      S::user()->id(), $asso_id);
                         $mmlist = new MMList(S::user()->id(), S::v('password'));
@@ -390,9 +390,9 @@ class RegisterModule extends PLModule
         $promo_forum = 'xorg.promo.x' . $promo;
         $registered_forums = array('xorg.general', 'xorg.pa.divers', 'xorg.pa.logements', $promo_forum);
         foreach ($registered_forums as $forum) {
-            XDB::execute("INSERT INTO  forums.abos (fid,uid)
+            XDB::execute("INSERT INTO  #forums#.abos (fid,uid)
                                SELECT  fid, {?}
-                                 FROM   forums.list
+                                 FROM  #forums#.list
                                 WHERE  nom = {?}",
                                 $uid, $val);
 
index 8acb63d..9820f3b 100644 (file)
@@ -73,9 +73,9 @@ class SearchModule extends PLModule
     {
         global $globals;
 
-        $res = XDB::query("SELECT  MIN(`diminutif`), MAX(`diminutif`)
-                             FROM  `groupex`.`asso`
-                            WHERE  `cat` = 'Promotions'");
+        $res = XDB::query("SELECT  MIN(diminutif), MAX(diminutif)
+                             FROM  #groupex#.asso
+                            WHERE  cat = 'Promotions'");
         list($min, $max) = $res->fetchOneRow();
         $page->assign('promo_min', $min);
         $page->assign('promo_max', $max);
@@ -173,7 +173,7 @@ class SearchModule extends PLModule
                 'binet'           => array('field' => 'id', 'table' => 'binets_def', 'text' => 'text', 'exact' => false),
                 'networking_type' => array('field' => 'network_type', 'table' => 'profile_networking_enum',
                                            'text' => 'name', 'exact' => false),
-                'groupex'         => array('field' => 'id', 'table' => 'groupex.asso',
+                'groupex'         => array('field' => 'id', 'table' => '#groupex#.asso',
                                            'text' => "(cat = 'GroupesX' OR cat = 'Institutions') AND pub = 'public' AND nom",
                                            'exact' => false),
                 'section'         => array('field' => 'id', 'table' => 'sections', 'text' => 'text', 'exact' => false),
@@ -224,7 +224,7 @@ class SearchModule extends PLModule
         //   result1|nb1
         //   result2|nb2
         //   ...
-        header('Content-Type: text/plain; charset="UTF-8"');
+        pl_content_headers("text/plain");
         $q = preg_replace(array('/\*+$/', // always look for $q*
                                 '/([\^\$\[\]])/', // escape special regexp char
                                 '/\*/'), // replace joker by regexp joker
@@ -299,8 +299,8 @@ class SearchModule extends PLModule
             $beginwith = false;
             break;
           case 'groupexTxt':
-            $db = "groupex.asso AS a INNER JOIN
-                   groupex.membres AS m ON(a.id = m.asso_id
+            $db = "#groupex#.asso AS a INNER JOIN
+                   #groupex#.membres AS m ON(a.id = m.asso_id
                                            AND (a.cat = 'GroupesX' OR a.cat = 'Institutions')
                                            AND a.pub = 'public')";
             $field='a.nom';
@@ -435,12 +435,12 @@ class SearchModule extends PLModule
             $field = '`fonction_fr`';
             break;
           case 'diploma':
-            header('Content-Type: text/xml; charset="UTF-8"');
+            pl_content_headers("text/xml");
             $this->get_diplomas();
             $page->changeTpl('search/adv.grade.form.tpl', NO_SKIN);
             return;
           case 'groupex':
-            $db = 'groupex.asso';
+            $db = '#groupex#.asso';
             $where = " WHERE (cat = 'GroupesX' OR cat = 'Institutions') AND pub = 'public'";
             $field = 'nom';
             break;
@@ -478,12 +478,12 @@ class SearchModule extends PLModule
           default: exit();
         }
         if (isset($idVal)) {
-            header('Content-Type: text/plain; charset="UTF-8"');
+            pl_content_headers("text/plain");
             $result = XDB::query('SELECT '.$field.' AS field FROM '.$db.' WHERE '.$id.' = {?} LIMIT 1',$idVal);
             echo $result->fetchOneCell();
             exit();
         }
-        header('Content-Type: text/xml; charset="UTF-8"');
+        pl_content_headers("text/xml");
         $page->changeTpl('include/field.select.tpl', NO_SKIN);
         $page->assign('name', $type);
         $page->assign('list', XDB::iterator('SELECT  '.$field.' AS field,
index b117467..1d6a047 100644 (file)
@@ -379,7 +379,7 @@ class QuickSearch extends SField
             $join .= "LEFT JOIN emails AS ems ON (ems.uid = u.user_id)";
         }
         if (!empty($this->ip)) {
-            $join .= "INNER JOIN logger.sessions AS ls ON (ls.uid = u.user_id)\n";
+            $join .= "INNER JOIN #logger#.sessions AS ls ON (ls.uid = u.user_id)\n";
         }
         if (!empty($this->phone)) {
             if (!S::logged()) {
index ecef2cf..7665c12 100644 (file)
@@ -59,7 +59,7 @@ function advancedSearchFromInput()
 
     $natField           = new RefSField('nationalite', array('u.nationalite', 'u.nationalite2', 'u.nationalite3'), '', '', '');
     $binetField         = new RefSField('binet', array('b.binet_id'), 'binets_ins', 'b', 'u.user_id=b.user_id');
-    $groupexField       = new RefSField('groupex', array('g.id'), array('groupex.asso', 'groupex.membres'), array('g', 'gm'),
+    $groupexField       = new RefSField('groupex', array('g.id'), array('#groupex#.asso', '#groupex#.membres'), array('g', 'gm'),
                                         array("(g.cat = 'GroupesX' OR g.cat = 'Institutions') AND g.pub = 'public'",
                                               'gm.asso_id = g.id AND u.user_id = gm.uid'));
     $sectionField       = new RefSField('section', array('u.section'), '', '', '');
index 2a74184..85ee054 100644 (file)
@@ -91,7 +91,7 @@ class StatsModule extends PLModule
         }
 
         //Genere le graphique à la volée avec GNUPLOT
-        header( "Content-type: image/png");
+        pl_cached_dynamic_content_headers("image/png");
 
         $delt = ($total - $init_nb)/10;
         $delt = $delt ? $delt : 5;
@@ -236,7 +236,7 @@ EOF
 EOF2;
         }
 
-        header('Content-type: image/png');
+        pl_cached_dynamic_content_headers("image/png");
         passthru($gnuplot);
         exit;
     }
index 3ce8541..199d96d 100644 (file)
@@ -109,7 +109,7 @@ class SurveyModule extends PLModule
             return PL_DO_AUTH;
         }
         if ($show == 'csv') {
-            header('Content-Type: text/csv; charset="UTF-8"');
+            pl_content_headers("text/csv");
             echo $survey->toCSV();
             exit;
         } else {
@@ -364,7 +364,7 @@ class SurveyModule extends PLModule
     function handler_ajax(&$page, $type)
     {
         $this->load('survey.inc.php');
-        header('Content-Type: text/html; charset="UTF-8"');
+        pl_content_headers("text/html");
         if (Survey::isType($type)) { // when type has been chosen, the form is updated to fit exactly the type of question chosen
             $page->changeTpl('survey/edit_new.tpl', NO_SKIN);
             $page->assign('survey_types', Survey::getTypes());
index c50cc12..0daa07a 100644 (file)
@@ -83,6 +83,7 @@ class Survey
         if ($this->mode == self::MODE_ALL) {
             $args['promos'] = '';
         }
+        $args['promos'] = str_replace(' ', '', $args['promos']);
         $this->promos  = ($args['promos'] == '' || preg_match('#^(\d{4}-?|(\d{4})?-\d{4})(,(\d{4}-?|(\d{4})?-\d{4}))*$#', $args['promos']))? $args['promos'] : '#';
     }
     // }}}
index 87be73a..ea1d55c 100644 (file)
@@ -48,10 +48,10 @@ class XnetModule extends PLModule
                             WHERE alias = {?}", $x);
 
         if ((list($type, $data) = $res->fetchOneRow())) {
-            Header("Content-type: image/$type");
+            pl_cached_dynamic_content_headers("image/$type");
             echo $data;
         } else {
-            Header('Content-type: image/png');
+            pl_cached_dynamic_content_headers("image/png");
             echo file_get_contents(dirname(__FILE__).'/../htdocs/images/none.png');
         }
         exit;
@@ -76,14 +76,14 @@ class XnetModule extends PLModule
 
         if (Get::has('del')) {
             $res = XDB::query('SELECT id, nom, mail_domain
-                                           FROM groupex.asso WHERE diminutif={?}',
+                                           FROM #groupex#.asso WHERE diminutif={?}',
                                         Get::v('del'));
             list($id, $nom, $domain) = $res->fetchOneRow();
             $page->assign('nom', $nom);
             if ($id && Post::has('del')) {
                 S::assert_xsrf_token();
 
-                XDB::query('DELETE FROM groupex.membres WHERE asso_id={?}', $id);
+                XDB::query('DELETE FROM #groupex#.membres WHERE asso_id={?}', $id);
                 $page->trigSuccess('membres supprimés');
 
                 if ($domain) {
@@ -102,7 +102,7 @@ class XnetModule extends PLModule
                     }
                 }
 
-                XDB::query('DELETE FROM groupex.asso WHERE id={?}', $id);
+                XDB::query('DELETE FROM #groupex#.asso WHERE id={?}', $id);
                 $page->trigSuccess("Groupe $nom supprimé");
                 Get::kill('del');
             }
@@ -115,12 +115,12 @@ class XnetModule extends PLModule
             S::assert_xsrf_token();
 
             $res = XDB::query('SELECT  COUNT(*)
-                                 FROM  groupex.asso
+                                 FROM  #groupex#.asso
                                 WHERE  diminutif = {?}',
                               Post::v('diminutif'));
 
             if ($res->fetchOneCell() == 0) {
-                XDB::execute('INSERT INTO  groupex.asso (id, diminutif)
+                XDB::execute('INSERT INTO  #groupex#.asso (id, diminutif)
                                    VALUES  (NULL, {?})',
                              Post::v('diminutif'));
                 pl_redirect('../' . Post::v('diminutif') . '/edit');
@@ -130,7 +130,7 @@ class XnetModule extends PLModule
         }
 
         $res = XDB::query('SELECT  nom, diminutif
-                             FROM  groupex.asso
+                             FROM  #groupex#.asso
                          ORDER BY  nom');
         $page->assign('assos', $res->fetchAllAssoc());
     }
@@ -143,8 +143,8 @@ class XnetModule extends PLModule
 
         $res = XDB::iterator(
                 'SELECT  dom.id, dom.nom as domnom, asso.diminutif, asso.nom
-                   FROM  groupex.dom
-             INNER JOIN  groupex.asso ON dom.id = asso.dom
+                   FROM  #groupex#.dom
+             INNER JOIN  #groupex#.asso ON dom.id = asso.dom
                   WHERE  FIND_IN_SET("GroupesX", dom.cat) AND FIND_IN_SET("GroupesX", asso.cat)
                ORDER BY  dom.nom, asso.nom');
         $groupesx = array();
@@ -153,8 +153,8 @@ class XnetModule extends PLModule
 
         $res = XDB::iterator(
                 'SELECT  dom.id, dom.nom as domnom, asso.diminutif, asso.nom
-                   FROM  groupex.dom
-             INNER JOIN  groupex.asso ON dom.id = asso.dom
+                   FROM  #groupex#.dom
+             INNER JOIN  #groupex#.asso ON dom.id = asso.dom
                   WHERE  FIND_IN_SET("Binets", dom.cat) AND FIND_IN_SET("Binets", asso.cat)
                ORDER BY  dom.nom, asso.nom');
         $binets = array();
@@ -163,14 +163,14 @@ class XnetModule extends PLModule
 
         $res = XDB::iterator(
                 'SELECT  asso.diminutif, asso.nom
-                   FROM  groupex.asso
+                   FROM  #groupex#.asso
                   WHERE  cat LIKE "%Promotions%"
                ORDER BY  diminutif');
         $page->assign('promos', $res);
 
         $res = XDB::iterator(
                 'SELECT  asso.diminutif, asso.nom
-                   FROM  groupex.asso
+                   FROM  #groupex#.asso
                   WHERE  FIND_IN_SET("Institutions", cat)
                ORDER BY  diminutif');
         $page->assign('inst', $res);
@@ -193,21 +193,24 @@ class XnetModule extends PLModule
         $page->assign('cat', $cat);
         $page->assign('dom', $dom);
 
-        $res  = XDB::query("SELECT id,nom FROM groupex.dom
-                             WHERE FIND_IN_SET({?}, cat)
-                          ORDER BY nom", $cat);
+        $res  = XDB::query("SELECT  id,nom 
+                              FROM  #groupex#.dom
+                             WHERE  FIND_IN_SET({?}, cat)
+                          ORDER BY  nom", $cat);
         $doms = $res->fetchAllAssoc();
         $page->assign('doms', $doms);
 
         if (empty($doms)) {
-            $res = XDB::query("SELECT diminutif, nom, site FROM groupex.asso
-                                   WHERE FIND_IN_SET({?}, cat)
-                                ORDER BY nom", $cat);
+            $res = XDB::query("SELECT  diminutif, nom, site
+                                 FROM  #groupex#.asso
+                                WHERE  FIND_IN_SET({?}, cat)
+                                ORDER  BY nom", $cat);
             $page->assign('gps', $res->fetchAllAssoc());
         } elseif (!is_null($dom)) {
-            $res = XDB::query("SELECT diminutif, nom, site FROM groupex.asso
-                                WHERE FIND_IN_SET({?}, cat) AND dom={?}
-                             ORDER BY nom", $cat, $dom);
+            $res = XDB::query("SELECT  diminutif, nom, site
+                                 FROM  #groupex#.asso
+                                WHERE  FIND_IN_SET({?}, cat) AND dom={?}
+                             ORDER BY  nom", $cat, $dom);
             $page->assign('gps', $res->fetchAllAssoc());
         }
 
@@ -219,7 +222,7 @@ class XnetModule extends PLModule
         $allkeys = func_get_args();
         unset($allkeys[0]);
         $url = join('/',$allkeys);
-        header("Content-type: text/javascript; charset=utf-8");
+        pl_content_headers("text/javascript");
         echo '$.ajax({ url: "'.$url.'?forceXml=1", dataType: "xml", success: function(xml) { $("body",xml).insertBefore("body"); $("body:eq(1)").remove(); }});';
         exit;
     }
index ebde459..fb9406e 100644 (file)
@@ -60,7 +60,7 @@ class XnetEventsModule extends PLModule
             }
             S::assert_xsrf_token();
 
-            $res = XDB::query("SELECT asso_id, short_name FROM groupex.evenements
+            $res = XDB::query("SELECT asso_id, short_name FROM #groupex#.evenements
                                 WHERE eid = {?} AND asso_id = {?}",
                               $eid, $globals->asso('id'));
 
@@ -81,15 +81,15 @@ class XnetEventsModule extends PLModule
             }
 
             // deletes the event items
-            XDB::execute('DELETE FROM  groupex.evenements_items
+            XDB::execute('DELETE FROM  #groupex#.evenements_items
                                 WHERE  eid = {?}', $eid);
 
             // deletes the event participants
-            XDB::execute('DELETE FROM  groupex.evenements_participants
+            XDB::execute('DELETE FROM  #groupex#.evenements_participants
                                 WHERE  eid = {?}', $eid);
 
             // deletes the event
-            XDB::execute('DELETE FROM  groupex.evenements
+            XDB::execute('DELETE FROM  #groupex#.evenements
                                 WHERE  eid = {?} AND asso_id = {?}',
                          $eid, $globals->asso('id'));
 
@@ -102,14 +102,14 @@ class XnetEventsModule extends PLModule
         }
 
         if ($action == 'archive') {
-            XDB::execute("UPDATE groupex.evenements
+            XDB::execute("UPDATE #groupex#.evenements
                              SET archive = 1
                            WHERE eid = {?} AND asso_id = {?}",
                          $eid, $globals->asso('id'));
         }
 
         if ($action == 'unarchive') {
-            XDB::execute("UPDATE groupex.evenements
+            XDB::execute("UPDATE #groupex#.evenements
                              SET archive = 0
                            WHERE eid = {?} AND asso_id = {?}",
                          $eid, $globals->asso('id'));
@@ -122,10 +122,10 @@ class XnetEventsModule extends PLModule
                             1) AS inscr_open, e.deadline_inscription,
                          u.nom, u.prenom, u.promo, a.alias,
                          MAX(ep.nb) IS NOT NULL AS inscrit, MAX(ep.paid) AS paid
-                  FROM  groupex.evenements  AS e
-            INNER JOIN  x4dat.auth_user_md5 AS u ON u.user_id = e.organisateur_uid
-            INNER JOIN  x4dat.aliases       AS a ON (a.type = 'a_vie' AND a.id = u.user_id)
-             LEFT JOIN  groupex.evenements_participants AS ep ON (ep.eid = e.eid AND ep.uid = {?})
+                  FROM  #groupex#.evenements  AS e
+            INNER JOIN  #x4dat#.auth_user_md5 AS u ON u.user_id = e.organisateur_uid
+            INNER JOIN  #x4dat#.aliases       AS a ON (a.type = 'a_vie' AND a.id = u.user_id)
+             LEFT JOIN  #groupex#.evenements_participants AS ep ON (ep.eid = e.eid AND ep.uid = {?})
                  WHERE  asso_id = {?}
                    AND  archive = " . ($archive ? "1 " : "0 ")
               . "GROUP BY  e.eid
@@ -144,8 +144,8 @@ class XnetEventsModule extends PLModule
             $e['show_participants'] = ($e['show_participants'] && (is_member() || may_update()));
             $res = XDB::query(
                 "SELECT titre, details, montant, ei.item_id, nb, ep.paid
-                   FROM groupex.evenements_items AS ei
-              LEFT JOIN groupex.evenements_participants AS ep
+                   FROM #groupex#.evenements_items AS ei
+              LEFT JOIN #groupex#.evenements_participants AS ep
                         ON (ep.eid = ei.eid AND ep.item_id = ei.item_id AND uid = {?})
                   WHERE ei.eid = {?}",
                     S::v('uid'), $e['eid']);
@@ -256,14 +256,14 @@ class XnetEventsModule extends PLModule
         foreach ($subs as $j => $nb) {
             if ($nb >= 0) {
                 XDB::execute(
-                    "REPLACE INTO  groupex.evenements_participants
+                    "REPLACE INTO  #groupex#.evenements_participants
                            VALUES  ({?}, {?}, {?}, {?}, {?}, {?})",
                     $eid, S::v('uid'), $j, $nb, Env::has('notify_payment') ? 'notify_payment' : '',
                     $j == 1 ? $paid - $telepaid : 0);
                 $updated = $eid;
             } else {
                 XDB::execute(
-                    "DELETE FROM  groupex.evenements_participants
+                    "DELETE FROM  #groupex#.evenements_participants
                            WHERE  eid = {?} AND uid = {?} AND item_id = {?}",
                     $eid, S::v("uid"), $j);
                 $updated = $eid;
@@ -290,10 +290,7 @@ class XnetEventsModule extends PLModule
             return PL_NOT_FOUND;
         }
 
-        header('Content-type: text/x-csv; encoding=UTF-8');
-        header('Pragma: ');
-        header('Cache-Control: ');
-
+        pl_content_headers("text/x-csv");
         $page->changeTpl('xnetevents/csv.tpl', NO_SKIN);
 
         $admin = may_update();
@@ -339,7 +336,7 @@ class XnetEventsModule extends PLModule
         $page->register_function('display_ical', 'display_ical');
         $page->assign_by_ref('e', $evt);
 
-        header('Content-Type: text/calendar; charset=utf-8');
+        pl_content_headers("text/calendar");
     }
 
     function handler_edit(&$page, $eid = null)
@@ -349,7 +346,7 @@ class XnetEventsModule extends PLModule
         // get eid if the the given one is a short name
         if (!is_null($eid) && !is_numeric($eid)) {
             $res = XDB::query("SELECT eid
-                                 FROM groupex.evenements
+                                 FROM #groupex#.evenements
                                 WHERE asso_id = {?} AND short_name = {?}",
                               $globals->asso('id'), $eid);
             if ($res->numRows()) {
@@ -360,7 +357,7 @@ class XnetEventsModule extends PLModule
         // check the event is in our group
         if (!is_null($eid)) {
             $res = XDB::query("SELECT short_name
-                                 FROM groupex.evenements
+                                 FROM #groupex#.evenements
                                 WHERE eid = {?} AND asso_id = {?}",
                               $eid, $globals->asso('id'));
             if ($res->numRows()) {
@@ -417,7 +414,7 @@ class XnetEventsModule extends PLModule
             }
 
             // Store the modifications in the database
-            XDB::execute('REPLACE INTO groupex.evenements
+            XDB::execute('REPLACE INTO #groupex#.evenements
                 SET eid={?}, asso_id={?}, organisateur_uid={?}, intitule={?},
                     paiement_id = {?}, descriptif = {?}, debut = {?},
                     fin = {?}, show_participants = {?}, short_name = {?},
@@ -444,12 +441,12 @@ class XnetEventsModule extends PLModule
                     $montant = strtr(Post::v('montant'.$i), ',', '.');
                     $money_defaut += (float)$montant;
                     XDB::execute("
-                        REPLACE INTO groupex.evenements_items
+                        REPLACE INTO #groupex#.evenements_items
                         VALUES ({?}, {?}, {?}, {?}, {?})",
                         $eid, $i, Post::v('titre'.$i),
                         Post::v('details'.$i), $montant);
                 } else {
-                    XDB::execute("DELETE FROM groupex.evenements_items
+                    XDB::execute("DELETE FROM #groupex#.evenements_items
                                             WHERE eid = {?} AND item_id = {?}", $eid, $i);
                 }
             }
@@ -472,7 +469,7 @@ class XnetEventsModule extends PLModule
 
             // events with no sub-event: add a sub-event with no name
             if ($nb_moments == 0) {
-                XDB::execute("INSERT INTO groupex.evenements_items
+                XDB::execute("INSERT INTO #groupex#.evenements_items
                                    VALUES ({?}, {?}, '', '', 0)", $eid, 1);
             }
 
@@ -493,10 +490,10 @@ class XnetEventsModule extends PLModule
         // when modifying an old event retreive the old datas
         if ($eid) {
             $res = XDB::query(
-                    "SELECT    eid, intitule, descriptif, debut, fin, organisateur_uid,
-                            show_participants, paiement_id, short_name,
-                            deadline_inscription, noinvite, accept_nonmembre
-                       FROM    groupex.evenements
+                    "SELECT  eid, intitule, descriptif, debut, fin, organisateur_uid,
+                             show_participants, paiement_id, short_name,
+                             deadline_inscription, noinvite, accept_nonmembre
+                       FROM  #groupex#.evenements
                       WHERE eid = {?}", $eid);
             $evt = $res->fetchOneAssoc();
             // find out if there is already a request for a payment for this event
@@ -512,10 +509,10 @@ class XnetEventsModule extends PLModule
             $page->assign('evt', $evt);
             // get all the different moments infos
             $res = XDB::iterator(
-                    "SELECT item_id, titre, details, montant
-                       FROM groupex.evenements_items AS ei
-                 INNER JOIN groupex.evenements AS e ON(e.eid = ei.eid)
-                      WHERE e.eid = {?}
+                    "SELECT  item_id, titre, details, montant
+                       FROM  #groupex#.evenements_items AS ei
+                 INNER JOIN  #groupex#.evenements AS e ON(e.eid = ei.eid)
+                      WHERE  e.eid = {?}
                    ORDER BY item_id", $eid);
             $items = array();
             while ($item = $res->next()) {
@@ -552,7 +549,7 @@ class XnetEventsModule extends PLModule
 
             // change the price paid by a participant
             if (Env::v('adm') == 'prix' && $member) {
-                XDB::execute("UPDATE groupex.evenements_participants
+                XDB::execute("UPDATE #groupex#.evenements_participants
                                  SET paid = paid + {?}
                                WHERE uid = {?} AND eid = {?} AND item_id = 1",
                         strtr(Env::v('montant'), ',', '.'),
@@ -562,7 +559,7 @@ class XnetEventsModule extends PLModule
             // change the number of personns coming with a participant
             if (Env::v('adm') == 'nbs' && $member) {
                 $res = XDB::query("SELECT paid
-                                     FROM groupex.evenements_participants
+                                     FROM #groupex#.evenements_participants
                                     WHERE uid = {?} AND eid = {?}",
                                   $member['uid'], $evt['eid']);
 
@@ -571,13 +568,13 @@ class XnetEventsModule extends PLModule
 
                 foreach ($nbs as $id => $nb) {
                     $nb = max(intval($nb), 0);
-                    XDB::execute("REPLACE INTO groupex.evenements_participants
+                    XDB::execute("REPLACE INTO #groupex#.evenements_participants
                                         VALUES ({?}, {?}, {?}, {?}, {?}, {?})",
                                   $evt['eid'], $member['uid'], $id, $nb, '', $id == 1 ? $paid : 0);
                 }
 
                 $res = XDB::query("SELECT COUNT(uid) AS cnt, SUM(nb) AS nb
-                                     FROM groupex.evenements_participants
+                                     FROM #groupex#.evenements_participants
                                     WHERE uid = {?} AND eid = {?}
                                  GROUP BY uid",
                                             $member['uid'], $evt['eid']);
@@ -602,10 +599,10 @@ class XnetEventsModule extends PLModule
                     'SELECT  UPPER(SUBSTRING(IF(u.nom IS NULL, m.nom,
                                                 IF(u.nom_usage<>"", u.nom_usage, u.nom)), 1, 1)),
                              COUNT(DISTINCT ep.uid)
-                       FROM  groupex.evenements_participants AS ep
-                 INNER JOIN  groupex.evenements AS e ON (ep.eid = e.eid)
-                  LEFT JOIN  groupex.membres AS m ON ( ep.uid = m.uid AND e.asso_id = m.asso_id)
-                  LEFT JOIN  auth_user_md5   AS u ON ( u.user_id = ep.uid )
+                       FROM  #groupex#.evenements_participants AS ep
+                 INNER JOIN  #groupex#.evenements              AS e ON (ep.eid = e.eid)
+                  LEFT JOIN  #groupex#.membres                 AS m ON ( ep.uid = m.uid AND e.asso_id = m.asso_id)
+                  LEFT JOIN  #x4dat#.auth_user_md5             AS u ON ( u.user_id = ep.uid )
                       WHERE  ep.eid = {?} '.$whereitemid . '
                    GROUP BY  UPPER(SUBSTRING(IF(u.nom IS NULL,m.nom,u.nom), 1, 1))', $evt['eid']);
 
@@ -626,9 +623,9 @@ class XnetEventsModule extends PLModule
                 "SELECT IF(u.nom_usage<>'', u.nom_usage, u.nom) AS nom, u.prenom,
                         u.promo, a.alias AS email, t.montant
                    FROM {$globals->money->mpay_tprefix}transactions AS t
-             INNER JOIN auth_user_md5 AS u ON(t.uid = u.user_id)
-             INNER JOIN aliases AS a ON (a.id = t.uid AND a.type='a_vie' )
-              LEFT JOIN groupex.evenements_participants AS ep ON(ep.uid = t.uid AND ep.eid = {?})
+             INNER JOIN #x4dat#.auth_user_md5             AS u ON(t.uid = u.user_id)
+             INNER JOIN #x4dat#.aliases                   AS a ON (a.id = t.uid AND a.type='a_vie' )
+              LEFT JOIN #groupex#.evenements_participants AS ep ON(ep.uid = t.uid AND ep.eid = {?})
                   WHERE t.ref = {?} AND ep.uid IS NULL",
                   $evt['eid'], $evt['paiement_id']);
             $page->assign('oublis', $res->total());
@@ -641,12 +638,12 @@ class XnetEventsModule extends PLModule
                                           IF(m.origine = 'X', u.promo, m.origine) AS promo,
                                           IF(m.origine = 'X', FIND_IN_SET('femme', u.flags), m.sexe) AS sexe,
                                           IF(m.origine = 'X', a.alias, m.email) AS email
-                                    FROM  groupex.evenements_participants AS p
-                              INNER JOIN  groupex.membres                 AS m USING(uid)
-                               LEFT JOIN  groupex.evenements_participants AS p2 ON (p2.uid = m.uid AND p2.eid = p.eid
-                                                                                    AND p2.nb != 0)
-                               LEFT JOIN  auth_user_md5                   AS u ON (u.user_id = m.uid)
-                               LEFT JOIN  aliases                         AS a ON (a.id = u.user_id AND a.type = 'a_vie')
+                                    FROM  #groupex#.evenements_participants AS p
+                              INNER JOIN  #groupex#.membres                 AS m USING(uid)
+                               LEFT JOIN  #groupex#.evenements_participants AS p2 ON (p2.uid = m.uid AND p2.eid = p.eid
+                                                                                      AND p2.nb != 0)
+                               LEFT JOIN  #x4dat#.auth_user_md5             AS u ON (u.user_id = m.uid)
+                               LEFT JOIN  #x4dat#.aliases                   AS a ON (a.id = u.user_id AND a.type = 'a_vie')
                                    WHERE  p.eid = {?} AND p2.eid IS NULL
                                        " . (Env::v('initiale') ? " AND IF(u.nom IS NULL, m.nom,
                                           IF(u.nom_usage<>'', u.nom_usage, u.nom)) LIKE '" . Env::v('initiale') . "%'"
index 9e79dfd..d2725d4 100644 (file)
@@ -35,15 +35,15 @@ function get_event_detail($eid, $item_id = false, $asso_id = null)
                  al.vid AS absent_list, pl.vid AS participant_list,
                  bl.vid AS payed_list, ul.vid AS booked_unpayed_list,
                  a.nom, a.prenom, a.promo, aa.alias
-           FROM  groupex.evenements              AS e
-     INNER JOIN  x4dat.auth_user_md5             AS a  ON a.user_id = e.organisateur_uid
-     INNER JOIN  x4dat.aliases                   AS aa ON (aa.type = 'a_vie' AND aa.id = a.user_id)
-     INNER JOIN  groupex.evenements_items        AS ei ON (e.eid = ei.eid)
-      LEFT JOIN  groupex.evenements_participants AS ep ON (e.eid = ep.eid AND ei.item_id = ep.item_id)
-      LEFT JOIN  virtual AS al ON (al.type = 'evt' AND al.alias = CONCAT(short_name, {?}))
-      LEFT JOIN  virtual AS pl ON (pl.type = 'evt' AND pl.alias = CONCAT(short_name, {?}))
-      LEFT JOIN  virtual AS bl ON (bl.type = 'evt' AND bl.alias = CONCAT(short_name, {?}))
-      LEFT JOIN  virtual AS ul ON (ul.type = 'evt' AND ul.alias = CONCAT(short_name, {?}))
+           FROM  #groupex#.evenements              AS e
+     INNER JOIN  #x4dat#.auth_user_md5             AS a  ON a.user_id = e.organisateur_uid
+     INNER JOIN  #x4dat#.aliases                   AS aa ON (aa.type = 'a_vie' AND aa.id = a.user_id)
+     INNER JOIN  #groupex#.evenements_items        AS ei ON (e.eid = ei.eid)
+      LEFT JOIN  #groupex#.evenements_participants AS ep ON (e.eid = ep.eid AND ei.item_id = ep.item_id)
+      LEFT JOIN  #x4dat#.virtual                   AS al ON (al.type = 'evt' AND al.alias = CONCAT(short_name, {?}))
+      LEFT JOIN  #x4dat#.virtual                   AS pl ON (pl.type = 'evt' AND pl.alias = CONCAT(short_name, {?}))
+      LEFT JOIN  #x4dat#.virtual                   AS bl ON (bl.type = 'evt' AND bl.alias = CONCAT(short_name, {?}))
+      LEFT JOIN  #x4dat#.virtual                   AS ul ON (ul.type = 'evt' AND ul.alias = CONCAT(short_name, {?}))
           WHERE  (e.eid = {?} OR e.short_name = {?}) AND ei.item_id = {?} AND e.asso_id = {?}
        GROUP BY  ei.item_id",
         '-absents@' . $globals->xnet->evts_domain,
@@ -65,9 +65,9 @@ function get_event_detail($eid, $item_id = false, $asso_id = null)
     if (!$item_id) {
         $res = XDB::query(
                "SELECT MAX(nb)
-                  FROM groupex.evenements              AS e
-            INNER JOIN groupex.evenements_items        AS ei ON (e.eid = ei.eid)
-             LEFT JOIN groupex.evenements_participants AS ep
+                  FROM #groupex#.evenements              AS e
+            INNER JOIN #groupex#.evenements_items        AS ei ON (e.eid = ei.eid)
+             LEFT JOIN #groupex#.evenements_participants AS ep
                        ON (e.eid = ep.eid AND ei.item_id = ep.item_id)
                  WHERE e.eid = {?}
               GROUP BY ep.uid", $evt['eid']);
@@ -78,8 +78,8 @@ function get_event_detail($eid, $item_id = false, $asso_id = null)
 
     $res = XDB::query(
         "SELECT titre, details, montant, ei.item_id, nb, ep.paid, FIND_IN_SET('notify_payment', ep.flags) AS notify_payment
-           FROM groupex.evenements_items        AS ei
-      LEFT JOIN groupex.evenements_participants AS ep
+           FROM #groupex#.evenements_items        AS ei
+      LEFT JOIN #groupex#.evenements_participants AS ep
                 ON (ep.eid = ei.eid AND ep.item_id = ei.item_id AND uid = {?})
           WHERE ei.eid = {?}",
             S::v('uid'), $evt['eid']);
@@ -143,11 +143,11 @@ function get_event_participants(&$evt, $item_id, $tri, $limit = '') {
                    (m.origine = 'X' OR m.origine IS NULL) AS x,
                    ep.uid, SUM(ep.paid) AS paid, SUM(ep.nb) AS nb,
                    FIND_IN_SET('notify_payment', ep.flags) AS notify_payment
-             FROM  groupex.evenements_participants AS ep
-       INNER JOIN  groupex.evenements AS e ON (ep.eid = e.eid)
-        LEFT JOIN  groupex.membres AS m ON ( ep.uid = m.uid AND e.asso_id = m.asso_id)
-        LEFT JOIN  auth_user_md5   AS u ON ( u.user_id = ep.uid )
-        LEFT JOIN  aliases         AS a ON ( a.id = ep.uid AND a.type='a_vie' )
+             FROM  #groupex#.evenements_participants AS ep
+       INNER JOIN  #groupex#.evenements  AS e ON (ep.eid = e.eid)
+        LEFT JOIN  #groupex#.membres     AS m ON ( ep.uid = m.uid AND e.asso_id = m.asso_id)
+        LEFT JOIN  #x4dat#.auth_user_md5 AS u ON ( u.user_id = ep.uid )
+        LEFT JOIN  #x4dat#.aliases       AS a ON ( a.id = ep.uid AND a.type='a_vie' )
             WHERE  ep.eid = {?}
                     ".(($item_id)?" AND item_id = $item_id":"")."
                     $where
@@ -188,8 +188,8 @@ function get_event_participants(&$evt, $item_id, $tri, $limit = '') {
         $u['telepayment'] = $u['paid'] - $u['adminpaid'];
         $res_ = XDB::iterator(
                 "SELECT  ep.nb, ep.item_id, ei.montant
-                   FROM  groupex.evenements_participants AS ep
-             INNER JOIN  groupex.evenements_items AS ei ON (ei.eid = ep.eid AND ei.item_id = ep.item_id)
+                   FROM  #groupex#.evenements_participants AS ep
+             INNER JOIN  #groupex#.evenements_items AS ei ON (ei.eid = ep.eid AND ei.item_id = ep.item_id)
                   WHERE  ep.eid = {?} AND ep.uid = {?}",
             $eid, $u['uid']);
         while ($i = $res_->next()) {
@@ -222,7 +222,7 @@ function subscribe_lists_event($participate, $uid, $evt, $paid, $payment = null)
         $email = $user->forlifeEmail();
     } else {
         $res = XDB::query("SELECT  email
-                             FROM  groupex.membres
+                             FROM  #groupex#.membres
                             WHERE  uid = {?} AND asso_id = {?}",
                           $uid, $globals->asso('id'));
         $email = $res->fetchOneCell();
@@ -293,7 +293,7 @@ function event_change_shortname(&$page, $eid, $old, $new)
     //vérifier que l'alias n'est pas déja pris
     if ($new && $old != $new) {
         $res = XDB::query('SELECT COUNT(*)
-                             FROM groupex.evenements
+                             FROM #groupex#.evenements
                             WHERE short_name = {?}',
                            $new);
         if ($res->fetchOneCell() > 0) {
@@ -338,20 +338,20 @@ function event_change_shortname(&$page, $eid, $old, $new)
         foreach (array('-participants@', '-paye@', '-participants-non-paye@') as $v) {
             XDB::execute("INSERT IGNORE INTO virtual_redirect (
                 SELECT  {?} AS vid, IF(a.alias IS NULL, m.email, CONCAT(a.alias, {?})) AS redirect
-                  FROM  groupex.evenements_participants AS ep
-             LEFT JOIN  groupex.membres AS m ON (ep.uid = m.uid)
-             LEFT JOIN  auth_user_md5   AS u ON (u.user_id = ep.uid)
-             LEFT JOIN  aliases         AS a ON (a.id = ep.uid AND a.type = 'a_vie')
+                  FROM  #groupex#.evenements_participants AS ep
+             LEFT JOIN  #groupex#.membres     AS m ON (ep.uid = m.uid)
+             LEFT JOIN  #x4dat#.auth_user_md5 AS u ON (u.user_id = ep.uid)
+             LEFT JOIN  #x4dat#.aliases       AS a ON (a.id = ep.uid AND a.type = 'a_vie')
                  WHERE  ep.eid = {?} AND " . $where[$v] . "
               GROUP BY  ep.uid)",
                 $lastid[$v], '@' . $globals->mail->domain, $eid);
         }
         XDB::execute("INSERT IGNORE INTO virtual_redirect (
             SELECT  {?} AS vid, IF(a.alias IS NULL, m.email, CONCAT(a.alias, {?})) AS redirect
-              FROM  groupex.membres AS m
-         LEFT JOIN  groupex.evenements_participants AS ep ON (ep.uid = m.uid AND ep.eid = {?})
-         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 ')
+              FROM  #groupex#.membres     AS m
+         LEFT JOIN  #groupex#.evenements_participants AS ep ON (ep.uid = m.uid AND ep.eid = {?})
+         LEFT JOIN  #x4dat#.auth_user_md5 AS u ON (u.user_id = m.uid)
+         LEFT JOIN  #x4dat#.aliases       AS a ON (a.id = m.uid AND a.type = 'a_vie')
              WHERE  m.asso_id = {?} AND ep.uid IS NULL
           GROUP BY  m.uid)",
             $lastid['-absents@'], '@' . $globals->mail->domain, $eid, $globals->asso('id'));
index 4454a63..6c71978 100644 (file)
@@ -35,7 +35,7 @@ function get_infos($email)
 
     $res = XDB::query(
             "SELECT  uid, nom, prenom, email, email AS email2, perms='admin', origine, comm, sexe
-               FROM  groupex.membres
+               FROM  #groupex#.membres
               WHERE  $field = {?} AND asso_id = {?}", $email, $globals->asso('id'));
 
     if ($res->numRows()) {
@@ -56,10 +56,10 @@ function get_infos($email)
                          CONCAT(b.alias, '@polytechnique.org') AS email2,
                          m.perms = 'admin' AS perms, m.origine, m.comm,
                          FIND_IN_SET('femme', u.flags) AS sexe
-                   FROM  auth_user_md5   AS u
-             INNER JOIN  aliases         AS a ON ( u.user_id = a.id AND a.type != 'homonyme' )
-             INNER JOIN  aliases         AS b ON ( u.user_id = b.id AND b.type = 'a_vie' )
-              LEFT JOIN  groupex.membres AS m ON ( m.uid = u.user_id AND asso_id={?})
+                   FROM  #x4dat#.auth_user_md5 AS u
+             INNER JOIN  #x4dat#.aliases       AS a ON ( u.user_id = a.id AND a.type != 'homonyme' )
+             INNER JOIN  #x4dat#.aliases       AS b ON ( u.user_id = b.id AND b.type = 'a_vie' )
+              LEFT JOIN  #groupex#.membres     AS m ON ( m.uid = u.user_id AND asso_id={?})
                   WHERE  a.alias = {?} AND u.user_id < 50000", $globals->asso('id'), $mbox);
         return $res->fetchOneAssoc();
     }
@@ -115,26 +115,26 @@ class XnetGrpModule extends PLModule
 
         if (S::logged()) {
             if (Env::has('read')) {
-                XDB::query('DELETE groupex.r.*
-                              FROM groupex.announces_read AS r
-                        INNER JOIN groupex.announces AS a ON a.id = r.announce_id
+                XDB::query('DELETE #groupex#.r.*
+                              FROM #groupex#.announces_read AS r
+                        INNER JOIN #groupex#.announces AS a ON a.id = r.announce_id
                              WHERE peremption < CURRENT_DATE()');
-                XDB::query('INSERT INTO groupex.announces_read
+                XDB::query('INSERT INTO #groupex#.announces_read
                                  VALUES ({?}, {?})',
                             Env::i('read'), S::i('uid'));
                 pl_redirect("");
             }
             if (Env::has('unread')) {
-                XDB::query('DELETE FROM groupex.announces_read
+                XDB::query('DELETE FROM #groupex#.announces_read
                                   WHERE announce_id={?} AND user_id={?}',
                             Env::i('unread'), S::i('uid'));
                 pl_redirect("#art" . Env::i('unread'));
             }
             $arts = XDB::iterator("SELECT a.*, u.nom, u.prenom, u.promo, u.hruid,
                                           FIND_IN_SET('photo', a.flags) AS photo
-                                     FROM groupex.announces AS a
-                               INNER JOIN auth_user_md5 AS u USING(user_id)
-                                LEFT JOIN groupex.announces_read AS r ON (r.user_id = {?} AND r.announce_id = a.id)
+                                     FROM #groupex#.announces      AS a
+                               INNER JOIN #x4dat#.auth_user_md5    AS u USING(user_id)
+                                LEFT JOIN #groupex#.announces_read AS r ON (r.user_id = {?} AND r.announce_id = a.id)
                                     WHERE asso_id = {?} AND peremption >= CURRENT_DATE()
                                           AND (promo_min = 0 OR promo_min <= {?})
                                           AND (promo_max = 0 OR promo_max >= {?})
@@ -142,8 +142,8 @@ class XnetGrpModule extends PLModule
                                  ORDER BY a.peremption",
                                    S::i('uid'), $globals->asso('id'), S::i('promo'), S::i('promo'));
             $index = XDB::iterator("SELECT a.id, a.titre, r.user_id IS NULL AS nonlu
-                                      FROM groupex.announces AS a
-                                 LEFT JOIN groupex.announces_read AS r ON (a.id = r.announce_id AND r.user_id = {?})
+                                      FROM #groupex#.announces AS a
+                                 LEFT JOIN #groupex#.announces_read AS r ON (a.id = r.announce_id AND r.user_id = {?})
                                      WHERE asso_id = {?} AND peremption >= CURRENT_DATE()
                                            AND (promo_min = 0 OR promo_min <= {?})
                                            AND (promo_max = 0 OR promo_max >= {?})
@@ -152,15 +152,15 @@ class XnetGrpModule extends PLModule
             $page->assign('article_index', $index);
         } else {
             $arts = XDB::iterator("SELECT a.*, u.nom, u.prenom, u.promo, FIND_IN_SET('photo', a.flags) AS photo
-                                     FROM groupex.announces AS a
-                               INNER JOIN auth_user_md5 AS u USING(user_id)
+                                     FROM #groupex#.announces   AS a
+                               INNER JOIN #x4dat#.auth_user_md5 AS u USING(user_id)
                                     WHERE asso_id = {?} AND peremption >= CURRENT_DATE()
                                           AND FIND_IN_SET('public', u.flags)",
                                   $globals->asso('id'));
         }
         if (may_update()) {
             $subs_valid = XDB::query("SELECT  uid
-                                        FROM  groupex.membres_sub_requests
+                                        FROM  #groupex#.membres_sub_requests
                                        WHERE  asso_id = {?}",
                                      $globals->asso('id'));
             $page->assign('requests', $subs_valid->numRows());
@@ -182,26 +182,16 @@ class XnetGrpModule extends PLModule
         global $globals;
 
         $res = XDB::query("SELECT logo, logo_mime
-                             FROM groupex.asso WHERE id = {?}",
+                             FROM #groupex#.asso WHERE id = {?}",
                           $globals->asso('id'));
         list($logo, $logo_mime) = $res->fetchOneRow();
 
+        pl_cached_dynamic_content_headers(empty($logo) ? "image/jpeg" : $logo_mime);
         if (!empty($logo)) {
-            header("Content-type: $mime");
-            header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
-            header('Last-Modified:' . gmdate('D, d M Y H:i:s') . ' GMT');
-            header('Cache-Control: no-cache, must-revalidate');
-            header('Pragma: no-cache');
             echo $logo;
         } else {
-            header('Content-type: image/jpeg');
-            header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
-            header('Last-Modified:' . gmdate('D, d M Y H:i:s') . ' GMT');
-            header('Cache-Control: no-cache, must-revalidate');
-            header('Pragma: no-cache');
-            readfile(dirname(__FILE__).'/../htdocs/images/dflt_carre.jpg');
+            readfile(dirname(__FILE__) . '/../htdocs/images/dflt_carre.jpg');
         }
-
         exit;
     }
 
@@ -244,7 +234,7 @@ class XnetGrpModule extends PLModule
                     return;
                 }
                 XDB::execute(
-                    "UPDATE  groupex.asso
+                    "UPDATE  #groupex#.asso
                         SET  nom={?}, diminutif={?}, cat={?}, dom={?},
                              descr={?}, site={?}, mail={?}, resp={?},
                              forum={?}, mail_domain={?}, ax={?}, pub={?},
@@ -265,7 +255,7 @@ class XnetGrpModule extends PLModule
                 }
             } else {
                 XDB::execute(
-                    "UPDATE  groupex.asso
+                    "UPDATE  #groupex#.asso
                         SET  descr={?}, site={?}, mail={?}, resp={?},
                              forum={?}, pub= {?}, sub_url={?},
                              unsub_url={?},flags={?}
@@ -280,7 +270,7 @@ class XnetGrpModule extends PLModule
             if ($_FILES['logo']['name']) {
                 $logo = file_get_contents($_FILES['logo']['tmp_name']);
                 $mime = $_FILES['logo']['type'];
-                XDB::execute('UPDATE groupex.asso
+                XDB::execute('UPDATE #groupex#.asso
                                  SET logo={?}, logo_mime={?}
                                WHERE id={?}', $logo, $mime,
                              $globals->asso('id'));
@@ -290,7 +280,7 @@ class XnetGrpModule extends PLModule
         }
 
         if (S::admin()) {
-            $dom = XDB::iterator('SELECT * FROM groupex.dom ORDER BY nom');
+            $dom = XDB::iterator('SELECT * FROM #groupex#.dom ORDER BY nom');
             $page->assign('dom', $dom);
             $page->assign('super', true);
         }
@@ -380,8 +370,8 @@ class XnetGrpModule extends PLModule
                         'SELECT  UPPER(SUBSTRING(
                                     IF(m.origine="X", IF(u.nom_usage<>"", u.nom_usage, u.nom),m.nom),
                                      1, 1)) as letter, COUNT(*)
-                           FROM  groupex.membres AS m
-                      LEFT JOIN  auth_user_md5   AS u ON ( u.user_id = m.uid)
+                           FROM  #groupex#.membres     AS m
+                      LEFT JOIN  #x4dat#.auth_user_md5 AS u ON ( u.user_id = m.uid)
                           WHERE  asso_id = {?} and (u.perms != \'pending\' OR m.email IS NOT NULL)
                        GROUP BY  letter
                        ORDER BY  letter', $globals->asso('id'));
@@ -390,8 +380,8 @@ class XnetGrpModule extends PLModule
                         'SELECT  IF(m.origine="X",u.promo,
                                     IF(m.origine="ext", "extérieur", "personne morale")) AS promo,
                                  COUNT(*), IF(m.origine="X",u.promo,"") AS promo_o
-                           FROM  groupex.membres AS m
-                      LEFT JOIN  auth_user_md5   AS u ON ( u.user_id = m.uid )
+                           FROM  #groupex#.membres     AS m
+                      LEFT JOIN  #x4dat#.auth_user_md5 AS u ON ( u.user_id = m.uid )
                           WHERE  asso_id = {?}
                        GROUP BY  promo
                        ORDER BY  promo_o DESC', $globals->asso('id'));
@@ -452,10 +442,10 @@ class XnetGrpModule extends PLModule
                            u.perms!='pending' AS inscrit,
                            m.comm as comm,
                            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' )
-                LEFT JOIN  emails          AS e ON ( e.flags = 'active' AND e.uid = m.uid)
+                     FROM  #groupex#.membres     AS m
+                LEFT JOIN  #x4dat#.auth_user_md5 AS u ON ( u.user_id = m.uid )
+                LEFT JOIN  #x4dat#.aliases       AS a ON ( a.id = m.uid AND a.type='a_vie' )
+                LEFT JOIN  #x4dat#.emails        AS e ON ( e.flags = 'active' AND e.uid = m.uid)
                     WHERE  m.asso_id = {?} $ini
                            AND (m.origine != 'X' OR u.perms != 'pending' OR m.email IS NOT NULL)
                  GROUP BY  m.uid
@@ -479,7 +469,7 @@ class XnetGrpModule extends PLModule
     {
         global $globals;
         $res = XDB::query('SELECT  uid
-                             FROM  groupex.membres
+                             FROM  #groupex#.membres
                             WHERE  asso_id = {?}', $globals->asso('id'));
         $vcard = new VCard($photos == 'photos', 'Membre du groupe ' . $globals->asso('nom'));
         $vcard->addUsers($res->fetchColumn());
@@ -499,17 +489,15 @@ class XnetGrpModule extends PLModule
                            IF(m.origine='X' AND u.perms != 'pending',CONCAT(a.alias, '@', {?}), m.email) AS email,
                            IF(m.origine='X',FIND_IN_SET('femme', u.flags), m.sexe) AS femme,
                            m.comm as comm
-                     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' )
+                     FROM  #groupex#.membres     AS m
+                LEFT JOIN  #x4dat#.auth_user_md5 AS u ON ( u.user_id = m.uid )
+                LEFT JOIN  #x4dat#.aliases       AS a ON ( a.id = m.uid AND a.type = 'a_vie' )
                     WHERE  m.asso_id = {?}
                            AND (m.origine != 'X' OR u.perms != 'pending' OR m.email IS NOT NULL)
                  GROUP BY  m.uid
                  ORDER BY  nom, prenom",
                  $globals->mail->domain, $globals->asso('id'));
-        header('Content-Type: text/x-csv; charset=utf-8;');
-        header('Pragma: ');
-        header('Cache-Control: ');
+        pl_content_headers("text/x-csv");
         $page->changeTpl('xnetgrp/annuaire-csv.tpl', NO_SKIN);
         $page->assign('ann', $ann);
     }
@@ -517,7 +505,7 @@ class XnetGrpModule extends PLModule
     private function removeSubscriptionRequest($uid)
     {
         global $globals;
-        XDB::execute("DELETE FROM groupex.membres_sub_requests
+        XDB::execute("DELETE FROM #groupex#.membres_sub_requests
                             WHERE asso_id = {?} AND uid = {?}",
                      $globals->asso('id'), $uid);
     }
@@ -526,7 +514,7 @@ class XnetGrpModule extends PLModule
     {
         global $globals;
         $this->removeSubscriptionRequest($user->id());
-        XDB::execute("INSERT IGNORE INTO  groupex.membres (asso_id, uid)
+        XDB::execute("INSERT IGNORE INTO  #groupex#.membres (asso_id, uid)
                                   VALUES  ({?}, {?})",
                      $globals->asso('id'), $user->id());
         if (XDB::affectedRows() == 1) {
@@ -567,13 +555,13 @@ class XnetGrpModule extends PLModule
 
             // Retrieves the subscription status, and the reason.
             $res = XDB::query("SELECT  reason
-                                 FROM  groupex.membres_sub_requests
+                                 FROM  #groupex#.membres_sub_requests
                                 WHERE  asso_id = {?} AND uid = {?}",
                               $globals->asso('id'), $user->id());
             $reason = ($res->numRows() ? $res->fetchOneCell() : null);
 
             $res = XDB::query("SELECT  COUNT(*)
-                                 FROM  groupex.membres
+                                 FROM  #groupex#.membres
                                 WHERE  asso_id = {?} AND uid = {?}",
                               $globals->asso('id'), $user->id());
             $already_member = ($res->fetchOneCell() > 0);
@@ -611,7 +599,7 @@ class XnetGrpModule extends PLModule
         }
 
         $res = XDB::query("SELECT  uid
-                             FROM  groupex.membres_sub_requests
+                             FROM  #groupex#.membres_sub_requests
                             WHERE  uid = {?} AND asso_id = {?}",
                          S::i('uid'), $globals->asso('id'));
         if ($res->numRows() != 0) {
@@ -622,14 +610,14 @@ class XnetGrpModule extends PLModule
         if (Post::has('inscrire')) {
             S::assert_xsrf_token();
 
-            XDB::execute("INSERT INTO  groupex.membres_sub_requests (asso_id, uid, ts, reason)
+            XDB::execute("INSERT INTO  #groupex#.membres_sub_requests (asso_id, uid, ts, reason)
                                VALUES  ({?}, {?}, NOW(), {?})",
                          $globals->asso('id'), S::i('uid'), Post::v('message'));
             $res = XDB::query('SELECT  IF(m.email IS NULL,
                                           CONCAT(al.alias,"@polytechnique.org"),
                                            m.email)
-                                 FROM  groupex.membres AS m
-                           INNER JOIN  aliases         AS al ON (al.type = "a_vie"
+                                 FROM  #groupex#.membres AS m
+                           INNER JOIN  #x4dat#.aliases   AS al ON (al.type = "a_vie"
                                                                  AND al.id = m.uid)
                                 WHERE  perms="admin" AND m.asso_id = {?}',
                              $globals->asso('id'));
@@ -687,8 +675,8 @@ class XnetGrpModule extends PLModule
 
         $it = XDB::iterator("SELECT  IF(u.nom_usage != '', u.nom_usage, u.nom) AS nom,
                                      u.prenom, u.promo, u.hruid, s.ts AS date
-                               FROM  groupex.membres_sub_requests AS s
-                         INNER JOIN  auth_user_md5 AS u ON (s.uid = u.user_id)
+                               FROM  #groupex#.membres_sub_requests AS s
+                         INNER JOIN  #x4dat#.auth_user_md5          AS u ON (s.uid = u.user_id)
                               WHERE  asso_id = {?}
                            ORDER BY  nom, prenom",
                            $globals->asso('id'));
@@ -751,9 +739,9 @@ class XnetGrpModule extends PLModule
         foreach ($subscribers as $mail) {
             $res = XDB::query(
                        'SELECT  COUNT(*)
-                          FROM  groupex.membres AS m
-                     LEFT JOIN  auth_user_md5   AS u ON (m.uid=u.user_id AND m.uid<50000)
-                     LEFT JOIN  aliases         AS a ON (a.id=u.user_id and a.type="a_vie")
+                          FROM  #groupex#.membres     AS m
+                     LEFT JOIN  #x4dat#.auth_user_md5 AS u ON (m.uid = u.user_id AND m.uid < 50000)
+                     LEFT JOIN  #x4dat#.aliases       AS a ON (a.id = u.user_id and a.type = "a_vie")
                          WHERE  asso_id = {?} AND
                                 (m.email = {?} OR CONCAT(a.alias, "@polytechnique.org") = {?})',
                         $globals->asso('id'), $mail, $mail);
@@ -787,7 +775,7 @@ class XnetGrpModule extends PLModule
         if (!User::isForeignEmailAddress($email)) {
             $user = User::get($email);
             if ($user) {
-                XDB::execute("REPLACE INTO  groupex.membres (uid, asso_id, origine)
+                XDB::execute("REPLACE INTO  #groupex#.membres (uid, asso_id, origine)
                                     VALUES  ({?}, {?}, 'X')",
                              $user->id(), $globals->asso('id'));
                 pl_redirect("member/" . $user->login());
@@ -808,7 +796,7 @@ class XnetGrpModule extends PLModule
                                 $market->add();
                             }
                         }
-                        XDB::execute('REPLACE INTO  groupex.membres (uid, asso_id, origine, email)
+                        XDB::execute('REPLACE INTO  #groupex#.membres (uid, asso_id, origine, email)
                                             VALUES  ({?}, {?}, "X", {?})',
                                      $uid, $globals->asso('id'), $email);
                         $this->removeSubscriptionRequest($uid);
@@ -816,9 +804,9 @@ class XnetGrpModule extends PLModule
                     }
                     $page->trigError("Utilisateur invalide");
                 } else {
-                    $res = XDB::query('SELECT MAX(uid)+1 FROM groupex.membres');
+                    $res = XDB::query('SELECT MAX(uid) + 1 FROM #groupex#.membres');
                     $uid = max(intval($res->fetchOneCell()), 50001);
-                    XDB::execute('REPLACE INTO  groupex.membres (uid, asso_id, origine, email)
+                    XDB::execute('REPLACE INTO  #groupex#.membres (uid, asso_id, origine, email)
                                         VALUES  ({?}, {?}, "ext", {?})',
                                  $uid, $globals->asso('id'), $email);
                     pl_redirect("member/$email");
@@ -831,7 +819,7 @@ class XnetGrpModule extends PLModule
 
     function handler_admin_member_new_ajax(&$page)
     {
-        header('Content-Type: text/html; charset="UTF-8"');
+        pl_content_headers("text/html");
         $page->changeTpl('xnetgrp/membres-new-search.tpl', NO_SKIN);
         $res = null;
         if (Env::has('login')) {
@@ -867,15 +855,15 @@ class XnetGrpModule extends PLModule
     {
         global $globals;
         XDB::execute(
-                "DELETE FROM  groupex.membres WHERE uid={?} AND asso_id={?}",
+                "DELETE FROM  #groupex#.membres WHERE uid={?} AND asso_id={?}",
                 $user['uid'], $globals->asso('id'));
 
         if ($globals->asso('notif_unsub')) {
             $mailer = new PlMailer('xnetgrp/unsubscription-notif.mail.tpl');
             $res = XDB::iterRow("SELECT  a.alias, u.prenom, IF(u.nom_usage != '', u.nom_usage, u.nom) AS nom
-                                   FROM  groupex.membres AS m
-                             INNER JOIN  aliases AS a ON (m.uid = a.id AND FIND_IN_SET('bestalias', a.flags))
-                             INNER JOIn  auth_user_md5 AS u ON (u.user_id = a.id)
+                                   FROM  #groupex#.membres     AS m
+                             INNER JOIN  #x4dat#.aliases       AS a ON (m.uid = a.id AND FIND_IN_SET('bestalias', a.flags))
+                             INNER JOIn  #x4dat#.auth_user_md5 AS u ON (u.user_id = a.id)
                                   WHERE  m.asso_id = {?} AND m.perms = 'admin'",
                                   $globals->asso('id'));
             while (list($alias, $prenom, $nom) = $res->next()) {
@@ -998,17 +986,17 @@ class XnetGrpModule extends PLModule
         // Check if the user is already in the group
         global $globals;
         $res = XDB::query("SELECT  uid, email
-                             FROM  groupex.membres
+                             FROM  #groupex#.membres
                             WHERE  uid = {?} AND asso_id = {?}",
                           $uid, $globals->asso('id'));
         if ($res->numRows()) {
             list($uid, $email) = $res->fetchOneRow();
-            XDB::execute("DELETE FROM groupex.membres
+            XDB::execute("DELETE FROM #groupex#.membres
                                 WHERE uid = {?}",
                          $user['uid']);
         } else {
             $email = $user['email'];
-            XDB::execute("UPDATE  groupex.membres
+            XDB::execute("UPDATE  #groupex#.membres
                              SET  uid = {?}, origine = 'X'
                            WHERE  uid = {?} AND asso_id = {?}",
                          $uid, $user['uid'], $globals->asso('id'));
@@ -1072,9 +1060,9 @@ class XnetGrpModule extends PLModule
                 $user['prenom']  = (Post::v('origine') == 'ext') ? Post::v('prenom') : '';
                 $user['sexe']    = (Post::v('origine') == 'ext') ? Post::v('sexe') : 0;
                 $user['origine'] = Post::v('origine');
-                XDB::query('UPDATE groupex.membres
-                               SET prenom={?}, nom={?}, email={?}, sexe={?}, origine={?}
-                             WHERE uid={?} AND asso_id={?}',
+                XDB::query('UPDATE  #groupex#.membres
+                               SET  prenom = {?}, nom = {?}, email = {?}, sexe = {?}, origine = {?}
+                             WHERE  uid = {?} AND asso_id = {?}',
                            $user['prenom'], $user['nom'], Post::v('email'),
                            $user['sexe'], $user['origine'],
                            $user['uid'], $globals->asso('id'));
@@ -1086,9 +1074,9 @@ class XnetGrpModule extends PLModule
             $perms = Post::i('is_admin');
             $comm  = trim(Post::s('comm'));
             if ($user['perms'] != $perms || $user['comm'] != $comm) {
-                XDB::query('UPDATE groupex.membres
-                               SET perms={?}, comm={?}
-                             WHERE uid={?} AND asso_id={?}',
+                XDB::query('UPDATE  #groupex#.membres
+                               SET  perms = {?}, comm = {?}
+                             WHERE  uid = {?} AND asso_id = {?}',
                             $perms ? 'admin' : 'membre', $comm,
                             $user['uid'], $globals->asso('id'));
                 if ($perms != $user['perms']) {
@@ -1192,23 +1180,23 @@ class XnetGrpModule extends PLModule
 
     function handler_photo_announce(&$page, $eid = null) {
         if ($eid) {
-            $res = XDB::query("SELECT * FROM groupex.announces_photo WHERE eid = {?}", $eid);
+            $res = XDB::query("SELECT * FROM #groupex#.announces_photo WHERE eid = {?}", $eid);
             if ($res->numRows()) {
                 $photo = $res->fetchOneAssoc();
-                header('Content-Type: image/' . $photo['attachmime']);
+                pl_cached_dynamic_content_headers("image/" . $photo['attachmime']);
                 echo $photo['attach'];
                 exit;
             }
         } else {
             $upload = new PlUpload(S::user()->login(), 'xnetannounce');
             if ($upload->exists() && $upload->isType('image')) {
-                header('Content-Type: ' . $upload->contentType());
+                pl_cached_dynamic_content_headers($upload->contentType());
                 echo $upload->getContents();
                 exit;
             }
         }
         global $globals;
-        header('Content-Type: image/png');
+        pl_cached_dynamic_content_headers("image/png");
         echo file_get_contents($globals->spoolroot . '/htdocs/images/logo.png');
         exit;
     }
@@ -1269,7 +1257,7 @@ class XnetGrpModule extends PLModule
             }
             $art['photo'] = $upload->exists() || Post::i('photo');
             if (Post::v('valid') == 'Pas d\'image' && !is_null($aid)) {
-                XDB::query("DELETE FROM groupex.announces_photo WHERE eid = {?}", $aid);
+                XDB::query("DELETE FROM #groupex#.announces_photo WHERE eid = {?}", $aid);
                 $upload->rm();
                 Post::kill('valid');
                 $art['photo'] = false;
@@ -1298,7 +1286,7 @@ class XnetGrpModule extends PLModule
                     $post = $banana->post($globals->asso('forum'), null,
                                           $art['titre'], MiniWiki::wikiToText($fulltext, false, 0, 80));
                 }*/
-                XDB::query("INSERT INTO groupex.announces
+                XDB::query("INSERT INTO #groupex#.announces
                                  (user_id, asso_id, create_date, titre, texte, contacts,
                                    peremption, promo_min, promo_max, flags, post_id)
                             VALUES ({?}, {?}, NOW(), {?}, {?}, {?}, {?}, {?}, {?}, {?}, {?})",
@@ -1307,7 +1295,7 @@ class XnetGrpModule extends PLModule
                 $aid = XDB::insertId();
                 if ($art['photo']) {
                     list($imgx, $imgy, $imgtype) = $upload->imageInfo();
-                    XDB::execute("INSERT INTO groupex.announces_photo
+                    XDB::execute("INSERT INTO #groupex#.announces_photo
                                           SET eid = {?}, attachmime = {?}, x = {?}, y = {?}, attach = {?}",
                                  $aid, $imgtype, $imgx, $imgy, $upload->getContents());
                 }
@@ -1329,7 +1317,7 @@ class XnetGrpModule extends PLModule
                     $page->trigWarning("La parution dans la Lettre Mensuelle est en attente de validation.");
                 }
             } else {
-                XDB::query("UPDATE groupex.announces
+                XDB::query("UPDATE #groupex#.announces
                                SET titre={?}, texte={?}, contacts={?}, peremption={?},
                                    promo_min={?}, promo_max={?}, flags={?}
                              WHERE id={?} AND asso_id={?}",
@@ -1338,8 +1326,8 @@ class XnetGrpModule extends PLModule
                            $art['id'], $globals->asso('id'));
                 if ($art['photo'] && $upload->exists()) {
                     list($imgx, $imgy, $imgtype) = $upload->imageInfo();
-                    XDB::execute("REPLACE INTO groupex.announces_photo
-                                          SET eid = {?}, attachmime = {?}, x = {?}, y = {?}, attach = {?}",
+                    XDB::execute("REPLACE INTO  #groupex#.announces_photo
+                                           SET  eid = {?}, attachmime = {?}, x = {?}, y = {?}, attach = {?}",
                                  $aid, $imgtype, $imgx, $imgy, $upload->getContents());
                     $upload->rm();
                 }
@@ -1353,8 +1341,8 @@ class XnetGrpModule extends PLModule
             $res = XDB::query("SELECT a.*, u.nom, u.prenom, u.promo, u.hruid,
                                       FIND_IN_SET('public', a.flags) AS public,
                                       FIND_IN_SET('photo', a.flags) AS photo
-                                 FROM groupex.announces AS a
-                           INNER JOIN auth_user_md5 AS u USING(user_id)
+                                 FROM #groupex#.announces   AS a
+                           INNER JOIN #x4dat#.auth_user_md5 AS u USING(user_id)
                                 WHERE asso_id = {?} AND a.id = {?}",
                               $globals->asso('id'), $aid);
             if ($res->numRows()) {
@@ -1367,7 +1355,7 @@ class XnetGrpModule extends PLModule
 
         if (is_null($aid)) {
             $events = XDB::iterator("SELECT *
-                                      FROM groupex.evenements
+                                      FROM #groupex#.evenements
                                      WHERE asso_id = {?} AND archive = 0",
                                    $globals->asso('id'));
             if ($events->total()) {
@@ -1387,12 +1375,12 @@ class XnetGrpModule extends PLModule
 
         if (Env::has('del')) {
             S::assert_xsrf_token();
-            XDB::execute("DELETE  FROM groupex.announces
+            XDB::execute("DELETE  FROM #groupex#.announces
                            WHERE  id = {?} AND asso_id = {?}",
                          Env::i('del'), $globals->asso('id'));
         }
         $res = XDB::iterator("SELECT  a.id, a.titre, a.peremption, a.peremption < CURRENT_DATE() AS perime
-                                FROM  groupex.announces AS a
+                                FROM  #groupex#.announces AS a
                                WHERE  a.asso_id = {?}
                             ORDER BY  a.peremption DESC",
                              $globals->asso('id'));
index c367967..88ba32a 100644 (file)
@@ -42,10 +42,10 @@ class XnetGrpEventFeed extends PlFeed
                                          CONCAT(u2.prenom, ' ', IF(u2.nom_usage != '', u2.nom_usage, u2.nom), ' (X',  u2.promo, ')') AS author,
                                          FIND_IN_SET('photo', a.flags) AS photo,
                                          CONCAT({?}, '/#art', a.id) AS link
-                                   FROM auth_user_md5 AS u
-                             INNER JOIN groupex.announces AS a ON ( (a.promo_min = 0 OR a.promo_min <= u.promo)
-                                                                  AND (a.promo_max = 0 OR a.promo_max <= u.promo))
-                             INNER JOIN auth_user_md5 AS u2 ON (u2.user_id = a.user_id)
+                                   FROM #x4dat#.auth_user_md5 AS u
+                             INNER JOIN #groupex#.announces   AS a ON ((a.promo_min = 0 OR a.promo_min <= u.promo)
+                                                                       AND (a.promo_max = 0 OR a.promo_max <= u.promo))
+                             INNER JOIN #x4dat#.auth_user_md5 AS u2 ON (u2.user_id = a.user_id)
                              WHERE u.user_id = {?} AND peremption >= NOW() AND a.asso_id = {?}",
                                    $this->link, $user->id(), $globals->asso('id'));
         } else {
@@ -53,8 +53,8 @@ class XnetGrpEventFeed extends PlFeed
                                          CONCAT(u.prenom, ' ', IF(u.nom_usage != '', u.nom_usage, u.nom), ' (X',  u.promo, ')') AS author,
                                          CONCAT({?}, '/#art', a.id) AS link,
                                          NULL AS photo, NULL AS contacts
-                                    FROM groupex.announces AS a
-                              INNER JOIN auth_user_md5 AS u USING(user_id)
+                                    FROM #groupex#.announces   AS a
+                              INNER JOIN #x4dat#.auth_user_md5 AS u USING(user_id)
                                    WHERE FIND_IN_SET('public', a.flags) AND peremption >= NOW() AND a.asso_id = {?}",
                                   $this->link, $globals->asso('id'));
         }
index 5751457..654add1 100644 (file)
@@ -35,9 +35,9 @@ function get_all_redirects($membres, $mls, &$client)
                              IF(u.prenom <> "", u.prenom, m.prenom) AS prenom,
                              IF(m.email <> "", m.email, CONCAT(a.alias, "@polytechnique.org")) as email,
                              IF(m.sexe IS NULL, FIND_IN_SET("femme", u.flags), m.sexe) AS sexe
-                       FROM  groupex.membres AS m
-                  LEFT JOIN  auth_user_md5   AS u ON (m.uid=u.user_id AND m.uid<50000)
-                  LEFT JOIN  aliases         AS a ON (a.id=u.user_id and a.type="a_vie")
+                       FROM  #groupex#.membres     AS m
+                  LEFT JOIN  #x4dat#.auth_user_md5 AS u ON (m.uid=u.user_id AND m.uid<50000)
+                  LEFT JOIN  #x4dat#.aliases       AS a ON (a.id=u.user_id and a.type="a_vie")
                       WHERE  asso_id = {?}
                              AND m.origine IN (' . $membres . ')
                              AND (m.email <> "" OR u.perms <> "pending")', $globals->asso('id'));
@@ -58,7 +58,7 @@ function get_all_redirects($membres, $mls, &$client)
                         $tos[] = $person;
                     }
                 } else {
-                    $res = XDB::query('SELECT prenom, nom, sexe FROM groupex.membres WHERE email={?}', $mem[1]);
+                    $res = XDB::query('SELECT prenom, nom, sexe FROM #groupex#.membres WHERE email={?}', $mem[1]);
                     if ($person = $res->fetchOneAssoc()) {
                         $person['email'] = $mem[1];
                         $tos[] = $person;
index 95c71bd..7176f09 100644 (file)
@@ -97,8 +97,8 @@ class XnetListsModule extends ListsModule
             $alias = substr($alias, 0, strpos($alias, '@')).'@'.$globals->asso('mail_domain');
             XDB::query(
                     'DELETE FROM  r, v
-                           USING  x4dat.virtual AS v
-                       LEFT JOIN  x4dat.virtual_redirect AS r USING(vid)
+                           USING  virtual AS v
+                       LEFT JOIN  virtual_redirect AS r USING(vid)
                            WHERE  v.alias={?}', $alias);
             $page->trigSuccess(Post::v('del_alias')." supprimé&nbsp;!");
         }
@@ -108,7 +108,7 @@ class XnetListsModule extends ListsModule
 
         $alias  = XDB::iterator(
                 'SELECT  alias,type
-                   FROM  x4dat.virtual
+                   FROM  virtual
                   WHERE  alias
                    LIKE  {?} AND type="user"
                ORDER BY  alias', '%@'.$globals->asso('mail_domain'));
@@ -117,7 +117,7 @@ class XnetListsModule extends ListsModule
         $page->assign('may_update', may_update());
 
         if (count($listes) > 0 && !$globals->asso('has_ml')) {
-            XDB::execute("UPDATE  groupex.asso
+            XDB::execute("UPDATE  #groupex#.asso
                              SET  flags = CONCAT_WS(',', IF(flags = '', NULL, flags), 'has_ml')
                            WHERE  id = {?}",
                          $globals->asso('id'));
@@ -153,7 +153,7 @@ class XnetListsModule extends ListsModule
         }
 
         $new = $liste.'@'.$globals->asso('mail_domain');
-        $res = XDB::query('SELECT alias FROM x4dat.virtual WHERE alias={?}', $new);
+        $res = XDB::query('SELECT alias FROM virtual WHERE alias={?}', $new);
 
         if ($res->numRows()) {
             $page->trigError('cet alias est déjà pris');
@@ -182,14 +182,14 @@ class XnetListsModule extends ListsModule
             if (!empty($app)) {
                 $app  = '-' . $app;
             }
-            XDB::execute('INSERT INTO x4dat.virtual (alias,type)
+            XDB::execute('INSERT INTO virtual (alias,type)
                                     VALUES({?},{?})', $liste. $app . '@'.$dom, 'list');
-            XDB::execute('INSERT INTO x4dat.virtual_redirect (vid,redirect)
+            XDB::execute('INSERT INTO virtual_redirect (vid,redirect)
                                     VALUES ({?}, {?})', XDB::insertId(),
                                    $red . $mdir . '@listes.polytechnique.org');
         }
 
-        XDB::execute("UPDATE  groupex.asso
+        XDB::execute("UPDATE  #groupex#.asso
                          SET  flags = CONCAT_WS(',', IF(flags = '', NULL, flags), 'has_ml')
                        WHERE  id = {?}",
                      $globals->asso('id'));
@@ -227,9 +227,9 @@ class XnetListsModule extends ListsModule
                            if (m.origine='X',FIND_IN_SET('femme', u.flags),0) AS femme,
                            m.perms='admin' AS admin,
                            m.origine='X' AS x
-                     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' )
+                     FROM  #groupex#.membres     AS m
+                LEFT JOIN  #x4dat#.auth_user_md5 AS u ON ( u.user_id = m.uid )
+                LEFT JOIN  #x4dat#.aliases       AS a ON ( a.id = m.uid AND a.type='a_vie' )
                     WHERE  m.asso_id = {?}
                  ORDER BY  promo, nom, prenom", $globals->asso('id'));
 
@@ -266,15 +266,15 @@ class XnetListsModule extends ListsModule
             if ($dom == 'polytechnique.org' || $dom == 'm4x.org') {
                 $res = XDB::query(
                         "SELECT  a.alias, b.alias
-                           FROM  x4dat.aliases AS a
-                      LEFT JOIN  x4dat.aliases AS b ON (a.id=b.id AND b.type = 'a_vie')
+                           FROM  aliases AS a
+                      LEFT JOIN  aliases AS b ON (a.id=b.id AND b.type = 'a_vie')
                           WHERE  a.alias={?} AND a.type!='homonyme'", $mbox);
                 if (list($alias, $blias) = $res->fetchOneRow()) {
                     $alias = empty($blias) ? $alias : $blias;
                     XDB::query(
-                        "INSERT IGNORE INTO  x4dat.virtual_redirect (vid,redirect)
+                        "INSERT IGNORE INTO  virtual_redirect (vid,redirect)
                                      SELECT  vid, {?}
-                                       FROM  x4dat.virtual
+                                       FROM  virtual
                                       WHERE  alias={?}", "$alias@m4x.org", $lfull);
                    $page->trigSuccess("$alias@m4x.org ajouté");
                 } else {
@@ -282,9 +282,9 @@ class XnetListsModule extends ListsModule
                 }
             } else {
                 XDB::query(
-                        "INSERT IGNORE INTO  x4dat.virtual_redirect (vid,redirect)
+                        "INSERT IGNORE INTO  virtual_redirect (vid,redirect)
                                      SELECT  vid,{?}
-                                       FROM  x4dat.virtual
+                                       FROM  virtual
                                       WHERE  alias={?}", "$mbox@$dom", $lfull);
                 $page->trigSuccess("$mbox@$dom ajouté");
             }
@@ -293,9 +293,9 @@ class XnetListsModule extends ListsModule
         if (Env::has('del_member')) {
             S::assert_xsrf_token();
             XDB::query(
-                    "DELETE FROM  x4dat.virtual_redirect
-                           USING  x4dat.virtual_redirect
-                      INNER JOIN  x4dat.virtual USING(vid)
+                    "DELETE FROM  virtual_redirect
+                           USING  virtual_redirect
+                      INNER JOIN  virtual USING(vid)
                            WHERE  redirect={?} AND alias={?}", Env::v('del_member'), $lfull);
             pl_redirect('alias/admin/'.$lfull);
         }
@@ -308,13 +308,13 @@ class XnetListsModule extends ListsModule
                                 FROM  (SELECT  redirect AS redirect,
                                                IF(SUBSTRING_INDEX(redirect, '@', -1) IN ({?}, {?}),
                                                   SUBSTRING_INDEX(redirect, '@', 1), NULL) AS login
-                                         FROM  x4dat.virtual_redirect AS vr
-                                   INNER JOIN  x4dat.virtual          AS v  USING(vid)
+                                         FROM  #x4dat#.virtual_redirect AS vr
+                                   INNER JOIN  #x4dat#.virtual          AS v  USING(vid)
                                         WHERE  v.alias = {?}
-                                     ORDER BY  redirect) AS r
-                           LEFT JOIN  aliases AS a ON (r.login IS NOT NULL AND r.login = a.alias)
-                           LEFT JOIN  auth_user_md5 AS u ON (u.user_id = a.id)
-                           LEFT JOIN groupex.membres AS m ON (m.asso_id = {?} AND IF(r.login IS NULL, m.email = r.redirect, m.uid = u.user_id))",
+                                     ORDER BY  redirect)    AS r
+                           LEFT JOIN  #x4dat#.aliases       AS a ON (r.login IS NOT NULL AND r.login = a.alias)
+                           LEFT JOIN  #x4dat#.auth_user_md5 AS u ON (u.user_id = a.id)
+                           LEFT JOIN  #groupex#.membres     AS m ON (m.asso_id = {?} AND IF(r.login IS NULL, m.email = r.redirect, m.uid = u.user_id))",
                 $globals->mail->domain, $globals->mail->domain2,
                 $lfull, $globals->asso('id'));
         $page->assign('mem', $res);
@@ -347,14 +347,14 @@ class XnetListsModule extends ListsModule
         }
 
         $new = $liste.'@'.$globals->asso('mail_domain');
-        $res = XDB::query('SELECT COUNT(*) FROM x4dat.virtual WHERE alias={?}', $new);
+        $res = XDB::query('SELECT COUNT(*) FROM virtual WHERE alias = {?}', $new);
         $n   = $res->fetchOneCell();
         if ($n) {
             $page->trigError('cet alias est déjà pris');
             return;
         }
 
-        XDB::query('INSERT INTO x4dat.virtual (alias,type) VALUES({?}, "user")', $new);
+        XDB::query('INSERT INTO virtual (alias,type) VALUES({?}, "user")', $new);
 
         pl_redirect("alias/admin/$new");
     }
index 1bef29b..b525a90 100644 (file)
@@ -20,8 +20,6 @@
 {*                                                                        *}
 {**************************************************************************}
 
-
-
 <form action="admin/deaths" method="post">
   <table class="bicol">
     <tr>
   </table>
 </form>
 
-<script type='text/javascript' src='javascript/jquery.js'></script>
 <script type="text/javascript">//<![CDATA[
   {literal}
-  $('input.deathDate').change(
-    function ()
-    {
-      $(this).addClass('sendDate');
-    });
+  $('input.deathDate').change(function () {
+    $(this).addClass('sendDate');
+  });
   
-  $('#deathDateList').submit(
-    function ()
-    {
-      // Avoid sending useless data to the webserver
-      $('input.deathDate').not('.sendDate').attr('disabled', true);
-    });
+  $('#deathDateList').submit(function () {
+    // Avoid sending useless data to the webserver
+    $('input.deathDate').not('.sendDate').attr('disabled', true);
+  });
   {/literal}
 //]]></script>
 
index 5622e3e..d10ed36 100644 (file)
   Sur la page de résultats d'une recherche, tu peux ajouter un contact en cliquant sur {icon name=add}.
 </p>
 
+{if $plset_count || $smarty.request.quick}
 <p>
   Tu peux télécharger des informations sur tes contacts&nbsp;:
 </p>
-{if $plset_count || $smarty.request.quick}
 <ul>
   <li>Tes contacts en PDF, sans les photos&nbsp;:
   [<a href="carnet/contacts/pdf/promo/mescontacts.pdf" class='popup'><strong>tri par promo</strong></a>]
index 3fa83fa..51298b5 100644 (file)
 
 <form method="post" action="{$platal->ns}admin/emails/broken" enctype="multipart/form-data">
   {xsrf_token_field}
-  <textarea name="list" cols="60" rows="30">{if $valid_emails || $invalid_emails}{foreach from=$valid_emails item=email}{$email}{/foreach}
+  <textarea name="list" cols="60" rows="30">{if $valid_emails || $invalid_emails}{foreach from=$valid_emails item=email}{$email}
+{/foreach}
 
-{foreach from=$invalid_emails item=email}{$email}{/foreach}{/if}</textarea><br />
+{foreach from=$invalid_emails item=email}{$email}
+{/foreach}{/if}</textarea><br />
   <input type="submit" name="sort_broken"
          value="Trie et supprime les doublons de la liste d'adresses" /><br />
   <input type="submit" name="process_broken"
index a37b5f4..a365aa6 100644 (file)
@@ -36,7 +36,7 @@
   {
     _selectAll('to_contacts');
     _selectAll('cc_contacts');
-    if(form.sujet.value == "" && !confirm("Le sujet de l'email est vide, veux-tu continuer&nbsp;?")) {
+    if(form.sujet.value == "" && !confirm("Le sujet de l'email est vide, veux-tu continuer ?")) {
         form.sujet.focus();
         return false;
     }
@@ -46,7 +46,7 @@
         alert("Il faut définir au moins un destinataire.");
         return false;
       }
-      if (!confirm("Tous les destinataires sont en copie cachée, veux-tu continuer&nbsp;?")) {
+      if (!confirm("Tous les destinataires sont en copie cachée, veux-tu continuer ?")) {
         form.to.focus();
         return false;
       }
index 4bcdf96..cc87198 100644 (file)
@@ -31,7 +31,7 @@
 </tr>
 <tr class="impair">
   <td class="titre">Admin</td>
-  <td><a href="survey/admin/edit/req/{$valid->id()}">Voir / &#201;diter le sondage complet</a></td>
+  <td><a href="survey/admin/edit/req/{$valid->id()}">Voirditer le sondage complet</a></td>
 </tr>
 
 {* vim:set et sw=2 sts=2 sws=2 enc=utf-8: *}
index 5eebe2a..e60eaf5 100644 (file)
   Création d'une liste de diffusion
 </h1>
 
-{if $created}
-
-<p class='erreur'>Demande de création envoyée&nbsp;!</p>
-
-{else}
+{if !$created}
 
 <p>
 N'importe qui peut faire la demande de création d'une liste de diffusion, il suffit pour cela d'être au
index e5ce00c..a8c3a8d 100644 (file)
@@ -116,7 +116,7 @@ function payment_submit(form)
         <select name="ref" onchange="payment_submit(this.form)">
           {select_db_table table="`$prefix`paiements" valeur=$pay->id
                            where="WHERE FIND_IN_SET(\'old\',t.flags)=0"
-                           join="LEFT JOIN groupex.asso AS g ON (t.asso_id = g.id)" group="g.nom"}
+                           join="LEFT JOIN #groupex#.asso AS g ON (t.asso_id = g.id)" group="g.nom"}
         </select>
         {/if}
         {if $pay->url}
@@ -129,7 +129,7 @@ function payment_submit(form)
       <td>Méthode</td>
       <td>
         <select name="methode">
-          {select_db_table table="paiement.methodes" valeur=$smarty.request.methode}
+          {select_db_table table="#paiement#.methodes" valeur=$smarty.request.methode}
         </select>
       </td>
     </tr>
index 0320714..36319ce 100644 (file)
@@ -60,7 +60,7 @@
 
 <h1>Comment faire une recherche&nbsp;?</h1>
 
-<h2>Nom, Prénom, Promotion&hellip;<h2>
+<h2>Nom, Prénom, Promotion&hellip;</h2>
 
 <p>
 La ligne de recherche ci-dessus accepte non seulement des mélanges de <strong>noms</strong> et de <strong>prénoms</strong>&hellip;
index 6254dbe..a290093 100644 (file)
@@ -1,24 +1,25 @@
-{**************************************************************************}\r
-{*                                                                        *}\r
-{*  Copyright (C) 2003-2009 Polytechnique.org                             *}\r
-{*  http://opensource.polytechnique.org/                                  *}\r
-{*                                                                        *}\r
-{*  This program is free software; you can redistribute it and/or modify  *}\r
-{*  it under the terms of the GNU General Public License as published by  *}\r
-{*  the Free Software Foundation; either version 2 of the License, or     *}\r
-{*  (at your option) any later version.                                   *}\r
-{*                                                                        *}\r
-{*  This program is distributed in the hope that it will be useful,       *}\r
-{*  but WITHOUT ANY WARRANTY; without even the implied warranty of        *}\r
-{*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *}\r
-{*  GNU General Public License for more details.                          *}\r
-{*                                                                        *}\r
-{*  You should have received a copy of the GNU General Public License     *}\r
-{*  along with this program; if not, write to the Free Software           *}\r
-{*  Foundation, Inc.,                                                     *}\r
-{*  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA               *}\r
-{*                                                                        *}\r
-{**************************************************************************}\r
-\r
-       <link rel="stylesheet" media="screen" type="text/css" href="css/bandeau.css"/>\r
+{**************************************************************************}
+{*                                                                        *}
+{*  Copyright (C) 2003-2009 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               *}
+{*                                                                        *}
+{**************************************************************************}
+
+<link rel="stylesheet" media="screen" type="text/css" href="css/bandeau.css"/>
+
 {* vim:set et sw=2 sts=2 sws=2 enc=utf-8: *}
index aa133a5..ea13d1a 100644 (file)
     <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
     <meta name="description" content="Le Portail des Polytechniciens" />
     <meta name="keywords" content="Ecole polytechnique, anciens eleves, portail, alumni, AX, X, routage, reroutage, e-mail, email, mail" />
+
     <link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" />
     <link rel="icon" href="/images/favicon.png" type="image/png" />
     <link rel="apple-touch-icon" href="images/logo.png" type="image/png" />
+
+    <link rel="stylesheet" type="text/css" href="css/base.css" media="all"/>
+    <link rel="stylesheet" type="text/css" href="css/print.css" media="print"/>
+
     <link rel="index"  href="" />
     <link rel="author" href="changelog" />
     <link rel="search" href="search" />
     <link rel="bookmark" href="http://www.polytechnique.fr/eleves/" title="| Site d'élèves" />
 
     {include core=plpage.header.tpl}
-    <link rel="stylesheet" type="text/css" href="css/base.css" media="all"/>
-    <link rel="stylesheet" type="text/css" href="css/print.css" media="print"/>
-    <script type="text/javascript">
-      var platal_baseurl = "{$globals->baseurl}/";
-    </script>
-    {javascript name=overlib}
-    {javascript name=md5}
-    {javascript name=sha1}
-    {javascript name=secure_hash}
 
 {* vim:set et sw=2 sts=2 sws=2 enc=utf-8: *}
index 9e95fc4..4e21b66 100644 (file)
@@ -22,8 +22,8 @@
 
     <tr>
       <td colspan='2'>
-        Remplissez ici une description g&#233;n&#233;rale du sondage, puis cliquer sur "Continuer"
-        pour passer &#224; l'&#233;dition des questions.
+        Remplissez ici une description générale du sondage, puis cliquer sur "Continuer"
+        pour passer à l'édition des questions.
       </td>
     </tr>
 {include file='survey/edit_root.tpl'}
index aa1c88d..05244be 100644 (file)
@@ -76,8 +76,9 @@
     <tr id="ln_promo_exp">
       <td></td>
       <td class="smaller">
-        Exemple&nbsp;: 1954,1986-1989,-1942,2000-&nbsp;&nbsp;&nbsp;restreindra le sondage &#224; toutes les promotions suivantes&nbsp;:<br/>
-        1954, 1986 &#224; 1989, toutes jusqu'à 1942 et toutes à partir 2000 (les bornes sont syst&#233;matiquement incluses)
+        Exemple&nbsp;: 1954,1986-1989,-1942,2000-&nbsp;&nbsp;&nbsp;restreindra le sondage à toutes les promotions suivantes&nbsp;:<br/>
+        1954, 1986 à 1989, toutes jusqu'à 1942 et toutes à partir 2000 (les bornes sont systématiquement incluses).<br />
+        Pour sélectionner toutes les promotions, laisser le vide.
       </td>
     </tr>
 
index dce0105..8409236 100644 (file)
@@ -35,7 +35,7 @@
   </table>
   <div class="center">
     <input type="submit" name="survey_submit" value="{if $survey_type == 'newsurvey'}Continuer{else}Valider{/if}"/>
-    <input type="reset" name="survey_reset" value="R&#233;initialiser"/>
+    <input type="reset" name="survey_reset" value="Réinitialiser"/>
     <input type="submit" name="survey_cancel" value="Annuler"/>
   </div>
 </form>
index 5f0ba1b..f262a5e 100644 (file)
@@ -36,7 +36,7 @@
 {elseif $survey_message neq ""}
   {$survey_message}
 {else}
-Une erreur inconnue est survenue dans l'&#233;dition de ce sondage. N'hésite pas &#224; <a href='send_bug/{ $smarty.server.REQUEST_URI }'>signaler ce bug</a> s'il persiste.
+Une erreur inconnue est survenue dans l'édition de ce sondage. N'hésite pas à <a href='send_bug/{ $smarty.server.REQUEST_URI }'>signaler ce bug</a> s'il persiste.
 {/if}
 <br/>
 <a href="{$survey_link}">Retour</a>
index 70e4cbd..e20ed25 100644 (file)
       <tr>
         <td class="titre">Promotions&nbsp;:</td>
         <td>
-          {if $survey.promos eq "#"}
-          erreur
-          {elseif $survey.promos eq ""}
-          aucune restriction
-          {else}
-          {$survey.promos}
+          {if $survey.promos eq "#"} 
+          <span class="erreur">erreur</span>
+          {elseif $survey.promos eq ""} 
+          aucune restriction 
+          {else} 
+          {$survey.promos} 
           {/if}
         </td>
       </tr>
@@ -58,8 +58,8 @@
       {/if}
     </table>
     {if $survey_resultmode}
-    <p class="smaller">{$survey.votes} personnes ont r&#233;pondu &#224; ce sondage.<br />
-      R&#233;cup&#233;rer <a href="survey/result/{$survey.id}/csv">l'ensemble des r&#233;sultats</a> au format csv
+    <p class="smaller">{$survey.votes} personnes ont répondu à ce sondage.<br />
+      Récupérer <a href="survey/result/{$survey.id}/csv">l'ensemble des résultats</a> au format csv
     </p>
     {/if}
     </td>
@@ -67,9 +67,9 @@
       {assign var="survey_editallmode" value=true}
     {/if}
     {if $survey_editmode}
-    <td class="smaller" style="width: 30%">
+    <td 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}
+      {if $survey_editallmode}<br /><a href='survey/edit/add/0'>{icon name=add} Ajouter une question au début</a>{/if}
     </td>
     {/if}
   </tr>
@@ -83,7 +83,7 @@
     <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>
+      <a href='survey/edit/add/{$squestion.id+1}'>{icon name=add} Ajouter une question après</a>
     </td>
     {/if}
   </tr>
@@ -98,7 +98,7 @@
   </a> |
   <a href='survey/edit/cancel'>
     {icon name=cross} Annuler
-    {if $survey_updatemode}les modifications{else}totalement la cr&#233;ation de ce sondage{/if}
+    {if $survey_updatemode}les modifications{else}totalement la création de ce sondage{/if}
   </a>
   {elseif $survey_adminmode}
   {if !$survey.valid}<a href="survey/admin/valid/{$survey.id}">Valider ce sondage</a> | {/if}
index caa4669..af24549 100644 (file)
@@ -21,7 +21,7 @@
 {**************************************************************************}
 
 {if $survey_resultmode}
-  Quelques r&#233;ponses donn&#233;es par les personnes sond&#233;es&nbsp;:
+  Quelques réponses données par les personnes sondées&nbsp;:
   <ul>
   {foreach item=sresult from=$squestion.result}
     <li>{$sresult.answer}</li>
index 4dd81bd..5357d31 100644 (file)
@@ -21,7 +21,7 @@
 {**************************************************************************}
 
 {if $survey_resultmode}
-  Quelques r&#233;ponses donn&#233;es par les personnes sond&#233;es&nbsp;:
+  Quelques réponses données par les personnes sondées&nbsp;:
   <ul>
   {foreach item=sresult from=$squestion.result}
     <li>{$sresult.answer}</li>
index f6abc30..e78dc61 100644 (file)
 {*  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA               *}
 {*                                                                        *}
 {**************************************************************************}
-<h1>Sondages&nbsp;: succ&#232;s</h1>
+<h1>Sondages&nbsp;: succès</h1>
 
 {if $survey_message neq ""}
   {$survey_message}
 {else}
-  Op&#233;ration r&#233;ussie
+  Opération réussie
 {/if}
 <br/>
 <a href="{$survey_link}">Retour</a>
index 9322c0b..4c3b82d 100644 (file)
     <link rel="bookmark" href="http://www.polytechnique.fr/eleves/" title="| Site d'élèves" />
 
     {include core=plpage.header.tpl}
-    <script type="text/javascript">
-    var platal_baseurl = "{$globals->baseurl}/"
-    if (window.top != window)
-      document.write('<link rel="stylesheet" type="text/css" href="css/onlycontent.css" media="all"/>');
-    </script>
-    {javascript name=overlib}
     {include file=skin/common.bandeau.head.tpl}
   </head>
   <body>
index c5eaa19..bef6fd3 100644 (file)
@@ -244,7 +244,7 @@ Ton inscription à [METS LE NOM DE L'ÉVÉNEMENT ICI] a bien été enregistrée
     </tr>
     <tr>
       <td class="titre">Tarif&nbsp;:<br /><small>(par participant)</small></td>
-      <td><input type="text" name="montant{$i}" value="{if $moment.montant}{$moment.montant|replace:".":","}{else}0,00{/if}" size="7" maxlength="7" /> &#8364; <small>(0 si gratuit)</small></td>
+      <td><input type="text" name="montant{$i}" value="{if $moment.montant}{$moment.montant|replace:".":","}{else}0,00{/if}" size="7" maxlength="7" />  <small>(0 si gratuit)</small></td>
     </tr>
   {/foreach}
   </table>
diff --git a/upgrade/0.10.2/update.sh b/upgrade/0.10.2/update.sh
new file mode 100755 (executable)
index 0000000..928d1e4
--- /dev/null
@@ -0,0 +1,15 @@
+#!/bin/bash
+
+. ../inc/pervasive.sh
+
+mailman_stop
+mailman_templates
+mailman_start
+
+###########################################################
+for sql in *.sql
+do
+    echo -n $sql
+    $MYSQL $DATABASE < $sql &>/dev/null || echo -n " ERROR"
+    echo .
+done
diff --git a/upgrade/0.10.3/update.sh b/upgrade/0.10.3/update.sh
new file mode 100755 (executable)
index 0000000..928d1e4
--- /dev/null
@@ -0,0 +1,15 @@
+#!/bin/bash
+
+. ../inc/pervasive.sh
+
+mailman_stop
+mailman_templates
+mailman_start
+
+###########################################################
+for sql in *.sql
+do
+    echo -n $sql
+    $MYSQL $DATABASE < $sql &>/dev/null || echo -n " ERROR"
+    echo .
+done
index 8b1d47f..f5b279e 100755 (executable)
@@ -10,6 +10,11 @@ if [ "$UID" != 0 ]; then
     exit 1
 fi
 
+if [[ -n "${DBPREFIX}" ]]; then
+    echo "Using non-default database ${DBPREFIX}x4dat."
+fi
+declare -r DATABASE="${DBPREFIX}x4dat"
+
 function mailman_stop() {
     echo -n "stops mailman"
     /etc/init.d/mailman stop &>/dev/null
@@ -28,4 +33,3 @@ function mailman_start() {
     /etc/init.d/mailman start &>/dev/null
     echo .
 }
-