]> git.mxchange.org Git - friendica.git/blobdiff - mod/delegate.php
Storing the protocol while following a contact
[friendica.git] / mod / delegate.php
index c8987ab570c95c6c2ab719a1017f712f736417df..456078451570cbc1db5f929201f6de0fa5cd6ad3 100644 (file)
@@ -11,14 +11,13 @@ use Friendica\Core\Renderer;
 use Friendica\Core\System;
 use Friendica\Database\DBA;
 use Friendica\Model\User;
-use Friendica\Util\Security;
 use Friendica\Util\Strings;
 
 require_once 'mod/settings.php';
 
 function delegate_init(App $a)
 {
-       return settings_init($a);
+       settings_init($a);
 }
 
 function delegate_post(App $a)
@@ -27,7 +26,7 @@ function delegate_post(App $a)
                return;
        }
 
-       if (count($a->user) && x($a->user, 'uid') && $a->user['uid'] != local_user()) {
+       if (count($a->user) && !empty($a->user['uid']) && $a->user['uid'] != local_user()) {
                notice(L10n::t('Permission denied.') . EOL);
                return;
        }
@@ -63,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')) {
+               if (!empty($_SESSION['submanage'])) {
                        $a->internalRedirect('delegate');
                }
 
@@ -84,7 +83,7 @@ function delegate_content(App $a)
 
        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')) {
+               if (!empty($_SESSION['submanage'])) {
                        $a->internalRedirect('delegate');
                }
 
@@ -163,6 +162,8 @@ function delegate_content(App $a)
 
        if (!is_null($parent_user)) {
                $parent_password = ['parent_password', L10n::t('Parent Password:'), '', L10n::t('Please enter the password of the parent account to legitimize your request.')];
+       } else {
+               $parent_password = '';
        }
 
        $o = Renderer::replaceMacros(Renderer::getMarkupTemplate('delegate.tpl'), [