]> git.mxchange.org Git - friendica.git/blobdiff - include/uimport.php
Merge remote-tracking branch 'upstream/master'
[friendica.git] / include / uimport.php
index 0de6652401338ff4a7904b5b66b1e2a89c14330a..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
@@ -125,7 +137,7 @@ function import_account(&$a, $file) {
          if ($contact['uid'] == $olduid && $contact['self'] == '0') {\r
             switch ($contact['network']){\r
                 case NETWORK_DFRN:\r
-                    // send moved message\r
+                    //  send relocate message (below)\r
                     break;\r
                 case NETWORK_ZOT:\r
                     // TODO handle zot network\r
@@ -226,10 +238,12 @@ function import_account(&$a, $file) {
             logger("uimport:insert pconfig ".$pconfig['id']. " : ERROR : ".last_error(), LOGGER_NORMAL);\r
         }\r
     } \r
-     \r
+    \r
+    // send relocate messages\r
+    proc_run('php', 'include/notifier.php', 'relocate' , $newuid);\r
     \r
     info(t("Done. You can now login with your username and password"));\r
     goaway( $a->get_baseurl() ."/login");\r
     \r
     \r
-}
\ No newline at end of file
+}\r