]> git.mxchange.org Git - friendica.git/blobdiff - include/uimport.php
Check for user name in deleted user list and unset account expiration before importin...
[friendica.git] / include / uimport.php
index 1bfd3334c8a3a74d96efd960603722963cb0c491..fcc7e75a6120d99790062a7ee15b8f89876a3f0c 100644 (file)
@@ -120,12 +120,26 @@ function import_account(&$a, $file) {
                notice(sprintf(t("User '%s' already exists on this server!"), $account['user']['nickname']));\r
                return;\r
        }\r
+       // check if username matches deleted account\r
+       $r = q("SELECT id FROM userd WHERE username='%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
        $olduid = $account['user']['uid'];\r
 \r
-       unset($account['user']['uid']);\r
+        unset($account['user']['uid']);\r
+        unset($account['user']['account_expired']);\r
+        unset($account['user']['account_expires_on']);\r
+        unset($account['user']['expire_notification_sent']);\r
        foreach ($account['user'] as $k => &$v) {\r
                $v = str_replace($oldbaseurl, $newbaseurl, $v);\r
        }\r