diff --git a/demo/phpThumb.demo.gallery.php b/demo/phpThumb.demo.gallery.php index 3e9e02e..f298f41 100644 --- a/demo/phpThumb.demo.gallery.php +++ b/demo/phpThumb.demo.gallery.php @@ -24,18 +24,21 @@ die('For security reasons, this demo is disabled by default. Please comment out line '.__LINE__.' in '.basename(__FILE__)); $docroot = realpath((getenv('DOCUMENT_ROOT') && preg_match('#^'.preg_quote(realpath(getenv('DOCUMENT_ROOT'))).'#', realpath(__FILE__))) ? getenv('DOCUMENT_ROOT') : str_replace(dirname(@$_SERVER['PHP_SELF']), '', str_replace(DIRECTORY_SEPARATOR, '/', dirname(__FILE__)))); -$basedir = '/demo/images/'; // webroot-relative path to main images directory (only this and subdirectories of this will be displayed) -$thumb = '/demo/phpThumb.php'; // webroot-relative path to "phpThumb.php" -$popup = '/demo/demo/phpThumb.demo.showpic.php'; // webroot-relative path to "phpThumb.demo.showpic.php" (only used if $use_popup == true) -$thumbnailsize = 120; // size of thumbnails in pixels when browsing gallery -$displaysize = 480; // size of large image display (popup or plain image) after clicking on thumbnail -$use_popup = true; // if true, open large image in self-resizing popup window; if false, display larger image in main window +$imgdir = '/images/'; // webroot-relative path to main images directory (only this and subdirectories of this will be displayed) +$thumb = '/phpThumb.php'; // webroot-relative path to "phpThumb.php" +$config = '/phpThumb.config.php'; // webroot-relative path to "phpThumb.php" +$popup = '/demo/phpThumb.demo.showpic.php'; // webroot-relative path to "phpThumb.demo.showpic.php" (only used if $use_popup == true) +$thumbnailsize = 120; // size of thumbnails in pixels when browsing gallery +$displaysize = 480; // size of large image display (popup or plain image) after clicking on thumbnail +$use_popup = true; // if true, open large image in self-resizing popup window; if false, display larger image in main window ////////////////////////////////////////////////////////////// -$dirlimit = realpath($docroot.'/'.$basedir); +require_once($docroot.$config); -$captionfile = $docroot.'/'.$basedir.(@$_REQUEST['dir'] ? $_REQUEST['dir'].'/' : '').'captions.txt'; +$dirlimit = realpath($docroot.'/'.$imgdir); + +$captionfile = $docroot.'/'.$imgdir.(@$_REQUEST['dir'] ? $_REQUEST['dir'].'/' : '').'captions.txt'; if (file_exists($captionfile)) { $filecontents = file($captionfile); foreach ($filecontents as $key => $value) { @@ -47,12 +50,12 @@ if (!empty($_REQUEST['pic'])) { $alt = @$CAPTIONS[$_REQUEST['pic']] ? $CAPTIONS[$_REQUEST['pic']] : $_REQUEST['pic']; - echo ''.htmlentities($alt).'
'; + echo ''.htmlentities($alt, ENT_QUOTES).'
'; echo '
'.htmlentities(@$CAPTIONS[$_REQUEST['pic']]).'
'; } else { - $currentdir = realpath($docroot.'/'.$basedir.@$_REQUEST['dir']); + $currentdir = realpath($docroot.'/'.$imgdir.@$_REQUEST['dir']); if (!preg_match('#^'.preg_quote($dirlimit).'#', $currentdir)) { echo 'Cannot browse to "'.htmlentities($currentdir).'"
'; } elseif ($dh = @opendir($currentdir)) { @@ -82,19 +85,19 @@ $alt = (!empty($CAPTIONS[$file]) ? $CAPTIONS[$file] : $file); echo ''.(!empty($CAPTIONS[$file]) ? '' : '').'
'.htmlentities($CAPTIONS[$file]).'
'; if ($use_popup) { - echo ''; + echo ''; } else { echo ''; } - echo ''.htmlentities($alt).''; + echo ''.htmlentities($alt, ENT_QUOTES).''; echo '
'; } echo '
'; } else { - echo 'No pictures in "'.htmlentities(str_replace(realpath($docroot), '', realpath($docroot.'/'.$basedir.@$_REQUEST['dir']))).'"'; + echo 'No pictures in "'.htmlentities(str_replace(realpath($docroot), '', realpath($docroot.'/'.$imgdir.@$_REQUEST['dir']))).'"'; } } else { - echo 'failed to open "'.htmlentities($basedir).'"'; + echo 'failed to open "'.htmlentities($currentdir).'"'; } } diff --git a/demo/phpThumb.demo.showpic.php b/demo/phpThumb.demo.showpic.php index a8d9a9b..c4899c5 100644 --- a/demo/phpThumb.demo.showpic.php +++ b/demo/phpThumb.demo.showpic.php @@ -31,6 +31,7 @@ die('For security reasons, this demo is disabled by default. Please comment out line '.__LINE__.' in '.basename(__FILE__)); $phpThumbLocation = '../phpThumb.php'; +require_once('../phpThumb.config.php'); echo ''; echo ''; @@ -76,7 +77,6 @@ function CrossBrowserResizeInnerWindowTo(newWidth, newHeight) { dpi) && $this->ImageMagickSwitchAvailable('density')) { // for vector source formats only (WMF, PDF, etc) - //$commandline .= ' -flatten'; + $commandline .= ' -flatten'; $commandline .= ' -density '.phpthumb_functions::escapeshellarg_replacement($this->dpi); } ob_start();