Merge pull request #8036 from nupplaphil/task/redundant_system_call

Remove redundant System::baseUrl() and System::removedBaseUrl() calls
This commit is contained in:
Hypolite Petovan 2019-12-30 17:37:25 -05:00 committed by GitHub
commit b852e5842b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
83 changed files with 427 additions and 490 deletions

View file

@ -130,7 +130,7 @@ function api_date($str)
* *
* @brief Register API endpoint * @brief Register API endpoint
* *
* @param string $path API URL path, relative to System::baseUrl() * @param string $path API URL path, relative to DI::baseUrl()
* @param string $func Function name to call on path request * @param string $func Function name to call on path request
* @param bool $auth API need logged user * @param bool $auth API need logged user
* @param string $method HTTP method reqiured to call this endpoint. * @param string $method HTTP method reqiured to call this endpoint.
@ -438,12 +438,12 @@ function api_rss_extra(App $a, $arr, $user_info)
$arr['$user'] = $user_info; $arr['$user'] = $user_info;
$arr['$rss'] = [ $arr['$rss'] = [
'alternate' => $user_info['url'], 'alternate' => $user_info['url'],
'self' => System::baseUrl() . "/" . DI::args()->getQueryString(), 'self' => DI::baseUrl() . "/" . DI::args()->getQueryString(),
'base' => System::baseUrl(), 'base' => DI::baseUrl(),
'updated' => api_date(null), 'updated' => api_date(null),
'atom_updated' => DateTimeFormat::utcNow(DateTimeFormat::ATOM), 'atom_updated' => DateTimeFormat::utcNow(DateTimeFormat::ATOM),
'language' => $user_info['lang'], 'language' => $user_info['lang'],
'logo' => System::baseUrl() . "/images/friendica-32.png", 'logo' => DI::baseUrl() . "/images/friendica-32.png",
]; ];
return $arr; return $arr;
@ -714,7 +714,7 @@ function api_get_user(App $a, $contact_id = null)
'statusnet_blocking' => false, 'statusnet_blocking' => false,
'notifications' => false, 'notifications' => false,
/// @TODO old way? /// @TODO old way?
//'statusnet_profile_url' => System::baseUrl()."/contact/".$uinfo[0]['cid'], //'statusnet_profile_url' => DI::baseUrl()."/contact/".$uinfo[0]['cid'],
'statusnet_profile_url' => $uinfo[0]['url'], 'statusnet_profile_url' => $uinfo[0]['url'],
'uid' => intval($uinfo[0]['uid']), 'uid' => intval($uinfo[0]['uid']),
'cid' => intval($uinfo[0]['cid']), 'cid' => intval($uinfo[0]['cid']),
@ -1164,8 +1164,8 @@ function api_statuses_update($type)
$phototypes = Images::supportedTypes(); $phototypes = Images::supportedTypes();
$ext = $phototypes[$r[0]['type']]; $ext = $phototypes[$r[0]['type']];
$description = $r[0]['desc'] ?? ''; $description = $r[0]['desc'] ?? '';
$_REQUEST['body'] .= "\n\n" . '[url=' . System::baseUrl() . '/photos/' . $r[0]['nickname'] . '/image/' . $r[0]['resource-id'] . ']'; $_REQUEST['body'] .= "\n\n" . '[url=' . DI::baseUrl() . '/photos/' . $r[0]['nickname'] . '/image/' . $r[0]['resource-id'] . ']';
$_REQUEST['body'] .= '[img=' . System::baseUrl() . '/photo/' . $r[0]['resource-id'] . '-' . $r[0]['scale'] . '.' . $ext . ']' . $description . '[/img][/url]'; $_REQUEST['body'] .= '[img=' . DI::baseUrl() . '/photo/' . $r[0]['resource-id'] . '-' . $r[0]['scale'] . '.' . $ext . ']' . $description . '[/img][/url]';
} }
} }
} }
@ -2786,7 +2786,7 @@ function api_format_items_embeded_images($item, $text)
$text = preg_replace_callback( $text = preg_replace_callback(
'|data:image/([^;]+)[^=]+=*|m', '|data:image/([^;]+)[^=]+=*|m',
function () use ($item) { function () use ($item) {
return System::baseUrl() . '/display/' . $item['guid']; return DI::baseUrl() . '/display/' . $item['guid'];
}, },
$text $text
); );
@ -3041,7 +3041,7 @@ function api_format_item($item, $type = "json", $status_user = null, $author_use
//'entities' => NULL, //'entities' => NULL,
'statusnet_html' => $converted["html"], 'statusnet_html' => $converted["html"],
'statusnet_conversation_id' => $item['parent'], 'statusnet_conversation_id' => $item['parent'],
'external_url' => System::baseUrl() . "/display/" . $item['guid'], 'external_url' => DI::baseUrl() . "/display/" . $item['guid'],
'friendica_activities' => api_format_items_activities($item, $type), 'friendica_activities' => api_format_items_activities($item, $type),
'friendica_title' => $item['title'], 'friendica_title' => $item['title'],
'friendica_html' => BBCode::convert($item['body'], false) 'friendica_html' => BBCode::convert($item['body'], false)
@ -3569,13 +3569,13 @@ function api_statusnet_config($type)
{ {
$name = Config::get('config', 'sitename'); $name = Config::get('config', 'sitename');
$server = DI::baseUrl()->getHostname(); $server = DI::baseUrl()->getHostname();
$logo = System::baseUrl() . '/images/friendica-64.png'; $logo = DI::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';
$private = Config::get('system', 'block_public') ? 'true' : 'false'; $private = Config::get('system', 'block_public') ? 'true' : 'false';
$textlimit = (string) Config::get('config', 'api_import_size', Config::get('config', 'max_import_size', 200000)); $textlimit = (string) Config::get('config', 'api_import_size', Config::get('config', 'max_import_size', 200000));
$ssl = Config::get('system', 'have_ssl') ? 'true' : 'false'; $ssl = Config::get('system', 'have_ssl') ? 'true' : 'false';
$sslserver = Config::get('system', 'have_ssl') ? str_replace('http:', 'https:', System::baseUrl()) : ''; $sslserver = Config::get('system', 'have_ssl') ? str_replace('http:', 'https:', DI::baseUrl()) : '';
$config = [ $config = [
'site' => ['name' => $name,'server' => $server, 'theme' => 'default', 'path' => '', 'site' => ['name' => $name,'server' => $server, 'theme' => 'default', 'path' => '',
@ -4313,7 +4313,7 @@ function api_fr_photos_list($type)
$photo['album'] = $rr['album']; $photo['album'] = $rr['album'];
$photo['filename'] = $rr['filename']; $photo['filename'] = $rr['filename'];
$photo['type'] = $rr['type']; $photo['type'] = $rr['type'];
$thumb = System::baseUrl() . "/photo/" . $rr['resource-id'] . "-" . $rr['scale'] . "." . $typetoext[$rr['type']]; $thumb = DI::baseUrl() . "/photo/" . $rr['resource-id'] . "-" . $rr['scale'] . "." . $typetoext[$rr['type']];
$photo['created'] = $rr['created']; $photo['created'] = $rr['created'];
$photo['edited'] = $rr['edited']; $photo['edited'] = $rr['edited'];
$photo['desc'] = $rr['desc']; $photo['desc'] = $rr['desc'];
@ -4619,15 +4619,15 @@ function api_account_update_profile_image($type)
$condition = ["`profile` AND `resource-id` != ? AND `uid` = ?", $data['photo']['id'], api_user()]; $condition = ["`profile` AND `resource-id` != ? AND `uid` = ?", $data['photo']['id'], api_user()];
Photo::update(['profile' => false], $condition); Photo::update(['profile' => false], $condition);
} else { } else {
$fields = ['photo' => System::baseUrl() . '/photo/' . $data['photo']['id'] . '-4.' . $fileext, $fields = ['photo' => DI::baseUrl() . '/photo/' . $data['photo']['id'] . '-4.' . $fileext,
'thumb' => System::baseUrl() . '/photo/' . $data['photo']['id'] . '-5.' . $fileext]; 'thumb' => DI::baseUrl() . '/photo/' . $data['photo']['id'] . '-5.' . $fileext];
DBA::update('profile', $fields, ['id' => $_REQUEST['profile'], 'uid' => api_user()]); DBA::update('profile', $fields, ['id' => $_REQUEST['profile'], 'uid' => api_user()]);
} }
Contact::updateSelfFromUserID(api_user(), true); Contact::updateSelfFromUserID(api_user(), true);
// Update global directory in background // Update global directory in background
$url = System::baseUrl() . '/profile/' . \get_app()->user['nickname']; $url = DI::baseUrl() . '/profile/' . \get_app()->user['nickname'];
if ($url && strlen(Config::get('system', 'directory'))) { if ($url && strlen(Config::get('system', 'directory'))) {
Worker::add(PRIORITY_LOW, "Directory", $url); Worker::add(PRIORITY_LOW, "Directory", $url);
} }
@ -4939,8 +4939,8 @@ function post_photo_item($hash, $allow_cid, $deny_cid, $allow_gid, $deny_gid, $f
]; ];
// adds link to the thumbnail scale photo // adds link to the thumbnail scale photo
$arr['body'] = '[url=' . System::baseUrl() . '/photos/' . $owner_record['nick'] . '/image/' . $hash . ']' $arr['body'] = '[url=' . DI::baseUrl() . '/photos/' . $owner_record['nick'] . '/image/' . $hash . ']'
. '[img]' . System::baseUrl() . '/photo/' . $hash . '-' . "2" . '.'. $typetoext[$filetype] . '[/img]' . '[img]' . DI::baseUrl() . '/photo/' . $hash . '-' . "2" . '.'. $typetoext[$filetype] . '[/img]'
. '[/url]'; . '[/url]';
// do the magic for storing the item in the database and trigger the federation to other contacts // do the magic for storing the item in the database and trigger the federation to other contacts
@ -5008,14 +5008,14 @@ function prepare_photo_data($type, $scale, $photo_id)
for ($k = intval($data['photo']['minscale']); $k <= intval($data['photo']['maxscale']); $k++) { for ($k = intval($data['photo']['minscale']); $k <= intval($data['photo']['maxscale']); $k++) {
$data['photo']['links'][$k . ":link"]["@attributes"] = ["type" => $data['photo']['type'], $data['photo']['links'][$k . ":link"]["@attributes"] = ["type" => $data['photo']['type'],
"scale" => $k, "scale" => $k,
"href" => System::baseUrl() . "/photo/" . $data['photo']['resource-id'] . "-" . $k . "." . $typetoext[$data['photo']['type']]]; "href" => DI::baseUrl() . "/photo/" . $data['photo']['resource-id'] . "-" . $k . "." . $typetoext[$data['photo']['type']]];
} }
} else { } else {
$data['photo']['link'] = []; $data['photo']['link'] = [];
// when we have profile images we could have only scales from 4 to 6, but index of array always needs to start with 0 // when we have profile images we could have only scales from 4 to 6, but index of array always needs to start with 0
$i = 0; $i = 0;
for ($k = intval($data['photo']['minscale']); $k <= intval($data['photo']['maxscale']); $k++) { for ($k = intval($data['photo']['minscale']); $k <= intval($data['photo']['maxscale']); $k++) {
$data['photo']['link'][$i] = System::baseUrl() . "/photo/" . $data['photo']['resource-id'] . "-" . $k . "." . $typetoext[$data['photo']['type']]; $data['photo']['link'][$i] = DI::baseUrl() . "/photo/" . $data['photo']['resource-id'] . "-" . $k . "." . $typetoext[$data['photo']['type']];
$i++; $i++;
} }
} }

View file

@ -16,7 +16,6 @@ use Friendica\Core\PConfig;
use Friendica\Core\Protocol; use Friendica\Core\Protocol;
use Friendica\Core\Renderer; use Friendica\Core\Renderer;
use Friendica\Core\Session; use Friendica\Core\Session;
use Friendica\Core\System;
use Friendica\Database\DBA; use Friendica\Database\DBA;
use Friendica\DI; use Friendica\DI;
use Friendica\Model\Contact; use Friendica\Model\Contact;
@ -86,7 +85,7 @@ function item_redir_and_replace_images($body, $images, $cid) {
while ($pos !== false && $cnt < 1000) { while ($pos !== false && $cnt < 1000) {
$search = '/\[url\=(.*?)\]\[!#saved_image([0-9]*)#!\]\[\/url\]' . '/is'; $search = '/\[url\=(.*?)\]\[!#saved_image([0-9]*)#!\]\[\/url\]' . '/is';
$replace = '[url=' . System::baseUrl() . '/redir/' . $cid $replace = '[url=' . DI::baseUrl() . '/redir/' . $cid
. '?f=1&url=' . '$1' . '][!#saved_image' . '$2' .'#!][/url]'; . '?f=1&url=' . '$1' . '][!#saved_image' . '$2' .'#!][/url]';
$newbody .= substr($origbody, 0, $pos['start']['open']); $newbody .= substr($origbody, 0, $pos['start']['open']);
@ -686,7 +685,7 @@ function conversation(App $a, array $items, Pager $pager, $mode, $update, $previ
'name' => $profile_name, 'name' => $profile_name,
'sparkle' => $sparkle, 'sparkle' => $sparkle,
'lock' => $lock, 'lock' => $lock,
'thumb' => System::removedBaseUrl(ProxyUtils::proxifyUrl($item['author-avatar'], false, ProxyUtils::SIZE_THUMB)), 'thumb' => DI::baseUrl()->remove(ProxyUtils::proxifyUrl($item['author-avatar'], false, ProxyUtils::SIZE_THUMB)),
'title' => $title, 'title' => $title,
'body' => $body, 'body' => $body,
'tags' => $tags['tags'], 'tags' => $tags['tags'],
@ -706,7 +705,7 @@ function conversation(App $a, array $items, Pager $pager, $mode, $update, $previ
'indent' => '', 'indent' => '',
'owner_name' => $owner_name, 'owner_name' => $owner_name,
'owner_url' => $owner_url, 'owner_url' => $owner_url,
'owner_photo' => System::removedBaseUrl(ProxyUtils::proxifyUrl($item['owner-avatar'], false, ProxyUtils::SIZE_THUMB)), 'owner_photo' => DI::baseUrl()->remove(ProxyUtils::proxifyUrl($item['owner-avatar'], false, ProxyUtils::SIZE_THUMB)),
'plink' => Item::getPlink($item), 'plink' => Item::getPlink($item),
'edpost' => false, 'edpost' => false,
'isstarred' => $isstarred, 'isstarred' => $isstarred,
@ -779,7 +778,7 @@ function conversation(App $a, array $items, Pager $pager, $mode, $update, $previ
} }
$o = Renderer::replaceMacros($page_template, [ $o = Renderer::replaceMacros($page_template, [
'$baseurl' => System::baseUrl($ssl_state), '$baseurl' => DI::baseUrl()->get($ssl_state),
'$return_path' => DI::args()->getQueryString(), '$return_path' => DI::args()->getQueryString(),
'$live_update' => $live_update_div, '$live_update' => $live_update_div,
'$remove' => L10n::t('remove'), '$remove' => L10n::t('remove'),
@ -1173,7 +1172,7 @@ function status_editor(App $a, $x, $notes_cid = 0, $popup = false)
$tpl = Renderer::getMarkupTemplate('jot-header.tpl'); $tpl = Renderer::getMarkupTemplate('jot-header.tpl');
DI::page()['htmlhead'] .= Renderer::replaceMacros($tpl, [ DI::page()['htmlhead'] .= Renderer::replaceMacros($tpl, [
'$newpost' => 'true', '$newpost' => 'true',
'$baseurl' => System::baseUrl(true), '$baseurl' => DI::baseUrl()->get(true),
'$geotag' => $geotag, '$geotag' => $geotag,
'$nickname' => $x['nickname'], '$nickname' => $x['nickname'],
'$ispublic' => L10n::t('Visible to <strong>everybody</strong>'), '$ispublic' => L10n::t('Visible to <strong>everybody</strong>'),
@ -1244,7 +1243,7 @@ function status_editor(App $a, $x, $notes_cid = 0, $popup = false)
'$posttype' => $notes_cid ? Item::PT_PERSONAL_NOTE : Item::PT_ARTICLE, '$posttype' => $notes_cid ? Item::PT_PERSONAL_NOTE : Item::PT_ARTICLE,
'$content' => $x['content'] ?? '', '$content' => $x['content'] ?? '',
'$post_id' => $x['post_id'] ?? '', '$post_id' => $x['post_id'] ?? '',
'$baseurl' => System::baseUrl(true), '$baseurl' => DI::baseUrl()->get(true),
'$defloc' => $x['default_location'], '$defloc' => $x['default_location'],
'$visitor' => $x['visitor'], '$visitor' => $x['visitor'],
'$pvisit' => $notes_cid ? 'none' : $x['visitor'], '$pvisit' => $notes_cid ? 'none' : $x['visitor'],

View file

@ -59,7 +59,7 @@ function notification($params)
$banner = $l10n->t('Friendica Notification'); $banner = $l10n->t('Friendica Notification');
$product = FRIENDICA_PLATFORM; $product = FRIENDICA_PLATFORM;
$siteurl = System::baseUrl(true); $siteurl = DI::baseUrl()->get(true);
$thanks = $l10n->t('Thank You,'); $thanks = $l10n->t('Thank You,');
$sitename = Config::get('config', 'sitename'); $sitename = Config::get('config', 'sitename');
if (Config::get('config', 'admin_name')) { if (Config::get('config', 'admin_name')) {
@ -101,7 +101,7 @@ function notification($params)
$additional_mail_header .= "X-Friendica-Platform: ".FRIENDICA_PLATFORM."\n"; $additional_mail_header .= "X-Friendica-Platform: ".FRIENDICA_PLATFORM."\n";
$additional_mail_header .= "X-Friendica-Version: ".FRIENDICA_VERSION."\n"; $additional_mail_header .= "X-Friendica-Version: ".FRIENDICA_VERSION."\n";
$additional_mail_header .= "List-ID: <notification.".$hostname.">\n"; $additional_mail_header .= "List-ID: <notification.".$hostname.">\n";
$additional_mail_header .= "List-Archive: <".System::baseUrl()."/notifications/system>\n"; $additional_mail_header .= "List-Archive: <".DI::baseUrl()."/notifications/system>\n";
if (array_key_exists('item', $params)) { if (array_key_exists('item', $params)) {
$title = $params['item']['title']; $title = $params['item']['title'];
@ -536,7 +536,7 @@ function notification($params)
$notify_id = DBA::lastInsertId(); $notify_id = DBA::lastInsertId();
$itemlink = System::baseUrl().'/notify/view/'.$notify_id; $itemlink = DI::baseUrl().'/notify/view/'.$notify_id;
$msg = Renderer::replaceMacros($epreamble, ['$itemlink' => $itemlink]); $msg = Renderer::replaceMacros($epreamble, ['$itemlink' => $itemlink]);
$msg_cache = format_notification_message($datarray['name_cache'], strip_tags(BBCode::convert($msg))); $msg_cache = format_notification_message($datarray['name_cache'], strip_tags(BBCode::convert($msg)));
@ -714,7 +714,7 @@ function check_item_notification($itemid, $uid, $defaulttype = "") {
$profiles[] = $owner["url"]; $profiles[] = $owner["url"];
// Notifications from Diaspora are often with an URL in the Diaspora format // Notifications from Diaspora are often with an URL in the Diaspora format
$profiles[] = System::baseUrl()."/u/".$user["nickname"]; $profiles[] = DI::baseUrl()."/u/".$user["nickname"];
$profiles2 = []; $profiles2 = [];
@ -764,7 +764,7 @@ function check_item_notification($itemid, $uid, $defaulttype = "") {
$params["uid"] = $uid; $params["uid"] = $uid;
$params["item"] = $item; $params["item"] = $item;
$params["parent"] = $item["parent"]; $params["parent"] = $item["parent"];
$params["link"] = System::baseUrl().'/display/'.urlencode($item["guid"]); $params["link"] = DI::baseUrl().'/display/'.urlencode($item["guid"]);
$params["otype"] = 'item'; $params["otype"] = 'item';
$params["source_name"] = $item["author-name"]; $params["source_name"] = $item["author-name"];
$params["source_link"] = $item["author-link"]; $params["source_link"] = $item["author-link"];

View file

@ -9,7 +9,6 @@ use Friendica\Core\L10n;
use Friendica\Core\Logger; use Friendica\Core\Logger;
use Friendica\Core\Protocol; use Friendica\Core\Protocol;
use Friendica\Core\Renderer; use Friendica\Core\Renderer;
use Friendica\Core\System;
use Friendica\Core\Session; use Friendica\Core\Session;
use Friendica\Database\DBA; use Friendica\Database\DBA;
use Friendica\DI; use Friendica\DI;
@ -92,7 +91,7 @@ function add_page_info_data(array $data, $no_photos = false)
/// @TODO make a positive list of allowed characters /// @TODO make a positive list of allowed characters
$hashtag = str_replace([" ", "+", "/", ".", "#", "'", "", "`", "(", ")", "", ""], $hashtag = str_replace([" ", "+", "/", ".", "#", "'", "", "`", "(", ")", "", ""],
["", "", "", "", "", "", "", "", "", "", "", ""], $keyword); ["", "", "", "", "", "", "", "", "", "", "", ""], $keyword);
$hashtags .= "#[url=" . System::baseUrl() . "/search?tag=" . $hashtag . "]" . $hashtag . "[/url] "; $hashtags .= "#[url=" . DI::baseUrl() . "/search?tag=" . $hashtag . "]" . $hashtag . "[/url] ";
} }
} }
@ -143,7 +142,7 @@ function add_page_keywords($url, $photo = "", $keywords = false, $keyword_blackl
$tags .= ", "; $tags .= ", ";
} }
$tags .= "#[url=" . System::baseUrl() . "/search?tag=" . $hashtag . "]" . $hashtag . "[/url]"; $tags .= "#[url=" . DI::baseUrl() . "/search?tag=" . $hashtag . "]" . $hashtag . "[/url]";
} }
} }
@ -298,7 +297,7 @@ function subscribe_to_hub($url, array $importer, array $contact, $hubmode = 'sub
return; return;
} }
$push_url = System::baseUrl() . '/pubsub/' . $user['nickname'] . '/' . $contact['id']; $push_url = DI::baseUrl() . '/pubsub/' . $user['nickname'] . '/' . $contact['id'];
// Use a single verify token, even if multiple hubs // Use a single verify token, even if multiple hubs
$verify_token = ((strlen($contact['hub-verify'])) ? $contact['hub-verify'] : Strings::getRandomHex()); $verify_token = ((strlen($contact['hub-verify'])) ? $contact['hub-verify'] : Strings::getRandomHex());

View file

@ -13,7 +13,6 @@ use Friendica\Content\Widget;
use Friendica\Core\Config; use Friendica\Core\Config;
use Friendica\Core\L10n; use Friendica\Core\L10n;
use Friendica\Core\Renderer; use Friendica\Core\Renderer;
use Friendica\Core\System;
use Friendica\Core\Session; use Friendica\Core\Session;
use Friendica\Database\DBA; use Friendica\Database\DBA;
use Friendica\DI; use Friendica\DI;
@ -221,7 +220,7 @@ function cal_content(App $a)
foreach ($r as $rr) { foreach ($r as $rr) {
$j = $rr['adjust'] ? DateTimeFormat::local($rr['start'], 'j') : DateTimeFormat::utc($rr['start'], 'j'); $j = $rr['adjust'] ? DateTimeFormat::local($rr['start'], 'j') : DateTimeFormat::utc($rr['start'], 'j');
if (empty($links[$j])) { if (empty($links[$j])) {
$links[$j] = System::baseUrl() . '/' . DI::args()->getCommand() . '#link-' . $j; $links[$j] = DI::baseUrl() . '/' . DI::args()->getCommand() . '#link-' . $j;
} }
} }
} }
@ -259,8 +258,8 @@ function cal_content(App $a)
'$tabs' => $tabs, '$tabs' => $tabs,
'$title' => L10n::t('Events'), '$title' => L10n::t('Events'),
'$view' => L10n::t('View'), '$view' => L10n::t('View'),
'$previous' => [System::baseUrl() . "/events/$prevyear/$prevmonth", L10n::t('Previous'), '', ''], '$previous' => [DI::baseUrl() . "/events/$prevyear/$prevmonth", L10n::t('Previous'), '', ''],
'$next' => [System::baseUrl() . "/events/$nextyear/$nextmonth", L10n::t('Next'), '', ''], '$next' => [DI::baseUrl() . "/events/$nextyear/$nextmonth", L10n::t('Next'), '', ''],
'$calendar' => Temporal::getCalendarTable($y, $m, $links, ' eventcal'), '$calendar' => Temporal::getCalendarTable($y, $m, $links, ' eventcal'),
'$events' => $events, '$events' => $events,
"today" => L10n::t("today"), "today" => L10n::t("today"),

View file

@ -177,7 +177,7 @@ function dfrn_confirm_post(App $a, $handsfree = null)
$params['dfrn_id'] = bin2hex($result); $params['dfrn_id'] = bin2hex($result);
$params['public_key'] = $public_key; $params['public_key'] = $public_key;
$my_url = System::baseUrl() . '/profile/' . $user['nickname']; $my_url = DI::baseUrl() . '/profile/' . $user['nickname'];
openssl_public_encrypt($my_url, $params['source_url'], $site_pubkey); openssl_public_encrypt($my_url, $params['source_url'], $site_pubkey);
$params['source_url'] = bin2hex($params['source_url']); $params['source_url'] = bin2hex($params['source_url']);
@ -469,7 +469,7 @@ function dfrn_confirm_post(App $a, $handsfree = null)
if (DBA::isResult($contact)) { if (DBA::isResult($contact)) {
$photo = $contact['photo']; $photo = $contact['photo'];
} else { } else {
$photo = System::baseUrl() . '/images/person-300.jpg'; $photo = DI::baseUrl() . '/images/person-300.jpg';
} }
Contact::updateAvatar($photo, $local_uid, $dfrn_record); Contact::updateAvatar($photo, $local_uid, $dfrn_record);
@ -536,7 +536,7 @@ function dfrn_confirm_post(App $a, $handsfree = null)
'to_name' => $combined['username'], 'to_name' => $combined['username'],
'to_email' => $combined['email'], 'to_email' => $combined['email'],
'uid' => $combined['uid'], 'uid' => $combined['uid'],
'link' => System::baseUrl() . '/contact/' . $dfrn_record, 'link' => DI::baseUrl() . '/contact/' . $dfrn_record,
'source_name' => ((strlen(stripslashes($combined['name']))) ? stripslashes($combined['name']) : L10n::t('[Name Withheld]')), 'source_name' => ((strlen(stripslashes($combined['name']))) ? stripslashes($combined['name']) : L10n::t('[Name Withheld]')),
'source_link' => $combined['url'], 'source_link' => $combined['url'],
'source_photo' => $combined['photo'], 'source_photo' => $combined['photo'],

View file

@ -559,7 +559,7 @@ function dfrn_request_content(App $a)
'to_name' => $r[0]['username'], 'to_name' => $r[0]['username'],
'to_email' => $r[0]['email'], 'to_email' => $r[0]['email'],
'uid' => $r[0]['uid'], 'uid' => $r[0]['uid'],
'link' => System::baseUrl() . '/notifications/intros', 'link' => DI::baseUrl() . '/notifications/intros',
'source_name' => ((strlen(stripslashes($r[0]['name']))) ? stripslashes($r[0]['name']) : L10n::t('[Name Withheld]')), 'source_name' => ((strlen(stripslashes($r[0]['name']))) ? stripslashes($r[0]['name']) : L10n::t('[Name Withheld]')),
'source_link' => $r[0]['url'], 'source_link' => $r[0]['url'],
'source_photo' => $r[0]['photo'], 'source_photo' => $r[0]['photo'],
@ -611,16 +611,16 @@ function dfrn_request_content(App $a)
$myaddr = $_GET['address']; $myaddr = $_GET['address'];
} elseif (local_user()) { } elseif (local_user()) {
if (strlen(DI::baseUrl()->getUrlPath())) { if (strlen(DI::baseUrl()->getUrlPath())) {
$myaddr = System::baseUrl() . '/profile/' . $a->user['nickname']; $myaddr = DI::baseUrl() . '/profile/' . $a->user['nickname'];
} else { } else {
$myaddr = $a->user['nickname'] . '@' . substr(System::baseUrl(), strpos(System::baseUrl(), '://') + 3); $myaddr = $a->user['nickname'] . '@' . substr(DI::baseUrl(), strpos(DI::baseUrl(), '://') + 3);
} }
} else { } else {
// last, try a zrl // last, try a zrl
$myaddr = Profile::getMyURL(); $myaddr = Profile::getMyURL();
} }
$target_addr = $a->profile['nickname'] . '@' . substr(System::baseUrl(), strpos(System::baseUrl(), '://') + 3); $target_addr = $a->profile['nickname'] . '@' . substr(DI::baseUrl(), strpos(DI::baseUrl(), '://') + 3);
/* The auto_request form only has the profile address /* The auto_request form only has the profile address
* because nobody is going to read the comments and * because nobody is going to read the comments and

View file

@ -13,12 +13,10 @@ use Friendica\Core\L10n;
use Friendica\Core\Logger; use Friendica\Core\Logger;
use Friendica\Core\Protocol; use Friendica\Core\Protocol;
use Friendica\Core\Renderer; use Friendica\Core\Renderer;
use Friendica\Core\System;
use Friendica\Core\Session; use Friendica\Core\Session;
use Friendica\Database\DBA; use Friendica\Database\DBA;
use Friendica\DI; use Friendica\DI;
use Friendica\Model\Contact; use Friendica\Model\Contact;
use Friendica\Model\Group;
use Friendica\Model\Item; use Friendica\Model\Item;
use Friendica\Model\Profile; use Friendica\Model\Profile;
use Friendica\Module\Objects; use Friendica\Module\Objects;
@ -100,8 +98,8 @@ function display_init(App $a)
$profiledata = display_fetchauthor($a, $item); $profiledata = display_fetchauthor($a, $item);
if (strstr(Strings::normaliseLink($profiledata["url"]), Strings::normaliseLink(System::baseUrl()))) { if (strstr(Strings::normaliseLink($profiledata["url"]), Strings::normaliseLink(DI::baseUrl()))) {
$nickname = str_replace(Strings::normaliseLink(System::baseUrl())."/profile/", "", Strings::normaliseLink($profiledata["url"])); $nickname = str_replace(Strings::normaliseLink(DI::baseUrl())."/profile/", "", Strings::normaliseLink($profiledata["url"]));
if ($nickname != $a->user["nickname"]) { if ($nickname != $a->user["nickname"]) {
$profile = DBA::fetchFirst("SELECT `profile`.`uid` AS `profile_uid`, `profile`.* , `contact`.`avatar-date` AS picdate, `user`.* FROM `profile` $profile = DBA::fetchFirst("SELECT `profile`.`uid` AS `profile_uid`, `profile`.* , `contact`.`avatar-date` AS picdate, `user`.* FROM `profile`
@ -159,7 +157,7 @@ function display_fetchauthor($a, $item)
$profiledata = Contact::getDetailsByURL($profiledata["url"], local_user(), $profiledata); $profiledata = Contact::getDetailsByURL($profiledata["url"], local_user(), $profiledata);
if (!empty($profiledata["photo"])) { if (!empty($profiledata["photo"])) {
$profiledata["photo"] = System::removedBaseUrl($profiledata["photo"]); $profiledata["photo"] = DI::baseUrl()->remove($profiledata["photo"]);
} }
return $profiledata; return $profiledata;
@ -232,8 +230,8 @@ function display_content(App $a, $update = false, $update_uid = 0)
$is_public = Item::exists(['id' => $item_id, 'private' => [0, 2]]); $is_public = Item::exists(['id' => $item_id, 'private' => [0, 2]]);
if ($is_public) { if ($is_public) {
// For the atom feed the nickname doesn't matter at all, we only need the item id. // For the atom feed the nickname doesn't matter at all, we only need the item id.
$alternate = System::baseUrl().'/display/feed-item/'.$item_id.'.atom'; $alternate = DI::baseUrl().'/display/feed-item/'.$item_id.'.atom';
$conversation = System::baseUrl().'/display/feed-item/'.$item_parent.'/conversation.atom'; $conversation = DI::baseUrl().'/display/feed-item/'.$item_parent.'/conversation.atom';
} else { } else {
$alternate = ''; $alternate = '';
$conversation = ''; $conversation = '';
@ -363,7 +361,7 @@ function display_content(App $a, $update = false, $update_uid = 0)
$page['htmlhead'] .= '<meta name="twitter:card" content="summary" />'."\n"; $page['htmlhead'] .= '<meta name="twitter:card" content="summary" />'."\n";
$page['htmlhead'] .= '<meta name="twitter:title" content="'.$title.'" />'."\n"; $page['htmlhead'] .= '<meta name="twitter:title" content="'.$title.'" />'."\n";
$page['htmlhead'] .= '<meta name="twitter:description" content="'.$description.'" />'."\n"; $page['htmlhead'] .= '<meta name="twitter:description" content="'.$description.'" />'."\n";
$page['htmlhead'] .= '<meta name="twitter:image" content="'.System::baseUrl().'/'.$image.'" />'."\n"; $page['htmlhead'] .= '<meta name="twitter:image" content="'.DI::baseUrl().'/'.$image.'" />'."\n";
$page['htmlhead'] .= '<meta name="twitter:url" content="'.$item["plink"].'" />'."\n"; $page['htmlhead'] .= '<meta name="twitter:url" content="'.$item["plink"].'" />'."\n";
// Dublin Core // Dublin Core
@ -373,7 +371,7 @@ function display_content(App $a, $update = false, $update_uid = 0)
// Open Graph // Open Graph
$page['htmlhead'] .= '<meta property="og:type" content="website" />'."\n"; $page['htmlhead'] .= '<meta property="og:type" content="website" />'."\n";
$page['htmlhead'] .= '<meta property="og:title" content="'.$title.'" />'."\n"; $page['htmlhead'] .= '<meta property="og:title" content="'.$title.'" />'."\n";
$page['htmlhead'] .= '<meta property="og:image" content="'.System::baseUrl().'/'.$image.'" />'."\n"; $page['htmlhead'] .= '<meta property="og:image" content="'.DI::baseUrl().'/'.$image.'" />'."\n";
$page['htmlhead'] .= '<meta property="og:url" content="'.$item["plink"].'" />'."\n"; $page['htmlhead'] .= '<meta property="og:url" content="'.$item["plink"].'" />'."\n";
$page['htmlhead'] .= '<meta property="og:description" content="'.$description.'" />'."\n"; $page['htmlhead'] .= '<meta property="og:description" content="'.$description.'" />'."\n";
$page['htmlhead'] .= '<meta name="og:article:author" content="'.$author_name.'" />'."\n"; $page['htmlhead'] .= '<meta name="og:article:author" content="'.$author_name.'" />'."\n";

View file

@ -11,7 +11,6 @@ use Friendica\Core\ACL;
use Friendica\Core\L10n; use Friendica\Core\L10n;
use Friendica\Core\Logger; use Friendica\Core\Logger;
use Friendica\Core\Renderer; use Friendica\Core\Renderer;
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;
@ -348,7 +347,7 @@ function events_content(App $a)
foreach ($r as $rr) { foreach ($r as $rr) {
$j = $rr['adjust'] ? DateTimeFormat::local($rr['start'], 'j') : DateTimeFormat::utc($rr['start'], 'j'); $j = $rr['adjust'] ? DateTimeFormat::local($rr['start'], 'j') : DateTimeFormat::utc($rr['start'], 'j');
if (empty($links[$j])) { if (empty($links[$j])) {
$links[$j] = System::baseUrl() . '/' . DI::args()->getCommand() . '#link-' . $j; $links[$j] = DI::baseUrl() . '/' . DI::args()->getCommand() . '#link-' . $j;
} }
} }
} }
@ -393,9 +392,9 @@ function events_content(App $a)
'$tabs' => $tabs, '$tabs' => $tabs,
'$title' => L10n::t('Events'), '$title' => L10n::t('Events'),
'$view' => L10n::t('View'), '$view' => L10n::t('View'),
'$new_event' => [System::baseUrl() . '/events/new', L10n::t('Create New Event'), '', ''], '$new_event' => [DI::baseUrl() . '/events/new', L10n::t('Create New Event'), '', ''],
'$previous' => [System::baseUrl() . '/events/$prevyear/$prevmonth', L10n::t('Previous'), '', ''], '$previous' => [DI::baseUrl() . '/events/$prevyear/$prevmonth', L10n::t('Previous'), '', ''],
'$next' => [System::baseUrl() . '/events/$nextyear/$nextmonth', L10n::t('Next'), '', ''], '$next' => [DI::baseUrl() . '/events/$nextyear/$nextmonth', L10n::t('Next'), '', ''],
'$calendar' => Temporal::getCalendarTable($y, $m, $links, ' eventcal'), '$calendar' => Temporal::getCalendarTable($y, $m, $links, ' eventcal'),
'$events' => $events, '$events' => $events,
@ -504,7 +503,7 @@ function events_content(App $a)
$tpl = Renderer::getMarkupTemplate('event_form.tpl'); $tpl = Renderer::getMarkupTemplate('event_form.tpl');
$o .= Renderer::replaceMacros($tpl, [ $o .= Renderer::replaceMacros($tpl, [
'$post' => System::baseUrl() . '/events', '$post' => DI::baseUrl() . '/events',
'$eid' => $eid, '$eid' => $eid,
'$cid' => $cid, '$cid' => $cid,
'$uri' => $uri, '$uri' => $uri,

View file

@ -8,7 +8,6 @@
use Friendica\App; use Friendica\App;
use Friendica\Core\L10n; use Friendica\Core\L10n;
use Friendica\Core\Renderer; use Friendica\Core\Renderer;
use Friendica\Core\System;
use Friendica\Database\DBA; use Friendica\Database\DBA;
use Friendica\Util\Images; use Friendica\Util\Images;
use Friendica\Util\Strings; use Friendica\Util\Strings;
@ -93,9 +92,9 @@ function fbrowser_content(App $a)
} }
return [ return [
System::baseUrl() . '/photos/' . $a->user['nickname'] . '/image/' . $rr['resource-id'], DI::baseUrl() . '/photos/' . $a->user['nickname'] . '/image/' . $rr['resource-id'],
$filename_e, $filename_e,
System::baseUrl() . '/photo/' . $rr['resource-id'] . '-' . $scale . '.'. $ext DI::baseUrl() . '/photo/' . $rr['resource-id'] . '-' . $scale . '.'. $ext
]; ];
} }
$files = array_map("_map_files1", $r); $files = array_map("_map_files1", $r);
@ -125,7 +124,7 @@ function fbrowser_content(App $a)
$filetype = ( (file_exists("images/icons/$m1.png"))?$m1:"zip"); $filetype = ( (file_exists("images/icons/$m1.png"))?$m1:"zip");
$filename_e = $rr['filename']; $filename_e = $rr['filename'];
return [System::baseUrl() . '/attach/' . $rr['id'], $filename_e, System::baseUrl() . '/images/icons/16/' . $filetype . '.png']; return [DI::baseUrl() . '/attach/' . $rr['id'], $filename_e, DI::baseUrl() . '/images/icons/16/' . $filetype . '.png'];
} }
$files = array_map("_map_files2", $files); $files = array_map("_map_files2", $files);

View file

@ -125,7 +125,7 @@ function follow_content(App $a)
$request = $ret['request']; $request = $ret['request'];
$tpl = Renderer::getMarkupTemplate('dfrn_request.tpl'); $tpl = Renderer::getMarkupTemplate('dfrn_request.tpl');
} else { } else {
$request = System::baseUrl() . '/follow'; $request = DI::baseUrl() . '/follow';
$tpl = Renderer::getMarkupTemplate('auto_request.tpl'); $tpl = Renderer::getMarkupTemplate('auto_request.tpl');
} }

View file

@ -81,7 +81,7 @@ function item_post(App $a) {
if (!$preview && !empty($_REQUEST['post_id_random'])) { if (!$preview && !empty($_REQUEST['post_id_random'])) {
if (!empty($_SESSION['post-random']) && $_SESSION['post-random'] == $_REQUEST['post_id_random']) { if (!empty($_SESSION['post-random']) && $_SESSION['post-random'] == $_REQUEST['post_id_random']) {
Logger::log("item post: duplicate post", Logger::DEBUG); Logger::log("item post: duplicate post", Logger::DEBUG);
item_post_return(System::baseUrl(), $api_source, $return_path); item_post_return(DI::baseUrl(), $api_source, $return_path);
} else { } else {
$_SESSION['post-random'] = $_REQUEST['post_id_random']; $_SESSION['post-random'] = $_REQUEST['post_id_random'];
} }
@ -537,7 +537,7 @@ function item_post(App $a) {
if (strlen($attachments)) { if (strlen($attachments)) {
$attachments .= ','; $attachments .= ',';
} }
$attachments .= '[attach]href="' . System::baseUrl() . '/attach/' . $attachment['id'] . $attachments .= '[attach]href="' . DI::baseUrl() . '/attach/' . $attachment['id'] .
'" length="' . $attachment['filesize'] . '" type="' . $attachment['filetype'] . '" length="' . $attachment['filesize'] . '" type="' . $attachment['filetype'] .
'" title="' . ($attachment['filename'] ? $attachment['filename'] : '') . '"[/attach]'; '" title="' . ($attachment['filename'] ? $attachment['filename'] : '') . '"[/attach]';
} }
@ -683,7 +683,7 @@ function item_post(App $a) {
$json = ['cancel' => 1]; $json = ['cancel' => 1];
if (!empty($_REQUEST['jsreload'])) { if (!empty($_REQUEST['jsreload'])) {
$json['reload'] = System::baseUrl() . '/' . $_REQUEST['jsreload']; $json['reload'] = DI::baseUrl() . '/' . $_REQUEST['jsreload'];
} }
echo json_encode($json); echo json_encode($json);
@ -757,7 +757,7 @@ function item_post(App $a) {
'to_email' => $user['email'], 'to_email' => $user['email'],
'uid' => $user['uid'], 'uid' => $user['uid'],
'item' => $datarray, 'item' => $datarray,
'link' => System::baseUrl().'/display/'.urlencode($datarray['guid']), 'link' => DI::baseUrl().'/display/'.urlencode($datarray['guid']),
'source_name' => $datarray['author-name'], 'source_name' => $datarray['author-name'],
'source_link' => $datarray['author-link'], 'source_link' => $datarray['author-link'],
'source_photo' => $datarray['author-avatar'], 'source_photo' => $datarray['author-avatar'],
@ -777,7 +777,7 @@ function item_post(App $a) {
'to_email' => $user['email'], 'to_email' => $user['email'],
'uid' => $user['uid'], 'uid' => $user['uid'],
'item' => $datarray, 'item' => $datarray,
'link' => System::baseUrl().'/display/'.urlencode($datarray['guid']), 'link' => DI::baseUrl().'/display/'.urlencode($datarray['guid']),
'source_name' => $datarray['author-name'], 'source_name' => $datarray['author-name'],
'source_link' => $datarray['author-link'], 'source_link' => $datarray['author-link'],
'source_photo' => $datarray['author-avatar'], 'source_photo' => $datarray['author-avatar'],
@ -799,14 +799,14 @@ function item_post(App $a) {
} }
$disclaimer = '<hr />' . L10n::t('This message was sent to you by %s, a member of the Friendica social network.', $a->user['username']) $disclaimer = '<hr />' . L10n::t('This message was sent to you by %s, a member of the Friendica social network.', $a->user['username'])
. '<br />'; . '<br />';
$disclaimer .= L10n::t('You may visit them online at %s', System::baseUrl() . '/profile/' . $a->user['nickname']) . EOL; $disclaimer .= L10n::t('You may visit them online at %s', DI::baseUrl() . '/profile/' . $a->user['nickname']) . EOL;
$disclaimer .= L10n::t('Please contact the sender by replying to this post if you do not wish to receive these messages.') . EOL; $disclaimer .= L10n::t('Please contact the sender by replying to this post if you do not wish to receive these messages.') . EOL;
if (!$datarray['title']=='') { if (!$datarray['title']=='') {
$subject = Email::encodeHeader($datarray['title'], 'UTF-8'); $subject = Email::encodeHeader($datarray['title'], 'UTF-8');
} else { } else {
$subject = Email::encodeHeader('[Friendica]' . ' ' . L10n::t('%s posted an update.', $a->user['username']), 'UTF-8'); $subject = Email::encodeHeader('[Friendica]' . ' ' . L10n::t('%s posted an update.', $a->user['username']), 'UTF-8');
} }
$link = '<a href="' . System::baseUrl() . '/profile/' . $a->user['nickname'] . '"><img src="' . $author['thumb'] . '" alt="' . $a->user['username'] . '" /></a><br /><br />'; $link = '<a href="' . DI::baseUrl() . '/profile/' . $a->user['nickname'] . '"><img src="' . $author['thumb'] . '" alt="' . $a->user['username'] . '" /></a><br /><br />';
$html = Item::prepareBody($datarray); $html = Item::prepareBody($datarray);
$message = '<html><body>' . $link . $html . $disclaimer . '</body></html>'; $message = '<html><body>' . $link . $html . $disclaimer . '</body></html>';
$params = [ $params = [
@ -841,7 +841,7 @@ function item_post(App $a) {
return $post_id; return $post_id;
} }
item_post_return(System::baseUrl(), $api_source, $return_path); item_post_return(DI::baseUrl(), $api_source, $return_path);
// NOTREACHED // NOTREACHED
} }

View file

@ -8,7 +8,6 @@ use Friendica\App;
use Friendica\Core\Config; use Friendica\Core\Config;
use Friendica\Core\L10n; use Friendica\Core\L10n;
use Friendica\Core\Renderer; use Friendica\Core\Renderer;
use Friendica\Core\System;
use Friendica\Database\DBA; use Friendica\Database\DBA;
use Friendica\DI; use Friendica\DI;
use Friendica\Model\User; use Friendica\Model\User;
@ -41,7 +40,7 @@ function lostpass_post(App $a)
} }
$sitename = Config::get('config', 'sitename'); $sitename = Config::get('config', 'sitename');
$resetlink = System::baseUrl() . '/lostpass/' . $pwdreset_token; $resetlink = DI::baseUrl() . '/lostpass/' . $pwdreset_token;
$preamble = Strings::deindent(L10n::t(' $preamble = Strings::deindent(L10n::t('
Dear %1$s, Dear %1$s,
@ -65,7 +64,7 @@ function lostpass_post(App $a)
The login details are as follows: The login details are as follows:
Site Location: %2$s Site Location: %2$s
Login Name: %3$s', $resetlink, System::baseUrl(), $user['nickname'])); Login Name: %3$s', $resetlink, DI::baseUrl(), $user['nickname']));
notification([ notification([
'type' => SYSTEM_EMAIL, 'type' => SYSTEM_EMAIL,
@ -138,7 +137,7 @@ function lostpass_generate_password($user)
'$lbl2' => L10n::t('Your password has been reset as requested.'), '$lbl2' => L10n::t('Your password has been reset as requested.'),
'$lbl3' => L10n::t('Your new password is'), '$lbl3' => L10n::t('Your new password is'),
'$lbl4' => L10n::t('Save or copy your new password - and then'), '$lbl4' => L10n::t('Save or copy your new password - and then'),
'$lbl5' => '<a href="' . System::baseUrl() . '">' . L10n::t('click here to login') . '</a>.', '$lbl5' => '<a href="' . DI::baseUrl() . '">' . L10n::t('click here to login') . '</a>.',
'$lbl6' => L10n::t('Your password may be changed from the <em>Settings</em> page after successful login.'), '$lbl6' => L10n::t('Your password may be changed from the <em>Settings</em> page after successful login.'),
'$newpass' => $new_password, '$newpass' => $new_password,
]); ]);
@ -160,7 +159,7 @@ function lostpass_generate_password($user)
Password: %3$s Password: %3$s
You may change that password from your account settings page after logging in. You may change that password from your account settings page after logging in.
', System::baseUrl(), $user['nickname'], $new_password)); ', DI::baseUrl(), $user['nickname'], $new_password));
notification([ notification([
'type' => SYSTEM_EMAIL, 'type' => SYSTEM_EMAIL,

View file

@ -4,12 +4,10 @@
*/ */
use Friendica\App; use Friendica\App;
use Friendica\Content\Pager;
use Friendica\Content\Widget; use Friendica\Content\Widget;
use Friendica\Core\Config; use Friendica\Core\Config;
use Friendica\Core\L10n; use Friendica\Core\L10n;
use Friendica\Core\Renderer; use Friendica\Core\Renderer;
use Friendica\Core\System;
use Friendica\Database\DBA; use Friendica\Database\DBA;
use Friendica\DI; use Friendica\DI;
use Friendica\Model\Contact; use Friendica\Model\Contact;
@ -60,7 +58,7 @@ function match_content(App $a)
if (strlen(Config::get('system', 'directory'))) { if (strlen(Config::get('system', 'directory'))) {
$host = get_server(); $host = get_server();
} else { } else {
$host = System::baseUrl(); $host = DI::baseUrl();
} }
$msearch_json = Network::post($host . '/msearch', $params)->getBody(); $msearch_json = Network::post($host . '/msearch', $params)->getBody();
@ -83,7 +81,7 @@ function match_content(App $a)
// Workaround for wrong directory photo URL // Workaround for wrong directory photo URL
$profile->photo = str_replace('http:///photo/', get_server() . '/photo/', $profile->photo); $profile->photo = str_replace('http:///photo/', get_server() . '/photo/', $profile->photo);
$connlnk = System::baseUrl() . '/follow/?url=' . $profile->url; $connlnk = DI::baseUrl() . '/follow/?url=' . $profile->url;
$photo_menu = [ $photo_menu = [
'profile' => [L10n::t("View Profile"), Contact::magicLink($profile->url)], 'profile' => [L10n::t("View Profile"), Contact::magicLink($profile->url)],
'follow' => [L10n::t("Connect/Follow"), $connlnk] 'follow' => [L10n::t("Connect/Follow"), $connlnk]

View file

@ -6,12 +6,10 @@
use Friendica\App; use Friendica\App;
use Friendica\Content\Nav; use Friendica\Content\Nav;
use Friendica\Content\Pager; use Friendica\Content\Pager;
use Friendica\Content\Smilies;
use Friendica\Content\Text\BBCode; use Friendica\Content\Text\BBCode;
use Friendica\Core\ACL; use Friendica\Core\ACL;
use Friendica\Core\L10n; use Friendica\Core\L10n;
use Friendica\Core\Renderer; use Friendica\Core\Renderer;
use Friendica\Core\System;
use Friendica\Database\DBA; use Friendica\Database\DBA;
use Friendica\DI; use Friendica\DI;
use Friendica\Model\Contact; use Friendica\Model\Contact;
@ -42,11 +40,11 @@ function message_init(App $a)
'$tabs' => $tabs, '$tabs' => $tabs,
'$new' => $new, '$new' => $new,
]); ]);
$base = System::baseUrl(); $base = DI::baseUrl();
$head_tpl = Renderer::getMarkupTemplate('message-head.tpl'); $head_tpl = Renderer::getMarkupTemplate('message-head.tpl');
DI::page()['htmlhead'] .= Renderer::replaceMacros($head_tpl, [ DI::page()['htmlhead'] .= Renderer::replaceMacros($head_tpl, [
'$baseurl' => System::baseUrl(true), '$baseurl' => DI::baseUrl()->get(true),
'$base' => $base '$base' => $base
]); ]);
} }
@ -103,7 +101,7 @@ function message_content(App $a)
return Login::form(); return Login::form();
} }
$myprofile = System::baseUrl() . '/profile/' . $a->user['nickname']; $myprofile = DI::baseUrl() . '/profile/' . $a->user['nickname'];
$tpl = Renderer::getMarkupTemplate('mail_head.tpl'); $tpl = Renderer::getMarkupTemplate('mail_head.tpl');
if ($a->argc > 1 && $a->argv[1] == 'new') { if ($a->argc > 1 && $a->argv[1] == 'new') {
@ -200,7 +198,7 @@ function message_content(App $a)
$tpl = Renderer::getMarkupTemplate('msg-header.tpl'); $tpl = Renderer::getMarkupTemplate('msg-header.tpl');
DI::page()['htmlhead'] .= Renderer::replaceMacros($tpl, [ DI::page()['htmlhead'] .= Renderer::replaceMacros($tpl, [
'$baseurl' => System::baseUrl(true), '$baseurl' => DI::baseUrl()->get(true),
'$nickname' => $a->user['nickname'], '$nickname' => $a->user['nickname'],
'$linkurl' => L10n::t('Please enter a link URL:') '$linkurl' => L10n::t('Please enter a link URL:')
]); ]);
@ -356,7 +354,7 @@ function message_content(App $a)
$tpl = Renderer::getMarkupTemplate('msg-header.tpl'); $tpl = Renderer::getMarkupTemplate('msg-header.tpl');
DI::page()['htmlhead'] .= Renderer::replaceMacros($tpl, [ DI::page()['htmlhead'] .= Renderer::replaceMacros($tpl, [
'$baseurl' => System::baseUrl(true), '$baseurl' => DI::baseUrl()->get(true),
'$nickname' => $a->user['nickname'], '$nickname' => $a->user['nickname'],
'$linkurl' => L10n::t('Please enter a link URL:') '$linkurl' => L10n::t('Please enter a link URL:')
]); ]);
@ -506,7 +504,7 @@ function render_messages(array $msg, $t)
$tpl = Renderer::getMarkupTemplate($t); $tpl = Renderer::getMarkupTemplate($t);
$rslt = ''; $rslt = '';
$myprofile = System::baseUrl() . '/profile/' . $a->user['nickname']; $myprofile = DI::baseUrl() . '/profile/' . $a->user['nickname'];
foreach ($msg as $rr) { foreach ($msg as $rr) {
if ($rr['unknown']) { if ($rr['unknown']) {

View file

@ -1,8 +1,8 @@
<?php <?php
use Friendica\App; use Friendica\App;
use Friendica\Core\System;
use Friendica\Database\DBA; use Friendica\Database\DBA;
use Friendica\DI;
function msearch_post(App $a) function msearch_post(App $a)
{ {
@ -54,8 +54,8 @@ function msearch_post(App $a)
while($search_result = DBA::fetch($search_stmt)) { while($search_result = DBA::fetch($search_stmt)) {
$results[] = [ $results[] = [
'name' => $search_result['name'], 'name' => $search_result['name'],
'url' => System::baseUrl() . '/profile/' . $search_result['nickname'], 'url' => DI::baseUrl() . '/profile/' . $search_result['nickname'],
'photo' => System::baseUrl() . '/photo/avatar/' . $search_result['uid'] . '.jpg', 'photo' => DI::baseUrl() . '/photo/avatar/' . $search_result['uid'] . '.jpg',
'tags' => str_replace([',', ' '], [' ', ' '], $search_result['pub_keywords']) 'tags' => str_replace([',', ' '], [' ', ' '], $search_result['pub_keywords'])
]; ];
} }

View file

@ -5,9 +5,8 @@
use Friendica\App; use Friendica\App;
use Friendica\Core\Protocol; use Friendica\Core\Protocol;
use Friendica\Core\System;
use Friendica\Database\DBA; use Friendica\Database\DBA;
use Friendica\Model\Contact; use Friendica\DI;
use Friendica\Model\Profile; use Friendica\Model\Profile;
use Friendica\Model\User; use Friendica\Model\User;
@ -32,14 +31,14 @@ function noscrape_init(App $a)
'nick' => $which, 'nick' => $which,
'guid' => $a->profile['guid'], 'guid' => $a->profile['guid'],
'key' => $a->profile['pubkey'], 'key' => $a->profile['pubkey'],
'homepage' => System::baseUrl()."/profile/{$which}", 'homepage' => DI::baseUrl()."/profile/{$which}",
'comm' => ($a->profile['account-type'] == User::ACCOUNT_TYPE_COMMUNITY), 'comm' => ($a->profile['account-type'] == User::ACCOUNT_TYPE_COMMUNITY),
'account-type' => $a->profile['account-type'], 'account-type' => $a->profile['account-type'],
]; ];
$dfrn_pages = ['request', 'confirm', 'notify', 'poll']; $dfrn_pages = ['request', 'confirm', 'notify', 'poll'];
foreach ($dfrn_pages as $dfrn) { foreach ($dfrn_pages as $dfrn) {
$json_info["dfrn-{$dfrn}"] = System::baseUrl()."/dfrn_{$dfrn}/{$which}"; $json_info["dfrn-{$dfrn}"] = DI::baseUrl()."/dfrn_{$dfrn}/{$which}";
} }
if (!$a->profile['net-publish'] || $a->profile['hidewall']) { if (!$a->profile['net-publish'] || $a->profile['hidewall']) {

View file

@ -5,7 +5,7 @@
use Friendica\App; use Friendica\App;
use Friendica\Core\L10n; use Friendica\Core\L10n;
use Friendica\Core\Renderer; use Friendica\Core\Renderer;
use Friendica\Core\System; use Friendica\DI;
use Friendica\Module\Security\Login; use Friendica\Module\Security\Login;
use Friendica\Util\Network; use Friendica\Util\Network;
use Friendica\Util\Strings; use Friendica\Util\Strings;
@ -15,7 +15,7 @@ function oexchange_init(App $a) {
if (($a->argc > 1) && ($a->argv[1] === 'xrd')) { if (($a->argc > 1) && ($a->argv[1] === 'xrd')) {
$tpl = Renderer::getMarkupTemplate('oexchange_xrd.tpl'); $tpl = Renderer::getMarkupTemplate('oexchange_xrd.tpl');
$o = Renderer::replaceMacros($tpl, ['$base' => System::baseUrl()]); $o = Renderer::replaceMacros($tpl, ['$base' => DI::baseUrl()]);
echo $o; echo $o;
exit(); exit();
} }
@ -42,7 +42,7 @@ function oexchange_content(App $a) {
$tags = ((!empty($_REQUEST['tags'])) $tags = ((!empty($_REQUEST['tags']))
? '&tags=' . urlencode(Strings::escapeTags(trim($_REQUEST['tags']))) : ''); ? '&tags=' . urlencode(Strings::escapeTags(trim($_REQUEST['tags']))) : '');
$s = Network::fetchUrl(System::baseUrl() . '/parse_url?f=&url=' . $url . $title . $description . $tags); $s = Network::fetchUrl(DI::baseUrl() . '/parse_url?f=&url=' . $url . $title . $description . $tags);
if (!strlen($s)) { if (!strlen($s)) {
return; return;

View file

@ -7,7 +7,6 @@ use Friendica\App;
use Friendica\Core\L10n; use Friendica\Core\L10n;
use Friendica\Core\PConfig; use Friendica\Core\PConfig;
use Friendica\Core\Protocol; use Friendica\Core\Protocol;
use Friendica\Core\System;
use Friendica\DI; use Friendica\DI;
use Friendica\Model\Contact; use Friendica\Model\Contact;
use Friendica\Network\Probe; use Friendica\Network\Probe;
@ -63,7 +62,7 @@ function ostatus_subscribe_content(App $a)
$total = sizeof($friends); $total = sizeof($friends);
if ($counter >= $total) { if ($counter >= $total) {
DI::page()['htmlhead'] = '<meta http-equiv="refresh" content="0; URL=' . System::baseUrl() . '/settings/connectors">'; DI::page()['htmlhead'] = '<meta http-equiv="refresh" content="0; URL=' . DI::baseUrl() . '/settings/connectors">';
PConfig::delete($uid, 'ostatus', 'legacy_friends'); PConfig::delete($uid, 'ostatus', 'legacy_friends');
PConfig::delete($uid, 'ostatus', 'legacy_contact'); PConfig::delete($uid, 'ostatus', 'legacy_contact');
$o .= L10n::t('Done'); $o .= L10n::t('Done');
@ -92,7 +91,7 @@ function ostatus_subscribe_content(App $a)
$o .= '<p>' . L10n::t('Keep this window open until done.') . '</p>'; $o .= '<p>' . L10n::t('Keep this window open until done.') . '</p>';
DI::page()['htmlhead'] = '<meta http-equiv="refresh" content="0; URL=' . System::baseUrl() . '/ostatus_subscribe?counter=' . $counter . '">'; DI::page()['htmlhead'] = '<meta http-equiv="refresh" content="0; URL=' . DI::baseUrl() . '/ostatus_subscribe?counter=' . $counter . '">';
return $o; return $o;
} }

View file

@ -398,8 +398,8 @@ function photos_post(App $a)
$arr['visible'] = $visibility; $arr['visible'] = $visibility;
$arr['origin'] = 1; $arr['origin'] = 1;
$arr['body'] = '[url=' . System::baseUrl() . '/photos/' . $a->data['user']['nickname'] . '/image/' . $photo['resource-id'] . ']' $arr['body'] = '[url=' . DI::baseUrl() . '/photos/' . $a->data['user']['nickname'] . '/image/' . $photo['resource-id'] . ']'
. '[img]' . System::baseUrl() . '/photo/' . $photo['resource-id'] . '-' . $photo['scale'] . '.'. $ext . '[/img]' . '[img]' . DI::baseUrl() . '/photo/' . $photo['resource-id'] . '-' . $photo['scale'] . '.'. $ext . '[/img]'
. '[/url]'; . '[/url]';
$item_id = Item::insert($arr); $item_id = Item::insert($arr);
@ -509,7 +509,7 @@ function photos_post(App $a)
} }
} elseif (strpos($tag, '#') === 0) { } elseif (strpos($tag, '#') === 0) {
$tagname = substr($tag, 1); $tagname = substr($tag, 1);
$str_tags .= '#[url=' . System::baseUrl() . "/search?tag=" . $tagname . ']' . $tagname . '[/url],'; $str_tags .= '#[url=' . DI::baseUrl() . "/search?tag=" . $tagname . ']' . $tagname . '[/url],';
} }
} }
} }
@ -573,8 +573,8 @@ function photos_post(App $a)
$arr['tag'] = $tagged[4]; $arr['tag'] = $tagged[4];
$arr['inform'] = $tagged[2]; $arr['inform'] = $tagged[2];
$arr['origin'] = 1; $arr['origin'] = 1;
$arr['body'] = L10n::t('%1$s was tagged in %2$s by %3$s', '[url=' . $tagged[1] . ']' . $tagged[0] . '[/url]', '[url=' . System::baseUrl() . '/photos/' . $owner_record['nickname'] . '/image/' . $photo['resource-id'] . ']' . L10n::t('a photo') . '[/url]', '[url=' . $owner_record['url'] . ']' . $owner_record['name'] . '[/url]') ; $arr['body'] = L10n::t('%1$s was tagged in %2$s by %3$s', '[url=' . $tagged[1] . ']' . $tagged[0] . '[/url]', '[url=' . DI::baseUrl() . '/photos/' . $owner_record['nickname'] . '/image/' . $photo['resource-id'] . ']' . L10n::t('a photo') . '[/url]', '[url=' . $owner_record['url'] . ']' . $owner_record['name'] . '[/url]') ;
$arr['body'] .= "\n\n" . '[url=' . System::baseUrl() . '/photos/' . $owner_record['nickname'] . '/image/' . $photo['resource-id'] . ']' . '[img]' . System::baseUrl() . "/photo/" . $photo['resource-id'] . '-' . $best . '.' . $ext . '[/img][/url]' . "\n" ; $arr['body'] .= "\n\n" . '[url=' . DI::baseUrl() . '/photos/' . $owner_record['nickname'] . '/image/' . $photo['resource-id'] . ']' . '[img]' . DI::baseUrl() . "/photo/" . $photo['resource-id'] . '-' . $best . '.' . $ext . '[/img][/url]' . "\n" ;
$arr['object'] = '<object><type>' . Activity\ObjectType::PERSON . '</type><title>' . $tagged[0] . '</title><id>' . $tagged[1] . '/' . $tagged[0] . '</id>'; $arr['object'] = '<object><type>' . Activity\ObjectType::PERSON . '</type><title>' . $tagged[0] . '</title><id>' . $tagged[1] . '/' . $tagged[0] . '</id>';
$arr['object'] .= '<link>' . XML::escape('<link rel="alternate" type="text/html" href="' . $tagged[1] . '" />' . "\n"); $arr['object'] .= '<link>' . XML::escape('<link rel="alternate" type="text/html" href="' . $tagged[1] . '" />' . "\n");
@ -584,8 +584,8 @@ function photos_post(App $a)
$arr['object'] .= '</link></object>' . "\n"; $arr['object'] .= '</link></object>' . "\n";
$arr['target'] = '<target><type>' . Activity\ObjectType::IMAGE . '</type><title>' . $photo['desc'] . '</title><id>' $arr['target'] = '<target><type>' . Activity\ObjectType::IMAGE . '</type><title>' . $photo['desc'] . '</title><id>'
. System::baseUrl() . '/photos/' . $owner_record['nickname'] . '/image/' . $photo['resource-id'] . '</id>'; . DI::baseUrl() . '/photos/' . $owner_record['nickname'] . '/image/' . $photo['resource-id'] . '</id>';
$arr['target'] .= '<link>' . XML::escape('<link rel="alternate" type="text/html" href="' . System::baseUrl() . '/photos/' . $owner_record['nickname'] . '/image/' . $photo['resource-id'] . '" />' . "\n" . '<link rel="preview" type="' . $photo['type'] . '" href="' . System::baseUrl() . "/photo/" . $photo['resource-id'] . '-' . $best . '.' . $ext . '" />') . '</link></target>'; $arr['target'] .= '<link>' . XML::escape('<link rel="alternate" type="text/html" href="' . DI::baseUrl() . '/photos/' . $owner_record['nickname'] . '/image/' . $photo['resource-id'] . '" />' . "\n" . '<link rel="preview" type="' . $photo['type'] . '" href="' . DI::baseUrl() . "/photo/" . $photo['resource-id'] . '-' . $best . '.' . $ext . '" />') . '</link></target>';
Item::insert($arr); Item::insert($arr);
} }
@ -804,8 +804,8 @@ function photos_post(App $a)
$arr['visible'] = $visible; $arr['visible'] = $visible;
$arr['origin'] = 1; $arr['origin'] = 1;
$arr['body'] = '[url=' . System::baseUrl() . '/photos/' . $owner_record['nickname'] . '/image/' . $resource_id . ']' $arr['body'] = '[url=' . DI::baseUrl() . '/photos/' . $owner_record['nickname'] . '/image/' . $resource_id . ']'
. '[img]' . System::baseUrl() . "/photo/{$resource_id}-{$smallest}.".$image->getExt() . '[/img]' . '[img]' . DI::baseUrl() . "/photo/{$resource_id}-{$smallest}.".$image->getExt() . '[/img]'
. '[/url]'; . '[/url]';
$item_id = Item::insert($arr); $item_id = Item::insert($arr);
@ -1529,7 +1529,7 @@ function photos_content(App $a)
DI::page()['htmlhead'] .= "\n" . '<meta name="twitter:card" content="summary_large_image" />' . "\n"; DI::page()['htmlhead'] .= "\n" . '<meta name="twitter:card" content="summary_large_image" />' . "\n";
DI::page()['htmlhead'] .= '<meta name="twitter:title" content="' . $photo["album"] . '" />' . "\n"; DI::page()['htmlhead'] .= '<meta name="twitter:title" content="' . $photo["album"] . '" />' . "\n";
DI::page()['htmlhead'] .= '<meta name="twitter:image" content="' . System::baseUrl() . "/" . $photo["href"] . '" />' . "\n"; DI::page()['htmlhead'] .= '<meta name="twitter:image" content="' . DI::baseUrl() . "/" . $photo["href"] . '" />' . "\n";
DI::page()['htmlhead'] .= '<meta name="twitter:image:width" content="' . $photo["width"] . '" />' . "\n"; DI::page()['htmlhead'] .= '<meta name="twitter:image:width" content="' . $photo["width"] . '" />' . "\n";
DI::page()['htmlhead'] .= '<meta name="twitter:image:height" content="' . $photo["height"] . '" />' . "\n"; DI::page()['htmlhead'] .= '<meta name="twitter:image:height" content="' . $photo["height"] . '" />' . "\n";

View file

@ -11,8 +11,8 @@ use Friendica\Core\Config;
use Friendica\Core\Hook; use Friendica\Core\Hook;
use Friendica\Core\L10n; use Friendica\Core\L10n;
use Friendica\Core\PConfig; use Friendica\Core\PConfig;
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\Group; use Friendica\Model\Group;
use Friendica\Model\Item; use Friendica\Model\Item;
@ -179,7 +179,7 @@ function ping_init(App $a)
$intro_count = count($intros1) + count($intros2); $intro_count = count($intros1) + count($intros2);
$intros = $intros1 + $intros2; $intros = $intros1 + $intros2;
$myurl = System::baseUrl() . '/profile/' . $a->user['nickname']; $myurl = DI::baseUrl() . '/profile/' . $a->user['nickname'];
$mails = q( $mails = q(
"SELECT `id`, `from-name`, `from-url`, `from-photo`, `created` FROM `mail` "SELECT `id`, `from-name`, `from-url`, `from-photo`, `created` FROM `mail`
WHERE `uid` = %d AND `seen` = 0 AND `from-url` != '%s' ", WHERE `uid` = %d AND `seen` = 0 AND `from-url` != '%s' ",
@ -263,7 +263,7 @@ function ping_init(App $a)
foreach ($intros as $intro) { foreach ($intros as $intro) {
$notif = [ $notif = [
'id' => 0, 'id' => 0,
'href' => System::baseUrl() . '/notifications/intros/' . $intro['id'], 'href' => DI::baseUrl() . '/notifications/intros/' . $intro['id'],
'name' => $intro['name'], 'name' => $intro['name'],
'url' => $intro['url'], 'url' => $intro['url'],
'photo' => $intro['photo'], 'photo' => $intro['photo'],
@ -279,7 +279,7 @@ function ping_init(App $a)
foreach ($regs as $reg) { foreach ($regs as $reg) {
$notif = [ $notif = [
'id' => 0, 'id' => 0,
'href' => System::baseUrl() . '/admin/users/', 'href' => DI::baseUrl() . '/admin/users/',
'name' => $reg['name'], 'name' => $reg['name'],
'url' => $reg['url'], 'url' => $reg['url'],
'photo' => $reg['micro'], 'photo' => $reg['micro'],
@ -446,7 +446,7 @@ function ping_get_notifications($uid)
); );
} }
$notification["href"] = System::baseUrl() . "/notify/view/" . $notification["id"]; $notification["href"] = DI::baseUrl() . "/notify/view/" . $notification["id"];
if ($notification["visible"] if ($notification["visible"]
&& !$notification["deleted"] && !$notification["deleted"]

View file

@ -158,7 +158,7 @@ function poke_content(App $a)
$head_tpl = Renderer::getMarkupTemplate('poke_head.tpl'); $head_tpl = Renderer::getMarkupTemplate('poke_head.tpl');
DI::page()['htmlhead'] .= Renderer::replaceMacros($head_tpl,[ DI::page()['htmlhead'] .= Renderer::replaceMacros($head_tpl,[
'$baseurl' => System::baseUrl(true), '$baseurl' => DI::baseUrl()->get(true),
]); ]);
$parent = (!empty($_GET['parent']) ? intval($_GET['parent']) : '0'); $parent = (!empty($_GET['parent']) ? intval($_GET['parent']) : '0');

View file

@ -8,7 +8,6 @@ use Friendica\BaseModule;
use Friendica\Core\Config; use Friendica\Core\Config;
use Friendica\Core\L10n; use Friendica\Core\L10n;
use Friendica\Core\Renderer; use Friendica\Core\Renderer;
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\DI;
@ -115,8 +114,8 @@ function profile_photo_post(App $a)
); );
} else { } else {
q("update profile set photo = '%s', thumb = '%s' where id = %d and uid = %d", q("update profile set photo = '%s', thumb = '%s' where id = %d and uid = %d",
DBA::escape(System::baseUrl() . '/photo/' . $base_image['resource-id'] . '-4.' . $Image->getExt()), DBA::escape(DI::baseUrl() . '/photo/' . $base_image['resource-id'] . '-4.' . $Image->getExt()),
DBA::escape(System::baseUrl() . '/photo/' . $base_image['resource-id'] . '-5.' . $Image->getExt()), DBA::escape(DI::baseUrl() . '/photo/' . $base_image['resource-id'] . '-5.' . $Image->getExt()),
intval($_REQUEST['profile']), intval(local_user()) intval($_REQUEST['profile']), intval(local_user())
); );
} }
@ -249,7 +248,7 @@ function profile_photo_content(App $a)
'$profiles' => $profiles, '$profiles' => $profiles,
'$form_security_token' => BaseModule::getFormSecurityToken("profile_photo"), '$form_security_token' => BaseModule::getFormSecurityToken("profile_photo"),
'$select' => sprintf('%s %s', L10n::t('or'), '$select' => sprintf('%s %s', L10n::t('or'),
($newuser) ? '<a href="' . System::baseUrl() . '">' . L10n::t('skip this step') . '</a>' : '<a href="' . System::baseUrl() . '/photos/' . $a->user['nickname'] . '">' . L10n::t('select a photo from your photo albums') . '</a>') ($newuser) ? '<a href="' . DI::baseUrl() . '">' . L10n::t('skip this step') . '</a>' : '<a href="' . DI::baseUrl() . '/photos/' . $a->user['nickname'] . '">' . L10n::t('select a photo from your photo albums') . '</a>')
]); ]);
return $o; return $o;
@ -261,7 +260,7 @@ function profile_photo_content(App $a)
'$filename' => $filename, '$filename' => $filename,
'$profile' => (isset($_REQUEST['profile']) ? intval($_REQUEST['profile']) : 0), '$profile' => (isset($_REQUEST['profile']) ? intval($_REQUEST['profile']) : 0),
'$resource' => $imagecrop['hash'] . '-' . $imagecrop['resolution'], '$resource' => $imagecrop['hash'] . '-' . $imagecrop['resolution'],
'$image_url' => System::baseUrl() . '/photo/' . $filename, '$image_url' => DI::baseUrl() . '/photo/' . $filename,
'$title' => L10n::t('Crop Image'), '$title' => L10n::t('Crop Image'),
'$desc' => L10n::t('Please adjust the image cropping for optimum viewing.'), '$desc' => L10n::t('Please adjust the image cropping for optimum viewing.'),
'$form_security_token' => BaseModule::getFormSecurityToken("profile_photo"), '$form_security_token' => BaseModule::getFormSecurityToken("profile_photo"),

View file

@ -13,7 +13,6 @@ use Friendica\Core\Hook;
use Friendica\Core\L10n; use Friendica\Core\L10n;
use Friendica\Core\PConfig; use Friendica\Core\PConfig;
use Friendica\Core\Renderer; use Friendica\Core\Renderer;
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\DI;
@ -514,7 +513,7 @@ function profiles_content(App $a) {
} }
DI::page()['htmlhead'] .= Renderer::replaceMacros(Renderer::getMarkupTemplate('profed_head.tpl'), [ DI::page()['htmlhead'] .= Renderer::replaceMacros(Renderer::getMarkupTemplate('profed_head.tpl'), [
'$baseurl' => System::baseUrl(true), '$baseurl' => DI::baseUrl()->get(true),
]); ]);
$opt_tpl = Renderer::getMarkupTemplate("profile-hide-friends.tpl"); $opt_tpl = Renderer::getMarkupTemplate("profile-hide-friends.tpl");
@ -588,7 +587,7 @@ function profiles_content(App $a) {
'$lbl_ex2' => L10n::t('Example: fishing photography software'), '$lbl_ex2' => L10n::t('Example: fishing photography software'),
'$disabled' => (($is_default) ? 'onclick="return false;" style="color: #BBBBFF;"' : ''), '$disabled' => (($is_default) ? 'onclick="return false;" style="color: #BBBBFF;"' : ''),
'$baseurl' => System::baseUrl(true), '$baseurl' => DI::baseUrl()->get(true),
'$profile_id' => $r[0]['id'], '$profile_id' => $r[0]['id'],
'$profile_name' => ['profile_name', L10n::t('Profile Name:'), $r[0]['profile-name'], L10n::t('Required'), '*'], '$profile_name' => ['profile_name', L10n::t('Profile Name:'), $r[0]['profile-name'], L10n::t('Required'), '*'],
'$is_default' => $is_default, '$is_default' => $is_default,

View file

@ -3,8 +3,8 @@
use Friendica\App; use Friendica\App;
use Friendica\Core\Config; use Friendica\Core\Config;
use Friendica\Core\Logger; use Friendica\Core\Logger;
use Friendica\Core\System;
use Friendica\Database\DBA; use Friendica\Database\DBA;
use Friendica\DI;
use Friendica\Model\PushSubscriber; use Friendica\Model\PushSubscriber;
use Friendica\Util\Network; use Friendica\Util\Network;
use Friendica\Util\Strings; use Friendica\Util\Strings;
@ -89,7 +89,7 @@ function pubsubhubbub_init(App $a) {
// sanity check that topic URLs are the same // sanity check that topic URLs are the same
$hub_topic2 = str_replace('/feed/', '/dfrn_poll/', $hub_topic); $hub_topic2 = str_replace('/feed/', '/dfrn_poll/', $hub_topic);
$self = System::baseUrl() . '/api/statuses/user_timeline/' . $owner['nickname'] . '.atom'; $self = DI::baseUrl() . '/api/statuses/user_timeline/' . $owner['nickname'] . '.atom';
if (!Strings::compareLink($hub_topic, $contact['poll']) && !Strings::compareLink($hub_topic2, $contact['poll']) && !Strings::compareLink($hub_topic, $self)) { if (!Strings::compareLink($hub_topic, $contact['poll']) && !Strings::compareLink($hub_topic2, $contact['poll']) && !Strings::compareLink($hub_topic, $self)) {
Logger::log('Hub topic ' . $hub_topic . ' != ' . $contact['poll']); Logger::log('Hub topic ' . $hub_topic . ' != ' . $contact['poll']);

View file

@ -149,7 +149,7 @@ function redir_magic($a, $cid, $url)
$basepath = Contact::getBasepath($contact_url); $basepath = Contact::getBasepath($contact_url);
// We don't use magic auth when there is no visitor, we are on the same system or we visit our own stuff // We don't use magic auth when there is no visitor, we are on the same system or we visit our own stuff
if (empty($visitor) || Strings::compareLink($basepath, System::baseUrl()) || Strings::compareLink($contact_url, $visitor)) { if (empty($visitor) || Strings::compareLink($basepath, DI::baseUrl()) || Strings::compareLink($contact_url, $visitor)) {
Logger::info('Redirecting without magic', ['target' => $target_url, 'visitor' => $visitor, 'contact' => $contact_url]); Logger::info('Redirecting without magic', ['target' => $target_url, 'visitor' => $visitor, 'contact' => $contact_url]);
System::externalRedirect($target_url); System::externalRedirect($target_url);
} }

View file

@ -6,7 +6,6 @@
use Friendica\App; use Friendica\App;
use Friendica\Core\Config; use Friendica\Core\Config;
use Friendica\Core\L10n; use Friendica\Core\L10n;
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\DI;
@ -33,7 +32,7 @@ function user_allow($hash)
$profile = DBA::selectFirst('profile', ['net-publish'], ['uid' => $register['uid'], 'is-default' => true]); $profile = DBA::selectFirst('profile', ['net-publish'], ['uid' => $register['uid'], 'is-default' => true]);
if (DBA::isResult($profile) && $profile['net-publish'] && Config::get('system', 'directory')) { if (DBA::isResult($profile) && $profile['net-publish'] && Config::get('system', 'directory')) {
$url = System::baseUrl() . '/profile/' . $user['nickname']; $url = DI::baseUrl() . '/profile/' . $user['nickname'];
Worker::add(PRIORITY_LOW, "Directory", $url); Worker::add(PRIORITY_LOW, "Directory", $url);
} }

View file

@ -6,7 +6,6 @@
use Friendica\App; use Friendica\App;
use Friendica\Core\L10n; use Friendica\Core\L10n;
use Friendica\Core\Protocol; use Friendica\Core\Protocol;
use Friendica\Core\System;
use Friendica\Database\DBA; use Friendica\Database\DBA;
use Friendica\DI; use Friendica\DI;
use Friendica\Model\Contact; use Friendica\Model\Contact;
@ -23,8 +22,6 @@ function repair_ostatus_content(App $a) {
$uid = local_user(); $uid = local_user();
$a = \get_app();
$counter = intval($_REQUEST['counter']); $counter = intval($_REQUEST['counter']);
$r = q("SELECT COUNT(*) AS `total` FROM `contact` WHERE $r = q("SELECT COUNT(*) AS `total` FROM `contact` WHERE
@ -60,7 +57,7 @@ function repair_ostatus_content(App $a) {
Contact::createFromProbe($uid, $r[0]["url"], true); Contact::createFromProbe($uid, $r[0]["url"], true);
DI::page()['htmlhead'] = '<meta http-equiv="refresh" content="1; URL='.System::baseUrl().'/repair_ostatus?counter='.$counter.'">'; DI::page()['htmlhead'] = '<meta http-equiv="refresh" content="1; URL=' . DI::baseUrl() . '/repair_ostatus?counter='.$counter.'">';
return $o; return $o;
} }

View file

@ -15,7 +15,6 @@ use Friendica\Core\Logger;
use Friendica\Core\PConfig; use Friendica\Core\PConfig;
use Friendica\Core\Renderer; use Friendica\Core\Renderer;
use Friendica\Core\Session; use Friendica\Core\Session;
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;
@ -787,7 +786,7 @@ function settings_content(App $a)
if (!empty($legacy_contact)) { if (!empty($legacy_contact)) {
/// @todo Isn't it supposed to be a $a->internalRedirect() call? /// @todo Isn't it supposed to be a $a->internalRedirect() call?
DI::page()['htmlhead'] = '<meta http-equiv="refresh" content="0; URL=' . System::baseUrl().'/ostatus_subscribe?url=' . urlencode($legacy_contact) . '">'; DI::page()['htmlhead'] = '<meta http-equiv="refresh" content="0; URL=' . DI::baseUrl().'/ostatus_subscribe?url=' . urlencode($legacy_contact) . '">';
} }
$settings_connectors = ''; $settings_connectors = '';
@ -851,7 +850,7 @@ function settings_content(App $a)
'$default_group' => Group::displayGroupSelection(local_user(), $default_group, L10n::t("Default group for OStatus contacts")), '$default_group' => Group::displayGroupSelection(local_user(), $default_group, L10n::t("Default group for OStatus contacts")),
'$legacy_contact' => ['legacy_contact', L10n::t('Your legacy GNU Social account'), $legacy_contact, L10n::t("If you enter your old GNU Social/Statusnet account name here \x28in the format user@domain.tld\x29, your contacts will be added automatically. The field will be emptied when done.")], '$legacy_contact' => ['legacy_contact', L10n::t('Your legacy GNU Social account'), $legacy_contact, L10n::t("If you enter your old GNU Social/Statusnet account name here \x28in the format user@domain.tld\x29, your contacts will be added automatically. The field will be emptied when done.")],
'$repair_ostatus_url' => System::baseUrl() . '/repair_ostatus', '$repair_ostatus_url' => DI::baseUrl() . '/repair_ostatus',
'$repair_ostatus_text' => L10n::t('Repair OStatus subscriptions'), '$repair_ostatus_text' => L10n::t('Repair OStatus subscriptions'),
'$settings_connectors' => $settings_connectors, '$settings_connectors' => $settings_connectors,
@ -949,7 +948,7 @@ function settings_content(App $a)
'$ptitle' => L10n::t('Display Settings'), '$ptitle' => L10n::t('Display Settings'),
'$form_security_token' => BaseModule::getFormSecurityToken("settings_display"), '$form_security_token' => BaseModule::getFormSecurityToken("settings_display"),
'$submit' => L10n::t('Save Settings'), '$submit' => L10n::t('Save Settings'),
'$baseurl' => System::baseUrl(true), '$baseurl' => DI::baseUrl()->get(true),
'$uid' => local_user(), '$uid' => local_user(),
'$theme' => ['theme', L10n::t('Display Theme:'), $theme_selected, '', $themes, true], '$theme' => ['theme', L10n::t('Display Theme:'), $theme_selected, '', $themes, true],
@ -1084,7 +1083,7 @@ function settings_content(App $a)
$profile_in_dir = '<input type="hidden" name="profile_in_directory" value="1" />'; $profile_in_dir = '<input type="hidden" name="profile_in_directory" value="1" />';
} else { } else {
$profile_in_dir = Renderer::replaceMacros($opt_tpl, [ $profile_in_dir = Renderer::replaceMacros($opt_tpl, [
'$field' => ['profile_in_directory', L10n::t('Publish your default profile in your local site directory?'), $profile['publish'], L10n::t('Your profile will be published in this node\'s <a href="%s">local directory</a>. Your profile details may be publicly visible depending on the system settings.', System::baseUrl().'/directory'), [L10n::t('No'), L10n::t('Yes')]] '$field' => ['profile_in_directory', L10n::t('Publish your default profile in your local site directory?'), $profile['publish'], L10n::t('Your profile will be published in this node\'s <a href="%s">local directory</a>. Your profile details may be publicly visible depending on the system settings.', DI::baseUrl().'/directory'), [L10n::t('No'), L10n::t('Yes')]]
]); ]);
} }
@ -1127,7 +1126,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 . '@' . DI::baseUrl()->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(), DI::baseUrl() . '/profile/' . $nickname),
'$basepath' => DI::baseUrl()->getHostname() '$basepath' => DI::baseUrl()->getHostname()
]); ]);
@ -1174,7 +1173,7 @@ function settings_content(App $a)
'$ptitle' => L10n::t('Account Settings'), '$ptitle' => L10n::t('Account Settings'),
'$submit' => L10n::t('Save Settings'), '$submit' => L10n::t('Save Settings'),
'$baseurl' => System::baseUrl(true), '$baseurl' => DI::baseUrl()->get(true),
'$uid' => local_user(), '$uid' => local_user(),
'$form_security_token' => BaseModule::getFormSecurityToken("settings"), '$form_security_token' => BaseModule::getFormSecurityToken("settings"),
'$nickname_block' => $prof_addr, '$nickname_block' => $prof_addr,

View file

@ -10,6 +10,7 @@ use Friendica\Core\Logger;
use Friendica\Core\Session; use Friendica\Core\Session;
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\Activity; use Friendica\Protocol\Activity;
use Friendica\Util\Security; use Friendica\Util\Security;
@ -90,7 +91,7 @@ function subthread_content(App $a) {
$post_type = (($item['resource-id']) ? L10n::t('photo') : L10n::t('status')); $post_type = (($item['resource-id']) ? L10n::t('photo') : L10n::t('status'));
$objtype = (($item['resource-id']) ? Activity\ObjectType::IMAGE : Activity\ObjectType::NOTE ); $objtype = (($item['resource-id']) ? Activity\ObjectType::IMAGE : Activity\ObjectType::NOTE );
$link = XML::escape('<link rel="alternate" type="text/html" href="' . System::baseUrl() . '/display/' . $item['guid'] . '" />' . "\n"); $link = XML::escape('<link rel="alternate" type="text/html" href="' . DI::baseUrl() . '/display/' . $item['guid'] . '" />' . "\n");
$body = $item['body']; $body = $item['body'];
$obj = <<< EOT $obj = <<< EOT
@ -131,7 +132,7 @@ EOT;
$ulink = '[url=' . $contact['url'] . ']' . $contact['name'] . '[/url]'; $ulink = '[url=' . $contact['url'] . ']' . $contact['name'] . '[/url]';
$alink = '[url=' . $item['author-link'] . ']' . $item['author-name'] . '[/url]'; $alink = '[url=' . $item['author-link'] . ']' . $item['author-name'] . '[/url]';
$plink = '[url=' . System::baseUrl() . '/display/' . $item['guid'] . ']' . $post_type . '[/url]'; $plink = '[url=' . DI::baseUrl() . '/display/' . $item['guid'] . ']' . $post_type . '[/url]';
$arr['body'] = sprintf( $bodyverb, $ulink, $alink, $plink ); $arr['body'] = sprintf( $bodyverb, $ulink, $alink, $plink );
$arr['verb'] = $activity; $arr['verb'] = $activity;

View file

@ -8,7 +8,6 @@ use Friendica\Content\ContactSelector;
use Friendica\Content\Widget; use Friendica\Content\Widget;
use Friendica\Core\L10n; use Friendica\Core\L10n;
use Friendica\Core\Renderer; use Friendica\Core\Renderer;
use Friendica\Core\System;
use Friendica\Database\DBA; use Friendica\Database\DBA;
use Friendica\DI; use Friendica\DI;
use Friendica\Model\Contact; use Friendica\Model\Contact;
@ -82,8 +81,8 @@ function suggest_content(App $a)
$entries = []; $entries = [];
foreach ($r as $rr) { foreach ($r as $rr) {
$connlnk = System::baseUrl() . '/follow/?url=' . (($rr['connect']) ? $rr['connect'] : $rr['url']); $connlnk = DI::baseUrl() . '/follow/?url=' . (($rr['connect']) ? $rr['connect'] : $rr['url']);
$ignlnk = System::baseUrl() . '/suggest?ignore=' . $rr['id']; $ignlnk = DI::baseUrl() . '/suggest?ignore=' . $rr['id'];
$photo_menu = [ $photo_menu = [
'profile' => [L10n::t("View Profile"), Contact::magicLink($rr["url"])], 'profile' => [L10n::t("View Profile"), Contact::magicLink($rr["url"])],
'follow' => [L10n::t("Connect/Follow"), $connlnk], 'follow' => [L10n::t("Connect/Follow"), $connlnk],

View file

@ -11,6 +11,7 @@ use Friendica\Core\Session;
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\Item; use Friendica\Model\Item;
use Friendica\Protocol\Activity; use Friendica\Protocol\Activity;
use Friendica\Util\Strings; use Friendica\Util\Strings;
@ -71,7 +72,7 @@ function tagger_content(App $a) {
$xterm = XML::escape($term); $xterm = XML::escape($term);
$post_type = (($item['resource-id']) ? L10n::t('photo') : L10n::t('status')); $post_type = (($item['resource-id']) ? L10n::t('photo') : L10n::t('status'));
$targettype = (($item['resource-id']) ? Activity\ObjectType::IMAGE : Activity\ObjectType::NOTE ); $targettype = (($item['resource-id']) ? Activity\ObjectType::IMAGE : Activity\ObjectType::NOTE );
$href = System::baseUrl() . '/display/' . $item['guid']; $href = DI::baseUrl() . '/display/' . $item['guid'];
$link = XML::escape('<link rel="alternate" type="text/html" href="'. $href . '" />' . "\n"); $link = XML::escape('<link rel="alternate" type="text/html" href="'. $href . '" />' . "\n");
@ -88,7 +89,7 @@ function tagger_content(App $a) {
</target> </target>
EOT; EOT;
$tagid = System::baseUrl() . '/search?tag=' . $xterm; $tagid = DI::baseUrl() . '/search?tag=' . $xterm;
$objtype = Activity\ObjectType::TAGTERM; $objtype = Activity\ObjectType::TAGTERM;
$obj = <<< EOT $obj = <<< EOT
@ -108,7 +109,7 @@ EOT;
return; return;
} }
$termlink = html_entity_decode('&#x2317;') . '[url=' . System::baseUrl() . '/search?tag=' . $term . ']'. $term . '[/url]'; $termlink = html_entity_decode('&#x2317;') . '[url=' . DI::baseUrl() . '/search?tag=' . $term . ']'. $term . '[/url]';
$arr = []; $arr = [];

View file

@ -7,7 +7,6 @@ use Friendica\App;
use Friendica\Core\L10n; use Friendica\Core\L10n;
use Friendica\Core\Protocol; use Friendica\Core\Protocol;
use Friendica\Core\Renderer; use Friendica\Core\Renderer;
use Friendica\Core\System;
use Friendica\Database\DBA; use Friendica\Database\DBA;
use Friendica\DI; use Friendica\DI;
use Friendica\Model\Contact; use Friendica\Model\Contact;
@ -101,7 +100,7 @@ function unfollow_content(App $a)
// NOTREACHED // NOTREACHED
} }
$request = System::baseUrl() . '/unfollow'; $request = DI::baseUrl() . '/unfollow';
$tpl = Renderer::getMarkupTemplate('auto_request.tpl'); $tpl = Renderer::getMarkupTemplate('auto_request.tpl');
$self = DBA::selectFirst('contact', ['url'], ['uid' => $uid, 'self' => true]); $self = DBA::selectFirst('contact', ['url'], ['uid' => $uid, 'self' => true]);

View file

@ -9,17 +9,14 @@ use Friendica\Content\Pager;
use Friendica\Core\Config; use Friendica\Core\Config;
use Friendica\Core\L10n; use Friendica\Core\L10n;
use Friendica\Core\Renderer; use Friendica\Core\Renderer;
use Friendica\Core\System;
use Friendica\Core\Session; use Friendica\Core\Session;
use Friendica\Database\DBA; use Friendica\Database\DBA;
use Friendica\DI; use Friendica\DI;
use Friendica\Model\Attach; use Friendica\Model\Attach;
use Friendica\Model\Contact; use Friendica\Model\Contact;
use Friendica\Model\Group;
use Friendica\Model\Item; use Friendica\Model\Item;
use Friendica\Model\Profile; use Friendica\Model\Profile;
use Friendica\Model\User; use Friendica\Model\User;
use Friendica\Protocol\DFRN;
use Friendica\Util\Security; use Friendica\Util\Security;
function videos_init(App $a) function videos_init(App $a)
@ -235,13 +232,13 @@ function videos_content(App $a)
$videos[] = [ $videos[] = [
'id' => $rr['id'], 'id' => $rr['id'],
'link' => System::baseUrl() . '/videos/' . $a->data['user']['nickname'] . '/video/' . $rr['hash'], 'link' => DI::baseUrl() . '/videos/' . $a->data['user']['nickname'] . '/video/' . $rr['hash'],
'title' => L10n::t('View Video'), 'title' => L10n::t('View Video'),
'src' => System::baseUrl() . '/attach/' . $rr['id'] . '?attachment=0', 'src' => DI::baseUrl() . '/attach/' . $rr['id'] . '?attachment=0',
'alt' => $alt_e, 'alt' => $alt_e,
'mime' => $rr['filetype'], 'mime' => $rr['filetype'],
'album' => [ 'album' => [
'link' => System::baseUrl() . '/videos/' . $a->data['user']['nickname'] . '/album/' . bin2hex($rr['album']), 'link' => DI::baseUrl() . '/videos/' . $a->data['user']['nickname'] . '/album/' . bin2hex($rr['album']),
'name' => $name_e, 'name' => $name_e,
'alt' => L10n::t('View Album'), 'alt' => L10n::t('View Album'),
], ],
@ -253,9 +250,9 @@ function videos_content(App $a)
$o .= Renderer::replaceMacros($tpl, [ $o .= Renderer::replaceMacros($tpl, [
'$title' => L10n::t('Recent Videos'), '$title' => L10n::t('Recent Videos'),
'$can_post' => $can_post, '$can_post' => $can_post,
'$upload' => [L10n::t('Upload New Videos'), System::baseUrl() . '/videos/' . $a->data['user']['nickname'] . '/upload'], '$upload' => [L10n::t('Upload New Videos'), DI::baseUrl() . '/videos/' . $a->data['user']['nickname'] . '/upload'],
'$videos' => $videos, '$videos' => $videos,
'$delete_url' => (($can_post) ? System::baseUrl() . '/videos/' . $a->data['user']['nickname'] : false) '$delete_url' => (($can_post) ? DI::baseUrl() . '/videos/' . $a->data['user']['nickname'] : false)
]); ]);
$o .= $pager->renderFull($total); $o .= $pager->renderFull($total);

View file

@ -13,8 +13,8 @@ use Friendica\Core\Config;
use Friendica\Core\L10n; use Friendica\Core\L10n;
use Friendica\Core\Logger; use Friendica\Core\Logger;
use Friendica\Core\Session; use Friendica\Core\Session;
use Friendica\Core\System;
use Friendica\Database\DBA; use Friendica\Database\DBA;
use Friendica\DI;
use Friendica\Model\Photo; use Friendica\Model\Photo;
use Friendica\Model\User; use Friendica\Model\User;
use Friendica\Object\Image; use Friendica\Object\Image;
@ -281,9 +281,9 @@ function wall_upload_post(App $a, $desktopmode = true)
$picture["width"] = $r[0]["width"]; $picture["width"] = $r[0]["width"];
$picture["height"] = $r[0]["height"]; $picture["height"] = $r[0]["height"];
$picture["type"] = $r[0]["type"]; $picture["type"] = $r[0]["type"];
$picture["albumpage"] = System::baseUrl() . '/photos/' . $page_owner_nick . '/image/' . $resource_id; $picture["albumpage"] = DI::baseUrl() . '/photos/' . $page_owner_nick . '/image/' . $resource_id;
$picture["picture"] = System::baseUrl() . "/photo/{$resource_id}-0." . $Image->getExt(); $picture["picture"] = DI::baseUrl() . "/photo/{$resource_id}-0." . $Image->getExt();
$picture["preview"] = System::baseUrl() . "/photo/{$resource_id}-{$smallest}." . $Image->getExt(); $picture["preview"] = DI::baseUrl() . "/photo/{$resource_id}-{$smallest}." . $Image->getExt();
if ($r_json) { if ($r_json) {
echo json_encode(['picture' => $picture]); echo json_encode(['picture' => $picture]);
@ -300,7 +300,7 @@ function wall_upload_post(App $a, $desktopmode = true)
exit(); exit();
} }
echo "\n\n" . '[url=' . System::baseUrl() . '/photos/' . $page_owner_nick . '/image/' . $resource_id . '][img]' . System::baseUrl() . "/photo/{$resource_id}-{$smallest}.".$Image->getExt()."[/img][/url]\n\n"; echo "\n\n" . '[url=' . DI::baseUrl() . '/photos/' . $page_owner_nick . '/image/' . $resource_id . '][img]' . DI::baseUrl() . "/photo/{$resource_id}-{$smallest}.".$Image->getExt()."[/img][/url]\n\n";
exit(); exit();
// NOTREACHED // NOTREACHED
} }

View file

@ -6,7 +6,6 @@ use Friendica\App;
use Friendica\Core\L10n; use Friendica\Core\L10n;
use Friendica\Core\Logger; use Friendica\Core\Logger;
use Friendica\Core\Renderer; use Friendica\Core\Renderer;
use Friendica\Core\System;
use Friendica\Database\DBA; use Friendica\Database\DBA;
use Friendica\DI; use Friendica\DI;
use Friendica\Model\Mail; use Friendica\Model\Mail;
@ -119,7 +118,7 @@ function wallmessage_content(App $a) {
$tpl = Renderer::getMarkupTemplate('wallmsg-header.tpl'); $tpl = Renderer::getMarkupTemplate('wallmsg-header.tpl');
DI::page()['htmlhead'] .= Renderer::replaceMacros($tpl, [ DI::page()['htmlhead'] .= Renderer::replaceMacros($tpl, [
'$baseurl' => System::baseUrl(true), '$baseurl' => DI::baseUrl()->get(true),
'$nickname' => $user['nickname'], '$nickname' => $user['nickname'],
'$linkurl' => L10n::t('Please enter a link URL:') '$linkurl' => L10n::t('Please enter a link URL:')
]); ]);

View file

@ -435,4 +435,12 @@ class BaseURL
$redirectTo = $this->get($ssl) . '/' . ltrim($toUrl, '/'); $redirectTo = $this->get($ssl) . '/' . ltrim($toUrl, '/');
System::externalRedirect($redirectTo); System::externalRedirect($redirectTo);
} }
/**
* Returns the base url as string
*/
public function __toString()
{
return $this->get();
}
} }

View file

@ -9,8 +9,8 @@ use Friendica\Core\Protocol;
use Friendica\Content\Text\HTML; use Friendica\Content\Text\HTML;
use Friendica\Core\L10n; use Friendica\Core\L10n;
use Friendica\Core\Renderer; use Friendica\Core\Renderer;
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\Util\Proxy as ProxyUtils; use Friendica\Util\Proxy as ProxyUtils;
@ -116,7 +116,7 @@ class ForumManager
'name' => $contact['name'], 'name' => $contact['name'],
'cid' => $contact['id'], 'cid' => $contact['id'],
'selected' => $selected, 'selected' => $selected,
'micro' => System::removedBaseUrl(ProxyUtils::proxifyUrl($contact['micro'], false, ProxyUtils::SIZE_MICRO)), 'micro' => DI::baseUrl()->remove(ProxyUtils::proxifyUrl($contact['micro'], false, ProxyUtils::SIZE_MICRO)),
'id' => ++$id, 'id' => ++$id,
]; ];
$entries[] = $entry; $entries[] = $entry;

View file

@ -10,7 +10,6 @@ use Friendica\Core\Hook;
use Friendica\Core\L10n; use Friendica\Core\L10n;
use Friendica\Core\Renderer; use Friendica\Core\Renderer;
use Friendica\Core\Session; use Friendica\Core\Session;
use Friendica\Core\System;
use Friendica\Database\DBA; use Friendica\Database\DBA;
use Friendica\DI; use Friendica\DI;
use Friendica\Model\Profile; use Friendica\Model\Profile;
@ -141,7 +140,7 @@ class Nav
$myident = ((is_array($a->user) && isset($a->user['nickname'])) ? $a->user['nickname'] . '@' : ''); $myident = ((is_array($a->user) && isset($a->user['nickname'])) ? $a->user['nickname'] . '@' : '');
$sitelocation = $myident . substr(System::baseUrl($ssl_state), strpos(System::baseUrl($ssl_state), '//') + 2); $sitelocation = $myident . substr(DI::baseUrl()->get($ssl_state), strpos(DI::baseUrl()->get($ssl_state), '//') + 2);
// nav links: array of array('href', 'text', 'extra css classes', 'title') // nav links: array of array('href', 'text', 'extra css classes', 'title')
$nav = []; $nav = [];

View file

@ -15,8 +15,8 @@ use Friendica\Core\Config;
use Friendica\Core\Hook; use Friendica\Core\Hook;
use Friendica\Core\L10n; use Friendica\Core\L10n;
use Friendica\Core\Renderer; use Friendica\Core\Renderer;
use Friendica\Core\System;
use Friendica\Database\DBA; use Friendica\Database\DBA;
use Friendica\DI;
use Friendica\Util\DateTimeFormat; use Friendica\Util\DateTimeFormat;
use Friendica\Util\Network; use Friendica\Util\Network;
use Friendica\Util\ParseUrl; use Friendica\Util\ParseUrl;
@ -373,7 +373,7 @@ class OEmbed
} }
$width = '100%'; $width = '100%';
$src = System::baseUrl() . '/oembed/' . Strings::base64UrlEncode($src); $src = DI::baseUrl() . '/oembed/' . Strings::base64UrlEncode($src);
return '<iframe onload="resizeIframe(this);" class="embed_rich" height="' . $height . '" width="' . $width . '" src="' . $src . '" allowfullscreen scrolling="no" frameborder="no">' . L10n::t('Embedded content') . '</iframe>'; return '<iframe onload="resizeIframe(this);" class="embed_rich" height="' . $height . '" width="' . $width . '" src="' . $src . '" allowfullscreen scrolling="no" frameborder="no">' . L10n::t('Embedded content') . '</iframe>';
} }

View file

@ -17,7 +17,7 @@ namespace Friendica\Content;
use Friendica\Core\Config; use Friendica\Core\Config;
use Friendica\Core\Hook; use Friendica\Core\Hook;
use Friendica\Core\PConfig; use Friendica\Core\PConfig;
use Friendica\Core\System; use Friendica\DI;
use Friendica\Util\Strings; use Friendica\Util\Strings;
/** /**
@ -102,42 +102,44 @@ class Smilies
]; ];
$baseUrl = DI::baseUrl();
$icons = [ $icons = [
'<img class="smiley" src="' . System::baseUrl() . '/images/smiley-heart.gif" alt="&lt;3" title="&lt;3" />', '<img class="smiley" src="' . $baseUrl . '/images/smiley-heart.gif" alt="&lt;3" title="&lt;3" />',
'<img class="smiley" src="' . System::baseUrl() . '/images/smiley-brokenheart.gif" alt="&lt;/3" title="&lt;/3" />', '<img class="smiley" src="' . $baseUrl . '/images/smiley-brokenheart.gif" alt="&lt;/3" title="&lt;/3" />',
'<img class="smiley" src="' . System::baseUrl() . '/images/smiley-brokenheart.gif" alt="&lt;\\3" title="&lt;\\3" />', '<img class="smiley" src="' . $baseUrl . '/images/smiley-brokenheart.gif" alt="&lt;\\3" title="&lt;\\3" />',
'<img class="smiley" src="' . System::baseUrl() . '/images/smiley-smile.gif" alt=":-)" title=":-)" />', '<img class="smiley" src="' . $baseUrl . '/images/smiley-smile.gif" alt=":-)" title=":-)" />',
'<img class="smiley" src="' . System::baseUrl() . '/images/smiley-wink.gif" alt=";-)" title=";-)" />', '<img class="smiley" src="' . $baseUrl . '/images/smiley-wink.gif" alt=";-)" title=";-)" />',
'<img class="smiley" src="' . System::baseUrl() . '/images/smiley-frown.gif" alt=":-(" title=":-(" />', '<img class="smiley" src="' . $baseUrl . '/images/smiley-frown.gif" alt=":-(" title=":-(" />',
'<img class="smiley" src="' . System::baseUrl() . '/images/smiley-tongue-out.gif" alt=":-P" title=":-P" />', '<img class="smiley" src="' . $baseUrl . '/images/smiley-tongue-out.gif" alt=":-P" title=":-P" />',
'<img class="smiley" src="' . System::baseUrl() . '/images/smiley-tongue-out.gif" alt=":-p" title=":-P" />', '<img class="smiley" src="' . $baseUrl . '/images/smiley-tongue-out.gif" alt=":-p" title=":-P" />',
'<img class="smiley" src="' . System::baseUrl() . '/images/smiley-kiss.gif" alt=":-\" title=":-\" />', '<img class="smiley" src="' . $baseUrl . '/images/smiley-kiss.gif" alt=":-\" title=":-\" />',
'<img class="smiley" src="' . System::baseUrl() . '/images/smiley-kiss.gif" alt=":-\" title=":-\" />', '<img class="smiley" src="' . $baseUrl . '/images/smiley-kiss.gif" alt=":-\" title=":-\" />',
'<img class="smiley" src="' . System::baseUrl() . '/images/smiley-kiss.gif" alt=":-x" title=":-x" />', '<img class="smiley" src="' . $baseUrl . '/images/smiley-kiss.gif" alt=":-x" title=":-x" />',
'<img class="smiley" src="' . System::baseUrl() . '/images/smiley-kiss.gif" alt=":-X" title=":-X" />', '<img class="smiley" src="' . $baseUrl . '/images/smiley-kiss.gif" alt=":-X" title=":-X" />',
'<img class="smiley" src="' . System::baseUrl() . '/images/smiley-laughing.gif" alt=":-D" title=":-D" />', '<img class="smiley" src="' . $baseUrl . '/images/smiley-laughing.gif" alt=":-D" title=":-D" />',
'<img class="smiley" src="' . System::baseUrl() . '/images/smiley-surprised.gif" alt="8-|" title="8-|" />', '<img class="smiley" src="' . $baseUrl . '/images/smiley-surprised.gif" alt="8-|" title="8-|" />',
'<img class="smiley" src="' . System::baseUrl() . '/images/smiley-surprised.gif" alt="8-O" title="8-O" />', '<img class="smiley" src="' . $baseUrl . '/images/smiley-surprised.gif" alt="8-O" title="8-O" />',
'<img class="smiley" src="' . System::baseUrl() . '/images/smiley-surprised.gif" alt=":-O" title="8-O" />', '<img class="smiley" src="' . $baseUrl . '/images/smiley-surprised.gif" alt=":-O" title="8-O" />',
'<img class="smiley" src="' . System::baseUrl() . '/images/smiley-thumbsup.gif" alt="\\o/" title="\\o/" />', '<img class="smiley" src="' . $baseUrl . '/images/smiley-thumbsup.gif" alt="\\o/" title="\\o/" />',
'<img class="smiley" src="' . System::baseUrl() . '/images/smiley-Oo.gif" alt="o.O" title="o.O" />', '<img class="smiley" src="' . $baseUrl . '/images/smiley-Oo.gif" alt="o.O" title="o.O" />',
'<img class="smiley" src="' . System::baseUrl() . '/images/smiley-Oo.gif" alt="O.o" title="O.o" />', '<img class="smiley" src="' . $baseUrl . '/images/smiley-Oo.gif" alt="O.o" title="O.o" />',
'<img class="smiley" src="' . System::baseUrl() . '/images/smiley-Oo.gif" alt="o_O" title="o_O" />', '<img class="smiley" src="' . $baseUrl . '/images/smiley-Oo.gif" alt="o_O" title="o_O" />',
'<img class="smiley" src="' . System::baseUrl() . '/images/smiley-Oo.gif" alt="O_o" title="O_o" />', '<img class="smiley" src="' . $baseUrl . '/images/smiley-Oo.gif" alt="O_o" title="O_o" />',
'<img class="smiley" src="' . System::baseUrl() . '/images/smiley-cry.gif" alt=":\'(" title=":\'("/>', '<img class="smiley" src="' . $baseUrl . '/images/smiley-cry.gif" alt=":\'(" title=":\'("/>',
'<img class="smiley" src="' . System::baseUrl() . '/images/smiley-foot-in-mouth.gif" alt=":-!" title=":-!" />', '<img class="smiley" src="' . $baseUrl . '/images/smiley-foot-in-mouth.gif" alt=":-!" title=":-!" />',
'<img class="smiley" src="' . System::baseUrl() . '/images/smiley-undecided.gif" alt=":-/" title=":-/" />', '<img class="smiley" src="' . $baseUrl . '/images/smiley-undecided.gif" alt=":-/" title=":-/" />',
'<img class="smiley" src="' . System::baseUrl() . '/images/smiley-embarassed.gif" alt=":-[" title=":-[" />', '<img class="smiley" src="' . $baseUrl . '/images/smiley-embarassed.gif" alt=":-[" title=":-[" />',
'<img class="smiley" src="' . System::baseUrl() . '/images/smiley-cool.gif" alt="8-)" title="8-)" />', '<img class="smiley" src="' . $baseUrl . '/images/smiley-cool.gif" alt="8-)" title="8-)" />',
'<img class="smiley" src="' . System::baseUrl() . '/images/beer_mug.gif" alt=":beer" title=":beer" />', '<img class="smiley" src="' . $baseUrl . '/images/beer_mug.gif" alt=":beer" title=":beer" />',
'<img class="smiley" src="' . System::baseUrl() . '/images/beer_mug.gif" alt=":homebrew" title=":homebrew" />', '<img class="smiley" src="' . $baseUrl . '/images/beer_mug.gif" alt=":homebrew" title=":homebrew" />',
'<img class="smiley" src="' . System::baseUrl() . '/images/coffee.gif" alt=":coffee" title=":coffee" />', '<img class="smiley" src="' . $baseUrl . '/images/coffee.gif" alt=":coffee" title=":coffee" />',
'<img class="smiley" src="' . System::baseUrl() . '/images/smiley-facepalm.gif" alt=":facepalm" title=":facepalm" />', '<img class="smiley" src="' . $baseUrl . '/images/smiley-facepalm.gif" alt=":facepalm" title=":facepalm" />',
'<img class="smiley" src="' . System::baseUrl() . '/images/like.gif" alt=":like" title=":like" />', '<img class="smiley" src="' . $baseUrl . '/images/like.gif" alt=":like" title=":like" />',
'<img class="smiley" src="' . System::baseUrl() . '/images/dislike.gif" alt=":dislike" title=":dislike" />', '<img class="smiley" src="' . $baseUrl . '/images/dislike.gif" alt=":dislike" title=":dislike" />',
'<a href="https://friendi.ca">~friendica <img class="smiley" src="' . System::baseUrl() . '/images/friendica-16.png" alt="~friendica" title="~friendica" /></a>', '<a href="https://friendi.ca">~friendica <img class="smiley" src="' . $baseUrl . '/images/friendica-16.png" alt="~friendica" title="~friendica" /></a>',
'<a href="http://redmatrix.me/">red<img class="smiley" src="' . System::baseUrl() . '/images/rm-16.png" alt="red#" title="red#" />matrix</a>', '<a href="http://redmatrix.me/">red<img class="smiley" src="' . $baseUrl . '/images/rm-16.png" alt="red#" title="red#" />matrix</a>',
'<a href="http://redmatrix.me/">red<img class="smiley" src="' . System::baseUrl() . '/images/rm-16.png" alt="red#matrix" title="red#matrix" />matrix</a>' '<a href="http://redmatrix.me/">red<img class="smiley" src="' . $baseUrl . '/images/rm-16.png" alt="red#matrix" title="red#matrix" />matrix</a>'
]; ];
$params = ['texts' => $texts, 'icons' => $icons]; $params = ['texts' => $texts, 'icons' => $icons];

View file

@ -452,7 +452,7 @@ class BBCode
foreach ($matches as $mtch) { foreach ($matches as $mtch) {
Logger::log('scale_external_image: ' . $mtch[1]); Logger::log('scale_external_image: ' . $mtch[1]);
$hostname = str_replace('www.', '', substr(System::baseUrl(), strpos(System::baseUrl(), '://') + 3)); $hostname = str_replace('www.', '', substr(DI::baseUrl(), strpos(DI::baseUrl(), '://') + 3));
if (stristr($mtch[1], $hostname)) { if (stristr($mtch[1], $hostname)) {
continue; continue;
} }
@ -1626,9 +1626,9 @@ class BBCode
$text = preg_replace("/\[img\](.*?)\[\/img\]/ism", '<img src="$1" alt="' . L10n::t('Image/photo') . '" />', $text); $text = preg_replace("/\[img\](.*?)\[\/img\]/ism", '<img src="$1" alt="' . L10n::t('Image/photo') . '" />', $text);
$text = preg_replace("/\[zmg\](.*?)\[\/zmg\]/ism", '<img src="$1" alt="' . L10n::t('Image/photo') . '" />', $text); $text = preg_replace("/\[zmg\](.*?)\[\/zmg\]/ism", '<img src="$1" alt="' . L10n::t('Image/photo') . '" />', $text);
$text = preg_replace("/\[crypt\](.*?)\[\/crypt\]/ism", '<br/><img src="' .System::baseUrl() . '/images/lock_icon.gif" alt="' . L10n::t('Encrypted content') . '" title="' . L10n::t('Encrypted content') . '" /><br />', $text); $text = preg_replace("/\[crypt\](.*?)\[\/crypt\]/ism", '<br/><img src="' .DI::baseUrl() . '/images/lock_icon.gif" alt="' . L10n::t('Encrypted content') . '" title="' . L10n::t('Encrypted content') . '" /><br />', $text);
$text = preg_replace("/\[crypt(.*?)\](.*?)\[\/crypt\]/ism", '<br/><img src="' .System::baseUrl() . '/images/lock_icon.gif" alt="' . L10n::t('Encrypted content') . '" title="' . '$1' . ' ' . L10n::t('Encrypted content') . '" /><br />', $text); $text = preg_replace("/\[crypt(.*?)\](.*?)\[\/crypt\]/ism", '<br/><img src="' .DI::baseUrl() . '/images/lock_icon.gif" alt="' . L10n::t('Encrypted content') . '" title="' . '$1' . ' ' . L10n::t('Encrypted content') . '" /><br />', $text);
//$Text = preg_replace("/\[crypt=(.*?)\](.*?)\[\/crypt\]/ism", '<br/><img src="' .System::baseUrl() . '/images/lock_icon.gif" alt="' . L10n::t('Encrypted content') . '" title="' . '$1' . ' ' . L10n::t('Encrypted content') . '" /><br />', $Text); //$Text = preg_replace("/\[crypt=(.*?)\](.*?)\[\/crypt\]/ism", '<br/><img src="' .DI::baseUrl() . '/images/lock_icon.gif" alt="' . L10n::t('Encrypted content') . '" title="' . '$1' . ' ' . L10n::t('Encrypted content') . '" /><br />', $Text);
// Simplify "video" element // Simplify "video" element
$text = preg_replace('(\[video.*?\ssrc\s?=\s?([^\s\]]+).*?\].*?\[/video\])ism', '[video]$1[/video]', $text); $text = preg_replace('(\[video.*?\ssrc\s?=\s?([^\s\]]+).*?\].*?\[/video\])ism', '[video]$1[/video]', $text);
@ -1778,21 +1778,21 @@ class BBCode
$text = preg_replace_callback( $text = preg_replace_callback(
"&\[url=/?posts/([^\[\]]*)\](.*)\[\/url\]&Usi", "&\[url=/?posts/([^\[\]]*)\](.*)\[\/url\]&Usi",
function ($match) { function ($match) {
return "[url=" . System::baseUrl() . "/display/" . $match[1] . "]" . $match[2] . "[/url]"; return "[url=" . DI::baseUrl() . "/display/" . $match[1] . "]" . $match[2] . "[/url]";
}, $text }, $text
); );
$text = preg_replace_callback( $text = preg_replace_callback(
"&\[url=/people\?q\=(.*)\](.*)\[\/url\]&Usi", "&\[url=/people\?q\=(.*)\](.*)\[\/url\]&Usi",
function ($match) { function ($match) {
return "[url=" . System::baseUrl() . "/search?search=%40" . $match[1] . "]" . $match[2] . "[/url]"; return "[url=" . DI::baseUrl() . "/search?search=%40" . $match[1] . "]" . $match[2] . "[/url]";
}, $text }, $text
); );
// Server independent link to posts and comments // Server independent link to posts and comments
// See issue: https://github.com/diaspora/diaspora_federation/issues/75 // See issue: https://github.com/diaspora/diaspora_federation/issues/75
$expression = "=diaspora://.*?/post/([0-9A-Za-z\-_@.:]{15,254}[0-9A-Za-z])=ism"; $expression = "=diaspora://.*?/post/([0-9A-Za-z\-_@.:]{15,254}[0-9A-Za-z])=ism";
$text = preg_replace($expression, System::baseUrl()."/display/$1", $text); $text = preg_replace($expression, DI::baseUrl()."/display/$1", $text);
/* Tag conversion /* Tag conversion
* Supports: * Supports:
@ -1801,15 +1801,15 @@ class BBCode
*/ */
$text = preg_replace_callback("/(?:#\[url\=[^\[\]]*\]|\[url\=[^\[\]]*\]#)(.*?)\[\/url\]/ism", function($matches) { $text = preg_replace_callback("/(?:#\[url\=[^\[\]]*\]|\[url\=[^\[\]]*\]#)(.*?)\[\/url\]/ism", function($matches) {
return '#<a href="' return '#<a href="'
. System::baseUrl() . '/search?tag=' . rawurlencode($matches[1]) . DI::baseUrl() . '/search?tag=' . rawurlencode($matches[1])
. '" class="tag" rel="tag" title="' . XML::escape($matches[1]) . '">' . '" class="tag" rel="tag" title="' . XML::escape($matches[1]) . '">'
. XML::escape($matches[1]) . XML::escape($matches[1])
. '</a>'; . '</a>';
}, $text); }, $text);
// We need no target="_blank" for local links // We need no target="_blank" for local links
// convert links start with System::baseUrl() as local link without the target="_blank" attribute // convert links start with DI::baseUrl() as local link without the target="_blank" attribute
$escapedBaseUrl = preg_quote(System::baseUrl(), '/'); $escapedBaseUrl = preg_quote(DI::baseUrl(), '/');
$text = preg_replace("/\[url\](".$escapedBaseUrl.".*?)\[\/url\]/ism", '<a href="$1">$1</a>', $text); $text = preg_replace("/\[url\](".$escapedBaseUrl.".*?)\[\/url\]/ism", '<a href="$1">$1</a>', $text);
$text = preg_replace("/\[url\=(".$escapedBaseUrl.".*?)\](.*?)\[\/url\]/ism", '<a href="$1">$2</a>', $text); $text = preg_replace("/\[url\=(".$escapedBaseUrl.".*?)\](.*?)\[\/url\]/ism", '<a href="$1">$2</a>', $text);
@ -1823,7 +1823,7 @@ class BBCode
// we may need to restrict this further if it picks up too many strays // we may need to restrict this further if it picks up too many strays
// link acct:user@host to a webfinger profile redirector // link acct:user@host to a webfinger profile redirector
$text = preg_replace('/acct:([^@]+)@((?!\-)(?:[a-zA-Z\d\-]{0,62}[a-zA-Z\d]\.){1,126}(?!\d+)[a-zA-Z\d]{1,63})/', '<a href="' . System::baseUrl() . '/acctlink?addr=$1@$2" target="extlink">acct:$1@$2</a>', $text); $text = preg_replace('/acct:([^@]+)@((?!\-)(?:[a-zA-Z\d\-]{0,62}[a-zA-Z\d]\.){1,126}(?!\d+)[a-zA-Z\d]{1,63})/', '<a href="' . DI::baseUrl() . '/acctlink?addr=$1@$2" target="extlink">acct:$1@$2</a>', $text);
// Perform MAIL Search // Perform MAIL Search
$text = preg_replace("/\[mail\](.*?)\[\/mail\]/", '<a href="mailto:$1">$1</a>', $text); $text = preg_replace("/\[mail\](.*?)\[\/mail\]/", '<a href="mailto:$1">$1</a>', $text);

View file

@ -10,7 +10,6 @@ use Friendica\Core\L10n;
use Friendica\Core\PConfig; use Friendica\Core\PConfig;
use Friendica\Core\Protocol; use Friendica\Core\Protocol;
use Friendica\Core\Renderer; use Friendica\Core\Renderer;
use Friendica\Core\System;
use Friendica\Core\Session; use Friendica\Core\Session;
use Friendica\Database\DBA; use Friendica\Database\DBA;
use Friendica\DI; use Friendica\DI;
@ -23,7 +22,6 @@ use Friendica\Util\DateTimeFormat;
use Friendica\Util\Proxy as ProxyUtils; use Friendica\Util\Proxy as ProxyUtils;
use Friendica\Util\Strings; use Friendica\Util\Strings;
use Friendica\Util\Temporal; use Friendica\Util\Temporal;
use Friendica\Util\XML;
class Widget class Widget
{ {
@ -402,7 +400,7 @@ class Widget
$tpl = Renderer::getMarkupTemplate('widget/remote_friends_common.tpl'); $tpl = Renderer::getMarkupTemplate('widget/remote_friends_common.tpl');
return Renderer::replaceMacros($tpl, [ return Renderer::replaceMacros($tpl, [
'$desc' => L10n::tt("%d contact in common", "%d contacts in common", $t), '$desc' => L10n::tt("%d contact in common", "%d contacts in common", $t),
'$base' => System::baseUrl(), '$base' => DI::baseUrl(),
'$uid' => $profile_uid, '$uid' => $profile_uid,
'$cid' => (($cid) ? $cid : '0'), '$cid' => (($cid) ? $cid : '0'),
'$linkmore' => (($t > 5) ? 'true' : ''), '$linkmore' => (($t > 5) ? 'true' : ''),

View file

@ -8,8 +8,8 @@ namespace Friendica\Content\Widget;
use Friendica\Core\L10n; use Friendica\Core\L10n;
use Friendica\Core\Renderer; use Friendica\Core\Renderer;
use Friendica\Core\System;
use Friendica\Database\DBA; use Friendica\Database\DBA;
use Friendica\DI;
use Friendica\Model\Item; use Friendica\Model\Item;
/** /**
@ -38,7 +38,7 @@ class TagCloud
$r = self::tagadelic($uid, $count, $owner_id, $flags, $type); $r = self::tagadelic($uid, $count, $owner_id, $flags, $type);
if (count($r)) { if (count($r)) {
$contact = DBA::selectFirst('contact', ['url'], ['uid' => $uid, 'self' => true]); $contact = DBA::selectFirst('contact', ['url'], ['uid' => $uid, 'self' => true]);
$url = System::removedBaseUrl($contact['url']); $url = DI::baseUrl()->remove($contact['url']);
$tags = []; $tags = [];
foreach ($r as $rr) { foreach ($r as $rr) {

View file

@ -20,30 +20,6 @@ use Friendica\Util\XML;
*/ */
class System class System
{ {
/**
* @brief Retrieves the Friendica instance base URL
*
* @param bool $ssl Whether to append http or https under BaseURL::SSL_POLICY_SELFSIGN
* @return string Friendica server base URL
*/
public static function baseUrl($ssl = false)
{
return DI::baseUrl()->get($ssl);
}
/**
* @brief Removes the baseurl from an url. This avoids some mixed content problems.
*
* @param string $orig_url The url to be cleaned
*
* @return string The cleaned url
* @throws \Exception
*/
public static function removedBaseUrl(string $orig_url)
{
return DI::baseUrl()->remove($orig_url);
}
/** /**
* @brief Returns a string with a callstack. Can be used for logging. * @brief Returns a string with a callstack. Can be used for logging.
* @param integer $depth optional, default 4 * @param integer $depth optional, default 4

View file

@ -125,10 +125,10 @@ class Theme
$exts = ['.png', '.jpg']; $exts = ['.png', '.jpg'];
foreach ($exts as $ext) { foreach ($exts as $ext) {
if (file_exists('view/theme/' . $theme . '/screenshot' . $ext)) { if (file_exists('view/theme/' . $theme . '/screenshot' . $ext)) {
return System::baseUrl() . '/view/theme/' . $theme . '/screenshot' . $ext; return DI::baseUrl() . '/view/theme/' . $theme . '/screenshot' . $ext;
} }
} }
return System::baseUrl() . '/images/blank.png'; return DI::baseUrl() . '/images/blank.png';
} }
public static function uninstall($theme) public static function uninstall($theme)

View file

@ -123,7 +123,7 @@ class UserImport
} }
$oldbaseurl = $account['baseurl']; $oldbaseurl = $account['baseurl'];
$newbaseurl = System::baseUrl(); $newbaseurl = DI::baseUrl();
$oldaddr = str_replace('http://', '@', Strings::normaliseLink($oldbaseurl)); $oldaddr = str_replace('http://', '@', Strings::normaliseLink($oldbaseurl));
$newaddr = str_replace('http://', '@', Strings::normaliseLink($newbaseurl)); $newaddr = str_replace('http://', '@', Strings::normaliseLink($newbaseurl));

View file

@ -979,7 +979,7 @@ class Worker
return; return;
} }
$url = System::baseUrl()."/worker"; $url = DI::baseUrl() . '/worker';
Network::fetchUrl($url, false, 1); Network::fetchUrl($url, false, 1);
} }

View file

@ -303,7 +303,7 @@ class Contact
*/ */
public static function isLocal($url) public static function isLocal($url)
{ {
return Strings::compareLink(self::getBasepath($url, true), System::baseUrl()); return Strings::compareLink(self::getBasepath($url, true), DI::baseUrl());
} }
/** /**
@ -647,19 +647,19 @@ class Contact
'self' => 1, 'self' => 1,
'name' => $user['username'], 'name' => $user['username'],
'nick' => $user['nickname'], 'nick' => $user['nickname'],
'photo' => System::baseUrl() . '/photo/profile/' . $user['uid'] . '.jpg', 'photo' => DI::baseUrl() . '/photo/profile/' . $user['uid'] . '.jpg',
'thumb' => System::baseUrl() . '/photo/avatar/' . $user['uid'] . '.jpg', 'thumb' => DI::baseUrl() . '/photo/avatar/' . $user['uid'] . '.jpg',
'micro' => System::baseUrl() . '/photo/micro/' . $user['uid'] . '.jpg', 'micro' => DI::baseUrl() . '/photo/micro/' . $user['uid'] . '.jpg',
'blocked' => 0, 'blocked' => 0,
'pending' => 0, 'pending' => 0,
'url' => System::baseUrl() . '/profile/' . $user['nickname'], 'url' => DI::baseUrl() . '/profile/' . $user['nickname'],
'nurl' => Strings::normaliseLink(System::baseUrl() . '/profile/' . $user['nickname']), 'nurl' => Strings::normaliseLink(DI::baseUrl() . '/profile/' . $user['nickname']),
'addr' => $user['nickname'] . '@' . substr(System::baseUrl(), strpos(System::baseUrl(), '://') + 3), 'addr' => $user['nickname'] . '@' . substr(DI::baseUrl(), strpos(DI::baseUrl(), '://') + 3),
'request' => System::baseUrl() . '/dfrn_request/' . $user['nickname'], 'request' => DI::baseUrl() . '/dfrn_request/' . $user['nickname'],
'notify' => System::baseUrl() . '/dfrn_notify/' . $user['nickname'], 'notify' => DI::baseUrl() . '/dfrn_notify/' . $user['nickname'],
'poll' => System::baseUrl() . '/dfrn_poll/' . $user['nickname'], 'poll' => DI::baseUrl() . '/dfrn_poll/' . $user['nickname'],
'confirm' => System::baseUrl() . '/dfrn_confirm/' . $user['nickname'], 'confirm' => DI::baseUrl() . '/dfrn_confirm/' . $user['nickname'],
'poco' => System::baseUrl() . '/poco/' . $user['nickname'], 'poco' => DI::baseUrl() . '/poco/' . $user['nickname'],
'name-date' => DateTimeFormat::utcNow(), 'name-date' => DateTimeFormat::utcNow(),
'uri-date' => DateTimeFormat::utcNow(), 'uri-date' => DateTimeFormat::utcNow(),
'avatar-date' => DateTimeFormat::utcNow(), 'avatar-date' => DateTimeFormat::utcNow(),
@ -722,7 +722,7 @@ class Contact
// We are adding a timestamp value so that other systems won't use cached content // We are adding a timestamp value so that other systems won't use cached content
$timestamp = strtotime($fields['avatar-date']); $timestamp = strtotime($fields['avatar-date']);
$prefix = System::baseUrl() . '/photo/' .$avatar['resource-id'] . '-'; $prefix = DI::baseUrl() . '/photo/' .$avatar['resource-id'] . '-';
$suffix = '.' . $file_suffix . '?ts=' . $timestamp; $suffix = '.' . $file_suffix . '?ts=' . $timestamp;
$fields['photo'] = $prefix . '4' . $suffix; $fields['photo'] = $prefix . '4' . $suffix;
@ -730,25 +730,25 @@ class Contact
$fields['micro'] = $prefix . '6' . $suffix; $fields['micro'] = $prefix . '6' . $suffix;
} else { } else {
// We hadn't found a photo entry, so we use the default avatar // We hadn't found a photo entry, so we use the default avatar
$fields['photo'] = System::baseUrl() . '/images/person-300.jpg'; $fields['photo'] = DI::baseUrl() . '/images/person-300.jpg';
$fields['thumb'] = System::baseUrl() . '/images/person-80.jpg'; $fields['thumb'] = DI::baseUrl() . '/images/person-80.jpg';
$fields['micro'] = System::baseUrl() . '/images/person-48.jpg'; $fields['micro'] = DI::baseUrl() . '/images/person-48.jpg';
} }
$fields['avatar'] = System::baseUrl() . '/photo/profile/' .$uid . '.' . $file_suffix; $fields['avatar'] = DI::baseUrl() . '/photo/profile/' .$uid . '.' . $file_suffix;
$fields['forum'] = $user['page-flags'] == User::PAGE_FLAGS_COMMUNITY; $fields['forum'] = $user['page-flags'] == User::PAGE_FLAGS_COMMUNITY;
$fields['prv'] = $user['page-flags'] == User::PAGE_FLAGS_PRVGROUP; $fields['prv'] = $user['page-flags'] == User::PAGE_FLAGS_PRVGROUP;
$fields['unsearchable'] = $user['hidewall'] || !$profile['net-publish']; $fields['unsearchable'] = $user['hidewall'] || !$profile['net-publish'];
// it seems as if ported accounts can have wrong values, so we make sure that now everything is fine. // it seems as if ported accounts can have wrong values, so we make sure that now everything is fine.
$fields['url'] = System::baseUrl() . '/profile/' . $user['nickname']; $fields['url'] = DI::baseUrl() . '/profile/' . $user['nickname'];
$fields['nurl'] = Strings::normaliseLink($fields['url']); $fields['nurl'] = Strings::normaliseLink($fields['url']);
$fields['addr'] = $user['nickname'] . '@' . substr(System::baseUrl(), strpos(System::baseUrl(), '://') + 3); $fields['addr'] = $user['nickname'] . '@' . substr(DI::baseUrl(), strpos(DI::baseUrl(), '://') + 3);
$fields['request'] = System::baseUrl() . '/dfrn_request/' . $user['nickname']; $fields['request'] = DI::baseUrl() . '/dfrn_request/' . $user['nickname'];
$fields['notify'] = System::baseUrl() . '/dfrn_notify/' . $user['nickname']; $fields['notify'] = DI::baseUrl() . '/dfrn_notify/' . $user['nickname'];
$fields['poll'] = System::baseUrl() . '/dfrn_poll/'. $user['nickname']; $fields['poll'] = DI::baseUrl() . '/dfrn_poll/'. $user['nickname'];
$fields['confirm'] = System::baseUrl() . '/dfrn_confirm/' . $user['nickname']; $fields['confirm'] = DI::baseUrl() . '/dfrn_confirm/' . $user['nickname'];
$fields['poco'] = System::baseUrl() . '/poco/' . $user['nickname']; $fields['poco'] = DI::baseUrl() . '/poco/' . $user['nickname'];
$update = false; $update = false;
@ -769,8 +769,8 @@ class Contact
DBA::update('contact', $fields, ['uid' => 0, 'nurl' => $self['nurl']]); DBA::update('contact', $fields, ['uid' => 0, 'nurl' => $self['nurl']]);
// Update the profile // Update the profile
$fields = ['photo' => System::baseUrl() . '/photo/profile/' .$uid . '.' . $file_suffix, $fields = ['photo' => DI::baseUrl() . '/photo/profile/' .$uid . '.' . $file_suffix,
'thumb' => System::baseUrl() . '/photo/avatar/' . $uid .'.' . $file_suffix]; 'thumb' => DI::baseUrl() . '/photo/avatar/' . $uid .'.' . $file_suffix];
DBA::update('profile', $fields, ['uid' => $uid, 'is-default' => true]); DBA::update('profile', $fields, ['uid' => $uid, 'is-default' => true]);
} }
} }
@ -1191,7 +1191,7 @@ class Contact
$sparkle = false; $sparkle = false;
if (($contact['network'] === Protocol::DFRN) && !$contact['self'] && empty($contact['pending'])) { if (($contact['network'] === Protocol::DFRN) && !$contact['self'] && empty($contact['pending'])) {
$sparkle = true; $sparkle = true;
$profile_link = System::baseUrl() . '/redir/' . $contact['id']; $profile_link = DI::baseUrl() . '/redir/' . $contact['id'];
} else { } else {
$profile_link = $contact['url']; $profile_link = $contact['url'];
} }
@ -1207,19 +1207,19 @@ class Contact
} }
if (self::canReceivePrivateMessages($contact) && empty($contact['pending'])) { if (self::canReceivePrivateMessages($contact) && empty($contact['pending'])) {
$pm_url = System::baseUrl() . '/message/new/' . $contact['id']; $pm_url = DI::baseUrl() . '/message/new/' . $contact['id'];
} }
if (($contact['network'] == Protocol::DFRN) && !$contact['self'] && empty($contact['pending'])) { if (($contact['network'] == Protocol::DFRN) && !$contact['self'] && empty($contact['pending'])) {
$poke_link = System::baseUrl() . '/poke/?c=' . $contact['id']; $poke_link = DI::baseUrl() . '/poke/?c=' . $contact['id'];
} }
$contact_url = System::baseUrl() . '/contact/' . $contact['id']; $contact_url = DI::baseUrl() . '/contact/' . $contact['id'];
$posts_link = System::baseUrl() . '/contact/' . $contact['id'] . '/conversations'; $posts_link = DI::baseUrl() . '/contact/' . $contact['id'] . '/conversations';
if (!$contact['self']) { if (!$contact['self']) {
$contact_drop_link = System::baseUrl() . '/contact/' . $contact['id'] . '/drop?confirm=1'; $contact_drop_link = DI::baseUrl() . '/contact/' . $contact['id'] . '/drop?confirm=1';
} }
$follow_link = ''; $follow_link = '';
@ -2268,7 +2268,7 @@ class Contact
if (($protocol === Protocol::DFRN) && !DBA::isResult($contact)) { if (($protocol === Protocol::DFRN) && !DBA::isResult($contact)) {
if ($interactive) { if ($interactive) {
if (strlen(DI::baseUrl()->getUrlPath())) { if (strlen(DI::baseUrl()->getUrlPath())) {
$myaddr = bin2hex(System::baseUrl() . '/profile/' . $a->user['nickname']); $myaddr = bin2hex(DI::baseUrl() . '/profile/' . $a->user['nickname']);
} else { } else {
$myaddr = bin2hex($a->user['nickname'] . '@' . DI::baseUrl()->getHostname()); $myaddr = bin2hex($a->user['nickname'] . '@' . DI::baseUrl()->getHostname());
} }
@ -2594,7 +2594,7 @@ class Contact
'to_name' => $user['username'], 'to_name' => $user['username'],
'to_email' => $user['email'], 'to_email' => $user['email'],
'uid' => $user['uid'], 'uid' => $user['uid'],
'link' => System::baseUrl() . '/notifications/intro', 'link' => DI::baseUrl() . '/notifications/intro',
'source_name' => ((strlen(stripslashes($contact_record['name']))) ? stripslashes($contact_record['name']) : L10n::t('[Name Withheld]')), 'source_name' => ((strlen(stripslashes($contact_record['name']))) ? stripslashes($contact_record['name']) : L10n::t('[Name Withheld]')),
'source_link' => $contact_record['url'], 'source_link' => $contact_record['url'],
'source_photo' => $contact_record['photo'], 'source_photo' => $contact_record['photo'],

View file

@ -13,6 +13,7 @@ use Friendica\Core\PConfig;
use Friendica\Core\Renderer; use Friendica\Core\Renderer;
use Friendica\Core\System; use Friendica\Core\System;
use Friendica\Database\DBA; use Friendica\Database\DBA;
use Friendica\DI;
use Friendica\Protocol\Activity; use Friendica\Protocol\Activity;
use Friendica\Util\DateTimeFormat; use Friendica\Util\DateTimeFormat;
use Friendica\Util\Map; use Friendica\Util\Map;
@ -589,9 +590,9 @@ class Event
$copy = null; $copy = null;
$drop = null; $drop = null;
if (local_user() && local_user() == $event['uid'] && $event['type'] == 'event') { if (local_user() && local_user() == $event['uid'] && $event['type'] == 'event') {
$edit = !$event['cid'] ? [System::baseUrl() . '/events/event/' . $event['id'], L10n::t('Edit event') , '', ''] : null; $edit = !$event['cid'] ? [DI::baseUrl() . '/events/event/' . $event['id'], L10n::t('Edit event') , '', ''] : null;
$copy = !$event['cid'] ? [System::baseUrl() . '/events/copy/' . $event['id'] , L10n::t('Duplicate event'), '', ''] : null; $copy = !$event['cid'] ? [DI::baseUrl() . '/events/copy/' . $event['id'] , L10n::t('Duplicate event'), '', ''] : null;
$drop = [System::baseUrl() . '/events/drop/' . $event['id'] , L10n::t('Delete event') , '', '']; $drop = [DI::baseUrl() . '/events/drop/' . $event['id'] , L10n::t('Delete event') , '', ''];
} }
$title = BBCode::convert(Strings::escapeHtml($event['summary'])); $title = BBCode::convert(Strings::escapeHtml($event['summary']));

View file

@ -12,8 +12,8 @@ use Friendica\Core\Config;
use Friendica\Core\Logger; use Friendica\Core\Logger;
use Friendica\Core\Protocol; use Friendica\Core\Protocol;
use Friendica\Core\System; use Friendica\Core\System;
use Friendica\Core\Worker;
use Friendica\Database\DBA; use Friendica\Database\DBA;
use Friendica\DI;
use Friendica\Network\Probe; use Friendica\Network\Probe;
use Friendica\Protocol\ActivityPub; use Friendica\Protocol\ActivityPub;
use Friendica\Protocol\PortableContact; use Friendica\Protocol\PortableContact;
@ -149,7 +149,7 @@ class GContact
} }
// The global contacts should contain the original picture, not the cached one // The global contacts should contain the original picture, not the cached one
if (($gcontact['generation'] != 1) && stristr(Strings::normaliseLink($gcontact['photo']), Strings::normaliseLink(System::baseUrl() . '/photo/'))) { if (($gcontact['generation'] != 1) && stristr(Strings::normaliseLink($gcontact['photo']), Strings::normaliseLink(DI::baseUrl() . '/photo/'))) {
$gcontact['photo'] = ''; $gcontact['photo'] = '';
} }
@ -503,9 +503,9 @@ class GContact
$done = []; $done = [];
/// @TODO Check if it is really neccessary to poll the own server /// @TODO Check if it is really neccessary to poll the own server
PortableContact::loadWorker(0, 0, 0, System::baseUrl() . '/poco'); PortableContact::loadWorker(0, 0, 0, DI::baseUrl() . '/poco');
$done[] = System::baseUrl() . '/poco'; $done[] = DI::baseUrl() . '/poco';
if (strlen(Config::get('system', 'directory'))) { if (strlen(Config::get('system', 'directory'))) {
$x = Network::fetchUrl(get_server() . '/pubsites'); $x = Network::fetchUrl(get_server() . '/pubsites');
@ -1122,7 +1122,7 @@ class GContact
"notify" => $userdata['notify'], 'url' => $userdata['url'], "notify" => $userdata['notify'], 'url' => $userdata['url'],
"hide" => ($userdata['hidewall'] || !$userdata['net-publish']), "hide" => ($userdata['hidewall'] || !$userdata['net-publish']),
'nick' => $userdata['nickname'], 'addr' => $userdata['addr'], 'nick' => $userdata['nickname'], 'addr' => $userdata['addr'],
"connect" => $userdata['addr'], "server_url" => System::baseUrl(), "connect" => $userdata['addr'], "server_url" => DI::baseUrl(),
"generation" => 1, 'network' => Protocol::DFRN]; "generation" => 1, 'network' => Protocol::DFRN];
self::update($gcontact); self::update($gcontact);
@ -1182,7 +1182,7 @@ class GContact
'addr' => $user->nickname . '@' . $hostname, 'addr' => $user->nickname . '@' . $hostname,
'nick' => $user->nickname, 'nick' => $user->nickname,
"network" => Protocol::OSTATUS, "network" => Protocol::OSTATUS,
'photo' => System::baseUrl() . '/images/person-300.jpg']; 'photo' => DI::baseUrl() . '/images/person-300.jpg'];
if (isset($user->bio)) { if (isset($user->bio)) {
$contact['about'] = $user->bio; $contact['about'] = $user->bio;

View file

@ -1564,7 +1564,7 @@ class Item
$item['edited'] = DateTimeFormat::utcNow(); $item['edited'] = DateTimeFormat::utcNow();
} }
$item['plink'] = ($item['plink'] ?? '') ?: System::baseUrl() . '/display/' . urlencode($item['guid']); $item['plink'] = ($item['plink'] ?? '') ?: DI::baseUrl() . '/display/' . urlencode($item['guid']);
$default = ['url' => $item['author-link'], 'name' => $item['author-name'], $default = ['url' => $item['author-link'], 'name' => $item['author-name'],
'photo' => $item['author-avatar'], 'network' => $item['network']]; 'photo' => $item['author-avatar'], 'network' => $item['network']];
@ -2592,10 +2592,10 @@ class Item
// All hashtags should point to the home server if "local_tags" is activated // All hashtags should point to the home server if "local_tags" is activated
if (Config::get('system', 'local_tags')) { if (Config::get('system', 'local_tags')) {
$item["body"] = preg_replace("/#\[url\=([$URLSearchString]*)\](.*?)\[\/url\]/ism", $item["body"] = preg_replace("/#\[url\=([$URLSearchString]*)\](.*?)\[\/url\]/ism",
"#[url=".System::baseUrl()."/search?tag=$2]$2[/url]", $item["body"]); "#[url=".DI::baseUrl()."/search?tag=$2]$2[/url]", $item["body"]);
$item["tag"] = preg_replace("/#\[url\=([$URLSearchString]*)\](.*?)\[\/url\]/ism", $item["tag"] = preg_replace("/#\[url\=([$URLSearchString]*)\](.*?)\[\/url\]/ism",
"#[url=".System::baseUrl()."/search?tag=$2]$2[/url]", $item["tag"]); "#[url=".DI::baseUrl()."/search?tag=$2]$2[/url]", $item["tag"]);
} }
// mask hashtags inside of url, bookmarks and attachments to avoid urls in urls // mask hashtags inside of url, bookmarks and attachments to avoid urls in urls
@ -2624,7 +2624,7 @@ class Item
} }
$basetag = str_replace('_',' ',substr($tag,1)); $basetag = str_replace('_',' ',substr($tag,1));
$newtag = '#[url=' . System::baseUrl() . '/search?tag=' . $basetag . ']' . $basetag . '[/url]'; $newtag = '#[url=' . DI::baseUrl() . '/search?tag=' . $basetag . ']' . $basetag . '[/url]';
$item["body"] = str_replace($tag, $newtag, $item["body"]); $item["body"] = str_replace($tag, $newtag, $item["body"]);
@ -2676,13 +2676,13 @@ class Item
return false; return false;
} }
$link = Strings::normaliseLink(System::baseUrl() . '/profile/' . $user['nickname']); $link = Strings::normaliseLink(DI::baseUrl() . '/profile/' . $user['nickname']);
/* /*
* Diaspora uses their own hardwired link URL in @-tags * Diaspora uses their own hardwired link URL in @-tags
* instead of the one we supply with webfinger * instead of the one we supply with webfinger
*/ */
$dlink = Strings::normaliseLink(System::baseUrl() . '/u/' . $user['nickname']); $dlink = Strings::normaliseLink(DI::baseUrl() . '/u/' . $user['nickname']);
$cnt = preg_match_all('/[\@\!]\[url\=(.*?)\](.*?)\[\/url\]/ism', $item['body'], $matches, PREG_SET_ORDER); $cnt = preg_match_all('/[\@\!]\[url\=(.*?)\](.*?)\[\/url\]/ism', $item['body'], $matches, PREG_SET_ORDER);
if ($cnt) { if ($cnt) {
@ -2852,7 +2852,7 @@ class Item
} }
Logger::log('check for photos', Logger::DEBUG); Logger::log('check for photos', Logger::DEBUG);
$site = substr(System::baseUrl(), strpos(System::baseUrl(), '://')); $site = substr(DI::baseUrl(), strpos(DI::baseUrl(), '://'));
$orig_body = $s; $orig_body = $s;
$new_body = ''; $new_body = '';

View file

@ -9,6 +9,7 @@ use Friendica\Core\L10n;
use Friendica\Core\Logger; use Friendica\Core\Logger;
use Friendica\Core\System; use Friendica\Core\System;
use Friendica\Core\Worker; use Friendica\Core\Worker;
use Friendica\DI;
use Friendica\Model\Item; use Friendica\Model\Item;
use Friendica\Model\Photo; use Friendica\Model\Photo;
use Friendica\Database\DBA; use Friendica\Database\DBA;
@ -148,7 +149,7 @@ class Mail
$recip_host = substr($recip_host, 0, strpos($recip_host, '/')); $recip_host = substr($recip_host, 0, strpos($recip_host, '/'));
$recip_handle = (($contact['addr']) ? $contact['addr'] : $contact['nick'] . '@' . $recip_host); $recip_handle = (($contact['addr']) ? $contact['addr'] : $contact['nick'] . '@' . $recip_host);
$sender_handle = $a->user['nickname'] . '@' . substr(System::baseUrl(), strpos(System::baseUrl(), '://') + 3); $sender_handle = $a->user['nickname'] . '@' . substr(DI::baseUrl(), strpos(DI::baseUrl(), '://') + 3);
$conv_guid = System::createUUID(); $conv_guid = System::createUUID();
$convuri = $recip_handle . ':' . $conv_guid; $convuri = $recip_handle . ':' . $conv_guid;
@ -214,7 +215,7 @@ class Mail
$images = $match[1]; $images = $match[1];
if (count($images)) { if (count($images)) {
foreach ($images as $image) { foreach ($images as $image) {
if (!stristr($image, System::baseUrl() . '/photo/')) { if (!stristr($image, DI::baseUrl() . '/photo/')) {
continue; continue;
} }
$image_uri = substr($image, strrpos($image, '/') + 1); $image_uri = substr($image, strrpos($image, '/') + 1);
@ -262,7 +263,7 @@ class Mail
$conv_guid = System::createUUID(); $conv_guid = System::createUUID();
$recip_handle = $recipient['nickname'] . '@' . substr(System::baseUrl(), strpos(System::baseUrl(), '://') + 3); $recip_handle = $recipient['nickname'] . '@' . substr(DI::baseUrl(), strpos(DI::baseUrl(), '://') + 3);
$sender_nick = basename($replyto); $sender_nick = basename($replyto);
$sender_host = substr($replyto, strpos($replyto, '://') + 3); $sender_host = substr($replyto, strpos($replyto, '://') + 3);

View file

@ -456,9 +456,9 @@ class Photo
$suffix = "?ts=" . time(); $suffix = "?ts=" . time();
$image_url = System::baseUrl() . "/photo/" . $resource_id . "-4." . $Image->getExt() . $suffix; $image_url = DI::baseUrl() . "/photo/" . $resource_id . "-4." . $Image->getExt() . $suffix;
$thumb = System::baseUrl() . "/photo/" . $resource_id . "-5." . $Image->getExt() . $suffix; $thumb = DI::baseUrl() . "/photo/" . $resource_id . "-5." . $Image->getExt() . $suffix;
$micro = System::baseUrl() . "/photo/" . $resource_id . "-6." . $Image->getExt() . $suffix; $micro = DI::baseUrl() . "/photo/" . $resource_id . "-6." . $Image->getExt() . $suffix;
// Remove the cached photo // Remove the cached photo
$a = \get_app(); $a = \get_app();
@ -487,9 +487,9 @@ class Photo
} }
if ($photo_failure) { if ($photo_failure) {
$image_url = System::baseUrl() . "/images/person-300.jpg"; $image_url = DI::baseUrl() . "/images/person-300.jpg";
$thumb = System::baseUrl() . "/images/person-80.jpg"; $thumb = DI::baseUrl() . "/images/person-80.jpg";
$micro = System::baseUrl() . "/images/person-48.jpg"; $micro = DI::baseUrl() . "/images/person-48.jpg";
} }
return [$image_url, $thumb, $micro]; return [$image_url, $thumb, $micro];
@ -622,7 +622,7 @@ class Photo
} }
foreach ($images as $image) { foreach ($images as $image) {
if (!stristr($image, System::baseUrl() . '/photo/')) { if (!stristr($image, DI::baseUrl() . '/photo/')) {
continue; continue;
} }
$image_uri = substr($image,strrpos($image,'/') + 1); $image_uri = substr($image,strrpos($image,'/') + 1);

View file

@ -20,8 +20,6 @@ use Friendica\Core\Protocol;
use Friendica\Core\Renderer; use Friendica\Core\Renderer;
use Friendica\Core\Session; use Friendica\Core\Session;
use Friendica\Core\System; use Friendica\Core\System;
use Friendica\Core\Theme;
use Friendica\Core\Worker;
use Friendica\Database\DBA; use Friendica\Database\DBA;
use Friendica\DI; use Friendica\DI;
use Friendica\Protocol\Activity; use Friendica\Protocol\Activity;
@ -396,7 +394,7 @@ class Profile
// show edit profile to yourself // show edit profile to yourself
if (!$is_contact && $local_user_is_self) { if (!$is_contact && $local_user_is_self) {
if (Feature::isEnabled(local_user(), 'multi_profiles')) { if (Feature::isEnabled(local_user(), 'multi_profiles')) {
$profile['edit'] = [System::baseUrl() . '/profiles', L10n::t('Profiles'), '', L10n::t('Manage/edit profiles')]; $profile['edit'] = [DI::baseUrl() . '/profiles', L10n::t('Profiles'), '', L10n::t('Manage/edit profiles')];
$r = q( $r = q(
"SELECT * FROM `profile` WHERE `uid` = %d", "SELECT * FROM `profile` WHERE `uid` = %d",
local_user() local_user()
@ -422,7 +420,7 @@ class Profile
} }
} }
} else { } else {
$profile['edit'] = [System::baseUrl() . '/profiles/' . $profile['id'], L10n::t('Edit profile'), '', L10n::t('Edit profile')]; $profile['edit'] = [DI::baseUrl() . '/profiles/' . $profile['id'], L10n::t('Edit profile'), '', L10n::t('Edit profile')];
$profile['menu'] = [ $profile['menu'] = [
'chg_photo' => L10n::t('Change profile photo'), 'chg_photo' => L10n::t('Change profile photo'),
'cr_new' => null, 'cr_new' => null,
@ -461,7 +459,7 @@ class Profile
if (!empty($profile['guid'])) { if (!empty($profile['guid'])) {
$diaspora = [ $diaspora = [
'guid' => $profile['guid'], 'guid' => $profile['guid'],
'podloc' => System::baseUrl(), 'podloc' => DI::baseUrl(),
'searchable' => (($profile['publish'] && $profile['net-publish']) ? 'true' : 'false'), 'searchable' => (($profile['publish'] && $profile['net-publish']) ? 'true' : 'false'),
'nickname' => $profile['nickname'], 'nickname' => $profile['nickname'],
'fullname' => $profile['name'], 'fullname' => $profile['name'],
@ -879,7 +877,7 @@ class Profile
} }
if ($a->profile['uid'] == local_user()) { if ($a->profile['uid'] == local_user()) {
$profile['edit'] = [System::baseUrl() . '/profiles/' . $a->profile['id'], L10n::t('Edit profile'), '', L10n::t('Edit profile')]; $profile['edit'] = [DI::baseUrl() . '/profiles/' . $a->profile['id'], L10n::t('Edit profile'), '', L10n::t('Edit profile')];
} }
return Renderer::replaceMacros($tpl, [ return Renderer::replaceMacros($tpl, [
@ -907,7 +905,7 @@ class Profile
$nickname = $a->user['nickname']; $nickname = $a->user['nickname'];
} }
$baseProfileUrl = System::baseUrl() . '/profile/' . $nickname; $baseProfileUrl = DI::baseUrl() . '/profile/' . $nickname;
$tabs = [ $tabs = [
[ [
@ -928,7 +926,7 @@ class Profile
], ],
[ [
'label' => L10n::t('Photos'), 'label' => L10n::t('Photos'),
'url' => System::baseUrl() . '/photos/' . $nickname, 'url' => DI::baseUrl() . '/photos/' . $nickname,
'sel' => $current == 'photos' ? 'active' : '', 'sel' => $current == 'photos' ? 'active' : '',
'title' => L10n::t('Photo Albums'), 'title' => L10n::t('Photo Albums'),
'id' => 'photo-tab', 'id' => 'photo-tab',
@ -936,7 +934,7 @@ class Profile
], ],
[ [
'label' => L10n::t('Videos'), 'label' => L10n::t('Videos'),
'url' => System::baseUrl() . '/videos/' . $nickname, 'url' => DI::baseUrl() . '/videos/' . $nickname,
'sel' => $current == 'videos' ? 'active' : '', 'sel' => $current == 'videos' ? 'active' : '',
'title' => L10n::t('Videos'), 'title' => L10n::t('Videos'),
'id' => 'video-tab', 'id' => 'video-tab',
@ -948,7 +946,7 @@ class Profile
if ($is_owner && $a->theme_events_in_profile) { if ($is_owner && $a->theme_events_in_profile) {
$tabs[] = [ $tabs[] = [
'label' => L10n::t('Events'), 'label' => L10n::t('Events'),
'url' => System::baseUrl() . '/events', 'url' => DI::baseUrl() . '/events',
'sel' => $current == 'events' ? 'active' : '', 'sel' => $current == 'events' ? 'active' : '',
'title' => L10n::t('Events and Calendar'), 'title' => L10n::t('Events and Calendar'),
'id' => 'events-tab', 'id' => 'events-tab',
@ -959,7 +957,7 @@ class Profile
} elseif (!$is_owner) { } elseif (!$is_owner) {
$tabs[] = [ $tabs[] = [
'label' => L10n::t('Events'), 'label' => L10n::t('Events'),
'url' => System::baseUrl() . '/cal/' . $nickname, 'url' => DI::baseUrl() . '/cal/' . $nickname,
'sel' => $current == 'cal' ? 'active' : '', 'sel' => $current == 'cal' ? 'active' : '',
'title' => L10n::t('Events and Calendar'), 'title' => L10n::t('Events and Calendar'),
'id' => 'events-tab', 'id' => 'events-tab',
@ -970,7 +968,7 @@ class Profile
if ($is_owner) { if ($is_owner) {
$tabs[] = [ $tabs[] = [
'label' => L10n::t('Personal Notes'), 'label' => L10n::t('Personal Notes'),
'url' => System::baseUrl() . '/notes', 'url' => DI::baseUrl() . '/notes',
'sel' => $current == 'notes' ? 'active' : '', 'sel' => $current == 'notes' ? 'active' : '',
'title' => L10n::t('Only You Can See This'), 'title' => L10n::t('Only You Can See This'),
'id' => 'notes-tab', 'id' => 'notes-tab',
@ -981,7 +979,7 @@ class Profile
if (!empty($_SESSION['new_member']) && $is_owner) { if (!empty($_SESSION['new_member']) && $is_owner) {
$tabs[] = [ $tabs[] = [
'label' => L10n::t('Tips for New Members'), 'label' => L10n::t('Tips for New Members'),
'url' => System::baseUrl() . '/newmember', 'url' => DI::baseUrl() . '/newmember',
'sel' => false, 'sel' => false,
'title' => L10n::t('Tips for New Members'), 'title' => L10n::t('Tips for New Members'),
'id' => 'newmember-tab', 'id' => 'newmember-tab',

View file

@ -6,8 +6,8 @@ namespace Friendica\Model;
use Friendica\Core\Cache; use Friendica\Core\Cache;
use Friendica\Core\Logger; use Friendica\Core\Logger;
use Friendica\Core\System;
use Friendica\Database\DBA; use Friendica\Database\DBA;
use Friendica\DI;
use Friendica\Util\Strings; use Friendica\Util\Strings;
/** /**
@ -208,7 +208,7 @@ class Term
*/ */
public static function insertFromTagFieldByItemId($item_id, $tag_str) public static function insertFromTagFieldByItemId($item_id, $tag_str)
{ {
$profile_base = System::baseUrl(); $profile_base = DI::baseUrl();
$profile_data = parse_url($profile_base); $profile_data = parse_url($profile_base);
$profile_path = $profile_data['path'] ?? ''; $profile_path = $profile_data['path'] ?? '';
$profile_base_friendica = $profile_data['host'] . $profile_path . '/profile/'; $profile_base_friendica = $profile_data['host'] . $profile_path . '/profile/';
@ -425,7 +425,7 @@ class Term
'implicit_mentions' => [], 'implicit_mentions' => [],
]; ];
$searchpath = System::baseUrl() . "/search?tag="; $searchpath = DI::baseUrl() . "/search?tag=";
$taglist = DBA::select( $taglist = DBA::select(
'term', 'term',

View file

@ -217,12 +217,12 @@ class User
// Check if the returned data is valid, otherwise fix it. See issue #6122 // Check if the returned data is valid, otherwise fix it. See issue #6122
// Check for correct url and normalised nurl // Check for correct url and normalised nurl
$url = System::baseUrl() . '/profile/' . $r['nickname']; $url = DI::baseUrl() . '/profile/' . $r['nickname'];
$repair = ($r['url'] != $url) || ($r['nurl'] != Strings::normaliseLink($r['url'])); $repair = ($r['url'] != $url) || ($r['nurl'] != Strings::normaliseLink($r['url']));
if (!$repair) { if (!$repair) {
// Check if "addr" is present and correct // Check if "addr" is present and correct
$addr = $r['nickname'] . '@' . substr(System::baseUrl(), strpos(System::baseUrl(), '://') + 3); $addr = $r['nickname'] . '@' . substr(DI::baseUrl(), strpos(DI::baseUrl(), '://') + 3);
$repair = ($addr != $r['addr']); $repair = ($addr != $r['addr']);
} }
@ -635,7 +635,7 @@ class User
$openid = new LightOpenID(DI::baseUrl()->getHostname()); $openid = new LightOpenID(DI::baseUrl()->getHostname());
$openid->identity = $openid_url; $openid->identity = $openid_url;
$openid->returnUrl = System::baseUrl() . '/openid'; $openid->returnUrl = DI::baseUrl() . '/openid';
$openid->required = ['namePerson/friendly', 'contact/email', 'namePerson']; $openid->required = ['namePerson/friendly', 'contact/email', 'namePerson'];
$openid->optional = ['namePerson/first', 'media/image/aspect11', 'media/image/default']; $openid->optional = ['namePerson/first', 'media/image/aspect11', 'media/image/default'];
try { try {
@ -782,8 +782,8 @@ class User
$insert_result = DBA::insert('profile', [ $insert_result = DBA::insert('profile', [
'uid' => $uid, 'uid' => $uid,
'name' => $username, 'name' => $username,
'photo' => System::baseUrl() . "/photo/profile/{$uid}.jpg", 'photo' => DI::baseUrl() . "/photo/profile/{$uid}.jpg",
'thumb' => System::baseUrl() . "/photo/avatar/{$uid}.jpg", 'thumb' => DI::baseUrl() . "/photo/avatar/{$uid}.jpg",
'publish' => $publish, 'publish' => $publish,
'is-default' => 1, 'is-default' => 1,
'net-publish' => $netpublish, 'net-publish' => $netpublish,

View file

@ -14,7 +14,6 @@ use Friendica\Core\Hook;
use Friendica\Core\L10n; use Friendica\Core\L10n;
use Friendica\Core\Protocol; use Friendica\Core\Protocol;
use Friendica\Core\Renderer; use Friendica\Core\Renderer;
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\DI;
@ -970,7 +969,7 @@ class Contact extends BaseModule
$profiledata = Model\Contact::getDetailsByURL($contact['url']); $profiledata = Model\Contact::getDetailsByURL($contact['url']);
if (local_user() && in_array($profiledata['network'], Protocol::FEDERATED)) { if (local_user() && in_array($profiledata['network'], Protocol::FEDERATED)) {
$profiledata['remoteconnect'] = System::baseUrl() . '/follow?url=' . urlencode($profiledata['url']); $profiledata['remoteconnect'] = DI::baseUrl() . '/follow?url=' . urlencode($profiledata['url']);
} }
Model\Profile::load($a, '', 0, $profiledata, true); Model\Profile::load($a, '', 0, $profiledata, true);

View file

@ -5,7 +5,6 @@
namespace Friendica\Module; namespace Friendica\Module;
use Friendica\BaseModule; use Friendica\BaseModule;
use Friendica\Core\System;
use Friendica\Database\DBA; use Friendica\Database\DBA;
use Friendica\DI; use Friendica\DI;
use Friendica\Model\Item; use Friendica\Model\Item;
@ -38,7 +37,7 @@ class Objects extends BaseModule
// If no original post could be found, it could possibly be a forum post, there we remove the "origin" field. // If no original post could be found, it could possibly be a forum post, there we remove the "origin" field.
// @TODO: Replace with parameter from router // @TODO: Replace with parameter from router
$item = Item::selectFirst(['id', 'author-link'], ['guid' => $a->argv[1], 'private' => false]); $item = Item::selectFirst(['id', 'author-link'], ['guid' => $a->argv[1], 'private' => false]);
if (!DBA::isResult($item) || !strstr($item['author-link'], System::baseUrl())) { if (!DBA::isResult($item) || !strstr($item['author-link'], DI::baseUrl())) {
throw new \Friendica\Network\HTTPException\NotFoundException(); throw new \Friendica\Network\HTTPException\NotFoundException();
} }
} }

View file

@ -118,19 +118,19 @@ class Profile extends BaseModule
$page['htmlhead'] .= '<meta content="noindex, noarchive" name="robots" />' . "\n"; $page['htmlhead'] .= '<meta content="noindex, noarchive" name="robots" />' . "\n";
} }
$page['htmlhead'] .= '<link rel="alternate" type="application/atom+xml" href="' . System::baseUrl() . '/dfrn_poll/' . self::$which . '" title="DFRN: ' . L10n::t('%s\'s timeline', $a->profile['username']) . '"/>' . "\n"; $page['htmlhead'] .= '<link rel="alternate" type="application/atom+xml" href="' . DI::baseUrl() . '/dfrn_poll/' . self::$which . '" title="DFRN: ' . L10n::t('%s\'s timeline', $a->profile['username']) . '"/>' . "\n";
$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"; $page['htmlhead'] .= '<link rel="alternate" type="application/atom+xml" href="' . DI::baseUrl() . '/feed/' . self::$which . '/" title="' . L10n::t('%s\'s posts', $a->profile['username']) . '"/>' . "\n";
$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"; $page['htmlhead'] .= '<link rel="alternate" type="application/atom+xml" href="' . DI::baseUrl() . '/feed/' . self::$which . '/comments" title="' . L10n::t('%s\'s comments', $a->profile['username']) . '"/>' . "\n";
$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"; $page['htmlhead'] .= '<link rel="alternate" type="application/atom+xml" href="' . DI::baseUrl() . '/feed/' . self::$which . '/activity" title="' . L10n::t('%s\'s timeline', $a->profile['username']) . '"/>' . "\n";
$uri = urlencode('acct:' . $a->profile['nickname'] . '@' . DI::baseUrl()->getHostname() . (DI::baseUrl()->getUrlPath() ? '/' . DI::baseUrl()->getUrlPath() : '')); $uri = urlencode('acct:' . $a->profile['nickname'] . '@' . DI::baseUrl()->getHostname() . (DI::baseUrl()->getUrlPath() ? '/' . DI::baseUrl()->getUrlPath() : ''));
$page['htmlhead'] .= '<link rel="lrdd" type="application/xrd+xml" href="' . System::baseUrl() . '/xrd/?uri=' . $uri . '" />' . "\n"; $page['htmlhead'] .= '<link rel="lrdd" type="application/xrd+xml" href="' . DI::baseUrl() . '/xrd/?uri=' . $uri . '" />' . "\n";
header('Link: <' . System::baseUrl() . '/xrd/?uri=' . $uri . '>; rel="lrdd"; type="application/xrd+xml"', false); header('Link: <' . DI::baseUrl() . '/xrd/?uri=' . $uri . '>; rel="lrdd"; type="application/xrd+xml"', false);
$dfrn_pages = ['request', 'confirm', 'notify', 'poll']; $dfrn_pages = ['request', 'confirm', 'notify', 'poll'];
foreach ($dfrn_pages as $dfrn) { foreach ($dfrn_pages as $dfrn) {
$page['htmlhead'] .= '<link rel="dfrn-' . $dfrn . '" href="' . System::baseUrl() . '/dfrn_' . $dfrn . '/' . self::$which . '" />' . "\n"; $page['htmlhead'] .= '<link rel="dfrn-' . $dfrn . '" href="' . DI::baseUrl() . '/dfrn_' . $dfrn . '/' . self::$which . '" />' . "\n";
} }
$page['htmlhead'] .= '<link rel="dfrn-poco" href="' . System::baseUrl() . '/poco/' . self::$which . '" />' . "\n"; $page['htmlhead'] .= '<link rel="dfrn-poco" href="' . DI::baseUrl() . '/poco/' . self::$which . '" />' . "\n";
} }
$category = $datequery = $datequery2 = ''; $category = $datequery = $datequery2 = '';
@ -193,8 +193,8 @@ class Profile extends BaseModule
$commpage = $a->profile['page-flags'] == User::PAGE_FLAGS_COMMUNITY; $commpage = $a->profile['page-flags'] == User::PAGE_FLAGS_COMMUNITY;
$commvisitor = $commpage && $remote_contact; $commvisitor = $commpage && $remote_contact;
DI::page()['aside'] .= Widget::postedByYear(System::baseUrl(true) . '/profile/' . $a->profile['nickname'], $a->profile['profile_uid'] ?? 0, true); DI::page()['aside'] .= Widget::postedByYear(DI::baseUrl()->get(true) . '/profile/' . $a->profile['nickname'], $a->profile['profile_uid'] ?? 0, true);
DI::page()['aside'] .= Widget::categories(System::baseUrl(true) . '/profile/' . $a->profile['nickname'], XML::escape($category)); DI::page()['aside'] .= Widget::categories(DI::baseUrl()->get(true) . '/profile/' . $a->profile['nickname'], XML::escape($category));
DI::page()['aside'] .= Widget::tagCloud(); DI::page()['aside'] .= Widget::tagCloud();
if (Security::canWriteToUserWall($a->profile['profile_uid'])) { if (Security::canWriteToUserWall($a->profile['profile_uid'])) {

View file

@ -8,7 +8,6 @@ use Friendica\Core\L10n;
use Friendica\Core\Protocol; use Friendica\Core\Protocol;
use Friendica\Core\Renderer; use Friendica\Core\Renderer;
use Friendica\Core\Session; use Friendica\Core\Session;
use Friendica\Core\System;
use Friendica\Database\DBA; use Friendica\Database\DBA;
use Friendica\DI; use Friendica\DI;
use Friendica\Model\User; use Friendica\Model\User;
@ -71,7 +70,7 @@ class Delegation extends BaseSettingsModule
if (DBA::isResult($user)) { if (DBA::isResult($user)) {
$condition = [ $condition = [
'uid' => local_user(), 'uid' => local_user(),
'nurl' => Strings::normaliseLink(System::baseUrl() . '/profile/' . $user['nickname']) 'nurl' => Strings::normaliseLink(DI::baseUrl() . '/profile/' . $user['nickname'])
]; ];
if (DBA::exists('contact', $condition)) { if (DBA::exists('contact', $condition)) {
DBA::insert('manage', ['uid' => $user_id, 'mid' => local_user()]); DBA::insert('manage', ['uid' => $user_id, 'mid' => local_user()]);
@ -109,7 +108,7 @@ class Delegation extends BaseSettingsModule
['nurl'], ['nurl'],
[ [
"`self` = 0 AND SUBSTRING_INDEX(`nurl`, '/', 3) = ? AND `uid` = ? AND `network` = ?", "`self` = 0 AND SUBSTRING_INDEX(`nurl`, '/', 3) = ? AND `uid` = ? AND `network` = ?",
Strings::normaliseLink(System::baseUrl()), Strings::normaliseLink(DI::baseUrl()),
local_user(), local_user(),
Protocol::DFRN, Protocol::DFRN,
] ]
@ -158,7 +157,7 @@ class Delegation extends BaseSettingsModule
'$submit' => L10n::t('Save Settings'), '$submit' => L10n::t('Save Settings'),
'$header' => L10n::t('Delegate Page Management'), '$header' => L10n::t('Delegate Page Management'),
'$delegates_header' => L10n::t('Delegates'), '$delegates_header' => L10n::t('Delegates'),
'$base' => System::baseUrl(), '$base' => DI::baseUrl(),
'$desc' => L10n::t('Delegates are able to manage all aspects of this account/page except for basic account settings. Please do not delegate your personal account to anybody that you do not trust completely.'), '$desc' => L10n::t('Delegates are able to manage all aspects of this account/page except for basic account settings. Please do not delegate your personal account to anybody that you do not trust completely.'),
'$head_delegates' => L10n::t('Existing Page Delegates'), '$head_delegates' => L10n::t('Existing Page Delegates'),
'$delegates' => $delegates, '$delegates' => $delegates,

View file

@ -6,12 +6,9 @@
namespace Friendica\Module\Settings; namespace Friendica\Module\Settings;
use Friendica\App; use Friendica\App;
use Friendica\App\Arguments;
use Friendica\BaseModule;
use Friendica\Core\Hook; use Friendica\Core\Hook;
use Friendica\Core\L10n; use Friendica\Core\L10n;
use Friendica\Core\Renderer; use Friendica\Core\Renderer;
use Friendica\Core\System;
use Friendica\Database\DBA; use Friendica\Database\DBA;
use Friendica\Database\DBStructure; use Friendica\Database\DBStructure;
use Friendica\DI; use Friendica\DI;
@ -196,7 +193,7 @@ class UserExport extends BaseSettingsModule
$output = [ $output = [
'version' => FRIENDICA_VERSION, 'version' => FRIENDICA_VERSION,
'schema' => DB_UPDATE_VERSION, 'schema' => DB_UPDATE_VERSION,
'baseurl' => System::baseUrl(), 'baseurl' => DI::baseUrl(),
'user' => $user, 'user' => $user,
'contact' => $contact, 'contact' => $contact,
'profile' => $profile, 'profile' => $profile,

View file

@ -12,7 +12,6 @@ use Friendica\BaseModule;
use Friendica\Core\Config; use Friendica\Core\Config;
use Friendica\Core\L10n; use Friendica\Core\L10n;
use Friendica\Core\Renderer; use Friendica\Core\Renderer;
use Friendica\Core\System;
use Friendica\Content\Text\BBCode; use Friendica\Content\Text\BBCode;
use Friendica\DI; use Friendica\DI;
@ -35,7 +34,7 @@ class Tos extends BaseModule
{ {
$this->privacy_operate = L10n::t('At the time of registration, and for providing communications between the user account and their contacts, the user has to provide a display name (pen name), an username (nickname) and a working email address. The names will be accessible on the profile page of the account by any visitor of the page, even if other profile details are not displayed. The email address will only be used to send the user notifications about interactions, but wont be visibly displayed. The listing of an account in the node\'s user directory or the global user directory is optional and can be controlled in the user settings, it is not necessary for communication.'); $this->privacy_operate = L10n::t('At the time of registration, and for providing communications between the user account and their contacts, the user has to provide a display name (pen name), an username (nickname) and a working email address. The names will be accessible on the profile page of the account by any visitor of the page, even if other profile details are not displayed. The email address will only be used to send the user notifications about interactions, but wont be visibly displayed. The listing of an account in the node\'s user directory or the global user directory is optional and can be controlled in the user settings, it is not necessary for communication.');
$this->privacy_distribute = L10n::t('This data is required for communication and is passed on to the nodes of the communication partners and is stored there. Users can enter additional private data that may be transmitted to the communication partners accounts.'); $this->privacy_distribute = L10n::t('This data is required for communication and is passed on to the nodes of the communication partners and is stored there. Users can enter additional private data that may be transmitted to the communication partners accounts.');
$this->privacy_delete = L10n::t('At any point in time a logged in user can export their account data from the <a href="%1$s/settings/userexport">account settings</a>. If the user wants to delete their account they can do so at <a href="%1$s/removeme">%1$s/removeme</a>. The deletion of the account will be permanent. Deletion of the data will also be requested from the nodes of the communication partners.', System::baseurl()); $this->privacy_delete = L10n::t('At any point in time a logged in user can export their account data from the <a href="%1$s/settings/userexport">account settings</a>. If the user wants to delete their account they can do so at <a href="%1$s/removeme">%1$s/removeme</a>. The deletion of the account will be permanent. Deletion of the data will also be requested from the nodes of the communication partners.', DI::baseurl());
// In some cases we don't need every single one of the above separate, but all in one block. // In some cases we don't need every single one of the above separate, but all in one block.
// So here is an array to look over // So here is an array to look over
$this->privacy_complete = [L10n::t('Privacy Statement'), $this->privacy_operate, $this->privacy_distribute, $this->privacy_delete]; $this->privacy_complete = [L10n::t('Privacy Statement'), $this->privacy_operate, $this->privacy_distribute, $this->privacy_delete];
@ -77,7 +76,7 @@ class Tos extends BaseModule
'$privstatementtitle' => L10n::t('Privacy Statement'), '$privstatementtitle' => L10n::t('Privacy Statement'),
'$privacy_operate' => L10n::t('At the time of registration, and for providing communications between the user account and their contacts, the user has to provide a display name (pen name), an username (nickname) and a working email address. The names will be accessible on the profile page of the account by any visitor of the page, even if other profile details are not displayed. The email address will only be used to send the user notifications about interactions, but wont be visibly displayed. The listing of an account in the node\'s user directory or the global user directory is optional and can be controlled in the user settings, it is not necessary for communication.'), '$privacy_operate' => L10n::t('At the time of registration, and for providing communications between the user account and their contacts, the user has to provide a display name (pen name), an username (nickname) and a working email address. The names will be accessible on the profile page of the account by any visitor of the page, even if other profile details are not displayed. The email address will only be used to send the user notifications about interactions, but wont be visibly displayed. The listing of an account in the node\'s user directory or the global user directory is optional and can be controlled in the user settings, it is not necessary for communication.'),
'$privacy_distribute' => L10n::t('This data is required for communication and is passed on to the nodes of the communication partners and is stored there. Users can enter additional private data that may be transmitted to the communication partners accounts.'), '$privacy_distribute' => L10n::t('This data is required for communication and is passed on to the nodes of the communication partners and is stored there. Users can enter additional private data that may be transmitted to the communication partners accounts.'),
'$privacy_delete' => L10n::t('At any point in time a logged in user can export their account data from the <a href="%1$s/settings/userexport">account settings</a>. If the user wants to delete their account they can do so at <a href="%1$s/removeme">%1$s/removeme</a>. The deletion of the account will be permanent. Deletion of the data will also be requested from the nodes of the communication partners.', System::baseurl()) '$privacy_delete' => L10n::t('At any point in time a logged in user can export their account data from the <a href="%1$s/settings/userexport">account settings</a>. If the user wants to delete their account they can do so at <a href="%1$s/removeme">%1$s/removeme</a>. The deletion of the account will be permanent. Deletion of the data will also be requested from the nodes of the communication partners.', DI::baseurl())
]); ]);
} else { } else {
return; return;

View file

@ -15,7 +15,6 @@ use Friendica\Core\Cache;
use Friendica\Core\Config; use Friendica\Core\Config;
use Friendica\Core\Logger; use Friendica\Core\Logger;
use Friendica\Core\Protocol; use Friendica\Core\Protocol;
use Friendica\Core\System;
use Friendica\Database\DBA; use Friendica\Database\DBA;
use Friendica\DI; use Friendica\DI;
use Friendica\Model\Contact; use Friendica\Model\Contact;
@ -373,7 +372,7 @@ class Probe
if (!empty($data['photo']) && !empty($data['baseurl'])) { if (!empty($data['photo']) && !empty($data['baseurl'])) {
$data['baseurl'] = Network::getUrlMatch(Strings::normaliseLink($data['baseurl']), Strings::normaliseLink($data['photo'])); $data['baseurl'] = Network::getUrlMatch(Strings::normaliseLink($data['baseurl']), Strings::normaliseLink($data['photo']));
} elseif (empty($data['photo'])) { } elseif (empty($data['photo'])) {
$data['photo'] = System::baseUrl() . '/images/person-300.jpg'; $data['photo'] = DI::baseUrl() . '/images/person-300.jpg';
} }
if (empty($data['name'])) { if (empty($data['name'])) {

View file

@ -60,7 +60,7 @@ class Transmitter
$count = DBA::count('contact', $condition); $count = DBA::count('contact', $condition);
$data = ['@context' => ActivityPub::CONTEXT]; $data = ['@context' => ActivityPub::CONTEXT];
$data['id'] = System::baseUrl() . '/followers/' . $owner['nickname']; $data['id'] = DI::baseUrl() . '/followers/' . $owner['nickname'];
$data['type'] = 'OrderedCollection'; $data['type'] = 'OrderedCollection';
$data['totalItems'] = $count; $data['totalItems'] = $count;
@ -71,7 +71,7 @@ class Transmitter
} }
if (empty($page)) { if (empty($page)) {
$data['first'] = System::baseUrl() . '/followers/' . $owner['nickname'] . '?page=1'; $data['first'] = DI::baseUrl() . '/followers/' . $owner['nickname'] . '?page=1';
} else { } else {
$data['type'] = 'OrderedCollectionPage'; $data['type'] = 'OrderedCollectionPage';
$list = []; $list = [];
@ -82,10 +82,10 @@ class Transmitter
} }
if (!empty($list)) { if (!empty($list)) {
$data['next'] = System::baseUrl() . '/followers/' . $owner['nickname'] . '?page=' . ($page + 1); $data['next'] = DI::baseUrl() . '/followers/' . $owner['nickname'] . '?page=' . ($page + 1);
} }
$data['partOf'] = System::baseUrl() . '/followers/' . $owner['nickname']; $data['partOf'] = DI::baseUrl() . '/followers/' . $owner['nickname'];
$data['orderedItems'] = $list; $data['orderedItems'] = $list;
} }
@ -109,7 +109,7 @@ class Transmitter
$count = DBA::count('contact', $condition); $count = DBA::count('contact', $condition);
$data = ['@context' => ActivityPub::CONTEXT]; $data = ['@context' => ActivityPub::CONTEXT];
$data['id'] = System::baseUrl() . '/following/' . $owner['nickname']; $data['id'] = DI::baseUrl() . '/following/' . $owner['nickname'];
$data['type'] = 'OrderedCollection'; $data['type'] = 'OrderedCollection';
$data['totalItems'] = $count; $data['totalItems'] = $count;
@ -120,7 +120,7 @@ class Transmitter
} }
if (empty($page)) { if (empty($page)) {
$data['first'] = System::baseUrl() . '/following/' . $owner['nickname'] . '?page=1'; $data['first'] = DI::baseUrl() . '/following/' . $owner['nickname'] . '?page=1';
} else { } else {
$data['type'] = 'OrderedCollectionPage'; $data['type'] = 'OrderedCollectionPage';
$list = []; $list = [];
@ -131,10 +131,10 @@ class Transmitter
} }
if (!empty($list)) { if (!empty($list)) {
$data['next'] = System::baseUrl() . '/following/' . $owner['nickname'] . '?page=' . ($page + 1); $data['next'] = DI::baseUrl() . '/following/' . $owner['nickname'] . '?page=' . ($page + 1);
} }
$data['partOf'] = System::baseUrl() . '/following/' . $owner['nickname']; $data['partOf'] = DI::baseUrl() . '/following/' . $owner['nickname'];
$data['orderedItems'] = $list; $data['orderedItems'] = $list;
} }
@ -162,12 +162,12 @@ class Transmitter
$count = DBA::count('item', $condition); $count = DBA::count('item', $condition);
$data = ['@context' => ActivityPub::CONTEXT]; $data = ['@context' => ActivityPub::CONTEXT];
$data['id'] = System::baseUrl() . '/outbox/' . $owner['nickname']; $data['id'] = DI::baseUrl() . '/outbox/' . $owner['nickname'];
$data['type'] = 'OrderedCollection'; $data['type'] = 'OrderedCollection';
$data['totalItems'] = $count; $data['totalItems'] = $count;
if (empty($page)) { if (empty($page)) {
$data['first'] = System::baseUrl() . '/outbox/' . $owner['nickname'] . '?page=1'; $data['first'] = DI::baseUrl() . '/outbox/' . $owner['nickname'] . '?page=1';
} else { } else {
$data['type'] = 'OrderedCollectionPage'; $data['type'] = 'OrderedCollectionPage';
$list = []; $list = [];
@ -184,10 +184,10 @@ class Transmitter
} }
if (!empty($list)) { if (!empty($list)) {
$data['next'] = System::baseUrl() . '/outbox/' . $owner['nickname'] . '?page=' . ($page + 1); $data['next'] = DI::baseUrl() . '/outbox/' . $owner['nickname'] . '?page=' . ($page + 1);
} }
$data['partOf'] = System::baseUrl() . '/outbox/' . $owner['nickname']; $data['partOf'] = DI::baseUrl() . '/outbox/' . $owner['nickname'];
$data['orderedItems'] = $list; $data['orderedItems'] = $list;
} }
@ -240,10 +240,10 @@ class Transmitter
$data['id'] = $contact['url']; $data['id'] = $contact['url'];
$data['diaspora:guid'] = $user['guid']; $data['diaspora:guid'] = $user['guid'];
$data['type'] = ActivityPub::ACCOUNT_TYPES[$user['account-type']]; $data['type'] = ActivityPub::ACCOUNT_TYPES[$user['account-type']];
$data['following'] = System::baseUrl() . '/following/' . $user['nickname']; $data['following'] = DI::baseUrl() . '/following/' . $user['nickname'];
$data['followers'] = System::baseUrl() . '/followers/' . $user['nickname']; $data['followers'] = DI::baseUrl() . '/followers/' . $user['nickname'];
$data['inbox'] = System::baseUrl() . '/inbox/' . $user['nickname']; $data['inbox'] = DI::baseUrl() . '/inbox/' . $user['nickname'];
$data['outbox'] = System::baseUrl() . '/outbox/' . $user['nickname']; $data['outbox'] = DI::baseUrl() . '/outbox/' . $user['nickname'];
$data['preferredUsername'] = $user['nickname']; $data['preferredUsername'] = $user['nickname'];
$data['name'] = $contact['name']; $data['name'] = $contact['name'];
$data['vcard:hasAddress'] = ['@type' => 'vcard:Home', 'vcard:country-name' => $profile['country-name'], $data['vcard:hasAddress'] = ['@type' => 'vcard:Home', 'vcard:country-name' => $profile['country-name'],
@ -254,7 +254,7 @@ class Transmitter
$data['publicKey'] = ['id' => $contact['url'] . '#main-key', $data['publicKey'] = ['id' => $contact['url'] . '#main-key',
'owner' => $contact['url'], 'owner' => $contact['url'],
'publicKeyPem' => $user['pubkey']]; 'publicKeyPem' => $user['pubkey']];
$data['endpoints'] = ['sharedInbox' => System::baseUrl() . '/inbox']; $data['endpoints'] = ['sharedInbox' => DI::baseUrl() . '/inbox'];
$data['icon'] = ['type' => 'Image', $data['icon'] = ['type' => 'Image',
'url' => $contact['photo']]; 'url' => $contact['photo']];
@ -273,7 +273,7 @@ class Transmitter
{ {
return [ return [
'@context' => ActivityPub::CONTEXT, '@context' => ActivityPub::CONTEXT,
'id' => System::baseUrl() . '/profile/' . $username, 'id' => DI::baseUrl() . '/profile/' . $username,
'type' => 'Tombstone', 'type' => 'Tombstone',
'published' => DateTimeFormat::utcNow(DateTimeFormat::ATOM), 'published' => DateTimeFormat::utcNow(DateTimeFormat::ATOM),
'updated' => DateTimeFormat::utcNow(DateTimeFormat::ATOM), 'updated' => DateTimeFormat::utcNow(DateTimeFormat::ATOM),
@ -983,7 +983,7 @@ class Transmitter
$terms = Term::tagArrayFromItemId($item['id'], [Term::HASHTAG, Term::MENTION, Term::IMPLICIT_MENTION]); $terms = Term::tagArrayFromItemId($item['id'], [Term::HASHTAG, Term::MENTION, Term::IMPLICIT_MENTION]);
foreach ($terms as $term) { foreach ($terms as $term) {
if ($term['type'] == Term::HASHTAG) { if ($term['type'] == Term::HASHTAG) {
$url = System::baseUrl() . '/search?tag=' . urlencode($term['term']); $url = DI::baseUrl() . '/search?tag=' . urlencode($term['term']);
$tags[] = ['type' => 'Hashtag', 'href' => $url, 'name' => '#' . $term['term']]; $tags[] = ['type' => 'Hashtag', 'href' => $url, 'name' => '#' . $term['term']];
} elseif ($term['type'] == Term::MENTION || $term['type'] == Term::IMPLICIT_MENTION) { } elseif ($term['type'] == Term::MENTION || $term['type'] == Term::IMPLICIT_MENTION) {
$contact = Contact::getDetailsByURL($term['url']); $contact = Contact::getDetailsByURL($term['url']);
@ -1460,7 +1460,7 @@ class Transmitter
$hash = hash('ripemd128', $contact['uid'].'-'.$contact['id'].'-'.$contact['created']); $hash = hash('ripemd128', $contact['uid'].'-'.$contact['id'].'-'.$contact['created']);
$uuid = substr($hash, 0, 8). '-' . substr($hash, 8, 4) . '-' . substr($hash, 12, 4) . '-' . substr($hash, 16, 4) . '-' . substr($hash, 20, 12); $uuid = substr($hash, 0, 8). '-' . substr($hash, 8, 4) . '-' . substr($hash, 12, 4) . '-' . substr($hash, 16, 4) . '-' . substr($hash, 20, 12);
return System::baseUrl() . '/activity/' . $uuid; return DI::baseUrl() . '/activity/' . $uuid;
} }
/** /**
@ -1480,7 +1480,7 @@ class Transmitter
$suggestion = DBA::selectFirst('fsuggest', ['url', 'note', 'created'], ['id' => $suggestion_id]); $suggestion = DBA::selectFirst('fsuggest', ['url', 'note', 'created'], ['id' => $suggestion_id]);
$data = ['@context' => ActivityPub::CONTEXT, $data = ['@context' => ActivityPub::CONTEXT,
'id' => System::baseUrl() . '/activity/' . System::createGUID(), 'id' => DI::baseUrl() . '/activity/' . System::createGUID(),
'type' => 'Announce', 'type' => 'Announce',
'actor' => $owner['url'], 'actor' => $owner['url'],
'object' => $suggestion['url'], 'object' => $suggestion['url'],
@ -1509,7 +1509,7 @@ class Transmitter
$owner = User::getOwnerDataById($uid); $owner = User::getOwnerDataById($uid);
$data = ['@context' => ActivityPub::CONTEXT, $data = ['@context' => ActivityPub::CONTEXT,
'id' => System::baseUrl() . '/activity/' . System::createGUID(), 'id' => DI::baseUrl() . '/activity/' . System::createGUID(),
'type' => 'dfrn:relocate', 'type' => 'dfrn:relocate',
'actor' => $owner['url'], 'actor' => $owner['url'],
'object' => $owner['url'], 'object' => $owner['url'],
@ -1548,7 +1548,7 @@ class Transmitter
} }
$data = ['@context' => ActivityPub::CONTEXT, $data = ['@context' => ActivityPub::CONTEXT,
'id' => System::baseUrl() . '/activity/' . System::createGUID(), 'id' => DI::baseUrl() . '/activity/' . System::createGUID(),
'type' => 'Delete', 'type' => 'Delete',
'actor' => $owner['url'], 'actor' => $owner['url'],
'object' => $owner['url'], 'object' => $owner['url'],
@ -1579,7 +1579,7 @@ class Transmitter
$profile = APContact::getByURL($owner['url']); $profile = APContact::getByURL($owner['url']);
$data = ['@context' => ActivityPub::CONTEXT, $data = ['@context' => ActivityPub::CONTEXT,
'id' => System::baseUrl() . '/activity/' . System::createGUID(), 'id' => DI::baseUrl() . '/activity/' . System::createGUID(),
'type' => 'Update', 'type' => 'Update',
'actor' => $owner['url'], 'actor' => $owner['url'],
'object' => self::getProfile($uid), 'object' => self::getProfile($uid),
@ -1616,7 +1616,7 @@ class Transmitter
$owner = User::getOwnerDataById($uid); $owner = User::getOwnerDataById($uid);
if (empty($id)) { if (empty($id)) {
$id = System::baseUrl() . '/activity/' . System::createGUID(); $id = DI::baseUrl() . '/activity/' . System::createGUID();
} }
$data = ['@context' => ActivityPub::CONTEXT, $data = ['@context' => ActivityPub::CONTEXT,
@ -1673,7 +1673,7 @@ class Transmitter
$owner = User::getOwnerDataById($uid); $owner = User::getOwnerDataById($uid);
$data = ['@context' => ActivityPub::CONTEXT, $data = ['@context' => ActivityPub::CONTEXT,
'id' => System::baseUrl() . '/activity/' . System::createGUID(), 'id' => DI::baseUrl() . '/activity/' . System::createGUID(),
'type' => 'Follow', 'type' => 'Follow',
'actor' => $owner['url'], 'actor' => $owner['url'],
'object' => $object, 'object' => $object,
@ -1705,7 +1705,7 @@ class Transmitter
$owner = User::getOwnerDataById($uid); $owner = User::getOwnerDataById($uid);
$data = ['@context' => ActivityPub::CONTEXT, $data = ['@context' => ActivityPub::CONTEXT,
'id' => System::baseUrl() . '/activity/' . System::createGUID(), 'id' => DI::baseUrl() . '/activity/' . System::createGUID(),
'type' => 'Accept', 'type' => 'Accept',
'actor' => $owner['url'], 'actor' => $owner['url'],
'object' => [ 'object' => [
@ -1742,7 +1742,7 @@ class Transmitter
$owner = User::getOwnerDataById($uid); $owner = User::getOwnerDataById($uid);
$data = ['@context' => ActivityPub::CONTEXT, $data = ['@context' => ActivityPub::CONTEXT,
'id' => System::baseUrl() . '/activity/' . System::createGUID(), 'id' => DI::baseUrl() . '/activity/' . System::createGUID(),
'type' => 'Reject', 'type' => 'Reject',
'actor' => $owner['url'], 'actor' => $owner['url'],
'object' => [ 'object' => [
@ -1782,7 +1782,7 @@ class Transmitter
return; return;
} }
$id = System::baseUrl() . '/activity/' . System::createGUID(); $id = DI::baseUrl() . '/activity/' . System::createGUID();
$owner = User::getOwnerDataById($uid); $owner = User::getOwnerDataById($uid);
$data = ['@context' => ActivityPub::CONTEXT, $data = ['@context' => ActivityPub::CONTEXT,

View file

@ -18,7 +18,6 @@ use Friendica\Core\Config;
use Friendica\Core\Hook; use Friendica\Core\Hook;
use Friendica\Core\Logger; use Friendica\Core\Logger;
use Friendica\Core\Protocol; use Friendica\Core\Protocol;
use Friendica\Core\System;
use Friendica\Database\DBA; use Friendica\Database\DBA;
use Friendica\DI; use Friendica\DI;
use Friendica\Model\Contact; use Friendica\Model\Contact;
@ -506,7 +505,7 @@ class DFRN
$ext = Images::supportedTypes(); $ext = Images::supportedTypes();
foreach ($rp as $p) { foreach ($rp as $p) {
$photos[$p['scale']] = System::baseUrl().'/photo/'.$p['resource-id'].'-'.$p['scale'].'.'.$ext[$p['type']]; $photos[$p['scale']] = DI::baseUrl().'/photo/'.$p['resource-id'].'-'.$p['scale'].'.'.$ext[$p['type']];
} }
@ -568,7 +567,7 @@ class DFRN
$root->setAttribute("xmlns:ostatus", ActivityNamespace::OSTATUS); $root->setAttribute("xmlns:ostatus", ActivityNamespace::OSTATUS);
$root->setAttribute("xmlns:statusnet", ActivityNamespace::STATUSNET); $root->setAttribute("xmlns:statusnet", ActivityNamespace::STATUSNET);
XML::addElement($doc, $root, "id", System::baseUrl()."/profile/".$owner["nick"]); XML::addElement($doc, $root, "id", DI::baseUrl()."/profile/".$owner["nick"]);
XML::addElement($doc, $root, "title", $owner["name"]); XML::addElement($doc, $root, "title", $owner["name"]);
$attributes = ["uri" => "https://friendi.ca", "version" => FRIENDICA_VERSION."-".DB_UPDATE_VERSION]; $attributes = ["uri" => "https://friendi.ca", "version" => FRIENDICA_VERSION."-".DB_UPDATE_VERSION];
@ -585,13 +584,13 @@ class DFRN
// DFRN itself doesn't uses this. But maybe someone else wants to subscribe to the public feed. // DFRN itself doesn't uses this. But maybe someone else wants to subscribe to the public feed.
OStatus::hublinks($doc, $root, $owner["nick"]); OStatus::hublinks($doc, $root, $owner["nick"]);
$attributes = ["rel" => "salmon", "href" => System::baseUrl()."/salmon/".$owner["nick"]]; $attributes = ["rel" => "salmon", "href" => DI::baseUrl()."/salmon/".$owner["nick"]];
XML::addElement($doc, $root, "link", "", $attributes); XML::addElement($doc, $root, "link", "", $attributes);
$attributes = ["rel" => "http://salmon-protocol.org/ns/salmon-replies", "href" => System::baseUrl()."/salmon/".$owner["nick"]]; $attributes = ["rel" => "http://salmon-protocol.org/ns/salmon-replies", "href" => DI::baseUrl()."/salmon/".$owner["nick"]];
XML::addElement($doc, $root, "link", "", $attributes); XML::addElement($doc, $root, "link", "", $attributes);
$attributes = ["rel" => "http://salmon-protocol.org/ns/salmon-mention", "href" => System::baseUrl()."/salmon/".$owner["nick"]]; $attributes = ["rel" => "http://salmon-protocol.org/ns/salmon-mention", "href" => DI::baseUrl()."/salmon/".$owner["nick"]];
XML::addElement($doc, $root, "link", "", $attributes); XML::addElement($doc, $root, "link", "", $attributes);
} }
@ -652,7 +651,7 @@ class DFRN
} }
XML::addElement($doc, $author, "name", $owner["name"], $attributes); XML::addElement($doc, $author, "name", $owner["name"], $attributes);
XML::addElement($doc, $author, "uri", System::baseUrl().'/profile/'.$owner["nickname"], $attributes); XML::addElement($doc, $author, "uri", DI::baseUrl().'/profile/'.$owner["nickname"], $attributes);
XML::addElement($doc, $author, "dfrn:handle", $owner["addr"], $attributes); XML::addElement($doc, $author, "dfrn:handle", $owner["addr"], $attributes);
$attributes = ["rel" => "photo", "type" => "image/jpeg", $attributes = ["rel" => "photo", "type" => "image/jpeg",
@ -989,7 +988,7 @@ class DFRN
} }
// Add conversation data. This is used for OStatus // Add conversation data. This is used for OStatus
$conversation_href = System::baseUrl()."/display/".$item["parent-guid"]; $conversation_href = DI::baseUrl()."/display/".$item["parent-guid"];
$conversation_uri = $conversation_href; $conversation_uri = $conversation_href;
if (isset($parent_item)) { if (isset($parent_item)) {
@ -1030,7 +1029,7 @@ class DFRN
"link", "link",
"", "",
["rel" => "alternate", "type" => "text/html", ["rel" => "alternate", "type" => "text/html",
"href" => System::baseUrl() . "/display/" . $item["guid"]] "href" => DI::baseUrl() . "/display/" . $item["guid"]]
); );
// "comment-allow" is some old fashioned stuff for old Friendica versions. // "comment-allow" is some old fashioned stuff for old Friendica versions.
@ -1901,7 +1900,7 @@ class DFRN
'to_email' => $importer['email'], 'to_email' => $importer['email'],
'uid' => $importer['importer_uid'], 'uid' => $importer['importer_uid'],
'item' => $suggest, 'item' => $suggest,
'link' => System::baseUrl().'/notifications/intros', 'link' => DI::baseUrl().'/notifications/intros',
'source_name' => $importer['name'], 'source_name' => $importer['name'],
'source_link' => $importer['url'], 'source_link' => $importer['url'],
'source_photo' => $importer['photo'], 'source_photo' => $importer['photo'],
@ -2129,7 +2128,7 @@ class DFRN
} }
} }
if ($Blink && Strings::compareLink($Blink, System::baseUrl() . "/profile/" . $importer["nickname"])) { if ($Blink && Strings::compareLink($Blink, DI::baseUrl() . "/profile/" . $importer["nickname"])) {
$author = DBA::selectFirst('contact', ['name', 'thumb', 'url'], ['id' => $item['author-id']]); $author = DBA::selectFirst('contact', ['name', 'thumb', 'url'], ['id' => $item['author-id']]);
$parent = Item::selectFirst(['id'], ['uri' => $item['parent-uri'], 'uid' => $importer["importer_uid"]]); $parent = Item::selectFirst(['id'], ['uri' => $item['parent-uri'], 'uid' => $importer["importer_uid"]]);
@ -2145,7 +2144,7 @@ class DFRN
"to_email" => $importer["email"], "to_email" => $importer["email"],
"uid" => $importer["importer_uid"], "uid" => $importer["importer_uid"],
"item" => $item, "item" => $item,
"link" => System::baseUrl()."/display/".urlencode($item['guid']), "link" => DI::baseUrl()."/display/".urlencode($item['guid']),
"source_name" => $author["name"], "source_name" => $author["name"],
"source_link" => $author["url"], "source_link" => $author["url"],
"source_photo" => $author["thumb"], "source_photo" => $author["thumb"],
@ -2886,13 +2885,13 @@ class DFRN
$community_page = ($user['page-flags'] == User::PAGE_FLAGS_COMMUNITY); $community_page = ($user['page-flags'] == User::PAGE_FLAGS_COMMUNITY);
$prvgroup = ($user['page-flags'] == User::PAGE_FLAGS_PRVGROUP); $prvgroup = ($user['page-flags'] == User::PAGE_FLAGS_PRVGROUP);
$link = Strings::normaliseLink(System::baseUrl() . '/profile/' . $user['nickname']); $link = Strings::normaliseLink(DI::baseUrl() . '/profile/' . $user['nickname']);
/* /*
* Diaspora uses their own hardwired link URL in @-tags * Diaspora uses their own hardwired link URL in @-tags
* instead of the one we supply with webfinger * instead of the one we supply with webfinger
*/ */
$dlink = Strings::normaliseLink(System::baseUrl() . '/u/' . $user['nickname']); $dlink = Strings::normaliseLink(DI::baseUrl() . '/u/' . $user['nickname']);
$cnt = preg_match_all('/[\@\!]\[url\=(.*?)\](.*?)\[\/url\]/ism', $item['body'], $matches, PREG_SET_ORDER); $cnt = preg_match_all('/[\@\!]\[url\=(.*?)\](.*?)\[\/url\]/ism', $item['body'], $matches, PREG_SET_ORDER);
if ($cnt) { if ($cnt) {

View file

@ -22,17 +22,16 @@ 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\Contact; use Friendica\Model\Contact;
use Friendica\Model\Conversation; use Friendica\Model\Conversation;
use Friendica\Model\GContact; use Friendica\Model\GContact;
use Friendica\Model\Group;
use Friendica\Model\Item; use Friendica\Model\Item;
use Friendica\Model\ItemDeliveryData; use Friendica\Model\ItemDeliveryData;
use Friendica\Model\Mail; use Friendica\Model\Mail;
use Friendica\Model\Profile; use Friendica\Model\Profile;
use Friendica\Model\User; use Friendica\Model\User;
use Friendica\Network\Probe; use Friendica\Network\Probe;
use Friendica\Protocol\ActivityNamespace;
use Friendica\Util\Crypto; use Friendica\Util\Crypto;
use Friendica\Util\DateTimeFormat; use Friendica\Util\DateTimeFormat;
use Friendica\Util\Map; use Friendica\Util\Map;
@ -145,7 +144,7 @@ class Diaspora
// Now we are collecting all relay contacts // Now we are collecting all relay contacts
foreach ($serverlist as $server_url) { foreach ($serverlist as $server_url) {
// We don't send messages to ourselves // We don't send messages to ourselves
if (Strings::compareLink($server_url, System::baseUrl())) { if (Strings::compareLink($server_url, DI::baseUrl())) {
continue; continue;
} }
$contact = self::getRelayContact($server_url); $contact = self::getRelayContact($server_url);
@ -2670,7 +2669,7 @@ class Diaspora
return false; return false;
} }
$orig_url = System::baseUrl()."/display/".$original_item["guid"]; $orig_url = DI::baseUrl()."/display/".$original_item["guid"];
$datarray = []; $datarray = [];
@ -2996,7 +2995,7 @@ class Diaspora
$nick = $contact["nick"]; $nick = $contact["nick"];
} }
return $nick . "@" . substr(System::baseUrl(), strpos(System::baseUrl(), "://") + 3); return $nick . "@" . substr(DI::baseUrl(), strpos(DI::baseUrl(), "://") + 3);
} }
@ -4117,9 +4116,9 @@ class Diaspora
$first = $split_name['first']; $first = $split_name['first'];
$last = $split_name['last']; $last = $split_name['last'];
$large = System::baseUrl().'/photo/custom/300/'.$profile['uid'].'.jpg'; $large = DI::baseUrl().'/photo/custom/300/'.$profile['uid'].'.jpg';
$medium = System::baseUrl().'/photo/custom/100/'.$profile['uid'].'.jpg'; $medium = DI::baseUrl().'/photo/custom/100/'.$profile['uid'].'.jpg';
$small = System::baseUrl().'/photo/custom/50/' .$profile['uid'].'.jpg'; $small = DI::baseUrl().'/photo/custom/50/' .$profile['uid'].'.jpg';
$searchable = (($profile['publish'] && $profile['net-publish']) ? 'true' : 'false'); $searchable = (($profile['publish'] && $profile['net-publish']) ? 'true' : 'false');
$dob = null; $dob = null;

View file

@ -11,11 +11,9 @@ use DOMXPath;
use Friendica\Content\Text\HTML; use Friendica\Content\Text\HTML;
use Friendica\Core\Logger; use Friendica\Core\Logger;
use Friendica\Core\Protocol; use Friendica\Core\Protocol;
use Friendica\Core\System;
use Friendica\Database\DBA; use Friendica\Database\DBA;
use Friendica\DI; use Friendica\DI;
use Friendica\Model\Item; use Friendica\Model\Item;
use Friendica\Protocol\ActivityNamespace;
use Friendica\Util\ParseUrl; use Friendica\Util\ParseUrl;
use Friendica\Util\Network; use Friendica\Util\Network;
use Friendica\Util\XML; use Friendica\Util\XML;
@ -353,7 +351,7 @@ class Feed {
$tags .= ', '; $tags .= ', ';
} }
$taglink = "#[url=" . System::baseUrl() . "/search?tag=" . $hashtag . "]" . $hashtag . "[/url]"; $taglink = "#[url=" . DI::baseUrl() . "/search?tag=" . $hashtag . "]" . $hashtag . "[/url]";
$tags .= $taglink; $tags .= $taglink;
} }

View file

@ -15,7 +15,6 @@ use Friendica\Core\Lock;
use Friendica\Core\Logger; use Friendica\Core\Logger;
use Friendica\Core\PConfig; use Friendica\Core\PConfig;
use Friendica\Core\Protocol; use Friendica\Core\Protocol;
use Friendica\Core\System;
use Friendica\Database\DBA; use Friendica\Database\DBA;
use Friendica\DI; use Friendica\DI;
use Friendica\Model\APContact; use Friendica\Model\APContact;
@ -25,8 +24,6 @@ use Friendica\Model\GContact;
use Friendica\Model\Item; use Friendica\Model\Item;
use Friendica\Model\User; use Friendica\Model\User;
use Friendica\Network\Probe; use Friendica\Network\Probe;
use Friendica\Object\Image;
use Friendica\Protocol\ActivityNamespace;
use Friendica\Util\DateTimeFormat; use Friendica\Util\DateTimeFormat;
use Friendica\Util\Images; use Friendica\Util\Images;
use Friendica\Util\Network; use Friendica\Util\Network;
@ -649,7 +646,7 @@ class OStatus
$item['tag'] = ''; $item['tag'] = '';
} }
$item['tag'] .= '#[url=' . System::baseUrl() . '/search?tag=' . $term . ']' . $term . '[/url]'; $item['tag'] .= '#[url=' . DI::baseUrl() . '/search?tag=' . $term . ']' . $term . '[/url]';
} }
} }
} }
@ -1293,7 +1290,7 @@ class OStatus
$attributes = ["uri" => "https://friendi.ca", "version" => FRIENDICA_VERSION . "-" . DB_UPDATE_VERSION]; $attributes = ["uri" => "https://friendi.ca", "version" => FRIENDICA_VERSION . "-" . DB_UPDATE_VERSION];
XML::addElement($doc, $root, "generator", FRIENDICA_PLATFORM, $attributes); XML::addElement($doc, $root, "generator", FRIENDICA_PLATFORM, $attributes);
XML::addElement($doc, $root, "id", System::baseUrl() . "/profile/" . $owner["nick"]); XML::addElement($doc, $root, "id", DI::baseUrl() . "/profile/" . $owner["nick"]);
XML::addElement($doc, $root, "title", $title); XML::addElement($doc, $root, "title", $title);
XML::addElement($doc, $root, "subtitle", sprintf("Updates from %s on %s", $owner["name"], Config::get('config', 'sitename'))); XML::addElement($doc, $root, "subtitle", sprintf("Updates from %s on %s", $owner["name"], Config::get('config', 'sitename')));
XML::addElement($doc, $root, "logo", $owner["photo"]); XML::addElement($doc, $root, "logo", $owner["photo"]);
@ -1306,23 +1303,23 @@ class OStatus
XML::addElement($doc, $root, "link", "", $attributes); XML::addElement($doc, $root, "link", "", $attributes);
/// @TODO We have to find out what this is /// @TODO We have to find out what this is
/// $attributes = array("href" => System::baseUrl()."/sup", /// $attributes = array("href" => DI::baseUrl()."/sup",
/// "rel" => "http://api.friendfeed.com/2008/03#sup", /// "rel" => "http://api.friendfeed.com/2008/03#sup",
/// "type" => "application/json"); /// "type" => "application/json");
/// XML::addElement($doc, $root, "link", "", $attributes); /// XML::addElement($doc, $root, "link", "", $attributes);
self::hublinks($doc, $root, $owner["nick"]); self::hublinks($doc, $root, $owner["nick"]);
$attributes = ["href" => System::baseUrl() . "/salmon/" . $owner["nick"], "rel" => "salmon"]; $attributes = ["href" => DI::baseUrl() . "/salmon/" . $owner["nick"], "rel" => "salmon"];
XML::addElement($doc, $root, "link", "", $attributes); XML::addElement($doc, $root, "link", "", $attributes);
$attributes = ["href" => System::baseUrl() . "/salmon/" . $owner["nick"], "rel" => "http://salmon-protocol.org/ns/salmon-replies"]; $attributes = ["href" => DI::baseUrl() . "/salmon/" . $owner["nick"], "rel" => "http://salmon-protocol.org/ns/salmon-replies"];
XML::addElement($doc, $root, "link", "", $attributes); XML::addElement($doc, $root, "link", "", $attributes);
$attributes = ["href" => System::baseUrl() . "/salmon/" . $owner["nick"], "rel" => "http://salmon-protocol.org/ns/salmon-mention"]; $attributes = ["href" => DI::baseUrl() . "/salmon/" . $owner["nick"], "rel" => "http://salmon-protocol.org/ns/salmon-mention"];
XML::addElement($doc, $root, "link", "", $attributes); XML::addElement($doc, $root, "link", "", $attributes);
$attributes = ["href" => System::baseUrl() . $selfUri, "rel" => "self", "type" => "application/atom+xml"]; $attributes = ["href" => DI::baseUrl() . $selfUri, "rel" => "self", "type" => "application/atom+xml"];
XML::addElement($doc, $root, "link", "", $attributes); XML::addElement($doc, $root, "link", "", $attributes);
if ($owner['account-type'] == Contact::TYPE_COMMUNITY) { if ($owner['account-type'] == Contact::TYPE_COMMUNITY) {
@ -1346,7 +1343,7 @@ class OStatus
*/ */
public static function hublinks(DOMDocument $doc, $root, $nick) public static function hublinks(DOMDocument $doc, $root, $nick)
{ {
$h = System::baseUrl() . '/pubsubhubbub/'.$nick; $h = DI::baseUrl() . '/pubsubhubbub/'.$nick;
XML::addElement($doc, $root, "link", "", ["href" => $h, "rel" => "hub"]); XML::addElement($doc, $root, "link", "", ["href" => $h, "rel" => "hub"]);
} }
@ -1492,7 +1489,7 @@ class OStatus
$author->appendChild($urls); $author->appendChild($urls);
} }
XML::addElement($doc, $author, "followers", "", ["url" => System::baseUrl() . "/profile/" . $owner["nick"] . "/contacts/followers"]); XML::addElement($doc, $author, "followers", "", ["url" => DI::baseUrl() . "/profile/" . $owner["nick"] . "/contacts/followers"]);
XML::addElement($doc, $author, "statusnet:profile_info", "", ["local_id" => $owner["uid"]]); XML::addElement($doc, $author, "statusnet:profile_info", "", ["local_id" => $owner["uid"]]);
if ($profile["publish"]) { if ($profile["publish"]) {
@ -1980,7 +1977,7 @@ class OStatus
XML::addElement($doc, $entry, "content", $body, ["type" => "html"]); XML::addElement($doc, $entry, "content", $body, ["type" => "html"]);
XML::addElement($doc, $entry, "link", "", ["rel" => "alternate", "type" => "text/html", XML::addElement($doc, $entry, "link", "", ["rel" => "alternate", "type" => "text/html",
"href" => System::baseUrl()."/display/".$item["guid"]] "href" => DI::baseUrl()."/display/".$item["guid"]]
); );
if (!$feed_mode && $complete && ($item["id"] > 0)) { if (!$feed_mode && $complete && ($item["id"] > 0)) {
@ -2024,7 +2021,7 @@ class OStatus
} else { } else {
$mentioned[$parent["author-link"]] = $parent["author-link"]; $mentioned[$parent["author-link"]] = $parent["author-link"];
$mentioned[$parent["owner-link"]] = $parent["owner-link"]; $mentioned[$parent["owner-link"]] = $parent["owner-link"];
$parent_plink = System::baseUrl()."/display/".$parent["guid"]; $parent_plink = DI::baseUrl()."/display/".$parent["guid"];
} }
$attributes = [ $attributes = [

View file

@ -556,7 +556,7 @@ class Network
Hook::callAll('avatar_lookup', $avatar); Hook::callAll('avatar_lookup', $avatar);
if (! $avatar['success']) { if (! $avatar['success']) {
$avatar['url'] = System::baseUrl() . '/images/person-300.jpg'; $avatar['url'] = DI::baseUrl() . '/images/person-300.jpg';
} }
Logger::log('Avatar: ' . $avatar['email'] . ' ' . $avatar['url'], Logger::DEBUG); Logger::log('Avatar: ' . $avatar['email'] . ' ' . $avatar['url'], Logger::DEBUG);

View file

@ -3,7 +3,6 @@
namespace Friendica\Util; namespace Friendica\Util;
use Friendica\Core\Config; use Friendica\Core\Config;
use Friendica\Core\System;
use Friendica\DI; use Friendica\DI;
/** /**
@ -76,7 +75,7 @@ class Proxy
// Only continue if it isn't a local image and the isn't deactivated // Only continue if it isn't a local image and the isn't deactivated
if (self::isLocalImage($url)) { if (self::isLocalImage($url)) {
$url = str_replace(Strings::normaliseLink(System::baseUrl()) . '/', System::baseUrl() . '/', $url); $url = str_replace(Strings::normaliseLink(DI::baseUrl()) . '/', DI::baseUrl() . '/', $url);
return $url; return $url;
} }
@ -109,7 +108,7 @@ class Proxy
$longpath .= '.' . $extension; $longpath .= '.' . $extension;
} }
$proxypath = System::baseUrl() . '/proxy/' . $longpath; $proxypath = DI::baseUrl() . '/proxy/' . $longpath;
if ($size != '') { if ($size != '') {
$size = ':' . $size; $size = ':' . $size;
@ -120,7 +119,7 @@ class Proxy
if ((strlen($proxypath) > 250) && $writemode) { if ((strlen($proxypath) > 250) && $writemode) {
return $shortpath; return $shortpath;
} elseif (strlen($proxypath) > 250) { } elseif (strlen($proxypath) > 250) {
return System::baseUrl() . '/proxy/' . $shortpath . '?url=' . urlencode($url); return DI::baseUrl() . '/proxy/' . $shortpath . '?url=' . urlencode($url);
} elseif ($writemode) { } elseif ($writemode) {
return $longpath; return $longpath;
} else { } else {
@ -141,7 +140,7 @@ class Proxy
*/ */
public static function proxifyHtml($html) public static function proxifyHtml($html)
{ {
$html = str_replace(Strings::normaliseLink(System::baseUrl()) . '/', System::baseUrl() . '/', $html); $html = str_replace(Strings::normaliseLink(DI::baseUrl()) . '/', DI::baseUrl() . '/', $html);
return preg_replace_callback('/(<img [^>]*src *= *["\'])([^"\']+)(["\'][^>]*>)/siU', 'self::replaceUrl', $html); return preg_replace_callback('/(<img [^>]*src *= *["\'])([^"\']+)(["\'][^>]*>)/siU', 'self::replaceUrl', $html);
} }
@ -164,7 +163,7 @@ class Proxy
} }
// links normalised - bug #431 // links normalised - bug #431
$baseurl = Strings::normaliseLink(System::baseUrl()); $baseurl = Strings::normaliseLink(DI::baseUrl());
$url = Strings::normaliseLink($url); $url = Strings::normaliseLink($url);
return (substr($url, 0, strlen($baseurl)) == $baseurl); return (substr($url, 0, strlen($baseurl)) == $baseurl);

View file

@ -8,7 +8,6 @@ use Friendica\Core\Config;
use Friendica\Core\L10n; use Friendica\Core\L10n;
use Friendica\Core\Logger; use Friendica\Core\Logger;
use Friendica\Core\Protocol; use Friendica\Core\Protocol;
use Friendica\Core\System;
use Friendica\Database\DBA; use Friendica\Database\DBA;
use Friendica\DI; use Friendica\DI;
use Friendica\Model; use Friendica\Model;
@ -292,7 +291,7 @@ class Delivery
// perform local delivery if we are on the same site // perform local delivery if we are on the same site
if (Strings::compareLink($basepath, System::baseUrl())) { if (Strings::compareLink($basepath, DI::baseUrl())) {
$condition = ['nurl' => Strings::normaliseLink($contact['url']), 'self' => true]; $condition = ['nurl' => Strings::normaliseLink($contact['url']), 'self' => true];
$target_self = DBA::selectFirst('contact', ['uid'], $condition); $target_self = DBA::selectFirst('contact', ['uid'], $condition);
if (!DBA::isResult($target_self)) { if (!DBA::isResult($target_self)) {

View file

@ -6,10 +6,9 @@
namespace Friendica\Worker; namespace Friendica\Worker;
use Friendica\Core\Logger; use Friendica\Core\Logger;
use Friendica\Core\System;
use Friendica\Database\DBA; use Friendica\Database\DBA;
use Friendica\DI;
use Friendica\Model\PushSubscriber; use Friendica\Model\PushSubscriber;
use Friendica\Model\GServer;
use Friendica\Protocol\OStatus; use Friendica\Protocol\OStatus;
use Friendica\Util\Network; use Friendica\Util\Network;
@ -47,7 +46,7 @@ class PubSubPublish
$headers = ["Content-type: application/atom+xml", $headers = ["Content-type: application/atom+xml",
sprintf("Link: <%s>;rel=hub,<%s>;rel=self", sprintf("Link: <%s>;rel=hub,<%s>;rel=self",
System::baseUrl() . '/pubsubhubbub/' . $subscriber['nickname'], DI::baseUrl() . '/pubsubhubbub/' . $subscriber['nickname'],
$subscriber['topic']), $subscriber['topic']),
"X-Hub-Signature: sha1=" . $hmac_sig]; "X-Hub-Signature: sha1=" . $hmac_sig];

View file

@ -2418,7 +2418,7 @@ class ApiTest extends DatabaseTest
public function testApiFormatItemsEmbededImages() public function testApiFormatItemsEmbededImages()
{ {
$this->assertEquals( $this->assertEquals(
'text ' . System::baseUrl() . '/display/item_guid', 'text ' . DI::baseUrl() . '/display/item_guid',
api_format_items_embeded_images(['guid' => 'item_guid'], 'text data:image/foo') api_format_items_embeded_images(['guid' => 'item_guid'], 'text data:image/foo')
); );
} }
@ -2921,7 +2921,7 @@ class ApiTest extends DatabaseTest
$result = api_statusnet_config('json'); $result = api_statusnet_config('json');
$this->assertEquals('localhost', $result['config']['site']['server']); $this->assertEquals('localhost', $result['config']['site']['server']);
$this->assertEquals('default', $result['config']['site']['theme']); $this->assertEquals('default', $result['config']['site']['theme']);
$this->assertEquals(System::baseUrl() . '/images/friendica-64.png', $result['config']['site']['logo']); $this->assertEquals(DI::baseUrl() . '/images/friendica-64.png', $result['config']['site']['logo']);
$this->assertTrue($result['config']['site']['fancy']); $this->assertTrue($result['config']['site']['fancy']);
$this->assertEquals('en', $result['config']['site']['language']); $this->assertEquals('en', $result['config']['site']['language']);
$this->assertEquals('UTC', $result['config']['site']['timezone']); $this->assertEquals('UTC', $result['config']['site']['timezone']);

View file

@ -2,7 +2,7 @@
<html itemscope itemtype="http://schema.org/Blog" lang="<?php echo $lang; ?>"> <html itemscope itemtype="http://schema.org/Blog" lang="<?php echo $lang; ?>">
<head> <head>
<title><?php if(!empty($page['title'])) echo $page['title'] ?></title> <title><?php if(!empty($page['title'])) echo $page['title'] ?></title>
<script>var baseurl="<?php echo Friendica\Core\System::baseUrl() ?>";</script> <script>var baseurl="<?php echo Friendica\DI::baseUrl() ?>";</script>
<?php if(!empty($page['htmlhead'])) echo $page['htmlhead'] ?> <?php if(!empty($page['htmlhead'])) echo $page['htmlhead'] ?>
</head> </head>
<body> <body>

View file

@ -2,7 +2,7 @@
<html> <html>
<head> <head>
<title><?php if(!empty($page['title'])) echo $page['title'] ?></title> <title><?php if(!empty($page['title'])) echo $page['title'] ?></title>
<script>var baseurl="<?php echo Friendica\Core\System::baseUrl() ?>";</script> <script>var baseurl="<?php echo Friendica\DI::baseUrl() ?>";</script>
<?php if(!empty($page['htmlhead'])) echo $page['htmlhead'] ?> <?php if(!empty($page['htmlhead'])) echo $page['htmlhead'] ?>
</head> </head>
<body class="minimal"> <body class="minimal">

View file

@ -30,7 +30,7 @@ $is_singleuser_class = $is_singleuser ? "is-singleuser" : "is-not-singleuser";
<head> <head>
<title><?php if (!empty($page['title'])) echo $page['title'] ?></title> <title><?php if (!empty($page['title'])) echo $page['title'] ?></title>
<meta request="<?php echo htmlspecialchars($_REQUEST['pagename'] ?? '') ?>"> <meta request="<?php echo htmlspecialchars($_REQUEST['pagename'] ?? '') ?>">
<script type="text/javascript">var baseurl = "<?php echo System::baseUrl(); ?>";</script> <script type="text/javascript">var baseurl = "<?php echo DI::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
// 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

View file

@ -1,30 +1,30 @@
<!DOCTYPE html > <!DOCTYPE html >
<html> <html>
<head> <head>
<title><?php if(!empty($page['title'])) echo $page['title'] ?></title> <title><?php if(!empty($page['title'])) echo $page['title'] ?></title>
<script>var baseurl="<?php echo Friendica\Core\System::baseUrl() ?>";</script> <script>var baseurl="<?php echo Friendica\DI::baseUrl() ?>";</script>
<?php if(!empty($page['htmlhead'])) echo $page['htmlhead'] ?> <?php if(!empty($page['htmlhead'])) echo $page['htmlhead'] ?>
</head> </head>
<body class="minimal"> <body class="minimal">
<section><?php if(!empty($page['content'])) echo $page['content']; ?> <section><?php if(!empty($page['content'])) echo $page['content']; ?>
<div id="page-footer"></div> <div id="page-footer"></div>
</section> </section>
<!-- Modal --> <!-- Modal -->
<div id="modal" class="modal fade" tabindex="-1" role="dialog"> <div id="modal" class="modal fade" tabindex="-1" role="dialog">
<div class="modal-dialog modal-full-screen"> <div class="modal-dialog modal-full-screen">
<div class="modal-content"> <div class="modal-content">
<div id="modal-header" class="modal-header"> <div id="modal-header" class="modal-header">
<button id="modal-cloase" type="button" class="close" data-dismiss="modal"> <button id="modal-cloase" type="button" class="close" data-dismiss="modal">
&times; &times;
</button> </button>
<h4 id="modal-title" class="modal-title"></h4> <h4 id="modal-title" class="modal-title"></h4>
</div> </div>
<div id="modal-body" class="modal-body"> <div id="modal-body" class="modal-body">
<!-- /# content goes here --> <!-- /# content goes here -->
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</body> </body>
</html> </html>

View file

@ -10,9 +10,9 @@
<title><?php if(!empty($page['title'])) echo $page['title'] ?></title> <title><?php if(!empty($page['title'])) echo $page['title'] ?></title>
<meta name="viewport" content="initial-scale=1.0"> <meta name="viewport" content="initial-scale=1.0">
<meta request="<?php echo htmlspecialchars($_REQUEST['pagename']) ?>"> <meta request="<?php echo htmlspecialchars($_REQUEST['pagename']) ?>">
<script type="text/javascript">var baseurl="<?php echo Friendica\Core\System::baseUrl() ?>";</script> <script type="text/javascript">var baseurl="<?php echo Friendica\DI::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 $baseurl = Friendica\Core\System::baseUrl(); ?> <?php $baseurl = Friendica\DI::baseUrl(); ?>
<?php $frio = "view/theme/frio"; ?> <?php $frio = "view/theme/frio"; ?>
<?php if(!empty($page['htmlhead'])) echo $page['htmlhead']; ?> <?php if(!empty($page['htmlhead'])) echo $page['htmlhead']; ?>
</head> </head>

View file

@ -8,10 +8,9 @@
*/ */
use Friendica\App; use Friendica\App;
use Friendica\Core\System;
use Friendica\DI; use Friendica\DI;
function quattro_init(App $a) { function quattro_init(App $a) {
DI::page()['htmlhead'] .= '<script src="'.System::baseUrl().'/view/theme/quattro/tinycon.min.js"></script>'; DI::page()['htmlhead'] .= '<script src="'.DI::baseUrl().'/view/theme/quattro/tinycon.min.js"></script>';
DI::page()['htmlhead'] .= '<script src="'.System::baseUrl().'/view/theme/quattro/js/quattro.js"></script>';; DI::page()['htmlhead'] .= '<script src="'.DI::baseUrl().'/view/theme/quattro/js/quattro.js"></script>';;
} }

View file

@ -2,7 +2,7 @@
<html> <html>
<head> <head>
<title><?php if(!empty($page['title'])) echo $page['title'] ?></title> <title><?php if(!empty($page['title'])) echo $page['title'] ?></title>
<script>var baseurl="<?php echo Friendica\Core\System::baseUrl() ?>";</script> <script>var baseurl="<?php echo Friendica\DI::baseUrl() ?>";</script>
<script type="text/javascript"> <script type="text/javascript">
function ScrollToBottom(){ function ScrollToBottom(){
window.scrollTo(0,document.body.scrollHeight); window.scrollTo(0,document.body.scrollHeight);

View file

@ -12,7 +12,6 @@
use Friendica\App; use Friendica\App;
use Friendica\Core\Renderer; use Friendica\Core\Renderer;
use Friendica\Core\System;
use Friendica\DI; use Friendica\DI;
function smoothly_init(App $a) { function smoothly_init(App $a) {
@ -20,7 +19,7 @@ function smoothly_init(App $a) {
$cssFile = null; $cssFile = null;
$ssl_state = null; $ssl_state = null;
$baseurl = System::baseUrl($ssl_state); $baseurl = DI::baseUrl()->get($ssl_state);
DI::page()['htmlhead'] .= <<< EOT DI::page()['htmlhead'] .= <<< EOT
<script> <script>
@ -87,7 +86,7 @@ if (! function_exists('_js_in_foot')) {
/** @purpose insert stuff in bottom of page /** @purpose insert stuff in bottom of page
*/ */
$ssl_state = null; $ssl_state = null;
$baseurl = System::baseUrl($ssl_state); $baseurl = DI::baseUrl()->get($ssl_state);
$bottom['$baseurl'] = $baseurl; $bottom['$baseurl'] = $baseurl;
$tpl = Renderer::getMarkupTemplate('bottom.tpl'); $tpl = Renderer::getMarkupTemplate('bottom.tpl');

View file

@ -16,7 +16,6 @@ use Friendica\Core\Config;
use Friendica\Core\L10n; use Friendica\Core\L10n;
use Friendica\Core\PConfig; use Friendica\Core\PConfig;
use Friendica\Core\Renderer; use Friendica\Core\Renderer;
use Friendica\Core\System;
use Friendica\Database\DBA; use Friendica\Database\DBA;
use Friendica\DI; use Friendica\DI;
use Friendica\Model\Contact; use Friendica\Model\Contact;
@ -117,7 +116,7 @@ function vier_community_info()
$show_lastusers = get_vier_config("show_lastusers", 1); $show_lastusers = get_vier_config("show_lastusers", 1);
// get_baseurl // get_baseurl
$url = System::baseUrl(); $url = DI::baseUrl();
$aside['$url'] = $url; $aside['$url'] = $url;
// comunity_profiles // comunity_profiles
@ -213,7 +212,7 @@ function vier_community_info()
'name' => $contact['name'], 'name' => $contact['name'],
'cid' => $contact['id'], 'cid' => $contact['id'],
'selected' => $selected, 'selected' => $selected,
'micro' => System::removedBaseUrl(ProxyUtils::proxifyUrl($contact['micro'], false, ProxyUtils::SIZE_MICRO)), 'micro' => DI::baseUrl()->remove(ProxyUtils::proxifyUrl($contact['micro'], false, ProxyUtils::SIZE_MICRO)),
'id' => ++$id, 'id' => ++$id,
]; ];
$entries[] = $entry; $entries[] = $entry;