App::get_baseurl is now replaced with System::baseUrl

This commit is contained in:
Michael 2017-08-26 07:32:10 +00:00
parent 3c24bed412
commit 5adfeb0bd5
134 changed files with 603 additions and 624 deletions

View file

@ -97,7 +97,7 @@ $called_api = null;
*
* Register a function to be the endpont for defined API path.
*
* @param string $path API URL path, relative to App::get_baseurl()
* @param string $path API URL path, relative to System::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.
@ -437,12 +437,12 @@ $called_api = null;
$arr['$user'] = $user_info;
$arr['$rss'] = array(
'alternate' => $user_info['url'],
'self' => App::get_baseurl() . "/" . $a->query_string,
'base' => App::get_baseurl(),
'self' => System::baseUrl() . "/" . $a->query_string,
'base' => System::baseUrl(),
'updated' => api_date(null),
'atom_updated' => datetime_convert('UTC', 'UTC', 'now', ATOM_TIME),
'language' => $user_info['language'],
'logo' => App::get_baseurl() . "/images/friendica-32.png",
'logo' => System::baseUrl() . "/images/friendica-32.png",
);
return $arr;
@ -755,7 +755,7 @@ $called_api = null;
'statusnet_blocking' => false,
'notifications' => false,
/// @TODO old way?
//'statusnet_profile_url' => App::get_baseurl()."/contacts/".$uinfo[0]['cid'],
//'statusnet_profile_url' => System::baseUrl()."/contacts/".$uinfo[0]['cid'],
'statusnet_profile_url' => $uinfo[0]['url'],
'uid' => intval($uinfo[0]['uid']),
'cid' => intval($uinfo[0]['cid']),
@ -1165,8 +1165,8 @@ $called_api = null;
if (dbm::is_result($r)) {
$phototypes = Photo::supportedTypes();
$ext = $phototypes[$r[0]['type']];
$_REQUEST['body'] .= "\n\n" . '[url=' . App::get_baseurl() . '/photos/' . $r[0]['nickname'] . '/image/' . $r[0]['resource-id'] . ']';
$_REQUEST['body'] .= '[img]' . App::get_baseurl() . '/photo/' . $r[0]['resource-id'] . '-' . $r[0]['scale'] . '.' . $ext . '[/img][/url]';
$_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 . '[/img][/url]';
}
}
@ -1930,7 +1930,7 @@ $called_api = null;
$start = $page * $count;
// Ugly code - should be changed
$myurl = App::get_baseurl() . '/profile/'. $a->user['nickname'];
$myurl = System::baseUrl() . '/profile/'. $a->user['nickname'];
$myurl = substr($myurl,strpos($myurl, '://') + 3);
//$myurl = str_replace(array('www.','.'),array('','\\.'),$myurl);
$myurl = str_replace('www.', '', $myurl);
@ -2495,7 +2495,7 @@ $called_api = null;
$text = preg_replace_callback(
"|data:image/([^;]+)[^=]+=*|m",
function($match) use ($item) {
return App::get_baseurl()."/display/".$item['guid'];
return System::baseUrl()."/display/".$item['guid'];
},
$text);
return $text;
@ -2912,7 +2912,7 @@ $called_api = null;
$name = $a->config['sitename'];
$server = $a->get_hostname();
$logo = App::get_baseurl() . '/images/friendica-64.png';
$logo = System::baseUrl() . '/images/friendica-64.png';
$email = $a->config['admin_email'];
$closed = (($a->config['register_policy'] == REGISTER_CLOSED) ? 'true' : 'false');
$private = ((Config::get('system', 'block_public')) ? 'true' : 'false');
@ -2921,7 +2921,7 @@ $called_api = null;
$texlimit = string($a->config['api_import_size']);
}
$ssl = ((Config::get('system', 'have_ssl')) ? 'true' : 'false');
$sslserver = (($ssl === 'true') ? str_replace('http:','https:',App::get_baseurl()) : '');
$sslserver = (($ssl === 'true') ? str_replace('http:','https:',System::baseUrl()) : '');
$config = array(
'site' => array('name' => $name,'server' => $server, 'theme' => 'default', 'path' => '',
@ -3423,7 +3423,7 @@ $called_api = null;
$photo['album'] = $rr['album'];
$photo['filename'] = $rr['filename'];
$photo['type'] = $rr['type'];
$thumb = App::get_baseurl() . "/photo/" . $rr['resource-id'] . "-" . $rr['scale'] . "." . $typetoext[$rr['type']];
$thumb = System::baseUrl() . "/photo/" . $rr['resource-id'] . "-" . $rr['scale'] . "." . $typetoext[$rr['type']];
$photo['created'] = $rr['created'];
$photo['edited'] = $rr['edited'];
$photo['desc'] = $rr['desc'];
@ -3721,15 +3721,15 @@ $called_api = null;
);
$r = q("UPDATE `contact` SET `photo` = '%s', `thumb` = '%s', `micro` = '%s' WHERE `self` AND `uid` = %d",
dbesc(App::get_baseurl() . '/photo/' . $data['photo']['id'] . '-4.' . $fileext),
dbesc(App::get_baseurl() . '/photo/' . $data['photo']['id'] . '-5.' . $fileext),
dbesc(App::get_baseurl() . '/photo/' . $data['photo']['id'] . '-6.' . $fileext),
dbesc(System::baseUrl() . '/photo/' . $data['photo']['id'] . '-4.' . $fileext),
dbesc(System::baseUrl() . '/photo/' . $data['photo']['id'] . '-5.' . $fileext),
dbesc(System::baseUrl() . '/photo/' . $data['photo']['id'] . '-6.' . $fileext),
intval(local_user())
);
} else {
$r = q("UPDATE `profile` SET `photo` = '%s', `thumb` = '%s' WHERE `id` = %d AND `uid` = %d",
dbesc(App::get_baseurl() . '/photo/' . $data['photo']['id'] . '-4.' . $filetype),
dbesc(App::get_baseurl() . '/photo/' . $data['photo']['id'] . '-5.' . $filetype),
dbesc(System::baseUrl() . '/photo/' . $data['photo']['id'] . '-4.' . $filetype),
dbesc(System::baseUrl() . '/photo/' . $data['photo']['id'] . '-5.' . $filetype),
intval($_REQUEST['profile']),
intval(local_user())
);
@ -3745,7 +3745,7 @@ $called_api = null;
// Update global directory in background
//$user = api_get_user(get_app());
$url = App::get_baseurl() . '/profile/' . get_app()->user['nickname'];
$url = System::baseUrl() . '/profile/' . get_app()->user['nickname'];
if ($url && strlen(get_config('system', 'directory'))) {
proc_run(PRIORITY_LOW, "include/directory.php", $url);
}
@ -3974,8 +3974,8 @@ $called_api = null;
);
// adds link to the thumbnail scale photo
$arr['body'] = '[url=' . App::get_baseurl() . '/photos/' . $owner_record[0]['name'] . '/image/' . $hash . ']'
. '[img]' . App::get_baseurl() . '/photo/' . $hash . '-' . "2" . '.'. $typetoext[$filetype] . '[/img]'
$arr['body'] = '[url=' . System::baseUrl() . '/photos/' . $owner_record[0]['name'] . '/image/' . $hash . ']'
. '[img]' . System::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
@ -4018,14 +4018,14 @@ $called_api = null;
for ($k = intval($data['photo']['minscale']); $k <= intval($data['photo']['maxscale']); $k++) {
$data['photo']['links'][$k . ":link"]["@attributes"] = array("type" => $data['photo']['type'],
"scale" => $k,
"href" => App::get_baseurl() . "/photo/" . $data['photo']['resource-id'] . "-" . $k . "." . $typetoext[$data['photo']['type']]);
"href" => System::baseUrl() . "/photo/" . $data['photo']['resource-id'] . "-" . $k . "." . $typetoext[$data['photo']['type']]);
}
} else {
$data['photo']['link'] = array();
// 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] = App::get_baseurl() . "/photo/" . $data['photo']['resource-id'] . "-" . $k . "." . $typetoext[$data['photo']['type']];
$data['photo']['link'][$i] = System::baseUrl() . "/photo/" . $data['photo']['resource-id'] . "-" . $k . "." . $typetoext[$data['photo']['type']];
$i++;
}
}