]> git.mxchange.org Git - friendica.git/blobdiff - mod/delegate.php
Renamed System::redirect() to $a->redirect()
[friendica.git] / mod / delegate.php
index e9760fa3f5cafd0c06d2c991576d5c06cf9a32b0..e525e1ab80d76a402356f96c582fa3de0292835d 100644 (file)
@@ -4,10 +4,13 @@
  */
 
 use Friendica\App;
+use Friendica\BaseModule;
 use Friendica\Core\L10n;
+use Friendica\Core\Protocol;
 use Friendica\Core\System;
 use Friendica\Database\DBA;
 use Friendica\Model\User;
+use Friendica\Util\Security;
 
 require_once 'mod/settings.php';
 
@@ -27,7 +30,7 @@ function delegate_post(App $a)
                return;
        }
 
-       check_form_security_token_redirectOnErr('/delegate', 'delegate');
+       BaseModule::checkFormSecurityTokenRedirectOnError('/delegate', 'delegate');
 
        $parent_uid = defaults($_POST, 'parent_user', 0);
        $parent_password = defaults($_POST, 'parent_password', '');
@@ -59,7 +62,7 @@ function delegate_content(App $a)
        if ($a->argc > 2 && $a->argv[1] === 'add' && intval($a->argv[2])) {
                // delegated admins can view but not change delegation permissions
                if (x($_SESSION, 'submanage')) {
-                       goaway(System::baseUrl() . '/delegate');
+                       $a->redirect('delegate');
                }
 
                $user_id = $a->argv[2];
@@ -74,17 +77,17 @@ function delegate_content(App $a)
                                DBA::insert('manage', ['uid' => $user_id, 'mid' => local_user()]);
                        }
                }
-               goaway(System::baseUrl() . '/delegate');
+               $a->redirect('delegate');
        }
 
        if ($a->argc > 2 && $a->argv[1] === 'remove' && intval($a->argv[2])) {
                // delegated admins can view but not change delegation permissions
                if (x($_SESSION, 'submanage')) {
-                       goaway(System::baseUrl() . '/delegate');
+                       $a->redirect('delegate');
                }
 
                DBA::delete('manage', ['uid' => $a->argv[2], 'mid' => local_user()]);
-               goaway(System::baseUrl() . '/delegate');
+               $a->redirect('delegate');
        }
 
        // find everybody that currently has delegated management to this account/page
@@ -110,14 +113,14 @@ function delegate_content(App $a)
                AND SUBSTRING_INDEX(`nurl`, '/', 3) = '%s'
                AND `uid` = %d
                AND `network` = '%s' ",
-               dbesc(normalise_link(System::baseUrl())),
+               DBA::escape(normalise_link(System::baseUrl())),
                intval(local_user()),
-               dbesc(NETWORK_DFRN)
+               DBA::escape(Protocol::DFRN)
        );
        if (DBA::isResult($r)) {
                $nicknames = [];
                foreach ($r as $rr) {
-                       $nicknames[] = "'" . dbesc(basename($rr['nurl'])) . "'";
+                       $nicknames[] = "'" . DBA::escape(basename($rr['nurl'])) . "'";
                }
 
                $nicks = implode(',', $nicknames);
@@ -161,7 +164,7 @@ function delegate_content(App $a)
        }
 
        $o = replace_macros(get_markup_template('delegate.tpl'), [
-               '$form_security_token' => get_form_security_token('delegate'),
+               '$form_security_token' => BaseModule::getFormSecurityToken('delegate'),
                '$parent_header' => L10n::t('Parent User'),
                '$parent_user' => $parent_user,
                '$parent_password' => $parent_password,