From 14ddbc473c3ccfc03773bd684cd41255cc951507 Mon Sep 17 00:00:00 2001 From: Dries Buytaert Date: Tue, 15 May 2001 18:38:57 +0000 Subject: - 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. --- includes/common.inc | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'includes/common.inc') 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 = "na"; 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 create a user account and login prior to accessing it."); +} function check_textfield($message) { return strip_tags(str_replace("\"", """, stripslashes($message))); -- cgit v1.2.3