* @return string homepage URL.
*/
function getHomePage() {
+ if (!preg_match("/^[a-zA-Z][a-zA-Z0-9+.-]*:/",
+ $this->data_array['homepage'])) {
+ $this->data_array['homepage'] = util_url_prefix() .
+ $this->data_array['homepage'];
+ }
return $this->data_array['homepage'];
}
}
/**
- * Construct the base URL http[s]://forge_name[:port]
+ * Return URL prefix (http:// or https://)
*
- * @return string base URL
+ * @return string URL prefix
*/
-function util_make_base_url() {
+function util_url_prefix() {
if (forge_get_config('use_ssl')) {
- $url = "https://" ;
+ return "https://";
} else {
- $url = "http://" ;
+ return "http://";
}
+}
+
+/**
+ * Construct the base URL http[s]://forge_name[:port]
+ *
+ * @return string base URL
+ */
+function util_make_base_url() {
+ $url = util_url_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') ;
}
return $url;
}
+
/**
* Construct full URL from a relative path
*
// ################# Homepage Link
echo '<div class="public-area-box" rel="doap:homepage">';
- if ( util_check_url($project->getHomePage())) {
- echo util_make_link ($project->getHomePage(), $HTML->getHomePic(_('Home Page')) . ' ' . _('Project Home Page'), false, true);
- } else {
- echo util_make_link ('http://' . $project->getHomePage(), $HTML->getHomePic(_('Home Page')) . ' ' . _('Project Home Page'), false, true);
- }
+ echo util_make_link($project->getHomePage(),
+ $HTML->getHomePic(_('Home Page')) . ' ' .
+ _('Project Home Page'), false, true);
echo "</div>\n";
// ################## ArtifactTypes