From: Tobias Diekershoff Date: Mon, 9 Sep 2013 06:33:47 +0000 (+0200) Subject: Check for user name in deleted user list and unset account expiration before importin... X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=7ab366b9c3653160dbe68fe2d096e4174547ff84;p=friendica.git Check for user name in deleted user list and unset account expiration before importing the account (Bug #760) --- diff --git a/include/uimport.php b/include/uimport.php index 1bfd3334c8..fcc7e75a61 100644 --- a/include/uimport.php +++ b/include/uimport.php @@ -120,12 +120,26 @@ function import_account(&$a, $file) { notice(sprintf(t("User '%s' already exists on this server!"), $account['user']['nickname'])); return; } + // check if username matches deleted account + $r = q("SELECT id FROM userd WHERE username='%s'", $account['user']['nickname']); + if ($r === false) { + logger("uimport:check nickname : ERROR : " . last_error(), LOGGER_NORMAL); + notice(t('Error! Cannot check nickname')); + return; + } + if (count($r) > 0) { + notice(sprintf(t("User '%s' already exists on this server!"), $account['user']['nickname'])); + return; + } $oldbaseurl = $account['baseurl']; $newbaseurl = $a->get_baseurl(); $olduid = $account['user']['uid']; - unset($account['user']['uid']); + unset($account['user']['uid']); + unset($account['user']['account_expired']); + unset($account['user']['account_expires_on']); + unset($account['user']['expire_notification_sent']); foreach ($account['user'] as $k => &$v) { $v = str_replace($oldbaseurl, $newbaseurl, $v); }