]> git.mxchange.org Git - friendica.git/blobdiff - mod/dfrn_request.php
Merge pull request #4243 from MrPetovan/task/switch-to-array-new-style
[friendica.git] / mod / dfrn_request.php
index 0bbc794bd5d1efbd0bb3b0d0b809a75389c22943..a5f18e07a3c298c803d8450cebccc6bbfdea19dc 100644 (file)
@@ -19,6 +19,7 @@ use Friendica\Database\DBM;
 use Friendica\Model\Contact;
 use Friendica\Model\Group;
 use Friendica\Model\User;
+use Friendica\Model\Profile;
 use Friendica\Module\Login;
 use Friendica\Network\Probe;
 
@@ -26,10 +27,11 @@ require_once 'include/enotify.php';
 
 function dfrn_request_init(App $a)
 {
-       if ($a->argc > 1)
+       if ($a->argc > 1) {
                $which = $a->argv[1];
+       }
 
-       profile_load($a, $which);
+       Profile::load($a, $which);
        return;
 }
 
@@ -87,12 +89,16 @@ function dfrn_request_post(App $a)
                                                // We don't need to be here. It has already happened.
                                                notice(t("This introduction has already been accepted.") . EOL);
                                                return;
-                                       } else
+                                       } else {
                                                $contact_record = $r[0];
+                                       }
                                }
 
                                if (is_array($contact_record)) {
-                                       $r = q("UPDATE `contact` SET `ret-aes` = %d, hidden = %d WHERE `id` = %d", intval($aes_allow), intval($hidden), intval($contact_record['id'])
+                                       $r = q("UPDATE `contact` SET `ret-aes` = %d, hidden = %d WHERE `id` = %d",
+                                               intval($aes_allow),
+                                               intval($hidden),
+                                               intval($contact_record['id'])
                                        );
                                } else {
                                        // Scrape the other site's profile page to pick up the dfrn links, key, fn, and photo
@@ -179,7 +185,7 @@ function dfrn_request_post(App $a)
                                }
 
                                // (ignore reply, nothing we can do it failed)
-                               // Old: goaway(zrl($dfrn_url));
+                               // Old: goaway(Profile::zrl($dfrn_url));
                                goaway($forwardurl);
                                return; // NOTREACHED
                        }
@@ -310,7 +316,7 @@ function dfrn_request_post(App $a)
                                        return;
                                } else {
                                        $contact_record = $ret[0];
-                                       $parms = array('dfrn-request' => $ret[0]['request']);
+                                       $parms = ['dfrn-request' => $ret[0]['request']];
                                }
                        }
 
@@ -511,7 +517,7 @@ function dfrn_request_content(App $a)
                }
 
                $tpl = get_markup_template("dfrn_req_confirm.tpl");
-               $o = replace_macros($tpl, array(
+               $o = replace_macros($tpl, [
                        '$dfrn_url' => $dfrn_url,
                        '$aes_allow' => (($aes_allow) ? '<input type="hidden" name="aes_allow" value="1" />' : "" ),
                        '$hidethem' => t('Hide this contact'),
@@ -523,7 +529,7 @@ function dfrn_request_content(App $a)
                        '$uid' => $_SESSION['uid'],
                        '$nickname' => $a->user['nickname'],
                        'dfrn_rawurl' => $_GET['dfrn_url']
-               ));
+               ]);
                return $o;
        } elseif ((x($_GET, 'confirm_key')) && strlen($_GET['confirm_key'])) {
                // we are the requestee and it is now safe to send our user their introduction,
@@ -547,7 +553,7 @@ function dfrn_request_content(App $a)
                                }
 
                                if (!$auto_confirm) {
-                                       notification(array(
+                                       notification([
                                                'type'         => NOTIFY_INTRO,
                                                'notify_flags' => $r[0]['notify-flags'],
                                                'language'     => $r[0]['language'],
@@ -560,19 +566,19 @@ function dfrn_request_content(App $a)
                                                'source_photo' => $r[0]['photo'],
                                                'verb'         => ACTIVITY_REQ_FRIEND,
                                                'otype'        => 'intro'
-                                       ));
+                                       ]);
                                }
 
                                if ($auto_confirm) {
                                        require_once 'mod/dfrn_confirm.php';
-                                       $handsfree = array(
+                                       $handsfree = [
                                                'uid'      => $r[0]['uid'],
                                                'node'     => $r[0]['nickname'],
                                                'dfrn_id'  => $r[0]['issued-id'],
                                                'intro_id' => $intro[0]['id'],
                                                'duplex'   => (($r[0]['page-flags'] == PAGE_FREELOVE) ? 1 : 0),
                                                'activity' => intval(PConfig::get($r[0]['uid'], 'system', 'post_newfriend'))
-                                       );
+                                       ];
                                        dfrn_confirm_post($a, $handsfree);
                                }
                        }
@@ -614,7 +620,7 @@ function dfrn_request_content(App $a)
                        }
                } else {
                        // last, try a zrl
-                       $myaddr = get_my_url();
+                       $myaddr = Profile::getMyURL();
                }
 
                $target_addr = $a->profile['nickname'] . '@' . substr(System::baseUrl(), strpos(System::baseUrl(), '://') + 3);
@@ -636,11 +642,11 @@ function dfrn_request_content(App $a)
                        get_server()
                );
 
-               $o = replace_macros($tpl, array(
+               $o = replace_macros($tpl, [
                        '$header' => t('Friend/Connection Request'),
                        '$desc' => t('Examples: jojo@demo.friendica.com, http://demo.friendica.com/profile/jojo, testuser@gnusocial.de'),
                        '$pls_answer' => t('Please answer the following:'),
-                       '$does_know_you' => array('knowyou', sprintf(t('Does %s know you?'), $a->profile['name']), false, '', array(t('No'), t('Yes'))),
+                       '$does_know_you' => ['knowyou', sprintf(t('Does %s know you?'), $a->profile['name']), false, '', [t('No'), t('Yes')]],
                        '$add_note' => t('Add a personal note:'),
                        '$page_desc' => $page_desc,
                        '$friendica' => t('Friendica'),
@@ -654,7 +660,7 @@ function dfrn_request_content(App $a)
                        '$nickname' => $a->argv[1],
                        '$name' => $a->profile['name'],
                        '$myaddr' => $myaddr
-               ));
+               ]);
                return $o;
        }