]> git.mxchange.org Git - friendica.git/blobdiff - mod/dfrn_request.php
Move Contact::Page_* constants to User::PAGE_FLAGS_*
[friendica.git] / mod / dfrn_request.php
index 16a2da55607cca309f96959d8134ceefa1658e29..6142257e77fd0083f9b80205450580452c67be56 100644 (file)
@@ -30,8 +30,6 @@ use Friendica\Util\DateTimeFormat;
 use Friendica\Util\Network;
 use Friendica\Util\Strings;
 
-require_once 'include/enotify.php';
-
 function dfrn_request_init(App $a)
 {
        if ($a->argc > 1) {
@@ -56,6 +54,9 @@ function dfrn_request_init(App $a)
  * in order to link our friend request with our own server cell.
  * After logging in, we click 'submit' to approve the linkage.
  *
+ * @param App $a
+ * @throws ImagickException
+ * @throws \Friendica\Network\HTTPException\InternalServerErrorException
  */
 function dfrn_request_post(App $a)
 {
@@ -187,7 +188,7 @@ function dfrn_request_post(App $a)
                                }
 
                                if (strlen($dfrn_request) && strlen($confirm_key)) {
-                                       $s = Network::fetchUrl($dfrn_request . '?confirm_key=' . $confirm_key);
+                                       Network::fetchUrl($dfrn_request . '?confirm_key=' . $confirm_key);
                                }
 
                                // (ignore reply, nothing we can do it failed)
@@ -229,7 +230,6 @@ function dfrn_request_post(App $a)
        }
 
        $nickname       = $a->profile['nickname'];
-       $notify_flags   = $a->profile['notify-flags'];
        $uid            = $a->profile['uid'];
        $maxreq         = intval($a->profile['maxreq']);
        $contact_record = null;
@@ -270,8 +270,6 @@ function dfrn_request_post(App $a)
                        }
                }
 
-               $real_name = !empty($_POST['realname']) ? Strings::escapeTags(trim($_POST['realname'])) : '';
-
                $url = trim($_POST['dfrn_url']);
                if (!strlen($url)) {
                        notice(L10n::t("Invalid locator") . EOL);
@@ -419,7 +417,7 @@ function dfrn_request_post(App $a)
                        $hash = Strings::getRandomHex() . (string) time();   // Generate a confirm_key
 
                        if (is_array($contact_record)) {
-                               $ret = q("INSERT INTO `intro` ( `uid`, `contact-id`, `blocked`, `knowyou`, `note`, `hash`, `datetime`)
+                               q("INSERT INTO `intro` ( `uid`, `contact-id`, `blocked`, `knowyou`, `note`, `hash`, `datetime`)
                                        VALUES ( %d, %d, 1, %d, '%s', '%s', '%s' )",
                                        intval($uid),
                                        intval($contact_record['id']),
@@ -512,8 +510,7 @@ function dfrn_request_content(App $a)
 
                        dfrn_request_post($a);
 
-                       killme();
-                       return; // NOTREACHED
+                       exit();
                }
 
                $tpl = Renderer::getMarkupTemplate("dfrn_req_confirm.tpl");
@@ -521,7 +518,6 @@ function dfrn_request_content(App $a)
                        '$dfrn_url' => $dfrn_url,
                        '$aes_allow' => (($aes_allow) ? '<input type="hidden" name="aes_allow" value="1" />' : "" ),
                        '$hidethem' => L10n::t('Hide this contact'),
-                       '$hidechecked' => '',
                        '$confirm_key' => $confirm_key,
                        '$welcome' => L10n::t('Welcome home %s.', $a->user['username']),
                        '$please' => L10n::t('Please confirm your introduction/connection request to %s.', $dfrn_url),
@@ -548,7 +544,7 @@ function dfrn_request_content(App $a)
                        $auto_confirm = false;
 
                        if (DBA::isResult($r)) {
-                               if ($r[0]['page-flags'] != Contact::PAGE_NORMAL && $r[0]['page-flags'] != Contact::PAGE_PRVGROUP) {
+                               if ($r[0]['page-flags'] != User::PAGE_FLAGS_NORMAL && $r[0]['page-flags'] != User::PAGE_FLAGS_PRVGROUP) {
                                        $auto_confirm = true;
                                }
 
@@ -576,7 +572,7 @@ function dfrn_request_content(App $a)
                                                'node'     => $r[0]['nickname'],
                                                'dfrn_id'  => $r[0]['issued-id'],
                                                'intro_id' => $intro[0]['id'],
-                                               'duplex'   => (($r[0]['page-flags'] == Contact::PAGE_FREELOVE) ? 1 : 0),
+                                               'duplex'   => (($r[0]['page-flags'] == User::PAGE_FLAGS_FREELOVE) ? 1 : 0),
                                        ];
                                        dfrn_confirm_post($a, $handsfree);
                                }
@@ -587,14 +583,13 @@ function dfrn_request_content(App $a)
                                // If we are auto_confirming, this record will have already been nuked
                                // in dfrn_confirm_post()
 
-                               $r = q("UPDATE `intro` SET `blocked` = 0 WHERE `hash` = '%s'",
+                               q("UPDATE `intro` SET `blocked` = 0 WHERE `hash` = '%s'",
                                        DBA::escape($_GET['confirm_key'])
                                );
                        }
                }
 
-               killme();
-               return; // NOTREACHED
+               exit();
        } else {
                // Normal web request. Display our user's introduction form.
                if ((Config::get('system', 'block_public')) && (!local_user()) && (!remote_user())) {
@@ -628,7 +623,7 @@ function dfrn_request_content(App $a)
                 * because nobody is going to read the comments and
                 * it doesn't matter if they know you or not.
                 */
-               if ($a->profile['page-flags'] == Contact::PAGE_NORMAL) {
+               if ($a->profile['page-flags'] == User::PAGE_FLAGS_NORMAL) {
                        $tpl = Renderer::getMarkupTemplate('dfrn_request.tpl');
                } else {
                        $tpl = Renderer::getMarkupTemplate('auto_request.tpl');
@@ -636,10 +631,7 @@ function dfrn_request_content(App $a)
 
                $page_desc = L10n::t("Please enter your 'Identity Address' from one of the following supported communications networks:");
 
-               $invite_desc = sprintf(
-                       L10n::t('If you are not yet a member of the free social web, <a href="%s">follow this link to find a public Friendica site and join us today</a>.'),
-                       get_server() . '/servers'
-               );
+               $invite_desc = L10n::t('If you are not yet a member of the free social web, <a href="%s">follow this link to find a public Friendica site and join us today</a>.', get_server() . '/servers');
 
                $o = Renderer::replaceMacros($tpl, [
                        '$header' => L10n::t('Friend/Connection Request'),
@@ -662,6 +654,4 @@ function dfrn_request_content(App $a)
                ]);
                return $o;
        }
-
-       return; // Somebody is fishing.
 }