New ';
// String to display with dir name if "new"
$dir_nav['sort_age'] = FALSE; // Sort directories by time-since-modified
// (most recent first) rather than by alpha.
$dir_nav['sort_rev'] = FALSE; // Reverse the sort order of directories.
$dir_nav['icon'] = FALSE; // Display a camera icon in directory links.
$dir_nav['updir_ena'] = TRUE; // Display an up-one-level link.
$dir_nav['row_width'] = '100%'; // Width of the Directory Navigation row
/**
* Control Bar (Contains visitor preferences: links style and default view)
*/
$ctrl_bar['enable'] = TRUE; // Enable control bar.
$dir_nav['prefs_ena'] = TRUE; // Display a Preferences link, which toggles
// the Control Bar for a more compact gallery.
$ctrl_bar['vw_ctrl'] = TRUE; // Enable control bar Links Style chooser.
$ctrl_bar['sz_ctrl'] = FALSE; // Enable control bar Default Size chooser.
$ctrl_bar['small'] = TRUE; // Use small text for control bar.
/**
* Image Links Placement and Sorting
*/
$img_links_above = FALSE; // Locate image links (numerals, thumbnails)
// above the image. Sensible default is below.
$img_links_sort_date = FALSE; // Sort images by date, not alphabetically.
$img_links_sort_rev = FALSE; // Sort images in reverse order.
/**
* Thumbnail Image Links
*/
$thmb_default = TRUE; // Default to thumbs view if thumbs-capable.
$thmb_enable = TRUE; // Enable thumbs view. Safe to leave TRUE.
$thmb_onfly = TRUE; // Create thumbnails 'on the fly' in their
// own request so pages load more quickly.
// Wrapping -- Don't wrap only one or two thumbnails.
$thmb_row['maxwidth'] = 680; // Approx. max. width of thumbnails row
$thmb_row['softwrap'] = 85; // A percentage, 51 to 99
/**
* Filename and Numeral Text Image Links
*/
$txtlinks_default = 'none'; // If no text-link type is specified, default
// to name, num, or none.
$namelinks_disa = FALSE; // Disable 'names' view option in the Control
// Bar size chooser. (Avoids the sidebar.)
$namelinks_small = TRUE; // Use small text for filename links.
$namelinks_trunc = 16; // Number of filename characters to display
// Numeral Text Image Links
$nmrl_row['small'] = TRUE; // Use small text for numeral links.
$nmrl_row['pad_top'] = '2px'; // padding above rows of numeral links
// Wrapping -- Don't wrap only one or two links.
$nmrl_row['maxcount'] = 23; // maximum number of numeral links per row
$nmrl_row['softwrap'] = 85; // percentage, 51 to 99
/**
* Upper Gallery Navigation Row immediately above the image
*
* If nothing on the row is enabled, the navigation row is omitted.
*/
$upr_nav['enable'] = TRUE;
$upr_nav['sizer'] = FALSE; // Show resizing links. Overrides 'full_link'.
$upr_nav['full_link'] = FALSE; // Show `Full Size' link if image is resized.
$upr_nav['prv_next'] = TRUE; // Show `Previous' / `Next' links.
$upr_nav['wrap'] = FALSE; // Wrap at Prev / Next at last / first image.
$upr_nav['frst_last'] = TRUE; // Show ` |<< ' and ` >>| ' links.
$upr_nav['cntr'] = FALSE; // Show `x of y' counter if no $dir_nav counter.
$upr_nav['cntr_bold'] = FALSE; // Bold font for `x of y' message
$upr_nav['sml_txt'] = FALSE; // Use small text.
$upr_nav['width'] = '500'; // Width of this navRow's table
$upr_nav['pad_top'] = '0px'; // Padding above row
/**
* Image Display
*/
$caption['min_width'] = 300; // Minimum width for an image caption
$caption['padding'] = '3px'; // Padding around caption text
$caption['nl2br'] = FALSE; // Automatically insert
tags in captions.
$caption['left_just'] = FALSE; // Left-justify caption (otherwise centered).
$caption['above'] = FALSE; // Place caption above the image, not below it.
// Settings for making the displayed image an active link
$img_link['next'] = TRUE; // Link to the next image from the one displayed.
$img_link['wrap'] = FALSE; // Link back to first image from the last one.
$img_link['wrap_up'] = TRUE; // Link the last image to the directory above.
// Other scripts have the following, so some people must like it.
$img_link['full'] = FALSE; // If the image is a resized version, link to the
// full sized version. Disables 'next' and 'wrap'.
$img_link['file'] = FALSE; // Full size link goes directly to the image file.
/**
* Lower Gallery Navigation Row below the image and caption
*
* If nothing on the row is enabled, the navigation row is omitted.
*/
$lwr_nav['enable'] = TRUE;
$lwr_nav['sizer'] = FALSE; // Show resizing links. Overrides 'full_link'.
$lwr_nav['full_link'] = TRUE; // Show `Full Size' link if image is resized.
$lwr_nav['prv_next'] = TRUE; // Show `previous' / `next' links.
$lwr_nav['wrap'] = FALSE; // Wrap at prev / next at last / first image.
$lwr_nav['frst_last'] = TRUE; // Show ` |<< ' and ` >>| ' links.
$lwr_nav['cntr'] = TRUE; // Show `x of y' counter if no $dir_nav counter.
$lwr_nav['cntr_bold'] = TRUE; // Bold font for `x of y' message
$lwr_nav['sml_txt'] = FALSE; // Use small text for this navigation row.
$lwr_nav['width'] = '500'; // Width of this navRow's table
$lwr_nav['pad_top'] = '2px'; // Padding above row
/**
* Gallery Footer Row
*/
$footer['pad_top'] = '5px'; // Extra space above the footer line
$site_link_fnt_size = '0.75em'; // Font size for Site Home Link
$copyright['fnt_size'] = '0.75em'; // Font size for Copyright Message
$qdig_homelink['ena'] = TRUE; // Show the Qdig Home link.
$qdig_homelink['fnt_size'] = '0.75em'; // Qdig Home link Font size
// Color and CSS Style Settings ---------------------------------------+
// See http://qdig.sourceforge.net/Qdig/ColorSchemes
// HTML Header CSS settings are only effective for stand-alone Qdig.
$header['css_bgcolor'] = '#f8f8f8'; // Page Background
$header['css_text_color'] = '#333333'; // Text
$header['css_link_color'] = '#004080'; // Link
$header['css_visit_color'] = '#006699'; // Visited Link
$header['css_bg_img_url'] = ''; // URL of a tiled background image.
// Example: '../images/qdig-bg.jpg'
$header['css_bg_logo'] = FALSE; // Use a background logo.
$header['css_logo_url'] = ''; // URL of logo image, else use cam-icon
$header['css_logo_pos'] = '99% 99%'; // CSS position of the bg_logo.
$header['css_img_bg'] = '#eeeeee'; // Image background (when loading)
// 'transparent' is a valid "color".
$header['css_img_border'] = '#cccccc'; // Displayed-image border
$header['css_img_brdr_w'] = '1px'; // Width of displayed-image border
$header['css_thm_border'] = '#cccccc'; // Thumbnail images' border
$header['css_thm_brdr_w'] = '0px'; // Width of thumbnail-image border
$header['css_thm_opacity'] = '100'; // Setting of 1 to 99 fades thumbs.
// (Opacity uses invalid CSS and
// slows rendering speed.)
$header['css_opacity_moz'] = FALSE; // Opacity for older gecko browsers
$header['css_thm_hilite'] = '#f9f99f'; // Hilight border for current-thumb.
$header['css_thm_hl_w'] = '2px'; // Width of highlight border
$header['css_user_def'] = ''; // User-defined CSS rules
// Set these to '' to disable.
$sidebar_bg_clr = '#eeeeee'; // Sidebar background
$sidebar_margin_top = '4px'; // Margin above the sidebar
$sidebar_height = ''; // '' is "auto". example: '350px'
$copyright['color'] = '#cccccc'; // Copyright text
$admin['color'] = '#cccccc'; // Admin link text
$qdig_homelink['color'] = '#cccccc'; // Qdig Home Link text
$grayout_color = '#999999'; // Grayed-out text
// Gallery Table and Image Table (Possibly for an embedded gallery)
// Use '' for default background color.
$gallery_table_bg_clr = ''; // Background color of the gallery table.
$image_table_bg_clr = ''; // Background color of image area.
// Arbitrary code can be inserted before or after the gallery table.
$pre_gallery = ''; // User-defined output before gallery
$post_gallery = ''; // User-defined output after gallery
// Image Conversion and Alternate-size Settings -----------------------+
// Thumbnail settings are in the Layout Settings section.
/**
* Writable Directories
*
* Folders containing your original images may be read-only by the web server
* daemon, but the script needs write permissions to write empty caption .txt
* files and converted-image files (thumbnail and alternate-sized images).
*/
$qdig_files = 'qdig-files/'; // The root of the writable tree. Setup is easy:
// Create the directory. Give it 2777 permissions
// (`chmod 2777'). Visit the gallery once. Then
// change the permissions to something sane (0755).
//$cnvrtd_dir = 'qdig-converted'; // Name of the resampled images subdirectory.
// Uncomment this and comment out $qdig_files
// for the behavior of previous releases.
$convrtd_subdir = 'converted-images/'; // Subdir for resampled images
$caption_subdir = 'captions'; // Subdir for captions
$touch_captions = TRUE; // Create empty caption .txt files, if found missing.
/**
* Image Magick and GD Settings
*
* If you have both Image Magick and GD, Qdig uses IM except on a Win32 server.
* To use the one that isn't the default, set the default one to FALSE.
*/
$convert_magick = TRUE; // Use Image Magick, if available, to convert images.
$convert_cmd = '/usr/bin/convert'; // Full pathname to `convert'.
// Example $convert_cmd for Win32 users:
//$convert_cmd = '"C:\\Program Files\\ImageMagick-5.5.3-Q16\\convert.exe"';
$convert_GD = TRUE; // Use PHP GD, if available, to convert images.
$convert_GD_ver = ''; // '' is auto-detect (recommended). Else '1' or '2'.
/**
* Sizes to convert / display
*
* Enable or disable any of the alternate sizes (to save bandwidth,
* fit a layout, etc.). Experiment, but here are some suggestions:
* Old Defaults: TRUE,TRUE,TRUE,TRUE,FALSE
* Basic: FALSE,TRUE,FALSE,FALSE,TRUE
*/
$disp_size['0'] = FALSE; // 'S' | These cause resizing links
$disp_size['1'] = TRUE; // 'M' | in the Control Bar and
$disp_size['2'] = FALSE; // 'L' | Navigation Bar to disappear
$disp_size['3'] = FALSE; // 'XL' | if set to FALSE and
$disp_size['4'] = TRUE; // 'FS' | appear if set to TRUE.
// If no size is specified, use this size as the default.
$default_img_size = '1'; // '1' is medium. Must be an enabled size.
/**
* Thumbnail Image Conversion Settings
*/
$cnvrt_thmb['size'] = 30; // Thunbnail image height in pixels.
// Sizes: 10 is tiny, 20 is small, 35 is medium,
// 50 is large, 75 is jumbo
$cnvrt_thmb['qual'] = 60; // Thumbnail image quality. Large thumbnails
// may look better, but will have increased file
// size, if you increase this a bit.
$cnvrt_thmb['sharpen'] = '0.6x0.6'; // Level of sharpening for thumbnails.
$cnvrt_thmb['single'] = FALSE; // Convert thumb in a singleton directory.
$cnvrt_thmb['mesg_on'] = FALSE; // Produce a message when a thunbnail image
// is auto-generated.
$cnvrt_thmb['no_prof'] = FALSE; // Strip image profile data to reduce size.
// (May be incompatible with some servers.)
$cnvrt_thmb['prefix'] = // Filename prefix for thumbnail images.
"thm{$cnvrt_thmb['size']}_"; // Use "thm_" for externally generated thumbs.
/**
* Alternate-sized Image Conversion Settings
*
* ['prefix'] is the filename prefix for the generated file.
* ['sharpen'] is the sharpen pramater passed to ImageMagick.
* ['maxwid'] is the size setting. Other dimensions are calculated.
* ['qual'] is the compression quality level.
* ['txt'] is the image size text used inline in a message. (Language Setting)
* ['label'] is the text used for a link. (Language Setting)
*/
$cnvrt_alt['indiv'] = TRUE; // Convert alternates one-at-a-time rather than
// all the images in a directory at once.
$cnvrt_alt['mesg_on'] = TRUE; // Produce a message when an image is converted.
$cnvrt_alt['no_prof'] = FALSE; // Strip image profile data to reduce size.
// (May be incompatible with some servers.)
// small
$cnvrt_size['0']['prefix'] = 'sml_';
$cnvrt_size['0']['sharpen'] = '0.6x0.8';
$cnvrt_size['0']['maxwid'] = 512;
$cnvrt_size['0']['qual'] = 87;
// medium
$cnvrt_size['1']['prefix'] = 'med_';
$cnvrt_size['1']['sharpen'] = '0.6x0.8';
$cnvrt_size['1']['maxwid'] = 640;
$cnvrt_size['1']['qual'] = 89;
// large
$cnvrt_size['2']['prefix'] = 'lrg_';
$cnvrt_size['2']['sharpen'] = '0.6x0.9';
$cnvrt_size['2']['maxwid'] = 800;
$cnvrt_size['2']['qual'] = 90;
// x-large
$cnvrt_size['3']['prefix'] = 'xlg_';
$cnvrt_size['3']['sharpen'] = '0.6x0.9';
$cnvrt_size['3']['maxwid'] = 1024;
$cnvrt_size['3']['qual'] = 91;
// actual
$cnvrt_size['4']['prefix'] = '../';
// Language Settings --------------------------------------------------+
// Text that appears in the output may be configured here.
/**
* Header
*/
$header['lang_code'] = 'en';
$header['charset'] = 'iso-8859-1';
/**
* Directory Navigation
*/
$dir_nav['main_txt'] = 'Main';
$dir_nav['choose_main_txt'] = 'Choose a gallery:';
$dir_nav['choose_main_title_txt'] = 'Please choose a gallery.';
$dir_nav['choose_sub_txt'] = '';
$dir_nav['choose_sub_title_txt'] = 'Please choose a gallery.';
$dir_nav['empty_dir_txt'] = 'No gallery!';
$dir_nav['empty_dir_title_txt'] = 'Sorry, no gallery here.';
$dir_nav['image_txt'] = 'Image';
$dir_nav['go_to_txt'] = 'Go to';
$dir_nav['up_level_txt'] = 'Up a level..';
$dir_nav['up_title_txt'] = 'Go up one level';
$dir_nav['current_txt'] = 'Current location:';
$dir_nav['prefs_title_txt'] = 'Change your visitor preferences';
$dir_nav['prefs_txt'] = 'Preferences';
/**
* Gallery Navigation Links
*/
$nav_lnk['prv_txt'] = '<< Previous';
$nav_lnk['prv_msg'] = 'Previous Image';
$nav_lnk['next_txt'] = 'Next >>';
$nav_lnk['next_msg'] = 'Next Image';
$nav_lnk['last_txt1'] = '<< Last';
$nav_lnk['last_txt2'] = '>>|';
$nav_lnk['last_msg'] = 'Last Image';
$nav_lnk['frst_txt1'] = 'First >>';
$nav_lnk['frst_txt2'] = '|<<';
$nav_lnk['frst_msg'] = 'First Image';
$nav_lnk['image'] = 'Image';
/**
* Text shown if there is no image to display
*/
$empty_gallery_msg = 'Empty gallery!';
// Text/Messages for controlView() (links view on control bar)
$ctrl_links_mesg['links_style'] = 'Links Style:';
$ctrl_links_mesg['thumbs_txt'] = 'Thumbs';
$ctrl_links_mesg['names_txt'] = 'Names';
$ctrl_links_mesg['nums_txt'] = 'Numbers';
$ctrl_links_mesg['none_txt'] = 'None';
$ctrl_links_mesg['thumbs_msg'] = 'Switch to Thumbnail Links';
$ctrl_links_mesg['names_msg'] = 'Switch to Filename Links';
$ctrl_links_mesg['nums_msg'] = 'Switch to Calendar-Style Links';
$ctrl_links_mesg['none_msg'] = 'Disable Direct Image Links';
/**
* Image size title text
*/
$cnvrt_size['0']['label'] = 'S';
$cnvrt_size['1']['label'] = 'M';
$cnvrt_size['2']['label'] = 'L';
$cnvrt_size['3']['label'] = 'XL';
$cnvrt_size['4']['label'] = 'FS';
$img_sz_labels['ctrl']['default_size'] = 'Default Size:';
$img_sz_labels['ctrl']['str1'] = 'Change the default image size to ';
$img_sz_labels['nav']['str1'] = 'See the ';
$img_sz_labels['nav']['str1a'] = 'Return to the ';
$cnvrt_size['0']['txt'] = 'Small';
$cnvrt_size['1']['txt'] = 'Medium';
$cnvrt_size['2']['txt'] = 'Large';
$cnvrt_size['3']['txt'] = 'Extra Large';
$cnvrt_size['4']['txt'] = 'Full Size';
$cnvrt_size['4']['txt2'] = 'default';
$img_sz_labels['ctrl']['str2'] = '.';
$img_sz_labels['nav']['str2'] = ' version of this image.';
/**
* Admin link
*/
$admin['link_title'] = 'Edit Caption';
$admin['link_text'] = 'Admin';
$admin['before_link'] = '(';
$admin['after_link'] = ')';
/**
* Image conversion messages (e.g. "Generated a new Large converted image for image.jpg")
*/
$cnvrt_mesgs['generated'] = 'Generated a new ';
$cnvrt_mesgs['generating'] = 'Generating a new ';
$cnvrt_mesgs['thumb'] = 'thumbnail';
$cnvrt_mesgs['converted'] = ' converted';
$cnvrt_mesgs['image_for'] = ' image for ';
$cnvrt_mesgs['using IM'] = " using 'convert'";
$cnvrt_mesgs['using GD'] = ' using GD';
$cnvrt_mesgs['on-the-fly'] = ''; // was: ' (on-the-fly)'
/**
* Miscellaneous
*/
$lang['nav_cntr_txt'] = 'of'; // Counter ("x of n")
$lang['Forbidden'] = 'Forbidden';
$lang['diag_messages'] = 'Diagnostic Messages';
// Security Settings ------------------------------------------------+
/**
* File creation mask. Determines default permissions for created files, dirs.
*
* Examples: umask(002) // `drwxrwxr-x' and `-rw-rw-r--' (world readable)
* umask(007) // `drwxrwx---' and `-rw-rw----' (not world readable)
*/
umask(002);
/**
* Paranoia Settings
*/
$safe_captions = TRUE; // Disable HTML in Captions. Convert special
// characters (<>&"') to `HTML entities'
$check_security = TRUE; // Perform a security check for world-writability.
$ignore_dir_links = TRUE; // Ignore gallery directories if they're symlinks.
$ignore_img_links = TRUE; // Ignore image files if they're symlinks.
$pathname_maxlen = 100; // Max. number of characters in a pathname.
$imgname_maxlen = 100; // Max. number of characters in an image filename.
$extra_paranoia = FALSE; // Do extra-strict checking for '..'.
$ignore_dotfiles = FALSE; // Ignore files that start with '.'.
$ignore_dotdirs = FALSE; // Ignore directories that start with '.'.
// HTML Header settings are only effective for stand-alone Qdig.
$header['zap_frames'] = FALSE; // Break out of a frameset.
$header['ie_imgbar_off'] = TRUE; // Suppress IE6's image toolbar.
// Miscellaneous Settings ---------------------------------------------+
/**
* Server Compatibility
*/
// Disable use of certain PHP functions for compatibility with some servers.
$is_readable_disa = FALSE; // Set to TRUE if is_readable() causes trouble.
$file_exists_disa = FALSE; // Set to TRUE if file_exists() causes trouble.
$max_exec_time = 30; // Max. execution time in seconds
$compat_quote = TRUE; // Add and extra "s to exec() command on Win32.
// For Win98 this should be set to FALSE.
$exclude_gif = FALSE; // Exclude GIF images.
// HTML Header settings are only effective for stand-alone Qdig.
$header['meta_cache'] = FALSE; // Use a Cache-Control meta tag. For servers
// that cause repeated reloading of thumbs.
$header['cache_sec'] = '3600'; // Number of seconds for the cache to expire.
/**
* Path Settings (Override defaults.)
*/
$qdig_url = ''; // Self-referring URL path. Examples: '/photos/' or
// '/photos/qdig.php' or '/~someuser/qdig/index.php'
// The next two are the same location; as a URL and as a filesystem path.
$url_base_path = ''; // Base URL path to the images (not the script)
// Examples: '/photos/qdig/' or '/~someuser/qdig/'
$fs_base_path = ''; // Filesystem path to the root dir of the gallery.
// Ex.: '/home/someuser/public_html/qdig/' or '../qdig'
/**
* Et-cetera
*/
$excl_dirs[] = 'Private'; // Ignore a directory with its name
$excl_dirs[] = 'qdig-converted'; // included here. Do not end these
$excl_dirs[] = ''; // name(s) with '/'.
$excl_imgs[] = 'qdig-bg.jpg'; // Ignore any image with its name
$excl_imgs[] = 'favicon.png'; // included here. Add as many of
$excl_imgs[] = ''; // these as you wish.
$excl_img_pattern = '_thumb'; // Don't display files containing this string.
$excl_main = FALSE; // Exclude all images in the root (Main) directory.
$extra_param = ''; // Extra parameter(s) to include in URLs.
// Examples: 'incl=qdig.php&' 'a=foo&b=bar&'
$anchor = ''; // Include an intra-page anchor in URLs. For embedded
// galleries, use '#qdig' to jump down to the gallery.
$keep_params = FALSE; // Keep extra GET parameters in the URLs.
/**
* Debugging Setting
*/
$diag_messages = FALSE; // Produce diagnostic messages. This will also enable
// verbose PHP error reporting.
/**
* Get External Settings
*/
if (function_exists('qdig_settings')) {
qdig_settings($qdig_version);
}
// Settings Notes -----------------------------------------------------+
// (To make upgrading easier, put notes about your settings here.)
/*
+-------------------+
| Adapt to Server |
+-------------------+
*/
// Get global variables and protect them from register_globals.
$get_vars = ($_GET) ? $_GET : $HTTP_GET_VARS;
$post_vars = ($_POST) ? $_POST : $HTTP_POST_VARS;
$cookie_vars = ($_COOKIE) ? $_COOKIE : $HTTP_COOKIE_VARS;
$request_vars = ($_REQUEST)
? $_REQUEST
: array_merge($get_vars, $post_vars, $cookie_vars);
if (ini_get('register_globals')) {
if (!is_array($request_vars)) { securityExit('Security Violation'); }
foreach($request_vars as $k=>$v) {
if (preg_match('/^(GLOBALS|_SERVER|_GET|_POST|_COOKIE|_FILES|_ENV|_REQUEST|_SESSION|qdig-files)$/i', $k)) {
securityExit('Security violation'); }
${$k}=''; unset(${$k});
}
}
$server_vars = ($_SERVER) ? $_SERVER : $HTTP_SERVER_VARS;
// Disallow some special characters in the query string.
if (preg_match('/(%00|%3c|<)/', $server_vars['QUERY_STRING'])
|| preg_match('!\\\\0!', @$get_vars['Qwd'])) {
securityExit('Invalid request.'); }
$php_self = @$server_vars['PHP_SELF'];
$script_name = @$server_vars['SCRIPT_NAME'];
if (! $request_uri = @$server_vars['REQUEST_URI']) { // Not provided by IIS.
$request_uri = @$php_self.'?'.@$server_vars['argv'][0]; // Close enough
}
// Suppress harmless Notices and annoying Warnings. Restored at the end.
if (!isset($orig_err_rep_level)) {
$orig_err_rep_level = ($diag_messages == TRUE)
? error_reporting(E_ALL)
: error_reporting(E_ALL ^E_NOTICE ^E_WARNING);
}
// Establish self-referring URL.
if (empty($qdig_url)) {
$tmp = explode('?', @$request_uri);
$qdig_url = @$tmp['0'];
unset($tmp);
}
if (empty($qdig_url)) {
$qdig_url = @$script_name;
}
// Safe mode?
if (ini_get('safe_mode')) {
$safe_mode = TRUE;
} else {
$safe_mode = FALSE;
@ini_set('max_execution_time', $max_exec_time);
}
// Which OS?
if (strtoupper(substr(PHP_OS, 0, 3)) == 'WIN') {
$platform = 'Win32';
} elseif (strtoupper(substr(PHP_OS, 0, 3)) == 'MAC') {
$platform = 'Macintosh';
} elseif (strtoupper(substr(PHP_OS, 0, 3)) == 'LIN') {
$platform = 'Linux';
} else {
$platform = 'Unix';
}
// Included Qdig?
if (realpath(__FILE__) == realpath(@$_SERVER['SCRIPT_FILENAME'])
|| ! $tmp = get_included_files())
{
$is_included = FALSE;
} else {
$is_included = TRUE;
}
/**
* Produce an icon image if ?image=cam-icon
*/
if (@$get_vars['image'] == 'cam-icon') {
cam_icon();
die();
}
if (@$get_vars['image'] == 'clear-dot') {
clear_dot();
die();
}
/*
+-------------+
| Functions |
+-------------+
*/
// http://qdig.sourceforge.net/Qdig/FunctionsList
/**
* The encoded icon image.
*/
function cam_icon()
{
header('Content-type: image/png');
header('Content-length: 346');
echo base64_decode(
'iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAALHRFWHRDcmVhdGlvbiBUaW1lAFRo'.
'dSAyNiBEZWMgMjAwMiAxMToxOTowNiAtMDcwMOKR1KkAAAAHdElNRQfSDBoSGhzS+Jz0AAAACXBI'.
'WXMAAAsSAAALEgHS3X78AAAABGdBTUEAALGPC/xhBQAAACdQTFRF////ZmZmMzMzZjMzM2ZmM2Yz'.
'ZjNmzMzMmZnMmZmZmZn/zP//ZmbMVprHTAAAAAF0Uk5TAEDm2GYAAABxSURBVHjaVU+LEsAgCAqr'.
'pbb//95Be9OdHoRSpSwAMKC8wCT+Qv6FJod9HZVbbgd0E0A8XAmt8rCLDyKChVF0QxS5IyQwyRbP'.
'mRbauxzkUuQdeIS8BY54E68u4VpaPZty1ohiHfCTm35u4KtY+9a3cgC4QwQQbFlZCQAAAABJRU5E'.
'rkJggg==');
} // End cam_icon()
function clear_dot()
{
header('Content-type: image/gif');
header('Content-length: 43');
echo base64_decode(
'R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==');
}
/**
* Security Exit
*/
function securityExit($mesg = 'Unspecified Error')
{
global $lang;
header('HTTP/1.0 403 Forbidden');
exit("\n
|
EOT;
if ($dir_nav['small'] == TRUE) {
$str .= ' ';
}
// Display path to current directory / image.
$str .= dirnavPath($dir_nav);
// Display navigation links to subdirectories.
$str .= subdirLinks($dir_nav);
// Preferences Link
if ($dir_nav['prefs_ena'] == TRUE) {
$ctrl_bar_ena = FALSE;
} else {
$ctrl_bar_ena = TRUE;
}
if ($dir_nav['prefs_ena'] == TRUE && count($imgs) > 1) {
$ctrl_bar_ena = FALSE;
if ($reqd_img_size_tmp == 'Ctrl') {
$qtmp_ctrl = '';
} else {
$qtmp_ctrl = 'Ctrl';
}
$imgurl = rawurlencode($reqd_image['file']);
$str .= << |
| '; } else { $tag = ' |
| $tag_bfr_lnk\n" .firstLink($reqd_image['num']) ." $tag_aft_lnk | \n"; } if ($nav['prv_next'] == TRUE) { $str .= "$tag_bfr_lnk\n" .prevLink($reqd_image['num'], $nav['wrap']) ." $tag_aft_lnk | \n"; } if ($nav['cntr'] == TRUE && ( $nav['sizer'] == TRUE || $nav['full_link'] == TRUE)) { $str .= "\n"; } elseif ($nav['cntr'] == TRUE ) { $str .= " | \n"; } if ($nav['cntr'] == TRUE) { if ($nav['cntr_bold'] == TRUE) { $bold_before = ''; $bold_after = ''; } else { $bold_before = ''; $bold_after = ''; } $str .= ' '.$tag_bfr_lnk.$bold_before.imageCounter($reqd_image['num']).$bold_after.$tag_aft_lnk."\n" ." | \n"; } } if (($nav['cntr'] == TRUE && $num_imgs > 1) && ($nav['sizer'] == TRUE || $nav['full_link'] == TRUE )) { $str .= ""; } elseif ($nav['sizer'] == TRUE || $nav['full_link'] == TRUE ) { $str .= " | \n"; } if ($nav['sizer'] == TRUE) { $str .= navSize($nav['sml_txt'], $img_sz_labels['nav'])." | \n"; } if ($nav['sizer'] == FALSE && $nav['full_link'] == TRUE) { $str .= $nav_full['str']." \n"; } if ($num_imgs > 1) { if ($nav['prv_next'] == TRUE) { $str .= "$tag_bfr_lnk\n" .nextLink($nav['wrap'])." $tag_aft_lnk | \n"; } if ($nav['frst_last'] == TRUE) { $str .= "$tag_bfr_lnk\n" .lastLink($reqd_image['num'])." $tag_aft_lnk | \n"; } } $str .= "
| \n" .siteHomeLink($site_lnk_url, $site_lnk_title)." | \n"; } if ($copyright_on == TRUE) { $str .= '\n" .showCopyright($copyright)." | \n"; } if ($qdig_homelink['ena'] == TRUE) { $str .= "\n" .qdigHomelink($qdighome_alone)." | \n"; } $str .= "
\n{$lang['diag_messages']}:
\n";
error_reporting(E_ALL);
} else {
$diag_mesgs = '';
}
/**
* $chroot_dir sanity check
*/
if (!empty($chroot_dir)) {
$rootdir = cleanPath($chroot_dir);
} else {
$rootdir = '.';
$chroot_dir = '';
}
if (!@is_dir($rootdir)) {
exit("\n
Chroot directory $chroot_dir doesn't exist.
Check gallery script configuration.\n \n");
}
/**
* Establish working directory.
*/
if (!empty($get_vars['Qwd'])) {
if (strlen($get_vars['Qwd']) > $pathname_maxlen
|| (strlen($get_vars['Qwd']) > 1 && $get_vars['Qwd'][0] == '.' && $get_vars['Qwd'][1] == '.')) {
securityExit('Pathname (Qwd=) is too long or starts with "..".');
}
$pwd_tmp = cleanPath($get_vars['Qwd']);
} else {
$pwd_tmp = '.';
}
if (strlen($pwd_tmp) <= strlen($rootdir)) {
$pwd = $rootdir;
} elseif (strpos($pwd_tmp, $rootdir) === 0) {
$pwd = rawurldecode($pwd_tmp);
}
if (! is_dir($pwd)
|| ! ($is_readable_disa == TRUE || is_readable($pwd)))
{
$pwd = $rootdir;
}
if ($extra_paranoia == TRUE
&& (strpos(stripslashes(rawurldecode($pwd)), '..')
|| empty ($pwd)
|| $pwd[0] != '.'
|| (strlen($pwd) > 1 && $pwd[1] == '.')))
{
securityExit('Updir ("..") is not allowed in a pathname (Qwd=).');
}
// Encode $pwd for use in URLs.
$pwd_url = urlPath($pwd);
// Sanitize URL base path.
if (!empty($url_base_path)) {
$url_base_path = strstr(urlPath($url_base_path), '/').'/';
}
/**
* Establish requested size.
*/
foreach($disp_size as $i => $ena) {
$size_labels[] = $cnvrt_size[$i]['label'];
if ($ena == TRUE) {
$valid_sizes[] = $cnvrt_size[$i]['label'];
}
}
if (isset($get_vars['Qis'])
&& strlen($get_vars['Qis']) < 9
&& in_array($get_vars['Qis'], $valid_sizes))
{
$reqd_img_size = $get_vars['Qis'];
} elseif (in_array($cnvrt_size[$default_img_size]['label'], $valid_sizes)) {
$reqd_img_size = $cnvrt_size[$default_img_size]['label'];
} else {
$reqd_img_size = $valid_sizes['0'];
}
/**
* Establish temp size, if any.
*/
if (isset($get_vars['Qtmp']) && strlen($get_vars['Qtmp']) < 9) {
$reqd_img_size_tmp = $get_vars['Qtmp'];
} else {
$reqd_img_size_tmp = FALSE;
}
if (in_array($reqd_img_size_tmp, $size_labels)
&& !in_array($reqd_img_size_tmp, $valid_sizes))
{
$reqd_img_size_tmp = FALSE;
}
/**
* Get non-Qdig GET parmameters, if any
*/
if ($keep_params == TRUE) {
$extra_param .= keepParams();
}
/**
* Establish Image Conversion and Captions Paths' roots
*/
if (!empty($qdig_files)) {
$cnvrtd_files_root = cleanPath("$qdig_files/$convrtd_subdir").'/';
$captions_root = cleanPath("$qdig_files/$caption_subdir").'/';
$qdig_files = substr(cleanPath($qdig_files), 2);
$chroot_dir = substr(cleanPath($chroot_dir), 2);
$qdf_parts = explode('/', $qdig_files);
$chroot_parts = explode('/', $chroot_dir);
foreach($qdf_parts as $i => $qdf_part) {
if (@$chroot_parts[$i] == $qdf_part) { continue; }
$qdig_files_topdir = $qdf_part;
}
} else {
$cnvrtd_files_root = '';
$captions_root = '';
$qdig_files = '';
}
/**
* Get the array of subdirectory names.
*/
$subdirs = getDirNames($pwd);
// Don't enable directory navigation if it's not usable
if ($dir_nav['enable'] == FALSE
|| ($pwd == '.' && ! isset($subdirs)))
{
$dir_nav['prefs_ena'] == FALSE;
}
/**
* Build style strings for color settings.
*/
// Gallery table background color
if (!empty($gallery_table_bg_clr)) {
$qdig_bg_clr_attr = 'bgcolor="'.$gallery_table_bg_clr.'" ';
} else {
$qdig_bg_clr_attr = '';
}
// Image table background color
if (!empty($image_table_bg_clr)) {
$img_tbl_bg_clr_attr = ' bgcolor="'.$image_table_bg_clr.'"';
} else {
$img_tbl_bg_clr_attr = '';
}
// Grayed-out text color
if (!empty($grayout_color)) {
$styl_grayout = 'class="qdig-grayout" style="color:'.$grayout_color.';"';
} else {
$styl_grayout = 'class="qdig-grayout"';
}
/**
* Check for Image Magick or GD
*/
// Turn them off if they're not likely to work.
if ($convert_GD == TRUE && ! gdVersion()) {
$convert_GD = FALSE;
}
if ($convert_magick == TRUE
&& ($safe_mode == TRUE || ! @is_file($convert_cmd)))
{
$convert_magick = FALSE;
}
// Prefer GD on Win32, otherwise prefer IM.
if ($convert_magick == TRUE && $convert_GD == TRUE) {
if ($platform == 'Win32') {
$convert_magick = FALSE;
} else {
$convert_GD = FALSE;
}
}
/**
* Get the array of image filenames.
*/
// Exclude background images.
$excl_imgs[] = end($logo_arrray = explode('/', $header['css_logo_url']));
$excl_imgs[] = end($bg_img_array = explode('/', $header['css_bg_img_url']));
$imgs = getImageFilenames($pwd);
/**
* Establish Image Conversion and Caption Paths
*/
$cnvrt_path = cleanPath($cnvrtd_files_root.$pwd.'/'.$cnvrtd_dir);
if (( $convert_magick == TRUE || $convert_GD == TRUE)
&& ! is_dir($cnvrt_path))
{
mkRecursiveDir($cnvrt_path);
}
$caption_path = cleanPath($captions_root.$pwd);
if (! is_dir($caption_path) && $touch_captions == TRUE) {
mkRecursiveDir($caption_path);
}
/*
* Security Check
*/
if ($check_security == TRUE
&& ! ($platform == 'Win32')
&& !empty($qdig_files)
&& @is_writable($qdig_files)
&& ! @$get_vars['Makethumb'] == 'Y'
&& umask() > 0)
{
if (@$base_dir) { $base_dir = $base_dir.'/'; }
$path = @$base_dir.cleanPath($qdig_files).'/';
$warning_fn = $path.'Security_Check_File--Safe_To_Delete';
$dperms = decoct(fileperms($path)) % 10000;
$wperms = substr($dperms, - 1); // world perms
if (@is_dir($cnvrt_path)
&& ($touch_captions == FALSE || @is_dir($caption_path)))
{
if (! is_file($warning_fn)) {
touch($warning_fn);
} elseif ($wperms == 7 || $wperms == 6 || $wperms == 3 || $wperms == 2)
{ // world-writable
$setting = '$check_security';
$install_txt = 'INSTALL.txt';
$exit_mesg =<<Check security.
The $path directory appears to be world-writable.
See $install_txt for information about setting permissions on the
directory to something reasonable (like 0755 / drwxr-xr-x). There is also
a $setting configuration setting you can use to disable the security
check that produces this message.
EOT;
if ($dperms == '777') {
$umask = umask();
$exit_mesg .=<<
If you want to use "777" (rather than "2777") permissions
you may also want to allow the script to create world-writable
files using the following File Creation Mask setting:
umask(000);
Doing so will be more convenient but "less secure" than leaving the
umask setting as it is now. It will also bypass the security check
that produces this message.
EOT;
$exit_mesg .='