Adds address edition in entreprise validation.
[platal.git] / include / banana / ml.inc.php
index 1a5413f..b78139c 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 /***************************************************************************
- *  Copyright (C) 2003-2008 Polytechnique.org                              *
+ *  Copyright (C) 2003-2009 Polytechnique.org                              *
  *  http://opensource.polytechnique.org/                                   *
  *                                                                         *
  *  This program is free software; you can redistribute it and/or modify   *
@@ -45,10 +45,13 @@ class MLBanana extends Banana
 {
     static public $listname;
     static public $domain;
+    private $user;
 
-    function __construct($forlife, $params = null)
+    function __construct(User &$user, $params = null)
     {
         global $globals;
+        $this->user = &$user;
+
         Banana::$spool_root = $globals->banana->spool_root;
         Banana::$spool_boxlist = false;
         Banana::$msgedit_canattach = true;
@@ -75,9 +78,20 @@ class MLBanana extends Banana
         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>";