Moves skills edition to mentor edition page.
[platal.git] / include / emails.inc.php
index db35a5d..5b6b0a7 100644 (file)
@@ -189,7 +189,7 @@ function mark_broken_email($email, $admin = false)
         return;
     }
 
-    $user = XDB::fetchOneAssoc('SELECT  r1.uid, r1.broken_level != 0 AS broken, COUNT(r2.uid) AS nb_mails,
+    $user = XDB::fetchOneAssoc('SELECT  r1.uid, a.hruid, a.full_name, r1.broken_level != 0 AS broken, COUNT(r2.uid) AS nb_mails,
                                         s.email AS alias, DATE_ADD(r1.last, INTERVAL 14 DAY) < CURDATE() as notify
                                   FROM  email_redirect_account AS r1
                             INNER JOIN  accounts               AS a  ON (a.uid = r1.uid)
@@ -469,6 +469,7 @@ class Email
 
     // Basic email properties; $sufficient indicates if the email can be used as
     // an unique redirection; $redirect contains the delivery email address.
+    public $id;
     public $type;
     public $sufficient;
     public $email;
@@ -510,6 +511,11 @@ class Email
         }
         $this->sufficient = ($this->type == 'smtp' || $this->type == 'googleapps');
         $this->filter_level = ($this->type == 'imap') ? null : array_search($this->action, Bogo::$states);
+        if (array_key_exists($this->type , self::$storage_domains)) {
+            $this->id = $this->type;
+        } else {
+            $this->id = str_replace(array('@', '.'), array('_at_', '_dot_'), $this->email);
+        }
         $this->user = &$user;
     }
 
@@ -517,7 +523,7 @@ class Email
     public function activate()
     {
         if ($this->inactive) {
-            if ($is_storage = in_array($this->type, self::get_allowed_storages($this->user))) {
+            if (in_array($this->type, self::get_allowed_storages($this->user))) {
                 self::activate_storage($this->user, $this->type, $this->action);
             } else {
                 XDB::execute('UPDATE  email_redirect_account
@@ -535,7 +541,7 @@ class Email
     public function deactivate()
     {
         if ($this->active) {
-            if ($is_storage = in_array($this->type, self::get_allowed_storages($this->user))) {
+            if (in_array($this->type, self::get_allowed_storages($this->user))) {
                 self::deactivate_storage($this->user, $this->type);
             } else {
                 XDB::execute('UPDATE  email_redirect_account