]> git.mxchange.org Git - friendica.git/blobdiff - mod/delegate.php
Merge pull request #3627 from tobiasd/20170812-invite
[friendica.git] / mod / delegate.php
index 1f261bb716afd6461fd88e8944ddbc6f06094855..e99734a33b32f14509d075f53212cf52b661adcc 100644 (file)
@@ -1,12 +1,14 @@
 <?php
+
+use Friendica\App;
+
 require_once('mod/settings.php');
 
-function delegate_init(App &$a) {
+function delegate_init(App $a) {
        return settings_init($a);
 }
 
-
-function delegate_content(App &$a) {
+function delegate_content(App $a) {
 
        if (! local_user()) {
                notice( t('Permission denied.') . EOL);
@@ -21,7 +23,6 @@ function delegate_content(App &$a) {
                        goaway(App::get_baseurl() . '/delegate');
                }
 
-
                $id = $a->argv[2];
 
                $r = q("select `nickname` from user where uid = %d limit 1",
@@ -45,12 +46,11 @@ 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') && intval($_SESSION['submanage'])) {
                        goaway(App::get_baseurl() . '/delegate');
                }
 
-               q("delete from manage where uid = %d and mid = %d limit 1",
+               q("DELETE FROM `manage` WHERE `uid` = %d AND `mid` = %d LIMIT 1",
                        intval($a->argv[2]),
                        intval(local_user())
                );
@@ -92,12 +92,12 @@ function delegate_content(App &$a) {
 
        // find every contact who might be a candidate for delegation
 
-       $r = q("select nurl from contact where substring_index(contact.nurl,'/',3) = '%s' 
+       $r = q("select nurl from contact where substring_index(contact.nurl,'/',3) = '%s'
                and contact.uid = %d and contact.self = 0 and network = '%s' ",
                dbesc(normalise_link(App::get_baseurl())),
                intval(local_user()),
                dbesc(NETWORK_DFRN)
-       ); 
+       );
 
        if (! dbm::is_result($r)) {
                notice( t('No potential page delegates located.') . EOL);
@@ -107,7 +107,7 @@ function delegate_content(App &$a) {
        $nicknames = array();
 
        if (dbm::is_result($r)) {
-               foreach($r as $rr) {
+               foreach ($r as $rr) {
                        $nicknames[] = "'" . dbesc(basename($rr['nurl'])) . "'";
                }
        }