Share

Qdig - Quick Digital Image Gallery

The forum address has changed, you have been automatically redirected. Please update any bookmarks to use the new URL.

Subscribe

Editing Captions

You are viewing a single message from this topic. View all messages.

  1. 2009-06-25 07:08:07 UTC
    I also can not edit captions using "Qdig 2.0". However, I can edit captions using version "qdig-1.2.9.4".

    I used Qdig a couple of years ago on a flash based website and I liked the results very much.

    Currently I want to use Qdig on a Joomla based website. And so far so good. I am using "qdig-1.2.9.4" and it allows me to edit captions in my Joomla file structure without any problems.

    I have read the Joomla setup info at:

    http://qdig.sourceforge.net/Support/Joomla

    And I am working on implementing the Qdig Joomla setup for a customer as I write this.

    I would consider my php progrmming skills as basic but determined. I just will not give up.

    It would be nice to resolve the caption editing impass with Qdig 2.0 and that is why I am posting here.

    Hopefully, someone who really knows what they are looking for will be able to figure it out.

    For myself, when programming and feeling lost at the keyboard somtimes I feel like one of the monkeys in the "infinite monkey theorem " postulation.

    mjc

    Enclosed: here is my php info() setup + a copy of the Qdig script as I have configured it.

    ---
    <?php
    /*#
    +----------------------------------------------------------------------+
    | Qdig - A Quick Digital Image Gallery
    |
    | Qdig is an easy-to-use script that dynamically creates an image
    | gallery or set of galleries from image files stored on your web
    | server's filesystem. The script is simple to install, just place it
    | in a directory that contains images and/or subdirectories with images.
    | You can navigate among directories for an organized presentation of
    | any size image collection. Qdig can generate thumbnail images and
    | web-sized resampled versions of large images such as digital camera
    | photos. Converting (resampling) images requires either Image Magick
    | or PHP's GD extensions and some quick-and-simple additional setup.
    | Qdig supports image captions and includes built-in caption editing
    | capability. Images with EXIF metadata can include an EXIF summary
    | line, including a link that exposes detailed EXIF information. There
    | are dozens of configurable options for customizing your galleries.
    | The script runs stand-alone, or a gallery may be included within
    | another page such as a weblog. Enjoy!
    +----------------------------------------------------------------------+
    | Copyright 2002, 2003, 2004, 2005, 2006, 2007 Hagan Fox
    | This program is distributed under the terms of the
    | GNU General Public License, Version 2
    |
    | This program is free software; you can redistribute it and/or modify
    | it under the terms of the GNU General Public License, Version 2 as
    | published by the Free Software Foundation.
    |
    | This program is distributed in the hope that it will be useful,
    | but WITHOUT ANY WARRANTY; without even the implied warranty of
    | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
    | GNU General Public License for more details.
    |
    | You should have received a copy of the GNU General Public License,
    | Version 2 along with this program; if not, visit GNU's Home Page
    | http://www.gnu.org/
    +----------------------------------------------------------------------+
    CVS: $Id: index.php,v 1.135 2007/02/11 06:37:03 haganfox Exp $#
    */#
    $qdig_version = '20070210';
    $mtime = microtime();
    $mtime = explode(' ', $mtime);
    $start_time = $mtime[1] + $mtime[0];
    define('Qdig', TRUE);

    /*
    +------------+
    | Settings |
    +------------+
    */

    // Commonly Used Settings ---------------------------------------------+
    // See http://qdig.sourceforge.net/Settings/CommonlyUsedSettings

    /**
    * Site Link and Copyright Text
    */
    // The optional Site Link is made up of a browsable URL and some link text.
    $site_link['url'] = ''; // Using '' disabls the Site Link.
    $site_link['title'] = 'Home Page'; // Link text
    // If you specify copyright text, it will appear at the bottom of your gallery.
    // See http://www.whatiscopyright.org/ for information about copyrights.
    $copyright['txt'] = 'Images copyright &copy; 2005, 2006, 2007 original creators or assignees. All rights reserved.';#

    /**
    * Gallery Size
    *
    * These don't specify the size of the gallery table, but they affect it.
    */
    $default_nav_width = 560; // Default width for gallery/directory navigation
    // rows and thumbnail link rows.
    $extra_size['pct'] = 2.5; // Add some extra-size percentage (0 to 10)
    $extra_size['width'] = 0; // Add some extra width, in pixels.
    $extra_size['height'] = 20; // Add some extra height (room for EXIF, captions).

    /**
    * Navigation Elements
    */
    $dir_nav['enable'] = TRUE; // Enable Directory Navigation. If disabled,
    // subdirectories will be isolated galleries.
    $ctrl_bar['enable'] = TRUE; // Enable the control bar (visitor preferences).
    $upr_nav['enable'] = TRUE; // Enable the upper gallery navigation row.
    $lwr_nav['enable'] = TRUE; // Enable the lower gallery navigation row.

    /**
    * Sizes to convert / display
    *
    * Enable or disable any of the alternate sizes.
    * Default settings: FALSE,TRUE,FALSE,FALSE,FALSE,TRUE,'1'
    */
    $disp_size[0] = FALSE; // 'XS' | These cause resizing
    $disp_size[1] = TRUE; // 'S' | links in the Control
    $disp_size[2] = FALSE; // 'M' | Bar and Navigation
    $disp_size[3] = FALSE; // 'L' | Bar to disappear
    $disp_size[4] = FALSE; // 'XL' | if set to FALSE and
    $disp_size[5] = TRUE; // 'FS' | appear if set to TRUE.
    // If no size is specified, use the following size.
    $default_img_size = '1'; // Must be an enabled size.

    /**
    * Caption Editing
    *
    * Caption editing exposes some security risk. It's safest to lock it
    * when you're not going to use it by setting $auth['locked'] to TRUE.
    * See INSTALL.txt and http://qdig.sourceforge.net/Support/EditCaptions
    */
    // The link to request editing a caption appears in the copyright area.
    $admin['link_ena'] = TRUE; // Enable the caption-editing (Admin) link.
    // Set a username and password or disable authentication to edit captions.
    $auth['enable'] = false; // If this is FALSE, anyone can edit captions.
    $auth['locked'] = FALSE; // If this is TRUE, nobody can edit captions.
    $auth['auto_lock'] = TRUE; // Automatically lock caption editing...
    $auth['time_limit'] = 2 * 60 * 60; // ...this many seconds after last activity.
    //
    // RESET AUTO-LOCK BY DELETING THE LOCK FILE FROM THE CAPTIONS ROOT DIRECTORY.
    //
    $auth['0']['username'] = 'puggmahone'; // Set the username.
    $auth['0']['password'] = crypt('i.am.using.a.password'); // Set the crypted password.
    // The password needs to be at least six characters and not pure alphabetic.
    // Use either crypt('some password') or else a pre-crypted password.
    // To pre-crypt a password, add ?Qtmp=crypt to any Qdig URL and use the form.
    $auth['pw_crypt_form'] = TRUE; // Enable the password crypting form.
    $auth['realm'] = 'Qdig Captions'; // HTTP-Authentication Realm. #
    $auth['session'] = true; // Use session-based authentication, not HTTP-Auth.

    // Layout Settings ----------------------------------------------------+
    // These are in roughly the same order as they appear in the output.
    // See http://qdig.sourceforge.net/Settings/LayoutSettings

    /**
    * HTML Header
    *
    * These work for stand-alone mode only, since othewise headers are suppressed.
    */
    $header['force_ena'] = FALSE; // Force HTML headers to be produced.
    $header['force_disa'] = FALSE; // Force HTML headers to be suppressed.
    $header['title_text_1'] = 'Image Gallery'; // Leading text in title (lang)#
    $header['title_delim'] = '|'; // Delimiter character(s)
    $header['title_cntr'] = TRUE; // Include an 'x of y' counter.
    $header['title_text_2'] = ''; // Trailing text in title
    $header['img_name'] = TRUE; // Include image name in title.
    $header['strip_ext'] = TRUE; // Strip the extension from it.
    $header['nav_links'] = TRUE; // Include nav. links in html header.
    $header['icon'] = TRUE; // Use the qdig-camera icon.
    $header['preload_next'] = TRUE; // Enable the preload-next-image function.

    /**
    * Directory Navigation (Contains pwd and subdirectories.)
    */
    // The $dir_nav['enable'] setting is in the Commonly Used Settings section.
    $dir_nav['small'] = FALSE; // Use small text for Dir. Navigation row.
    $dir_nav['fname_ena'] = true; // Display the filename.
    $dir_nav['cntr_ena'] = TRUE; // Display the counter.
    $dir_nav['path_delim'] = '&gt;'; // Delimiter between path elements
    $dir_nav['strip_num'] = TRUE; // Strip numeral prefixes ("010_Foo" is "Foo").
    $dir_nav['dir_is_new'] = 0 * 24 * 60 * 60; // New if less than this many seconds
    $dir_nav_lang_new = 'New';#
    $dir_nav['new_flag'] = "&nbsp;
    <small style='font-size:8pt; vertical-align:top; padding-bottom:1px; text-decoration:none;
    font-weight:normal; color:black; background-color:yellow;'>&nbsp;$dir_nav_lang_new&nbsp;</small>";
    // 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['start_thm'] = FALSE; // Start in a dir with thumbs-only display (if
    // enabled), else jump to the first image.
    // The next two are for subdirectories-only pages
    $dir_nav['align_dirs'] = 'center'; // Text alignment (left/center/right).
    $dir_nav['size_of_image'] = TRUE; // Expand area to image-display size.

    /**
    * Control Bar (Contains visitor preferences: links style and default view)
    */
    // The $ctrl_bar['enable'] setting is in the Commonly Used Settings section.
    $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['def_size'] = 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
    */
    $thumbs['enable'] = TRUE; // Enable thumbs view. Safe to leave TRUE.
    $thumbs['default'] = TRUE; // Default to thumbs view if thumbs-capable.
    $thumbs['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'] = 0; // Approx. max. width of thumbnails row (0=default)
    $thmb_row['softwrap'] = 84; // A percentage, 80 to 99
    // NEW! Thumbs-only View of Gallery Directories
    $thumbs['thm_only'] = TRUE; // Folder is thumbs-only if more than...
    $thumbs['t_o_imgs'] = 999; // ...this many images, or...
    $thumbs['t_o_rows'] = 2; // ...this many rows, whichever is smaller.
    $thumbs['t_o_h2w'] = 0.75; // Height-to-width ratio of an average image.
    // NEW! Vicinity Thumbs -- Show only a single row of thumbnail links.
    $thumbs['vicinity'] = TRUE; // Show only thumbs for "nearby" images.
    $thumbs['shift_by'] = 0; // Adjust the number of vicinity lead-in images. // TODO shift to right is limited.

    /**
    * Filename and Numeral Text Image Links
    */
    $txtlinks_default = 'name'; // 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'] = 15; // 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'] = 20; // maximum number of numeral links per row
    $nmrl_row['softwrap'] = 85; // percentage, 80 to 100

    /**
    * Upper Gallery Navigation Row immediately above the image
    *
    * If nothing on the row is enabled, the navigation row is omitted.
    */
    // The $upr_nav['enable'] setting is in the Commonly Used Settings section.
    $upr_nav['tmp_size'] = 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 Next / Prev. at the 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'] = 0; // Width of this navRow's table (0=default)
    $upr_nav['padding'] = '1px 0px 2px 0px'; // CSS Padding for the row

    /**
    * Image Display
    */
    $caption['padding'] = '2px'; // CSS padding around caption text
    $caption['nl2br'] = FALSE; // Automatically insert <br /> tags in captions.
    $caption['left_just'] = FALSE; // Left-justify caption (otherwise centered).
    $caption['above'] = FALSE; // Place caption above the image, not below it.
    $caption['placehold'] = FALSE; // If there's no caption, display a blank line.
    // 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.
    $img_link['th_page'] = FALSE; // Link to all-thumbs view if available...
    $img_link['t_p_few'] = FALSE; // ...even in directories with few images.
    $img_link['few_limit'] = 9; // How many is "few" for $img_link['t_p_few']?
    // 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; // Cause the link to go directly to the image file.
    // Image Metadata settings
    $exif['ena'] = FALSE; // Include a line of EXIF data below the image.

    /**
    * Lower Gallery Navigation Row below the image and caption
    *
    * If nothing on the row is enabled, the navigation row is omitted.
    */
    // The $lwr_nav['enable'] setting is in the Commonly Used Settings section.
    $lwr_nav['tmp_size'] = 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 Next / Prev. at the 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'] = 0; // Width of this navRow's table (0=default)
    $lwr_nav['padding'] = '1px 0px 2px 0px'; // CSS Padding for the row

    /**
    * Gallery Footer Row
    */
    $footer['pad_top'] = '5px'; // Extra space above the footer line
    $site_link['font_size'] = '0.75em'; // Font size for Site 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
    // Contribute a color scheme in the Qdig General Discussion forum.

    // 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'] = '60'; // Setting of 1 to 99 fades thumbs.
    // (Opacity may slow 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
    // Settings beyond here can be set to '' to use the page default.
    // Gallery Table and Image Table (Important for an embedded gallery)
    $gallery_table_bg_clr = ''; // Background color of the gallery table.
    $gallery_table_align = 'center'; // Horizontal position (left/center/center).
    $image_table_bg_clr = ''; // Background color of image area.
    $sidebar['bg_clr'] = '#f3f3f3'; // Sidebar background
    $sidebar['margin'] = '4px 0px 2px 2px'; // 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
    $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.
    // "Sizes to convert / display" are in the Commonly Used 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: (lang)#
    // Create the directory. Give it 2777 permissions
    // (`chmod 2777'). Visit the gallery once. Then
    // change the permissions to something sane (0755).
    $convrtd_subdir = 'converted-images/'; // Subdir for resampled images (lang)#
    $caption_subdir = 'captions'; // Subdir for captions (lang)#
    $touch_captions = tru; // 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 IM's `convert'
    $convert_nice = TRUE; // Modify priority with nice(1) command if available.
    $nice_command = '/bin/nice -n 18 ';
    // 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'.

    /**
    * Thumbnail Image Conversion Settings
    */
    $cnvrt_thmb['size'] = 50; // 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 a 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']}_"; // The default includes the thumb file size. #
    //$cnvrt_thmb['prefix'] = 'thm_'; // Uncomment for 'thm_' (w/o file size). #

    /**
    * 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.)
    $cnvrt_alt['aspect'] = 0.75; // Default inverted aspect ratio (H/W) (experimental) // TODO
    $cnvrt_alt['by_height'] = TRUE; // Convert by height, not "height or width"...
    $cnvrt_alt['limit_width'] = TRUE; // ...except extra-wide images.
    // x-small
    $cnvrt_size[0]['prefix'] = 'xsm_';#
    $cnvrt_size[0]['sharpen'] = '0.6x0.7';
    $cnvrt_size[0]['maxwid'] = 420;
    $cnvrt_size[0]['qual'] = 87;
    // small
    $cnvrt_size[1]['prefix'] = 'sml_';#
    $cnvrt_size[1]['sharpen'] = '0.6x0.8';
    $cnvrt_size[1]['maxwid'] = 544;
    $cnvrt_size[1]['qual'] = 87;
    // medium
    $cnvrt_size[2]['prefix'] = 'med_';#
    $cnvrt_size[2]['sharpen'] = '0.6x0.8';
    $cnvrt_size[2]['maxwid'] = 640;
    $cnvrt_size[2]['qual'] = 89;
    // large
    $cnvrt_size[3]['prefix'] = 'lrg_';#
    $cnvrt_size[3]['sharpen'] = '0.6x0.9';
    $cnvrt_size[3]['maxwid'] = 800;
    $cnvrt_size[3]['qual'] = 90;
    // x-large
    $cnvrt_size[4]['prefix'] = 'xlg_';#
    $cnvrt_size[4]['sharpen'] = '0.6x0.9';
    $cnvrt_size[4]['maxwid'] = 1024;
    $cnvrt_size[4]['qual'] = 91;
    // actual
    $cnvrt_size[5]['prefix'] = '../';

    // Language Settings --------------------------------------------------+
    // Text that appears in the output may be configured here.

    // htmlHeader() #
    $header['lang_code'] = 'en';#
    $header['charset'] = 'iso-8859-1';#
    $header['keywords'] = ''; // e.g. 'foo,bar' #
    // dirNav() #
    $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 '; // Using '#' is shorter.#
    $dir_nav['go_to_txt'] = 'Go to';#
    $dir_nav['thumbs'] = 'thumbnails';#
    $dir_nav['up_level_txt'] = 'Up&nbsp;a&nbsp;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_title_txt2'] = 'Keep your current visitor preferences';#
    //$dir_nav['prefs_txt'] = 'Preferences';#
    $dir_nav['prefs_txt'] = '+';#
    $dir_nav['prefs_txt2'] = '&ndash;';#
    // Navigation Links: imageThumbsLinks(), imageTextLinks(), displayImage(), #
    // prevLink(), nextLink(), lastLink(), firstLink(), navRow() #
    $nav_lnk['prv_txt'] = '&lt;&lt; Previous';#
    $nav_lnk['prv_msg'] = 'Previous Image';#
    $nav_lnk['next_txt'] = 'Next &gt;&gt;';#
    $nav_lnk['next_msg'] = 'Next Image';#
    $nav_lnk['last_txt1'] = '&lt;&lt; Last';#
    $nav_lnk['last_txt2'] = '&gt;&gt;|';#
    $nav_lnk['last_msg'] = 'Last Image';#
    $nav_lnk['frst_txt1'] = 'First &gt;&gt;';#
    $nav_lnk['frst_txt2'] = '|&lt;&lt;';#
    $nav_lnk['frst_msg'] = 'First Image';#
    $nav_lnk['Image'] = 'Image';#
    $nav_lnk['Gallery Navigation'] = 'Gallery Navigation';#
    // controlView() #
    $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';#
    $img_sz_labels['ctrl']['Default Size'] = 'Default Size:';#
    $img_sz_labels['ctrl']['Change def'] = 'Change the default image size to ';#
    // displayImage(), captionBlock() #
    $lang['Close Window'] = 'Close Window';#
    $lang['Requested Image'] = 'Requested Image';#
    $caption['lang Caption'] = 'Caption';#
    // Image size: displayImage(), navSize(), navFull()
    $cnvrt_size[0]['label'] = 'XS';#
    $cnvrt_size[1]['label'] = 'S';#
    $cnvrt_size[2]['label'] = 'M';#
    $cnvrt_size[3]['label'] = 'L';#
    $cnvrt_size[4]['label'] = 'XL';#
    $cnvrt_size[5]['label'] = 'FS';#
    $img_sz_labels['nav']['See the'] = 'See the ';#
    $img_sz_labels['nav']['Return to'] = 'Return to the ';#
    $cnvrt_size[0]['txt'] = 'Extra Small';#
    $cnvrt_size[1]['txt'] = 'Small';#
    $cnvrt_size[2]['txt'] = 'Medium';#
    $cnvrt_size[3]['txt'] = 'Large';#
    $cnvrt_size[4]['txt'] = 'Extra Large';#
    $cnvrt_size[5]['txt'] = 'Full Size';#
    $cnvrt_size[5]['txt2'] = 'default';#
    $img_sz_labels['ctrl']['str2'] = '.';#
    $img_sz_labels['nav']['version of'] = ' version of this image.';#
    // imageCounter() #
    $lang['nav_cntr_txt'] = ' of '; // "x of n" counter #
    // createThumbs(), resizeImage() #
    $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)'#
    // footerRow() #
    $footer['summary_txt'] = 'Gallery Footer';#
    $copyright['title_txt'] = 'Copyright Notice';#
    $qdig_homelink['div_title'] = 'Gallery by Qdig';#
    // adminLink() #
    $admin['link_title'] = 'Edit Caption';#
    $admin['link_text'] = 'Admin';#
    $admin['before_link'] = '(';#
    $admin['after_link'] = ')';#
    // authorize(), cryptPw(), editCaption(), #
    $auth['Unauthorized'] = 'Unauthorized';#
    $auth['Disabled'] = 'Caption editing is locked.';#
    $auth['Log in'] = ' Log in ';#
    $auth['Cancel'] = ' Cancel ';#
    $auth['Save'] = ' Save ';#
    $auth['Encrypt'] = ' Encrypt ';#
    $auth['Done'] = ' Done ';#
    $auth['Password'] = 'Password: ';#
    $auth['Crypted'] = 'Crypted: ';#
    $auth['Line'] = 'Line: ';#
    $auth['PW too few'] = 'Password has too few characters.';#
    $auth['PW alpha'] = 'Password needs at least one non-alphabet character.';#
    $auth['PW bad'] = 'Password is not acceptable.';#
    $auth['Enter password'] = 'Enter the password to encrypt:';#
    $auth['Enable Cookies'] = 'Cookies must be enabled.';#
    $auth['Back to gallery'] = 'Back to gallery';#
    // Misc. #
    $lang['Diag Messages'] = 'Diagnostic Messages';#
    $lang['Image Gallery'] = 'Image Gallery';#
    $lang['Control Bar'] = 'Control Bar';#
    $lang['Img Disp Area'] = 'Image Display Area';#
    $lang['Empty gallery'] = 'Empty gallery!';#
    $lang['Forbidden'] = '403 Forbidden';#

    // Security Settings ------------------------------------------------+

    // Formerly most of these were grouped as "Paranoia Settings".
    $only_embed_qdig = FALSE; // Only allow included Qdig, not stand-alone.
    $safe_captions = TRUE; // Disable HTML in Captions. Convert special
    // characters (<>&"') to "HTML entities"
    $caption['size_limit'] = 385; // Max. number of characters in a caption.
    $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 '..' and more.
    umask(0002); // File creation mask if $extra_paranoia is TRUE // TODO: Does this have any effect?
    // Examples: umask(0002); // `drwxrwxr-x' and `-rw-rw-r--' (world readable)
    // umask(0007); // `drwxrwx---' and `-rw-rw----' (not world readable)
    // umask(0000); // `drwxrwxrwx' and `-rw-rw-rw-' (world writable)
    $ignore_dotfiles = TRUE; // Ignore files that start with '.'.
    $ignore_dotdirs = TRUE; // 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'] = '864000'; // Number of seconds for the cache to expire.

    /**
    * Path Settings (Override defaults.)
    */
    // These 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/' or '/~someuser/qdig/'
    $fs_base_path = ''; // Filesystem path to the root dir of the gallery.
    // Ex.: '/home/someuser/public_html/qdig/' or '../qdig'
    $chroot_dir = ''; // The topmost directory of the gallery tree.
    // Note: You may also want to add the path to the $qdig_files location
    // (Example: For 'images' $qdig_files might be 'images/qdig-files/'.)
    // See http://qdig.sourceforge.net/Support/ChrootDirectory
    $qdig_url = ''; // Self-referring URL path. Examples: '/photos/' or
    // '/photos/qdig.php' or '/~someuser/qdig/index.php'

    /**
    * 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_dir_preg = '/^priv_/'; // Ignore dirs by perl-compatible regex. // TODO Strip string from dir name?
    $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_preg = '/^thumb_/'; // Ignore images by perl-compatible regex.
    $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&amp;' 'a=foo&amp;b=bar&amp;'
    $keep_params = FALSE; // Retain extra GET parameters in Qdig URLs. Allows
    // Qdig to "share" the query string when embedded. // TODO: Set limits (#/size)? Rename?
    $anchor = ''; // Include an intra-page anchor in URLs. For embedded
    // galleries, use '#qdig' to jump down to the gallery.

    /**
    * 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); }
    // External Language Settings
    //@include_once('./lang-xx.php'); // Uncomment and change xx to a country code.

    // End of Settings ----------------------------------------------------+

    /*
    +-------------------+
    | 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;
    $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)) == 'LIN') {
    $platform = 'Linux';
    } elseif (strtoupper(substr(PHP_OS, 0, 3)) == 'MAC') {
    $platform = 'Macintosh';
    } elseif (strtoupper(substr(PHP_OS, 0, 5)) == 'FREEB') {
    $platform = 'FreeBSD';
    } else {
    $platform = 'Unix';
    }
    // Included Qdig?
    if (function_exists('qdig_settings')) {
    $is_included = TRUE;
    } elseif (__FILE__ == realpath(@$server_vars['SCRIPT_FILENAME'])
    || ! $tmp = get_included_files())
    {
    $is_included = FALSE;
    } else {
    $is_included = TRUE;
    }
    if ($only_embed_qdig == TRUE && $is_included == FALSE) {
    securityExit('Direct access is disabled.');
    }
    if (!function_exists('exif_read_data')) { $exif['ena'] = FALSE; }

    /*
    +-------------+
    | 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()

    /**
    * An encoded transparent 1x1 image.
    */
    function clear_dot()
    {
    header('Content-type: image/gif');
    header('Content-length: 43');
    echo base64_decode(
    'R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==');
    } // end clear_dot()

    /**
    * Allow ? in place of & in a query string.
    */
    function fixGets($vars) {
    foreach ($vars as $k => $v) {
    if (strpos($v, '?') === FALSE) { continue; }
    $multi = explode('?', $v); unset ($vars[$k]); $i=0;
    foreach ($multi as $param) {
    $pair = explode('=', $param);
    if (@$i++ < 1) { $vars[$k] = $pair[0]; continue; }
    $pk = @$pair[0]; $pv = @$pair[1];
    $vars[$pk] = $pv;
    }
    }
    return $vars;
    }

    /**
    * Get a crypted version of an input password.
    */
    function cryptPw() {
    global $post_vars, $std_uri, $auth;
    if ($auth['pw_crypt_form'] == FALSE) { return; }
    $passwd = @$post_vars["passwd"];
    echo <<<EOT
    <html><body style='font-family: Verdana,Arial,Helvetica,sans-serif;'>
    <head><title>Qdig Password Crypting Form</title><style><!--
    pre { font-family:'Lucida Console','Andale Mono','Courier New',Courier; }
    --></style></head>
    <form action='$std_uri&amp;Qtmp=crypt'
    method='POST' style='margin:1em;'>{$auth['Enter password']}
    <input type='text' name='passwd' value='$passwd' />
    <input type='submit' value='{$auth['Encrypt']}' /></form>\n
    EOT;
    if ($passwd) {
    if (strlen($passwd) < 6) {
    echo " <div style='margin-left:1em'>{$auth['PW too few']}</div>\n";
    } elseif (preg_match('%^(?:[[:cntrl:]])*$%xs', $passwd)) {
    echo " <div style='margin-left:1em'>{$auth['PW bad']}</div>\n";
    } elseif (preg_match('%^(?:[[:alpha:]])*$%xs', $passwd)) {
    echo " <div style='margin-left:1em'>{$auth['PW alpha']}</div>\n";
    } else {
    $crypted = crypt($passwd);
    $auth_str = '$auth';
    echo <<<EOT
    <table style='margin-left:1em' cellpadding='2' cellspacing='0' border='0'>
    <tr><td align='right'><pre>{$auth['Password']}</pre></td><td><pre>$passwd</pre></td></tr>
    <tr><td align='right'><pre>{$auth['Crypted']}</pre></td><td><pre>$crypted</pre></td></tr>
    <tr><td align='right'><pre>{$auth['Line']}</pre></td>
    <td colspan='2'><pre>{$auth_str}['0']['password'] = '$crypted';</pre></td></tr>
    </table>\n
    EOT;
    }
    }
    echo <<<EOT
    <form action='$std_uri'
    method='POST' style='margin:1em;'><input type='submit' value='{$auth['Done']}'/></form>
    </body></html>
    EOT;
    exit;
    }

    /**
    * Security Exit
    */
    function securityExit($mesg = 'Unspecified Error')
    {
    global $lang;
    header('HTTP/1.0 403 Forbidden');
    exit("<html>\n <head><title>{$lang['Forbidden']}</title></head>
    <body>{$lang['Forbidden']}: $mesg</body>\n</html>");
    } // End securityExit()

    /**
    * Return 'TRUE' or 'FALSE' string based on a variable's status.
    */
    function trueFalse($data, $true = 'TRUE', $false = 'FALSE')
    {
    if (@$data == TRUE) { return $true; } else { return $false; }
    } // End trueFalse()

    /**
    * Return non-Qdig GET parameters, ready for prepending to a query string.
    */
    function keepParams()
    {
    global $get_vars, $extra_param;
    if (!empty($extra_param) || empty($get_vars) ) { return; }
    foreach ($get_vars as $param => $value) {
    if (! preg_match('!^(Qwd|Qif|Qiv|Qis|Qtmp|Qimg|Makethumb)$!',
    $param)) {
    $params .= $param.'='.$value.'&amp;';
    }
    }
    return $params;
    }

    /**
    * Get the names of image files in a directory.
    */
    function getImageFilenames($path)
    {
    global $rootdir, $is_readable_disa, $convert_GD, $ignore_img_links,
    $img_links, $imgname_maxlen, $exclude_gif, $excl_main, $excl_imgs,
    $excl_img_pattern, $excl_img_preg, $extra_paranoia, $ignore_dotfiles;
    if ($excl_main == TRUE && $path == $rootdir) { return; }
    $img_exts = ($convert_GD == TRUE)
    ? '\.jpg$|\.jpeg$|\.jpe$|\.png$'
    : '\.jpg$|\.jpeg$|\.jpe$|\.png$|\.bmp$';
    if ($exclude_gif == FALSE) { $img_exts .= '|\.gif$'; }
    $pwd_handle = opendir($path);
    $i = 100;
    while (($file = readdir($pwd_handle)) != false) {
    if ($file == '.' || $file == '..' || strpos('X'.$file, '*')
    || strpos('X'.$file, '?') || strpos('X'.$file, '/')) { continue; }
    if ($extra_paranoia == TRUE && is_file($path.'/'.$file)) {
    if (strpos(stripslashes(rawurldecode($file)), '..')
    || ($file[0] == '.' && $file[1] == '.'))
    {
    securityExit('Updir ("..") is not allowed in a filename.');
    }
    if (strlen($file) > $imgname_maxlen) {
    securityExit('Filename length exceed. Increase $imgname_maxlen?');
    }
    }
    if ($ignore_dotfiles == TRUE && $file[0] == '.') { continue; }
    if (in_array($file, $excl_imgs)) { continue; }
    if (preg_match($excl_img_preg, $file)) { continue; }
    if (strpos('*'.$file, $excl_img_pattern)) { continue; }
    if (is_file($path.'/'.$file)
    && ($is_readable_disa == TRUE || is_readable($path.'/'.$file))
    && ! ($ignore_img_links == TRUE && is_link($path.'/'.$file))
    && eregi($img_exts, $file))
    {
    $mod_date = filemtime($path.'/'.$file).$i;
    $img_files[$mod_date] = $file;
    $i++;
    }
    }
    closedir($pwd_handle);
    if (isset($img_files)) {
    ($img_links['sort_date'] == TRUE)
    ? ksort($img_files)
    : natcasesort($img_files);
    foreach ($img_files as $img) { $sorted_files[] = $img; }
    return ($img_links['sort_rev'] == TRUE)
    ? array_reverse($sorted_files)
    : $sorted_files;
    }
    } // End getImageFilenames()

    /**
    * Check to see if at least one potential gallery directory exists.
    */
    function checkForDirs($path)
    {
    global $qdig_files_topdir, $is_readable_disa, $ignore_dir_links,
    $excl_dirs, $excl_dir_preg, $ignore_dotdirs;
    $pwd_handle = opendir($path);
    while (($file = readdir($pwd_handle)) != FALSE) {
    if($file == '.'
    || $file == '..' || strpos('X'.$file, '*')
    || strpos('X'.$file, '?') || strpos('X'.$file, '/')
    || $file == $qdig_files_topdir
    || @in_array($file, $excl_dirs)
    || preg_match($excl_dir_preg, $file)
    || ! ($is_readable_disa == TRUE || @is_readable($path.'/'.$file))
    || ($ignore_dir_links == TRUE && is_link($path.'/'.$file)))
    {
    continue;
    }
    if ($ignore_dotdirs == TRUE && $file[0] == '.') { continue; }
    if (is_dir($path.'/'.$file)) {
    $has_dir = TRUE;
    closedir($pwd_handle);
    return $has_dir;
    }
    }
    closedir($pwd_handle);
    } // End checkForDirs()

    /**
    * Check for existence of at least one image file in a directory.
    */
    function checkForImgs($path)
    {
    global $is_readable_disa, $ignore_img_links, $ignore_dotfiles;
    $pwd_handle = opendir($path);
    while (($file = readdir($pwd_handle)) != FALSE) {
    if($file == '.'
    || $file == '..' || strpos('X'.$file, '*')
    || strpos('X'.$file, '?') || strpos('X'.$file, '/')
    || ! ($is_readable_disa == TRUE || @is_readable($path.'/'.$file))
    || is_dir($path.'/'.$file)
    || ($ignore_img_links == TRUE && is_link($path.'/'.$file)))
    {
    continue;
    }
    if ($ignore_dotfiles == TRUE && $file[0] == '.') { continue; }
    if (eregi('\.jpg$|\.jpeg$|\.jpe$|\.png$|\.gif$|\.bmp$', $file)) {
    $has_img = TRUE;
    closedir($pwd_handle);
    return $has_img;
    }
    }
    closedir($pwd_handle);
    } // End checkForImgs()

    /**
    * Get the names of gallery directories in a directory.
    *
    * A gallery directory is one that contains at least one image or potential
    * gallery directory. Returns an array with the dirname and its age.
    */
    function getDirNames($path)
    {
    global $qdig_files_topdir, $is_readable_disa, $dir_nav, $ignore_dir_links,
    $excl_dirs, $excl_dir_preg, $ignore_dotdirs;
    $dir_handle = opendir($path);
    while (($file = readdir($dir_handle)) != false) {
    if($file == '.'
    || $file == '..' || strpos('X'.$file, '*')
    || strpos('X'.$file, '?') || strpos('X'.$file, '/')
    || ! is_dir($path.'/'.$file)
    || ($ignore_dir_links == TRUE && is_link($path.'/'.$file))
    || ! ($is_readable_disa == TRUE || is_readable($path.'/'.$file))
    || @in_array($file, $excl_dirs)
    || preg_match($excl_dir_preg, $file)
    || $file == $qdig_files_topdir)
    {
    continue;
    }
    if ($ignore_dotdirs == TRUE && $file[0] == '.') { continue; }
    $dirs[] = $file;
    }
    closedir($dir_handle);
    if (isset($dirs)) {
    $timeofday = gettimeofday();
    $unixtime = $timeofday['sec'];
    $i = 0;
    natcasesort($dirs);
    foreach ($dirs as $dir) {
    if (checkForImgs($path.'/'.$dir) || checkForDirs($path.'/'.$dir)
    && ($is_readable_disa == TRUE || is_readable($path)))
    {
    $dirmodified = filemtime($path.'/'.$dir);
    $dir_age = 1000 * ($unixtime - $dirmodified) + $i;
    $sorted_dirs[$dir] = $dir_age;
    $i++;
    }
    }
    if (isset($sorted_dirs)) {
    return ($dir_nav['sort_rev'] == TRUE)
    ? array_reverse($sorted_dirs)
    : $sorted_dirs;
    }
    }
    } // End getDirNames()

    /*
    * Get the image number and filename of the requested image.
    *
    * If none is requested or the file is non-existent, default to the first image.
    */
    function getReqdImage()
    {
    global $pwd, $imgs, $get_vars, $imgname_maxlen, $extra_paranoia;
    if (empty($imgs)) { return; }
    if (!empty($get_vars['Qif'])) {
    $imagefile = stripslashes(rawurldecode($get_vars['Qif']));
    if (strlen($imagefile) > $imgname_maxlen
    || ($imagefile[0] == '.' && $imagefile[1] == '.'))
    {
    securityExit('Filename (Qif=) is too long or starts with "..".');
    }
    // Redundant, but what the heck.
    if ($extra_paranoia == TRUE
    && strpos(stripslashes(rawurldecode($imagefile)), '..'))
    {
    securityExit('Updir ("..") not allowed in a filename.');
    }
    }
    if (isset($imagefile) && is_file($pwd.'/'.$imagefile)) {
    $reqd_img_file = $imagefile;
    // Look up the image's index number
    $imgs_flip = array_flip($imgs);
    $reqd_img_num = $imgs_flip[$imagefile];
    } else {
    $reqd_img_file = $imgs[0];
    $reqd_img_num = 0;
    }
    return array('file' => $reqd_img_file, 'num' => $reqd_img_num);
    } // End getReqdImage()

    /**
    * Convert a string to a useful path starting with './'.
    *
    * click/buzz/./pop//boom/../bam/ becomes ./click/buzz/pop/boom/bam
    */
    function cleanPath($path)
    {
    $path = stripslashes(rawurldecode($path));
    $path_array = explode('/', $path);
    $clean_path = '.';
    foreach ($path_array as $dir) {
    if ($dir == '' || $dir == '.' || $dir == '..' || $dir == '...') { continue; }
    $clean_path .='/'.$dir;
    }
    return $clean_path;
    } // End cleanPath()

    /**
    * rawurlencode() a file's path but keep slashes, tildes.
    */
    function urlPath($path)
    {
    $decoded = rawurldecode($path); // Decode if encoded
    $cleaned = cleanPath($decoded);
    $encoded = rawurlencode($cleaned); // Encode
    $encoded_path = str_replace('%2F', '/', $encoded);
    $encoded_path = str_replace('%7E', '~', $encoded_path);
    return $encoded_path;
    } // End rawurlencodePath()

    /**
    * Build an 'x of n' counter.
    */
    function imageCounter($image_num)
    {
    global $imgs, $lang;
    $num_imgs = count($imgs);
    $img_num = $image_num + 1;
    if ($num_imgs > 0) {
    $str = "$img_num{$lang['nav_cntr_txt']}$num_imgs";
    return $str;
    }
    } // End imageCounter()

    /**
    * Get which version of GD is installed, if any.
    *
    * Returns the version (1 or 2) of the GD extension.
    */
    function gdVersion()
    {
    global $convert_GD_ver;
    if (! extension_loaded('gd')) { return; }
    static $gd_ver = 0;
    // Accept a user-defined setting if it's 1.
    if ($convert_GD_ver == 1) { $gd_ver = 1; return 1; }
    // Use the static variable if function was called previously.
    if ($convert_GD_ver !=2 && $gd_ver > 0) { return $gd_ver; }
    // Use the gd_info() function if possible.
    if (function_exists('gd_info')) {
    $ver_info = gd_info();
    preg_match('/\d/', $ver_info['GD Version'], $match);
    $gd_ver = $match[0];
    return $match[0];
    }
    // If phpinfo() is disabled use a specified / fail-safe choice...
    if (preg_match('/phpinfo/', ini_get('disable_functions'))) {
    if ($convert_GD_ver == 2) {
    $gd_ver = 2; return 2;
    } else {
    $gd_ver = 1; return 1;
    }
    }
    // ...otherwise use phpinfo().
    ob_start();
    phpinfo(8);
    $info = ob_get_contents();
    ob_end_clean();
    $info = stristr($info, 'gd version');
    preg_match('/\d/', $info, $match);
    $gd_ver = $match[0];
    return $match[0];
    } // End gdVersion()

    /**
    * Fix permissions of a file or directory.
    *
    * Adjusts permissions so both the script and account owner can modify / delete.
    * Adapted from PmWiki's fixperms() function copyright by Patrick R. Michaud.
    */
    function fixPerms($file) {
    global $extra_paranoia;
    if ($extra_paranoia == TRUE) { return; }
    clearstatcache();
    if (!file_exists($file)) { return; }
    $bp = 0;
    if (fileowner($file)!=@fileowner('.')) { $bp = (is_dir($file)) ? 007 : 006; }
    if (filegroup($file)==@filegroup('.')) { $bp <<= 3; }
    if ($bp && (fileperms($file) & $bp) != $bp) {
    chmod($file, fileperms($file)|$bp);
    }
    } // end of fixPerms()

    /**
    * Create a directory recursively (like `mkdir -p $dir').
    */
    function mkRecursiveDir($dir)
    {
    global $file_exists_disa, $base_dir;
    $path_array = explode('/', $dir);
    $path = $base_dir;
    foreach ($path_array as $dir) {
    if ($dir == '' || $dir == '.' || $dir == '..' || $dir == '...'
    || strpos('X'.$dir, '*') || strpos('X'.$dir, '?')) { continue; }
    $path .= '/'.$dir;
    if ((($file_exists_disa == TRUE && ! is_file($path))
    || ! file_exists($path))
    && is_writable(dirname($path)))
    {
    mkdir($path, 0777);
    fixPerms($path);
    }
    }
    } // End mkRecursiveDir()

    /**
    * Generate thumbnail images for images that do not have thumbnails yet.
    */
    function createThumbs($cnvrt_thmb)
    {
    global $platform, $pwd, $imgs, $convert_magick, $cnvrt_path, $convert_cmd,
    $convert_GD, $thmbs_ena, $convert_writable, $caption_path,
    $touch_captions, $cnvrt_mesgs, $file_exists_disa, $compat_quote;
    if ($thmbs_ena == FALSE || empty($imgs) || $convert_writable == FALSE) { return; }
    if ($cnvrt_thmb['single'] == FALSE && count($imgs) < 2) { return; } // one-image gallery
    if ($convert_GD == TRUE && ! ($gd_version = gdVersion())) { return; }
    if (! isset($cnvrt_thmb['size'])) {
    $cnvrt_thmb['size'] = 35;
    }
    if (! isset($cnvrt_thmb['qual'])) { $cnvrt_thmb['qual'] = 65; }
    if ($cnvrt_thmb['mesg_on'] == TRUE) { $str = ''; }
    if ($convert_magick == TRUE) {
    $strip_prof = ($cnvrt_thmb['no_prof'] == TRUE) ? ' +profile "*"' : '';
    $winquote = ($platform == 'Win32' && $compat_quote == TRUE) ? '"' : '';
    }
    foreach ($imgs as $img_file) {
    if ($touch_captions == TRUE && is_dir($caption_path)) {
    $caption_file = $caption_path.'/'.$img_file.'.txt';
    if (($file_exists_disa == TRUE && ! is_file($caption_file))
    || ! file_exists($caption_file))
    {
    touch($caption_file);
    fixPerms($caption_file);
    }
    }
    $orig_img = $pwd.'/'.$img_file;
    $cnvrtd_img = $cnvrt_path.'/'.$cnvrt_thmb['prefix'].$img_file;
    if (($file_exists_disa == TRUE && ! is_file($cnvrtd_img))
    || ! file_exists($cnvrtd_img))
    {
    $img_size = GetImageSize($orig_img);
    $height = $img_size[1];
    $th_maxdim = $height;
    $cnvt_percent = round(($cnvrt_thmb['size'] / $th_maxdim) * 100, 2);
    // convert it
    if ($convert_magick == TRUE) {
    // Image Magick image conversion
    exec($winquote.$convert_cmd
    .' -geometry '.$cnvt_percent.'%'
    .' -quality '.$cnvrt_thmb['qual']
    .' -sharpen '.$cnvrt_thmb['sharpen'].$strip_prof
    .' "'.$orig_img.'"'.' "'.$cnvrtd_img.'"'.$winquote);
    fixPerms($cnvrtd_img);
    $using = $cnvrt_mesgs['using IM'];
    } elseif ($convert_GD == TRUE) {
    // GD image conversion
    if (eregi('\.jpg$|\.jpeg$', $img_file) == TRUE
    && (imageTypes() & IMG_JPG) == TRUE)
    {
    $src_img = imageCreateFromJpeg($orig_img);
    } elseif (eregi('\.png$', $img_file) == TRUE
    && (imageTypes() & IMG_PNG) == TRUE)
    {
    $src_img = imageCreateFromPng($orig_img);
    } elseif (eregi('\.gif$', $img_file) == TRUE
    && (imageTypes() & IMG_GIF) == TRUE)
    {
    $src_img = imageCreateFromGif($orig_img);
    } else {
    continue;
    }
    $src_width = imageSx($src_img);
    $src_height = imageSy($src_img);
    $dest_width = $src_width * ($cnvt_percent / 100);
    $dest_height = $src_height * ($cnvt_percent / 100);
    if ($gd_version >= 2) {
    $dst_img = imageCreateTruecolor($dest_width, $dest_height);
    imageCopyResampled($dst_img, $src_img, 0, 0, 0, 0,
    $dest_width, $dest_height, $src_width, $src_height);
    } else {
    $dst_img = imageCreate($dest_width, $dest_height);
    imageCopyResized($dst_img, $src_img, 0, 0, 0, 0,
    $dest_width, $dest_height, $src_width, $src_height);
    }
    imagedestroy($src_img);
    if (eregi('\.jpg$|\.jpeg$', $img_file) == TRUE
    && (imageTypes() & IMG_JPG) == TRUE)
    {
    imageJpeg($dst_img, $cnvrtd_img, $cnvrt_thmb['qual']);
    } elseif (eregi('\.png$', $img_file) == TRUE
    && (imageTypes() & IMG_PNG) == TRUE)
    {
    imagePng($dst_img, $cnvrtd_img);
    } elseif (eregi('\.gif$', $img_file) == TRUE
    && (imageTypes() & IMG_GIF) == TRUE)
    {
    imageGif($dst_img, $cnvrtd_img);
    }
    imagedestroy($dst_img);
    fixPerms($cnvrtd_img);
    $using = $cnvrt_mesgs['using GD'].$gd_version;
    }
    if ($cnvrt_thmb['mesg_on'] == TRUE && is_file($cnvrtd_img)) {
    $str .= " <small>\n"
    .' '.$cnvrt_mesgs['Generated']
    .$cnvrt_mesgs['thumb'].$cnvrt_mesgs['image for']
    .$img_file.$using.".\n"
    ." </small>\n <br />\n";
    }
    }
    }
    if (isset($str)) { return $str; }
    } // End createThumbs()

    /**
    * Figure out how big a thumb will be, based on input image
    */
    function predictThumbSize($orig_img)
    {
    global $cnvrt_thmb;
    $img_size = GetImageSize($orig_img);
    $width = $img_size[0];
    $height = $img_size[1];
    $th_maxdim = $height;
    $cnvt_percent = round(($cnvrt_thmb['size'] / $th_maxdim) * 100, 2);
    $dest_width = round($width * ($cnvt_percent / 100));
    $dest_height = round($height * ($cnvt_percent / 100));
    $attr = sprintf("height=\"%s\" width=\"%s\"", $dest_height, $dest_width);
    return array($dest_width, $dest_height, $img_size[2], $attr);
    } // End predictThumbSize()

    /**
    * Generate images of alternate sizes.
    */
    function resizeImage($cnvrt_arry)
    {
    global $platform, $imgs, $cnvrt_path, $reqd_image, $convert_writable,
    $convert_magick, $convert_GD, $convert_cmd, $cnvrt_alt, $cnvrt_mesgs,
    $compat_quote, $exif;
    if (empty($imgs) || $convert_writable == FALSE) { return; }
    if ($convert_GD == TRUE && ! ($gd_version = gdVersion())) {return; }
    if ($convert_magick == TRUE) {
    $strip_prof = ($cnvrt_alt['no_prof'] == TRUE) ? ' +profile "*"' : '';
    $winquote = ($platform == 'Win32' && $compat_quote == TRUE) ? '"' : '';
    }
    if ($cnvrt_alt['mesg_on'] == TRUE) { $str = ''; }
    if (@$cnvrt_alt['aspect'] < 0.59 || @$cnvrt_alt['aspect'] > 0.81) {
    $cnvrt_alt['aspect'] = 0.75; }
    foreach ($imgs as $img_file) {
    if ($cnvrt_alt['indiv'] == TRUE && $img_file != $reqd_image['file']) { continue; }
    $orig_img = $reqd_image['pwd'].'/'.$img_file;
    $cnvrtd_img = $cnvrt_path.'/'.$cnvrt_arry['prefix'].$img_file;
    if (! is_file($cnvrtd_img)) {
    $img_size = GetImageSize($orig_img);
    $height = $img_size[1];
    $width = $img_size[0];
    $area = $height * $width;
    $maxarea = $cnvrt_arry['maxwid'] * $cnvrt_arry['maxwid'] * 0.9;
    $maxheight = ($cnvrt_arry['maxwid'] * $cnvrt_alt['aspect'] + 1);
    if (($width - 0.2) / $height > 1 / $cnvrt_alt['aspect']) { // TODO was +1.2
    $factor = 1;
    if ($cnvrt_alt['limit_width']) $cnvrt_alt['by_height'] = FALSE;
    } else { $factor = 0.9375; }
    if ($area > $maxarea
    || $width > $cnvrt_arry['maxwid']
    || $height > $maxheight)
    {
    if (($width / $cnvrt_arry['maxwid']) >= ($height / $maxheight)) {
    $dim = 'W'; }
    if (($height / $maxheight) >= ($width / $cnvrt_arry['maxwid'])
    || $cnvrt_alt['by_height'] == TRUE)
    {
    $dim = 'H'; }
    if ($dim == 'W') {
    $cnvt_percent =
    round((($factor * $cnvrt_arry['maxwid']) / $width) * 100, 2);
    }
    if ($dim == 'H') {
    $cnvt_percent =
    round((($cnvrt_alt['aspect'] * $cnvrt_arry['maxwid']) / $height) * 100, 2);
    }
    // convert it
    if ($convert_magick == TRUE) {
    // Image Magick image conversion
    exec($winquote.$convert_cmd
    .' -geometry '.$cnvt_percent.'%'
    .' -quality '.$cnvrt_arry['qual']
    .' -sharpen '.$cnvrt_arry['sharpen'].$strip_prof
    .' "'.$orig_img.'"'.' "'.$cnvrtd_img.'"'.$winquote);
    fixPerms($cnvrtd_img);
    $using = $cnvrt_mesgs['using IM'];
    } elseif ($convert_GD == TRUE) {
    // GD image conversion
    if (eregi('\.jpg$|\.jpeg$', $img_file) == TRUE
    && (imageTypes() & IMG_JPG) == TRUE)
    {
    $src_img = imageCreateFromJpeg($orig_img);
    } elseif (eregi('\.png$', $img_file) == TRUE
    && (imageTypes() & IMG_PNG) == TRUE)
    {
    $src_img = imageCreateFromPng($orig_img);
    } elseif (eregi('\.gif$', $img_file) == TRUE
    && (imageTypes() & IMG_GIF) == TRUE)
    {
    $src_img = imageCreateFromGif($orig_img);
    } else {
    continue;
    }
    $src_width = imageSx($src_img);
    $src_height = imageSy($src_img);
    $dest_width = $src_width * ($cnvt_percent / 100);
    $dest_height = $src_height * ($cnvt_percent / 100);
    if ($gd_version >= 2) {
    $dst_img = imageCreateTruecolor($dest_width, $dest_height);
    imageCopyResampled($dst_img, $src_img, 0, 0, 0, 0,
    $dest_width, $dest_height, $src_width, $src_height);
    } else {
    $dst_img = imageCreate($dest_width, $dest_height);
    imageCopyResized($dst_img, $src_img, 0, 0, 0, 0,
    $dest_width, $dest_height, $src_width, $src_height);
    }
    imageDestroy($src_img);
    if (eregi('\.jpg$|\.jpeg$', $img_file) == TRUE
    && (imageTypes() & IMG_JPG) == TRUE)
    {
    imageJpeg($dst_img, $cnvrtd_img, $cnvrt_arry['qual']);
    } elseif (eregi('\.png$', $img_file) == TRUE
    && (imageTypes() & IMG_PNG) == TRUE)
    {
    imagePng($dst_img, $cnvrtd_img);
    } elseif (eregi('\.gif$', $img_file) == TRUE
    && (imageTypes() & IMG_GIF) == TRUE)
    {
    imageGif($dst_img, $cnvrtd_img);
    }
    imageDestroy($dst_img);
    fixPerms($cnvrtd_img);
    $using = $cnvrt_mesgs['using GD'].$gd_version;
    }
    if ($cnvrt_alt['mesg_on'] == TRUE
    && is_file($cnvrtd_img))
    {
    $str .= " <small>\n"
    .' '.$cnvrt_mesgs['Generated'].$cnvrt_arry['txt'].$cnvrt_mesgs['converted']
    .$cnvrt_mesgs['image for'].$img_file.$using.".\n"
    ." </small>\n <br />\n";
    }
    }
    }
    }
    if (isset($str)) { return $str; }
    } //End resizeImage()

    /**
    * Produce the HTML header for a stand-alone gallery.
    *
    * Only produce a header if this is a stand-alone gallery.
    */
    function htmlHeader($header)
    {
    global $is_included, $imgs, $qdig_url, $request_uri, $anchor,
    $extra_param, $subdirs, $reqd_image, $is_readable_disa, $dir_nav,
    $cnvrt_size, $cnvrt_path;
    if ($header['force_disa'] == TRUE) { return ''; }
    $str = '';
    if ($header['force_ena'] == TRUE || $is_included == FALSE) {
    if (!empty($header['title_text_1'])) {
    $title = $header['title_text_1'];
    }
    $title_loc = basename($reqd_image['pwd']);
    if ($title_loc != '.') { // TODO: s/b $rootdir?
    if ($dir_nav['strip_num'] && preg_match('!^[[:digit:]]+_!', $title_loc)) {
    $title_loc = preg_replace('!^[[:digit:]]*_!', '', $title_loc); }
    $title .= " {$header['title_delim']} $title_loc";
    } elseif (isset($subdirs)) {
    $title .= " {$header['title_delim']} {$dir_nav['main_txt']}";
    }
    if ($header['title_cntr'] == TRUE
    && isset($reqd_image['num'])
    && $title_cntr = imageCounter($reqd_image['num']))
    {
    $title .= " {$header['title_delim']} $title_cntr";
    }
    if (!empty($header['title_text_2'])) {
    $title .= " {$header['title_delim']} {$header['title_text_2']}";
    }
    if ($header['img_name'] == TRUE && isset($reqd_image['file'])) {
    $img_name = $reqd_image['file'];
    if ($header['strip_ext'] == TRUE) {
    $ext = strrchr($reqd_image['file'], '.');
    $img_name = substr($reqd_image['file'], 0, -strlen($ext));
    }
    $title .= " {$header['title_delim']} $img_name";
    }
    $meta_cache = ($header['meta_cache'] == TRUE)
    ? '<meta http-equiv="Cache-Control" content="max-age='
    .$header['cache_sec']."\" />\n "
    .'<meta http-equiv="Expires" content="'
    .gmdate("D, d M Y H:i:s", time() + $header['cache_sec'])
    ." GMT"."\" />\n "
    : '';
    if (!empty($header['css_bg_img_url'])) {
    $bg_image = 'body { background-image:url("'.$header['css_bg_img_url']
    .'"); background-attachment:fixed; }'."\n ";
    } elseif ($header['css_bg_logo'] == TRUE) { // TODO hide from old browsers?
    $icon = (empty($header['css_logo_url']))
    ? "$qdig_url?Qimg=cam-icon"
    : $header['css_logo_url'];
    $bg_image = "body { background-image:url(\"$icon\");"
    ."background-position:{$header['css_logo_pos']};\n"
    ." background-repeat:no-repeat; background-attachment:fixed; }\n ";
    } else {
    $bg_image = '';
    }
    $ie_imgtoolbar = ($header['ie_imgbar_off'] == TRUE)
    ? '<meta http-equiv="imagetoolbar" content="no" />'."\n "
    : '';
    $keywords = (empty($header['keywords']))
    ? 'qdig,image gallery,photo album,online gallery,web photo album,'
    .'digital image gallery,web gallery,photos,images,album,'
    .'gallery,digital images,digital camera,digital photos,'
    .'digicam photos,digital camera photos,presentation'
    : $header['keywords'];
    $num_imgs = count($imgs);
    if ($header['preload_next'] == TRUE
    && !empty($imgs) && $reqd_image['num'] + 1 != $num_imgs)
    {
    foreach ($cnvrt_size as $size_info) {
    if ($reqd_image['size'] == $size_info['label']) {
    $next_num = $reqd_image['num'] + 1;
    $next_file = $imgs[$next_num];
    $next_path = $cnvrt_path.'/'.$size_info['prefix'].$imgs[$next_num];
    if (! is_file($next_path)
    || ! ($is_readable_disa == TRUE || is_readable($next_path)))
    {
    $next_url = $reqd_image['pwd_url'].'/'.$imgs[$next_num];
    } else {
    $next_url = urlPath($next_path);
    }
    }
    }
    $preload = ' <script type="text/javascript"> <!--'
    ."\n function preloadNext(){\n img = new Image();\n "
    ."img.src = \"$next_url\"\n }"
    ." // -->\n </script>\n";
    $onload = " onload='preloadNext()'";
    } else {
    $preload='';
    $onload='';
    }
    $zap_frames = ($header['zap_frames'] == TRUE)
    ? ' <script type="text/javascript"> <!--'
    ."\n if (top.frames.length > 1) { top.location=\"$request_uri\"; }\n"
    ." // -->\n </script>\n"
    : '';
    $str = <<<EOT
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html lang="{$header['lang_code']}">
    <head>
    $meta_cache<meta http-equiv="Content-Type" content="text/html; charset={$header['charset']}" />
    <meta http-equiv="Content-Language" content="{$header['lang_code']}" />
    <meta http-equiv="Content-Style-Type" content="text/css" />
    $ie_imgtoolbar<meta name="description" content="An online image gallery" />
    <meta name="keywords" content="$keywords" />
    <meta name="robots" content="index,follow" />
    <meta name="MSSmartTagsPreventParsing" content="true" />\n
    EOT;
    if ($header['nav_links'] == TRUE) {
    if ($reqd_image['pwd'] != '.') { // TODO: s/b $rootdir?
    $str .= ' <link rel="top" href="'.$qdig_url.'?'.$extra_param
    .'Qwd=.&amp;Qiv='.$reqd_image['view'].'&amp;Qis='
    .$reqd_image['size'].$anchor.'" />'."\n";
    $up_one = urlPath(dirname($reqd_image['pwd']));
    $str .= ' <link rel="up" href="'.$qdig_url.'?'.$extra_param
    .'Qwd='.$up_one.'&amp;Qiv='.$reqd_image['view'].'&amp;Qis='
    .$reqd_image['size'].$anchor.'" />'."\n";
    }
    if (!empty($imgs) && $reqd_image['num'] != 0) {
    $first_img = rawurlencode($imgs[0]);
    $str .= ' <link rel="first" href="'.$qdig_url.'?'.$extra_param
    .'Qwd='.$reqd_image['pwd'].'&amp;Qif='.$first_img.'&amp;Qiv='
    .$reqd_image['view'].'&amp;Qis='.$reqd_image['size'].$anchor
    .'" />'."\n";
    $prev_img = rawurlencode($imgs[$reqd_image['num'] - 1]);
    $str .= ' <link rel="prev" href="'.$qdig_url.'?'.$extra_param
    .'Qwd='.$reqd_image['pwd'].'&amp;Qif='.$prev_img.'&amp;Qiv='
    .$reqd_image['view'].'&amp;Qis='.$reqd_image['size'].$anchor
    .'" />'."\n";
    }
    $num_imgs = count($imgs);
    if (!empty($imgs) && $reqd_image['num'] + 1 != $num_imgs) {
    $next_img = rawurlencode($imgs[$reqd_image['num'] + 1]);
    $str .= ' <link rel="next" href="'.$qdig_url.'?'.$extra_param
    .'Qwd='.$reqd_image['pwd'].'&amp;Qif='.$next_img.'&amp;Qiv='
    .$reqd_image['view'].'&amp;Qis='.$reqd_image['size'].$anchor
    .'" />'."\n";
    $last_img = rawurlencode($imgs[$num_imgs - 1]);
    $str .= ' <link rel="last" href="'.$qdig_url.'?'.$extra_param
    .'Qwd='.$reqd_image['pwd'].'&amp;Qif='.$last_img.'&amp;Qiv='
    .$reqd_image['view'].'&amp;Qis='.$reqd_image['size'].$anchor
    .'" />'."\n";
    }
    }
    if ($header['css_thm_opacity'] > 0
    && $header['css_thm_opacity'] < 100)
    {
    $alpha = $header['css_thm_opacity'];
    $opacity = $alpha / 100;
    if ($header['css_opacity_moz'] == TRUE) {
    $moz_opacity = " -moz-opacity:$opacity;";
    $moz_opacity_cur = ' -moz-opacity:100;';
    } else {
    $moz_opacity = '';
    $moz_opacity_cur = '';
    }
    $thm_opacity = "
    filter:alpha(opacity=$alpha);$moz_opacity opacity:$opacity;";
    $thm_opacity_curr = "
    filter:alpha(opacity=100);$moz_opacity_cur opacity:1.0;";
    } else {
    $thm_opacity = '';
    $thm_opacity_curr = '';
    }
    if ($header['icon'] == TRUE) {
    $str .= <<<EOT
    <link rel="icon" href="$qdig_url?Qimg=cam-icon&amp;ext=.png" type="image/png" />
    <link rel="shortcut icon" href="$qdig_url?Qimg=cam-icon&amp;ext=.png" type="image/png" />\n
    EOT;
    }
    $str .= <<<EOT
    <title>$title</title>
    <style type="text/css"> <!--
    /* Bare-bones CSS style properties for a stand-alone Qdig gallery */
    body { font-family:Arial, Helvetica, Geneva, sans-serif;
    background-color:{$header['css_bgcolor']}; margin:1px; }
    {$bg_image}body, td { font-size:14px; color:{$header['css_text_color']}; }
    small { font-size:0.85em; }
    a { font-weight:bold; color: {$header['css_link_color']};
    text-decoration: none; }
    a:visited { font-weight:bold; color:{$header['css_visit_color']};
    text-decoration:none; }
    a:hover { text-decoration:underline; }
    img { border:0px; }
    img.qdig-image { background-color:{$header['css_img_bg']};
    border:{$header['css_img_brdr_w']} solid {$header['css_img_border']}; }
    img.qdig-thumb { background-color:{$header['css_img_bg']};
    border:{$header['css_thm_brdr_w']} solid {$header['css_thm_border']};$thm_opacity }
    img#qdig-thumb-current { border-color:{$header['css_thm_hilite']};
    border-left:{$header['css_thm_hl_w']} solid {$header['css_thm_hilite']};
    border-right:{$header['css_thm_hl_w']} solid {$header['css_thm_hilite']};$thm_opacity_curr }
    img.qdig-all-thumb { background-color:{$header['css_img_bg']};
    border:{$header['css_thm_brdr_w']} solid {$header['css_thm_border']}; }
    table#qdig-dirnav { } .qdig-navpath { } a.qdig-navpath { } a.qdig-subdirlink { }
    .qdig-caption, .qdig-imageinfo
    { font-family:Verdana, Arial, Helvetica, sans-serif; font-size:10pt; }
    .qdig-grayout { } #qdig-admin { } .navrow { } table#qdig-uppernav { }
    table#qdig-lowernav { } {$header['css_user_def']} // -->
    </style>
    $zap_frames$preload</head>
    <body$onload>
    <div style="padding-top:0px;">\n
    EOT;
    }
    return $str;
    } // End htmlHeader()

    /**
    * Produce the HTML footer for a stand-alone gallery.
    *
    * Only produce a footer if this script is running stand-alone.
    */
    function htmlFooter($header)
    {
    global $is_included;
    if ($header['force_disa'] == TRUE) { return "\n"; }
    $str = "\n";
    if ($header['force_ena'] == TRUE || $is_included == FALSE) {
    $str = "</div>\n</body>\n</html>";
    }
    return $str;
    } // End htmlFooter()

    /**
    * Generate some gallery size information.
    */
    function gallerySize() {
    global $extra_size, $imgs, $reqd_img_size_tmp, $valid_sizes,
    $reqd_image, $cnvrt_size, $default_nav_width, $thmb_row, $dir_nav,
    $cnvrt_alt;
    if ($extra_size['pct'] < 0 || $extra_size['pct'] > 10) {
    $extra_size['pct'] = 0; }
    $width_margin = 1 + (($extra_size['pct'] * 2) / 100);
    if ($reqd_img_size_tmp == TRUE && in_array($reqd_img_size_tmp, $valid_sizes)) {
    $reqd_size = $reqd_img_size_tmp;
    } else {
    $reqd_size = $reqd_image['size'];
    }
    foreach ($cnvrt_size as $size_array) {
    if ($size_array['label'] == $reqd_size && !empty($size_array['maxwid'])) {
    $width = round($size_array['maxwid'] * $width_margin) + 2;
    }
    }
    if (@$cnvrt_alt['aspect'] < 0.59 || @$cnvrt_alt['aspect'] > 0.81) {
    $cnvrt_alt['aspect'] = 0.75; }
    if (empty($width)) {
    if (empty($imgs)) {
    $width = round($default_nav_width * .95);
    } else {
    $height =
    round((($default_nav_width * .95) -2) * $cnvrt_alt['aspect'] + 2) + $extra_size['height'];
    return array('size_attr' => '', 'height' => $height);
    }
    }
    $height = round(($width -2) * $cnvrt_alt['aspect'] + 2) + $extra_size['height']; // For dir-only
    $width += $extra_size['width'];
    // Thumbs row might be wider.
    $thumbwidth =
    round($thmb_row['maxwidth'] * (1 + ($width_margin / 100))) + $extra_size['width'];
    if ($reqd_image['view'] == 'thumbs' && $width < $thumbwidth) {
    $width = $thumbwidth; }
    if (!empty($imgs)) {
    return array('size_attr' => "width=\"$width\"", 'height' => $height); }
    if ($dir_nav['size_of_image'] == TRUE) {
    return array('size_attr' => "width=\"$width\"", 'height' => $height); }
    return array('size_attr' => '', 'height' => $height);
    } // End gallerySize()

    /**
    * Display the current gallery directory with links to higher-level directories.
    */
    function dirnavPath($dir_nav, $thm_dir_view = FALSE)
    {
    global $get_vars, $imgs, $subdirs, $qdig_url, $extra_param, $anchor,
    $reqd_image, $img_link, $dir_nav, $rootdir, $thmb_row, $cnvrt_thmb;
    $i = 0;
    $num_imgs = count($imgs);
    $split_path = explode('/', urlPath($reqd_image['pwd']));
    $path_pos = count($split_path);
    $split_root = explode('/', urlPath($rootdir));
    $root_pos = count($split_root);
    $path = $rootdir;
    $str = '';
    $path_delim = $dir_nav['path_delim'];
    foreach ($split_path as $dir) {
    $i++;
    if ($i < $root_pos && $thm_dir_view == FALSE) { continue; }
    if ($dir == $split_path[$root_pos - 1] && $reqd_image['pwd'] == $rootdir) {
    if ($thm_dir_view == TRUE) {
    if ($rootdir != '.') {
    $dir_nav['main_txt'] = rawurldecode($dir); // Test.
    }
    if ($thm_dir_view == 'thumbs') {
    $str = '<b>'.$dir_nav['main_txt'].'</b>'."\n";
    } else {
    $str = <<<EOT
    <a href="$qdig_url?{$extra_param}Qwd=.&amp;Qiv={$reqd_image['view']}&amp;Qis={$reqd_image['size']}$anchor"
    class="qdig-navpath" title="{$dir_nav['go_to_txt']} {$dir_nav['main_txt']} - {$dir_nav['thumbs']}">{$dir_nav['main_txt']}</a>\n
    EOT;
    }
    } elseif (empty($imgs) && !empty($dir_nav['choose_main_txt'])) {
    $str = '<span title="'.$dir_nav['choose_main_title_txt'].'">'
    .$dir_nav['choose_main_txt'].'</span><br />'."\n";
    } elseif (empty($imgs)) {
    $str = "\n";
    } else {
    $str = '<b>'.$dir_nav['main_txt'].'</b>'."\n";
    }
    if ($dir_nav['fname_ena'] == TRUE && !empty($reqd_image['file'])) {
    $str .= ' '.$dir_nav['path_delim'].' '.$reqd_image['file']; }
    if ($dir_nav['cntr_ena'] == TRUE && $num_imgs > 1) {
    $str .= '&nbsp; <span style="white-space:nowrap;">(';
    if (! $dir_nav['fname_ena'] == TRUE) {
    $str .= $dir_nav['image_txt']; }
    $str .= imageCounter($reqd_image['num']).")</span> \n";
    }
    continue;
    } elseif ($dir == $split_path[$root_pos - 1]) {
    $str .= <<<EOT
    <a href="$qdig_url?{$extra_param}Qwd=.&amp;Qiv={$reqd_image['view']}&amp;Qis={$reqd_image['size']}$anchor"
    class="qdig-navpath" title="{$dir_nav['go_to_txt']} {$dir_nav['main_txt']}">{$dir_nav['main_txt']}</a>\n
    EOT;
    continue;
    }
    $path = $path.'/'.$dir;
    $dirlabel = rawurldecode($dir);
    if ($dir_nav['strip_num'] && preg_match('!^[[:digit:]]+_!', $dirlabel)) {
    $dirlabel = preg_replace('!^[[:digit:]]*_!', '', $dirlabel); }
    if (! @$get_vars['Qtmp'] == 'thumbs'
    && @$img_link['dir_thumbonly'] == TRUE) // TODO Test.
    {
    $link_pwd = 1;
    }
    if ($i < $path_pos + @$link_pwd) {
    $str .= <<<EOT
    {$dir_nav['path_delim']} <a href="$qdig_url?{$extra_param}Qwd=$path&amp;Qiv={$reqd_image['view']}&amp;Qis={$reqd_image['size']}$anchor"
    class="qdig-navpath" title="{$dir_nav['go_to_txt']} $dirlabel">$dirlabel</a>
    EOT;
    if ($dir_nav['cntr_ena'] == TRUE && $num_imgs > 1
    && $i == $path_pos)
    {
    $str .= '&nbsp; <span style="white-space:nowrap;">(';
    if (! $dir_nav['fname_ena'] == TRUE) {
    $str .= $dir_nav['image_txt']; }
    $str .= imageCounter($reqd_image['num']).")</span> \n";
    }
    } else {
    $str .= <<<EOT
    {$dir_nav['path_delim']} <span class="qdig-navpath" title="{$dir_nav['current_txt']} $dirlabel"><b>$dirlabel</b></span>
    EOT;
    if ($dir_nav['fname_ena'] == TRUE && $num_imgs > 0) {
    $str .= ' '.$dir_nav['path_delim'].' '.$reqd_image['file']; }
    if ($dir_nav['cntr_ena'] == TRUE && $num_imgs > 1) {
    $str .= '&nbsp; <span style="white-space:nowrap;">(';
    if (! $dir_nav['fname_ena'] == TRUE) {
    $str .= $dir_nav['image_txt']; }
    $str .= imageCounter($reqd_image['num']).")</span> \n";
    }
    if (empty($imgs) && !empty($subdirs)) {
    $str .= (!empty($dir_nav['choose_sub_txt']))
    ? '<br /><span title="'.$dir_nav['choose_sub_title_txt']
    .'">'.$dir_nav['choose_sub_txt']. "</span><br />\n"
    : "<br />\n";
    } elseif (empty($imgs)) {
    $str .= '<br /><br /><span title="'.$dir_nav['empty_dir_title_txt']
    .'">'.$dir_nav['empty_dir_txt']."</span>\n";
    }
    }
    }
    return $str;
    } // End dirnavPath()

    /**
    * Produce navigation links to subdirectory galleries.
    */
    function subdirLinks($dir_nav)
    {
    global $imgs, $qdig_url, $extra_param, $anchor, $reqd_image, $subdirs,
    $thumbs, $rootdir;
    if (isset($imgs)) {
    $icon = ($dir_nav['icon'] == TRUE)
    ? '<img src="'.$qdig_url
    .'?Qimg=cam-icon" alt="camera icon" />&nbsp;'
    : '';
    $tag1 = '&nbsp;'; $bkt1 = '<b>[</b>'; $bkt2 = '<b>]</b>'; $tag2 = '';
    } else {
    $tag1 = '<br />'; $bkt1 = ''; $bkt2 = ''; $tag2 = '<br />'; $icon = '';
    }
    $str = '';
    if (isset($subdirs)) {
    if ($dir_nav['sort_age'] == TRUE) {
    ($dir_nav['sort_rev'] == TRUE) ? arsort($subdirs) : asort($subdirs); }
    foreach ($subdirs as $dir => $age_idx) {
    if ($thumbs['thm_only'] == FALSE || $dir_nav['start_thm'] == TRUE) {
    $qif = '';
    } else {
    $dir_imgs = getImageFilenames("{$reqd_image['pwd']}/$dir");
    $qif = '&amp;Qif='.rawurlencode($dir_imgs[0]);
    }
    $dirurl = rawurlencode($dir);
    $dirtxt = str_replace(' ', '&nbsp;', $dir);
    $dirtxt = str_replace("'", '&#39;', $dirtxt);
    if ($dir_nav['strip_num'] && preg_match('!^[[:digit:]]+_!', $dirtxt)) {
    $dirtxt = preg_replace('!^[[:digit:]]*_!', '', $dirtxt); }
    $newdir = ($age_idx < ($dir_nav['dir_is_new'] * 1000))
    ? $dir_nav['new_flag']
    : '';
    $str .= <<<EOT
    <span style='white-space:nowrap;'>$tag1$bkt1
    <a href="$qdig_url?{$extra_param}Qwd={$reqd_image['pwd_url']}/$dirurl{$qif}&amp;Qiv={$reqd_image['view']}&amp;Qis={$reqd_image['size']}$anchor"
    class="qdig-subdirlink" title="{$dir_nav['go_to_txt']} $dir">$icon$dirtxt$newdir</a>
    $bkt2</span>\n
    EOT;
    }
    }
    if ($reqd_image['pwd'] != $rootdir && $dir_nav['updir_ena'] == TRUE) {
    $up_one = urlPath(dirname($reqd_image['pwd']));
    $str .= <<<EOT
    <span style='white-space:nowrap;'>$tag2$tag1$bkt1
    <a href="$qdig_url?{$extra_param}Qwd=$up_one&amp;Qiv={$reqd_image['view']}&amp;Qis={$reqd_image['size']}$anchor"
    class="qdig-subdirlink" title="{$dir_nav['up_title_txt']}"> {$dir_nav['up_level_txt']}</a>
    $bkt2</span>\n
    EOT;
    }
    return $str;
    } // End subdirLinks()

    /**
    * Build a list of Text Name or Text Numeral Links to the images.
    */
    function imageTextLinks($nmrl_row)
    {
    global $imgs, $qdig_url, $extra_param, $anchor, $reqd_image, $namelinks_ena,
    $namelinks, $nav_lnk;
    if (count($imgs) > 1) {
    if (!empty($nmrl_row)
    && ($nmrl_row['softwrap'] > 99 || $nmrl_row['softwrap'] < 76))
    {
    $nmrl_row['softwrap'] = 100; }
    if ($namelinks_ena == FALSE) {
    $str = " <!-- text navigation links -->\n";
    $str .= ' <div align="center" style="padding-top:'.$nmrl_row['pad_top'].'; white-space:nowrap;">'."\n";
    // prepare wrap data
    $number_of_imgs = count($imgs);
    $number_of_rows = $number_of_imgs / $nmrl_row['maxcount']; # 7.2
    $long_rows = floor($number_of_rows); # 7
    $extra = $number_of_rows - $long_rows;
    if ($extra && $extra < 1 - ($nmrl_row['softwrap'] / 120)) {
    $trimmed_row_length = floor($nmrl_row['maxcount'] * ($nmrl_row['softwrap'] / 100));
    } else {
    $trimmed_row_length = $nmrl_row['maxcount'];
    }
    $i = 1;
    $j = 1;
    if ($extra) $k = $long_rows;
    while ($i <= $number_of_imgs) {
    if (($k == $long_rows && $j == $trimmed_row_length)
    || ($j == $nmrl_row['maxcount'] && $long_rows > 1))
    {
    $long_rows --;
    $j = 0;
    $wrap[$i] = TRUE;
    }
    if ($long_rows <= 1 && $j == $trimmed_row_length) {
    $wrap[$i] = TRUE; }
    $i++;
    $j++;
    } // end prepare wrap data */
    if ($nmrl_row['small'] == TRUE) {
    $tag_bfr_num_lnk = '<small>';
    $tag_aft_num_lnk = '</small>';
    } else {
    $tag_bfr_num_lnk = '';
    $tag_aft_num_lnk = '';
    }
    } else {
    // TODO: Use CSS?
    $str = '';
    if ($namelinks['small'] == TRUE) {
    $tag_bfr_name_lnk = '<small>';
    $tag_aft_name_lnk = '</small>';
    } else {
    $tag_bfr_name_lnk = '';
    $tag_aft_name_lnk = '';
    }
    }
    $imgs_flipped = array_flip($imgs);
    foreach ($imgs_flipped as $img_num) {
    if (isset($wrap)
    && @$wrap[$img_num] == TRUE
    && $namelinks_ena == FALSE)
    {
    $str .= " </div><!-- wrap numerals row -->\n";
    $str .= " <div align=\"center\" style=\"padding-top:{$nmrl_row['pad_top']}; white-space:nowrap;\">\n";
    }
    // pad single- and double-numeral links
    $pad = ($img_num < 10) ? '&nbsp;' : '';
    if ($img_num < 100) { $pad .= '&nbsp;'; }
    $num = $img_num + 1;
    $img = $imgs[$img_num];
    $imgurl = rawurlencode($img);
    $str .= <<<EOT
    <a href="$qdig_url?{$extra_param}Qwd={$reqd_image['pwd_url']}&amp;Qif=$imgurl&amp;Qiv={$reqd_image['view']}&amp;Qis={$reqd_image['size']}$anchor"
    title="{$nav_lnk['Image']} $num - $img">
    EOT;
    if ($namelinks_ena == TRUE) {
    // Strip extension from filename
    $ext = strrchr($img, '.');
    $img = substr($img, 0, -strlen($ext));
    // Truncate long names
    $img_lnk_txt = (strlen($img) > $namelinks['trunc'])
    ? substr($img, 0, $namelinks['trunc'] - 2).'...'
    : $img;
    $str .= <<<EOT
    $tag_bfr_name_lnk&nbsp;$img_lnk_txt&nbsp;$tag_aft_name_lnk</a><br />\n
    EOT;
    } else {
    $num = $img_num + 1;
    $str .= <<<EOT
    $tag_bfr_num_lnk$pad$num$pad$tag_aft_num_lnk</a>&nbsp;\n
    EOT;
    }
    }
    if ($namelinks_ena == FALSE) { $str .= " </div>\n"; }
    return $str;
    }
    } //End imageTextLinks()

    /**
    * Build a list of Thumbnail Image Links to the images in the current directory.
    */
    function imageThumbsLinks($thmb_row)
    {
    global $get_vars, $pwd, $imgs, $qdig_url, $extra_param, $anchor,
    $reqd_image, $cnvrt_path, $cnvrt_thmb, $nav_lnk, $thumbs_msg,
    $thumbs, $file_exists_disa, $cnvrt_mesgs, $url_base_path,
    $extra_paranoia, $safe_mode, $header, $is_included;
    // set a default maxwidth (if necessary)
    if (empty($thmb_row['maxwidth'])) { $thmb_row['maxwidth'] = 560; }
    // set a default softwrap (if necessary)
    if (empty($thmb_row['softwrap'])
    || $thmb_row['softwrap'] < 80
    || $thmb_row['softwrap'] > 99)
    {
    $thmb_row['softwrap'] = 85;
    }
    $num_imgs = count($imgs);
    if (isset($imgs) && $num_imgs > 1) {
    $str = " <!-- thumbnail-image links -->\n";
    $str .= " <div align=\"center\" style=\"margin:2px 2px 0px 0px; white-space:nowrap\">\n";
    // prepare wrap data
    $thumbs_width
    = floor((1 - ($thmb_row['softwrap'] / 100)) * $thmb_row['maxwidth']);
    $thumbs_wrap
    = 0 - floor((1 - ($thmb_row['softwrap'] / 100)) * $thmb_row['maxwidth']) * 0.75;
    $thumbs_wide = 0;
    $width_so_far = 0;
    $num = 0;
    $wrapped = FALSE;
    if (@$get_vars['Qtmp'] == 'thumbs') {
    $thumbs['vicinity'] = FALSE;
    $thumb_class = 'qdig-all-thumb';
    } else {
    $thumb_class = 'qdig-thumb';
    }
    if ($thumbs['vicinity'] == TRUE) {
    $wid_px = $thmb_row['maxwidth'] * ($thmb_row['softwrap'] / 100);
    $target_wid = $wid_px;
    $wid_num = ($wid_px / $cnvrt_thmb['size']) / 2 * 0.6;
    }
    foreach ($imgs as $image) {
    $num++;
    if ($thumbs['vicinity']== TRUE
    && ($num < ($reqd_image['num'] - @$wid_num + 0.45 - $thumbs['shift_by'])))
    {
    continue;
    }
    if ($thumbs['vicinity'] == TRUE && $wid_px < 0) { continue; }
    $thmbs[$image]['num'] = $num;
    $thmbs[$image]['image'] = $image;
    $thmb_file = $cnvrt_path.'/'.$cnvrt_thmb['prefix'].$image;
    $thmbs[$image]['thumb'] = $thmb_file;
    $thmb = $cnvrt_thmb['prefix'].rawurlencode($image);
    $thmbs[$image]['cnvurl'] = $url_base_path.urlPath($cnvrt_path)."/$thmb";
    $imgurl = rawurlencode($image);
    $thmbs[$image]['imgurl'] = $imgurl;
    if (($file_exists_disa == TRUE && is_file($thmb_file))
    || file_exists($thmb_file))
    {
    $exists = TRUE;
    $thmbs[$image]['exists'] = TRUE;
    } else {
    $exists = FALSE;
    $thmbs[$image]['exists'] = FALSE;
    }
    # RAR... get either the size of the real thumb, or the size it will be
    if ($exists == TRUE) {
    if ($safe_mode == TRUE) { // TODO: Test in safe mode.
    $img_size = predictThumbSize($pwd.'/'.$image);
    } elseif (filesize($thmb_file) == 0 && $extra_paranoia == FALSE) {
    unlink($thmb_file);
    predictThumbSize($pwd.'/'.$image);
    } elseif (! $img_size = GetImageSize($thmb_file)) {
    predictThumbSize($pwd.'/'.$image);
    }
    } elseif ($thumbs['onfly'] == TRUE) {
    # This thumb doesn't exist yet. Pass a separate request for it.
    $img_size = predictThumbSize($pwd.'/'.$image);
    $thmbs[$image]['cnvurl'] = <<<EOT
    $qdig_url?{$extra_param}Qwd={$reqd_image['pwd_url']}&amp;Qif=$imgurl&amp;Makethumb=Y
    EOT;
    # Add to the thumbs message to let the user know we're going to make on fly.
    if ($cnvrt_thmb['mesg_on'] == TRUE) {
    $thumbs_msg .= " <small>\n"
    .' '.$cnvrt_mesgs['Generating']
    .$cnvrt_mesgs['thumb'].$cnvrt_mesgs['image for']
    .$image.$cnvrt_mesgs['on-the-fly'].".\n"
    ." </small>\n <br />\n";
    }
    } else { $img_size = predictThumbSize($pwd.'/'.$image); }
    $thumb_width = $img_size[0] + ($header['css_thm_brdr_w'] * 2);
    $thumbs_width = $thumbs_width + $thumb_width;
    $thumbs_wrap = $thumbs_wrap + $thumb_width;
    if ($thumbs_width > $thmb_row['maxwidth']) {
    $thumbs_width = $thumbs_wrap;
    $wrapped = FALSE;
    $thumbs_wide++;
    }
    $thmbs[$image]['img_size'] = $img_size;
    if ($thumbs_wrap > ($thmb_row['maxwidth'] * ($thmb_row['softwrap'] / 100))
    && $wrapped == FALSE)
    {
    $thumbs_wrap = 0;
    $thmbs[$image]['wrap'] = TRUE;
    $wrap[] = TRUE;
    $wrapped = TRUE;
    } else {
    $thmbs[$image]['wrap'] = FALSE;
    $wrap[] = FALSE;
    }
    $width_so_far = $width_so_far + $img_size[0];
    $wid_px = @$wid_px - $img_size[0];
    }
    // Add lead-in images to end-of-list thumbs so the row won't shorten.
    if ($thumbs['vicinity'] == TRUE && $width_so_far < @$target_wid ) {
    $imgs_rev = array_reverse($imgs);
    $thmbs = array_reverse($thmbs);
    $num = 0;
    $wid_num = ($wid_px / $cnvrt_thmb['size']) / 2;
    foreach ($imgs_rev as $image) {
    $num++;
    if (isset($thmbs[$image])) { continue; }
    if ($thumbs['vicinity'] == TRUE && $wid_px < 0) { continue; }
    $thmbs[$image]['num'] = $num_imgs - $num + 1;
    $thmbs[$image]['image'] = $image;
    $thmb_file = $cnvrt_path.'/'.$cnvrt_thmb['prefix'].$image;
    $thmbs[$image]['thumb'] = $thmb_file;
    $thmb = $cnvrt_thmb['prefix'].rawurlencode($image);
    $thmbs[$image]['cnvurl'] = $url_base_path.urlPath($cnvrt_path)."/$thmb";
    $imgurl = rawurlencode($image);
    $thmbs[$image]['imgurl'] = $imgurl;
    if (($file_exists_disa == TRUE && is_file($thmb_file))
    || file_exists($thmb_file))
    {
    $exists = TRUE;
    $thmbs[$image]['exists'] = TRUE;
    } else {
    $exists = FALSE;
    $thmbs[$image]['exists'] = FALSE;
    }
    # RAR... get either the size of the real thumb, or the size it will be
    if ($exists == TRUE) {
    if ($safe_mode == TRUE) { // TODO: Test in safe mode.
    $img_size = predictThumbSize($pwd.'/'.$image);
    } elseif (filesize($thmb_file) == 0 && $extra_paranoia == FALSE) {
    unlink($thmb_file);
    predictThumbSize($pwd.'/'.$image);
    } elseif (! $img_size = GetImageSize($thmb_file)) {
    predictThumbSize($pwd.'/'.$image);
    }
    } elseif ($thumbs['onfly'] == TRUE) {
    # This thumb doesn't exist yet, the URL will be one to make the conversion.
    $img_size = predictThumbSize($pwd.'/'.$image);
    $thmbs[$image]['cnvurl'] = <<<EOT
    $qdig_url?{$extra_param}Qwd={$reqd_image['pwd_url']}&amp;Qif=$imgurl&amp;Makethumb=Y
    EOT;
    # Add to the thumbs message to let the user know we're going to make on fly.
    if ($cnvrt_thmb['mesg_on'] == TRUE) {
    $thumbs_msg .= " <small>\n"
    .' '.$cnvrt_mesgs['Generating']
    .$cnvrt_mesgs['thumb'].$cnvrt_mesgs['image for']
    .$image.$cnvrt_mesgs['on-the-fly'].".\n"
    ." </small>\n <br />\n";
    }
    } else { $img_size = predictThumbSize($pwd.'/'.$image); }
    $thmbs[$image]['img_size'] = $img_size;
    $wid_px = @$wid_px - $img_size[0];
    }
    $thmbs = array_reverse($thmbs); // Restore.
    } else {
    // Avoid stragglers in the last row.
    $soft_wrap = $thmb_row['maxwidth'] * ($thmb_row['softwrap'] / 100);
    $wrap_margin = $thmb_row['maxwidth'] - $soft_wrap;
    $thm = end($thmbs); // Last image
    if ($thumbs_wrap < $wrap_margin * 1.2
    || ($thumbs_wrap > $soft_wrap
    && $thm['img_size'][0] > ($thumbs_wrap - $soft_wrap)))
    {
    $accum = $soft_wrap / 4.5;
    $thumbs_wide++;
    foreach ($thmbs as $thm) {
    $img_name = $thm['image'];
    $accum += $thm['img_size'][0] + ($header['css_thm_brdr_w'] * 2);
    if ($accum > $soft_wrap) {
    $thmbs[$img_name]['wrap'] = TRUE;
    $accum = 0;
    } else {
    $thmbs[$img_name]['wrap'] = FALSE;
    }
    }
    }
    }
    foreach ($thmbs as $thm) {
    $thumb_id = '';
    $thumb_id_a = '';
    if (! @$get_vars['Qtmp'] == 'thumbs'
    && $reqd_image['num'] == $thm['num'] - 1)
    {
    $thumb_id = 'id="qdig-thumb-current"';
    $thumb_id_a = 'id="qdig-thumb-current-a"';
    }
    if (@$thm['wrap'] == TRUE && $thumbs_wide > 0
    && ! $thumbs['vicinity'] == TRUE)
    {
    $str .= " </div><!-- wrap thubms row -->\n"
    ." <div align=\"center\" style=\"margin:2px 2px 0px 0px; white-space:nowrap;\">\n";
    $thumbs_wide--;
    }
    // Strip the extension from the name
    $ext = strrchr($thm['image'], '.');
    $image_name = substr($thm['image'], 0, -strlen($ext));
    if ($thumbs['onfly'] == FALSE
    && ! (($file_exists_disa == TRUE && is_file($thm['thumb']))
    || file_exists($thm['thumb']))
    && $is_included == FALSE) // TODO: Use e.g. $direct_url setting?
    {
    $thm['cnvurl'] = "$qdig_url?Qimg=clear-dot";
    }
    $str .= <<<EOT
    <a href="$qdig_url?{$extra_param}Qwd={$reqd_image['pwd_url']}&amp;Qif={$thm['imgurl']}&amp;Qiv={$reqd_image['view']}&amp;Qis={$reqd_image['size']}$anchor"
    class="$thumb_class-a" $thumb_id_a title="{$nav_lnk['Image']} {$thm['num']} - $image_name"><img class="$thumb_class" $thumb_id
    src="{$thm['cnvurl']}" alt="$image_name" {$thm['img_size'][3]} /></a>\n
    EOT;
    }
    $str .= " </div>\n";
    return $str;
    }
    } // End imageThumbsLinks()

    /**
    * Produce a Directory Navigation Row.
    *
    * Contains the path to the current gallery directory and subdirectory links.
    */
    function dirNav($dir_nav)
    {
    global $get_vars, $img_link, $imgs, $qdig_url, $extra_param, $anchor, $reqd_image,
    $rootdir, $subdirs, $reqd_img_size_tmp, $chroot_dir, $gallery_size;
    if (@$img_link['dir_thumbonly'] == TRUE && $reqd_image['pwd'] == $rootdir) {
    $thm_dir_view = (@$get_vars['Qtmp'] == 'thumbs') ? 'thumbs' : 'img_page';
    } elseif (! isset($subdirs) // Skip it if there are no subdirectories
    && ((empty($chroot_dir) && $reqd_image['pwd'] == '.') // TODO: s/b $rootdir?
    || (!empty($chroot_dir) && $reqd_image['pwd'] == './'.$chroot_dir )))
    {
    return array('str' => '', 'ctrl_bar_ena' => TRUE);
    }
    if (empty($imgs)) {
    $align = (preg_match('!^(left|center|right)$!', $dir_nav['align_dirs']))
    ? $dir_nav['align_dirs']
    : 'center';
    $height_attr = " height=\"{$gallery_size['height']}\"";
    } else { $align = 'center'; $height_attr = '';}
    // Show it if it's enabled.
    if ($dir_nav['enable'] == FALSE) { return array('str' => '', 'ctrl_bar_ena' => TRUE); }
    $str = <<<EOT
    \n <!-- directory navigation -->
    <td colspan="2"$height_attr>
    <div style="text-align:$align; width:100%;" id="qdig-dirnav">\n
    EOT;
    if ($dir_nav['small'] == TRUE) {
    $str .= ' <small>';
    }
    // Display path to current directory / image.
    $str .= dirnavPath($dir_nav, @$thm_dir_view);
    // Display navigation links to subdirectories.
    $str .= subdirLinks($dir_nav);
    // Preferences Link
    $ctrl_bar_ena = ($dir_nav['prefs_ena'] == TRUE) ? FALSE : TRUE;
    if ($dir_nav['prefs_ena'] == TRUE && count($imgs) > 1) {
    $ctrl_bar_ena = FALSE;
    if ($reqd_img_size_tmp == 'Ctrl') {
    $qtmp_ctrl = '';
    $link_title = $dir_nav['prefs_title_txt2'];
    $link_text = $dir_nav['prefs_txt2'];
    } else {
    $qtmp_ctrl = '&amp;Qtmp=Ctrl';
    $link_title = $dir_nav['prefs_title_txt'];
    $link_text = $dir_nav['prefs_txt'];
    }
    $imgurl = rawurlencode($reqd_image['file']);
    $str .= <<<EOT
    <span style="white-space:nowrap;" class="qdig-navpath">&nbsp;<b>[ </b><a href="$qdig_url?{$extra_param}Qwd={$reqd_image['pwd_url']}&amp;Qif=$imgurl&amp;Qiv={$reqd_image['view']}&amp;Qis={$reqd_image['size']}$qtmp_ctrl$anchor"
    title="$link_title">$link_text</a><b> ]</b></span>\n
    EOT;
    }
    if ($dir_nav['small'] == TRUE) { $str .= ' </small>'; }
    $tag = (empty($imgs)) ? '<tr><td>' : '<tr>';
    $str .= <<<EOT
    </div>
    </td>
    </tr>$tag\n
    EOT;
    return array('str' => $str, 'ctrl_bar_ena' => $ctrl_bar_ena);
    } // End dirNav()

    /**
    * Display the requested image.
    *
    * Show the requested image and the caption, if any.
    */
    function displayImage($reqd_image, $labels)
    {
    global $get_vars, $imgs, $qdig_url, $rootdir, $extra_param, $anchor,
    $cnvrt_path, $reqd_img_size_tmp, $nav_lnk, $cnvrt_size, $subdirs,
    $is_readable_disa, $img_link, $caption, $url_base_path, $safe_mode,
    $omit_image, $dir_nav, $lang, $gallery_size, $exif;
    if (empty($imgs) || @$omit_image == TRUE) { return ''; }
    $str = '';
    foreach ($cnvrt_size as $size_info) {
    if ($reqd_img_size_tmp == $size_info['label']
    || (! isset($size_string) && $reqd_image['size'] == $size_info['label']))
    {
    $cnvrt_url = urlPath($cnvrt_path);
    $size_string = $cnvrt_path.'/'.$size_info['prefix'];
    $size_str_url = $cnvrt_url.'/'.$size_info['prefix'];
    if (! is_file($size_string.$reqd_image['file'])
    || ! ($is_readable_disa == TRUE || is_readable($size_string.$reqd_image['file'])))
    {
    $size_string = $reqd_image['pwd'].'/';
    $size_str_url = $reqd_image['pwd_url'].'/';
    }
    }
    }
    if (! isset($size_string)) {
    $size_string = $reqd_image['pwd'].'/';
    $size_str_url = $reqd_image['pwd_url'].'/';
    }
    $str = "\n <!-- requested image -->\n";
    $pad = (@$get_vars['Qtmp'] == 'popup')
    ? 'padding:0px;'
    : 'padding-top:2px;';
    $height = round($gallery_size['height'] * 0.96);
    $str .= " <div align=\"center\" id=\"qdig-img_and_caption\" style=\"$pad\">\n";
    $str .= <<<EOT
    <table summary="{$lang['Requested Image']}" cellpadding="0" cellspacing="0">
    <tr><td height="$height"><div style="text-align:center;" id="qdig-imgarea">\n
    EOT;
    if (! is_file($reqd_image['pwd'].'/'.$reqd_image['file'])) {
    $img_file = $imgs[0];
    $img_num = 1;
    } else {
    $img_file = $reqd_image['file'];
    $img_num = $reqd_image['num'];
    }
    $num_imgs = count($imgs);
    if ($num_imgs <= $img_link['few_limit']) { $img_link['t_p_few'] = FALSE; }
    if ($safe_mode == FALSE) {
    $img_size = GetImageSize($size_string.$img_file);
    } else {
    $img_size[0] = '';
    $img_size[3] = '';
    }
    if ($caption['above'] == TRUE) {
    $str .= captionBlock($img_file, $img_size[0]); }
    if ($img_link['wrap_up'] == TRUE
    && $reqd_image['pwd'] == $rootdir)
    {
    $img_link['wrap_up'] = FALSE;
    }
    $img_url = $size_str_url.rawurlencode($img_file);
    // Strip extension
    $ext = strrchr($img_file, '.');
    $img_name = substr($img_file, 0, -strlen($ext));
    if (@$get_vars['Qtmp'] == 'popup') {
    $str .= <<<EOT
    <a href="javascript:window.close();" title='{$lang['Close Window']}'
    ><img class="qdig-image" src="$url_base_path$img_url"
    alt="$img_name" {$img_size[3]} /></a>
    EOT;
    } else if ($num_imgs > 0) {
    if ($reqd_img_size_tmp == $cnvrt_size[5]['label']
    || $reqd_img_size_tmp == $cnvrt_size[4]['label']
    || $reqd_img_size_tmp == $cnvrt_size[3]['label']
    || $reqd_img_size_tmp == $cnvrt_size[2]['label']
    || $reqd_img_size_tmp == $cnvrt_size[1]['label']
    || $reqd_img_size_tmp == $cnvrt_size[0]['label']
    || ($img_link['full'] == TRUE
    && $size_string != $reqd_image['pwd'].'/')
    && $reqd_image['size'] != $cnvrt_size[5]['label'])
    {
    if ($reqd_img_size_tmp != $cnvrt_size[5]['label']
    && ! ($reqd_img_size_tmp == $cnvrt_size[4]['label']
    || $reqd_img_size_tmp == $cnvrt_size[3]['label']
    || $reqd_img_size_tmp == $cnvrt_size[2]['label']
    || $reqd_img_size_tmp == $cnvrt_size[1]['label']
    || $reqd_img_size_tmp == $cnvrt_size[0]['label']))
    {
    $qtmp_parm = "&amp;Qtmp={$cnvrt_size[5]['label']}";
    $title_txt1 = $labels['nav']['See the'];
    $title_txt2 = $cnvrt_size[5]['txt'];
    } else {
    $qtmp_parm = '';
    $title_txt1 = $labels['nav']['Return to'];
    $title_txt2 = $cnvrt_size[5]['txt2'];
    }
    $title = $title_txt1.$title_txt2.$labels['nav']['version of'];
    $file_url = rawurlencode($reqd_image['file']);
    $direct = urlPath($reqd_image['pwd'].'/'.$img_file);
    if ($img_link['full'] == TRUE
    && $img_link['file'] == TRUE
    && $size_string != $reqd_image['pwd'].'/'
    && $reqd_image['size'] != $cnvrt_size[5]['label'])
    {
    $str .= <<<EOT
    <a href="$url_base_path$direct" target="_top" title="$title"><img class="qdig-image" src="$url_base_path$img_url"
    alt="$img_name" {$img_size[3]} /></a>\n
    EOT;
    } else {
    $str .= <<<EOT
    <a href="$qdig_url?{$extra_param}Qwd={$reqd_image['pwd_url']}&amp;Qif=$file_url&amp;Qiv={$reqd_image['view']}&amp;Qis={$reqd_image['size']}$qtmp_parm$anchor"
    title="$title"><img class="qdig-image" src="$url_base_path$img_url"
    alt="$img_name" {$img_size[3]} /></a>\n
    EOT;
    }
    } elseif (is_file($reqd_image['pwd'].'/'.$img_file)
    && ($img_link['t_p_few'] == TRUE || @$img_link['dir_thumbonly'])
    && $img_link['th_page'] == TRUE)
    { // TODO Test. Probably didn't need to create yet another link?...
    $str .= <<<EOT
    <a href="$qdig_url?{$extra_param}Qwd={$reqd_image['pwd_url']}&amp;Qiv={$reqd_image['view']}&amp;Qis={$reqd_image['size']}'&amp;Qtmp=thumbs$anchor"
    title="{$nav_lnk['frst_msg']}"><img class="qdig-image" src="$url_base_path$img_url"
    alt="$img_name" {$img_size[3]} /></a>\n
    EOT;
    } elseif (is_file($reqd_image['pwd'].'/'.$img_file)
    && $img_num == $num_imgs - 1)
    {
    if ($img_link['next'] == TRUE
    && $img_link['wrap'] == TRUE
    && $img_link['full'] == FALSE)
    {
    $first_url = rawurlencode($imgs[0]);
    $str .= <<<EOT
    <a href="$qdig_url?{$extra_param}Qwd={$reqd_image['pwd_url']}&amp;Qif=$first_url&amp;Qiv={$reqd_image['view']}&amp;Qis={$reqd_image['size']}$anchor"
    title="{$nav_lnk['frst_msg']}"><img class="qdig-image" src="$url_base_path$img_url"
    alt="$img_name" {$img_size[3]} /></a>\n
    EOT;
    } elseif ($img_link['next'] == TRUE
    && $img_link['wrap_up'] == TRUE
    && $img_link['full'] == FALSE)
    {
    if (@$img_link['dir_thumbonly']) {
    $wd_up = $reqd_image['pwd_url'];
    $title = "{$dir_nav['go_to_txt']} - {$dir_nav['thumbs']}";
    } else {
    $wd = strrchr($reqd_image['pwd_url'], '/');
    $wd_up = substr($reqd_image['pwd_url'], 0, -strlen($wd));
    $title = $dir_nav['up_title_txt'];
    }
    $str .= <<<EOT
    <a href="$qdig_url?{$extra_param}Qwd=$wd_up&amp;Qiv={$reqd_image['view']}&amp;Qis={$reqd_image['size']}$anchor"
    title="$title"><img class="qdig-image" src="$url_base_path$img_url"
    alt="$img_name" {$img_size[3]} /></a>\n
    EOT;
    } else {
    $str .= ' <img class="qdig-image" src="'.$url_base_path.$img_url
    .'" alt="'.$img_file.'" '.$img_size[3].' />'."\n";
    }
    } elseif(is_file($reqd_image['pwd'].'/'.$img_file) && $num_imgs > 1) {
    if ($img_link['next'] == TRUE && $img_link['full'] == FALSE) {
    $next_url = rawurlencode($imgs[$img_num + 1]);
    $str .= <<<EOT
    <a href="$qdig_url?{$extra_param}Qwd={$reqd_image['pwd_url']}&amp;Qif=$next_url&amp;Qiv={$reqd_image['view']}&amp;Qis={$reqd_image['size']}$anchor"
    title="{$nav_lnk['next_msg']}"><img class="qdig-image" src="$url_base_path$img_url"
    alt="$img_name" {$img_size[3]} /></a>\n
    EOT;
    } else {
    $str .= ' <img class="qdig-image" src="'.$url_base_path.$img_url
    .'" alt="'.$img_file.'" '.$img_size[3].' />'."\n";
    }
    }
    } elseif(is_file($reqd_image['pwd'].'/'.$img_file)) {
    $str .= ' <img class="qdig-image" src="'.$url_base_path.$img_url
    .'" alt="'.$img_file.'" '.$img_size[3].' />'."\n";
    }
    if ($caption['above'] != TRUE) $str .= captionBlock($img_file, $img_size[0]);
    if ($exif['ena'] && function_exists('exifBlock')) {
    $str .= exifBlock($img_file); }
    $str .= " </div></td></tr></table></div>\n";
    return $str;
    } // End displayImage()

    /**
    * Produce an Image Caption block.
    */
    function captionBlock($img_file, $img_width)
    {
    global $pwd, $caption, $safe_captions, $caption_path, $touch_captions,
    $is_readable_disa, $file_exists_disa, $safe_mode, $caption;
    if (@$caption['editform']) return $caption['editform'];
    $caption_file = $caption_path.'/'.$img_file.'.txt';
    if ($touch_captions == TRUE) {
    if ((($file_exists_disa == TRUE && ! is_file($caption_file))
    || ! file_exists($caption_file))
    && is_writable($caption_path))
    {
    touch($caption_file);
    fixPerms($caption_file);
    }
    }
    $txt = '';
    // Get caption text from file
    if (@is_file($caption_file)
    && filesize($caption_file) > 0
    && ($is_readable_disa == TRUE || is_readable($caption_file)))
    {
    $fh = fopen($caption_file, 'r');
    $txt .= fread($fh, filesize($caption_file));
    fclose($fh);
    }
    if (empty($txt)) {
    if($caption['placehold'] == TRUE) { $txt = '<br />'; } else { return; }
    }
    $txt_align = ($caption['left_just'] == TRUE) ? 'left' : 'center';
    $str = " <div title='{$caption['lang Caption']}'"
    ." class='qdig-caption' style='width:100%;"
    ." padding:{$caption['padding']};\n text-align:$txt_align;'>";
    $str .= ($safe_captions == TRUE && $caption['nl2br'] == TRUE)
    ? nl2br($txt)
    : $txt;
    $str .= "</div>\n";
    return $str;
    } // End captionBlock()

    /**
    * Produce a `Previous Image'or `Last Image` link for a Gallery Navigation Row.
    *
    * Link to the previous image, or optionally to the last if this is first image.
    */
    function prevLink($img_num, $nav_wrap)
    {
    global $imgs, $qdig_url, $extra_param, $anchor, $reqd_image, $nav_lnk, $styl_grayout;
    $num_imgs = count($imgs);
    if ($num_imgs > 1) {
    if ($img_num < 1 && $nav_wrap == FALSE) {
    $txt = $nav_lnk['prv_txt'];
    $str = <<<EOT
    <span $styl_grayout><b>$txt</b></span>\n
    EOT;
    return $str;
    }
    if ($img_num < 1 || $img_num > $num_imgs) {
    $last_image_file = $imgs[$num_imgs - 1];
    $image = rawurlencode($last_image_file);
    $msg = $nav_lnk['last_msg'];
    $txt = $nav_lnk['last_txt1'];
    } else {
    $image = rawurlencode($imgs[$img_num - 1]);
    $msg = $nav_lnk['prv_msg'];
    $txt = $nav_lnk['prv_txt'];
    }
    $str = <<<EOT
    <a href="$qdig_url?{$extra_param}Qwd={$reqd_image['pwd_url']}&amp;Qif=$image&amp;Qiv={$reqd_image['view']}&amp;Qis={$reqd_image['size']}$anchor"
    title="$msg">$txt</a>\n
    EOT;
    return $str;
    }
    } // End prevLink()

    /**
    * Produce a `Next Image' or `First Image' link for a Gallery Navigation Row.
    *
    * Link to the next image, or optionally to the first if this is the last image.
    */
    function nextLink($nav_wrap)
    {
    global $imgs, $qdig_url, $extra_param, $anchor, $reqd_image,
    $nav_lnk, $styl_grayout;
    $num_imgs = count($imgs);
    if ($reqd_image['num'] + 1 == $num_imgs && $nav_wrap == FALSE) {
    $str = <<<EOT
    <span $styl_grayout><b>{$nav_lnk['next_txt']}</b></span>\n
    EOT;
    return $str;
    }
    if ($num_imgs > 1) {
    if ($reqd_image['num'] + 1 == $num_imgs) {
    $image = rawurlencode($imgs[0]);
    $msg = $nav_lnk['frst_msg'];
    $txt = $nav_lnk['frst_txt1'];
    } else {
    $image = rawurlencode($imgs[$reqd_image['num'] + 1]);
    $msg = $nav_lnk['next_msg'];
    $txt = $nav_lnk['next_txt'];
    }
    $str = <<<EOT
    <a href="$qdig_url?{$extra_param}Qwd={$reqd_image['pwd_url']}&amp;Qif=$image&amp;Qiv={$reqd_image['view']}&amp;Qis={$reqd_image['size']}$anchor"
    title="$msg">$txt</a>\n
    EOT;
    return $str;
    }
    } // End nextLink()

    /**
    * Produce a `Last Image' (` >>| ') link for a Gallery Navigation Row.
    */
    function lastLink($reqd_image)
    {
    global $imgs, $qdig_url, $extra_param, $anchor, $reqd_image, $nav_lnk,
    $styl_grayout;
    $num_imgs = count($imgs);
    if ($num_imgs > 1) {
    if ($reqd_image['num'] + 1 == $num_imgs) {
    $str = <<<EOT
    <span $styl_grayout><b>{$nav_lnk['last_txt2']}</b></span>\n
    EOT;
    } else {
    $last_image_file = $imgs[count($imgs) - 1];
    $file = rawurlencode($last_image_file);
    $str = <<<EOT
    <a href="$qdig_url?{$extra_param}Qwd={$reqd_image['pwd_url']}&amp;Qif=$file&amp;Qiv={$reqd_image['view']}&amp;Qis={$reqd_image['size']}$anchor"
    title="{$nav_lnk['last_msg']}">{$nav_lnk['last_txt2']}</a>\n
    EOT;
    }
    return $str;
    }
    } // End lastLink()

    /**
    * Build a `First Image' (` |<< ') link for a Gallery Navigation Row.
    */
    function firstLink($img_num)
    {
    global $imgs, $qdig_url, $extra_param, $anchor, $reqd_image, $nav_lnk,
    $styl_grayout;
    if (count($imgs) > 1) {
    if ($img_num == 0) {
    $str = <<<EOT
    <span $styl_grayout><b>{$nav_lnk['frst_txt2']}</b></span>\n
    EOT;
    } else {
    $image = rawurlencode($imgs[0]);
    $str = <<<EOT
    <a href="$qdig_url?{$extra_param}Qwd={$reqd_image['pwd_url']}&amp;Qif=$image&amp;Qiv={$reqd_image['view']}&amp;Qis={$reqd_image['size']}$anchor"
    title="{$nav_lnk['frst_msg']}">{$nav_lnk['frst_txt2']}</a>\n
    EOT;
    }
    return $str;
    }
    } // End firstLink()

    /**
    * Build a Gallery Navigation Row table.
    *
    * Includes Prev/Next links and/or Home link, as set by user settings.
    */
    function navRow($nav, $id)
    {
    global $imgs, $reqd_image, $cnvrt_path, $img_sz_labels, $dir_nav,
    $nav_lnk, $is_readable_disa;
    if ($nav['enable'] == FALSE) { return ''; }
    $str = '';
    if (! is_dir($cnvrt_path)
    || ! ($is_readable_disa == TRUE || is_readable($cnvrt_path)))
    {
    $nav['tmp_size'] = FALSE;
    $nav['full_link'] = FALSE;
    }
    if ($nav['tmp_size'] == TRUE) { // Sizer overrides Full Size link.
    $nav['full_link'] = FALSE;
    }
    $nav_full = navFull($nav['sml_txt'], $img_sz_labels['nav']);
    if ($nav_full['show_full_link'] == FALSE) { $nav['full_link'] = FALSE; }
    if ($dir_nav['cntr_ena'] == TRUE && $dir_nav['enable'] == TRUE) {
    $nav['cntr'] = FALSE;
    }
    // Don't build a table if there's no content
    $num_imgs = count($imgs);
    if ($num_imgs > 1
    && (($nav['prv_next'] == TRUE)
    || ($nav['frst_last'] == TRUE)
    || ($nav['cntr'] == TRUE))
    || ($num_imgs > 0
    && ($nav['tmp_size'] == TRUE) || ($nav['full_link'] == TRUE)))
    {
    if ($nav['sml_txt'] == TRUE) {
    $tag_bfr_lnk = '<small>';
    $tag_aft_lnk = '</small>';
    } else {
    $tag_bfr_lnk = '';
    $tag_aft_lnk = '';
    }
    $padding = (isset($nav['padding']))
    ? $nav['padding']
    : '0px';
    $str = <<<EOT
    \n <!-- gallery navigation -->
    <div align="center" style="padding:$padding;">
    <table summary="{$nav_lnk['Gallery Navigation']}"
    class="qdig-navrow" id="qdig-{$id}nav"
    width="{$nav['width']}" cellpadding="0" cellspacing="0">
    <tr>\n
    EOT;
    if ($num_imgs > 1) {
    if ($nav['frst_last'] == TRUE) {
    $str .= " <td width=\"5%\" style='white-space:nowrap; text-align:center;'>$tag_bfr_lnk\n"
    .firstLink($reqd_image['num'])
    ." $tag_aft_lnk</td>\n";
    }
    if ($nav['prv_next'] == TRUE) {
    $str .= " <td width=\"14%\" style='white-space:nowrap; text-align:center;'>$tag_bfr_lnk\n"
    .prevLink($reqd_image['num'], $nav['wrap'])
    ." $tag_aft_lnk</td>\n";
    }
    if ($nav['cntr'] == TRUE
    && ( $nav['tmp_size'] == TRUE || $nav['full_link'] == TRUE))
    {
    $str .= " <td width=\"10%\" style='white-space:nowrap; text-align:center;'>\n";
    } elseif ($nav['cntr'] == TRUE ) {
    $str .= " <td width=\"30%\" style='white-space:nowrap; text-align:center;'>\n";
    }
    if ($nav['cntr'] == TRUE) {
    if ($nav['cntr_bold'] == TRUE) {
    $bold_before = '<b>';
    $bold_after = '</b>';
    } else {
    $bold_before = '';
    $bold_after = '';
    }
    $str .= ' '.$tag_bfr_lnk.$bold_before.imageCounter($reqd_image['num']).$bold_after.$tag_aft_lnk."\n"
    ." </td>\n";
    }
    }
    if (($nav['cntr'] == TRUE && $num_imgs > 1)
    && ($nav['tmp_size'] == TRUE || $nav['full_link'] == TRUE ))
    {
    $str .= " <td width=\"20%\" style='white-space:nowrap; text-align:center;'> &nbsp;";
    } elseif ($nav['tmp_size'] == TRUE || $nav['full_link'] == TRUE ) {
    $str .= " <td width=\"30%\" style='white-space:nowrap; text-align:center;'>\n";
    }
    if ($nav['tmp_size'] == TRUE) {
    $str .= navSize($nav['sml_txt'], $img_sz_labels['nav'])." </td>\n";
    }
    if ($nav['tmp_size'] == FALSE && $nav['full_link'] == TRUE) {
    $str .= $nav_full['str']." </td>\n";
    }
    if ($num_imgs > 1) {
    if ($nav['prv_next'] == TRUE) {
    $str .= " <td width=\"14%\" style='white-space:nowrap; text-align:center;'>$tag_bfr_lnk\n"
    .nextLink($nav['wrap'])." $tag_aft_lnk</td>\n";
    }
    if ($nav['frst_last'] == TRUE) {
    $str .= " <td width=\"5%\" style='white-space:nowrap; text-align:center;'>$tag_bfr_lnk\n"
    .lastLink($reqd_image['num'])." $tag_aft_lnk</td>\n";
    }
    }
    $str .= " </tr>\n </table>\n </div>\n";
    }
    return $str;
    } // End navRow()

    /**
    * Produce a Gallery Footer Row table.
    *
    * Includes Site Link, Copyright, and Quig Home link.
    */
    function footerRow()
    {
    global $imgs, $reqd_image, $site_link, $copyright, $qdig_homelink,
    $footer, $rootdir;
    if (@$footer['omit'] == TRUE) { return ''; }
    if (count($imgs) < 1) { unset($copyright['txt']); }
    $site_link_on = !empty($site_link['url']) && !empty($site_link['title']);
    $copyright_on = !empty($copyright['txt']);
    $qdig_link_on = $qdig_homelink['ena'];
    if (!($site_link_on == TRUE || $copyright_on == TRUE || $qdig_link_on == TRUE)) {
    return ''; // Nothing to do.
    }
    $sitelink_align = ($copyright_on || $qdig_link_on)
    ? ' align="left"'
    : ' align="center"';
    if (($site_link_on && $qdig_link_on)
    || (!$site_link_on && !$qdig_link_on))
    {
    $copyright_align = ' align="center"';
    } elseif ($site_link_on) {
    $copyright_align = ' align="right"';
    } elseif ($qdig_link_on) {
    $copyright_align = ' align="left"';
    }
    $qdig_link_align = ! ($site_link_on || $copyright_on)
    ? ' align="center"'
    : ' align="right"';
    $tag = (empty($imgs) && $reqd_image['pwd'] == $rootdir)
    ? '<small><small><br /></small></small>'."\n "
    : '';
    $str = <<<EOT
    \n <!-- table footer row of image dispaly area -->
    $tag<div align="center" style="padding-top:{$footer['pad_top']};">
    <table summary="{$footer['summary_txt']}"
    width="100%" cellpadding="1" cellspacing="0">
    <tr>\n
    EOT;
    if ($site_link_on == TRUE) {
    $str .= <<<EOT
    <td nowrap="nowrap" $sitelink_align>
    <div style="font-size:{$site_link['font_size']};">
    <a href="{$site_link['url']}" title="{$site_link['title']}">{$site_link['title']}</a>&nbsp;
    </div>
    </td>\n
    EOT;
    }
    if ($copyright_on == TRUE) {
    $str .= <<<EOT
    <td nowrap="nowrap" $copyright_align>
    <div title="{$copyright['title_txt']}" style="color:{$copyright['color']};
    font-size: {$copyright['fnt_size']}; font-weight:normal;">
    {$copyright['txt']}
    </div>
    </td>\n
    EOT;
    }
    if ($qdig_homelink['ena'] == TRUE) {
    $str .= <<<EOT
    <td nowrap="nowrap" $qdig_link_align>
    <div title="{$qdig_homelink['div_title']}"
    style="color:{$qdig_homelink['color']}; font-size:{$qdig_homelink['fnt_size']};">
    Gallery by
    <a href="http://qdig.sourceforge.net/"
    title="Qdig Gallery Script Home Page" style="color:{$qdig_homelink['color']};
    font-weight:normal;">Qdig</a>
    </div>
    </td>\n
    EOT;
    }
    $str .= " </tr>\n </table>\n </div>\n";
    return $str;
    } // End footerRow()

    /**
    * Display either the Text or Thumbnail Image Links.
    */
    function displayImageLinks($thmb_row, $nmrl_row)
    {
    global $thmbs_ena, $convert_readable;
    $str = ($thmbs_ena == TRUE && $convert_readable == TRUE)
    ? imageThumbsLinks($thmb_row)
    : imageTextLinks($nmrl_row);
    return $str;
    } // End displayImageLinks()

    /**
    * Produce a `Default View' chooser for a Gallery Control Bar.
    */
    function controlView($ctrl_links_mesg)
    {
    global $imgs, $qdig_url, $extra_param, $anchor, $reqd_image, $thumbs,
    $styl_grayout, $ctrl_bar, $convert_readable, $namelinks;
    if (count($imgs) < 2) { return; }
    $reqd_file = rawurlencode($reqd_image['file']);
    $str = " <td align=\"center\">\n";
    $str .= ($ctrl_bar['small'] == TRUE)
    ? " <div style=\"padding-top:2px;\"><small>\n"
    : " <div style=\"padding-top:2px;\">\n";
    $str .= " {$ctrl_links_mesg['links_style']} <b>[</b>\n";
    if ( $reqd_image['view'] != 'thumbs'
    && $convert_readable == TRUE
    && $thumbs['enable'] == TRUE)
    {
    $str .= <<<EOT
    <a href="$qdig_url?{$extra_param}Qwd={$reqd_image['pwd_url']}&amp;Qif=$reqd_file&amp;Qiv=thumbs&amp;Qis={$reqd_image['size']}$anchor"
    title="{$ctrl_links_mesg['thumbs_msg']}">{$ctrl_links_mesg['thumbs_txt']}</a> |\n
    EOT;
    } elseif ($convert_readable == TRUE && $thumbs['enable'] == TRUE) {
    $txt = $ctrl_links_mesg['thumbs_txt'];
    $str .= <<<EOT
    <span $styl_grayout><b>$txt</b></span> |\n
    EOT;
    }
    if ( $reqd_image['view'] != 'name' && $namelinks['disa'] == FALSE ) {
    $str .= <<<EOT
    <a href="$qdig_url?{$extra_param}Qwd={$reqd_image['pwd_url']}&amp;Qif=$reqd_file&amp;Qiv=name&amp;Qis={$reqd_image['size']}$anchor"
    title="{$ctrl_links_mesg['names_msg']}">{$ctrl_links_mesg['names_txt']}</a> |\n
    EOT;
    } elseif ($namelinks['disa'] == FALSE) {
    $txt = $ctrl_links_mesg['names_txt'];
    $str .= <<<EOT
    <span $styl_grayout><b>$txt</b></span> |\n
    EOT;
    }
    if ( $reqd_image['view'] != 'num') {
    $str .= <<<EOT
    <a href="$qdig_url?{$extra_param}Qwd={$reqd_image['pwd_url']}&amp;Qif=$reqd_file&amp;Qiv=num&amp;Qis={$reqd_image['size']}$anchor"
    title="{$ctrl_links_mesg['nums_msg']}">{$ctrl_links_mesg['nums_txt']}</a> |\n
    EOT;
    } else {
    $txt = $ctrl_links_mesg['nums_txt'];
    $str .= <<<EOT
    <span $styl_grayout><b>$txt</b></span> |\n
    EOT;
    }
    if ( $reqd_image['view'] != 'none') {
    $str .= <<<EOT
    <a href="$qdig_url?{$extra_param}Qwd={$reqd_image['pwd_url']}&amp;Qif=$reqd_file&amp;Qiv=none&amp;Qis={$reqd_image['size']}$anchor"
    title="{$ctrl_links_mesg['none_msg']}">{$ctrl_links_mesg['none_txt']}</a>\n
    EOT;
    } else {
    $txt = $ctrl_links_mesg['none_txt'];
    $str .= <<<EOT
    <span $styl_grayout><b>$txt</b></span>\n
    EOT;
    }
    $str .= " <b>]</b>\n";
    $str .= ($ctrl_bar['small'] == TRUE)
    ? " </small></div>\n"
    : " </div>\n";
    $str .= " </td>\n";
    return $str;
    } // End controlView()

    /**
    * Produce a `Default Size' chooser for a Gallery Control Bar.
    */
    function controlSize($labels)
    {
    global $imgs, $qdig_url, $extra_param, $anchor, $reqd_image, $cnvrt_path,
    $styl_grayout, $ctrl_bar, $disp_size, $cnvrt_size, $is_readable_disa;
    if (count($imgs) < 2) { return; }
    if (! is_dir($cnvrt_path)
    || ! ($is_readable_disa == TRUE || is_readable($cnvrt_path)))
    {
    return;
    }
    $reqd_file = rawurlencode($reqd_image['file']);
    $str = ($ctrl_bar['vw_ctrl'] == FALSE)
    ? " <td align=\"center\" nowrap=\"nowrap\">\n"
    : " <td nowrap=\"nowrap\">\n";
    $str .= ($ctrl_bar['small'] == TRUE)
    ? " <div style=\"padding-top:2px;\"><small>\n"
    : " <div style=\"padding-top:2px;\">\n";
    $x = 0;
    foreach ($cnvrt_size as $size_info) {
    if ($reqd_image['size'] != $size_info['label']
    && $disp_size[$x] == TRUE)
    {
    $title = $labels['Change def'].$cnvrt_size[$x]['txt'].$labels['str2'];
    $size[] = <<<EOT
    <a href="$qdig_url?{$extra_param}Qwd={$reqd_image['pwd_url']}&amp;Qif=$reqd_file&amp;Qiv={$reqd_image['view']}&amp;Qis={$size_info['label']}$anchor"
    title="$title">{$size_info['label']}</a>
    EOT;
    } elseif ($disp_size[$x] == TRUE) {
    $size[] = <<<EOT
    <span $styl_grayout><b>{$size_info['label']}</b></span>
    EOT;
    }
    $x++;
    }
    if (!empty($size)) {
    $str .= " &nbsp;{$labels['Default Size']} <b>[</b>\n";
    $num_sizes=count($size);
    $i = 0;
    foreach ($size as $size_str) {
    $str .= $size_str;
    if ($i < ($num_sizes - 1)) {
    $str .= " |\n";
    }
    $i++;
    }
    $str .= "\n <b>]</b>\n";
    } else {
    $str .= '&nbsp;';
    }
    $str .= ($ctrl_bar['small'] == TRUE)
    ? " </small></div>\n"
    : " </div>\n";
    $str .= " </td>\n";
    return $str;
    } // End controlSize()

    /**
    * Produce a Size Chooser for a Gallery Navigation Row.
    */
    function navSize($small_b, $labels)
    {
    global $imgs, $qdig_url, $extra_param, $anchor, $reqd_image, $cnvrt_path,
    $reqd_img_size_tmp, $styl_grayout, $disp_size, $cnvrt_size,
    $valid_sizes, $is_readable_disa;
    if (! is_dir($cnvrt_path)
    || ! ($is_readable_disa == TRUE || is_readable($cnvrt_path)))
    {
    return;
    }
    if ($small_b == TRUE) {
    $small_on = "<small>";
    $small_off = "</small>";
    } else {
    $small_on = '';
    $small_off = '';
    }
    $size_displayed = (!empty($reqd_img_size_tmp))
    ? $reqd_img_size_tmp
    : $reqd_image['size'];
    $n = count($disp_size) - 1;
    $full_size = $cnvrt_size[$n]['label'];
    $str = $small_on.'<b>[</b>'.$small_off."\n";
    $num_sizes = count($disp_size);
    $num_valid = count($valid_sizes);
    foreach ($disp_size as $i => $enabled) {
    $size = $cnvrt_size[$i]['label'];
    if (!in_array($size, $valid_sizes)) { continue; } // skip
    $qtmp_txt = ($size == $reqd_image['size']) ? '' : '&amp;Qtmp='.$size;
    $title = $labels['See the'].$cnvrt_size[$i]['txt'].$labels['version of'];
    $file = $cnvrt_path.'/'.$cnvrt_size[$i]['prefix'].$reqd_image['file'];
    $file2 = $cnvrt_path.'/'.@$cnvrt_size[$z]['prefix'].$reqd_image['file'];
    $z=$i;
    if ($size == $reqd_image['size'] && is_file($file2)) { $foo = TRUE; }
    if ($size == $size_displayed && is_file($file)) { $bar = TRUE; }
    if (is_file($file) && !is_file($file2)) { $bim = TRUE; }
    $reqd_file = rawurlencode($reqd_image['file']);
    if ((is_file($file) || is_file($file2) || $size == $full_size && @$bar == TRUE && $bim == FALSE)
    && $size != $size_displayed)
    {
    $size_txt[] = <<<EOT
    $small_on<a href="$qdig_url?{$extra_param}Qwd={$reqd_image['pwd_url']}&amp;Qif=$reqd_file&amp;Qiv={$reqd_image['view']}&amp;Qis={$reqd_image['size']}$qtmp_txt$anchor"
    title="$title">{$size}</a>$small_off
    EOT;
    } else {
    $size_txt[] = <<<EOT
    $small_on<span $styl_grayout><b>{$size}</b></span>$small_off
    EOT;
    }
    }
    $num_to_display = count($size_txt);
    foreach ($size_txt as $txt) {
    $str .= $txt;
    $num_to_display--;
    $str .= ($num_to_display > 0)
    ? " |\n"
    : "\n ".$small_on.'<b>]</b>'.$small_off."\n";
    }
    return $str;
    } // End navSize()

    /**
    * Produce an `Full Size' chooser for a Gallery Navigation Row.
    */
    function navFull($small_b, $labels)
    {
    global $imgs, $qdig_url, $extra_param, $anchor, $reqd_image, $cnvrt_path,
    $reqd_img_size_tmp, $styl_grayout, $cnvrt_size, $is_readable_disa;
    if (! isset($reqd_image['file'])
    || ! is_dir($cnvrt_path)
    || ! ($is_readable_disa == TRUE || is_readable($cnvrt_path)))
    {
    return; // no use, so never mind
    }
    if ($small_b == TRUE) {
    $small_on = '<small>';
    $small_off = '</small>';
    } else {
    $small_on = '';
    $small_off = '';
    }
    $size_info = $cnvrt_size[5];
    $full_label = $size_info['label'];
    $show_full_link = ($reqd_img_size_tmp != $full_label
    && $reqd_image['size'] != $full_label);
    $title = $labels['See the'].$size_info['txt'].$labels['version of'];
    foreach ($cnvrt_size as $size_info) {
    if ($reqd_image['size'] == $size_info['label'] ) {
    $file = $cnvrt_path.'/'.$size_info['prefix'].$reqd_image['file'];
    if (! is_file($file)) {
    $show_full_link = FALSE;
    }
    }
    }
    $file = $reqd_image['pwd'].'/'.$reqd_image['file'];
    if (is_file($file)
    && ($is_readable_disa == TRUE || is_readable($file))
    && $show_full_link == TRUE)
    {
    $reqd_file = rawurlencode($reqd_image['file']);
    $str = <<<EOT
    $small_on<a href="$qdig_url?{$extra_param}Qwd={$reqd_image['pwd_url']}&amp;Qif=$reqd_file&amp;Qiv={$reqd_image['view']}&amp;Qis={$reqd_image['size']}&amp;Qtmp=$full_label$anchor"
    title="$title">{$size_info['txt']}</a>$small_off\n
    EOT;
    } else { //TODO: Use grayed-out link?
    $str = "&nbsp;\n";
    }
    return array('str' => $str, 'show_full_link' => $show_full_link);
    } // End navFull()

    /**
    * Produce a Gallery Sidebar if appropriate.
    */
    function sideBar($nl_ena, $thmbs_ena, $bg_clr, $margin, $height)
    {
    global $imgs, $namelinks, $gallery_size;
    if (count($imgs) < 2 || $nl_ena == FALSE) { return; } // no sidebar if no image links
    if (empty($height) || $height == 'auto') {
    if (empty($gallery_size['height'])) {
    $height = 'auto';
    $scroll = '';
    } else {
    $height = $gallery_size['height'].'px';
    $scroll = 'overflow:auto;';
    }
    $valign = 'top';
    } else {
    $scroll = 'overflow:auto;';
    $valign = 'top';
    }
    $em = round((($namelinks['trunc'] + 2.7) / 2.1) + 0.8, 2); // TODO Yet another setting? Test...
    $arr['sb_on'] = TRUE;
    $str = <<<EOT
    \n <!-- Begin Qdig sidebar -->
    <td valign="$valign" nowrap="nowrap">
    <div style="margin:$margin; background-color:$bg_clr; height:$height;
    width:{$em}em; $scroll padding-top:2px; padding-bottom:2px; text-align:center;">\n
    EOT;
    $str .= displayImageLinks('', '');
    $str .= " </div>\n </td>\n <!-- End Qdig sidebar -->\n";
    $arr['str'] = $str;
    return $arr;
    } // End sideBar()

    /**
    * Produce an Admin link for editing an image's caption.
    */
    function adminLink($admin)
    {
    global $header, $is_included, $get_vars, $reqd_image, $qdig_url,
    $server_vars, $std_uri;
    if ($header['force_disa'] == TRUE) { return ''; }
    $str = '';
    if (isset($reqd_image['file'])
    && ($header['force_ena'] == TRUE || $is_included == FALSE))
    {
    $str = <<<EOT
    \n <span id="qdig-admin">{$admin['before_link']}<a
    href="$std_uri&amp;Qtmp=admin" title="{$admin['link_title']}"
    rel="nofollow" style="color:{$admin['color']};
    font-weight:normal;">{$admin['link_text']}</a>{$admin['after_link']}</span>
    EOT;
    }
    return $str;
    } // End adminLink()

    /**
    * Check for a valid username/password pair going any further.
    */
    function authorize($auth) {
    global $captions_root, $post_vars, $server_vars, $cookie_vars, $std_uri, $pwd;
    if ($auth['locked'] == TRUE) { unset($auth['0']['username']); }
    if ($auth['auto_lock'] == TRUE ) {
    $limiter_file = @$captions_root.'Edit-Lock_File--Delete_To_Unlock.txt'; // TODO: lang?
    $test_file = @$captions_root.'Write-Test.txt';
    if (!@is_file($limiter_file)) {
    if (@touch($test_file)) { $touch_lfile = TRUE; @unlink($test_file);
    } else { unset($auth['0']['username']); }
    } else {
    $now = time();
    $dir_age = $now - filemtime($pwd);
    $limiter_file_age = $now - filemtime($limiter_file);
    if ($dir_age > 0 && $dir_age < $auth['time_limit']) {
    touch($limiter_file);
    } elseif ($limiter_file_age < 0
    || $limiter_file_age > $auth['time_limit'])
    {
    unset($auth['0']['username']);
    } else { touch($limiter_file); }
    }
    }
    if (isset($auth['0']['username']) && $auth['enable'] == FALSE) {
    if (@$touch_lfile == TRUE) { touch($limiter_file); }
    return;
    }
    if (isset($auth['0']['username']) && empty($auth['0']['username'])) {
    $auth['0']['username'] = 'null';
    $auth['0']['password'] = '*';
    }
    foreach ($auth as $k => $v) {
    if (is_array($v) && $u = @$v['username']) {
    $users_array[$u] = @$v['password']; }
    }
    if ($auth['session'] == TRUE) {
    @session_start();
    if (@$_SESSION['LOGGED_IN'] == TRUE) {
    if (!isset($auth['0']['username']) || $auth['0']['username'] == 'null') {
    unset($_SESSION['LOGGED_IN']); // Log out
    } else {
    if (@$touch_lfile == TRUE) { touch($limiter_file); }
    return;
    }
    }
    $auth_user = @$post_vars['AUTH_USER'];
    $auth_pw = @$post_vars['AUTH_PW'];
    } else {
    $auth_user = @$server_vars['PHP_AUTH_USER'];
    $auth_pw = @$server_vars['PHP_AUTH_PW'];
    }
    if ($auth_pw && strlen($auth_pw) < 6) {
    $badpw = 1; $mesg = $auth['PW too few'];
    } elseif ($auth_pw && preg_match('%^(?:[[:alpha:]])*$%xs', $auth_pw)) {
    $badpw = 1; $mesg = $auth['PW alpha'];
    } elseif ($auth_pw && preg_match('%[[:cntrl:]]%', $auth_pw)) {
    $badpw = 1; $mesg = $auth['PW bad'];
    } elseif (empty($users_array)) {
    $badpw = 1; $mesg = $auth['Disabled']; // Locked.
    } else {
    $badpw = 0; $mesg = $auth['Unauthorized'];
    }
    if (!empty($auth_user) && !empty($auth_pw) && $badpw == FALSE
    && crypt($auth_pw, @$users_array[$auth_user]) == @$users_array[$auth_user])
    {
    if ($auth['session'] == TRUE) { $_SESSION['LOGGED_IN'] = TRUE; }
    if (@$touch_lfile == TRUE) { touch($limiter_file); }
    return;
    }
    $session_name = ini_get('session.name');
    if (!empty($users_array) && $auth['session'] == TRUE) { // TODO SSL?
    $adm_parm = '&amp;Qtmp=admin'; // TODO: Lang: Log in
    if (@$post_vars['text'] && empty($cookie_vars[$session_name])) {
    $exit_mesg = "<html><body>{$auth['Enable Cookies']}</body></html>";
    } else { // TODO: embedded?
    if ($mesg == $auth['Unauthorized']) { $mesg = ''; }
    if ($badpw && !empty($mesg)) { $mesg = "$mesg<br />\n"; }
    $exit_mesg = <<<EOT
    <html><head><title>Qdig Login</title></head><body><div id='qdig-login'>{$mesg}Enter a username and password.
    <form name='loginform' action='$std_uri$adm_parm' method='post' style='margin:0px;' >User Name:<br /><input
    name='AUTH_USER' type='text' id='user' class='inputbox' value=''><br />Password:<br /><input
    name='AUTH_PW' type='password' class='inputbox' value=''><br /><div class='formbuttons'><input
    type='submit' name='post' value='{$auth['Log in']}' accesskey='s' /> <input
    type='submit' name='cancel' value='{$auth['Cancel']}' accesskey='c'
    /></div></form><script language='javascript' type='text/javascript'><!--
    document.loginform.user.focus() //--></script></body></div></html>
    EOT;
    }
    } else {
    if (!empty($users_array)) {
    @header("WWW-Authenticate: Basic realm=\"{$auth['realm']}\", stale=FALSE");
    }
    $exit_mesg = "<html><body>$mesg"
    .'<br />'."<a href='$std_uri'"." title='{$auth['Back to gallery']}'>"
    ."{$auth['Back to gallery']}</a>".'</body></html>';
    }
    header("HTTP/1.0 401 Unauthorized");
    exit($exit_mesg);
    } // End authorize()

    /**
    * Edit the image's caption.
    */
    function editCaption($auth) {
    global $post_vars, $caption, $fs_base_path, $captions_root, $pwd, $reqd_image,
    $touch_captions, $qdig_url, $server_vars, $std_uri, $caption;
    $redir_uri = substr("$qdig_url?{$server_vars['QUERY_STRING']}", 0, -11);
    if (@$post_vars['cancel'] == ' Cancel ') {
    header("Location: $redir_uri"); exit; }
    if (@$post_vars['text']
    // && !preg_match('%^(?:[[:print:]])*$%xs', $post_vars['text']))
    && !preg_match('%^(?:[\x09\x0A\x0D\x20-\x7E])*$%xs', $post_vars['text']))
    {
    securityExit('Text must be printable.');
    }
    authorize($auth);
    if (strlen(@$post_vars['text']) > @$caption['size_limit']) {
    securityExit('Too much text.'); }
    $hta_path = cleanPath($fs_base_path.$captions_root.'.htaccess');
    $hta_path = substr($hta_path, 1);
    if (!file_exists($hta_path) && $fp = @fopen($hta_path, "w")) {
    fwrite($fp, "Order Deny,Allow\nDeny from all\n");
    fclose($fp);
    }
    $cap_ed_path = cleanPath($fs_base_path.$captions_root.$pwd.'/'.$reqd_image['file']).'.txt';
    $cap_ed_path = substr($cap_ed_path, 1);
    $adm_parm = ''; $text = '';
    if (@is_file($cap_ed_path)) {
    $fh = fopen($cap_ed_path, 'r');
    $text = fread($fh, filesize($cap_ed_path));
    fclose($fh);
    } elseif ($touch_captions == TRUE) {
    touch($cap_ed_path);
    fixPerms($cap_ed_path);
    }
    if (@$post_vars['post'] == $auth['Save'] && isset($post_vars['text'])) {
    if ($post_vars['text'] == '') {
    if (@unlink($cap_ed_path)) {
    $mesg_parm = '&Qtmp=DeleteSuccess'; // TODO Do something with these.
    } else {
    $mesg_parm = '&Qtmp=DeleteUnable';
    }
    } elseif ($post_vars['text'] != $text) {
    $cap_ed_dir = dirname($cap_ed_path);
    $sfsg = ($fh = fopen("$cap_ed_path,new", 'w'));
    $sfsg = $sfsg && fwrite($fh, stripslashes($post_vars['text']));
    $sfsg = $sfsg && fclose($fh);
    if (@file_exists($cap_ed_path)) $sfsg = $sfsg && unlink($cap_ed_path);
    $sfsg = $sfsg && rename("$cap_ed_path,new", $cap_ed_path);
    fixPerms($cap_ed_path);
    clearstatcache();
    $text = $post_vars['text'];
    if ($sfsg == TRUE) { // So far, so good
    $mesg_parm = '&Qtmp=SaveSuccess';
    } else {
    $mesg_parm = '&Qtmp=SaveUnable';
    }
    } else {
    $mesg_parm = '&Qtmp=SaveUnchanged';
    }
    header("Location: $redir_uri$mesg_parm"); exit;
    } else {
    $adm_parm = '&amp;Qtmp=admin';
    return <<<EOT
    <form name='captionform' action='$std_uri$adm_parm' method='post' style='margin:2px;' ><textarea
    name='text' id='text' rows='5' cols='60' accesskey=',' title='{$caption['lang Caption']}'
    onkeydown='if (event.keyCode==27) event.returnValue=false;'
    >$text</textarea><br /><div class='formbuttons'><input
    type='submit' name='post' value='{$auth['Save']}' accesskey='s' /> <input
    type='submit' name='cancel' value='{$auth['Cancel']}' accesskey='c'
    /></div></form><script language='javascript' type='text/javascript'><!--
    document.captionform.text.focus() //--></script>
    EOT;
    }
    } // End editCaption()

    /*
    +---------+
    | Logic |
    +---------+
    */

    /**
    * Fix $get_vars. ? can be used in place of & as a separator.
    */
    // Disallow some special characters in the query string.
    if (preg_match('/(%00|%3c|<)/i', $server_vars['QUERY_STRING'])
    || preg_match('/\\\\0/', @$get_vars['Qwd'])) {
    securityExit('Invalid request.'); }
    // Disallow wildcard characters in the query string.
    $qs = urldecode($server_vars['QUERY_STRING']);
    if (strpos('X'.$qs, '*') || strpos('X'.$qs, '\..')) {
    securityExit('Invalid request.'); }
    if (strpos('X'.$server_vars['QUERY_STRING'], '?')) {
    $get_vars = fixGets($get_vars); }
    $gv = implode('', $get_vars); $gv = urldecode($gv);
    if (strpos('X'.$gv, '?') || strpos('X'.@$get_vars['Qif'], '/')
    || ($ignore_dotfiles == TRUE && !empty($get_vars['Qif'])
    && @$get_vars['Qif'][0] == '.')) {
    securityExit('Invalid request.'); }

    /**
    * Produce an image if e.g. ?Qimg=cam-icon
    */
    if (@$get_vars['Qimg'] == 'cam-icon') { cam_icon(); die(); }
    if (@$get_vars['Qimg'] == 'clear-dot') { clear_dot(); die(); }

    /**
    * Set the filesystem and URL base paths
    */
    // If either one is a subdirectory it can automatically set the other.
    if (!empty( $url_base_path)
    && empty($fs_base_path)
    && !preg_match('!^/!', $url_base_path))
    {
    $fs_base_path = $url_base_path;
    } elseif (!empty( $fs_base_path)
    && empty($url_base_path)
    && !preg_match('!^/!', $fs_base_path))
    {
    $url_base_path = $fs_base_path;
    }
    // Come up with a default URL base path.
    if (preg_match('!^/$!', $qdig_url)) {
    $default_url_base_path = '';
    } elseif (preg_match('!/$!', $qdig_url)) {
    $default_url_base_path = substr($qdig_url, 0, -1); // TODO Pick one.
    // $default_url_base_path = dirname($qdig_url.'X');
    } else {
    $default_url_base_path = dirname($qdig_url);
    }
    // Set a normalized URL base path.
    if (empty($url_base_path)) {
    $url_base_path = $default_url_base_path;
    } elseif (!preg_match('!/!', $url_base_path)
    || preg_match('!^\\./!', $url_base_path)) {
    $url_base_path = $default_url_base_path.'/'.$url_base_path;
    } elseif (preg_match('!^\\.\\./!', $url_base_path)) {
    $url_base_path = dirname($default_url_base_path).'/'.$url_base_path;
    }
    $url_base_path = strstr(urlPath($url_base_path), '/').'/';
    // Set a normalized filesystem base path
    // TODO: Win32 compatible? (Sure hope so!)
    if (empty($fs_base_path)) {
    $base_dir = realpath(getcwd());
    $fs_base_path = $base_dir.'/';
    } else {
    $base_dir = realpath($fs_base_path);
    $orig_wd = getcwd();
    chdir($base_dir);
    }

    /**
    * $chroot_dir sanity check
    */
    if (!empty($chroot_dir)) {
    $rootdir = cleanPath($chroot_dir);
    } else {
    $rootdir = '.';
    $chroot_dir = '';
    }
    if (!@is_dir($rootdir)) {
    exit("<html>\n <body>
    Chroot directory <b>$chroot_dir</b> doesn't exist.<br />
    Check gallery script configuration.\n </body>\n</html>");
    }

    /**
    * 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] == '.')) { // Switch to preg_match?
    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);

    /**
    * 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))) // TODO: s/b $qdig_files_topdir?
    {
    $dir_nav['prefs_ena'] == FALSE;
    }

    /**
    * Build style strings for color settings.
    */
    // Gallery table background color
    $qdig_bg_clr_attr = (!empty($gallery_table_bg_clr))
    ? ' bgcolor="'.$gallery_table_bg_clr.'"'
    : '';
    $qdig_table_align_attr = (!empty($gallery_table_align))
    ? ' align="'.$gallery_table_align.'"'
    : '';
    // Image table background color
    $img_tbl_bg_clr_attr = (!empty($image_table_bg_clr))
    ? ' bgcolor="'.$image_table_bg_clr.'"'
    : '';
    // Grayed-out text color
    $styl_grayout = (!empty($grayout_color))
    ? 'class="qdig-grayout" style="color:'.$grayout_color.';"'
    : 'class="qdig-grayout"';

    /**
    * Check for Image Magick or GD
    */
    // Turn them off if they're not likely to work.
    $user_GD_setting = $convert_GD_ver; // For diag messages
    if ($convert_GD == TRUE && ! $convert_GD_ver = gdVersion()) {
    $convert_GD = FALSE;
    }
    if ($convert_magick == TRUE
    && ($safe_mode == TRUE
    || ($platform != 'Win32' && ! is_file($convert_cmd))))
    {
    $convert_magick = FALSE;
    }
    // Prefer GD on Win32, otherwise prefer IM.
    if ($convert_magick == TRUE && $convert_GD == TRUE) {
    ($platform == 'Win32')
    ? $convert_magick = FALSE
    : $convert_GD = FALSE;
    }
    $nice_parts = explode(' ', $nice_command);
    if ($convert_nice == TRUE
    && ($platform == 'Win32' || ! is_file($nice_parts['0'])))
    {
    $convert_nice = FALSE;
    }
    if ($convert_nice == TRUE) { $convert_cmd = $nice_command.$convert_cmd; }

    /**
    * Get the array of image filenames.
    */
    // Exclude background images.
    $logo_array = explode('/', $header['css_logo_url']);
    $bg_img_array = explode('/', $header['css_bg_img_url']);
    $excl_imgs[] = end($logo_array);
    $excl_imgs[] = end($bg_img_array);
    $imgs = getImageFilenames($pwd);

    /**
    * Set some default widths
    */
    if (isset($default_nav_width)) {
    if (empty($thmb_row['maxwidth']))
    $thmb_row['maxwidth'] = $default_nav_width;
    if (empty($upr_nav['width']))
    $upr_nav['width'] = round($default_nav_width * 0.95);
    if (empty($lwr_nav['width']))
    $lwr_nav['width'] = round($default_nav_width * 0.95);
    }

    /**
    * Determine if this is s thumbs-only directory
    */
    if (@$get_vars['Qtmp'] == 'thumbs') { // Force thumb dir
    $thumbs['t_o_imgs'] = 1;
    $thumbs['thm_only'] = TRUE;
    unset($get_vars['Qif']);
    }
    if ($thumbs['thm_only'] == TRUE) { // TODO Test.
    $factor = (100 - ((100 - $thmb_row['softwrap']) / 2)) / 99.3;
    $row_width = (($thmb_row['maxwidth'] / $cnvrt_thmb['size'])
    * $thumbs['t_o_rows'] * $thumbs['t_o_h2w']);
    if ($row_width < 1 ) { $row_width = 1; $factor = 1; }
    if ($thumbs['t_o_imgs'] < 1) { $thumbs['t_o_imgs'] = 1; }
    if (count($imgs) > ($row_width * $factor)
    || count($imgs) > $thumbs['t_o_imgs'])
    {
    $img_link['dir_thumbonly'] = TRUE;
    if (!isset($get_vars['Qif']) && !empty($imgs)) {
    $get_vars['Qtmp'] = 'thumbs';
    }
    }
    }

    // Thumbs-only page (experimental) TODO: Omit for stable release?
    if (@$get_vars['Qtmp'] == 'thumbs') {
    $header['css_thm_hl_w'] = '0px';
    $header['title_cntr'] = FALSE;
    $dir_nav['cntr_ena'] = FALSE;
    $header['img_name'] = FALSE;
    $header['css_thm_opacity'] = '100';
    $omit_image = TRUE;
    //$dir_nav['enable'] = true;
    $ctrl_bar['enable'] = FALSE;
    $upr_nav['enable'] = FALSE;
    $lwr_nav['enable'] = FALSE;
    //$footer['omit'] = TRUE;
    }
    // Image is a popup target (experimental).
    if (@$get_vars['Qtmp'] == 'popup') {
    $header['nav_links'] = FALSE;
    //$omit_navlinks = TRUE;
    //$omit_image = TRUE;
    //$footer['omit'] = TRUE;
    }

    /**
    * Establish Image Conversion and Caption Paths
    */
    $cnvrt_path = cleanPath($cnvrtd_files_root.$pwd.'/');
    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 ||
    ($admin['link_ena'] == TRUE && $auth['enable'] == 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)
    {
    $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);
    fixPerms($warning_fn);
    } elseif ((!($dperms == '777' && $extra_paranoia == FALSE)
    && $wperms == 7 || $wperms == 6 || $wperms == 3 || $wperms == 2))
    { // world-writable
    $setting = '<span style="color:blue;">$check_security</span>';
    $install_txt = '<a href="http://cvs.sourceforge.net/viewcvs.py/qdig/qdig/INSTALL.txt?rev=1.20"'
    ."\n".' title ="INSTALL.txt file from CVS">INSTALL.txt</a>';
    $exit_mesg = <<<EOT
    <html><head><title>Security Warning</title></head><body>
    <h3 style="color:black; background-color:pink; width:450px;">Check
    security.</h3><div style='width:450px;'>
    <p>The <b>$path</b> directory appears to be world-writable.</p>
    <p>See $install_txt for information about setting the directory's
    permissions 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.</p>
    </div>
    </body></html>
    EOT;
    exit($exit_mesg);
    }
    }
    }

    /**
    * Are converted images writable or readable?
    */
    $path_writable = (is_dir($cnvrt_path) && is_writable($cnvrt_path));
    if (($convert_magick == TRUE || $convert_GD == TRUE)
    && $path_writable == TRUE)
    {
    $convert_writable = TRUE;
    } else {
    $convert_writable = FALSE;
    $convert_magick = FALSE; // Turn off if path isn't writable
    $convert_GD = FALSE;
    }
    if (is_dir($cnvrt_path)
    && ($is_readable_disa == TRUE || is_readable($cnvrt_path)))
    {
    $convert_readable = TRUE;
    } else {
    $convert_readable = FALSE;
    }

    /*
    * Get the requested view
    */
    if (isset($get_vars['Qiv'])
    && strlen($get_vars['Qiv']) < 10
    && preg_match('!^(thumbs|name|num|none)$!', $get_vars['Qiv']))
    {
    $reqd_view = $get_vars['Qiv'];
    }
    if ($thumbs['enable'] == FALSE) {
    if ($reqd_view == 'thumbs') { $reqd_view = $txtlinks_default; }
    $thumbs['default'] = FALSE;
    }
    if (! isset($reqd_view)
    && $convert_readable == TRUE
    && $thumbs['default'] == TRUE)
    {
    $reqd_view = 'thumbs';
    }
    if ($thumbs['onfly'] == TRUE
    && isset($get_vars['Makethumb'])
    && $convert_writable == TRUE)
    {
    $reqd_view = 'thumbs';
    }
    if (! isset($reqd_view)) { $reqd_view = $txtlinks_default; }
    if ($reqd_view == 'text' || $reqd_view == 'name' || $reqd_view == 'num') {
    $thmbs_ena = FALSE;
    }
    if ($reqd_view == 'thumbs'
    && $convert_readable == TRUE
    && $thumbs['enable'] == TRUE)
    {
    $thmbs_ena = TRUE;
    }
    $namelinks_ena = ($reqd_view == 'name');
    if ($reqd_view == 'none') {
    $thmbs_ena = FALSE;
    $no_lnks_view = TRUE;
    } else {
    $no_lnks_view = FALSE;
    }
    if (!empty($reqd_img_size_tmp)) {
    $fs = end($cnvrt_size);
    if ($reqd_img_size_tmp == $fs['label'] && $reqd_view == 'name') {
    $thmbs_ena = FALSE;
    $no_lnks_view = TRUE;
    }
    }
    if (!isset($thmbs_ena)) { $thmbs_ena = FALSE; }
    if ($thmbs_ena == FALSE) {
    $img_link['dir_thumbonly'] = FALSE;
    $omit_image = FALSE;
    if (@$get_vars['Qtmp'] == 'thumbs') {
    unset($get_vars['Qtmp']);
    }
    }

    // Store the requested image file (name / num), directory, and view, and size.
    $reqd_image = getReqdImage();
    $reqd_image['pwd'] = $pwd;
    $reqd_image['pwd_url'] = $pwd_url;
    $reqd_image['view'] = $reqd_view;
    $reqd_image['size'] = $reqd_img_size;

    // Generate a $std_uri (self-referring link with query string) and do some
    // things that require it.
    $reqd_file = rawurlencode(@$reqd_image['file']); // TODO Allow tildes?
    $reqd_pwd = urlPath($reqd_image['pwd']);
    $std_uri = $qdig_url.'?'.$extra_param.'Qwd='.$reqd_pwd.'&amp;Qif='
    .$reqd_file.'&amp;Qiv='.$reqd_image['view'].'&amp;Qis='.$reqd_image['size'];
    // Produce the password-crypting page if requested.
    if (@$get_vars['Qtmp'] == 'crypt') { cryptPw(); }
    // Produce the caption-editing link.
    if ($admin['link_ena'] == TRUE) { @$copyright['txt'] .= adminLink($admin); }
    // Create the the caption-editing form if requested.
    if (@$get_vars['Qtmp'] == 'admin') { $caption['editform'] = editCaption($auth); }

    // Turn off $thumbs['onfly'] if this is an embedded gallery...
    if ($header['force_ena'] == TRUE && $thumbs['onfly'] == TRUE) {
    $thumbs['onfly'] = TRUE;
    } elseif ($header['force_disa'] == TRUE || $is_included == TRUE) {
    $thumbs['onfly'] = FALSE;
    }
    // ...if the image is a singleton...
    if ($cnvrt_thmb['single'] == TRUE && count($imgs) < 2) {
    $thumbs['onfly'] = FALSE;
    }
    // ...or if the server is in Safe Mode.
    // TODO Necessary?
    if ($safe_mode == TRUE) { $thumbs['onfly'] = FALSE; }

    /**
    * Create a single thumb if it's been requested.
    */
    if (isset($get_vars['Makethumb'])) {
    $imgs = array($reqd_image['file']); // Reset the image list.
    $cnvrt_thmb['single'] = TRUE;
    $thumbs_msg = createThumbs($cnvrt_thmb);
    $name = $cnvrt_path.'/'.$cnvrt_thmb['prefix'].$imgs[0];
    // Get the MIME type for the header.
    if (! $img_size = GetImageSize($name)) {
    header('Content-type: image/gif');
    header('Content-length: 43');
    echo base64_decode(
    'R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==');
    exit;
    }
    $content_types[1] = 'image/gif';
    $content_types[2] = 'image/jpeg';
    $content_types[3] = 'image/png';
    $content_types[6] = 'image/bmp';
    $content_type = $content_types[$img_size[2]];
    $content_length = filesize($name);
    // Send headers.
    header("Content-Length: $content_length");
    header("Content-Type: $content_type");
    // Send the image data and stop the script.
    $fp = fopen($name, 'rb');
    fpassthru($fp);
    exit;
    }

    /**
    * Include the metadata script.
    */
    $qdig_exif_file = dirname(__FILE__).'/qdig-metadata.php';
    if ($exif['ena'] && @is_file($qdig_exif_file)) {
    include_once('qdig-metadata.php'); }

    /**
    * Determine if we need a Control Bar.
    */
    if ($ctrl_bar['vw_ctrl'] == FALSE && $ctrl_bar['def_size'] == FALSE) {
    $ctrl_bar['enable'] = FALSE;
    }
    if ($ctrl_bar['enable'] == FALSE) {
    $dir_nav['prefs_ena'] = FALSE;
    }
    if ($dir_nav['enable'] == FALSE && $ctrl_bar['enable'] == TRUE) {
    $ctrl_bar['ena'] = TRUE;
    $dir_nav['prefs_ena'] = FALSE;
    }

    /**
    * Determine if we need a display area.
    */
    if (!empty($site_link['url']) || $qdig_homelink['ena'] == FALSE || !empty($imgs)) {
    $display_area = TRUE;
    } else {
    $display_area = FALSE;
    }

    /**
    * Create thumbnail image(s) if necessary.
    */
    if ($thumbs['onfly'] == FALSE) { $thumbs_msg = createThumbs($cnvrt_thmb); }

    /**
    * Create alternate image sizes.
    */
    $resize_msg = '';
    if ($disp_size[0] == TRUE
    && (($cnvrt_alt['indiv'] == FALSE
    || $upr_nav['tmp_size'] == TRUE
    || $lwr_nav['tmp_size'] == TRUE)
    || $reqd_img_size == $cnvrt_size[0]['label']))
    {
    $resize_msg .= resizeImage($cnvrt_size[0]);
    }
    if ($disp_size[1] == TRUE
    && (($cnvrt_alt['indiv'] == FALSE
    || $upr_nav['tmp_size'] == TRUE
    || $lwr_nav['tmp_size'] == TRUE)
    || $reqd_img_size == $cnvrt_size[1]['label']))
    {
    $resize_msg .= resizeImage($cnvrt_size[1]);
    }
    if ($disp_size[2] == TRUE
    && (($cnvrt_alt['indiv'] == FALSE
    || $upr_nav['tmp_size'] == TRUE
    || $lwr_nav['tmp_size'] == TRUE)
    || $reqd_img_size == $cnvrt_size[2]['label']))
    {
    $resize_msg .= resizeImage($cnvrt_size[2]);
    }
    if ($disp_size[3] == TRUE
    && (($cnvrt_alt['indiv'] == FALSE
    || $upr_nav['tmp_size'] == TRUE
    || $lwr_nav['tmp_size'] == TRUE)
    || $reqd_img_size == $cnvrt_size[3]['label']))
    {
    $resize_msg .= resizeImage($cnvrt_size[3]);
    }
    if ($disp_size[4] == TRUE
    && (($cnvrt_alt['indiv'] == FALSE
    || $upr_nav['tmp_size'] == TRUE
    || $lwr_nav['tmp_size'] == TRUE)
    || $reqd_img_size == $cnvrt_size[4]['label']))
    {
    $resize_msg .= resizeImage($cnvrt_size[4]);
    }

    /**
    * Produce diagnostic messages.
    */
    if ($diag_messages == TRUE) {
    $diag_mesgs = "<p><small>\n<b>{$lang['Diag Messages']}:</b><br />\n";
    $server_sw = $server_vars['SERVER_SOFTWARE'];
    if (preg_match('/Fedora/', $server_sw)) {
    $server_sw .= "<br />\nFedora Core 3 or later may require
    <a href='http://qdig.sourceforge.net/Support/FedoraSELinux'>adjusting the SELinux policy</a> for Apache.";
    }
    if (@file_exists($qdig_files) && @is_dir($qdig_files)) {
    $qdig_files_exists = TRUE;
    $qdig_files_perms = decoct(fileperms($qdig_files)) % 10000;
    } else {
    $qdig_files_exists = FALSE;
    }
    if (@file_exists($cnvrtd_files_root) && @is_dir($cnvrtd_files_root)) {
    $cnvrtd_root_exists = TRUE;
    $cnvrtd_root_perms = decoct(fileperms($cnvrtd_files_root)) % 10000;
    } else {
    $cnvrtd_root_exists = FALSE;
    }
    if (@file_exists($captions_root) && @is_dir($captions_root)) {
    $captions_root_exists = TRUE;
    $captions_root_perms = decoct(fileperms($captions_root)) % 10000;
    } else {
    $captions_root_exists = FALSE;
    }
    if ($convert_nice == TRUE) {
    $convert_tmp = explode(' ', $convert_cmd);
    $convert_cmd = end($convert_tmp);
    }
    if (@file_exists($convert_cmd)) {
    $convert_cmd_exists = TRUE;
    $convert_cmd_perms = decoct(fileperms($convert_cmd)) % 10000;
    } else {
    $convert_cmd_exists = FALSE;
    }
    $diag_mesgs .= "Qdig version is $qdig_version,&nbsp; "
    .'PHP Version is '.phpversion()
    .trueFalse(ini_get('safe_mode'), ' with <a href="http://qdig.sourceforge.net/Support/PHPSafeMode"'
    .' title="Qdig And PHP Safe Mode">Safe Mode enabled</a>', '').' '.'on '.$platform
    .@trueFalse(function_exists('exif_read_data'), ',&nbsp; EXIF capable', ',&nbsp; no EXIF')."<br />\n"
    .'Server Software is '.$server_sw."<br />\n"
    .'<span style="white-space:nowrap;">'
    .'$qdig_url is <a href="'.$qdig_url.'" title="Gallery URL (w/o query string)">'.$qdig_url.'</a>'."<br />\n"
    .'$php_self is '.$php_self."<br />\n"
    .'$script_name is '.$script_name."<br />\n"
    .'Query string is '.@trueFalse(strlen($server_vars['QUERY_STRING']) > 64, '<br />&nbsp; ', '')
    .@trueFalse($server_vars['QUERY_STRING'],$server_vars['QUERY_STRING'], ' (empty)')."<br />\n"
    .'$pwd is '.$pwd.',&nbsp; '
    .'$chroot_dir is '.@trueFalse($chroot_dir, $chroot_dir, '(empty)')."<br />\n"
    .'$is_included is '.@trueFalse($is_included).',&nbsp; '
    .'$header[\'force_ena\'] / [\'force_disa\'] are '.@trueFalse($header['force_ena']).' / '
    .@trueFalse($header['force_disna'])."<br />\n"
    .@trueFalse($url_base_path, '$url_base_path is '.$url_base_path."<br />\n", '')
    .@'$fs_base_path is '.$fs_base_path."<br />\n"
    .@trueFalse($base_dir, '$base_dir is '.$base_dir, '$base_dir (realpath($fs_base_path)) is empty')."<br />\n"
    .'$qdig_files is '.@trueFalse($qdig_files, $qdig_files, '(empty)').'&nbsp; '
    .@trueFalse($qdig_files_exists, "(exists, $qdig_files_perms perms)", "(doesn't exist)")."<br />\n"
    .'$cnvrtd_files_root is '.@trueFalse($cnvrtd_files_root, $cnvrtd_files_root, '(empty)').'&nbsp; '
    .@trueFalse($cnvrtd_root_exists, "(exists, $cnvrtd_root_perms perms)", "(doesn't exist)")."<br />\n"
    .'$captions_root is '.@trueFalse($captions_root, $captions_root, '(empty)').'&nbsp; '
    .@trueFalse($captions_root_exists, "(exists, $captions_root_perms perms)", "(doesn't exist)")."<br />\n"
    .'$convert_magick is '.trueFalse($convert_magick).',&nbsp; '
    .'$convert_cmd is '.@trueFalse($convert_cmd, $convert_cmd, '(empty)').'&nbsp; '
    .@trueFalse($convert_cmd_exists, "(exists, $convert_cmd_perms perms)", "(possibly doesn't exist)")
    .@trueFalse($convert_nice, '&nbsp; (nice)', '')."<br />\n"
    .'$convert_GD is '.trueFalse($convert_GD).',&nbsp; ';
    if (!empty($user_GD_setting)) {
    $ext_loaded = '';
    $overridden = '';
    if (! extension_loaded('gd')) {
    $ext_loaded = ' (extension not loaded)';
    }
    if ($user_GD_setting != 1 && $convert_GD_ver == 1) {
    $overridden = ' (reset to 1)';
    }
    $diag_mesgs .= "GD version is set to"
    ." $user_GD_setting$overridden$ext_loaded,&nbsp; ";
    } else {
    $diag_mesgs .= ($gdv = gdVersion())
    ? "GD version $gdv detected,&nbsp; "
    : "GD is not detected,&nbsp; ";
    }
    $diag_mesgs .= (preg_match('/phpinfo/', ini_get('disable_functions')))
    ? "phpinfo() disabled"
    : "phpinfo() enabled";
    $diag_mesgs .= (!ini_get('safe_mode') && $memory_limit = @ini_get('memory_limit'))
    ? ',&nbsp; '.$memory_limit." mem. limit<br />\n"
    : "<br />\n";
    $diag_mesgs .= '$convert_writable is '.trueFalse($convert_writable).',&nbsp; '
    .'$convert_readable is '.trueFalse($convert_readable).',&nbsp; '
    .'$reqd_view is '.$reqd_view."<br />\n"
    .'$thmbs_ena is '.trueFalse($thmbs_ena).',&nbsp; '
    .'$namelinks_ena is '.trueFalse($namelinks_ena).',&nbsp; '
    .'$check_security is '.trueFalse($check_security)."<br />\n"
    .'$is_readable_disa is '.trueFalse($is_readable_disa).',&nbsp; '
    .'$file_exists_disa is '.trueFalse($file_exists_disa).',&nbsp; '
    .'$compat_quote is '.trueFalse($compat_quote)."<br /></span>\n";
    }

    /*
    +----------+
    | Output |
    +----------+
    */

    /**
    * Echo an HTML header if the script is running stand-alone.
    */
    echo htmlHeader($header);

    /**
    * Image is a popup target (experimental).
    */
    if (@$get_vars['Qtmp'] == 'popup') {
    echo displayImage($reqd_image, $img_sz_labels);
    echo footerRow();
    echo htmlFooter($header);
    exit();
    }

    /**
    * Open the Qdig gallery table.
    */
    // For injecting some output ahead of the gallery
    if (!ini_get('register_globals')) { echo $pre_gallery; }
    $gallery_size = gallerySize();
    $size_attr = $gallery_size['size_attr'];
    echo <<<EOT

    <!-- Begin Qdig Image Gallery v$qdig_version -->
    <table summary="{$lang['Image Gallery']}" id="qdig"$qdig_bg_clr_attr
    cellpadding="0" cellspacing="0" border="0" $size_attr$qdig_table_align_attr>
    <tr>\n
    EOT;

    /**
    * Directory Navigation
    */
    $dirnav_out = dirNav($dir_nav);
    echo $dirnav_out['str'];

    /**
    * Control Bar
    */
    if ($reqd_img_size_tmp == 'Ctrl') { $dirnav_out['ctrl_bar_ena'] = TRUE; }
    // Show it if it's enabled
    if ($ctrl_bar['enable'] == TRUE && $dirnav_out['ctrl_bar_ena'] == TRUE) {
    // Only open Control Bar if appropriate
    if (count($imgs) > 1)
    {
    $control_bar_on = TRUE;
    echo <<<EOT
    \n <!-- Begin Qdig control bar -->
    <td colspan="2">
    <table summary="{$lang['Control Bar']}"
    width="100%" cellpadding="0" cellspacing="0">
    <tr>\n
    EOT;
    } else {
    $control_bar_on = FALSE;
    }
    // Control for selecting links view.
    if ($ctrl_bar['vw_ctrl'] == TRUE ) {
    echo controlView($ctrl_links_mesg);
    }
    // Size preferences
    if ($ctrl_bar['def_size'] == TRUE ) {
    echo controlSize($img_sz_labels['ctrl']);
    }
    // Close Control Bar if open
    if ($control_bar_on == TRUE) {
    echo <<<EOT
    </tr>
    </table>
    </td>
    </tr><tr>
    <!-- End Qdig control bar -->\n
    EOT;
    }
    }
    // End Control Bar

    /**
    * Sidebar for Text Image Links if appropriate
    */
    if ($no_lnks_view == FALSE && ! @$omit_navlinks == TRUE) {
    $sidelinks = sideBar($namelinks_ena, $thmbs_ena,
    $sidebar['bg_clr'], $sidebar['margin'], $sidebar['height']);
    echo $sidelinks['str'];
    }
    // End Sidebar

    /**
    * Main qdig image display area
    */
    if ($display_area == TRUE) {
    $img_tbl_width_attr = (@$sidelinks['str'] == TRUE)
    ? ' '.$gallery_size['size_attr']
    : '';
    echo <<<EOT
    \n <!-- Begin Qdig gallery image display area -->
    <td$img_tbl_bg_clr_attr$img_tbl_width_attr>
    <table summary="{$lang['Img Disp Area']}"
    width="100%" cellpadding="2" cellspacing="0" border="0">
    <tr><td>\n\n
    EOT;
    } elseif (empty($subdirs) && $reqd_image['pwd'] == $rootdir) {
    echo <<<EOT
    <td$img_tbl_bg_clr_attr>
    <table summary="{$lang['Empty gallery']}"
    width="100%" cellpadding="2" cellspacing="0" border="0">
    <tr><td height="{$gallery_size['height']}">
    <br />
    <div style="text-align:center;">{$lang['Empty gallery']}</div>
    </td></tr><tr><td>\n
    EOT;
    }

    // Show Text Numeral or Thumbnail Links to all of the images (above image).
    if (!isset($sidelinks['sb_on'])
    && $no_lnks_view == FALSE
    && ! @$omit_navlinks == TRUE
    && $img_links['above'] == TRUE)
    {
    echo displayImageLinks($thmb_row, $nmrl_row);
    }

    // Show an Upper Navigation Row, above the displayed image.
    echo navRow($upr_nav, 'upper');

    // Display the requested image or else the first image.
    echo displayImage($reqd_image, $img_sz_labels);

    // Lower Navigation Row, below the displayed image.
    echo navRow($lwr_nav, 'lower');

    // Show Text Numeral or Thumbnail Links to all of the images (below image).
    if (!isset($sidelinks['sb_on'])
    && $no_lnks_view == FALSE
    && ! @$omit_navlinks == TRUE
    && $img_links['above'] == FALSE)
    {
    echo displayImageLinks($thmb_row, $nmrl_row);
    }

    // Gallery Footer Row (site link / copyright / qdig home link)
    echo footerRow();

    if ($display_area == TRUE ) {
    echo <<<EOT
    \n </td></tr></table></td>
    <!-- End Qdig gallery image display area -->\n
    EOT;
    } elseif (empty($subdirs) && $reqd_image['pwd'] == $rootdir) { // TODO s/b top dir?
    echo "\n".' </td></tr></table></td>';
    }
    // End main qdig image display area.

    /**
    * Echo messages, if any.
    */
    if (!empty($thumbs_msg) || !empty($resize_msg) || !empty($diag_mesgs)) {
    if (!empty($diag_mesgs)){
    $mtime = microtime();
    $mtime = explode(' ',$mtime);
    $end_time = $mtime[1] + $mtime[0];
    $exec_time = round(($end_time - $start_time), 3) * 1000;
    $max_time = ini_get('max_execution_time');
    $diag_mesgs .= "Execution time is $exec_time milliseconds, max_execution_time is $max_time seconds\n"
    ."</small></p>\n";
    }
    $msgs = "\n <tr><td colspan='2'>\n <div style='text-align:left;'>";
    $msgs .= "\n <!-- messages -->\n";
    $msgs .= $resize_msg;
    $msgs .= @$thumbs_msg;
    $msgs .= $diag_mesgs;
    $msgs .= " </div>\n </td></tr>\n";
    } else {
    $msgs = '';
    }

    /**
    * Close the Qdig gallery table.
    */
    $tag = (empty($imgs) && !empty($subdirs)) ? '</td>' : '';
    echo <<<EOT
    \n $tag</tr>$msgs</table>
    <!-- End Qdig Image Gallery v$qdig_version -->\n\n
    EOT;
    // Display metadata tables, if requested.
    if ($exif['ena'] && @$get_vars['Qtmp'] == 'EXIF' && function_exists('exifDump')) {
    echo exifDump($exif); }

    // For injecting some output after the gallery
    if (!ini_get('register_globals')) { echo $post_gallery; }

    /**
    * Echo an HTML Footer if the script is running stand-alone.
    */
    echo htmlFooter($header);

    // Leave the working dir and error reporting the way we found them.
    if (isset($orig_wd)) { chdir($orig_wd); }
    error_reporting($orig_err_rep_level);

    /* vim: set noexpandtab tabstop=4 shiftwidth=4: */

    ---
    PHP Version 5.2.9

    System Windows NT MSI601 5.1 build 2600
    Build Date Feb 25 2009 15:51:41
    Configure Command cscript /nologo configure.js "--enable-snapshot-build" "--enable-debug-pack" "--with-snapshot-template=d:\php-sdk\snap_5_2\vc6\x86\template" "--with-php-build=d:\php-sdk\snap_5_2\vc6\x86\php_build" "--with-pdo-oci=D:\php-sdk\oracle\instantclient10\sdk,shared" "--with-oci8=D:\php-sdk\oracle\instantclient10\sdk,shared"
    Server API Apache 2.0 Handler
    Virtual Directory Support enabled
    Configuration File (php.ini) Path C:\WINDOWS
    Loaded Configuration File D:\xampp171\php\php.ini
    Scan this dir for additional .ini files (none)
    additional .ini files parsed (none)
    PHP API 20041225
    PHP Extension 20060613
    Zend Extension 220060519
    Debug Build no
    Thread Safety enabled
    Zend Memory Manager enabled
    IPv6 Support enabled
    Registered PHP Streams php, file, data, http, ftp, compress.zlib, zip
    Registered Stream Socket Transports tcp, udp
    Registered Stream Filters convert.iconv.*, string.rot13, string.toupper, string.tolower, string.strip_tags, convert.*, consumed, zlib.*

    This program makes use of the Zend Scripting Language Engine:
    Zend Engine v2.2.0, Copyright (c) 1998-2009 Zend Technologies
    with Zend Extension Manager v1.2.0, Copyright (c) 2003-2007, by Zend Technologies
    with Zend Optimizer v3.3.3, Copyright (c) 1998-2007, by Zend Technologies


    PHP Credits
    Configuration
    PHP CoreDirective Local Value Master Value
    allow_call_time_pass_reference On On
    allow_url_fopen On On
    allow_url_include Off Off
    always_populate_raw_post_data Off Off
    arg_separator.input & &
    arg_separator.output &amp; &amp;
    asp_tags Off Off
    auto_append_file no value no value
    auto_globals_jit On On
    auto_prepend_file no value no value
    browscap D:\xampp171\php\browscap\browscap.ini D:\xampp171\php\browscap\browscap.ini
    default_charset no value no value
    default_mimetype text/html text/html
    define_syslog_variables Off Off
    disable_classes no value no value
    disable_functions no value no value
    display_errors On On
    display_startup_errors Off Off
    doc_root no value no value
    docref_ext no value no value
    docref_root no value no value
    enable_dl On On
    error_append_string no value no value
    error_log no value no value
    error_prepend_string no value no value
    error_reporting 6135 6135
    expose_php On On
    extension_dir D:\xampp171\php\ext\ D:\xampp171\php\ext\
    file_uploads On On
    highlight.bg #FFFFFF #FFFFFF
    highlight.comment #FF8000 #FF8000
    highlight.default #0000BB #0000BB
    highlight.html #000000 #000000
    highlight.keyword #007700 #007700
    highlight.string #DD0000 #DD0000
    html_errors On On
    ignore_repeated_errors Off Off
    ignore_repeated_source Off Off
    ignore_user_abort Off Off
    implicit_flush Off Off
    include_path .;D:\xampp171\php\pear\ .;D:\xampp171\php\pear\
    log_errors Off Off
    log_errors_max_len 1024 1024
    magic_quotes_gpc On On
    magic_quotes_runtime Off Off
    magic_quotes_sybase Off Off
    mail.force_extra_parameters no value no value
    max_execution_time 60 60
    max_input_nesting_level 64 64
    max_input_time 60 60
    memory_limit 32M 32M
    open_basedir no value no value
    output_buffering no value no value
    output_handler no value no value
    post_max_size 64M 64M
    precision 12 12
    realpath_cache_size 16K 16K
    realpath_cache_ttl 120 120
    register_argc_argv On On
    register_globals Off Off
    register_long_arrays On On
    report_memleaks On On
    report_zend_debug On On
    safe_mode Off Off
    safe_mode_exec_dir no value no value
    safe_mode_gid Off Off
    safe_mode_include_dir no value no value
    sendmail_from no value no value
    sendmail_path no value no value
    serialize_precision 100 100
    short_open_tag On On
    SMTP localhost localhost
    smtp_port 25 25
    sql.safe_mode Off Off
    track_errors Off Off
    unserialize_callback_func no value no value
    upload_max_filesize 64M 64M
    upload_tmp_dir D:\xampp171\tmp D:\xampp171\tmp
    user_dir no value no value
    variables_order EGPCS EGPCS
    xmlrpc_error_number 0 0
    xmlrpc_errors Off Off
    y2k_compliance On On
    zend.ze1_compatibility_mode Off Off


    apache2handlerApache Version Apache/2.2.11 (Win32) DAV/2 mod_ssl/2.2.11 OpenSSL/0.9.8i PHP/5.2.9
    Apache API Version 20051115
    Server Administrator admin@localhost
    Hostname:Port localhost:80
    Max Requests Per Child: 0 - Keep Alive: on - Max Per Connection: 100
    Timeouts Connection: 300 - Keep-Alive: 5
    Virtual Server No
    Server Root D:/xampp171/apache
    Loaded Modules core mod_win32 mpm_winnt http_core mod_so mod_actions mod_alias mod_asis mod_auth_basic mod_auth_digest mod_authn_alias mod_authn_anon mod_authn_dbd mod_authn_dbm mod_authn_default mod_authn_file mod_authz_dbm mod_authz_default mod_authz_groupfile mod_authz_host mod_authz_user mod_autoindex mod_cache mod_mem_cache mod_cern_meta mod_charset_lite mod_cgi mod_dav mod_dav_fs mod_deflate mod_dir mod_env mod_expires mod_ext_filter mod_headers mod_ident mod_include mod_info mod_isapi util_ldap mod_log_config mod_mime mod_mime_magic mod_negotiation mod_rewrite mod_setenvif mod_speling mod_status mod_unique_id mod_usertrack mod_vhost_alias mod_ssl mod_php5

    Directive Local Value Master Value
    engine 1 1
    last_modified 0 0
    xbithack 0 0


    Apache EnvironmentVariable Value
    UNIQUE_ID SkMJ-8CoAJAAAArEEucAAAD3
    HTTP_USER_AGENT Opera/9.27 (Windows NT 5.1; U; en)
    HTTP_HOST 127.0.0.1
    HTTP_ACCEPT text/html, application/xml;q=0.9, application/xhtml+xml, image/png, image/jpeg, image/gif, image/x-xbitmap, */*;q=0.1
    HTTP_ACCEPT_LANGUAGE en-US,en;q=0.9
    HTTP_ACCEPT_CHARSET iso-8859-1, utf-8, utf-16, *;q=0.1
    HTTP_ACCEPT_ENCODING deflate, gzip, x-gzip, identity, *;q=0
    HTTP_REFERER http://127.0.0.1/xampp/navi.php
    HTTP_CONNECTION Keep-Alive, TE
    HTTP_TE deflate, gzip, chunked, identity, trailers
    PATH C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Program Files\Toshiba\Bluetooth Toshiba Stack\sys\;C:\WINDOWS\system32\WindowsPowerShell\v1.0;C:\Program Files\GNU\gpg4win1.1.4\pub;d:\Program Files\ClawsMail1.19\pub;D:\Program Files\Bitvise Tunnelier
    SystemRoot C:\WINDOWS
    COMSPEC C:\WINDOWS\system32\cmd.exe
    PATHEXT .COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.PSC1
    WINDIR C:\WINDOWS
    SERVER_SIGNATURE <address>Apache/2.2.11 (Win32) DAV/2 mod_ssl/2.2.11 OpenSSL/0.9.8i PHP/5.2.9 Server at 127.0.0.1 Port 80</address>
    SERVER_SOFTWARE Apache/2.2.11 (Win32) DAV/2 mod_ssl/2.2.11 OpenSSL/0.9.8i PHP/5.2.9
    SERVER_NAME 127.0.0.1
    SERVER_ADDR 127.0.0.1
    SERVER_PORT 80
    REMOTE_ADDR 127.0.0.1
    DOCUMENT_ROOT D:/xampp171/htdocs
    SERVER_ADMIN admin@localhost
    SCRIPT_FILENAME D:/xampp171/htdocs/xampp/phpinfo.php
    REMOTE_PORT 1536
    GATEWAY_INTERFACE CGI/1.1
    SERVER_PROTOCOL HTTP/1.1
    REQUEST_METHOD GET
    QUERY_STRING no value
    REQUEST_URI /xampp/phpinfo.php
    SCRIPT_NAME /xampp/phpinfo.php


    HTTP Headers InformationHTTP Request Headers
    HTTP Request GET /xampp/phpinfo.php HTTP/1.1
    User-Agent Opera/9.27 (Windows NT 5.1; U; en)
    Host 127.0.0.1
    Accept text/html, application/xml;q=0.9, application/xhtml+xml, image/png, image/jpeg, image/gif, image/x-xbitmap, */*;q=0.1
    Accept-Language en-US,en;q=0.9
    Accept-Charset iso-8859-1, utf-8, utf-16, *;q=0.1
    Accept-Encoding deflate, gzip, x-gzip, identity, *;q=0
    Referer http://127.0.0.1/xampp/navi.php
    Connection Keep-Alive, TE
    TE deflate, gzip, chunked, identity, trailers
    HTTP Response Headers
    X-Powered-By PHP/5.2.9
    Keep-Alive timeout=5, max=98
    Connection Keep-Alive
    Transfer-Encoding chunked
    Content-Type text/html


    bcmathBCMath support enabled


    calendarCalendar support enabled


    com_dotnetCOM support enabled
    DCOM support disabled
    .Net support enabled

    Directive Local Value Master Value
    com.allow_dcom 0 0
    com.autoregister_casesensitive 1 1
    com.autoregister_typelib 0 0
    com.autoregister_verbose 0 0
    com.code_page no value no value
    com.typelib_file no value no value


    ctypectype functions enabled


    datedate/time support enabled
    "Olson" Timezone Database Version 2009.1
    Timezone Database internal
    Default timezone Europe/Helsinki

    Directive Local Value Master Value
    date.default_latitude 31.7667 31.7667
    date.default_longitude 35.2333 35.2333
    date.sunrise_zenith 90.583333 90.583333
    date.sunset_zenith 90.583333 90.583333
    date.timezone no value no value


    domDOM/XML enabled
    DOM/XML API Version 20031129
    libxml Version 2.7.3
    HTML Support enabled
    XPath Support enabled
    XPointer Support enabled
    Schema Support enabled
    RelaxNG Support enabled


    exifEXIF Support enabled
    EXIF Version 1.4 $Id: exif.c,v 1.173.2.5.2.27 2008/12/31 11:17:37 sebastian Exp $
    Supported EXIF Version 0220
    Supported filetypes JPEG,TIFF


    filterInput Validation and Filtering enabled
    Revision $Revision: 1.52.2.45 $

    Directive Local Value Master Value
    filter.default unsafe_raw unsafe_raw
    filter.default_flags no value no value


    ftpFTP support enabled


    gdGD Support enabled
    GD Version bundled (2.0.34 compatible)
    FreeType Support enabled
    FreeType Linkage with freetype
    FreeType Version 2.1.9
    T1Lib Support enabled
    GIF Read Support enabled
    GIF Create Support enabled
    JPG Support enabled
    PNG Support enabled
    WBMP Support enabled
    XBM Support enabled


    gettextGetText Support enabled


    hashhash support enabled
    Hashing Engines md2 md4 md5 sha1 sha256 sha384 sha512 ripemd128 ripemd160 ripemd256 ripemd320 whirlpool tiger128,3 tiger160,3 tiger192,3 tiger128,4 tiger160,4 tiger192,4 snefru gost adler32 crc32 crc32b haval128,3 haval160,3 haval192,3 haval224,3 haval256,3 haval128,4 haval160,4 haval192,4 haval224,4 haval256,4 haval128,5 haval160,5 haval192,5 haval224,5 haval256,5


    iconviconv support enabled
    iconv implementation "libiconv"
    iconv library version 1.11

    Directive Local Value Master Value
    iconv.input_encoding ISO-8859-1 ISO-8859-1
    iconv.internal_encoding ISO-8859-1 ISO-8859-1
    iconv.output_encoding ISO-8859-1 ISO-8859-1


    imapIMAP c-Client Version 2004
    SSL Support enabled


    jsonjson support enabled
    json version 1.2.1


    libxmllibXML support active
    libXML Version 2.7.3
    libXML streams enabled


    mbstringMultibyte Support enabled
    Multibyte string engine libmbfl
    Multibyte (japanese) regex support enabled
    Multibyte regex (oniguruma) version 4.4.4
    Multibyte regex (oniguruma) backtrack check On

    mbstring extension makes use of "streamable kanji code filter and converter", which is distributed under the GNU Lesser General Public License version 2.1.

    Directive Local Value Master Value
    mbstring.detect_order no value no value
    mbstring.encoding_translation Off Off
    mbstring.func_overload 0 0
    mbstring.http_input pass pass
    mbstring.http_output pass pass
    mbstring.internal_encoding no value no value
    mbstring.language neutral neutral
    mbstring.strict_detection Off Off
    mbstring.substitute_character no value no value


    mcryptmcrypt support enabled
    Version 2.5.7
    Api No 20021217
    Supported ciphers cast-128 gost rijndael-128 twofish arcfour cast-256 loki97 rijndael-192 saferplus wake blowfish-compat des rijndael-256 serpent xtea blowfish enigma rc2 tripledes
    Supported modes cbc cfb ctr ecb ncfb nofb ofb stream

    Directive Local Value Master Value
    mcrypt.algorithms_dir no value no value
    mcrypt.modes_dir no value no value


    mime_magicmime_magic support

    Directive Local Value Master Value
    mime_magic.debug Off Off
    mime_magic.magicfile D:\xampp171\php\extras\magic.mime D:\xampp171\php\extras\magic.mime


    mingMing SWF output library enabled
    Version 0.3beta1


    mssqlMSSQL Support enabled
    Active Persistent Links 0
    Active Links 0
    Library version 7.0

    Directive Local Value Master Value
    mssql.allow_persistent On On
    mssql.batchsize 0 0
    mssql.compatability_mode Off Off
    mssql.connect_timeout 5 5
    mssql.datetimeconvert On On
    mssql.max_links Unlimited Unlimited
    mssql.max_persistent Unlimited Unlimited
    mssql.max_procs Unlimited Unlimited
    mssql.min_error_severity 10 10
    mssql.min_message_severity 10 10
    mssql.secure_connection Off Off
    mssql.textlimit Server default Server default
    mssql.textsize Server default Server default
    mssql.timeout 60 60


    mysqlMySQL Support enabled
    Active Persistent Links 0
    Active Links 0
    Client API version 5.0.51a

    Directive Local Value Master Value
    mysql.allow_persistent On On
    mysql.connect_timeout 60 60
    mysql.default_host no value no value
    mysql.default_password no value no value
    mysql.default_port no value no value
    mysql.default_socket no value no value
    mysql.default_user no value no value
    mysql.max_links Unlimited Unlimited
    mysql.max_persistent Unlimited Unlimited
    mysql.trace_mode Off Off


    mysqliMysqlI Support enabled
    Client API library version 5.0.51a
    Client API header version 5.0.51a
    MYSQLI_SOCKET /tmp/mysql.sock

    Directive Local Value Master Value
    mysqli.default_host no value no value
    mysqli.default_port 3306 3306
    mysqli.default_pw no value no value
    mysqli.default_socket no value no value
    mysqli.default_user no value no value
    mysqli.max_links Unlimited Unlimited
    mysqli.reconnect Off Off


    odbcODBC Support enabled
    Active Persistent Links 0
    Active Links 0
    ODBC library Win32

    Directive Local Value Master Value
    odbc.allow_persistent On On
    odbc.check_persistent On On
    odbc.default_cursortype Static cursor Static cursor
    odbc.default_db no value no value
    odbc.default_pw no value no value
    odbc.default_user no value no value
    odbc.defaultbinmode return as is return as is
    odbc.defaultlrl return up to 4096 bytes return up to 4096 bytes
    odbc.max_links Unlimited Unlimited
    odbc.max_persistent Unlimited Unlimited


    paradoxParadox support enabled
    pxlib Version 0.6.3
    support for recoding record data iconv
    pxlib was build on no value
    Revision $Revision: 1.37 $


    pcrePCRE (Perl Compatible Regular Expressions) Support enabled
    PCRE Library Version 7.8 2008-09-05

    Directive Local Value Master Value
    pcre.backtrack_limit 100000 100000
    pcre.recursion_limit 100000 100000


    pdfPDF Support enabled
    PDFlib GmbH Version 5.0.3
    PECL Version 2.1.4
    Revision $Revision: 1.155 $


    PDOPDO support enabled
    PDO drivers mssql, mysql, sqlite2


    pdo_mssqlPDO Driver for MSSQL DB-lib enabled
    Flavour MSSQL_70


    pdo_mysqlPDO Driver for MySQL, client library version 5.0.51a


    pgsqlPostgreSQL Support enabled
    PostgreSQL(libpq) Version 8.3.1
    Multibyte character support enabled
    SSL support enabled
    Active Persistent Links 0
    Active Links 0

    Directive Local Value Master Value
    pgsql.allow_persistent On On
    pgsql.auto_reset_persistent Off Off
    pgsql.ignore_notice Off Off
    pgsql.log_notice Off Off
    pgsql.max_links Unlimited Unlimited
    pgsql.max_persistent Unlimited Unlimited


    psPS Support enabled
    PSlib Version 0.4.0
    Revision $Revision: 1.35 $


    ReflectionReflection enabled
    Version $Id: php_reflection.c,v 1.164.2.33.2.55 2008/12/31 11:17:42 sebastian Exp $


    sessionSession Support enabled
    Registered save handlers files user sqlite
    Registered serializer handlers php php_binary wddx

    Directive Local Value Master Value
    session.auto_start Off Off
    session.bug_compat_42 On On
    session.bug_compat_warn On On
    session.cache_expire 180 180
    session.cache_limiter nocache nocache
    session.cookie_domain no value no value
    session.cookie_httponly Off Off
    session.cookie_lifetime 0 0
    session.cookie_path / /
    session.cookie_secure Off Off
    session.entropy_file no value no value
    session.entropy_length 0 0
    session.gc_divisor 100 100
    session.gc_maxlifetime 1440 1440
    session.gc_probability 1 1
    session.hash_bits_per_character 4 4
    session.hash_function 0 0
    session.name PHPSESSID PHPSESSID
    session.referer_check no value no value
    session.save_handler files files
    session.save_path D:\xampp171\tmp D:\xampp171\tmp
    session.serialize_handler php php
    session.use_cookies On On
    session.use_only_cookies Off Off
    session.use_trans_sid 0 0


    SimpleXMLSimplexml support enabled
    Revision $Revision: 1.151.2.22.2.46 $
    Schema support enabled


    soapSoap Client enabled
    Soap Server enabled

    Directive Local Value Master Value
    soap.wsdl_cache 1 1
    soap.wsdl_cache_dir D:\xampp171\tmp D:\xampp171\tmp
    soap.wsdl_cache_enabled 1 1
    soap.wsdl_cache_limit 5 5
    soap.wsdl_cache_ttl 86400 86400


    socketsSockets Support enabled


    SPLSPL support enabled
    Interfaces Countable, OuterIterator, RecursiveIterator, SeekableIterator, SplObserver, SplSubject
    Classes AppendIterator, ArrayIterator, ArrayObject, BadFunctionCallException, BadMethodCallException, CachingIterator, DirectoryIterator, DomainException, EmptyIterator, FilterIterator, InfiniteIterator, InvalidArgumentException, IteratorIterator, LengthException, LimitIterator, LogicException, NoRewindIterator, OutOfBoundsException, OutOfRangeException, OverflowException, ParentIterator, RangeException, RecursiveArrayIterator, RecursiveCachingIterator, RecursiveDirectoryIterator, RecursiveFilterIterator, RecursiveIteratorIterator, RecursiveRegexIterator, RegexIterator, RuntimeException, SimpleXMLIterator, SplFileInfo, SplFileObject, SplObjectStorage, SplTempFileObject, UnderflowException, UnexpectedValueException


    SQLiteSQLite support enabled
    PECL Module version 2.0-dev $Id: sqlite.c,v 1.166.2.13.2.12 2008/12/31 11:17:44 sebastian Exp $
    SQLite Library 2.8.17
    SQLite Encoding iso8859

    Directive Local Value Master Value
    sqlite.assoc_case 0 0


    standardRegex Library Bundled library enabled
    Dynamic Library Support enabled
    Internal Sendmail Support for Windows enabled

    Directive Local Value Master Value
    assert.active 1 1
    assert.bail 0 0
    assert.callback no value no value
    assert.quiet_eval 0 0
    assert.warning 1 1
    auto_detect_line_endings 0 0
    default_socket_timeout 60 60
    safe_mode_allowed_env_vars PHP_ PHP_
    safe_mode_protected_env_vars LD_LIBRARY_PATH LD_LIBRARY_PATH
    url_rewriter.tags a=href,area=href,frame=src,input=src,form=,fieldset= a=href,area=href,frame=src,input=src,form=,fieldset=
    user_agent no value no value


    tokenizerTokenizer Support enabled


    wddxWDDX Support enabled
    WDDX Session Serializer enabled


    xmlXML Support active
    XML Namespace Support active
    libxml2 Version 2.7.3


    xmlreaderXMLReader enabled


    xmlrpccore library version xmlrpc-epi v. 0.51
    php extension version 0.51
    author Dan Libby
    homepage http://xmlrpc-epi.sourceforge.net
    open sourced by Epinions.com


    xmlwriterXMLWriter enabled


    xslXSL enabled
    libxslt Version 1.1.23
    libxslt compiled against libxml Version 2.6.32
    EXSLT enabled
    libexslt Version 0.8.13


    Zend OptimizerOptimization Pass 1 enabled
    Optimization Pass 2 enabled
    Optimization Pass 3 enabled
    Optimization Pass 4 enabled
    Optimization Pass 9 disabled
    Zend Loader disabled
    License Path no value
    Obfuscation level 0


    zipZip enabled
    Extension Version $Id: php_zip.c,v 1.1.2.49 2009/02/05 19:53:22 pajoye Exp $
    Zip version 1.8.11
    Libzip version 0.9.0


    zlibZLib Support enabled
    Stream Wrapper support compress.zlib://
    Stream Filter support zlib.inflate, zlib.deflate
    Compiled Version 1.2.3
    Linked Version 1.2.3

    Directive Local Value Master Value
    zlib.output_compression Off Off
    zlib.output_compression_level -1 -1
    zlib.output_handler no value no value


    Additional ModulesModule Name


    EnvironmentVariable Value
    no value ::=::\
    no value D:=D:\xampp171
    ALLUSERSPROFILE C:\Documents and Settings\All Users
    APPDATA C:\Documents and Settings\Monica\Application Data
    CLIENTNAME Console
    CommonProgramFiles C:\Program Files\Common Files
    COMPUTERNAME MSI601
    ComSpec C:\WINDOWS\system32\cmd.exe
    FP_NO_HOST_CHECK NO
    HOMEDRIVE C:
    HOMEPATH \Documents and Settings\Monica
    LOGONSERVER \\MSI601
    NUMBER_OF_PROCESSORS 1
    OS Windows_NT
    Path C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Program Files\Toshiba\Bluetooth Toshiba Stack\sys\;C:\WINDOWS\system32\WindowsPowerShell\v1.0;C:\Program Files\GNU\gpg4win1.1.4\pub;d:\Program Files\ClawsMail1.19\pub;D:\Program Files\Bitvise Tunnelier
    PATHEXT .COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.PSC1
    PROCESSOR_ARCHITECTURE x86
    PROCESSOR_IDENTIFIER x86 Family 6 Model 22 Stepping 1, GenuineIntel
    PROCESSOR_LEVEL 6
    PROCESSOR_REVISION 1601
    ProgramFiles C:\Program Files
    PROMPT $P$G
    SESSIONNAME Console
    SystemDrive C:
    SystemRoot C:\WINDOWS
    TEMP C:\DOCUME~1\Monica\LOCALS~1\Temp
    TMP C:\DOCUME~1\Monica\LOCALS~1\Temp
    USERDOMAIN MSI601
    USERNAME Monica
    USERPROFILE C:\Documents and Settings\Monica
    windir C:\WINDOWS
    AP_PARENT_PID 1000


    PHP VariablesVariable Value
    _SERVER["UNIQUE_ID"] SkMJ-8CoAJAAAArEEucAAAD3
    _SERVER["HTTP_USER_AGENT"] Opera/9.27 (Windows NT 5.1; U; en)
    _SERVER["HTTP_HOST"] 127.0.0.1
    _SERVER["HTTP_ACCEPT"] text/html, application/xml;q=0.9, application/xhtml+xml, image/png, image/jpeg, image/gif, image/x-xbitmap, */*;q=0.1
    _SERVER["HTTP_ACCEPT_LANGUAGE"] en-US,en;q=0.9
    _SERVER["HTTP_ACCEPT_CHARSET"] iso-8859-1, utf-8, utf-16, *;q=0.1
    _SERVER["HTTP_ACCEPT_ENCODING"] deflate, gzip, x-gzip, identity, *;q=0
    _SERVER["HTTP_REFERER"] http://127.0.0.1/xampp/navi.php
    _SERVER["HTTP_CONNECTION"] Keep-Alive, TE
    _SERVER["HTTP_TE"] deflate, gzip, chunked, identity, trailers
    _SERVER["PATH"] C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Program Files\Toshiba\Bluetooth Toshiba Stack\sys\;C:\WINDOWS\system32\WindowsPowerShell\v1.0;C:\Program Files\GNU\gpg4win1.1.4\pub;d:\Program Files\ClawsMail1.19\pub;D:\Program Files\Bitvise Tunnelier
    _SERVER["SystemRoot"] C:\WINDOWS
    _SERVER["COMSPEC"] C:\WINDOWS\system32\cmd.exe
    _SERVER["PATHEXT"] .COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.PSC1
    _SERVER["WINDIR"] C:\WINDOWS
    _SERVER["SERVER_SIGNATURE"] <address>Apache/2.2.11 (Win32) DAV/2 mod_ssl/2.2.11 OpenSSL/0.9.8i PHP/5.2.9 Server at 127.0.0.1 Port 80</address>
    _SERVER["SERVER_SOFTWARE"] Apache/2.2.11 (Win32) DAV/2 mod_ssl/2.2.11 OpenSSL/0.9.8i PHP/5.2.9
    _SERVER["SERVER_NAME"] 127.0.0.1
    _SERVER["SERVER_ADDR"] 127.0.0.1
    _SERVER["SERVER_PORT"] 80
    _SERVER["REMOTE_ADDR"] 127.0.0.1
    _SERVER["DOCUMENT_ROOT"] D:/xampp171/htdocs
    _SERVER["SERVER_ADMIN"] admin@localhost
    _SERVER["SCRIPT_FILENAME"] D:/xampp171/htdocs/xampp/phpinfo.php
    _SERVER["REMOTE_PORT"] 1536
    _SERVER["GATEWAY_INTERFACE"] CGI/1.1
    _SERVER["SERVER_PROTOCOL"] HTTP/1.1
    _SERVER["REQUEST_METHOD"] GET
    _SERVER["QUERY_STRING"] no value
    _SERVER["REQUEST_URI"] /xampp/phpinfo.php
    _SERVER["SCRIPT_NAME"] /xampp/phpinfo.php
    _SERVER["PHP_SELF"] /xampp/phpinfo.php
    _SERVER["REQUEST_TIME"] 1245907455
    _SERVER["argv"] Array
    (
    )
    _SERVER["argc"] 0
    _ENV["ALLUSERSPROFILE"] C:\Documents and Settings\All Users
    _ENV["APPDATA"] C:\Documents and Settings\Monica\Application Data
    _ENV["CLIENTNAME"] Console
    _ENV["CommonProgramFiles"] C:\Program Files\Common Files
    _ENV["COMPUTERNAME"] MSI601
    _ENV["ComSpec"] C:\WINDOWS\system32\cmd.exe
    _ENV["FP_NO_HOST_CHECK"] NO
    _ENV["HOMEDRIVE"] C:
    _ENV["HOMEPATH"] \Documents and Settings\Monica
    _ENV["LOGONSERVER"] \\MSI601
    _ENV["NUMBER_OF_PROCESSORS"] 1
    _ENV["OS"] Windows_NT
    _ENV["Path"] C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Program Files\Toshiba\Bluetooth Toshiba Stack\sys\;C:\WINDOWS\system32\WindowsPowerShell\v1.0;C:\Program Files\GNU\gpg4win1.1.4\pub;d:\Program Files\ClawsMail1.19\pub;D:\Program Files\Bitvise Tunnelier
    _ENV["PATHEXT"] .COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.PSC1
    _ENV["PROCESSOR_ARCHITECTURE"] x86
    _ENV["PROCESSOR_IDENTIFIER"] x86 Family 6 Model 22 Stepping 1, GenuineIntel
    _ENV["PROCESSOR_LEVEL"] 6
    _ENV["PROCESSOR_REVISION"] 1601
    _ENV["ProgramFiles"] C:\Program Files
    _ENV["PROMPT"] $P$G
    _ENV["SESSIONNAME"] Console
    _ENV["SystemDrive"] C:
    _ENV["SystemRoot"] C:\WINDOWS
    _ENV["TEMP"] C:\DOCUME~1\Monica\LOCALS~1\Temp
    _ENV["TMP"] C:\DOCUME~1\Monica\LOCALS~1\Temp
    _ENV["USERDOMAIN"] MSI601
    _ENV["USERNAME"] Monica
    _ENV["USERPROFILE"] C:\Documents and Settings\Monica
    _ENV["windir"] C:\WINDOWS
    _ENV["AP_PARENT_PID"] 1000


    PHP License
    This program is free software; you can redistribute it and/or modify it under the terms of the PHP License as published by the PHP Group and included in the distribution in the file: LICENSE

    This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

    If you did not receive a copy of the PHP license, or have any questions about PHP licensing, please contact license@php.net.
< Previous | 1 | Next >

Add a Reply

This forum does not allow anonymous participation.

Log in to add a reply. Not registered? Create an account to participate and receive email updates when replies are posted to this topic.