mirror of
https://github.com/friendica/friendica
synced 2024-12-23 04:00:15 +00:00
Remove deprecated App::getHostName() - process methods to DI::baseUrl()->getHostName()
This commit is contained in:
parent
2900389696
commit
50be94aa5e
23 changed files with 34 additions and 50 deletions
4
boot.php
4
boot.php
|
@ -482,8 +482,6 @@ function get_server()
|
||||||
|
|
||||||
function get_temppath()
|
function get_temppath()
|
||||||
{
|
{
|
||||||
$a = \get_app();
|
|
||||||
|
|
||||||
$temppath = Config::get("system", "temppath");
|
$temppath = Config::get("system", "temppath");
|
||||||
|
|
||||||
if (($temppath != "") && System::isDirectoryUsable($temppath)) {
|
if (($temppath != "") && System::isDirectoryUsable($temppath)) {
|
||||||
|
@ -500,7 +498,7 @@ function get_temppath()
|
||||||
$temppath = BasePath::getRealPath($temppath);
|
$temppath = BasePath::getRealPath($temppath);
|
||||||
|
|
||||||
// To avoid any interferences with other systems we create our own directory
|
// To avoid any interferences with other systems we create our own directory
|
||||||
$new_temppath = $temppath . "/" . $a->getHostName();
|
$new_temppath = $temppath . "/" . DI::baseUrl()->getHostname();
|
||||||
if (!is_dir($new_temppath)) {
|
if (!is_dir($new_temppath)) {
|
||||||
/// @TODO There is a mkdir()+chmod() upwards, maybe generalize this (+ configurable) into a function/method?
|
/// @TODO There is a mkdir()+chmod() upwards, maybe generalize this (+ configurable) into a function/method?
|
||||||
mkdir($new_temppath);
|
mkdir($new_temppath);
|
||||||
|
|
|
@ -3563,10 +3563,8 @@ api_register_func('api/friendships/incoming', 'api_friendships_incoming', true);
|
||||||
*/
|
*/
|
||||||
function api_statusnet_config($type)
|
function api_statusnet_config($type)
|
||||||
{
|
{
|
||||||
$a = \get_app();
|
|
||||||
|
|
||||||
$name = Config::get('config', 'sitename');
|
$name = Config::get('config', 'sitename');
|
||||||
$server = $a->getHostName();
|
$server = DI::baseUrl()->getHostname();
|
||||||
$logo = System::baseUrl() . '/images/friendica-64.png';
|
$logo = System::baseUrl() . '/images/friendica-64.png';
|
||||||
$email = Config::get('config', 'admin_email');
|
$email = Config::get('config', 'admin_email');
|
||||||
$closed = intval(Config::get('config', 'register_policy')) === \Friendica\Module\Register::CLOSED ? 'true' : 'false';
|
$closed = intval(Config::get('config', 'register_policy')) === \Friendica\Module\Register::CLOSED ? 'true' : 'false';
|
||||||
|
|
|
@ -12,6 +12,7 @@ use Friendica\Core\Renderer;
|
||||||
use Friendica\Core\System;
|
use Friendica\Core\System;
|
||||||
use Friendica\Database\DBA;
|
use Friendica\Database\DBA;
|
||||||
use Friendica\Model\Contact;
|
use Friendica\Model\Contact;
|
||||||
|
use Friendica\DI;
|
||||||
use Friendica\Model\Item;
|
use Friendica\Model\Item;
|
||||||
use Friendica\Model\User;
|
use Friendica\Model\User;
|
||||||
use Friendica\Protocol\Activity;
|
use Friendica\Protocol\Activity;
|
||||||
|
@ -68,7 +69,7 @@ function notification($params)
|
||||||
}
|
}
|
||||||
|
|
||||||
$sender_name = $sitename;
|
$sender_name = $sitename;
|
||||||
$hostname = $a->getHostName();
|
$hostname = DI::baseUrl()->getHostname();
|
||||||
if (strpos($hostname, ':')) {
|
if (strpos($hostname, ':')) {
|
||||||
$hostname = substr($hostname, 0, strpos($hostname, ':'));
|
$hostname = substr($hostname, 0, strpos($hostname, ':'));
|
||||||
}
|
}
|
||||||
|
|
|
@ -455,7 +455,7 @@ function dfrn_request_post(App $a)
|
||||||
// Diaspora needs the uri in the format user@domain.tld
|
// Diaspora needs the uri in the format user@domain.tld
|
||||||
// Diaspora will support the remote subscription in a future version
|
// Diaspora will support the remote subscription in a future version
|
||||||
if ($network == Protocol::DIASPORA) {
|
if ($network == Protocol::DIASPORA) {
|
||||||
$uri = $nickname . '@' . $a->getHostName();
|
$uri = $nickname . '@' . DI::baseUrl()->getHostname();
|
||||||
|
|
||||||
if (DI::baseUrl()->getUrlPath()) {
|
if (DI::baseUrl()->getUrlPath()) {
|
||||||
$uri .= '/' . DI::baseUrl()->getUrlPath();
|
$uri .= '/' . DI::baseUrl()->getUrlPath();
|
||||||
|
|
|
@ -1127,8 +1127,8 @@ 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() . DI::baseUrl()->getUrlPath(), System::baseUrl() . '/profile/' . $nickname),
|
'$desc' => L10n::t("Your Identity Address is <strong>'%s'</strong> or '%s'.", $nickname . '@' . DI::baseUrl()->getHostname() . DI::baseUrl()->getUrlPath(), System::baseUrl() . '/profile/' . $nickname),
|
||||||
'$basepath' => $a->getHostName()
|
'$basepath' => DI::baseUrl()->getHostname()
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$stpl = Renderer::getMarkupTemplate('settings/settings.tpl');
|
$stpl = Renderer::getMarkupTemplate('settings/settings.tpl');
|
||||||
|
|
12
src/App.php
12
src/App.php
|
@ -299,18 +299,6 @@ class App
|
||||||
$this->baseURL->saveByURL($url);
|
$this->baseURL->saveByURL($url);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the current hostname
|
|
||||||
*
|
|
||||||
* @return string
|
|
||||||
*
|
|
||||||
* @deprecated 2019.06 - use BaseURL->getHostname() instead
|
|
||||||
*/
|
|
||||||
public function getHostName()
|
|
||||||
{
|
|
||||||
return $this->baseURL->getHostname();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the current UserAgent as a String
|
* Returns the current UserAgent as a String
|
||||||
*
|
*
|
||||||
|
|
|
@ -182,7 +182,7 @@ class System
|
||||||
if (is_bool($prefix) && !$prefix) {
|
if (is_bool($prefix) && !$prefix) {
|
||||||
$prefix = '';
|
$prefix = '';
|
||||||
} elseif (empty($prefix)) {
|
} elseif (empty($prefix)) {
|
||||||
$prefix = hash('crc32', DI::app()->getHostName());
|
$prefix = hash('crc32', DI::baseUrl()->getHostname());
|
||||||
}
|
}
|
||||||
|
|
||||||
while (strlen($prefix) < ($size - 13)) {
|
while (strlen($prefix) < ($size - 13)) {
|
||||||
|
|
|
@ -2269,7 +2269,7 @@ class Contact
|
||||||
if (strlen(DI::baseUrl()->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'] . '@' . DI::baseUrl()->getHostname());
|
||||||
}
|
}
|
||||||
|
|
||||||
DI::baseUrl()->redirect($ret['request'] . "&addr=$myaddr");
|
DI::baseUrl()->redirect($ret['request'] . "&addr=$myaddr");
|
||||||
|
|
|
@ -1279,7 +1279,7 @@ class Item
|
||||||
if ($notify) {
|
if ($notify) {
|
||||||
// We have to avoid duplicates. So we create the GUID in form of a hash of the plink or uri.
|
// We have to avoid duplicates. So we create the GUID in form of a hash of the plink or uri.
|
||||||
// We add the hash of our own host because our host is the original creator of the post.
|
// We add the hash of our own host because our host is the original creator of the post.
|
||||||
$prefix_host = \get_app()->getHostName();
|
$prefix_host = DI::baseUrl()->getHostname();
|
||||||
} else {
|
} else {
|
||||||
$prefix_host = '';
|
$prefix_host = '';
|
||||||
|
|
||||||
|
@ -2752,8 +2752,6 @@ class Item
|
||||||
|
|
||||||
public static function isRemoteSelf($contact, &$datarray)
|
public static function isRemoteSelf($contact, &$datarray)
|
||||||
{
|
{
|
||||||
$a = \get_app();
|
|
||||||
|
|
||||||
if (!$contact['remote_self']) {
|
if (!$contact['remote_self']) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -2765,7 +2763,7 @@ class Item
|
||||||
}
|
}
|
||||||
|
|
||||||
// Prevent to forward already forwarded posts
|
// Prevent to forward already forwarded posts
|
||||||
if ($datarray["app"] == $a->getHostName()) {
|
if ($datarray["app"] == DI::baseUrl()->getHostname()) {
|
||||||
Logger::log('Already forwarded (second test)', Logger::DEBUG);
|
Logger::log('Already forwarded (second test)', Logger::DEBUG);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,6 +23,7 @@ use Friendica\Core\System;
|
||||||
use Friendica\Core\Theme;
|
use Friendica\Core\Theme;
|
||||||
use Friendica\Core\Worker;
|
use Friendica\Core\Worker;
|
||||||
use Friendica\Database\DBA;
|
use Friendica\Database\DBA;
|
||||||
|
use Friendica\DI;
|
||||||
use Friendica\Protocol\Activity;
|
use Friendica\Protocol\Activity;
|
||||||
use Friendica\Protocol\Diaspora;
|
use Friendica\Protocol\Diaspora;
|
||||||
use Friendica\Util\DateTimeFormat;
|
use Friendica\Util\DateTimeFormat;
|
||||||
|
@ -1175,7 +1176,7 @@ class Profile
|
||||||
|
|
||||||
$a->contact = $arr['visitor'];
|
$a->contact = $arr['visitor'];
|
||||||
|
|
||||||
info(L10n::t('OpenWebAuth: %1$s welcomes %2$s', $a->getHostName(), $visitor['name']));
|
info(L10n::t('OpenWebAuth: %1$s welcomes %2$s', DI::baseUrl()->getHostname(), $visitor['name']));
|
||||||
|
|
||||||
Logger::log('OpenWebAuth: auth success from ' . $visitor['addr'], Logger::DEBUG);
|
Logger::log('OpenWebAuth: auth success from ' . $visitor['addr'], Logger::DEBUG);
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,6 +18,7 @@ use Friendica\Core\Protocol;
|
||||||
use Friendica\Core\System;
|
use Friendica\Core\System;
|
||||||
use Friendica\Core\Worker;
|
use Friendica\Core\Worker;
|
||||||
use Friendica\Database\DBA;
|
use Friendica\Database\DBA;
|
||||||
|
use Friendica\DI;
|
||||||
use Friendica\Model\TwoFactor\AppSpecificPassword;
|
use Friendica\Model\TwoFactor\AppSpecificPassword;
|
||||||
use Friendica\Object\Image;
|
use Friendica\Object\Image;
|
||||||
use Friendica\Util\Crypto;
|
use Friendica\Util\Crypto;
|
||||||
|
@ -587,7 +588,6 @@ class User
|
||||||
*/
|
*/
|
||||||
public static function create(array $data)
|
public static function create(array $data)
|
||||||
{
|
{
|
||||||
$a = \get_app();
|
|
||||||
$return = ['user' => null, 'password' => ''];
|
$return = ['user' => null, 'password' => ''];
|
||||||
|
|
||||||
$using_invites = Config::get('system', 'invitation_only');
|
$using_invites = Config::get('system', 'invitation_only');
|
||||||
|
@ -633,7 +633,7 @@ class User
|
||||||
$_SESSION['register'] = 1;
|
$_SESSION['register'] = 1;
|
||||||
$_SESSION['openid'] = $openid_url;
|
$_SESSION['openid'] = $openid_url;
|
||||||
|
|
||||||
$openid = new LightOpenID($a->getHostName());
|
$openid = new LightOpenID(DI::baseUrl()->getHostname());
|
||||||
$openid->identity = $openid_url;
|
$openid->identity = $openid_url;
|
||||||
$openid->returnUrl = System::baseUrl() . '/openid';
|
$openid->returnUrl = System::baseUrl() . '/openid';
|
||||||
$openid->required = ['namePerson/friendly', 'contact/email', 'namePerson'];
|
$openid->required = ['namePerson/friendly', 'contact/email', 'namePerson'];
|
||||||
|
|
|
@ -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() . (DI::baseUrl()->getUrlPath() ? '/' . DI::baseUrl()->getUrlPath() : '')
|
'acct:' . $user['nickname'] . '@' . DI::baseUrl()->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.
|
||||||
|
|
|
@ -21,7 +21,7 @@ class OpenSearch extends BaseModule
|
||||||
{
|
{
|
||||||
header('Content-type: application/opensearchdescription+xml');
|
header('Content-type: application/opensearchdescription+xml');
|
||||||
|
|
||||||
$hostname = DI::app()->getHostName();
|
$hostname = DI::baseUrl()->getHostname()();
|
||||||
$baseUrl = DI::app()->getBaseURL();
|
$baseUrl = DI::app()->getBaseURL();
|
||||||
|
|
||||||
/** @var DOMDocument $xml */
|
/** @var DOMDocument $xml */
|
||||||
|
|
|
@ -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() . (DI::baseUrl()->getUrlPath() ? '/' . DI::baseUrl()->getUrlPath() : ''));
|
$uri = urlencode('acct:' . $a->profile['nickname'] . '@' . DI::baseUrl()->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);
|
||||||
|
|
||||||
|
|
|
@ -124,7 +124,7 @@ class Register extends BaseModule
|
||||||
'$ask_password' => $ask_password,
|
'$ask_password' => $ask_password,
|
||||||
'$password1' => ['password1', L10n::t('New Password:'), '', L10n::t('Leave empty for an auto generated password.')],
|
'$password1' => ['password1', L10n::t('New Password:'), '', L10n::t('Leave empty for an auto generated password.')],
|
||||||
'$password2' => ['confirm', L10n::t('Confirm:'), '', ''],
|
'$password2' => ['confirm', L10n::t('Confirm:'), '', ''],
|
||||||
'$nickdesc' => L10n::t('Choose a profile nickname. This must begin with a text character. Your profile address on this site will then be "<strong>nickname@%s</strong>".', DI::app()->getHostName()),
|
'$nickdesc' => L10n::t('Choose a profile nickname. This must begin with a text character. Your profile address on this site will then be "<strong>nickname@%s</strong>".', DI::baseUrl()->getHostname()),
|
||||||
'$nicklabel' => L10n::t('Choose a nickname: '),
|
'$nicklabel' => L10n::t('Choose a nickname: '),
|
||||||
'$photo' => $photo,
|
'$photo' => $photo,
|
||||||
'$publish' => $profile_publish,
|
'$publish' => $profile_publish,
|
||||||
|
@ -132,7 +132,7 @@ class Register extends BaseModule
|
||||||
'$username' => $username,
|
'$username' => $username,
|
||||||
'$email' => $email,
|
'$email' => $email,
|
||||||
'$nickname' => $nickname,
|
'$nickname' => $nickname,
|
||||||
'$sitename' => DI::app()->getHostName(),
|
'$sitename' => DI::baseUrl()->getHostname()(),
|
||||||
'$importh' => L10n::t('Import'),
|
'$importh' => L10n::t('Import'),
|
||||||
'$importt' => L10n::t('Import your profile to this friendica instance'),
|
'$importt' => L10n::t('Import your profile to this friendica instance'),
|
||||||
'$showtoslink' => Config::get('system', 'tosdisplay'),
|
'$showtoslink' => Config::get('system', 'tosdisplay'),
|
||||||
|
|
|
@ -30,7 +30,7 @@ class HostMeta extends BaseModule
|
||||||
|
|
||||||
$tpl = Renderer::getMarkupTemplate('xrd_host.tpl');
|
$tpl = Renderer::getMarkupTemplate('xrd_host.tpl');
|
||||||
echo Renderer::replaceMacros($tpl, [
|
echo Renderer::replaceMacros($tpl, [
|
||||||
'$zhost' => $app->getHostName(),
|
'$zhost' => DI::baseUrl()->getHostname()(),
|
||||||
'$zroot' => $app->getBaseURL(),
|
'$zroot' => $app->getBaseURL(),
|
||||||
'$domain' => $app->getBaseURL(),
|
'$domain' => $app->getBaseURL(),
|
||||||
'$bigkey' => Salmon::salmonKey($config->get('system', 'site_pubkey'))
|
'$bigkey' => Salmon::salmonKey($config->get('system', 'site_pubkey'))
|
||||||
|
|
|
@ -17,6 +17,7 @@ use Friendica\Core\Logger;
|
||||||
use Friendica\Core\Protocol;
|
use Friendica\Core\Protocol;
|
||||||
use Friendica\Core\System;
|
use Friendica\Core\System;
|
||||||
use Friendica\Database\DBA;
|
use Friendica\Database\DBA;
|
||||||
|
use Friendica\DI;
|
||||||
use Friendica\Model\Contact;
|
use Friendica\Model\Contact;
|
||||||
use Friendica\Model\Profile;
|
use Friendica\Model\Profile;
|
||||||
use Friendica\Protocol\ActivityNamespace;
|
use Friendica\Protocol\ActivityNamespace;
|
||||||
|
@ -76,7 +77,7 @@ class Probe
|
||||||
*/
|
*/
|
||||||
private static function ownHost($host)
|
private static function ownHost($host)
|
||||||
{
|
{
|
||||||
$own_host = \get_app()->getHostName();
|
$own_host = DI::baseUrl()->getHostname();
|
||||||
|
|
||||||
$parts = parse_url($host);
|
$parts = parse_url($host);
|
||||||
|
|
||||||
|
|
|
@ -13,6 +13,7 @@ use Friendica\Core\Logger;
|
||||||
use Friendica\Core\Protocol;
|
use Friendica\Core\Protocol;
|
||||||
use Friendica\Core\System;
|
use Friendica\Core\System;
|
||||||
use Friendica\Database\DBA;
|
use Friendica\Database\DBA;
|
||||||
|
use Friendica\DI;
|
||||||
use Friendica\Model\Item;
|
use Friendica\Model\Item;
|
||||||
use Friendica\Protocol\ActivityNamespace;
|
use Friendica\Protocol\ActivityNamespace;
|
||||||
use Friendica\Util\ParseUrl;
|
use Friendica\Util\ParseUrl;
|
||||||
|
@ -465,7 +466,7 @@ class Feed {
|
||||||
// Distributed items should have a well formatted URI.
|
// Distributed items should have a well formatted URI.
|
||||||
// Additionally we have to avoid conflicts with identical URI between imported feeds and these items.
|
// Additionally we have to avoid conflicts with identical URI between imported feeds and these items.
|
||||||
if ($notify) {
|
if ($notify) {
|
||||||
$item['guid'] = Item::guidFromUri($orig_plink, $a->getHostName());
|
$item['guid'] = Item::guidFromUri($orig_plink, DI::baseUrl()->getHostname()());
|
||||||
unset($item['uri']);
|
unset($item['uri']);
|
||||||
unset($item['parent-uri']);
|
unset($item['parent-uri']);
|
||||||
|
|
||||||
|
|
|
@ -17,6 +17,7 @@ use Friendica\Core\PConfig;
|
||||||
use Friendica\Core\Protocol;
|
use Friendica\Core\Protocol;
|
||||||
use Friendica\Core\System;
|
use Friendica\Core\System;
|
||||||
use Friendica\Database\DBA;
|
use Friendica\Database\DBA;
|
||||||
|
use Friendica\DI;
|
||||||
use Friendica\Model\APContact;
|
use Friendica\Model\APContact;
|
||||||
use Friendica\Model\Contact;
|
use Friendica\Model\Contact;
|
||||||
use Friendica\Model\Conversation;
|
use Friendica\Model\Conversation;
|
||||||
|
@ -1846,7 +1847,7 @@ class OStatus
|
||||||
}
|
}
|
||||||
|
|
||||||
$item["uri"] = $item['parent-uri'] = $item['thr-parent']
|
$item["uri"] = $item['parent-uri'] = $item['thr-parent']
|
||||||
= 'tag:'.get_app()->getHostName().
|
= 'tag:' . DI::baseUrl()->getHostname()().
|
||||||
','.date('Y-m-d').':'.$action.':'.$owner['uid'].
|
','.date('Y-m-d').':'.$action.':'.$owner['uid'].
|
||||||
':person:'.$connect_id.':'.$item['created'];
|
':person:'.$connect_id.':'.$item['created'];
|
||||||
|
|
||||||
|
|
|
@ -37,6 +37,7 @@ namespace Friendica\Util;
|
||||||
use Friendica\Core\Config;
|
use Friendica\Core\Config;
|
||||||
use Friendica\Core\PConfig;
|
use Friendica\Core\PConfig;
|
||||||
use Friendica\Database\DBA;
|
use Friendica\Database\DBA;
|
||||||
|
use Friendica\DI;
|
||||||
use Friendica\Model\User;
|
use Friendica\Model\User;
|
||||||
|
|
||||||
class ExAuth
|
class ExAuth
|
||||||
|
@ -123,8 +124,6 @@ class ExAuth
|
||||||
*/
|
*/
|
||||||
private function isUser(array $aCommand)
|
private function isUser(array $aCommand)
|
||||||
{
|
{
|
||||||
$a = \get_app();
|
|
||||||
|
|
||||||
// Check if there is a username
|
// Check if there is a username
|
||||||
if (!isset($aCommand[1])) {
|
if (!isset($aCommand[1])) {
|
||||||
$this->writeLog(LOG_NOTICE, 'invalid isuser command, no username given');
|
$this->writeLog(LOG_NOTICE, 'invalid isuser command, no username given');
|
||||||
|
@ -140,7 +139,7 @@ class ExAuth
|
||||||
$sUser = str_replace(['%20', '(a)'], [' ', '@'], $aCommand[1]);
|
$sUser = str_replace(['%20', '(a)'], [' ', '@'], $aCommand[1]);
|
||||||
|
|
||||||
// Does the hostname match? So we try directly
|
// Does the hostname match? So we try directly
|
||||||
if ($a->getHostName() == $aCommand[2]) {
|
if (DI::baseUrl()->getHostname() == $aCommand[2]) {
|
||||||
$this->writeLog(LOG_INFO, 'internal user check for ' . $sUser . '@' . $aCommand[2]);
|
$this->writeLog(LOG_INFO, 'internal user check for ' . $sUser . '@' . $aCommand[2]);
|
||||||
$found = DBA::exists('user', ['nickname' => $sUser]);
|
$found = DBA::exists('user', ['nickname' => $sUser]);
|
||||||
} else {
|
} else {
|
||||||
|
@ -205,8 +204,6 @@ class ExAuth
|
||||||
*/
|
*/
|
||||||
private function auth(array $aCommand)
|
private function auth(array $aCommand)
|
||||||
{
|
{
|
||||||
$a = \get_app();
|
|
||||||
|
|
||||||
// check user authentication
|
// check user authentication
|
||||||
if (sizeof($aCommand) != 4) {
|
if (sizeof($aCommand) != 4) {
|
||||||
$this->writeLog(LOG_NOTICE, 'invalid auth command, data missing');
|
$this->writeLog(LOG_NOTICE, 'invalid auth command, data missing');
|
||||||
|
@ -222,7 +219,7 @@ class ExAuth
|
||||||
$sUser = str_replace(['%20', '(a)'], [' ', '@'], $aCommand[1]);
|
$sUser = str_replace(['%20', '(a)'], [' ', '@'], $aCommand[1]);
|
||||||
|
|
||||||
// Does the hostname match? So we try directly
|
// Does the hostname match? So we try directly
|
||||||
if ($a->getHostName() == $aCommand[2]) {
|
if (DI::baseUrl()->getHostname() == $aCommand[2]) {
|
||||||
$this->writeLog(LOG_INFO, 'internal auth for ' . $sUser . '@' . $aCommand[2]);
|
$this->writeLog(LOG_INFO, 'internal auth for ' . $sUser . '@' . $aCommand[2]);
|
||||||
|
|
||||||
$aUser = DBA::selectFirst('user', ['uid', 'password', 'legacy_password'], ['nickname' => $sUser]);
|
$aUser = DBA::selectFirst('user', ['uid', 'password', 'legacy_password'], ['nickname' => $sUser]);
|
||||||
|
|
|
@ -47,7 +47,7 @@ class CronJobs
|
||||||
Logger::info('cron_start');
|
Logger::info('cron_start');
|
||||||
Nodeinfo::update();
|
Nodeinfo::update();
|
||||||
// Now trying to register
|
// Now trying to register
|
||||||
$url = 'http://the-federation.info/register/' . $a->getHostName();
|
$url = 'http://the-federation.info/register/' . DI::baseUrl()->getHostname();
|
||||||
Logger::debug('Check registering url', ['url' => $url]);
|
Logger::debug('Check registering url', ['url' => $url]);
|
||||||
$ret = Network::fetchUrl($url);
|
$ret = Network::fetchUrl($url);
|
||||||
Logger::debug('Check registering answer', ['answer' => $ret]);
|
Logger::debug('Check registering answer', ['answer' => $ret]);
|
||||||
|
|
|
@ -140,7 +140,7 @@ class Delivery
|
||||||
// if $parent['wall'] == 1 we will already have the parent message in our array
|
// if $parent['wall'] == 1 we will already have the parent message in our array
|
||||||
// and we will relay the whole lot.
|
// and we will relay the whole lot.
|
||||||
|
|
||||||
$localhost = DI::app()->getHostName();
|
$localhost = DI::baseUrl()->getHostname();
|
||||||
if (strpos($localhost, ':')) {
|
if (strpos($localhost, ':')) {
|
||||||
$localhost = substr($localhost, 0, strpos($localhost, ':'));
|
$localhost = substr($localhost, 0, strpos($localhost, ':'));
|
||||||
}
|
}
|
||||||
|
@ -548,7 +548,7 @@ class Delivery
|
||||||
$headers = 'From: ' . Email::encodeHeader($local_user['username'],'UTF-8') . ' <' . $local_user['email'] . '>' . "\n";
|
$headers = 'From: ' . Email::encodeHeader($local_user['username'],'UTF-8') . ' <' . $local_user['email'] . '>' . "\n";
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$headers = 'From: '. Email::encodeHeader($local_user['username'], 'UTF-8') . ' <noreply@' . DI::app()->getHostName() . '>' . "\n";
|
$headers = 'From: '. Email::encodeHeader($local_user['username'], 'UTF-8') . ' <noreply@' . DI::baseUrl()->getHostname() . '>' . "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
$headers .= 'Message-Id: <' . Email::iri2msgid($target_item['uri']) . '>' . "\n";
|
$headers .= 'Message-Id: <' . Email::iri2msgid($target_item['uri']) . '>' . "\n";
|
||||||
|
|
|
@ -180,7 +180,7 @@ class Notifier
|
||||||
// if $parent['wall'] == 1 we will already have the parent message in our array
|
// if $parent['wall'] == 1 we will already have the parent message in our array
|
||||||
// and we will relay the whole lot.
|
// and we will relay the whole lot.
|
||||||
|
|
||||||
$localhost = str_replace('www.','',$a->getHostName());
|
$localhost = str_replace('www.','', DI::baseUrl()->getHostname());
|
||||||
if (strpos($localhost,':')) {
|
if (strpos($localhost,':')) {
|
||||||
$localhost = substr($localhost,0,strpos($localhost,':'));
|
$localhost = substr($localhost,0,strpos($localhost,':'));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue