From fb52c6661375e2bc8011b764c06fc9fd67617c55 Mon Sep 17 00:00:00 2001 From: Andreas Gohr Date: Sat, 2 Oct 2010 20:06:23 +0200 Subject: coding style cleanup in lib/exe/detail.php --- lib/exe/detail.php | 74 ++++++++++++++++++++++++------------------------------ 1 file changed, 33 insertions(+), 41 deletions(-) (limited to 'lib/exe') diff --git a/lib/exe/detail.php b/lib/exe/detail.php index 3a04b7b09..eaa106978 100644 --- a/lib/exe/detail.php +++ b/lib/exe/detail.php @@ -1,51 +1,43 @@ '; - foreach(explode(' ','basedir userewrite baseurl useslash') as $x){ - print '$'."conf['$x'] = '".$conf[$x]."';\n"; - } - foreach(explode(' ','DOCUMENT_ROOT HTTP_HOST SCRIPT_FILENAME PHP_SELF '. - 'REQUEST_URI SCRIPT_NAME PATH_INFO PATH_TRANSLATED') as $x){ - print '$'."_SERVER['$x'] = '".$_SERVER[$x]."';\n"; - } - print "getID('media'): ".getID('media')."\n"; - print "getID('media',false): ".getID('media',false)."\n"; - print ''; - } - - $ERROR = false; - // check image permissions - $AUTH = auth_quickaclcheck($IMG); - if($AUTH >= AUTH_READ){ +if(!defined('DOKU_INC')) define('DOKU_INC',dirname(__FILE__).'/../../'); +define('DOKU_MEDIADETAIL',1); +require_once(DOKU_INC.'inc/init.php'); +//close session +session_write_close(); + +$IMG = getID('media'); +$ID = cleanID($_REQUEST['id']); + +if($conf['allowdebug'] && $_REQUEST['debug']){ + print '
';
+    foreach(explode(' ','basedir userewrite baseurl useslash') as $x){
+        print '$'."conf['$x'] = '".$conf[$x]."';\n";
+    }
+    foreach(explode(' ','DOCUMENT_ROOT HTTP_HOST SCRIPT_FILENAME PHP_SELF '.
+                'REQUEST_URI SCRIPT_NAME PATH_INFO PATH_TRANSLATED') as $x){
+        print '$'."_SERVER['$x'] = '".$_SERVER[$x]."';\n";
+    }
+    print "getID('media'): ".getID('media')."\n";
+    print "getID('media',false): ".getID('media',false)."\n";
+    print '
'; +} + +$ERROR = false; +// check image permissions +$AUTH = auth_quickaclcheck($IMG); +if($AUTH >= AUTH_READ){ // check if image exists $SRC = mediaFN($IMG); if(!@file_exists($SRC)){ - //doesn't exist! + //doesn't exist! } - }else{ +}else{ // no auth $ERROR = p_locale_xhtml('denied'); - } - - /*if(!$ERROR){ - // load EXIF/IPTC/image details - $INFO = array(); - $INFO['std'][''] - imagesize - }*/ - +} - //start output and load template - header('Content-Type: text/html; charset=utf-8'); - include(template('detail.php')); +//start output and load template +header('Content-Type: text/html; charset=utf-8'); +include(template('detail.php')); -- cgit v1.2.3 From e6e54bbf489558efff6d36ca016a745267d79f7d Mon Sep 17 00:00:00 2001 From: Andreas Gohr Date: Sat, 2 Oct 2010 20:07:07 +0200 Subject: populate $INFO in lib/exe/detail.php FS#2041 --- lib/exe/detail.php | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'lib/exe') diff --git a/lib/exe/detail.php b/lib/exe/detail.php index eaa106978..1ecb59e4e 100644 --- a/lib/exe/detail.php +++ b/lib/exe/detail.php @@ -37,6 +37,10 @@ if($AUTH >= AUTH_READ){ $ERROR = p_locale_xhtml('denied'); } +// this makes some general infos available as well as the info about the +// "parent" page +$INFO = pageinfo(); + //start output and load template header('Content-Type: text/html; charset=utf-8'); include(template('detail.php')); -- cgit v1.2.3 From 0b8362164d6b8853a5fcee5f590786de4cd5bcf1 Mon Sep 17 00:00:00 2001 From: Andreas Gohr Date: Sat, 2 Oct 2010 20:11:40 +0200 Subject: Added some 404 handling to lib/exe/detail.php --- lib/exe/detail.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'lib/exe') diff --git a/lib/exe/detail.php b/lib/exe/detail.php index 1ecb59e4e..35186f5dd 100644 --- a/lib/exe/detail.php +++ b/lib/exe/detail.php @@ -30,7 +30,8 @@ if($AUTH >= AUTH_READ){ $SRC = mediaFN($IMG); if(!@file_exists($SRC)){ //doesn't exist! - + header("HTTP/1.0 404 File not Found"); + $ERROR = 'File not found'; } }else{ // no auth -- cgit v1.2.3