X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=mod%2Fremoveme.php;h=ecf65c04c1969747ef9462c1296dd6b14eb20973;hb=86320317f493d0bf26fac7860d2e0c388633ab0c;hp=a53bc3ecebecb19bde1715914aef4a85501012ba;hpb=2ef81108b37a85642e1f3380044a03cb1cd8719a;p=friendica.git diff --git a/mod/removeme.php b/mod/removeme.php index a53bc3eceb..ecf65c04c1 100644 --- a/mod/removeme.php +++ b/mod/removeme.php @@ -6,11 +6,11 @@ use Friendica\App; use Friendica\Core\Config; use Friendica\Core\L10n; -use Friendica\Core\System; +use Friendica\Core\Renderer; use Friendica\Database\DBA; +use Friendica\DI; use Friendica\Model\User; - -require_once 'include/enotify.php'; +use Friendica\Util\Strings; function removeme_post(App $a) { @@ -18,15 +18,15 @@ function removeme_post(App $a) return; } - if (x($_SESSION, 'submanage') && intval($_SESSION['submanage'])) { + if (!empty($_SESSION['submanage'])) { return; } - if ((!x($_POST, 'qxz_password')) || (!strlen(trim($_POST['qxz_password'])))) { + if (empty($_POST['qxz_password'])) { return; } - if ((!x($_POST, 'verify')) || (!strlen(trim($_POST['verify'])))) { + if (empty($_POST['verify'])) { return; } @@ -55,8 +55,12 @@ function removeme_post(App $a) ]); } - if (User::authenticate($a->user, trim($_POST['qxz_password']))) { + if (User::getIdFromPasswordAuthentication($a->user, trim($_POST['qxz_password']))) { User::remove($a->user['uid']); + + unset($_SESSION['authenticated']); + unset($_SESSION['uid']); + DI::baseUrl()->redirect(); // NOTREACHED } } @@ -64,19 +68,19 @@ function removeme_post(App $a) function removeme_content(App $a) { if (!local_user()) { - $a->redirect(); + DI::baseUrl()->redirect(); } - $hash = random_string(); + $hash = Strings::getRandomHex(); require_once("mod/settings.php"); settings_init($a); $_SESSION['remove_account_verify'] = $hash; - $tpl = get_markup_template('removeme.tpl'); - $o = replace_macros($tpl, [ - '$basedir' => $a->getBaseURL(), + $tpl = Renderer::getMarkupTemplate('removeme.tpl'); + $o = Renderer::replaceMacros($tpl, [ + '$basedir' => DI::baseUrl()->get(), '$hash' => $hash, '$title' => L10n::t('Remove My Account'), '$desc' => L10n::t('This will completely remove your account. Once this has been done it is not recoverable.'),