Remove deprecated App::cmd - replace with DI::args()->getCommand()

This commit is contained in:
Philipp Holzer 2019-12-16 01:33:13 +01:00
parent e6f61c2cc7
commit 33674808dc
No known key found for this signature in database
GPG key ID: D8365C3D36B77D90
16 changed files with 23 additions and 25 deletions

View 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') {

View 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
*/

View 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;
}
}
}

View 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);

View 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;
}
}
}

View 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());

View 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);
}
}

View file

@ -914,7 +914,7 @@ function network_tabs(App $a)
$all_active = 'active';
}
$cmd = $a->cmd;
$cmd = DI::args()->getCommand();
// tabs
$tabs = [

View 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');

View 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])) : '');

View 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();

View 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

View 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();

View 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.

View 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,

View 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