X-Git-Url: https://scm.fusionforge.org/anonscm/gitweb?p=fusionforge%2Ffusionforge.git;a=blobdiff_plain;f=gforge%2Fcommon%2Finclude%2Futils.php;h=379aeb6951590d2fc81172000ccb736f7276aa6b;hp=efbb8409312925d9c863432ec02893247c1162bd;hb=0bee22f97b4930389f088d4358b45bcc9797c8dc;hpb=4ea091de96c45ff2405f9d26b3396eaaa9b4e723
diff --git a/gforge/common/include/utils.php b/gforge/common/include/utils.php
index efbb840931..379aeb6951 100644
--- a/gforge/common/include/utils.php
+++ b/gforge/common/include/utils.php
@@ -975,6 +975,11 @@ function util_strip_accents($text) {
return utf8_encode($find);
}
+/**
+ * Constructs the forge's URL prefix out of $GLOBALS['sys_urlprefix']
+ *
+ * @return string
+ */
function normalized_urlprefix () {
$prefix = $GLOBALS['sys_urlprefix'] ;
$prefix = ereg_replace ("^/", "", $prefix) ;
@@ -985,6 +990,12 @@ function normalized_urlprefix () {
return $prefix ;
}
+/**
+ * Construct full URL from a relative path
+ *
+ * @param string $path
+ * @return string URL
+ */
function util_make_url ($path) {
if ($GLOBALS['sys_use_ssl'])
$url = "https://" ;
@@ -996,6 +1007,12 @@ function util_make_url ($path) {
return $url ;
}
+/**
+ * Construct proper (relative) URI (prepending prefix)
+ *
+ * @param string $path
+ * @return string URI
+ */
function util_make_uri ($path) {
$path = ereg_replace ("^/", "", $path) ;
$uri = normalized_urlprefix () ;
@@ -1017,10 +1034,25 @@ function util_make_link ($path, $text, $extra_params=false, $absolute=false) {
}
}
+/**
+ * Create an HTML link to a user's profile page
+ *
+ * @param string $username
+ * @param int $user_id
+ * @param string $text
+ * @return string
+ */
function util_make_link_u ($username, $user_id,$text) {
return '' . $text . '' ;
}
+/**
+ * Create URL for user's profile page
+ *
+ * @param string $username
+ * @param int $user_id
+ * @return string URL
+ */
function util_make_url_u ($username, $user_id) {
if (isset ($GLOBALS['sys_noforcetype']) && $GLOBALS['sys_noforcetype']) {
return util_make_url ("/developer/?user_id=$user_id");
@@ -1029,10 +1061,24 @@ function util_make_url_u ($username, $user_id) {
}
}
+/**
+ * Create a HTML link to a project's page
+ * @param string $groupame
+ * @param int $group_id
+ * @param string $text
+ * @return string
+ */
function util_make_link_g ($groupame, $group_id,$text) {
return '' . $text . '' ;
}
+/**
+ * Create URL for a project's page
+ *
+ * @param string $groupame
+ * @param int $group_id
+ * @return string
+ */
function util_make_url_g ($groupame, $group_id) {
if (isset ($GLOBALS['sys_noforcetype']) && $GLOBALS['sys_noforcetype']) {
return util_make_url ("/project/?group_id=$group_id");