parameters and getURLpath to getURLPath

This commit is contained in:
Philipp Holzer 2018-10-10 01:18:47 +02:00
parent 3eb4332f33
commit 307286fc47
No known key found for this signature in database
GPG Key ID: 517BE60E2CE5C8A5
12 changed files with 22 additions and 22 deletions

View File

@ -1124,7 +1124,7 @@ function admin_page_site_post(App $a)
Worker::add(PRIORITY_LOW, 'Directory'); Worker::add(PRIORITY_LOW, 'Directory');
} }
if ($a->getURLpath() != "") { if ($a->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'))) {
@ -1421,7 +1421,7 @@ function admin_page_site(App $a)
if (empty(Config::get('config', 'hostname'))) { if (empty(Config::get('config', 'hostname'))) {
Config::set('config', 'hostname', $a->getHostName()); Config::set('config', 'hostname', $a->getHostName());
} }
$diaspora_able = ($a->getURLpath() == ""); $diaspora_able = ($a->getURLPath() == "");
$optimize_max_tablesize = Config::get('system', 'optimize_max_tablesize', -1); $optimize_max_tablesize = Config::get('system', 'optimize_max_tablesize', -1);

View File

@ -453,8 +453,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 ($a->getURLPath()) {
$uri .= '/' . $a->getURLpath(); $uri .= '/' . $a->getURLPath();
} }
$uri = urlencode($uri); $uri = urlencode($uri);
@ -609,7 +609,7 @@ function dfrn_request_content(App $a)
} elseif (x($_GET, 'address') && ($_GET['address'] != "")) { } elseif (x($_GET, 'address') && ($_GET['address'] != "")) {
$myaddr = $_GET['address']; $myaddr = $_GET['address'];
} elseif (local_user()) { } elseif (local_user()) {
if (strlen($a->getURLpath())) { if (strlen($a->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

@ -50,7 +50,7 @@ function hcard_init(App $a)
$a->page['htmlhead'] .= '<meta name="dfrn-global-visibility" content="' . (($a->profile['net-publish']) ? 'true' : 'false') . '" />' . "\r\n" ; $a->page['htmlhead'] .= '<meta name="dfrn-global-visibility" content="' . (($a->profile['net-publish']) ? 'true' : 'false') . '" />' . "\r\n" ;
$a->page['htmlhead'] .= '<link rel="alternate" type="application/atom+xml" href="' . System::baseUrl() . '/dfrn_poll/' . $which .'" />' . "\r\n" ; $a->page['htmlhead'] .= '<link rel="alternate" type="application/atom+xml" href="' . System::baseUrl() . '/dfrn_poll/' . $which .'" />' . "\r\n" ;
$uri = urlencode('acct:' . $a->profile['nickname'] . '@' . $a->getHostName() . (($a->getURLpath()) ? '/' . $a->getURLpath() : '')); $uri = urlencode('acct:' . $a->profile['nickname'] . '@' . $a->getHostName() . (($a->getURLPath()) ? '/' . $a->getURLPath() : ''));
$a->page['htmlhead'] .= '<link rel="lrdd" type="application/xrd+xml" href="' . System::baseUrl() . '/xrd/?uri=' . $uri . '" />' . "\r\n"; $a->page['htmlhead'] .= '<link rel="lrdd" type="application/xrd+xml" href="' . System::baseUrl() . '/xrd/?uri=' . $uri . '" />' . "\r\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

@ -91,7 +91,7 @@ function profile_init(App $a)
$a->page['htmlhead'] .= '<link rel="alternate" type="application/atom+xml" href="' . System::baseUrl() . '/feed/' . $which . '/" title="' . L10n::t('%s\'s posts', $a->profile['username']) . '"/>' . "\r\n"; $a->page['htmlhead'] .= '<link rel="alternate" type="application/atom+xml" href="' . System::baseUrl() . '/feed/' . $which . '/" title="' . L10n::t('%s\'s posts', $a->profile['username']) . '"/>' . "\r\n";
$a->page['htmlhead'] .= '<link rel="alternate" type="application/atom+xml" href="' . System::baseUrl() . '/feed/' . $which . '/comments" title="' . L10n::t('%s\'s comments', $a->profile['username']) . '"/>' . "\r\n"; $a->page['htmlhead'] .= '<link rel="alternate" type="application/atom+xml" href="' . System::baseUrl() . '/feed/' . $which . '/comments" title="' . L10n::t('%s\'s comments', $a->profile['username']) . '"/>' . "\r\n";
$a->page['htmlhead'] .= '<link rel="alternate" type="application/atom+xml" href="' . System::baseUrl() . '/feed/' . $which . '/activity" title="' . L10n::t('%s\'s timeline', $a->profile['username']) . '"/>' . "\r\n"; $a->page['htmlhead'] .= '<link rel="alternate" type="application/atom+xml" href="' . System::baseUrl() . '/feed/' . $which . '/activity" title="' . L10n::t('%s\'s timeline', $a->profile['username']) . '"/>' . "\r\n";
$uri = urlencode('acct:' . $a->profile['nickname'] . '@' . $a->getHostName() . ($a->getURLpath() ? '/' . $a->getURLpath() : '')); $uri = urlencode('acct:' . $a->profile['nickname'] . '@' . $a->getHostName() . ($a->getURLPath() ? '/' . $a->getURLPath() : ''));
$a->page['htmlhead'] .= '<link rel="lrdd" type="application/xrd+xml" href="' . System::baseUrl() . '/xrd/?uri=' . $uri . '" />' . "\r\n"; $a->page['htmlhead'] .= '<link rel="lrdd" type="application/xrd+xml" href="' . System::baseUrl() . '/xrd/?uri=' . $uri . '" />' . "\r\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

@ -57,7 +57,7 @@ function redir_init(App $a) {
} }
if (remote_user()) { if (remote_user()) {
$host = substr(System::baseUrl() . ($a->getURLpath() ? '/' . $a->getURLpath() : ''), strpos(System::baseUrl(), '://') + 3); $host = substr(System::baseUrl() . ($a->getURLPath() ? '/' . $a->getURLPath() : ''), strpos(System::baseUrl(), '://') + 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

@ -1136,7 +1136,7 @@ function settings_content(App $a)
$tpl_addr = get_markup_template('settings/nick_set.tpl'); $tpl_addr = get_markup_template('settings/nick_set.tpl');
$prof_addr = replace_macros($tpl_addr,[ $prof_addr = replace_macros($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() . $a->getURLPath(), System::baseUrl() . '/profile/' . $nickname),
'$basepath' => $a->getHostName() '$basepath' => $a->getHostName()
]); ]);

View File

@ -56,8 +56,8 @@ function xrd_init(App $a)
$alias = str_replace('/profile/', '/~', $profile_url); $alias = str_replace('/profile/', '/~', $profile_url);
$addr = 'acct:'.$user['nickname'].'@'.$a->getHostName(); $addr = 'acct:'.$user['nickname'].'@'.$a->getHostName();
if ($a->getURLpath()) { if ($a->getURLPath()) {
$addr .= '/'.$a->getURLpath(); $addr .= '/'.$a->getURLPath();
} }
if ($mode == 'xml') { if ($mode == 'xml') {

View File

@ -673,7 +673,7 @@ class App
$this->hostname = Config::get('config', 'hostname'); $this->hostname = Config::get('config', 'hostname');
} }
return $scheme . '://' . $this->hostname . (!empty($this->getURLpath()) ? '/' . $this->getURLpath() : '' ); return $scheme . '://' . $this->hostname . (!empty($this->getURLPath()) ? '/' . $this->getURLPath() : '' );
} }
/** /**
@ -727,7 +727,7 @@ class App
return $this->hostname; return $this->hostname;
} }
public function getURLpath() public function getURLPath()
{ {
return $this->urlpath; return $this->urlpath;
} }
@ -873,20 +873,20 @@ class App
/** /**
* @brief Removes the base url from an url. This avoids some mixed content problems. * @brief Removes the base url from an url. This avoids some mixed content problems.
* *
* @param string $orig_url * @param string $origURL
* *
* @return string The cleaned url * @return string The cleaned url
*/ */
public function removeBaseURL($orig_url) public function removeBaseURL($origURL)
{ {
// Remove the hostname from the url if it is an internal link // Remove the hostname from the url if it is an internal link
$nurl = normalise_link($orig_url); $nurl = normalise_link($origURL);
$base = normalise_link($this->getBaseURL()); $base = normalise_link($this->getBaseURL());
$url = str_replace($base . '/', '', $nurl); $url = str_replace($base . '/', '', $nurl);
// if it is an external link return the orignal value // if it is an external link return the orignal value
if ($url == normalise_link($orig_url)) { if ($url == normalise_link($origURL)) {
return $orig_url; return $origURL;
} else { } else {
return $url; return $url;
} }

View File

@ -631,7 +631,7 @@ class NotificationsManager extends BaseObject
// We have to distinguish between these two because they use different data. // We have to distinguish between these two because they use different data.
// Contact suggestions // Contact suggestions
if ($it['fid']) { if ($it['fid']) {
$return_addr = bin2hex(self::getApp()->user['nickname'] . '@' . self::getApp()->getHostName() . ((self::getApp()->getURLpath()) ? '/' . self::getApp()->getURLpath() : '')); $return_addr = bin2hex(self::getApp()->user['nickname'] . '@' . self::getApp()->getHostName() . ((self::getApp()->getURLPath()) ? '/' . self::getApp()->getURLPath() : ''));
$intro = [ $intro = [
'label' => 'friend_suggestion', 'label' => 'friend_suggestion',

View File

@ -1632,7 +1632,7 @@ class Contact extends BaseObject
if (($ret['network'] === Protocol::DFRN) && !DBA::isResult($contact)) { if (($ret['network'] === Protocol::DFRN) && !DBA::isResult($contact)) {
if ($interactive) { if ($interactive) {
if (strlen($a->getURLpath())) { if (strlen($a->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

@ -78,7 +78,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() . ($a->getURLPath() ? '/' . $a->getURLPath() : '')
); );
// Try to get an authentication token from the other instance. // Try to get an authentication token from the other instance.

View File

@ -26,7 +26,7 @@ if (!isset($minimal)) {
<script type="text/javascript">var baseurl = "<?php echo System::baseUrl(); ?>";</script> <script type="text/javascript">var baseurl = "<?php echo System::baseUrl(); ?>";</script>
<script type="text/javascript">var frio = "<?php echo 'view/theme/frio'; ?>";</script> <script type="text/javascript">var frio = "<?php echo 'view/theme/frio'; ?>";</script>
<?php <?php
$basepath = $a->getURLpath() ? "/" . $a->getURLpath() . "/" : "/"; $basepath = $a->getURLPath() ? "/" . $a->getURLPath() . "/" : "/";
$frio = "view/theme/frio"; $frio = "view/theme/frio";
// Because we use minimal for modals the header and the included js stuff should be only loaded // Because we use minimal for modals the header and the included js stuff should be only loaded