return true;
}
+/**
+ * util_check_url() - determines if given URL is valid.
+ *
+ * Currently, test is very basic, only the protocol is
+ * checked, allowed values are: http, https, ftp.
+ *
+ * @param string The URL
+ * @return boolean true if valid, false if not valid.
+ */
+function util_check_url($url) {
+ return (preg_match('/^(http|https|ftp):\/\//', $url) > 0);
+}
+
/**
* util_send_message() - Send email
* This function should be used in place of the PHP mail() function
global $sys_bcc_all_email_address,$sys_sendmail_path;
if (!$to) {
- $to='noreply@'.$GLOBALS['sys_default_domain'];
+ $to='noreply@'.forge_get_config('web_host');
}
if (!$from) {
- $from='noreply@'.$GLOBALS['sys_default_domain'];
+ $from='noreply@'.forge_get_config('web_host');
}
else
$url = "http://" ;
- $url .= $GLOBALS['sys_default_domain'] ;
+ $url .= forge_get_config('web_host') ;
$url .= util_make_uri ($path) ;
return $url ;
}
return true;
}
+// array_replace_recursive only appeared in PHP 5.3.0
+if (!function_exists('array_replace_recursive')) {
+ function array_replace_recursive ($a1, $a2) {
+ $result = $a1 ;
+
+ if (!is_array ($a2)) {
+ return $a2 ;
+ }
+
+ foreach ($a2 as $k => $v) {
+ if (!is_array ($v) ||
+ !isset ($result[$k]) || !is_array ($result[$k])) {
+ $result[$k] = $v ;
+ }
+
+ $result[$k] = array_replace_recursive ($result[$k],
+ $v) ;
+ }
+
+ return $result ;
+ }
+}
+
// Local Variables:
// mode: php
// c-file-style: "bsd"