]> git.mxchange.org Git - friendica.git/commitdiff
uimport: check check to ensure the username isn't already taken before import (issue...
authorFabrixxm <fabrix.xm@gmail.com>
Tue, 13 Nov 2012 09:52:32 +0000 (04:52 -0500)
committerFabrixxm <fabrix.xm@gmail.com>
Tue, 13 Nov 2012 09:52:32 +0000 (04:52 -0500)
include/uimport.php

index 9427931687f81596e31329a05b4f71635e249eb0..38b1772475959b39a6f8b016dfc16c2fd46eb3ee 100644 (file)
@@ -73,6 +73,18 @@ function import_account(&$a, $file) {
         return;\r
     }\r
    \r
+       \r
+       // check for username\r
+       $r = q("SELECT uid FROM user WHERE nickname='%s'", $account['user']['nickname']);\r
+       if ($r===false) {\r
+               logger("uimport:check nickname : ERROR : ".last_error(), LOGGER_NORMAL);\r
+               notice(t('Error! Cannot check nickname'));\r
+               return;\r
+       }\r
+       if (count($r)>0) {\r
+               notice(sprintf(t("User '%s' already exists on this server!"),$account['user']['nickname']));\r
+               return;\r
+       }\r
 \r
     $oldbaseurl  = $account['baseurl'];\r
     $newbaseurl = $a->get_baseurl();\r