[Svn] r3775 - in trunk/plugins/password: . drivers

trac at roundcube.net trac at roundcube.net
Sun Jun 20 12:43:08 CEST 2010


Author: alec
Date: 2010-06-20 05:43:08 -0500 (Sun, 20 Jun 2010)
New Revision: 3775

Modified:
   trunk/plugins/password/drivers/ldap.php
   trunk/plugins/password/drivers/sql.php
   trunk/plugins/password/package.xml
   trunk/plugins/password/password.php
Log:
- Removed user_login/username_local/username_domain methods,
  use rcube_user::get_username instead (#1486707)


Modified: trunk/plugins/password/drivers/ldap.php
===================================================================
--- trunk/plugins/password/drivers/ldap.php	2010-06-20 10:36:31 UTC (rev 3774)
+++ trunk/plugins/password/drivers/ldap.php	2010-06-20 10:43:08 UTC (rev 3775)
@@ -133,14 +133,15 @@
  */
 function substitute_vars($str)
 {
+    $rcmail = rcmail::get_instance();
     $str = str_replace(array(
             '%login',
             '%name',
             '%domain',
         ), array(
             $_SESSION['username'],
-            password::username_local(),
-            password::username_domain(),
+            $rcmail->user->get_username('local'),
+            $rcmail->user->get_username('domain'),
         ), $str
     );
 

Modified: trunk/plugins/password/drivers/sql.php
===================================================================
--- trunk/plugins/password/drivers/sql.php	2010-06-20 10:36:31 UTC (rev 3774)
+++ trunk/plugins/password/drivers/sql.php	2010-06-20 10:43:08 UTC (rev 3775)
@@ -106,8 +106,8 @@
     }
 
     // at least we should always have the local part
-    $sql = str_replace('%l', $db->quote(password::username_local(), 'text'), $sql);
-    $sql = str_replace('%d', $db->quote(password::username_domain(), 'text'), $sql);
+    $sql = str_replace('%l', $db->quote($rcmail->user->get_username('local'), 'text'), $sql);
+    $sql = str_replace('%d', $db->quote($rcmail->user->get_username('domain'), 'text'), $sql);
     $sql = str_replace('%u', $db->quote($_SESSION['username'],'text'), $sql);
     $sql = str_replace('%h', $db->quote($_SESSION['imap_host'],'text'), $sql);
     $sql = str_replace('%p', $db->quote($passwd,'text'), $sql);

Modified: trunk/plugins/password/package.xml
===================================================================
--- trunk/plugins/password/package.xml	2010-06-20 10:36:31 UTC (rev 3774)
+++ trunk/plugins/password/package.xml	2010-06-20 10:43:08 UTC (rev 3775)
@@ -15,11 +15,11 @@
 		<email>alec at alec.pl</email>
 		<active>yes</active>
 	</lead>
-	<date>2010-04-29</date>
+	<date>2010-06-20</date>
 	<time>12:00:00</time>
 	<version>
-		<release>1.4</release>
-		<api>1.4</api>
+		<release>1.5</release>
+		<api>1.5</api>
 	</version>
 	<stability>
 		<release>stable</release>
@@ -27,9 +27,8 @@
 	</stability>
 	<license uri="http://www.gnu.org/licenses/gpl-2.0.html">GNU GPLv2</license>
 	<notes>
-- Use mail_domain value for domain variables when there is no domain in username:
-  sql and ldap drivers(#1486694)
-- Created package.xml
+- Removed user_login/username_local/username_domain methods,
+  use rcube_user::get_username instead (#1486707)
     </notes>
 	<contents>
 		<dir baseinstalldir="/" name="/">
@@ -98,4 +97,24 @@
 		</required>
 	</dependencies>
 	<phprelease/>
+	<changelog>
+	    <release>
+	        <date>2010-04-29</date>
+	        <time>12:00:00</time>
+	        <version>
+		        <release>1.4</release>
+		        <api>1.4</api>
+	        </version>
+	        <stability>
+		        <release>stable</release>
+		        <api>stable</api>
+	        </stability>
+	        <license uri="http://www.gnu.org/licenses/gpl-2.0.html">GNU GPLv2</license>
+	        <notes>
+- Use mail_domain value for domain variables when there is no domain in username:
+  sql and ldap drivers (#1486694)
+- Created package.xml
+            </notes>
+	    </release>
+	</changelog>
 </package>

Modified: trunk/plugins/password/password.php
===================================================================
--- trunk/plugins/password/password.php	2010-06-20 10:36:31 UTC (rev 3774)
+++ trunk/plugins/password/password.php	2010-06-20 10:43:08 UTC (rev 3775)
@@ -240,39 +240,7 @@
             default:
                 return $this->gettext('internalerror');
         }
-    }
-
-    static function username_local()
-    {
-        return password::user_login('local');
-    }
-
-    static function username_domain()
-    {
-        return password::user_login('domain');
-    }
-    
-    static function user_login($part = null)
-    {
-        $user_info = explode('@', $_SESSION['username']);
-  
-        // at least we should always have the local part
-        if ($part == 'local') {
-            return $user_info[0];
-        }
-        else if ($part == 'domain') {
-            if (!empty($user_info[1])) {
-                return $user_info[1];
-            }
-            // if no domain was provided use the default if available
-            if ($domain = rcmail::get_instance()->config->get('mail_domain')) {
-                return $domain;
-            }
-            return '';
-        }
-
-        return $_SESSION['username'];
-    }                                          
+    }                                     
 }
 
 ?>

_______________________________________________
http://lists.roundcube.net/mailman/listinfo/svn



More information about the Svn mailing list