From 5a5bcb983095b5aa4ba202c377ca3a962849151d Mon Sep 17 00:00:00 2001 From: markleeds Date: Wed, 9 Jan 2008 02:47:41 +0000 Subject: [PATCH] Adjusts fileroot for document paths at the moment that the document is to be displayed. This is for documents that may have been moved from another filesystem. --- controllers/C_Document.class.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/controllers/C_Document.class.php b/controllers/C_Document.class.php index 6ebe26de0..ede58b170 100644 --- a/controllers/C_Document.class.php +++ b/controllers/C_Document.class.php @@ -205,6 +205,13 @@ class C_Document extends Controller { //strip url of protocol handler $url = preg_replace("|^(.*)://|","",$url); + //change full path to current webroot. this is for documents that may have + //been moved from a different filesystem and the full path in the database + //is not current. + $temp_url = $GLOBALS["fileroot"].'/documents/'.$_SESSION["pid"].'/'.basename($url); + if (file_exists($temp_url)) { + $url = $temp_url; + } if (!file_exists($url)) { echo "The requested document is not present at the expected location on the filesystem or there are not sufficient permissions to access it. $url"; } -- 2.11.4.GIT