]> git.mxchange.org Git - friendica.git/commitdiff
Move xml_status and http_status_exit
authorAdam Magness <adam.magness@gmail.com>
Sat, 27 Jan 2018 04:37:55 +0000 (23:37 -0500)
committerAdam Magness <adam.magness@gmail.com>
Sat, 27 Jan 2018 04:37:55 +0000 (23:37 -0500)
move functions

18 files changed:
include/network.php
mod/_well_known.php
mod/dfrn_confirm.php
mod/dfrn_notify.php
mod/dfrn_poll.php
mod/display.php
mod/hovercard.php
mod/nodeinfo.php
mod/poco.php
mod/probe.php
mod/pubsubhubbub.php
mod/receive.php
mod/salmon.php
mod/search.php
mod/statistics_json.php
mod/webfinger.php
src/Module/Feed.php
src/Protocol/Diaspora.php

index 875597f764e7fccb54f30ddf6eefdcdcb99693bb..726eac757062b7d758bda7af11cce250a0c1559e 100644 (file)
@@ -12,16 +12,6 @@ use Friendica\Object\Image;
 use Friendica\Util\Network;
 use Friendica\Util\XML;
 
-function xml_status($st, $message = '')
-{
-       Network::xmlStatus($st, $message);
-}
-
-function http_status_exit($val, $description = [])
-{
-       Network::httpStatusExit($val, $description);
-}
-
 function validate_url($url)
 {
        return Network::validateURL($url);
index 4b37c0b97f05fb162fd424a27c94d7144dcecba8..e7bc8c92bf66bbce2f640bea829543d1f48dbaf6 100644 (file)
@@ -2,10 +2,11 @@
 
 use Friendica\App;
 use Friendica\Core\Config;
+use Friendica\Util\Network;
 
-require_once("mod/hostxrd.php");
-require_once("mod/nodeinfo.php");
-require_once("mod/xrd.php");
+require_once 'mod/hostxrd.php';
+require_once 'mod/nodeinfo.php';
+require_once 'mod/xrd.php';
 
 function _well_known_init(App $a)
 {
@@ -25,7 +26,7 @@ function _well_known_init(App $a)
                                break;
                }
        }
-       http_status_exit(404);
+       Network::httpStatusExit(404);
        killme();
 }
 
index d3c84c54fa20680c94d7a09f3c72036626e37d10..9e5f0f3d54b3c64c7fe188f6ec8acd16c2645224 100644 (file)
@@ -493,7 +493,7 @@ function dfrn_confirm_post(App $a, $handsfree = null)
                $user = dba::selectFirst('user', [], ['nickname' => $node]);
                if (!DBM::is_result($user)) {
                        $message = L10n::t('No user record found for \'%s\' ', $node);
-                       xml_status(3, $message); // failure
+                       Network::xmlStatus(3, $message); // failure
                        // NOTREACHED
                }
 
@@ -503,7 +503,7 @@ function dfrn_confirm_post(App $a, $handsfree = null)
 
                if (!strstr($my_prvkey, 'PRIVATE KEY')) {
                        $message = L10n::t('Our site encryption key is apparently messed up.');
-                       xml_status(3, $message);
+                       Network::xmlStatus(3, $message);
                }
 
                // verify everything
@@ -514,7 +514,7 @@ function dfrn_confirm_post(App $a, $handsfree = null)
 
                if (!strlen($decrypted_source_url)) {
                        $message = L10n::t('Empty site URL was provided or URL could not be decrypted by us.');
-                       xml_status(3, $message);
+                       Network::xmlStatus(3, $message);
                        // NOTREACHED
                }
 
@@ -530,7 +530,7 @@ function dfrn_confirm_post(App $a, $handsfree = null)
                        if (!DBM::is_result($contact)) {
                                // this is either a bogus confirmation (?) or we deleted the original introduction.
                                $message = L10n::t('Contact record was not found for you on our site.');
-                               xml_status(3, $message);
+                               Network::xmlStatus(3, $message);
                                return; // NOTREACHED
                        }
                }
@@ -544,7 +544,7 @@ function dfrn_confirm_post(App $a, $handsfree = null)
 
                if (!$foreign_pubkey) {
                        $message = L10n::t('Site public key not available in contact record for URL %s.', $decrypted_source_url);
-                       xml_status(3, $message);
+                       Network::xmlStatus(3, $message);
                }
 
                $decrypted_dfrn_id = "";
@@ -560,7 +560,7 @@ function dfrn_confirm_post(App $a, $handsfree = null)
 
                if (dba::exists('contact', ['dfrn-id' => $decrypted_dfrn_id])) {
                        $message = L10n::t('The ID provided by your system is a duplicate on our system. It should work if you try again.');
-                       xml_status(1, $message); // Birthday paradox - duplicate dfrn-id
+                       Network::xmlStatus(1, $message); // Birthday paradox - duplicate dfrn-id
                        // NOTREACHED
                }
 
@@ -571,7 +571,7 @@ function dfrn_confirm_post(App $a, $handsfree = null)
                );
                if (!DBM::is_result($r)) {
                        $message = L10n::t('Unable to set your contact credentials on our system.');
-                       xml_status(3, $message);
+                       Network::xmlStatus(3, $message);
                }
 
                // It's possible that the other person also requested friendship.
@@ -626,7 +626,7 @@ function dfrn_confirm_post(App $a, $handsfree = null)
                );
                if (!DBM::is_result($r)) {      // indicates schema is messed up or total db failure
                        $message = L10n::t('Unable to update your contact profile details on our system');
-                       xml_status(3, $message);
+                       Network::xmlStatus(3, $message);
                }
 
                // Otherwise everything seems to have worked and we are almost done. Yay!
@@ -707,7 +707,7 @@ function dfrn_confirm_post(App $a, $handsfree = null)
                                }
                        }
                }
-               xml_status(0); // Success
+               Network::xmlStatus(0); // Success
                return; // NOTREACHED
                ////////////////////// End of this scenario ///////////////////////////////////////////////
        }
index 8903d66e3529ba1db492b9128a9c591c14dcca93..142cafaa09f7b510341f1349b303ab52dd57b364 100644 (file)
@@ -11,6 +11,7 @@ use Friendica\Core\Config;
 use Friendica\Database\DBM;
 use Friendica\Model\Contact;
 use Friendica\Protocol\DFRN;
+use Friendica\Util\Network;
 
 require_once 'include/items.php';
 require_once 'include/event.php';
@@ -48,7 +49,7 @@ function dfrn_notify_post(App $a) {
        );
        if (! DBM::is_result($r)) {
                logger('dfrn_notify: could not match challenge to dfrn_id ' . $dfrn_id . ' challenge=' . $challenge);
-               xml_status(3, 'Could not match challenge');
+               Network::xmlStatus(3, 'Could not match challenge');
        }
 
        $r = q("DELETE FROM `challenge` WHERE `dfrn-id` = '%s' AND `challenge` = '%s'",
@@ -70,7 +71,7 @@ function dfrn_notify_post(App $a) {
                        $sql_extra = sprintf(" AND `dfrn-id` = '%s' AND `duplex` = 1 ", dbesc($dfrn_id));
                        break;
                default:
-                       xml_status(3, 'Invalid direction');
+                       Network::xmlStatus(3, 'Invalid direction');
                        break; // NOTREACHED
        }
 
@@ -96,7 +97,7 @@ function dfrn_notify_post(App $a) {
 
        if (! DBM::is_result($r)) {
                logger('dfrn_notify: contact not found for dfrn_id ' . $dfrn_id);
-               xml_status(3, 'Contact not found');
+               Network::xmlStatus(3, 'Contact not found');
                //NOTREACHED
        }
 
@@ -131,7 +132,7 @@ function dfrn_notify_post(App $a) {
                // Relationship is dissolved permanently
                Contact::remove($importer['id']);
                logger('relationship dissolved : ' . $importer['name'] . ' dissolved ' . $importer['username']);
-               xml_status(0, 'relationship dissolved');
+               Network::xmlStatus(0, 'relationship dissolved');
        }
 
        $rino = Config::get('system', 'rino_encrypt');
@@ -145,7 +146,7 @@ function dfrn_notify_post(App $a) {
                // but only for $remote_rino > 1, because old code did't send rino version
                if ($rino_remote > 1 && $rino < $rino_remote) {
                        logger("rino version '$rino_remote' is lower than supported '$rino'");
-                       xml_status(0, "rino version '$rino_remote' is lower than supported '$rino'");
+                       Network::xmlStatus(0, "rino version '$rino_remote' is lower than supported '$rino'");
                }
 
                $rawkey = hex2bin(trim($key));
@@ -175,14 +176,14 @@ function dfrn_notify_post(App $a) {
                                break;
                        default:
                                logger("rino: invalid sent version '$rino_remote'");
-                               xml_status(0, "Invalid sent version '$rino_remote'");
+                               Network::xmlStatus(0, "Invalid sent version '$rino_remote'");
                }
 
                logger('rino: decrypted data: ' . $data, LOGGER_DATA);
        }
 
        $ret = DFRN::import($data, $importer);
-       xml_status($ret, 'Processed');
+       Network::xmlStatus($ret, 'Processed');
 
        // NOTREACHED
 }
index 0392c2c920e89923aa824b36fe7fb245231f267c..8841a7b5a63b8c82119bad4985cd5a7563e1c24c 100644 (file)
@@ -48,7 +48,7 @@ function dfrn_poll_init(App $a)
 
        if (($dfrn_id === '') && (!x($_POST, 'dfrn_id'))) {
                if (Config::get('system', 'block_public') && !local_user() && !remote_user()) {
-                       http_status_exit(403);
+                       Network::httpStatusExit(403);
                }
 
                $user = '';
@@ -57,7 +57,7 @@ function dfrn_poll_init(App $a)
                                dbesc($a->argv[1])
                        );
                        if (!$r) {
-                               http_status_exit(404);
+                               Network::httpStatusExit(404);
                        }
 
                        $hidewall = ($r[0]['hidewall'] && !local_user());
@@ -144,7 +144,7 @@ function dfrn_poll_init(App $a)
                                dbesc($sec)
                        );
                        if (!DBM::is_result($r)) {
-                               xml_status(3, 'No ticket');
+                               Network::xmlStatus(3, 'No ticket');
                                // NOTREACHED
                        }
 
@@ -157,7 +157,7 @@ function dfrn_poll_init(App $a)
                                intval($r[0]['cid'])
                        );
                        if (!DBM::is_result($c)) {
-                               xml_status(3, 'No profile');
+                               Network::xmlStatus(3, 'No profile');
                        }
 
                        $contact = $c[0];
@@ -184,7 +184,7 @@ function dfrn_poll_init(App $a)
                        if ($final_dfrn_id != $orig_id) {
                                logger('profile_check: ' . $final_dfrn_id . ' != ' . $orig_id, LOGGER_DEBUG);
                                // did not decode properly - cannot trust this site
-                               xml_status(3, 'Bad decryption');
+                               Network::xmlStatus(3, 'Bad decryption');
                        }
 
                        header("Content-type: text/xml");
@@ -208,10 +208,10 @@ function dfrn_poll_init(App $a)
                        $r = q("SELECT * FROM `profile_check` WHERE `dfrn_id` = '%s' ORDER BY `expire` DESC",
                                dbesc($dfrn_id));
                        if (DBM::is_result($r)) {
-                               xml_status(1);
+                               Network::xmlStatus(1);
                                return; // NOTREACHED
                        }
-                       xml_status(0);
+                       Network::xmlStatus(0);
                        return; // NOTREACHED
                }
        }
@@ -236,7 +236,7 @@ function dfrn_poll_post(App $a)
                                dbesc($sec)
                        );
                        if (!DBM::is_result($r)) {
-                               xml_status(3, 'No ticket');
+                               Network::xmlStatus(3, 'No ticket');
                                // NOTREACHED
                        }
 
@@ -249,7 +249,7 @@ function dfrn_poll_post(App $a)
                                intval($r[0]['cid'])
                        );
                        if (!DBM::is_result($c)) {
-                               xml_status(3, 'No profile');
+                               Network::xmlStatus(3, 'No profile');
                        }
 
                        $contact = $c[0];
@@ -276,7 +276,7 @@ function dfrn_poll_post(App $a)
                        if ($final_dfrn_id != $orig_id) {
                                logger('profile_check: ' . $final_dfrn_id . ' != ' . $orig_id, LOGGER_DEBUG);
                                // did not decode properly - cannot trust this site
-                               xml_status(3, 'Bad decryption');
+                               Network::xmlStatus(3, 'Bad decryption');
                        }
 
                        header("Content-type: text/xml");
index d62b398a754d98567c0be804a9abdbde34f42da7..54a54be1678fa615db4311afb735818faa6a257b 100644 (file)
@@ -11,6 +11,7 @@ use Friendica\Model\Contact;
 use Friendica\Model\Group;
 use Friendica\Model\Profile;
 use Friendica\Protocol\DFRN;
+use Friendica\Util\Network;
 
 function display_init(App $a)
 {
@@ -423,7 +424,7 @@ function display_content(App $a, $update = false, $update_uid = 0) {
 function displayShowFeed($item_id, $conversation) {
        $xml = DFRN::itemFeed($item_id, $conversation);
        if ($xml == '') {
-               http_status_exit(500);
+               Network::httpStatusExit(500);
        }
        header("Content-type: application/atom+xml");
        echo $xml;
index 334bf228abe74ddb253c79ccb5d1b253ef69f593..29a23acdffe3ae784a00cd3605ca2df2128cfe00 100644 (file)
@@ -12,6 +12,7 @@ use Friendica\Core\Config;
 use Friendica\Model\Contact;
 use Friendica\Model\GContact;
 use Friendica\Model\Profile;
+use Friendica\Util\Network;
 
 function hovercard_init(App $a)
 {
@@ -26,7 +27,7 @@ function hovercard_content()
 
        // Get out if the system doesn't have public access allowed
        if (intval(Config::get('system', 'block_public'))) {
-               http_status_exit(401);
+               Network::httpStatusExit(401);
        }
 
        // Return the raw content of the template. We use this to make templates usable for js functions.
index d0c4acab02b3a1ddb23470f0df1860159e76f36f..b3d42ab52ee35b95a864efbaa8eeeb50bbe0b3bf 100644 (file)
@@ -22,12 +22,12 @@ function nodeinfo_wellknown(App $a) {
 
 function nodeinfo_init(App $a) {
        if (!Config::get('system', 'nodeinfo')) {
-               http_status_exit(404);
+               Network::httpStatusExit(404);
                killme();
        }
 
        if (($a->argc != 2) || ($a->argv[1] != '1.0')) {
-               http_status_exit(404);
+               Network::httpStatusExit(404);
                killme();
        }
 
index 761a9c2b80858bf0d4ea79250798e35748899e9a..348f76d1ce8904c52a695edf3a24e5310a343280 100644 (file)
@@ -8,12 +8,13 @@ use Friendica\Core\Cache;
 use Friendica\Core\Config;
 use Friendica\Database\DBM;
 use Friendica\Protocol\PortableContact;
+use Friendica\Util\Network;
 
 function poco_init(App $a) {
        $system_mode = false;
 
        if (intval(Config::get('system', 'block_public')) || (Config::get('system', 'block_local_dir'))) {
-               http_status_exit(401);
+               Network::httpStatusExit(401);
        }
 
        if ($a->argc > 1) {
@@ -22,7 +23,7 @@ function poco_init(App $a) {
        if (! x($user)) {
                $c = q("SELECT * FROM `pconfig` WHERE `cat` = 'system' AND `k` = 'suggestme' AND `v` = 1");
                if (! DBM::is_result($c)) {
-                       http_status_exit(401);
+                       Network::httpStatusExit(401);
                }
                $system_mode = true;
        }
@@ -63,7 +64,7 @@ function poco_init(App $a) {
                        dbesc($user)
                );
                if (! DBM::is_result($users) || $users[0]['hidewall'] || $users[0]['hide-friends']) {
-                       http_status_exit(404);
+                       Network::httpStatusExit(404);
                }
 
                $user = $users[0];
@@ -357,7 +358,7 @@ function poco_init(App $a) {
                        $ret['entry'][] = [];
                }
        } else {
-               http_status_exit(500);
+               Network::httpStatusExit(500);
        }
        logger("End of poco", LOGGER_DEBUG);
 
@@ -371,6 +372,6 @@ function poco_init(App $a) {
                echo json_encode($ret);
                killme();
        } else {
-               http_status_exit(500);
+               Network::httpStatusExit(500);
        }
 }
index deb80c0de28d5c40b975a8679809def49ff9e1a9..a7746d55bcddceb8de7539532a9ed06d2b1f26c2 100644 (file)
@@ -5,11 +5,12 @@
 use Friendica\App;
 use Friendica\Core\L10n;
 use Friendica\Network\Probe;
+use Friendica\Util\Network;
 
 function probe_content(App $a)
 {
        if (!local_user()) {
-               http_status_exit(403, ["title" => L10n::t("Public access denied."),
+               Network::httpStatusExit(403, ["title" => L10n::t("Public access denied."),
                        "description" => L10n::t("Only logged in users are permitted to perform a probing.")]);
                killme();
        }
index c2091d4de84df0c643801ad2f336ec46138eda96..af7172cee29bc376130c52b75fd22afeb0033d87 100644 (file)
@@ -13,7 +13,7 @@ function pubsubhubbub_init(App $a) {
        // PuSH subscription must be considered "public" so just block it
        // if public access isn't enabled.
        if (Config::get('system', 'block_public')) {
-               http_status_exit(403);
+               Network::httpStatusExit(403);
        }
 
        // Subscription request from subscriber
@@ -41,7 +41,7 @@ function pubsubhubbub_init(App $a) {
                        $subscribe = 0;
                } else {
                        logger("pubsubhubbub: invalid hub_mode=$hub_mode, ignoring.");
-                       http_status_exit(404);
+                       Network::httpStatusExit(404);
                }
 
                logger("pubsubhubbub: $hub_mode request from " .
@@ -57,7 +57,7 @@ function pubsubhubbub_init(App $a) {
 
                if (!$nick) {
                        logger('pubsubhubbub: bad hub_topic=$hub_topic, ignoring.');
-                       http_status_exit(404);
+                       Network::httpStatusExit(404);
                }
 
                // fetch user from database given the nickname
@@ -67,7 +67,7 @@ function pubsubhubbub_init(App $a) {
 
                if (!DBM::is_result($r)) {
                        logger('pubsubhubbub: local account not found: ' . $nick);
-                       http_status_exit(404);
+                       Network::httpStatusExit(404);
                }
 
                $owner = $r[0];
@@ -76,7 +76,7 @@ function pubsubhubbub_init(App $a) {
                if ($r[0]['hidewall']) {
                        logger('pubsubhubbub: local user ' . $nick .
                                   'has chosen to hide wall, ignoring.');
-                       http_status_exit(403);
+                       Network::httpStatusExit(403);
                }
 
                // get corresponding row from contact table
@@ -85,7 +85,7 @@ function pubsubhubbub_init(App $a) {
                           intval($owner['uid']));
                if (!DBM::is_result($r)) {
                        logger('pubsubhubbub: contact not found.');
-                       http_status_exit(404);
+                       Network::httpStatusExit(404);
                }
 
                $contact = $r[0];
@@ -94,7 +94,7 @@ function pubsubhubbub_init(App $a) {
                if (!link_compare($hub_topic, $contact['poll'])) {
                        logger('pubsubhubbub: hub topic ' . $hub_topic . ' != ' .
                                   $contact['poll']);
-                       http_status_exit(404);
+                       Network::httpStatusExit(404);
                }
 
                // do subscriber verification according to the PuSH protocol
@@ -117,7 +117,7 @@ function pubsubhubbub_init(App $a) {
                if ($ret < 200 || $ret > 299) {
                        logger("pubsubhubbub: subscriber verification at $hub_callback ".
                                   "returned $ret, ignoring.");
-                       http_status_exit(404);
+                       Network::httpStatusExit(404);
                }
 
                // check that the correct hub_challenge code was echoed back
@@ -125,7 +125,7 @@ function pubsubhubbub_init(App $a) {
                        logger("pubsubhubbub: subscriber did not echo back ".
                                   "hub.challenge, ignoring.");
                        logger("\"$hub_challenge\" != \"".trim($body)."\"");
-                       http_status_exit(404);
+                       Network::httpStatusExit(404);
                }
 
                // fetch the old subscription if it exists
@@ -163,7 +163,7 @@ function pubsubhubbub_init(App $a) {
                        logger("pubsubhubbub: successfully unsubscribed [$hub_callback].");
                        // we do nothing here, since the row was already deleted
                }
-               http_status_exit(202);
+               Network::httpStatusExit(202);
        }
 
        killme();
index 0c7a7e095391f8ae4201539741300761e56d8d52..60b8ed7961afe143aa1129c95ff9f276d99f6995 100644 (file)
@@ -8,6 +8,7 @@ use Friendica\App;
 use Friendica\Core\Config;
 use Friendica\Database\DBM;
 use Friendica\Protocol\Diaspora;
+use Friendica\Util\Network;
 
 /**
  * @param object $a App
@@ -18,7 +19,7 @@ function receive_post(App $a)
        $enabled = intval(Config::get('system', 'diaspora_enabled'));
        if (!$enabled) {
                logger('mod-diaspora: disabled');
-               http_status_exit(500);
+               Network::httpStatusExit(500);
        }
 
        if (($a->argc == 2) && ($a->argv[1] === 'public')) {
@@ -28,13 +29,13 @@ function receive_post(App $a)
                $public = false;
 
                if ($a->argc != 3 || $a->argv[1] !== 'users') {
-                       http_status_exit(500);
+                       Network::httpStatusExit(500);
                }
                $guid = $a->argv[2];
 
                $importer = dba::selectFirst('user', [], ['guid' => $guid, 'account_expired' => false, 'account_removed' => false]);
                if (!DBM::is_result($importer)) {
-                       http_status_exit(500);
+                       Network::httpStatusExit(500);
                }
        }
 
@@ -47,7 +48,7 @@ function receive_post(App $a)
        if (!$xml) {
                $postdata = file_get_contents("php://input");
                if ($postdata == '') {
-                       http_status_exit(500);
+                       Network::httpStatusExit(500);
                }
 
                logger('mod-diaspora: message is in the new format', LOGGER_DEBUG);
@@ -67,7 +68,7 @@ function receive_post(App $a)
        logger('mod-diaspora: decoded msg: ' . print_r($msg, true), LOGGER_DATA);
 
        if (!is_array($msg)) {
-               http_status_exit(500);
+               Network::httpStatusExit(500);
        }
 
        logger('mod-diaspora: dispatching', LOGGER_DEBUG);
@@ -79,6 +80,6 @@ function receive_post(App $a)
                $ret = Diaspora::dispatch($importer, $msg);
        }
 
-       http_status_exit(($ret) ? 200 : 500);
+       Network::httpStatusExit(($ret) ? 200 : 500);
        // NOTREACHED
 }
index d5b0fe243036b3d0dc41484af647371a61ff17da..20806df559472616729a299300f94814f0b61a22 100644 (file)
@@ -9,6 +9,7 @@ use Friendica\Model\Contact;
 use Friendica\Protocol\OStatus;
 use Friendica\Protocol\Salmon;
 use Friendica\Util\Crypto;
+use Friendica\Util\Network;
 
 require_once 'include/items.php';
 
@@ -38,7 +39,7 @@ function salmon_post(App $a) {
                dbesc($nick)
        );
        if (! DBM::is_result($r)) {
-               http_status_exit(500);
+               Network::httpStatusExit(500);
        }
 
        $importer = $r[0];
@@ -58,7 +59,7 @@ function salmon_post(App $a) {
 
        if(! $base) {
                logger('mod-salmon: unable to locate salmon data in xml ');
-               http_status_exit(400);
+               Network::httpStatusExit(400);
        }
 
        // Stash the signature away for now. We have to find their key or it won't be good for anything.
@@ -96,7 +97,7 @@ function salmon_post(App $a) {
 
        if(! $author_link) {
                logger('mod-salmon: Could not retrieve author URI.');
-               http_status_exit(400);
+               Network::httpStatusExit(400);
        }
 
        // Once we have the author URI, go to the web and try to find their public key
@@ -107,7 +108,7 @@ function salmon_post(App $a) {
 
        if(! $key) {
                logger('mod-salmon: Could not retrieve author key.');
-               http_status_exit(400);
+               Network::httpStatusExit(400);
        }
 
        $key_info = explode('.',$key);
@@ -139,7 +140,7 @@ function salmon_post(App $a) {
 
        if (! $verify) {
                logger('mod-salmon: Message did not verify. Discarding.');
-               http_status_exit(400);
+               Network::httpStatusExit(400);
        }
 
        logger('mod-salmon: Message verified with mode '.$mode);
@@ -183,7 +184,7 @@ function salmon_post(App $a) {
        //if((DBM::is_result($r)) && (($r[0]['readonly']) || ($r[0]['rel'] == CONTACT_IS_FOLLOWER) || ($r[0]['blocked']))) {
        if (DBM::is_result($r) && $r[0]['blocked']) {
                logger('mod-salmon: Ignoring this author.');
-               http_status_exit(202);
+               Network::httpStatusExit(202);
                // NOTREACHED
        }
 
@@ -194,5 +195,5 @@ function salmon_post(App $a) {
 
        OStatus::import($data, $importer, $contact_rec, $hub);
 
-       http_status_exit(200);
+       Network::httpStatusExit(200);
 }
index b48fafe7854ae295d92478f94a8fa754bbcbbf14..681dbc9a526a719397d8f011fb8f4f9e7a329bb7 100644 (file)
@@ -9,6 +9,7 @@ use Friendica\Core\Cache;
 use Friendica\Core\Config;
 use Friendica\Core\L10n;
 use Friendica\Database\DBM;
+use Friendica\Util\Network;
 
 require_once "include/bbcode.php";
 require_once 'include/security.php';
@@ -99,7 +100,7 @@ function search_content(App $a) {
        }
 
        if (Config::get('system','local_search') && !local_user() && !remote_user()) {
-               http_status_exit(403,
+               Network::httpStatusExit(403,
                                ["title" => L10n::t("Public access denied."),
                                        "description" => L10n::t("Only logged in users are permitted to perform a search.")]);
                killme();
@@ -124,7 +125,7 @@ function search_content(App $a) {
                if (!is_null($result)) {
                        $resultdata = json_decode($result);
                        if (($resultdata->time > (time() - $crawl_permit_period)) && ($resultdata->accesses > $free_crawls)) {
-                               http_status_exit(429,
+                               Network::httpStatusExit(429,
                                                ["title" => L10n::t("Too Many Requests"),
                                                        "description" => L10n::t("Only one search per minute is permitted for not logged in users.")]);
                                killme();
index f2c6e074f98efe17dec9860e0b456c0a47e12928..75e89ba75e304ed4377a5f3f6a6bb86671c9f884 100644 (file)
@@ -7,11 +7,12 @@
 use Friendica\App;
 use Friendica\Core\Addon;
 use Friendica\Core\Config;
+use Friendica\Util\Network;
 
 function statistics_json_init(App $a) {
 
        if (!Config::get("system", "nodeinfo")) {
-               http_status_exit(404);
+               Network::httpStatusExit(404);
                killme();
        }
 
index 3e205ec03057afb82c686ed622a729f897243cc4..f834e4ff36e86a729499551a56b34ec6246f074d 100644 (file)
@@ -5,11 +5,12 @@
 use Friendica\App;
 use Friendica\Core\L10n;
 use Friendica\Network\Probe;
+use Friendica\Util\Network;
 
 function webfinger_content(App $a)
 {
        if (!local_user()) {
-               http_status_exit(
+               Network::httpStatusExit(
                        403,
                        [
                                "title" => L10n::t("Public access denied."),
index 678e77e83a5b549be202d8eca28d44dc2d1ae4f6..efc5a097e827c3b77e8133fdb2773a58d7c38b37 100644 (file)
@@ -4,6 +4,7 @@ namespace Friendica\Module;
 \r
 use Friendica\BaseModule;\r
 use Friendica\Protocol\OStatus;\r
+use Friendica\Util\Network;\r
 \r
 /**\r
  * Provides public Atom feeds\r
@@ -31,7 +32,7 @@ class Feed extends BaseModule
                $nocache     = x($_GET, 'nocache') && local_user();\r
 \r
                if ($a->argc < 2) {\r
-                       http_status_exit(400);\r
+                       Network::httpStatusExit(400);\r
                }\r
 \r
                $type = null;\r
index 2ad4fadb115e472b92decc97792a205465ecff1f..58e3f5aff66acd55a194b76bb174755e1c3c735c 100644 (file)
@@ -285,7 +285,7 @@ class Diaspora
 
                        if (!is_object($j_outer_key_bundle)) {
                                logger('Outer Salmon did not verify. Discarding.');
-                               http_status_exit(400);
+                               Network::httpStatusExit(400);
                        }
 
                        $outer_iv = base64_decode($j_outer_key_bundle->iv);
@@ -300,7 +300,7 @@ class Diaspora
 
                if (!is_object($basedom)) {
                        logger('Received data does not seem to be an XML. Discarding. '.$xml);
-                       http_status_exit(400);
+                       Network::httpStatusExit(400);
                }
 
                $base = $basedom->children(NAMESPACE_SALMON_ME);
@@ -325,7 +325,7 @@ class Diaspora
                $verify = Crypto::rsaVerify($signed_data, $signature, $key);
                if (!$verify) {
                        logger('Message did not verify. Discarding.');
-                       http_status_exit(400);
+                       Network::httpStatusExit(400);
                }
 
                return ['message' => (string)base64url_decode($base->data),
@@ -403,7 +403,7 @@ class Diaspora
 
                if (!$base) {
                        logger('unable to locate salmon data in xml');
-                       http_status_exit(400);
+                       Network::httpStatusExit(400);
                }
 
 
@@ -441,7 +441,7 @@ class Diaspora
 
                if (!$author_link) {
                        logger('Could not retrieve author URI.');
-                       http_status_exit(400);
+                       Network::httpStatusExit(400);
                }
                // Once we have the author URI, go to the web and try to find their public key
                // (first this will look it up locally if it is in the fcontact cache)
@@ -452,14 +452,14 @@ class Diaspora
 
                if (!$key) {
                        logger('Could not retrieve author key.');
-                       http_status_exit(400);
+                       Network::httpStatusExit(400);
                }
 
                $verify = Crypto::rsaVerify($signed_data, $signature, $key);
 
                if (!$verify) {
                        logger('Message did not verify. Discarding.');
-                       http_status_exit(400);
+                       Network::httpStatusExit(400);
                }
 
                logger('Message verified.');