[phpBB Debug] PHP Warning: in file [ROOT]/includes/crs/crs_misc_functions.php on line 37: mime_content_type(): Empty filename or path
[phpBB Debug] PHP Warning: in file [ROOT]/includes/crs/crs_misc_functions.php on line 37: mime_content_type(): Empty filename or path
Zen Cart 源代码 image_handler.php

Zen Cart 源代码 image_handler.php




下载文件

文件名: image_handler.php
文件类型: PHP文件
文件大小: 44.75 KiB
MD5: 2ff46ec96a6769dd1aef5d7aa89846b9

image_handler.php - 关闭高亮
  1. <?php
  2. /**
  3.  * image_handler.php
  4.  * IH2 admin interface
  5.  *
  6.  * @author  Tim Kroeger <tim@breakmyzencart.com>
  7.  * @copyright Copyright 2005-2006 breakmyzencart.com
  8.  * @license http://www.gnu.org/licenses/gpl.txt GNU General Public License V2.0
  9.  * @version $Id: image_handler.php,v 1.5 2006/05/01 12:16:43 tim Exp $
  10.  */
  11.  
  12.   require('includes/application_top.php');
  13.   require(DIR_WS_CLASSES . 'currencies.php');
  14.   require_once(DIR_FS_CATALOG . DIR_WS_CLASSES . 'bmz_image_handler.class.php');
  15.  
  16.   define('HEADING_TITLE', IH_HEADING_TITLE);
  17.   define('HEADING_TITLE_PRODUCT_SELECT', IH_HEADING_TITLE_PRODUCT_SELECT);
  18.  
  19.   global $messageStack;
  20.   $page = isset($_GET['page']) ? $_GET['page'] : ((!defined('IH_VERSION') || (IH_VERSION == 'REMOVED')) ? 'admin' : 'manager');
  21.   $action = (isset($_GET['action']) ? $_GET['action'] : '');
  22.   $products_filter = (isset($_GET['products_filter']) ? $_GET['products_filter'] : $products_filter);
  23.   $current_category_id = (isset($_GET['current_category_id']) ? $_GET['current_category_id'] : $current_category_id);
  24.   $currencies = new currencies();
  25.   $import_info = null;
  26.  
  27.   function get_image_details_string( $filename ) {
  28.  
  29.     if (!file_exists( $filename )) {
  30.       return "no info";
  31.     }
  32.     $str = "";
  33.     // find out some details about the file
  34.     $image_size = @getimagesize($filename);
  35.     $image_fs_size = filesize($filename);
  36.  
  37.     $str .= $image_size[0]."x".$image_size[1];
  38.     $str .= "<br /><strong>". round($image_fs_size/1024, 2) . "Kb</strong>";
  39.    
  40.     return $str;
  41.   }
  42.  
  43.   //
  44.   // Search the base directory and find additional images
  45.   //
  46.   function find_additional_images(&$array, $directory, $extension, $base ) {
  47.  
  48.     $image = $base . $extension;
  49.  
  50.     // Check for additional matching images
  51.     if ($dir = @dir($directory)) {
  52.       while ($file = $dir->read()) {
  53.         if (!is_dir($directory . $file)) {
  54.           if(preg_match("/^" . $base . "/i", $file) == '1') {
  55.             // echo "BASE: ".$base.' FILE: '.$file.'<br />';
  56.             if (substr($file, 0, strrpos($file, '.')) != substr($image, 0, strrpos($image, '.'))) {
  57.               if ($base . preg_replace("/^$base/", '', $file) == $file) {
  58.                 $array[] = $file;
  59.                 // echo 'I AM A MATCH ' . $products_image_directory . '/'.$file . $products_image_extension .'<br />';
  60.               } else {
  61.                 // echo 'I AM NOT A MATCH ' . $file . '<br />';
  62.               }
  63.             }
  64.           }
  65.         }
  66.       }
  67.      
  68.       if (sizeof($array) > 1) {
  69.         sort($array);
  70.       }
  71.      
  72.       $dir->close();
  73.      
  74.       return 1;
  75.     }
  76.    
  77.     return 0;
  78.   }
  79.  
  80.   function find_original_image($src) {
  81.     global $ihConf;
  82.     // try to find file by using different file extensions if initial
  83.     // source doesn't succeed
  84.     $imageroot = $ihConf['dir']['docroot'] . $ihConf['dir']['images'] . 'original/';
  85.     if (is_file($imageroot . $src)) {
  86.       return 'original/' . $src;
  87.     } else {
  88.       // do a quick search for files with common extensions
  89.       $extensions = array('.png', '.PNG', '.jpg', '.JPG', '.jpeg', '.JPEG', '.gif', '.GIF');
  90.       $base = substr($src, 0, strrpos($src, '.'));
  91.       for ($i=0; $i<count($extensions); $i++) {
  92.         if (is_file($imageroot . $base . $extensions[$i])) {
  93.           return 'original/' . $base . $extensions[$i];
  94.         }
  95.       }
  96.       // not found? maybe mixed case file extension?
  97.       if ($ihConf['allow_mixed_case_ext']) {
  98.         // this can cost some time for every displayed image so default is
  99.         // to not do this search
  100.         $directory = dirname($imageroot . $src);
  101.         $dir = @dir($directory);
  102.         while ($file = $dir->read()) {
  103.           if (!is_dir($directory . $file)) {
  104.             if(preg_match("/^" . $imageroot . $base . "/i", $file) == '1') {
  105.               $file_ext = substr($file, strrpos($file, '.'));
  106.               if (is_file($imageroot . $base . $file_ext)) {
  107.                 return 'original/' . $base . $file_ext;
  108.               }
  109.             }
  110.           }
  111.         }
  112.       }
  113.     }
  114.     // still here? no file found...
  115.     return false;
  116.   }
  117.  
  118.   function get_import_info() {
  119.     global $db;
  120.     $products = $db->Execute("select products_id, products_image from " . TABLE_PRODUCTS . " where products_image != '' order by products_image asc");
  121.     $previous_image = '';
  122.     $info = array();
  123.     $index = 0;
  124.     $previous_image = '';
  125.     while (!$products->EOF){
  126.       $image = $products->fields['products_image'];
  127.       if ($image != $previous_image) {
  128.         $previous_image = $image;
  129.         $original_image = find_original_image($image);
  130.         if ($original_image) {
  131.           $info[$index]['source'] = $image;
  132.           $info[$index]['original'] = $original_image;
  133.           $info[$index]['target'] = preg_replace('/^original\//', '', $original_image);
  134.           $index++;  
  135.         }
  136.       }
  137.       $products->MoveNext();
  138.     }
  139.     return $info;
  140.   }
  141.  
  142.  
  143.  
  144.  
  145.  
  146.   if ($action == 'set_products_filter') {
  147.     $_GET['products_filter'] = $_POST['products_filter'];
  148.     zen_redirect(zen_href_link(FILENAME_IMAGE_HANDLER, 'page=manager&products_filter=' . $_GET['products_filter']));
  149.   }
  150.  
  151.   if ($page == 'manager') {
  152.     // manager actions are handled in a seperate file
  153.     require('includes/ih_manager.php');
  154.   }
  155.  
  156.  
  157.   if ($action == 'ih_remove') {
  158.     $error = remove_image_handler();
  159.     if ($error) {
  160.       $messageStack->add($error, 'error');
  161.     } else {
  162.       zen_redirect(zen_href_link(FILENAME_IMAGE_HANDLER, 'page=admin&action=ih_remove_success'));
  163.     }
  164.   }
  165.  
  166.   if ($action == 'ih_remove_success') {
  167.       $messageStack->add(IH_REMOVED, 'success');
  168.   }
  169.  
  170.   if ($action == 'ih_install') {
  171.     $error = install_image_handler();
  172.     if ($error) {
  173.       $messageStack->add($error, 'error');
  174.     } else {
  175.       zen_redirect(zen_href_link(FILENAME_IMAGE_HANDLER, 'page=admin&action=ih_install_success'));
  176.     }
  177.   }
  178.  
  179.   if ($action == 'ih_install_success') {
  180.       $messageStack->add(IH_INSTALLED, 'success');
  181.   }
  182.  
  183.   if ($action == 'ih_update') {
  184.     $error = update_image_handler();
  185.     if ($error) {
  186.       $messageStack->add($error, 'error');
  187.     } else {
  188.       zen_redirect(zen_href_link(FILENAME_IMAGE_HANDLER, 'page=admin&action=ih_update_success'));
  189.     }
  190.   }
  191.  
  192.   if ($action == 'ih_update_success') {
  193.       $messageStack->add(IH_UPDATED, 'success');
  194.   }
  195.  
  196.   if ($action == 'ih_import_images') {
  197.     $files = get_import_info();
  198.     $previous_image = '';
  199.     $imageroot = $ihConf['dir']['docroot'] . $ihConf['dir']['images'];
  200.     if (count($files) > 0) {
  201.       for ($i = 0; $i < count($files); $i++) {
  202.         // Remove destination file if it's there
  203.         @unlink($imageroot . $files[$i]['target']);
  204.         if (rename($imageroot . $files[$i]['original'], $imageroot . $files[$i]['target'])) {
  205.           // Update database
  206.           if ($files[$i]['target'] != $files[$i]['source']) {
  207.             $db->Execute("update " . TABLE_PRODUCTS . " set products_image='" . $files[$i]['target'] . "' where products_image='" . $files[$i]['source'] . "'");
  208.           }
  209.           @unlink($imageroot . $files[$i]['source']);
  210.           $messageStack->add(TEXT_MSG_IMPORT_SUCCESS . $files[$i]['original'] . ' => ' . $files[$i]['target'], 'success');
  211.         } else {
  212.           $messageStack->add(TEXT_MSG_IMPORT_FAILURE . $files[$i]['original'] . ' => ' . $files[$i]['target'], 'error');
  213.         }
  214.       }
  215.       $messageStack->add(IH_IMAGES_IMPORTED, 'success');
  216.     }
  217.   }
  218.  
  219.   if ($action == 'ih_scan_originals') {
  220.     $import_info = get_import_info();
  221.     if (count($import_info) <= 0) {
  222.       $messageStack->add(IH_NO_ORIGINALS, 'caution');
  223.     }
  224.   }  
  225.  
  226.   if ($action == 'ih_clear_cache') {
  227.     $error = bmz_clear_cache();
  228.     if (!$error) {
  229.       $messageStack->add(IH_CACHE_CLEARED, 'success');
  230.     }
  231.   }
  232.  
  233.  
  234.  
  235. ?>
  236. <!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
  237. <html <?php echo HTML_PARAMS; ?>>
  238. <head>
  239. <meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">
  240. <title><?php echo TITLE; ?></title>
  241. <link rel="stylesheet" type="text/css" href="includes/stylesheet.css">
  242. <link rel="stylesheet" type="text/css" href="includes/cssjsmenuhover.css" media="all" id="hoverJS">
  243. <script language="javascript" src="includes/menu.js"></script>
  244. <script language="javascript" src="includes/general.js"></script>
  245. <link rel="stylesheet" type="text/css" href="includes/javascript/spiffyCal/spiffyCal_v2_1.css">
  246. <script language="JavaScript" src="includes/javascript/spiffyCal/spiffyCal_v2_1.js"></script>
  247.  
  248. <script type="text/javascript">
  249.   <!--
  250.   function init()
  251.   {
  252.     cssjsmenu('navbar');
  253.     if (document.getElementById)
  254.     {
  255.       var kill = document.getElementById('hoverJS');
  256.       kill.disabled = true;
  257.     }
  258.   }
  259.  
  260.    function popupWindow(url) {
  261.         window.open(url,'popupWindow','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,copyhistory=no,width=600,height=460,screenX=150,screenY=150,top=150,left=150')
  262.     }
  263.  
  264.   // -->
  265. </script>
  266. <style type="text/css">
  267.   <!--
  268.   /* general headline setup */
  269.   h1, h2, h3, h4, h5 {
  270.      color: #000000;
  271.      font-family: Georgia,"Times New Roman",serif;
  272.      font-weight: bold;
  273.      letter-spacing: 0.1em;
  274.      word-spacing: 0.2em;
  275.      margin: 0 0 0 0;
  276.      padding: 0 0 0 0;
  277.      clear: left
  278.   }
  279.  
  280.   .logo h1 {margin: 0; padding: 11px 0 0 0; font-size: 30px; color:#CCCCCC}
  281.   h1 {font-size: 180%}
  282.   h2 {font-size: 160%}
  283.   h3 {font-size: 140%}
  284.   h4 {font-size: 120%}
  285.   h5 {font-size: 100%}
  286.  
  287.   h1 a, h2 a, h3 a, h4 a, h5 a {
  288.      font-family: Georgia,"Times New Roman",serif;
  289.      font-weight: bold;
  290.      letter-spacing: 0.1em;
  291.      word-spacing: 0.2em;
  292.   }
  293.  
  294.   input[type="text"], input[type="submit"], input[type="file"], select {
  295.     border: 1px solid #CCCCCC;
  296.     background-color: #FFFFFF;
  297.   }
  298.  
  299.   div.adminbox {
  300.     padding: 8px;
  301.   }
  302.  
  303.   div.aboutbox {
  304.     margin: 0 auto;
  305.     width: 60%;
  306.     text-align:center;
  307.   }
  308.  
  309.   .aboutbox p {
  310.     text-align: justify;
  311.   }
  312.  
  313.   div.managerbox {
  314.     clear: both;
  315.   }
  316.  
  317.   div.donationbox {
  318.     display: none;
  319.     float: right;
  320.     padding: 8px;
  321.     border: 1px solid #CCCCCC;
  322.     background-color: #F5F5F5;
  323.     text-align: left;
  324.     margin: 10px;
  325.   }
  326.  
  327.   .donationbox label {
  328.     display: none;
  329.     font-weight: normal;
  330.   }
  331.  
  332.   .donationbox input[type=text], .donationbox input[type=submit], .donationbox select {
  333.     display: none;
  334.     border: 1px solid #CCCCCC;
  335.     background-color: #FFFFFF;
  336.   }
  337.  
  338.   .donationbox input[type=submit] {margin-bottom: 5px; cursor: pointer}
  339.  
  340.   .donationbox h2 {
  341.     font-size: 100%;
  342.   }
  343.  
  344.   a.wikilink1:link    { color:#009900; text-decoration:none }
  345.   a.wikilink1:visited { color:#009900; text-decoration:none }
  346.   a.wikilink1:hover   { color:#009900; text-decoration:underline }
  347.  
  348.  
  349.   -->
  350. </style>
  351.  
  352.  
  353. </head>
  354. <body onload="init()">
  355. <div id="spiffycalendar" class="text"></div>
  356. <!-- header //-->
  357. <?php require(DIR_WS_INCLUDES . 'header.php'); ?>
  358. <!-- header_eof //-->
  359.  
  360. <!-- body //-->
  361.  
  362. <div>
  363.  
  364. <div style="float:left; padding: 8px 5px;">
  365. <h1><?php echo HEADING_TITLE; ?></h1>
  366. <?php
  367. if (defined('IH_VERSION')) {
  368.     echo IH_VERSION_VERSION . ':&nbsp;' . IH_VERSION . '<br />';
  369. } else {
  370.     echo IH_VERSION_NOT_FOUND . '<br />';
  371. }
  372. ?>
  373. </div>
  374.  
  375. <?php
  376. if ($page == 'manager') {
  377. // SEARCH DIALOG BOX
  378.   echo '<div style="float:right; padding: 5px;">';
  379.   echo zen_draw_form('search', FILENAME_CATEGORIES, '', 'get');
  380. // show reset search
  381.   if (isset($_GET['search']) && zen_not_null($_GET['search'])) {
  382.     echo '<a href="' . zen_href_link(FILENAME_CATEGORIES) . '">' . zen_image_button('button_reset.gif', IMAGE_RESET) . '</a>&nbsp;&nbsp;';
  383.   }
  384.   echo HEADING_TITLE_SEARCH_DETAIL . ' ' . zen_draw_input_field('search');
  385.   if (isset($_GET['search']) && zen_not_null($_GET['search'])) {
  386.     $keywords = zen_db_input(zen_db_prepare_input($_GET['search']));
  387.     echo '<br/ >' . TEXT_INFO_SEARCH_DETAIL_FILTER . $keywords;
  388.   }
  389.   echo '</form>';
  390.   echo '</div>';
  391. }
  392. ?>
  393. </div>
  394.  
  395. <div style="clear:both">
  396.  
  397. <ul style="background-color:#F5F5F5; border: solid #CCCCCC; border-width: 1px 0px;">
  398.   <li style="display:inline; padding:2px 5px; <?php echo ($page == 'manager') ? 'background:#CCCCCC;' : ''; ?>">
  399.     <a href="<?php echo zen_href_link(FILENAME_IMAGE_HANDLER, 'page=manager') ?>">图像管理</a>
  400.   </li>
  401.   <li style="display:inline; padding:2px 5px; <?php echo ($page == 'admin') ? 'background:#CCCCCC;' : ''; ?>">
  402.      <a href="<?php echo zen_href_link(FILENAME_IMAGE_HANDLER, 'page=admin') ?>">模块管理</a>
  403.   </li>
  404.   <li style="display:inline; padding:2px 5px; <?php echo ($page == 'preview') ? 'background:#CCCCCC;' : ''; ?>">
  405.     <a href="<?php echo zen_href_link(FILENAME_IMAGE_HANDLER, 'page=preview') ?>">图像预览</a>
  406.   </li>
  407.   <li style="display:inline; padding:2px 5px; <?php echo ($page == 'about') ? 'background:#CCCCCC;' : ''; ?>">
  408.     <a href="<?php echo zen_href_link(FILENAME_IMAGE_HANDLER, 'page=about') ?>">关于我们</a>
  409.   </li>
  410. </ul>
  411.  
  412. <div class="donationbox">
  413. <form class="contrib" action="https://www.paypal.com/cgi-bin/webscr" method="post">
  414.   <input type="hidden" name="business" value="paypal@breakmyzencart.com" />
  415.   <input type="hidden" name="item_name" value="breakmyzencart donation" />
  416.   <input type="hidden" name="item_number" value="DONATE" />
  417.   <input type="hidden" name="no_note" value="0" />
  418.   <input type="hidden" name="cmd" value="_xclick" />
  419.   <input type="hidden" name="lc" value="en" />
  420.   <input type="hidden" name="on0" value="Anonymity" />
  421.   <input type="hidden" name="on1" value="Comment" />
  422.   <input type="hidden" name="no_shipping" value="1" />
  423.   <input type="hidden" name="tax" value="0" />
  424.  
  425.   <input type="hidden" name="return" value="http://breakmyzencart.com/thanks" />
  426.   <input type="hidden" name="cancel_return" value="http://breakmyzencart.com/canceled" />
  427.  
  428.   <?php
  429.   //<input type="hidden" name="notify_url" value="http://breakmyzencart.com/donated.php" /-->
  430.   ?>
  431.  
  432.   <h2>Please donate. <a class="wikilink1" href="http://breakmyzencart.com/donate" title="Why donate">Why?</a></h2>
  433.   <p>
  434.   <label for="don-amount">One time gift of</label>
  435.   <input type="text" name="amount" id="don-amount" maxlength="30" size="5" />
  436.   <select name="currency_code">
  437.     <option value="USD" selected="selected">美元(USD)</option>
  438.     <option value="EUR">欧元(EUR)</option>
  439.     <option value="GBP">英镑(GBP)</option>
  440.     <option value="CAD">加元(CAD)</option>
  441.     <option value="AUD">澳元(AUD)</option>
  442.     <option value="JPY">日元(JPY)</option>
  443.   </select>
  444.   </p>
  445.   <p>
  446.   <label for="os1">Public comment
  447.     <small>(200 characters max)</small>
  448.   </label>  
  449.   <br />
  450.   <input type="text" size="25" name="os1" id="os1" maxlength="200" />
  451.   </p>
  452.   <p>
  453.   <a class="wikilink1" href="http://breakmyzencart.com/donors_list" title="Donors' list'">Donors&rsquo; list</a><br />
  454.   <input type="radio" name="os0" id="name-yes" value="Mention my name" />
  455.   <label for="name-yes">List my name</label>
  456.   <br />
  457.   <input type="radio" name="os0" id="name-no" checked="checked" value="Don't mention my name" />
  458.   <label for="name-no">List anonymously</label>
  459.   <br />
  460.  
  461.   <input type="submit" value="Donate Now!" />
  462.   <br />
  463.   <img src="images/cc.gif" alt="Visa, MasterCard, Discover, American Express, eCheck" />
  464.   </p>
  465. </form>
  466. </div>
  467.  
  468. <div class="adminbox">
  469. <?php
  470.  
  471.  
  472.  
  473. /**
  474.  * ADMIN TABPAGE INITIALIZATION
  475.  */
  476. $ih_admin_actions = array();
  477.  
  478. if ($page == 'admin') {
  479.     if (!defined('IH_VERSION') || (IH_VERSION == 'REMOVED')) {
  480.         $ih_admin_actions['ih_install'] = IH_INSTALL;
  481.     } else {
  482.         if (bmz_needs_update($ihConf['version'], IH_VERSION)) {
  483.             $ih_admin_actions['ih_update'] = IH_UPDATE;
  484.         }
  485.        
  486.         $ih_admin_actions['ih_confirm_remove'] = IH_REMOVE;
  487.     }
  488.     $ih_admin_actions['ih_clear_cache'] = IH_CLEAR_CACHE;
  489.   $ih_admin_actions['ih_scan_originals'] = IH_SCAN_FOR_ORIGINALS;
  490. }
  491.  
  492.  
  493.  
  494.  
  495. /**
  496.  * image handler uninstall confirmation
  497.  */
  498.  
  499. if ($action == 'ih_confirm_remove') {
  500.   echo zen_draw_form('remove_form', FILENAME_IMAGE_HANDLER, '', 'get');
  501.   echo zen_draw_hidden_field('action', 'ih_remove');
  502.   echo IH_CONFIRM_REMOVE . '&nbsp;';
  503.   echo zen_image_submit('button_delete.gif', IMAGE_DELETE);
  504.   echo '</form>';
  505. }
  506.  
  507. if ($action == 'ih_scan_originals') {
  508.   if (count($import_info) > 0) {
  509.     echo zen_draw_form('import_form', FILENAME_IMAGE_HANDLER, '', 'get');
  510.     echo zen_draw_hidden_field('action', 'ih_import_images');
  511.     echo IH_CONFIRM_IMPORT . '<br />';
  512.     echo zen_image_submit('button_confirm.gif', IMAGE_CONFIRM) . '<br /><br />';
  513.     for ($i = 0; $i < count($import_info); $i++) {
  514.       echo "#$i: " . $import_info[$i]['original'] . ' => ' . $import_info[$i]['target'] . '<br /><br />';
  515.     }
  516.     echo '<br /><br />' . IH_CONFIRM_IMPORT . '<br />';
  517.     echo zen_image_submit('button_confirm.gif', IMAGE_CONFIRM) . '<br />';
  518.     echo '</form>';
  519.   }
  520. }
  521.  
  522. if (count($ih_admin_actions) > 0) {
  523.     echo '<ul>';
  524.     foreach ($ih_admin_actions as $action_name => $link_name) {
  525.         echo '<li><a href="' . zen_href_link(FILENAME_IMAGE_HANDLER, 'page=admin&action=' . $action_name) . '">' . $link_name . '</a></li>';
  526.     }
  527.     echo '</ul>';
  528. }
  529.  
  530.  
  531.  
  532.  
  533. /**
  534.  * MANAGER TABPAGE
  535.  */
  536.  
  537. if ($page == 'manager') {
  538.   $curr_page = FILENAME_IMAGE_HANDLER;
  539.     require(DIR_WS_MODULES . FILENAME_PREV_NEXT_DISPLAY);
  540. ?>
  541.  
  542.       <form name="set_products_filter_id" <?php echo 'action="' . zen_href_link(FILENAME_IMAGE_HANDLER, 'action=set_products_filter') . '"'; ?> method="post"><?php echo zen_draw_hidden_field('products_filter', $_GET['products_filter']); ?>
  543.         <table border="0" cellspacing="0" cellpadding="2">
  544.           <tr>
  545.             <td class="main" width="200" align="left" valign="top">&nbsp;</td>
  546.             <td colspan="2" class="main"><?php echo TEXT_PRODUCT_TO_VIEW; ?></td>
  547.           </tr>
  548.           <tr>
  549.             <td class="main" width="200" align="center" valign="top">
  550.  
  551. <?php
  552. // FIX HERE
  553. if ($_GET['products_filter'] != '') {
  554.   $display_priced_by_attributes = zen_get_products_price_is_priced_by_attributes($_GET['products_filter']);
  555.   echo ($display_priced_by_attributes ? '<span class="alert">' . TEXT_PRICED_BY_ATTRIBUTES . '</span>' . '<br />' : '');
  556.   echo zen_get_products_display_price($_GET['products_filter']) . '<br /><br />';
  557.   echo zen_get_products_quantity_min_units_display($_GET['products_filter'], $include_break = true);
  558.   $not_for_cart = $db->Execute("select p.products_id from " . TABLE_PRODUCTS . " p left join " . TABLE_PRODUCT_TYPES . " pt on p.products_type= pt.type_id where pt.allow_add_to_cart = 'N'");
  559. } else {
  560.   echo '';
  561.   $not_for_cart = '';
  562. }
  563. ?>
  564.             </td>
  565.             <td class="attributes-even" align="center"><?php echo zen_draw_products_pull_down('products_filter', 'size="5"', $not_for_cart->fields, true, $_GET['products_filter'], true, true); ?></td>
  566.             <td class="main" align="center" valign="top">
  567.               <?php
  568.                 echo zen_image_submit('button_display.gif', IMAGE_DISPLAY);
  569.               ?>
  570.             </td>
  571.           </tr>
  572.  
  573.         <tr>
  574.           <td colspan="3">
  575.             <table>
  576.  
  577. <?php
  578. // show when product is linked
  579. if (zen_get_product_is_linked($products_filter) == 'true') {
  580. ?>
  581.               <tr>
  582.                 <td class="main" align="center" valign="bottom">
  583.                   <?php echo zen_image(DIR_WS_IMAGES . 'icon_yellow_on.gif', IMAGE_ICON_LINKED) . '&nbsp;&nbsp;' . TEXT_LEGEND_LINKED . ' ' . zen_get_product_is_linked($products_filter, 'true'); ?>
  584.                 </td>
  585.               </tr>
  586. <?php } ?>
  587.               <tr>
  588.                 <td class="main" align="center" valign="bottom">
  589. <?php
  590.   if ($_GET['products_filter'] != '') {
  591.     echo '<a href="' . zen_href_link(FILENAME_CATEGORIES, 'action=new_product' . '&cPath=' . $current_category_id . '&pID=' . $products_filter . '&product_type=' . zen_get_products_type($products_filter)) . '">' . zen_image_button('button_edit_product.gif', IMAGE_EDIT_PRODUCT) . '<br />' . TEXT_PRODUCT_EDIT . '</a>';
  592.     echo '</td><td class="main" align="center" valign="bottom">';
  593.     echo '<a href="' . zen_href_link(FILENAME_ATTRIBUTES_CONTROLLER, 'products_filter=' . $products_filter . '&current_category_id=' . $current_category_id, 'NONSSL') . '">' . zen_image_button('button_edit_attribs.gif', IMAGE_EDIT_ATTRIBUTES) . '<br />' . TEXT_ATTRIBUTE_EDIT . '</a>' . '&nbsp;&nbsp;&nbsp;';
  594.   }
  595. ?>
  596.                 </td>
  597.               </tr>
  598.             </table>
  599.           </td>
  600.         </tr>
  601.  
  602.         </table>
  603.       </form>
  604.  
  605.  
  606. <div class="managerbox">
  607. <!-- Start Photo Display -->
  608.  
  609. <?php
  610. // start of attributes display
  611. if ($products_filter == '') {
  612. ?>
  613.     <h2><?php echo HEADING_TITLE_PRODUCT_SELECT; ?></h2>
  614. <?php
  615. } else {
  616.   // Get the details for the product
  617.   $product = $db->Execute("select p.products_id, p.products_model,
  618.                                      p.products_image,
  619.                                      p.product_is_free, p.product_is_call, p.products_quantity_mixed, p.products_priced_by_attribute, p.products_status,
  620.                                      p.products_discount_type, p.products_discount_type_from, p.products_price_sorter,
  621.                                      pd.products_name,
  622.                                      p.master_categories_id
  623.                               from " . TABLE_PRODUCTS . " p, " .
  624.                                         TABLE_PRODUCTS_DESCRIPTION . " pd
  625.                               where p.products_id = '" . $_GET['products_filter'] . "'
  626.                               and p.products_id = pd.products_id
  627.                               and pd.language_id = '" . (int)$_SESSION['languages_id'] . "'");
  628.  
  629.  
  630.     if ($product->RecordCount() > 0) {
  631.         $pInfo = new objectInfo($product->fields);
  632.     }
  633.  
  634.   // Determine if there are any images and work out the file names
  635.   // (based on code from modules/pages/product_info/main_template_vars_images(& _additional) (copying is evil!))
  636.   if ($pInfo->products_image != '') {
  637.    
  638.     $products_image = $pInfo->products_image;
  639.     $products_image_match_array = array();
  640.  
  641.     // get file extension and base
  642.     $products_image_extension = substr($products_image, strrpos($products_image, '.'));
  643.     $products_image_base = preg_replace("/".$products_image_extension."$/", '', $products_image);
  644.        
  645.     // if in a subdirectory
  646.     if (strrpos($products_image_base, '/')) {
  647.       $products_image_base = substr($products_image_base, strrpos($products_image_base, '/')+1);
  648.     }
  649.    
  650.    
  651.     // sort out directory
  652.     $products_image_directory =  substr($products_image, 0, strrpos($products_image, '/'));
  653.       // add slash to base dir
  654.       if (($products_image_directory != '') && (!ereg("\/$", $products_image_directory))) {
  655.         $products_image_directory .= '/';
  656.       }
  657.     $products_image_directory_full = DIR_FS_CATALOG . DIR_WS_IMAGES . $products_image_directory;
  658.    
  659.     // Check that the image exists! (out of date Database)
  660.     if (file_exists( $products_image_directory_full . $products_image_base . $products_image_extension )) {
  661.  
  662.       // Add base image to array
  663.       $products_image_match_array[] = $products_image_base . $products_image_extension;
  664.       // $products_image_base .= "_";
  665.      
  666.       // Check for additional matching images
  667.       find_additional_images($products_image_match_array, $products_image_directory_full,
  668.         $products_image_extension, $products_image_base );
  669.     }
  670.    
  671.   } // if products_image
  672.  
  673. ?>
  674.  
  675. <?php
  676.   if ($pInfo->products_id != '') {
  677. ?>
  678.     <h2>
  679.       <?php echo TEXT_PRODUCT_INFO . ': #' . $pInfo->products_id . '&nbsp;&nbsp;' . $pInfo->products_name; ?>&nbsp;&nbsp;&nbsp;
  680.       <?php
  681.         if ($pInfo->products_model != '') {
  682.           echo TEXT_PRODUCTS_MODEL . ': ' . $pInfo->products_model;
  683.         }
  684.       ?>
  685.       &nbsp;&nbsp;&nbsp;
  686.       <?php
  687.         if ($pInfo->products_image != '') {
  688.           if (preg_match("/^([^\/]+)\//", $pInfo->products_image, $matches)) {
  689.             echo TEXT_IMAGE_BASE_DIR .': ';
  690.             echo $matches[1];
  691.           }
  692.         }
  693.       ?>
  694.     </h2>
  695.     <table border="0" width="100%" cellspacing="0" cellpadding="2"><tr><td valign="top">
  696.     <table border="0" width="100%" cellspacing="0" cellpadding="2">
  697.     <tr class="dataTableHeadingRow">
  698.       <td class="dataTableHeadingContent"><?php echo TABLE_HEADING_PHOTO_NAME; ?></td>
  699.       <td class="dataTableHeadingContent" align="center"><?php echo TABLE_HEADING_DEFAULT_SIZE; ?></td>
  700.       <td class="dataTableHeadingContent" align="center"><?php echo TABLE_HEADING_MEDIUM_SIZE; ?></td>
  701.       <td class="dataTableHeadingContent" align="center"><?php echo TABLE_HEADING_LARGE_SIZE; ?></td>
  702.       <td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_ACTION; ?>&nbsp;</td>
  703.     </tr>
  704. <?php
  705.   $count = sizeof($products_image_match_array);
  706.   if (! $count) {
  707.     // no images
  708.     $no_images = 1;
  709. ?>
  710.       <tr>
  711.         <td colspan="6" class="dataTableContent" align="center"><?php echo TEXT_NO_PRODUCT_IMAGES; ?></td>
  712.       </tr>
  713. <?php
  714.   }
  715. ?>
  716.  
  717. <?php
  718.   $first = 1;
  719.   for ($i=0; $i < $count; $i++) {
  720.     // there are some pictures, show them!
  721.     $splitpos = strrpos($products_image_match_array[$i], '.');
  722.     $tmp_image_name = substr($products_image_match_array[$i], 0, $splitpos);
  723.     $products_image_extension = substr($products_image_match_array[$i], $splitpos);
  724.    
  725.     $image_file = DIR_WS_IMAGES . $products_image_directory . $tmp_image_name . $products_image_extension;
  726.     $image_file_medium = DIR_WS_IMAGES . 'medium/' . $products_image_directory . $tmp_image_name . IMAGE_SUFFIX_MEDIUM . $products_image_extension;
  727.     $image_file_large  = DIR_WS_IMAGES . 'large/' . $products_image_directory . $tmp_image_name . IMAGE_SUFFIX_LARGE .  $products_image_extension;
  728.  
  729.     $image_file_full = DIR_FS_CATALOG . $image_file;
  730.     $image_file_medium_full = DIR_FS_CATALOG . $image_file_medium;
  731.     $image_file_large_full = DIR_FS_CATALOG . $image_file_large;
  732.  
  733.     $tmp_image = new ih_image($image_file, $ihConf['small']['width'], $ihConf['small']['height']);
  734.     $tmp_image_file = $tmp_image->get_local();
  735.     $tmp_image_file_full = DIR_FS_CATALOG . $tmp_image_file;
  736.     $tmp_image_preview = new ih_image($tmp_image_file, IMAGE_SHOPPING_CART_WIDTH, IMAGE_SHOPPING_CART_HEIGHT);
  737.  
  738.     $tmp_image_medium = new ih_image($image_file_medium, $ihConf['medium']['width'], $ihConf['medium']['height']);
  739.     $tmp_image_file_medium = $tmp_image_medium->get_local();
  740.     $tmp_image_file_medium_full = DIR_FS_CATALOG . $tmp_image_file_medium;
  741.     $tmp_image_medium_preview = new ih_image($tmp_image_file_medium, IMAGE_SHOPPING_CART_WIDTH, IMAGE_SHOPPING_CART_HEIGHT);
  742.    
  743.     $tmp_image_large = new ih_image($image_file_large, $ihConf['large']['width'], $ihConf['large']['height']);
  744.     $tmp_image_file_large = $tmp_image_large->get_local();
  745.     $tmp_image_file_large_full = DIR_FS_CATALOG . $tmp_image_file_large;
  746.     $tmp_image_large_preview = new ih_image($tmp_image_file_large, IMAGE_SHOPPING_CART_WIDTH, IMAGE_SHOPPING_CART_HEIGHT);
  747.  
  748.  
  749.     // Get file details
  750.     $text_default_size = get_image_details_string( $tmp_image_file_full );
  751.     $text_medium_size = get_image_details_string( $tmp_image_file_medium_full );
  752.     $text_large_size = get_image_details_string( $tmp_image_file_large_full );
  753.  
  754.     if ($first == 1) {
  755.       $tmp_image_link = zen_catalog_href_link(FILENAME_POPUP_IMAGE, 'pID=' . $pInfo->products_id);
  756.       $first = 0;
  757.     } else {
  758.       $tmp_image_link = zen_catalog_href_link(FILENAME_POPUP_IMAGE_ADDITIONAL,
  759.         'pID=' . $pInfo->products_id . '&pic='.($i).'&products_image_large_additional='.$tmp_image_file_large);
  760.     }
  761.  
  762.    
  763.     if ( $_GET['imgName'] == $tmp_image_name ) {
  764.       // an image is selected, highlight it
  765.       echo '<tr id="defaultSelected" class="dataTableRowSelected" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="document.location.href=\''
  766.        . zen_href_link(FILENAME_IMAGE_HANDLER, 'products_filter=' . $_GET['products_filter']
  767.        . '&imgName=' .$tmp_image_name . '&action=layout_edit') . '\'">' . "\n";
  768.         // set some details for later usage
  769.       $selected_image_file = DIR_WS_CATALOG . $tmp_image_file_medium;
  770.       $selected_image_file_large = DIR_WS_CATALOG . $tmp_image_file_large;
  771.         $selected_image_link = $tmp_image_link;
  772.         $selected_image_name = $tmp_image_name;
  773.         $selected_image_suffix = preg_replace("/^".$products_image_base."/", '', $tmp_image_name);
  774.         $selected_image_extension = $products_image_extension;
  775.     } else {
  776.       echo '<tr class="dataTableRow" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="document.location.href=\''
  777.         . zen_href_link(FILENAME_IMAGE_HANDLER, 'products_filter=' . $_GET['products_filter']
  778.         . '&imgName=' . $tmp_image_name . '&action=layout_info') . '\'">' . "\n";
  779.     }
  780. ?>
  781.    
  782.       <td class="dataTableContent"><?php echo $tmp_image_name; ?></td>
  783.       <td class="dataTableContent" align="center" valign="top">
  784.         <?php
  785.           $preview_image = $tmp_image_preview->get_resized_image(IMAGE_SHOPPING_CART_WIDTH, IMAGE_SHOPPING_CART_HEIGHT, 'generic');
  786.           list($width, $height) = @getimagesize(DIR_FS_CATALOG . $preview_image);
  787.           $width = min($width, intval(IMAGE_SHOPPING_CART_WIDTH));
  788.           $height = min ($height, intval(IMAGE_SHOPPING_CART_HEIGHT));
  789.           echo zen_image(DIR_WS_CATALOG . $preview_image, addslashes($products_name), $width, $height) . '<br />';
  790.         ?>
  791.         <?php echo $text_default_size; ?>
  792.       </td>
  793.       <td class="dataTableContent" align="center" valign="top">
  794.         <?php
  795.           $preview_image = $tmp_image_medium_preview->get_resized_image(IMAGE_SHOPPING_CART_WIDTH, IMAGE_SHOPPING_CART_HEIGHT, 'generic');
  796.           list($width, $height) = @getimagesize(DIR_FS_CATALOG . $preview_image);
  797.           $width = min($width, intval(IMAGE_SHOPPING_CART_WIDTH));
  798.           $height = min ($height, intval(IMAGE_SHOPPING_CART_HEIGHT));
  799.           echo zen_image(DIR_WS_CATALOG . $preview_image, addslashes($products_name), $width, $height) . '<br />';
  800.           echo $text_medium_size . '<br />';
  801.           if (is_file($image_file_medium_full)) {
  802.             echo ' <a href="' . zen_href_link(FILENAME_IMAGE_HANDLER, 'imgName='
  803.               . $image_file_medium . '&products_filter=' . $_GET['products_filter'] . '&action=quick_delete') . '">'
  804.               . zen_image_button('button_delete.gif', IMAGE_DELETE) . '</a>';
  805.           }
  806.         ?>
  807.       </td>
  808.       <td class="dataTableContent" align="center" valign="top">
  809.         <?php
  810.           $preview_image = $tmp_image_large_preview->get_resized_image(IMAGE_SHOPPING_CART_WIDTH, IMAGE_SHOPPING_CART_HEIGHT, 'generic');
  811.           list($width, $height) = @getimagesize(DIR_FS_CATALOG . $preview_image);
  812.           $width = min($width, intval(IMAGE_SHOPPING_CART_WIDTH));
  813.           $height = min ($height, intval(IMAGE_SHOPPING_CART_HEIGHT));
  814.           echo zen_image(DIR_WS_CATALOG . $preview_image, addslashes($products_name), $width, $height) . '<br />';
  815.           echo $text_large_size . '<br />';
  816.           if (is_file($image_file_large_full)) {
  817.             echo ' <a href="' . zen_href_link(FILENAME_IMAGE_HANDLER, 'imgName='
  818.               . $image_file_large . '&products_filter=' . $_GET['products_filter'] . '&action=quick_delete') . '">'
  819.               . zen_image_button('button_delete.gif', IMAGE_DELETE) . '</a>';
  820.           }
  821.         ?>
  822.       </td>
  823.       <td class="dataTableContent" align="right"><?php
  824.         if ( $_GET['imgName'] == $tmp_image_name ) {
  825.           echo zen_image(DIR_WS_IMAGES . 'icon_arrow_right.gif', '');
  826.         } else {
  827.           echo '<a href="' . zen_href_link(FILENAME_IMAGE_HANDLER, 'products_filter=' . $_GET['products_filter']
  828.             . '&imgName=' . $tmp_image_name . '&action=layout_info')
  829.             . '">' . zen_image(DIR_WS_IMAGES . 'icon_info.gif', IMAGE_ICON_INFO) . '</a>';
  830.         }
  831.       ?>&nbsp;</td>
  832.     </tr>
  833. <?php  
  834.    
  835.   } // for each photo loop
  836. ?>
  837.   </table></td><!-- END Photo list table -->
  838.   <!-- Start Data Edit Pane -->
  839. <?php
  840.   $heading = array();
  841.   $contents = array();
  842.  
  843.   switch ($action) {
  844.     case 'layout_info':
  845.       // edit
  846.       list($width, $height) = @getimagesize(DIR_FS_CATALOG . $selected_image_file);
  847. //      $width = min($width, intval(MEDIUM_IMAGE_WIDTH));
  848. //      $height = min($height, intval(MEDIUM_IMAGE_HEIGHT));
  849.       $heading[] = array('text' => '<strong>' . TEXT_INFO_IMAGE_INFO . '</strong>');
  850.       $contents = array('align' => 'center', 'form' => zen_draw_form('image_define', FILENAME_IMAGE_HANDLER,
  851.         'page=' . $_GET['page'] . '&products_filter=' . $_GET['products_filter'] . '&action=save', 'post', 'enctype="multipart/form-data"'));
  852.           $contents[] = array('text' => '<strong>'.TEXT_INFO_NAME.': </strong>' . $selected_image_name .'<br />');
  853.           $contents[] = array('text' => '<strong>'.TEXT_INFO_FILE_TYPE.': </strong>' . $selected_image_extension .'<br />');
  854.           $contents[] = array('text' =>
  855.               '<script language="javascript" type="text/javascript"><!--
  856.              document.write(\'<a href="javascript:popupWindow(\\\'' . $selected_image_link . '\\\')">'
  857.              . zen_image($selected_image_file, addslashes($products_name), $width, $height)
  858.              . '<br />' . TEXT_CLICK_TO_ENLARGE . '</a>\');'
  859.               .'//-->'
  860.         .'</script>
  861.        <noscript>'
  862.         .'<a href="' . zen_href_link($selected_image_file_large) . '" target="_blank">'
  863.             . zen_image($selected_image_file, $products_name, $width, $height)
  864.             . TEXT_CLICK_TO_ENLARGE . '</a>'
  865.         .'</noscript>' );
  866.       // show new, delete, and edit buttons
  867.       $contents[] = array('align' => 'center', 'text' => '<br />' .
  868.         ' <a href="' . zen_href_link(FILENAME_IMAGE_HANDLER, 'imgName='
  869.         . $_GET['imgName'] . '&products_filter=' . $_GET['products_filter'] . '&action=layout_edit') . '">'
  870.         . zen_image_button('button_edit.gif', IMAGE_EDIT) . '</a> &nbsp; '
  871.         .' <a href="' . zen_href_link(FILENAME_IMAGE_HANDLER, 'imgName='
  872.         . $_GET['imgName'] . '&products_filter=' . $_GET['products_filter'] . '&action=layout_delete') . '">'
  873.         . zen_image_button('button_delete.gif', IMAGE_DELETE) . '</a> &nbsp;'
  874.         .' <a href="' . zen_href_link(FILENAME_IMAGE_HANDLER,
  875.         '&products_filter=' . $_GET['products_filter'] . '&action=layout_new') . '">'
  876.         . zen_image_button('button_new_file.gif', IMAGE_NEW) . '</a>');
  877.      
  878.       break;
  879.     case 'layout_edit':
  880.       // Edit specific details
  881.       $imgNameStr = '&imgEdit=1' .'&imgBase=' . $products_image_base
  882.           . "&imgSuffix=" . $selected_image_suffix
  883.           . "&imgBaseDir=" . $products_image_directory
  884.           . "&imgExtension=" . $selected_image_extension;
  885.       $heading[] = array('text' => '<strong>' . TEXT_INFO_EDIT_PHOTO . '</strong>');
  886.  
  887.     case 'layout_new':  
  888.      
  889.       if ( $action != 'layout_edit' ) {
  890.         $imgNameStr .= ( $no_images == 1 ) ? "&newImg=1" : '&imgBase='.$products_image_base
  891.           . "&imgBaseDir=" . $products_image_directory
  892.           . "&imgExtension=" . $products_image_extension;
  893.         $heading[] = array('text' => '<strong>' . TEXT_INFO_NEW_PHOTO . '</strong>');
  894.       }
  895.      
  896.      
  897.       $contents = array('form' => zen_draw_form('image_define', FILENAME_IMAGE_HANDLER,
  898.         '&products_filter=' . $_GET['products_filter'] . $imgNameStr
  899.         .'&action=save', 'post', 'enctype="multipart/form-data"'));
  900.  
  901.       // check if this is a master image or if no images exist
  902.       if ($no_images == 1) {
  903.         $contents[] = array('text' => '<strong>'.TEXT_INFO_IMAGE_BASE_NAME.'</strong><br />' );
  904.         $contents[] = array('text' => zen_draw_input_field('imgBase', '', 30));
  905.              
  906.         $dir = @dir(DIR_FS_CATALOG_IMAGES);
  907.             $dir_info[] = array('id' => '', 'text' => TEXT_INFO_MAIN_DIR);
  908.             while ($file = $dir->read()) {
  909.               if (is_dir(DIR_FS_CATALOG_IMAGES . $file)
  910.                   && strtoupper($file) != 'CVS'
  911.                   && $file != "."
  912.                   && $file != ".."
  913.                   && $file != 'original'
  914.                   && $file != 'medium'
  915.                   && $file != 'large') {
  916.                   $dir_info[] = array('id' => $file . '/', 'text' => $file);
  917.               }
  918.             }
  919.             $contents[] = array('text' => '<br /><strong>'.TEXT_INFO_BASE_DIR.'</strong><br />'.TEXT_INFO_NEW_DIR);
  920.             $contents[] = array('text' => TEXT_INFO_IMAGE_DIR . zen_draw_pull_down_menu('imgBaseDir', $dir_info, ""));
  921.             $contents[] = array('text' => TEXT_INFO_OR.' ' . zen_draw_input_field('imgNewBaseDir', '', 20) );
  922.  
  923.       } else if ($action != 'layout_edit') {
  924.             $contents[] = array('text' => '<strong>'.TEXT_INFO_IMAGE_SUFFIX.'</strong><br />'.TEXT_INFO_USE_AUTO_SUFFIX.'<br />' );
  925.             $contents[] = array('text' => zen_draw_input_field('imgSuffix', $selected_image_suffix, 10) );
  926.       }
  927.  
  928.       // Image fields
  929.       $contents[] = array('text' => '<br /><strong>' . TEXT_INFO_DEFAULT_IMAGE . '</strong><br />'
  930.           . TEXT_INFO_DEFAULT_IMAGE_HELP . '<br />'
  931.           . zen_draw_input_field('default_image', '', ' size="20" ', false, 'file') . '<br />' . $ptInfo->default_image);
  932.  
  933.       if ( $action == 'layout_edit' ) {
  934.         if ( $selected_image_name == $products_image_match_array[0]) {
  935.           $contents[] = array('text' => zen_draw_radio_field('imgNaming', 'new_discard', true)
  936.                 . IH_NEW_NAME_DISCARD_IMAGES . '<br />'
  937. //  new_copy functionality scheduled for future release                
  938. //            . zen_draw_radio_field('imgNaming', 'new_copy', false)
  939. //                . IH_NEW_NAME_COPY_IMAGES . '<br />'
  940.             . zen_draw_radio_field('imgNaming', 'keep_name', false)
  941.                 . IH_KEEP_NAME);
  942.         }
  943.       }
  944.  
  945.       $contents[] = array('text' => '<br /><strong>' . 'Medium image file (optional)' . '</strong><br />' .
  946.           zen_draw_input_field('medium_image', '', ' size="20" ', false, 'file') . '<br />' . $ptInfo->medium_image);
  947.       $contents[] = array('text' => '<br /><strong>' . 'Large image file (optional)' . '</strong><br />' .
  948.           zen_draw_input_field('large_image', '', ' size="20" ', false, 'file') . '<br />' . $ptInfo->large_image);
  949.       $contents[] = array('align' => 'center', 'text' => '<br />' . zen_image_submit('button_save.gif', IMAGE_SAVE) );
  950.       break;
  951.     case 'layout_delete':
  952.  
  953.       $imgStr = "&imgBase=" . $products_image_base
  954.           . "&imgSuffix=" . $selected_image_suffix
  955.           . "&imgBaseDir=" . $products_image_directory
  956.           . "&imgExtension=" . $selected_image_extension;
  957.          
  958.       // show new button      
  959.       $heading[] = array('text' => '<strong>' . TEXT_INFO_CONFIRM_DELETE . '</strong>');
  960.      
  961.       $contents[] = array('text' => '<br />' . $products_image_directory.$products_image_base.$selected_image_suffix.$selected_image_extension);
  962.       $contents[] = array('text' => '<br />' . TEXT_INFO_CONFIRM_DELETE_SURE);
  963.       if ($selected_image_suffix == '') {
  964.         $contents[] = array('text' => zen_draw_checkbox_field('delete_from_database_only', 'Y', false) . IH_DELETE_FROM_DB_ONLY);
  965.       }
  966.  
  967.       $contents[] = array('align' => 'center', 'text' => '<br />'
  968.         .' <a href="' . zen_href_link(FILENAME_IMAGE_HANDLER,
  969.         '&products_filter=' . $_GET['products_filter'] . '&action=delete'
  970.         . $imgStr ) . '">'
  971.         . zen_image_button( 'button_delete.gif', IMAGE_DELETE ) . '</a>');
  972.       break;
  973.     default:
  974.       // show new button      
  975.       $heading[] = array('text' => '<strong>' . TEXT_INFO_SELECT_ACTION . '</strong>');
  976.       $contents = array('form' => zen_draw_form('image_define', FILENAME_PRODUCT_TYPES, 'page=' . $_GET['page'] . '&ptID=' . $ptInfo->type_id . '&action=new', 'post', 'enctype="multipart/form-data"'));
  977.       $contents[] = array('text' => '<br />' . TEXT_INFO_CLICK_TO_ADD);
  978.       $contents[] = array('align' => 'center', 'text' => '<br />'
  979.         .' <a href="' . zen_href_link(FILENAME_IMAGE_HANDLER,
  980.         '&products_filter=' . $_GET['products_filter'] . '&action=layout_new') . '">'
  981.         . zen_image_button('button_new_file.gif', IMAGE_NEW) . '</a>');
  982.       break;
  983.   }
  984.  
  985.   if ( (zen_not_null($heading)) && (zen_not_null($contents)) ) {
  986.     echo '            <td width="25%" valign="top">' . "\n";
  987.  
  988.     $box = new box;
  989.     echo $box->infoBox($heading, $contents);
  990.  
  991.     echo '            </td>' . "\n";
  992.   }
  993. ?>  
  994.   </tr></table>
  995. <?php
  996.  
  997.   } // if products_id
  998.  
  999. } // if products_filter
  1000. ?>
  1001. </div>
  1002. <?php
  1003. } // if $page == 'manager'
  1004.  
  1005.  
  1006. /**
  1007.  * PREVIEW TABPAGE
  1008.  */
  1009.  
  1010. if ($page == 'preview') {
  1011.   $images = array();
  1012.   $pngimage = new ih_image(basename($ihConf['dir']['admin']) . "/" . 'images/ih-test.png', intval($ihConf['small']['width']), intval($ihConf['small']['height']));
  1013.   $images['pngsource'] = $pngimage->get_resized_image(intval($ihConf['small']['width']), intval($ihConf['small']['height']), 'orig');
  1014.   $images['pngsmall'] = $pngimage->get_resized_image($ihConf['small']['width'], $ihConf['small']['height'], 'small');
  1015.   $images['pngmedium'] = $pngimage->get_resized_image($ihConf['medium']['width'], $ihConf['medium']['height'], 'medium');
  1016.   $images['pnglarge'] = $pngimage->get_resized_image($ihConf['large']['width'], $ihConf['large']['height'], 'large');
  1017.  
  1018.   $jpgimage = new ih_image(basename($ihConf['dir']['admin']) . "/" . 'images/ih-test.jpg', intval($ihConf['small']['width']), intval($ihConf['small']['height']));
  1019.   $images['jpgsource'] = $jpgimage->get_resized_image(intval($ihConf['small']['width']), intval($ihConf['small']['height']), 'orig');
  1020.   $images['jpgsmall'] = $jpgimage->get_resized_image($ihConf['small']['width'], $ihConf['small']['height'], 'small');
  1021.   $images['jpgmedium'] = $jpgimage->get_resized_image($ihConf['medium']['width'], $ihConf['medium']['height'], 'medium');
  1022.   $images['jpglarge'] = $jpgimage->get_resized_image($ihConf['large']['width'], $ihConf['large']['height'], 'large');
  1023.  
  1024.   $gifimage = new ih_image(basename($ihConf['dir']['admin']) . "/" . 'images/ih-test.gif', intval($ihConf['small']['width']), intval($ihConf['small']['height']));
  1025.   $images['gifsource'] = $gifimage->get_resized_image(intval($ihConf['small']['width']), intval($ihConf['small']['height']), 'orig');
  1026.   $images['gifsmall'] = $gifimage->get_resized_image($ihConf['small']['width'], $ihConf['small']['height'], 'small');
  1027.   $images['gifmedium'] = $gifimage->get_resized_image($ihConf['medium']['width'], $ihConf['medium']['height'], 'medium');
  1028.   $images['giflarge'] = $gifimage->get_resized_image($ihConf['large']['width'], $ihConf['large']['height'], 'large');
  1029.  
  1030. ?>
  1031.   <table style="background-color:#F5F5F5" cellspacing="0" cellpadding="5px" border="0">
  1032.     <tr>
  1033.         <th style="border-bottom: 1px solid #CCCCCC; border-right: 1px solid #CCCCCC"><?php echo IH_SOURCE_TYPE; ?></th>
  1034.         <th style="border-bottom: 1px solid #CCCCCC"><?php echo IH_SOURCE_IMAGE; ?></th>
  1035.         <th style="border-bottom: 1px solid #CCCCCC"><?php echo IH_SMALL_IMAGE; ?></th>
  1036.         <th style="border-bottom: 1px solid #CCCCCC"><?php echo IH_MEDIUM_IMAGE; ?></th>
  1037.     </tr>
  1038.     <!-- source png row -->
  1039.     <tr>
  1040.         <td style="border-right: 1px solid #CCCCCC"><strong>png</strong></td>
  1041.         <td><img style="border: 1px solid #000000; background:url(images/checkpattern.gif)" src="<?php echo HTTP_SERVER . DIR_WS_CATALOG . $images['pngsource']?>" /></td>
  1042.         <td><img style="border: 1px solid #000000; background:url(images/checkpattern.gif)" src="<?php echo HTTP_SERVER . DIR_WS_CATALOG . $images['pngsmall']?>" /></td>
  1043.         <td><img style="border: 1px solid #000000; background:url(images/checkpattern.gif)" src="<?php echo HTTP_SERVER . DIR_WS_CATALOG . $images['pngmedium']?>" /></td>
  1044.     </tr>
  1045.     <!-- source jpg row -->
  1046.     <tr>
  1047.         <td style="border-right: 1px solid #CCCCCC"><strong>jpg</strong></td>
  1048.         <td><img style="border: 1px solid #000000; background:url(images/checkpattern.gif)" src="<?php echo HTTP_SERVER . DIR_WS_CATALOG . $images['jpgsource']?>" /></td>
  1049.         <td><img style="border: 1px solid #000000; background:url(images/checkpattern.gif)" src="<?php echo HTTP_SERVER . DIR_WS_CATALOG . $images['jpgsmall']?>" /></td>
  1050.         <td><img style="border: 1px solid #000000; background:url(images/checkpattern.gif)" src="<?php echo HTTP_SERVER . DIR_WS_CATALOG . $images['jpgmedium']?>" /></td>
  1051.     </tr>
  1052.     <!-- source gif row -->
  1053.     <tr style="border-right: 1px solid #CCCCCC">
  1054.         <td style="border-right: 1px solid #CCCCCC"><strong>gif</strong></td>
  1055.         <td><img style="border: 1px solid #000000; background:url(images/checkpattern.gif)" src="<?php echo HTTP_SERVER . DIR_WS_CATALOG . $images['gifsource']?>" /></td>
  1056.         <td><img style="border: 1px solid #000000; background:url(images/checkpattern.gif)" src="<?php echo HTTP_SERVER . DIR_WS_CATALOG . $images['gifsmall']?>" /></td>
  1057.         <td><img style="border: 1px solid #000000; background:url(images/checkpattern.gif)" src="<?php echo HTTP_SERVER . DIR_WS_CATALOG . $images['gifmedium']?>" /></td>
  1058.     </tr>
  1059.   </table>
  1060. <?php
  1061. }
  1062.  
  1063.  
  1064.  
  1065. /**
  1066.  * ABOUT TABPAGE
  1067.  */
  1068.  
  1069. if ($page == 'about') {
  1070. ?>
  1071. <div class="aboutbox">
  1072. <p>
  1073.   <h2>图像管理模块 <sup>2</sup></h2>
  1074.   by<br />
  1075.   <a href="http://breakmyzencart.com/">breakmyzencart.com</a><br />
  1076.   (<a href="mailto:tim@breakmyzencart.com">tim@breakmyzencart.com</a>)<br />
  1077. </p>
  1078. <p>
  1079. Donations help me divert more time from other projects to breakmyzencart,
  1080. which means you get the great new Zen-Cart contributions, maintenance of
  1081. current releases for your ease of use and this informational website stays
  1082. up-to-date.
  1083. </p>
  1084. <p>
  1085. And don&rsquo;t forget my university studies! You help with that, too!
  1086. </p>
  1087. <p>
  1088. Any amount is very much appreciated, so don&rsquo;t hesitate to send whatever
  1089. you can. Every little bit helps!<br />
  1090. Thank you!
  1091. </p>
  1092.  
  1093. </div>
  1094.  
  1095. </div>
  1096. <?php
  1097. }
  1098. ?>
  1099. <!-- body_eof //-->
  1100. <!-- footer //-->
  1101. <?php
  1102.     require(DIR_WS_INCLUDES . 'footer.php');
  1103. ?>
  1104. <!-- footer_eof //-->
  1105. </body>
  1106. </html>
  1107. <?php
  1108.     require(DIR_WS_INCLUDES . 'application_bottom.php');


cron