projects
/
fusionforge
/
fusionforge.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
project home
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
add optional forced http|https prefix to util_make_url() and its subcalls
[fusionforge/fusionforge.git]
/
src
/
common
/
include
/
utils.php
diff --git
a/src/common/include/utils.php
b/src/common/include/utils.php
index e0fc10b8a171b0aad2c8e5c9de1442b28e726a9b..01e07b9f0309ab62288518264b899c9b599d4e11 100644
(file)
--- a/
src/common/include/utils.php
+++ b/
src/common/include/utils.php
@@
-1081,23
+1081,30
@@
function normalized_urlprefix() {
/**
* Return URL prefix (http:// or https://)
*
/**
* Return URL prefix (http:// or https://)
*
+ * @param string $prefix (optional) : 'http' or 'https' to force it
* @return string URL prefix
*/
* @return string URL prefix
*/
-function util_url_prefix() {
- if (forge_get_config('use_ssl')) {
- return "https://";
- } else {
- return "http://";
+function util_url_prefix($prefix = '') {
+ if ($prefix == 'http' || $prefix == 'https' ) {
+ return $prefix . '://';
+ }
+ else {
+ if (forge_get_config('use_ssl')) {
+ return "https://";
+ } else {
+ return "http://";
+ }
}
}
/**
* Construct the base URL http[s]://forge_name[:port]
*
}
}
/**
* Construct the base URL http[s]://forge_name[:port]
*
+ * @param string $prefix (optional) : 'http' or 'https' to force it
* @return string base URL
*/
* @return string base URL
*/
-function util_make_base_url() {
- $url = util_url_prefix();
+function util_make_base_url(
$prefix = ''
) {
+ $url = util_url_prefix(
$prefix
);
$url .= forge_get_config('web_host') ;
if (forge_get_config('https_port') && (forge_get_config('https_port') != 443)) {
$url .= ":".forge_get_config('https_port') ;
$url .= forge_get_config('web_host') ;
if (forge_get_config('https_port') && (forge_get_config('https_port') != 443)) {
$url .= ":".forge_get_config('https_port') ;
@@
-1108,11
+1115,12
@@
function util_make_base_url() {
/**
* Construct full URL from a relative path
*
/**
* Construct full URL from a relative path
*
- * @param string $path
+ * @param string $path (optional)
+ * @param string $prefix (optional) : 'http' or 'https' to force it
* @return string URL
*/
* @return string URL
*/
-function util_make_url($path = '') {
- $url = util_make_base_url().util_make_uri($path) ;
+function util_make_url($path = ''
, $prefix = ''
) {
+ $url = util_make_base_url(
$prefix
).util_make_uri($path) ;
return $url;
}
return $url;
}