Merge branch 'master' into hruid
authorVincent Zanotti <vincent.zanotti@polytechnique.org>
Sun, 13 Jul 2008 22:04:29 +0000 (00:04 +0200)
committerVincent Zanotti <vincent.zanotti@polytechnique.org>
Sun, 13 Jul 2008 22:04:29 +0000 (00:04 +0200)
1  2 
include/banana/forum.inc.php
include/banana/ml.inc.php
include/banana/moderate.inc.php
include/vcard.inc.php
modules/lists.php
modules/marketing.php

@@@ -68,12 -68,13 +68,13 @@@ class ForumsBanana extends Banan
  
          // Get user profile from SQL
          $req = XDB::query("SELECT  nom, mail, sig,
-                                    FIND_IN_SET('threads',flags), FIND_IN_SET('automaj',flags)
+                                    FIND_IN_SET('threads',flags), FIND_IN_SET('automaj',flags),
+                                    tree_unread, tree_read
                               FROM  {$globals->banana->table_prefix}profils
                              WHERE  uid={?}", S::i('uid'));
-         if (!(list($nom,$mail,$sig,$disp,$maj) = $req->fetchOneRow())) {
+         if (!(list($nom, $mail, $sig, $disp, $maj, $unread, $read) = $req->fetchOneRow())) {
              $nom  = S::v('prenom')." ".S::v('nom');
 -            $mail = S::v('forlife')."@" . $globals->mail->domain;
 +            $mail = $this->user->forlifeEmail();
              $sig  = $nom." (".S::v('promo').")";
              $disp = 0;
              $maj  = 1;
              SELECT  nom, mail, sig,
                      FIND_IN_SET('threads', flags),
                      FIND_IN_SET('automaj', flags),
-                     FIND_IN_SET('xface', flags)
+                     FIND_IN_SET('xface', flags),
+                     tree_unread,
+                     tree_read
                FROM  forums.profils
               WHERE  uid = {?}", S::v('uid'));
-         if (!(list($nom, $mail, $sig, $disp, $maj, $xface) = $req->fetchOneRow())) {
+         if (!(list($nom, $mail, $sig, $disp, $maj, $xface, $unread, $read) = $req->fetchOneRow())) {
              $nom   = S::v('prenom').' '.S::v('nom');
 -            $mail  = S::v('forlife').'@'.$globals->mail->domain;
 +            $mail  = S::user()->forlifeEmail();
              $sig   = $nom.' ('.S::v('promo').')';
              $disp  = 0;
              $maj   = 0;
@@@ -78,10 -75,21 +78,21 @@@ class MLBanana extends Banan
          global $platal, $globals;
  
          $nom  = S::v('prenom') . ' ' . S::v('nom');
 -        $mail = S::v('bestalias') . '@' . $globals->mail->domain;
 +        $mail = $this->user->bestEmail();
          $sig  = $nom . ' (' . S::v('promo') . ')';
 -        Banana::$msgedit_headers['X-Org-Mail'] = S::v('forlife') . '@' . $globals->mail->domain;
 +        Banana::$msgedit_headers['X-Org-Mail'] = $this->user->forlifeEmail();
  
+         // Tree color
+         $req = XDB::query("SELECT  tree_unread, tree_read
+                              FROM  {$globals->banana->table_prefix}profils
+                             WHERE  uid={?}", S::i('uid'));
+         if (!(list($unread, $read) = $req->fetchOneRow())) {
+             $unread = 'o';
+             $read = 'dg';
+         }
+         Banana::$tree_unread = $unread;
+         Banana::$tree_read = $read;
          // Build user profile
          Banana::$profile['headers']['From']         = "$nom <$mail>";
          Banana::$profile['headers']['Organization'] = make_Organization();
@@@ -57,8 -57,10 +57,10 @@@ class ModerationBanana extends Banan
      static public $domain;
      static public $client;
  
 -    function __construct($forlife, $params = null)
 +    function __construct(User &$user, $params = null)
      {
+         ini_set('memory_limit', '128M'); 
          global $globals;
          ModerationBanana::$client = $params['client'];
          ModerationBanana::$listname = $params['listname'];
Simple merge
Simple merge
@@@ -199,22 -203,25 +203,24 @@@ class MarketingModule extends PLModul
              $email = valide_email(Post::v('mail'));
          }
          if (Post::has('valide') && isvalid_email_redirection($email)) {
+             S::assert_xsrf_token();
              // security stuff
 -            check_email($email, "Proposition d'une adresse surveillee pour " . $user['forlife'] . " par " . S::v('forlife'));
 -            $res = XDB::query("SELECT  e.flags
 -                                 FROM  emails   AS e
 -                           INNER JOIN  aliases  AS a ON (a.id = e.uid)
 -                                WHERE  e.email = {?} AND a.alias = {?}", $email, $user['forlife']);
 +            check_email($email, "Proposition d'une adresse surveillee pour " . $user->login() . " par " . S::user()->login());
 +            $res = XDB::query("SELECT  flags
 +                                 FROM  emails
 +                                WHERE  email = {?} AND uid = {?}", $email, $user->id());
              $state = $res->numRows() ? $res->fetchOneCell() : null;
              if ($state == 'panne') {
 -                $page->trigWarning("L'adresse que tu as fournie est l'adresse actuelle de {$user['prenom']} et est en panne.");
 +                $page->trigWarning("L'adresse que tu as fournie est l'adresse actuelle de {$user_data['prenom']} et est en panne.");
              } elseif ($state == 'active') {
 -                $page->trigWarning("L'adresse que tu as fournie est l'adresse actuelle de {$user['prenom']}");
 -            } elseif ($user['email'] && !trim(Post::v('comment'))) {
 +                $page->trigWarning("L'adresse que tu as fournie est l'adresse actuelle de {$user_data['prenom']}");
 +            } elseif ($user_data['email'] && !trim(Post::v('comment'))) {
                  $page->trigError("Il faut que tu ajoutes un commentaire à ta proposition pour justifier le "
 -                           ."besoin de changer la redirection de " . $user['prenom']);
 +                               . "besoin de changer la redirection de " . $user_data['prenom']);
              } else {
                  require_once 'validations.inc.php';
 -                $valid = new BrokenReq(S::i('uid'), $user, $email, trim(Post::v('comment')));
 +                $valid = new BrokenReq(S::i('uid'), $user_data, $email, trim(Post::v('comment')));
                  $valid->submit();
                  $page->assign('sent', true);
              }