]> git.mxchange.org Git - friendica.git/commitdiff
Remove deprecated App::cmd - replace with DI::args()->getCommand()
authornupplaPhil <admin@philipp.info>
Mon, 16 Dec 2019 00:33:13 +0000 (01:33 +0100)
committernupplaPhil <admin@philipp.info>
Sun, 29 Dec 2019 19:17:51 +0000 (20:17 +0100)
16 files changed:
include/conversation.php
mod/api.php
mod/cal.php
mod/dfrn_request.php
mod/events.php
mod/match.php
mod/message.php
mod/network.php
mod/photos.php
mod/pubsub.php
mod/suggest.php
mod/videos.php
src/App.php
src/Model/Profile.php
src/Module/Contact.php
src/Object/Post.php

index 7025cf4cabaab76e131f7af109c1c2726a6114ac..bf1f5645b1aa48ea5c30a50ac0a18c99e3639139 100644 (file)
@@ -480,7 +480,7 @@ function conversation(App $a, array $items, Pager $pager, $mode, $update, $previ
                         */
                        $live_update_div = '<div id="live-network"></div>' . "\r\n"
                                . "<script> var profile_uid = " . $_SESSION['uid']
-                               . "; var netargs = '" . substr($a->cmd, 8)
+                               . "; var netargs = '" . substr(DI::args()->getCommand(), 8)
                                . '?f='
                                . (!empty($_GET['cid'])    ? '&cid='    . rawurlencode($_GET['cid'])    : '')
                                . (!empty($_GET['search']) ? '&search=' . rawurlencode($_GET['search']) : '')
@@ -540,7 +540,7 @@ function conversation(App $a, array $items, Pager $pager, $mode, $update, $previ
 
                if (!$update) {
                        $live_update_div = '<div id="live-community"></div>' . "\r\n"
-                               . "<script> var profile_uid = -1; var netargs = '" . substr($a->cmd, 10)
+                               . "<script> var profile_uid = -1; var netargs = '" . substr(DI::args()->getCommand(), 10)
                                ."/?f='; var profile_page = " . $pager->getPage() . "; </script>\r\n";
                }
        } elseif ($mode === 'contacts') {
@@ -549,7 +549,7 @@ function conversation(App $a, array $items, Pager $pager, $mode, $update, $previ
 
                if (!$update) {
                        $live_update_div = '<div id="live-contacts"></div>' . "\r\n"
-                               . "<script> var profile_uid = -1; var netargs = '" . substr($a->cmd, 9)
+                               . "<script> var profile_uid = -1; var netargs = '" . substr(DI::args()->getCommand(), 9)
                                ."/?f='; var profile_page = " . $pager->getPage() . "; </script>\r\n";
                }
        } elseif ($mode === 'search') {
index b6a2c0b59fa04124b838dceffb589d91cf2da35f..842c1a74dc67ea0b289e768898d9e7b3b9b42421 100644 (file)
@@ -45,7 +45,7 @@ function api_post(App $a)
 
 function api_content(App $a)
 {
-       if ($a->cmd == 'api/oauth/authorize') {
+       if (DI::args()->getCommand() == 'api/oauth/authorize') {
                /*
                 * api/oauth/authorize interact with the user. return a standard page
                 */
index 5a4f0a9c51731ba275fa639aa82286ff6b0af063..62508fbef73be395fe2a04276148a92653183d64 100644 (file)
@@ -221,7 +221,7 @@ function cal_content(App $a)
                        foreach ($r as $rr) {
                                $j = $rr['adjust'] ? DateTimeFormat::local($rr['start'], 'j') : DateTimeFormat::utc($rr['start'], 'j');
                                if (empty($links[$j])) {
-                                       $links[$j] = System::baseUrl() . '/' . $a->cmd . '#link-' . $j;
+                                       $links[$j] = System::baseUrl() . '/' . DI::args()->getCommand() . '#link-' . $j;
                                }
                        }
                }
index f7dc5f55cdabd77952269ccbd60c84ff936f4c6f..7f0ad805a7fe6343e6757b1b7af3b5ad51693517 100644 (file)
@@ -335,19 +335,19 @@ function dfrn_request_post(App $a)
                                $url = Network::isUrlValid($url);
                                if (!$url) {
                                        notice(L10n::t('Invalid profile URL.') . EOL);
-                                       DI::baseUrl()->redirect($a->cmd);
+                                       DI::baseUrl()->redirect(DI::args()->getCommand());
                                        return; // NOTREACHED
                                }
 
                                if (!Network::isUrlAllowed($url)) {
                                        notice(L10n::t('Disallowed profile URL.') . EOL);
-                                       DI::baseUrl()->redirect($a->cmd);
+                                       DI::baseUrl()->redirect(DI::args()->getCommand());
                                        return; // NOTREACHED
                                }
 
                                if (Network::isUrlBlocked($url)) {
                                        notice(L10n::t('Blocked domain') . EOL);
-                                       DI::baseUrl()->redirect($a->cmd);
+                                       DI::baseUrl()->redirect(DI::args()->getCommand());
                                        return; // NOTREACHED
                                }
 
@@ -355,7 +355,7 @@ function dfrn_request_post(App $a)
 
                                if (!count($parms)) {
                                        notice(L10n::t('Profile location is not valid or does not contain profile information.') . EOL);
-                                       DI::baseUrl()->redirect($a->cmd);
+                                       DI::baseUrl()->redirect(DI::args()->getCommand());
                                } else {
                                        if (empty($parms['fn'])) {
                                                notice(L10n::t('Warning: profile location has no identifiable owner name.') . EOL);
index ddcac1bd154f0939980d306d709b4e65516b4d9e..991d0cef7b19462273c85482a9716c7a179a9ccb 100644 (file)
@@ -217,7 +217,7 @@ function events_content(App $a)
        }
 
        if ($a->argc == 1) {
-               $_SESSION['return_path'] = $a->cmd;
+               $_SESSION['return_path'] = DI::args()->getCommand();
        }
 
        if (($a->argc > 2) && ($a->argv[1] === 'ignore') && intval($a->argv[2])) {
@@ -350,7 +350,7 @@ function events_content(App $a)
                        foreach ($r as $rr) {
                                $j = $rr['adjust'] ? DateTimeFormat::local($rr['start'], 'j') : DateTimeFormat::utc($rr['start'], 'j');
                                if (empty($links[$j])) {
-                                       $links[$j] = System::baseUrl() . '/' . $a->cmd . '#link-' . $j;
+                                       $links[$j] = System::baseUrl() . '/' . DI::args()->getCommand() . '#link-' . $j;
                                }
                        }
                }
index 41346bc89d6a12e3788b616246e4a1c92abc6212..189210f4b54e07d50e2a814bd88a88c449511666 100644 (file)
@@ -11,6 +11,7 @@ use Friendica\Core\L10n;
 use Friendica\Core\Renderer;
 use Friendica\Core\System;
 use Friendica\Database\DBA;
+use Friendica\DI;
 use Friendica\Model\Contact;
 use Friendica\Model\Profile;
 use Friendica\Util\Network;
@@ -38,7 +39,7 @@ function match_content(App $a)
        $a->page['aside'] .= Widget::findPeople();
        $a->page['aside'] .= Widget::follow();
 
-       $_SESSION['return_path'] = $a->cmd;
+       $_SESSION['return_path'] = DI::args()->getCommand();
 
        $profile = Profile::getByUID(local_user());
 
index 46ed9b0c12555fff3816229aba6525ed23cfc8d9..4c6aa3d84823eb6fe9f544f8999a3419e5985884 100644 (file)
@@ -89,7 +89,7 @@ function message_post(App $a)
                $a->argc = 2;
                $a->argv[1] = 'new';
        } else {
-               DI::baseUrl()->redirect($a->cmd . '/' . $ret);
+               DI::baseUrl()->redirect(DI::args()->getCommand() . '/' . $ret);
        }
 }
 
index adc315a548138281d100787317291fc6cfb66e55..be121540c122c61708aedcb925d7c7076b6277b6 100644 (file)
@@ -914,7 +914,7 @@ function network_tabs(App $a)
                $all_active = 'active';
        }
 
-       $cmd = $a->cmd;
+       $cmd = DI::args()->getCommand();
 
        // tabs
        $tabs = [
index 6398211c9bff142f0664ff4eb370078fd95c2baf..a0a1be9327bbae93565b49e18cc52f1c293a14e0 100644 (file)
@@ -846,7 +846,7 @@ function photos_content(App $a)
 
        $phototypes = Images::supportedTypes();
 
-       $_SESSION['photo_return'] = $a->cmd;
+       $_SESSION['photo_return'] = DI::args()->getCommand();
 
        // Parse arguments
        $datum = null;
@@ -1362,7 +1362,7 @@ function photos_content(App $a)
                if (!empty($link_item['id']) && !empty($link_item['uri'])) {
                        $cmnt_tpl = Renderer::getMarkupTemplate('comment_item.tpl');
                        $tpl = Renderer::getMarkupTemplate('photo_item.tpl');
-                       $return_path = $a->cmd;
+                       $return_path = DI::args()->getCommand();
 
                        if ($cmd === 'view' && ($can_post || Security::canWriteToUserWall($owner_uid))) {
                                $like_tpl = Renderer::getMarkupTemplate('like_noshare.tpl');
index c008fb09dac3b93d887005f66c8874f576f45148..4c1c2759d8a62fb0e3b8478aaf3dd87a66f991df 100644 (file)
@@ -86,7 +86,7 @@ function pubsub_post(App $a)
 {
        $xml = Network::postdata();
 
-       Logger::log('Feed arrived from ' . $_SERVER['REMOTE_ADDR'] . ' for ' .  $a->cmd . ' with user-agent: ' . $_SERVER['HTTP_USER_AGENT']);
+       Logger::log('Feed arrived from ' . $_SERVER['REMOTE_ADDR'] . ' for ' .  DI::args()->getCommand() . ' with user-agent: ' . $_SERVER['HTTP_USER_AGENT']);
        Logger::log('Data: ' . $xml, Logger::DATA);
 
        $nick       = (($a->argc > 1) ? Strings::escapeTags(trim($a->argv[1])) : '');
index daf5de00fcba1b25e7faccd1a137b6220f220670..15370d25a9bdcfb4355c2f36d6a9b6428ef8687b 100644 (file)
@@ -41,7 +41,7 @@ function suggest_content(App $a)
                return;
        }
 
-       $_SESSION['return_path'] = $a->cmd;
+       $_SESSION['return_path'] = DI::args()->getCommand();
 
        $a->page['aside'] .= Widget::findPeople();
        $a->page['aside'] .= Widget::follow();
index 6d136d7de5026e6fed45eb6df9a4510e3fcf9285..b6f6b1d8e74094fcafc698134679be8856fdc663 100644 (file)
@@ -124,7 +124,7 @@ function videos_content(App $a)
 
        //$phototypes = Photo::supportedTypes();
 
-       $_SESSION['video_return'] = $a->cmd;
+       $_SESSION['video_return'] = DI::args()->getCommand();
 
        //
        // Parse arguments
index c028f9d9d8c80e161dd4d1c9077c2ec302f3cc28..892039dc5a302bd30fa44db0cdb6c52a9856fb62 100644 (file)
@@ -53,8 +53,6 @@ class App
        public $page_contact;
        public $content;
        public $data = [];
-       /** @deprecated 2019.09 - use App\Arguments->getCommand() */
-       public $cmd = '';
        /** @deprecated 2019.09 - use App\Arguments->getArgv() or Arguments->get() */
        public $argv;
        /** @deprecated 2019.09 - use App\Arguments->getArgc() */
@@ -170,7 +168,6 @@ class App
                $this->args     = $args;
                $this->process  = $process;
 
-               $this->cmd          = $args->getCommand();
                $this->argv         = $args->getArgv();
                $this->argc         = $args->getArgc();
                $this->module       = $module->getName();
index 69ec447951b0571537dc9eae7c3adcaad074b70f..a08cdade126493efa1f716a129019ef0e2998317 100644 (file)
@@ -1047,7 +1047,7 @@ class Profile
 
                $addr = $_GET['addr'] ?? $my_url;
 
-               $arr = ['zrl' => $my_url, 'url' => $a->cmd];
+               $arr = ['zrl' => $my_url, 'url' => DI::args()->getCommand()];
                Hook::callAll('zrl_init', $arr);
 
                // Try to find the public contact entry of the visitor.
index c45a27c88aa606680fb6adc3c4e96316f5219640..d307652b63681ff5fc9aa4619ad6d533d4c3ce1d 100644 (file)
@@ -819,7 +819,7 @@ class Contact extends BaseModule
                        '$desc'       => L10n::t('Search your contacts'),
                        '$finding'    => $searching ? L10n::t('Results for: %s', $search) : '',
                        '$submit'     => L10n::t('Find'),
-                       '$cmd'        => $a->cmd,
+                       '$cmd'        => DI::args()->getCommand(),
                        '$contacts'   => $contacts,
                        '$contact_drop_confirm' => L10n::t('Do you really want to delete this contact?'),
                        'multiselect' => 1,
index 032c7ea4d0137e5840dc811ced6cc4ca017ab800..fd99a206de399a5f0bae7302539d172605c4e74e 100644 (file)
@@ -453,7 +453,7 @@ class Post
                        'received'        => $item['received'],
                        'commented'       => $item['commented'],
                        'created_date'    => $item['created'],
-                       'return'          => ($a->cmd) ? bin2hex($a->cmd) : '',
+                       'return'          => (DI::args()->getCommand()) ? bin2hex(DI::args()->getCommand()) : '',
                        'delivery'        => [
                                'queue_count'       => $item['delivery_queue_count'],
                                'queue_done'        => $item['delivery_queue_done'] + $item['delivery_queue_failed'], /// @todo Possibly display it separately in the future