Move redundant System::baseUrl() to DI::baseUrl() calls
This commit is contained in:
+19
-19
@@ -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++;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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'],
|
||||
|
||||
+5
-5
@@ -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"];
|
||||
|
||||
+3
-4
@@ -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());
|
||||
|
||||
Reference in New Issue
Block a user