summaryrefslogtreecommitdiff
path: root/include/functions.php
diff options
context:
space:
mode:
Diffstat (limited to 'include/functions.php')
-rw-r--r--include/functions.php25
1 files changed, 23 insertions, 2 deletions
diff --git a/include/functions.php b/include/functions.php
index f273e2f80..d99f6a64b 100644
--- a/include/functions.php
+++ b/include/functions.php
@@ -30,6 +30,27 @@
require_once 'config.php';
+ /**
+ * Define a constant if not already defined
+ *
+ * @param string $name The constant name.
+ * @param mixed $value The constant value.
+ * @access public
+ * @return boolean True if defined successfully or not.
+ */
+ function define_default($name, $value) {
+ // Note: performence freaks should define everything in
+ // tunables.php in config.php becasue if will make defined()
+ // run much faster, see 'tris+php at tfconsulting dot com dot
+ // au' comment here:
+ // http://www.php.net/manual/en/function.defined.php#89886
+ defined($name) or define($name, $value);
+ }
+
+ // Require tunables.php to define tunable constants (That may have
+ // already been denied in config.php)
+ require_once 'tunables.php';
+
if (DB_TYPE == "pgsql") {
define('SUBSTRING_FOR_DATE', 'SUBSTRING_FOR_DATE');
} else {
@@ -308,8 +329,8 @@
array("If-Modified-Since: ".gmdate('D, d M Y H:i:s \G\M\T', $timestamp)));
}
- curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout ? $timeout : 15);
- curl_setopt($ch, CURLOPT_TIMEOUT, $timeout ? $timeout : 45);
+ curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout ? $timeout : FILE_FETCH_CONNECT_TIMEOUT);
+ curl_setopt($ch, CURLOPT_TIMEOUT, $timeout ? $timeout : FILE_FETCH_TIMEOUT);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, !ini_get("safe_mode"));
curl_setopt($ch, CURLOPT_MAXREDIRS, 20);
curl_setopt($ch, CURLOPT_BINARYTRANSFER, true);