Add radio button group widget type SMOPT_TYPE_STRLIST_RADIO
[squirrelmail.git] / functions / abook_local_file.php
index fb215e27c3f525b0f8551fb1119d24188ef28f37..65ae8256f24372c3976c47a07577a4cf65e7d68a 100644 (file)
@@ -3,7 +3,7 @@
 /**
  * abook_local_file.php
  *
- * @copyright © 1999-2006 The SquirrelMail Project Team
+ * @copyright © 1999-2007 The SquirrelMail Project Team
  * @license http://opensource.org/licenses/gpl-license.php GNU Public License
  * @version $Id$
  * @package squirrelmail
@@ -512,7 +512,15 @@ class abook_local_file extends addressbook_backend {
             // i18n: don't use html formating in translation
             return $this->set_error(sprintf(_("User \"%s\" does not exist"),$alias));
         }
-
+        
+        /* If the alias changed, see if the new alias exists */
+        if (strtolower($alias) != strtolower($userdata['nickname'])) {
+            $ret = $this->lookup($userdata['nickname']);
+            if (!empty($ret)) {
+                return $this->set_error(sprintf(_("User \"%s\" already exists"), $userdata['nickname']));
+            }
+        }
+        
         /* Lock the file to make sure we're the only process working
          * on it. */
         if(!$this->lock()) {
@@ -571,6 +579,4 @@ class abook_local_file extends addressbook_backend {
         }
         return $value;
     }
-
-} /* End of class abook_local_file */
-?>
+}