]> git.mxchange.org Git - friendica.git/blobdiff - mod/lostpass.php
Merge pull request #3986 from MrPetovan/task/admin-block-list
[friendica.git] / mod / lostpass.php
index f9e9400fc2caf47318c49be9babe156a5f3a159e..b3304fda12bba312b3149025bb21f3f8c76b2107 100644 (file)
@@ -1,23 +1,28 @@
 <?php
+/**
+ * @file mod/lostpass.php
+ */
+use Friendica\App;
+use Friendica\Core\System;
+use Friendica\Database\DBM;
 
-require_once('include/email.php');
-require_once('include/enotify.php');
-require_once('include/text.php');
+require_once 'include/enotify.php';
+require_once 'include/text.php';
 
-function lostpass_post(App &$a) {
+function lostpass_post(App $a) {
 
        $loginame = notags(trim($_POST['login-name']));
        if(! $loginame)
-               goaway(z_root());
+               goaway(System::baseUrl());
 
        $r = q("SELECT * FROM `user` WHERE ( `email` = '%s' OR `nickname` = '%s' ) AND `verified` = 1 AND `blocked` = 0 LIMIT 1",
                dbesc($loginame),
                dbesc($loginame)
        );
 
-       if (! dbm::is_result($r)) {
+       if (! DBM::is_result($r)) {
                notice( t('No valid account found.') . EOL);
-               goaway(z_root());
+               goaway(System::baseUrl());
        }
 
        $uid = $r[0]['uid'];
@@ -36,7 +41,7 @@ function lostpass_post(App &$a) {
 
 
        $sitename = $a->config['sitename'];
-       $resetlink = App::get_baseurl() . '/lostpass?verify=' . $new_password;
+       $resetlink = System::baseUrl() . '/lostpass?verify=' . $new_password;
 
        $preamble = deindent(t('
                Dear %1$s,
@@ -63,21 +68,21 @@ function lostpass_post(App &$a) {
                Login Name:     %3$s'));
 
        $preamble = sprintf($preamble, $username, $sitename);
-       $body = sprintf($body, $resetlink, App::get_baseurl(), $email);
+       $body = sprintf($body, $resetlink, System::baseUrl(), $email);
 
        notification(array(
-               'type' => "SYSTEM_EMAIL",
+               'type' => SYSTEM_EMAIL,
                'to_email' => $email,
                'subject'=> sprintf( t('Password reset requested at %s'),$sitename),
                'preamble'=> $preamble,
                'body' => $body));
 
-       goaway(z_root());
+       goaway(System::baseUrl());
 
 }
 
 
-function lostpass_content(App &$a) {
+function lostpass_content(App $a) {
 
 
        if(x($_GET,'verify')) {
@@ -87,7 +92,7 @@ function lostpass_content(App &$a) {
                $r = q("SELECT * FROM `user` WHERE `pwdreset` = '%s' LIMIT 1",
                        dbesc($hash)
                );
-               if (! dbm::is_result($r)) {
+               if (! DBM::is_result($r)) {
                        $o =  t("Request could not be verified. \x28You may have previously submitted it.\x29 Password reset failed.");
                        return $o;
                }
@@ -103,7 +108,7 @@ function lostpass_content(App &$a) {
                        intval($uid)
                );
 
-               /// @TODO Is dbm::is_result() okay here?
+               /// @TODO Is DBM::is_result() okay here?
                if ($r) {
                        $tpl = get_markup_template('pwdreset.tpl');
                        $o .= replace_macros($tpl,array(
@@ -111,10 +116,10 @@ function lostpass_content(App &$a) {
                                '$lbl2' => t('Your password has been reset as requested.'),
                                '$lbl3' => t('Your new password is'),
                                '$lbl4' => t('Save or copy your new password - and then'),
-                               '$lbl5' => '<a href="' . App::get_baseurl() . '">' . t('click here to login') . '</a>.',
+                               '$lbl5' => '<a href="' . System::baseUrl() . '">' . t('click here to login') . '</a>.',
                                '$lbl6' => t('Your password may be changed from the <em>Settings</em> page after successful login.'),
                                '$newpass' => $new_password,
-                               '$baseurl' => App::get_baseurl()
+                               '$baseurl' => System::baseUrl()
 
                        ));
                                info("Your password has been reset." . EOL);
@@ -139,10 +144,10 @@ function lostpass_content(App &$a) {
                        '));
 
                        $preamble = sprintf($preamble, $username);
-                       $body = sprintf($body, App::get_baseurl(), $email, $new_password);
+                       $body = sprintf($body, System::baseUrl(), $email, $new_password);
 
                        notification(array(
-                               'type' => "SYSTEM_EMAIL",
+                               'type' => SYSTEM_EMAIL,
                                'to_email' => $email,
                                'subject'=> sprintf( t('Your password has been changed at %s'),$sitename),
                                'preamble'=> $preamble,