Remove deprecated App::getUrlPath - process methods to DI::baseUrl()->getUrlPath()

This commit is contained in:
Philipp Holzer 2019-12-16 00:39:54 +01:00
parent e93fba5136
commit 2900389696
No known key found for this signature in database
GPG Key ID: D8365C3D36B77D90
9 changed files with 12 additions and 23 deletions

View File

@ -457,8 +457,8 @@ function dfrn_request_post(App $a)
if ($network == Protocol::DIASPORA) { if ($network == Protocol::DIASPORA) {
$uri = $nickname . '@' . $a->getHostName(); $uri = $nickname . '@' . $a->getHostName();
if ($a->getURLPath()) { if (DI::baseUrl()->getUrlPath()) {
$uri .= '/' . $a->getURLPath(); $uri .= '/' . DI::baseUrl()->getUrlPath();
} }
$uri = urlencode($uri); $uri = urlencode($uri);
@ -610,7 +610,7 @@ function dfrn_request_content(App $a)
} elseif (!empty($_GET['address'])) { } elseif (!empty($_GET['address'])) {
$myaddr = $_GET['address']; $myaddr = $_GET['address'];
} elseif (local_user()) { } elseif (local_user()) {
if (strlen($a->getURLPath())) { if (strlen(DI::baseUrl()->getUrlPath())) {
$myaddr = System::baseUrl() . '/profile/' . $a->user['nickname']; $myaddr = System::baseUrl() . '/profile/' . $a->user['nickname'];
} else { } else {
$myaddr = $a->user['nickname'] . '@' . substr(System::baseUrl(), strpos(System::baseUrl(), '://') + 3); $myaddr = $a->user['nickname'] . '@' . substr(System::baseUrl(), strpos(System::baseUrl(), '://') + 3);

View File

@ -60,7 +60,7 @@ function redir_init(App $a) {
} }
if (remote_user()) { if (remote_user()) {
$host = substr($a->getBaseURL() . ($a->getURLPath() ? '/' . $a->getURLPath() : ''), strpos($a->getBaseURL(), '://') + 3); $host = substr(DI::baseUrl()->getUrlPath() . (DI::baseUrl()->getUrlPath() ? '/' . DI::baseUrl()->getUrlPath() : ''), strpos(DI::baseUrl()->getUrlPath(), '://') + 3);
$remotehost = substr($contact['addr'], strpos($contact['addr'], '@') + 1); $remotehost = substr($contact['addr'], strpos($contact['addr'], '@') + 1);
// On a local instance we have to check if the local user has already authenticated // On a local instance we have to check if the local user has already authenticated

View File

@ -1127,7 +1127,7 @@ function settings_content(App $a)
$tpl_addr = Renderer::getMarkupTemplate('settings/nick_set.tpl'); $tpl_addr = Renderer::getMarkupTemplate('settings/nick_set.tpl');
$prof_addr = Renderer::replaceMacros($tpl_addr,[ $prof_addr = Renderer::replaceMacros($tpl_addr,[
'$desc' => L10n::t("Your Identity Address is <strong>'%s'</strong> or '%s'.", $nickname . '@' . $a->getHostName() . $a->getURLPath(), System::baseUrl() . '/profile/' . $nickname), '$desc' => L10n::t("Your Identity Address is <strong>'%s'</strong> or '%s'.", $nickname . '@' . $a->getHostName() . DI::baseUrl()->getUrlPath(), System::baseUrl() . '/profile/' . $nickname),
'$basepath' => $a->getHostName() '$basepath' => $a->getHostName()
]); ]);

View File

@ -311,18 +311,6 @@ class App
return $this->baseURL->getHostname(); return $this->baseURL->getHostname();
} }
/**
* Returns the sub-path of the full URL
*
* @return string
*
* @deprecated 2019.06 - use BaseURL->getUrlPath() instead
*/
public function getURLPath()
{
return $this->baseURL->getUrlPath();
}
/** /**
* Returns the current UserAgent as a String * Returns the current UserAgent as a String
* *

View File

@ -2266,7 +2266,7 @@ class Contact
if (($protocol === Protocol::DFRN) && !DBA::isResult($contact)) { if (($protocol === Protocol::DFRN) && !DBA::isResult($contact)) {
if ($interactive) { if ($interactive) {
if (strlen($a->getURLPath())) { if (strlen(DI::baseUrl()->getUrlPath())) {
$myaddr = bin2hex(System::baseUrl() . '/profile/' . $a->user['nickname']); $myaddr = bin2hex(System::baseUrl() . '/profile/' . $a->user['nickname']);
} else { } else {
$myaddr = bin2hex($a->user['nickname'] . '@' . $a->getHostName()); $myaddr = bin2hex($a->user['nickname'] . '@' . $a->getHostName());

View File

@ -242,7 +242,7 @@ class Site extends BaseAdminModule
Worker::add(PRIORITY_LOW, 'Directory'); Worker::add(PRIORITY_LOW, 'Directory');
} }
if ($a->getURLPath() != "") { if (DI::baseUrl()->getUrlPath() != "") {
$diaspora_enabled = false; $diaspora_enabled = false;
} }
if ($ssl_policy != intval(Config::get('system', 'ssl_policy'))) { if ($ssl_policy != intval(Config::get('system', 'ssl_policy'))) {
@ -523,7 +523,7 @@ class Site extends BaseAdminModule
'develop' => L10n::t('check the development version') 'develop' => L10n::t('check the development version')
]; ];
$diaspora_able = ($a->getURLPath() == ''); $diaspora_able = (DI::baseUrl()->getUrlPath() == '');
$optimize_max_tablesize = Config::get('system', 'optimize_max_tablesize', -1); $optimize_max_tablesize = Config::get('system', 'optimize_max_tablesize', -1);

View File

@ -80,7 +80,7 @@ class Magic extends BaseModule
$headers = HTTPSignature::createSig( $headers = HTTPSignature::createSig(
$headers, $headers,
$user['prvkey'], $user['prvkey'],
'acct:' . $user['nickname'] . '@' . $a->getHostName() . ($a->getURLPath() ? '/' . $a->getURLPath() : '') 'acct:' . $user['nickname'] . '@' . $a->getHostName() . (DI::baseUrl()->getUrlPath() ? '/' . DI::baseUrl()->getUrlPath() : '')
); );
// Try to get an authentication token from the other instance. // Try to get an authentication token from the other instance.

View File

@ -120,7 +120,7 @@ class Profile extends BaseModule
$a->page['htmlhead'] .= '<link rel="alternate" type="application/atom+xml" href="' . System::baseUrl() . '/feed/' . self::$which . '/" title="' . L10n::t('%s\'s posts', $a->profile['username']) . '"/>' . "\n"; $a->page['htmlhead'] .= '<link rel="alternate" type="application/atom+xml" href="' . System::baseUrl() . '/feed/' . self::$which . '/" title="' . L10n::t('%s\'s posts', $a->profile['username']) . '"/>' . "\n";
$a->page['htmlhead'] .= '<link rel="alternate" type="application/atom+xml" href="' . System::baseUrl() . '/feed/' . self::$which . '/comments" title="' . L10n::t('%s\'s comments', $a->profile['username']) . '"/>' . "\n"; $a->page['htmlhead'] .= '<link rel="alternate" type="application/atom+xml" href="' . System::baseUrl() . '/feed/' . self::$which . '/comments" title="' . L10n::t('%s\'s comments', $a->profile['username']) . '"/>' . "\n";
$a->page['htmlhead'] .= '<link rel="alternate" type="application/atom+xml" href="' . System::baseUrl() . '/feed/' . self::$which . '/activity" title="' . L10n::t('%s\'s timeline', $a->profile['username']) . '"/>' . "\n"; $a->page['htmlhead'] .= '<link rel="alternate" type="application/atom+xml" href="' . System::baseUrl() . '/feed/' . self::$which . '/activity" title="' . L10n::t('%s\'s timeline', $a->profile['username']) . '"/>' . "\n";
$uri = urlencode('acct:' . $a->profile['nickname'] . '@' . $a->getHostName() . ($a->getURLPath() ? '/' . $a->getURLPath() : '')); $uri = urlencode('acct:' . $a->profile['nickname'] . '@' . $a->getHostName() . (DI::baseUrl()->getUrlPath() ? '/' . DI::baseUrl()->getUrlPath() : ''));
$a->page['htmlhead'] .= '<link rel="lrdd" type="application/xrd+xml" href="' . System::baseUrl() . '/xrd/?uri=' . $uri . '" />' . "\n"; $a->page['htmlhead'] .= '<link rel="lrdd" type="application/xrd+xml" href="' . System::baseUrl() . '/xrd/?uri=' . $uri . '" />' . "\n";
header('Link: <' . System::baseUrl() . '/xrd/?uri=' . $uri . '>; rel="lrdd"; type="application/xrd+xml"', false); header('Link: <' . System::baseUrl() . '/xrd/?uri=' . $uri . '>; rel="lrdd"; type="application/xrd+xml"', false);

View File

@ -10,6 +10,7 @@
use Friendica\Core\Config; use Friendica\Core\Config;
use Friendica\Core\PConfig; use Friendica\Core\PConfig;
use Friendica\Core\System; use Friendica\Core\System;
use Friendica\DI;
use Friendica\Model\Profile; use Friendica\Model\Profile;
require_once 'view/theme/frio/php/frio_boot.php'; require_once 'view/theme/frio/php/frio_boot.php';
@ -19,7 +20,7 @@ if (!isset($minimal)) {
$minimal = false; $minimal = false;
} }
$basepath = $a->getURLPath() ? "/" . $a->getURLPath() . "/" : "/"; $basepath = DI::baseUrl()->getUrlPath() ? "/" . DI::baseUrl()->getUrlPath() . "/" : "/";
$frio = "view/theme/frio"; $frio = "view/theme/frio";
$view_mode_class = ($a->is_mobile || $a->is_tablet) ? 'mobile-view' : 'desktop-view'; $view_mode_class = ($a->is_mobile || $a->is_tablet) ? 'mobile-view' : 'desktop-view';
$is_singleuser = Config::get('system', 'singleuser'); $is_singleuser = Config::get('system', 'singleuser');