summaryrefslogtreecommitdiff
path: root/includes/common.inc
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2001-05-15 18:38:57 +0000
committerDries Buytaert <dries@buytaert.net>2001-05-15 18:38:57 +0000
commit14ddbc473c3ccfc03773bd684cd41255cc951507 (patch)
tree3310c06c4323dfc5690d6e78236158b7bac2f428 /includes/common.inc
parent1da587a9d9df433952981da62dda4f2b216799c7 (diff)
downloadbrdo-14ddbc473c3ccfc03773bd684cd41255cc951507.tar.gz
brdo-14ddbc473c3ccfc03773bd684cd41255cc951507.tar.bz2
- Created 2 new functions:
+ path_uri(): returns the fully-qualified URI of your drupal site. + path_img(): returns the image directory or http://image-server.com/ in case you prefer to load-balance bandwidth usage. Replaced all occurences of the variable "site_url" with path_uri() and removed "site_url" from "setting.module". - Drastically simplified the node_save() API, which should make the node-forms more secure. Updated "story.module", "book.module", "forum.module", "page.module" and "node.module" to reflect this change. This is needs more testing so hit it, beat it, tease it. - Fixed an occasional glitch in the configuration file loading logic. - Made "queue.module" display an informative notice when an anonymous user tries accessing the moderation queue. - Updated the hard-coded information in drupal.module a bit.
Diffstat (limited to 'includes/common.inc')
-rw-r--r--includes/common.inc17
1 files changed, 16 insertions, 1 deletions
diff --git a/includes/common.inc b/includes/common.inc
index 49b55eb54..99f87a1f4 100644
--- a/includes/common.inc
+++ b/includes/common.inc
@@ -5,7 +5,8 @@ $na = "<I>na</I>";
function conf_init() {
global $HTTP_HOST, $REQUEST_URI;
$file = strtolower(strtr($HTTP_HOST ."". substr($REQUEST_URI, 0, strrpos($REQUEST_URI, "/")), "/:", ".."));
- return file_exists("includes/$file.php") ? $file : "setting";
+ while ($file && !file_exists("includes/$file.php")) $file = substr($file, 0, strrpos($file, "."));
+ return $file ? $file : "setting";
}
function error_handler($errno, $message, $filename, $line, $variables) {
@@ -37,6 +38,20 @@ function throttle($type, $rate) {
}
}
+function path_uri() {
+ global $HTTP_HOST, $REQUEST_URI;
+ $REQUEST_URI = strstr("export/", $REQUEST_URI);
+ return "http://". $HTTP_HOST . substr($REQUEST_URI, 0, strrpos($REQUEST_URI, "/")) ."/";
+}
+
+function path_img() {
+ // use "http://your-image-server.com/ if you want to host images on a seperate server.
+ return "./images/";
+}
+
+function notice_account() {
+ return t("This page requires a valid user account. Please <A HREF=\"account.php\">create a user account</A> and <A HREF=\"account.php\">login</A> prior to accessing it.");
+}
function check_textfield($message) {
return strip_tags(str_replace("\"", "&quot;", stripslashes($message)));