remove emails.inc.php hook
authorx2000habouzit <x2000habouzit@839d8a87-29fc-0310-9880-83ba4fa771e5>
Sun, 23 Jul 2006 22:21:26 +0000 (22:21 +0000)
committerx2000habouzit <x2000habouzit@839d8a87-29fc-0310-9880-83ba4fa771e5>
Sun, 23 Jul 2006 22:21:26 +0000 (22:21 +0000)
git-svn-id: svn+ssh://murphy/home/svn/platal/trunk@614 839d8a87-29fc-0310-9880-83ba4fa771e5

configs/platal.ini
hooks/emails.inc.php [deleted file]
include/validations/aliases.inc.php

index bf4bd09..f589a9f 100644 (file)
@@ -9,6 +9,14 @@ web_pass = "***"
 table_prefix = "banana_"
 
 
+[Mail]
+domain  = ""
+domain2 = ""
+
+alias_dom  = ""
+alias_dom2 = ""
+
+
 [Lists]
 rpchost   = "localhost"
 rpcport   = 4949
diff --git a/hooks/emails.inc.php b/hooks/emails.inc.php
deleted file mode 100644 (file)
index bdbf24f..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
-<?php
-/***************************************************************************
- *  Copyright (C) 2003-2006 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                *
- ***************************************************************************/
-
-// {{{ config HOOK
-
-class MailConfig
-{
-    var $domain     = '';
-    var $domain2    = '';
-
-    var $alias_dom  = '';
-    var $alias_dom2 = '';
-
-    function shorter_domain()
-    {
-        if (empty($this->domain2) || strlen($this->domain2)>strlen($this->domain)) {
-            return $this->domain;
-        } else {
-            return $this->domain2;
-        }
-    }
-}
-
-function emails_config()
-{
-    global $globals;
-    $globals->mail = new MailConfig;
-}
-// }}}
-?>
index 9cd0b0b..6038b9c 100644 (file)
@@ -92,20 +92,35 @@ class AliasReq extends Validate
     }
 
     // }}}
+    // {{{ function shorter_domain
+
+    function shorter_domain()
+    {
+        global $globals;
+
+        if (empty($globals->domain2) || strlen($globals->domain2) > strlen($globals->domain)) {
+            return $globals->domain;
+        } else {
+            return $globals->domain2;
+        }
+    }
+
+    // }}}
     // {{{ function commit()
 
     function commit ()
     {
         global $globals;
-        
-        XDB::execute("UPDATE auth_user_quick SET emails_alias_pub = {?} WHERE user_id = {?}", $this->public, $this->uid);
+
+        XDB::execute("UPDATE auth_user_quick SET emails_alias_pub = {?} WHERE user_id = {?}",
+                     $this->public, $this->uid);
 
         if ($this->old) {
             return XDB::execute('UPDATE virtual SET alias={?} WHERE alias={?}', $this->alias, $this->old);
         } else {
             XDB::execute('INSERT INTO virtual SET alias={?},type="user"', $this->alias);
             $vid = mysql_insert_id();
-            $dom = $globals->mail->shorter_domain();
+            $dom = $this->shorter_domain();
             return XDB::query('INSERT INTO virtual_redirect (vid,redirect) VALUES ({?}, {?})', $vid, $this->forlife.'@'.$dom);
         }
     }