From 195d12e131a2d1f635adc9c31c7627baf60616ed Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Sun, 14 Sep 2003 07:56:07 +0000 Subject: [PATCH] a (hopefully) more windows-compatible way to add the missing slash in the docroot of some webservers --- etemplate/inc/class.html.inc.php | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/etemplate/inc/class.html.inc.php b/etemplate/inc/class.html.inc.php index d05887ba7a..be328e3c6a 100644 --- a/etemplate/inc/class.html.inc.php +++ b/etemplate/inc/class.html.inc.php @@ -28,6 +28,14 @@ class html $this->prefered_img_title = $this->user_agent == 'mozilla' && $this->ua_version < 5 ? 'ALT' : 'TITLE'; //echo "

HTTP_USER_AGENT='$GLOBALS[HTTP_USER_AGENT]', UserAgent: '$this->user_agent', Version: '$this->ua_version', img_title: '$this->prefered_img_title'

\n"; + + $this->document_root = $_SERVER['DOCUMENT_ROOT']; + // this is because some webservers report their docroot without the leading slash + if (!is_dir($this->document_root) && is_dir('/'.$this->document_root)) + { + $this->document_root = '/' . $this->document_root; + } + //echo "

_SERVER[DOCUMENT_ROOT]='$_SERVER[DOCUMENT_ROOT]', this->document_root='$this->document_root'

\n"; } /* @@ -275,8 +283,7 @@ class html { $path = $name; // name may already contain absolut path } - // as some webservers does not report there DOCUMENT_ROOT starting with a '/', we just add one - if (!@is_readable('/'.$_SERVER['DOCUMENT_ROOT'] . $path)) + if (!@is_readable($this->document_root . $path)) { return $title; }