Browse Source

Move redundant System::baseUrl() to DI::baseUrl() calls

pull/8036/head
nupplaPhil 2 years ago
parent
commit
3f34229752
No known key found for this signature in database GPG Key ID: D8365C3D36B77D90
  1. 38
      include/api.php
  2. 8
      include/conversation.php
  3. 10
      include/enotify.php
  4. 7
      include/items.php
  5. 7
      mod/cal.php
  6. 6
      mod/dfrn_confirm.php
  7. 8
      mod/dfrn_request.php
  8. 13
      mod/display.php
  9. 11
      mod/events.php
  10. 7
      mod/fbrowser.php
  11. 2
      mod/follow.php
  12. 16
      mod/item.php
  13. 9
      mod/lostpass.php
  14. 6
      mod/match.php
  15. 14
      mod/message.php
  16. 6
      mod/msearch.php
  17. 7
      mod/noscrape.php
  18. 6
      mod/oexchange.php
  19. 5
      mod/ostatus_subscribe.php
  20. 20
      mod/photos.php
  21. 10
      mod/ping.php
  22. 2
      mod/poke.php
  23. 9
      mod/profile_photo.php
  24. 5
      mod/profiles.php
  25. 4
      mod/pubsubhubbub.php
  26. 2
      mod/redir.php
  27. 3
      mod/regmod.php
  28. 5
      mod/repair_ostatus.php
  29. 13
      mod/settings.php
  30. 5
      mod/subthread.php
  31. 5
      mod/suggest.php
  32. 7
      mod/tagger.php
  33. 3
      mod/unfollow.php
  34. 13
      mod/videos.php
  35. 10
      mod/wall_upload.php
  36. 3
      mod/wallmessage.php
  37. 8
      src/App/BaseURL.php
  38. 3
      src/Content/Nav.php
  39. 4
      src/Content/OEmbed.php
  40. 74
      src/Content/Smilies.php
  41. 22
      src/Content/Text/BBCode.php
  42. 4
      src/Content/Widget.php
  43. 11
      src/Core/System.php
  44. 4
      src/Core/Theme.php
  45. 2
      src/Core/UserImport.php
  46. 2
      src/Core/Worker.php
  47. 68
      src/Model/Contact.php
  48. 7
      src/Model/Event.php
  49. 12
      src/Model/GContact.php
  50. 14
      src/Model/Item.php
  51. 7
      src/Model/Mail.php
  52. 14
      src/Model/Photo.php
  53. 24
      src/Model/Profile.php
  54. 6
      src/Model/Term.php
  55. 10
      src/Model/User.php
  56. 3
      src/Module/Contact.php
  57. 3
      src/Module/Objects.php
  58. 20
      src/Module/Profile.php
  59. 7
      src/Module/Settings/Delegation.php
  60. 5
      src/Module/Settings/UserExport.php
  61. 5
      src/Module/Tos.php
  62. 3
      src/Network/Probe.php
  63. 58
      src/Protocol/ActivityPub/Transmitter.php
  64. 27
      src/Protocol/DFRN.php
  65. 15
      src/Protocol/Diaspora.php
  66. 4
      src/Protocol/Feed.php
  67. 23
      src/Protocol/OStatus.php
  68. 2
      src/Util/Network.php
  69. 11
      src/Util/Proxy.php
  70. 3
      src/Worker/Delivery.php
  71. 5
      src/Worker/PubSubPublish.php
  72. 4
      tests/include/ApiTest.php
  73. 2
      view/php/default.php
  74. 2
      view/php/minimal.php
  75. 2
      view/theme/frio/php/default.php
  76. 60
      view/theme/frio/php/minimal.php
  77. 4
      view/theme/frio/php/standard.php
  78. 5
      view/theme/quattro/theme.php
  79. 2
      view/theme/smoothly/php/default.php
  80. 5
      view/theme/smoothly/theme.php
  81. 2
      view/theme/vier/theme.php

38
include/api.php

@ -130,7 +130,7 @@ function api_date($str)
*
* @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 bool $auth API need logged user
* @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['$rss'] = [
'alternate' => $user_info['url'],
'self' => System::baseUrl() . "/" . DI::args()->getQueryString(),
'base' => System::baseUrl(),
'self' => DI::baseUrl() . "/" . DI::args()->getQueryString(),
'base' => DI::baseUrl(),
'updated' => api_date(null),
'atom_updated' => DateTimeFormat::utcNow(DateTimeFormat::ATOM),
'language' => $user_info['lang'],
'logo' => System::baseUrl() . "/images/friendica-32.png",
'logo' => DI::baseUrl() . "/images/friendica-32.png",
];
return $arr;
@ -714,7 +714,7 @@ function api_get_user(App $a, $contact_id = null)
'statusnet_blocking' => false,
'notifications' => false,
/// @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'],
'uid' => intval($uinfo[0]['uid']),
'cid' => intval($uinfo[0]['cid']),
@ -1164,8 +1164,8 @@ function api_statuses_update($type)
$phototypes = Images::supportedTypes();
$ext = $phototypes[$r[0]['type']];
$description = $r[0]['desc'] ?? '';
$_REQUEST['body'] .= "\n\n" . '[url=' . System::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'] .= "\n\n" . '[url=' . DI::baseUrl() . '/photos/' . $r[0]['nickname'] . '/image/' . $r[0]['resource-id'] . ']';
$_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(
'|data:image/([^;]+)[^=]+=*|m',
function () use ($item) {
return System::baseUrl() . '/display/' . $item['guid'];
return DI::baseUrl() . '/display/' . $item['guid'];
},
$text
);
@ -3041,7 +3041,7 @@ function api_format_item($item, $type = "json", $status_user = null, $author_use
//'entities' => NULL,
'statusnet_html' => $converted["html"],
'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_title' => $item['title'],
'friendica_html' => BBCode::convert($item['body'], false)
@ -3569,13 +3569,13 @@ function api_statusnet_config($type)
{
$name = Config::get('config', 'sitename');
$server = DI::baseUrl()->getHostname();
$logo = System::baseUrl() . '/images/friendica-64.png';
$logo = DI::baseUrl() . '/images/friendica-64.png';
$email = Config::get('config', 'admin_email');
$closed = intval(Config::get('config', 'register_policy')) === \Friendica\Module\Register::CLOSED ? '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));
$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 = [
'site' => ['name' => $name,'server' => $server, 'theme' => 'default', 'path' => '',
@ -4313,7 +4313,7 @@ function api_fr_photos_list($type)
$photo['album'] = $rr['album'];
$photo['filename'] = $rr['filename'];
$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['edited'] = $rr['edited'];
$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()];
Photo::update(['profile' => false], $condition);
} else {
$fields = ['photo' => System::baseUrl() . '/photo/' . $data['photo']['id'] . '-4.' . $fileext,
'thumb' => System::baseUrl() . '/photo/' . $data['photo']['id'] . '-5.' . $fileext];
$fields = ['photo' => DI::baseUrl() . '/photo/' . $data['photo']['id'] . '-4.' . $fileext,
'thumb' => DI::baseUrl() . '/photo/' . $data['photo']['id'] . '-5.' . $fileext];
DBA::update('profile', $fields, ['id' => $_REQUEST['profile'], 'uid' => api_user()]);
}
Contact::updateSelfFromUserID(api_user(), true);
// 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'))) {
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
$arr['body'] = '[url=' . System::baseUrl() . '/photos/' . $owner_record['nick'] . '/image/' . $hash . ']'
. '[img]' . System::baseUrl() . '/photo/' . $hash . '-' . "2" . '.'. $typetoext[$filetype] . '[/img]'
$arr['body'] = '[url=' . DI::baseUrl() . '/photos/' . $owner_record['nick'] . '/image/' . $hash . ']'
. '[img]' . DI::baseUrl() . '/photo/' . $hash . '-' . "2" . '.'. $typetoext[$filetype] . '[/img]'
. '[/url]';
// 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++) {
$data['photo']['links'][$k . ":link"]["@attributes"] = ["type" => $data['photo']['type'],
"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 {
$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
$i = 0;
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++;
}
}

8
include/conversation.php

@ -86,7 +86,7 @@ function item_redir_and_replace_images($body, $images, $cid) {
while ($pos !== false && $cnt < 1000) {
$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]';
$newbody .= substr($origbody, 0, $pos['start']['open']);
@ -779,7 +779,7 @@ function conversation(App $a, array $items, Pager $pager, $mode, $update, $previ
}
$o = Renderer::replaceMacros($page_template, [
'$baseurl' => System::baseUrl($ssl_state),
'$baseurl' => DI::baseUrl()->get($ssl_state),
'$return_path' => DI::args()->getQueryString(),
'$live_update' => $live_update_div,
'$remove' => L10n::t('remove'),
@ -1173,7 +1173,7 @@ function status_editor(App $a, $x, $notes_cid = 0, $popup = false)
$tpl = Renderer::getMarkupTemplate('jot-header.tpl');
DI::page()['htmlhead'] .= Renderer::replaceMacros($tpl, [
'$newpost' => 'true',
'$baseurl' => System::baseUrl(true),
'$baseurl' => DI::baseUrl()->get(true),
'$geotag' => $geotag,
'$nickname' => $x['nickname'],
'$ispublic' => L10n::t('Visible to <strong>everybody</strong>'),
@ -1244,7 +1244,7 @@ function status_editor(App $a, $x, $notes_cid = 0, $popup = false)
'$posttype' => $notes_cid ? Item::PT_PERSONAL_NOTE : Item::PT_ARTICLE,
'$content' => $x['content'] ?? '',
'$post_id' => $x['post_id'] ?? '',
'$baseurl' => System::baseUrl(true),
'$baseurl' => DI::baseUrl()->get(true),
'$defloc' => $x['default_location'],
'$visitor' => $x['visitor'],
'$pvisit' => $notes_cid ? 'none' : $x['visitor'],

10
include/enotify.php

@ -59,7 +59,7 @@ function notification($params)
$banner = $l10n->t('Friendica Notification');
$product = FRIENDICA_PLATFORM;
$siteurl = System::baseUrl(true);
$siteurl = DI::baseUrl(true);
$thanks = $l10n->t('Thank You,');
$sitename = Config::get('config', 'sitename');
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-Version: ".FRIENDICA_VERSION."\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)) {
$title = $params['item']['title'];
@ -536,7 +536,7 @@ function notification($params)
$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_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"];
// 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 = [];
@ -764,7 +764,7 @@ function check_item_notification($itemid, $uid, $defaulttype = "") {
$params["uid"] = $uid;
$params["item"] = $item;
$params["parent"] = $item["parent"];
$params["link"] = System::baseUrl().'/display/'.urlencode($item["guid"]);
$params["link"] = DI::baseUrl().'/display/'.urlencode($item["guid"]);
$params["otype"] = 'item';
$params["source_name"] = $item["author-name"];
$params["source_link"] = $item["author-link"];

7
include/items.php

@ -9,7 +9,6 @@ use Friendica\Core\L10n;
use Friendica\Core\Logger;
use Friendica\Core\Protocol;
use Friendica\Core\Renderer;
use Friendica\Core\System;
use Friendica\Core\Session;
use Friendica\Database\DBA;
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
$hashtag = str_replace([" ", "+", "/", ".", "#", "'", "โ€™", "`", "(", ")", "โ€ž", "โ€œ"],
["", "", "", "", "", "", "", "", "", "", "", ""], $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 .= "#[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;
}
$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
$verify_token = ((strlen($contact['hub-verify'])) ? $contact['hub-verify'] : Strings::getRandomHex());

7
mod/cal.php

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

6
mod/dfrn_confirm.php

@ -177,7 +177,7 @@ function dfrn_confirm_post(App $a, $handsfree = null)
$params['dfrn_id'] = bin2hex($result);
$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);
$params['source_url'] = bin2hex($params['source_url']);
@ -469,7 +469,7 @@ function dfrn_confirm_post(App $a, $handsfree = null)
if (DBA::isResult($contact)) {
$photo = $contact['photo'];
} else {
$photo = System::baseUrl() . '/images/person-300.jpg';
$photo = DI::baseUrl() . '/images/person-300.jpg';
}
Contact::updateAvatar($photo, $local_uid, $dfrn_record);
@ -536,7 +536,7 @@ function dfrn_confirm_post(App $a, $handsfree = null)
'to_name' => $combined['username'],
'to_email' => $combined['email'],
'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_link' => $combined['url'],
'source_photo' => $combined['photo'],

8
mod/dfrn_request.php

@ -559,7 +559,7 @@ function dfrn_request_content(App $a)
'to_name' => $r[0]['username'],
'to_email' => $r[0]['email'],
'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_link' => $r[0]['url'],
'source_photo' => $r[0]['photo'],
@ -611,16 +611,16 @@ function dfrn_request_content(App $a)
$myaddr = $_GET['address'];
} elseif (local_user()) {
if (strlen(DI::baseUrl()->getUrlPath())) {
$myaddr = System::baseUrl() . '/profile/' . $a->user['nickname'];
$myaddr = DI::baseUrl() . '/profile/' . $a->user['nickname'];
} else {
$myaddr = $a->user['nickname'] . '@' . substr(System::baseUrl(), strpos(System::baseUrl(), '://') + 3);
$myaddr = $a->user['nickname'] . '@' . substr(DI::baseUrl(), strpos(DI::baseUrl(), '://') + 3);
}
} else {
// last, try a zrl
$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
* because nobody is going to read the comments and

13
mod/display.php

@ -18,7 +18,6 @@ use Friendica\Core\Session;
use Friendica\Database\DBA;
use Friendica\DI;
use Friendica\Model\Contact;
use Friendica\Model\Group;
use Friendica\Model\Item;
use Friendica\Model\Profile;
use Friendica\Module\Objects;
@ -100,8 +99,8 @@ function display_init(App $a)
$profiledata = display_fetchauthor($a, $item);
if (strstr(Strings::normaliseLink($profiledata["url"]), Strings::normaliseLink(System::baseUrl()))) {
$nickname = str_replace(Strings::normaliseLink(System::baseUrl())."/profile/", "", Strings::normaliseLink($profiledata["url"]));
if (strstr(Strings::normaliseLink($profiledata["url"]), Strings::normaliseLink(DI::baseUrl()))) {
$nickname = str_replace(Strings::normaliseLink(DI::baseUrl())."/profile/", "", Strings::normaliseLink($profiledata["url"]));
if ($nickname != $a->user["nickname"]) {
$profile = DBA::fetchFirst("SELECT `profile`.`uid` AS `profile_uid`, `profile`.* , `contact`.`avatar-date` AS picdate, `user`.* FROM `profile`
@ -232,8 +231,8 @@ function display_content(App $a, $update = false, $update_uid = 0)
$is_public = Item::exists(['id' => $item_id, 'private' => [0, 2]]);
if ($is_public) {
// 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';
$conversation = System::baseUrl().'/display/feed-item/'.$item_parent.'/conversation.atom';
$alternate = DI::baseUrl().'/display/feed-item/'.$item_id.'.atom';
$conversation = DI::baseUrl().'/display/feed-item/'.$item_parent.'/conversation.atom';
} else {
$alternate = '';
$conversation = '';
@ -363,7 +362,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:title" content="'.$title.'" />'."\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";
// Dublin Core
@ -373,7 +372,7 @@ function display_content(App $a, $update = false, $update_uid = 0)
// Open Graph
$page['htmlhead'] .= '<meta property="og:type" content="website" />'."\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:description" content="'.$description.'" />'."\n";
$page['htmlhead'] .= '<meta name="og:article:author" content="'.$author_name.'" />'."\n";

11
mod/events.php

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

7
mod/fbrowser.php

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

2
mod/follow.php

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

16
mod/item.php

@ -81,7 +81,7 @@ function item_post(App $a) {
if (!$preview && !empty($_REQUEST['post_id_random'])) {
if (!empty($_SESSION['post-random']) && $_SESSION['post-random'] == $_REQUEST['post_id_random']) {
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 {
$_SESSION['post-random'] = $_REQUEST['post_id_random'];
}
@ -537,7 +537,7 @@ function item_post(App $a) {
if (strlen($attachments)) {
$attachments .= ',';
}
$attachments .= '[attach]href="' . System::baseUrl() . '/attach/' . $attachment['id'] .
$attachments .= '[attach]href="' . DI::baseUrl() . '/attach/' . $attachment['id'] .
'" length="' . $attachment['filesize'] . '" type="' . $attachment['filetype'] .
'" title="' . ($attachment['filename'] ? $attachment['filename'] : '') . '"[/attach]';
}
@ -683,7 +683,7 @@ function item_post(App $a) {
$json = ['cancel' => 1];
if (!empty($_REQUEST['jsreload'])) {
$json['reload'] = System::baseUrl() . '/' . $_REQUEST['jsreload'];
$json['reload'] = DI::baseUrl() . '/' . $_REQUEST['jsreload'];
}
echo json_encode($json);
@ -757,7 +757,7 @@ function item_post(App $a) {
'to_email' => $user['email'],
'uid' => $user['uid'],
'item' => $datarray,
'link' => System::baseUrl().'/display/'.urlencode($datarray['guid']),
'link' => DI::baseUrl().'/display/'.urlencode($datarray['guid']),
'source_name' => $datarray['author-name'],
'source_link' => $datarray['author-link'],
'source_photo' => $datarray['author-avatar'],
@ -777,7 +777,7 @@ function item_post(App $a) {
'to_email' => $user['email'],
'uid' => $user['uid'],
'item' => $datarray,
'link' => System::baseUrl().'/display/'.urlencode($datarray['guid']),
'link' => DI::baseUrl().'/display/'.urlencode($datarray['guid']),
'source_name' => $datarray['author-name'],
'source_link' => $datarray['author-link'],
'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'])
. '<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;
if (!$datarray['title']=='') {
$subject = Email::encodeHeader($datarray['title'], 'UTF-8');
} else {
$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);
$message = '<html><body>' . $link . $html . $disclaimer . '</body></html>';
$params = [
@ -841,7 +841,7 @@ function item_post(App $a) {
return $post_id;
}
item_post_return(System::baseUrl(), $api_source, $return_path);
item_post_return(DI::baseUrl(), $api_source, $return_path);
// NOTREACHED
}

9
mod/lostpass.php

@ -8,7 +8,6 @@ use Friendica\App;
use Friendica\Core\Config;
use Friendica\Core\L10n;
use Friendica\Core\Renderer;
use Friendica\Core\System;
use Friendica\Database\DBA;
use Friendica\DI;
use Friendica\Model\User;
@ -41,7 +40,7 @@ function lostpass_post(App $a)
}
$sitename = Config::get('config', 'sitename');
$resetlink = System::baseUrl() . '/lostpass/' . $pwdreset_token;
$resetlink = DI::baseUrl() . '/lostpass/' . $pwdreset_token;
$preamble = Strings::deindent(L10n::t('
Dear %1$s,
@ -65,7 +64,7 @@ function lostpass_post(App $a)
The login details are as follows:
Site Location: %2$s
Login Name: %3$s', $resetlink, System::baseUrl(), $user['nickname']));
Login Name: %3$s', $resetlink, DI::baseUrl(), $user['nickname']));
notification([
'type' => SYSTEM_EMAIL,
@ -138,7 +137,7 @@ function lostpass_generate_password($user)
'$lbl2' => L10n::t('Your password has been reset as requested.'),
'$lbl3' => L10n::t('Your new password is'),
'$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.'),
'$newpass' => $new_password,
]);
@ -160,7 +159,7 @@ function lostpass_generate_password($user)
Password: %3$s
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([
'type' => SYSTEM_EMAIL,

6
mod/match.php

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

14
mod/message.php

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

6
mod/msearch.php

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

7
mod/noscrape.php

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

6
mod/oexchange.php

@ -5,7 +5,7 @@
use Friendica\App;
use Friendica\Core\L10n;
use Friendica\Core\Renderer;
use Friendica\Core\System;
use Friendica\DI;
use Friendica\Module\Security\Login;
use Friendica\Util\Network;
use Friendica\Util\Strings;
@ -15,7 +15,7 @@ function oexchange_init(App $a) {
if (($a->argc > 1) && ($a->argv[1] === 'xrd')) {
$tpl = Renderer::getMarkupTemplate('oexchange_xrd.tpl');
$o = Renderer::replaceMacros($tpl, ['$base' => System::baseUrl()]);
$o = Renderer::replaceMacros($tpl, ['$base' => DI::baseUrl()]);
echo $o;
exit();
}
@ -42,7 +42,7 @@ function oexchange_content(App $a) {
$tags = ((!empty($_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)) {
return;

5
mod/ostatus_subscribe.php

@ -7,7 +7,6 @@ use Friendica\App;
use Friendica\Core\L10n;
use Friendica\Core\PConfig;
use Friendica\Core\Protocol;
use Friendica\Core\System;
use Friendica\DI;
use Friendica\Model\Contact;
use Friendica\Network\Probe;
@ -63,7 +62,7 @@ function ostatus_subscribe_content(App $a)
$total = sizeof($friends);
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_contact');
$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>';
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;
}

20
mod/photos.php

@ -398,8 +398,8 @@ function photos_post(App $a)
$arr['visible'] = $visibility;
$arr['origin'] = 1;
$arr['body'] = '[url=' . System::baseUrl() . '/photos/' . $a->data['user']['nickname'] . '/image/' . $photo['resource-id'] . ']'
. '[img]' . System::baseUrl() . '/photo/' . $photo['resource-id'] . '-' . $photo['scale'] . '.'. $ext . '[/img]'
$arr['body'] = '[url=' . DI::baseUrl() . '/photos/' . $a->data['user']['nickname'] . '/image/' . $photo['resource-id'] . ']'
. '[img]' . DI::baseUrl() . '/photo/' . $photo['resource-id'] . '-' . $photo['scale'] . '.'. $ext . '[/img]'
. '[/url]';
$item_id = Item::insert($arr);
@ -509,7 +509,7 @@ function photos_post(App $a)
}
} elseif (strpos($tag, '#') === 0) {
$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['inform'] = $tagged[2];
$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'] .= "\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'] = 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=' . 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'] .= '<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['target'] = '<target><type>' . Activity\ObjectType::IMAGE . '</type><title>' . $photo['desc'] . '</title><id>'
. System::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>';
. DI::baseUrl() . '/photos/' . $owner_record['nickname'] . '/image/' . $photo['resource-id'] . '</id>';
$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);
}
@ -804,8 +804,8 @@ function photos_post(App $a)
$arr['visible'] = $visible;
$arr['origin'] = 1;
$arr['body'] = '[url=' . System::baseUrl() . '/photos/' . $owner_record['nickname'] . '/image/' . $resource_id . ']'
. '[img]' . System::baseUrl() . "/photo/{$resource_id}-{$smallest}.".$image->getExt() . '[/img]'
$arr['body'] = '[url=' . DI::baseUrl() . '/photos/' . $owner_record['nickname'] . '/image/' . $resource_id . ']'
. '[img]' . DI::baseUrl() . "/photo/{$resource_id}-{$smallest}.".$image->getExt() . '[/img]'
. '[/url]';
$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'] .= '<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:height" content="' . $photo["height"] . '" />' . "\n";

10
mod/ping.php

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

2
mod/poke.php

@ -158,7 +158,7 @@ function poke_content(App $a)
$head_tpl = Renderer::getMarkupTemplate('poke_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');

9
mod/profile_photo.php

@ -8,7 +8,6 @@ use Friendica\BaseModule;
use Friendica\Core\Config;
use Friendica\Core\L10n;
use Friendica\Core\Renderer;
use Friendica\Core\System;
use Friendica\Core\Worker;
use Friendica\Database\DBA;
use Friendica\DI;
@ -115,8 +114,8 @@ function profile_photo_post(App $a)
);
} else {
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(System::baseUrl() . '/photo/' . $base_image['resource-id'] . '-5.' . $Image->getExt()),
DBA::escape(DI::baseUrl() . '/photo/' . $base_image['resource-id'] . '-4.' . $Image->getExt()),
DBA::escape(DI::baseUrl() . '/photo/' . $base_image['resource-id'] . '-5.' . $Image->getExt()),
intval($_REQUEST['profile']), intval(local_user())
);
}
@ -249,7 +248,7 @@ function profile_photo_content(App $a)
'$profiles' => $profiles,
'$form_security_token' => BaseModule::getFormSecurityToken("profile_photo"),
'$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;
@ -261,7 +260,7 @@ function profile_photo_content(App $a)
'$filename' => $filename,
'$profile' => (isset($_REQUEST['profile']) ? intval($_REQUEST['profile']) : 0),
'$resource' => $imagecrop['hash'] . '-' . $imagecrop['resolution'],
'$image_url' => System::baseUrl() . '/photo/' . $filename,
'$image_url' => DI::baseUrl() . '/photo/' . $filename,
'$title' => L10n::t('Crop Image'),
'$desc' => L10n::t('Please adjust the image cropping for optimum viewing.'),
'$form_security_token' => BaseModule::getFormSecurityToken("profile_photo"),

5
mod/profiles.php

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

4
mod/pubsubhubbub.php

@ -3,8 +3,8 @@
use Friendica\App;
use Friendica\Core\Config;
use Friendica\Core\Logger;
use Friendica\Core\System;
use Friendica\Database\DBA;
use Friendica\DI;
use Friendica\Model\PushSubscriber;
use Friendica\Util\Network;
use Friendica\Util\Strings;
@ -89,7 +89,7 @@ function pubsubhubbub_init(App $a) {
// sanity check that topic URLs are the same
$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)) {
Logger::log('Hub topic ' . $hub_topic . ' != ' . $contact['poll']);

2
mod/redir.php

@ -149,7 +149,7 @@ function redir_magic($a, $cid, $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
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]);
System::externalRedirect($target_url);
}

3
mod/regmod.php

@ -6,7 +6,6 @@
use Friendica\App;
use Friendica\Core\Config;
use Friendica\Core\L10n;
use Friendica\Core\System;
use Friendica\Core\Worker;
use Friendica\Database\DBA;
use Friendica\DI;
@ -33,7 +32,7 @@ function user_allow($hash)
$profile = DBA::selectFirst('profile', ['net-publish'], ['uid' => $register['uid'], 'is-default' => true]);
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);
}

5
mod/repair_ostatus.php

@ -6,7 +6,6 @@
use Friendica\App;
use Friendica\Core\L10n;
use Friendica\Core\Protocol;
use Friendica\Core\System;
use Friendica\Database\DBA;
use Friendica\DI;
use Friendica\Model\Contact;
@ -23,8 +22,6 @@ function repair_ostatus_content(App $a) {
$uid = local_user();
$a = \get_app();
$counter = intval($_REQUEST['counter']);
$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);
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;
}

13
mod/settings.php

@ -15,7 +15,6 @@ use Friendica\Core\Logger;
use Friendica\Core\PConfig;
use Friendica\Core\Renderer;
use Friendica\Core\Session;
use Friendica\Core\System;
use Friendica\Core\Theme;
use Friendica\Core\Worker;
use Friendica\Database\DBA;
@ -787,7 +786,7 @@ function settings_content(App $a)
if (!empty($legacy_contact)) {
/// @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 = '';
@ -851,7 +850,7 @@ function settings_content(App $a)
'$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.")],
'$repair_ostatus_url' => System::baseUrl() . '/repair_ostatus',
'$repair_ostatus_url' => DI::baseUrl() . '/repair_ostatus',
'$repair_ostatus_text' => L10n::t('Repair OStatus subscriptions'),
'$settings_connectors' => $settings_connectors,
@ -949,7 +948,7 @@ function settings_content(App $a)
'$ptitle' => L10n::t('Display Settings'),
'$form_security_token' => BaseModule::getFormSecurityToken("settings_display"),
'$submit' => L10n::t('Save Settings'),
'$baseurl' => System::baseUrl(true),
'$baseurl' => DI::baseUrl()->get(true),
'$uid' => local_user(),
'$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" />';
} else {
$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');
$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()
]);
@ -1174,7 +1173,7 @@ function settings_content(App $a)
'$ptitle' => L10n::t('Account Settings'),
'$submit' => L10n::t('Save Settings'),
'$baseurl' => System::baseUrl(true),
'$baseurl' => DI::baseUrl()->get(true),
'$uid' => local_user(),
'$form_security_token' => BaseModule::getFormSecurityToken("settings"),
'$nickname_block' => $prof_addr,

5
mod/subthread.php

@ -10,6 +10,7 @@ use Friendica\Core\Logger;
use Friendica\Core\Session;
use Friendica\Core\System;
use Friendica\Database\DBA;
use Friendica\DI;
use Friendica\Model\Item;
use Friendica\Protocol\Activity;
use Friendica\Util\Security;
@ -90,7 +91,7 @@ function subthread_content(App $a) {
$post_type = (($item['resource-id']) ? L10n::t('photo') : L10n::t('status'));
$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'];
$obj = <<< EOT
@ -131,7 +132,7 @@ EOT;
$ulink = '[url=' . $contact['url'] . ']' . $contact['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['verb'] = $activity;

5
mod/suggest.php

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

7
mod/tagger.php

@ -11,6 +11,7 @@ use Friendica\Core\Session;
use Friendica\Core\System;
use Friendica\Core\Worker;
use Friendica\Database\DBA;
use Friendica\DI;
use Friendica\Model\Item;
use Friendica\Protocol\Activity;
use Friendica\Util\Strings;
@ -71,7 +72,7 @@ function tagger_content(App $a) {
$xterm = XML::escape($term);
$post_type = (($item['resource-id']) ? L10n::t('photo') : L10n::t('status'));
$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");
@ -88,7 +89,7 @@ function tagger_content(App $a) {
</target>
EOT;
$tagid = System::baseUrl() . '/search?tag=' . $xterm;
$tagid = DI::baseUrl() . '/search?tag=' . $xterm;
$objtype = Activity\ObjectType::TAGTERM;
$obj = <<< EOT
@ -108,7 +109,7 @@ EOT;
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 = [];

3
mod/unfollow.php

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

13
mod/videos.php

@ -9,17 +9,14 @@ use Friendica\Content\Pager;
use Friendica\Core\Config;
use Friendica\Core\L10n;
use Friendica\Core\Renderer;
use Friendica\Core\System;
use Friendica\Core\Session;
use Friendica\Database\DBA;
use Friendica\DI;
use Friendica\Model\Attach;
use Friendica\Model\Contact;
use Friendica\Model\Group;
use Friendica\Model\Item;
use Friendica\Model\Profile;
use Friendica\Model\User;
use Friendica\Protocol\DFRN;
use Friendica\Util\Security;
function videos_init(App $a)
@ -235,13 +232,13 @@ function videos_content(App $a)
$videos[] = [
'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'),
'src' => System::baseUrl() . '/attach/' . $rr['id'] . '?attachment=0',
'src' => DI::baseUrl() . '/attach/' . $rr['id'] . '?attachment=0',
'alt' => $alt_e,
'mime' => $rr['filetype'],
'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']),