Explorar el Código

When modifying an entry, if the nick name is different, check that the new nick name doesn't exist in the address book.

stevetruckstuff hace 19 años
padre
commit
e2b956b799
Se han modificado 1 ficheros con 9 adiciones y 1 borrados
  1. 9 1
      functions/abook_local_file.php

+ 9 - 1
functions/abook_local_file.php

@@ -512,7 +512,15 @@ class abook_local_file extends addressbook_backend {
             // i18n: don't use html formating in translation
             // i18n: don't use html formating in translation
             return $this->set_error(sprintf(_("User \"%s\" does not exist"),$alias));
             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
         /* Lock the file to make sure we're the only process working
          * on it. */
          * on it. */
         if(!$this->lock()) {
         if(!$this->lock()) {