Uses Post dedicated trim function when possible.
[platal.git] / include / validations / listes.inc.php
index dec551b..4be1f5e 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 /***************************************************************************
- *  Copyright (C) 2003-2010 Polytechnique.org                              *
+ *  Copyright (C) 2003-2011 Polytechnique.org                              *
  *  http://opensource.polytechnique.org/                                   *
  *                                                                         *
  *  This program is free software; you can redistribute it and/or modify   *
@@ -82,17 +82,23 @@ class ListeReq extends Validate
         global $globals;
 
         if (Env::has('listname')) {
-            $this->liste = trim(Env::v('listname'));
+            $this->liste = Post::t('listname');
         }
         if (Env::has('domainname')) {
-            $this->domain = trim(Env::v('domainname'));
+            $this->domain = Post::t('domainname');
         }
         if (Env::has('assotype')) {
-            $this->asso = trim(Env::v('assotype'));
+            $this->asso = Post::t('assotype');
         }
         if (!$this->asso) {
             $this->domain = $globals->mail->domain;
         }
+        foreach ($this->owners as $key => &$email) {
+            $email = Post::t('owners_' . $key);
+        }
+        foreach ($this->members as $key => &$email) {
+            $email = Post::t('members_' . $key);
+        }
         return true;
     }
 
@@ -139,7 +145,7 @@ class ListeReq extends Validate
             return 1;
         }
 
-        $list = new MMList(S::user()->id(), $this->domain);
+        $list = new MMList(S::user(), $this->domain);
         $ret = $list->create_list($this->liste, utf8_decode($this->desc), $this->advertise,
                                   $this->modlevel, $this->inslevel,
                                   $this->owners, $this->members);