[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 源代码 popup_file_select.php

Zen Cart 源代码 popup_file_select.php




下载文件

文件名: popup_file_select.php
文件类型: PHP文件
文件大小: 4.39 KiB
MD5: 41ca59b23d47ca36f5684dba7272491b

popup_file_select.php - 关闭高亮
  1. <?php
  2. /**
  3.  * @package admin
  4.  * @copyright Copyright 2006 Andrew Berezin andrew@eCommerce-service.com
  5.  * @copyright Copyright 2003-2006 Zen Cart Development Team
  6.  * @copyright Portions Copyright 2003 osCommerce
  7.  * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
  8.  * @version $Id: popup_file_select.php v1.0.0 13.10.2006 2:30 Andrew Berezin $
  9.  */
  10.  
  11. require('includes/application_top.php');
  12. @define('FILENAME_POPUP_FILE_SELECT', 'popup_file_select');
  13.  
  14. $filter = array('jpg', 'png', 'gif', 'bmp');
  15.  
  16. if(isset($_GET['sdir'])) $subdir = zen_db_input($_GET['sdir']);
  17. else $subdir = '';
  18.  
  19. $d = dir(DIR_FS_CATALOG_IMAGES . $subdir);
  20. $curdir = preg_replace('@^' . DIR_FS_CATALOG_IMAGES . '@', '', $d->path);
  21. $updir = explode('/', trim($curdir, '/'));
  22. unset($updir[sizeof($updir)-1]);
  23. $updir = implode('/', $updir);
  24.  
  25. while (false !== ($entry = $d->read())) {
  26.     if($entry == '..' && $d->path != DIR_FS_CATALOG_IMAGES) {
  27.         $dirs[$entry] = '<a href="' . zen_href_link(FILENAME_POPUP_FILE_SELECT, 'sdir=' . $updir . '/') . '">' . zen_image(DIR_WS_ICONS . 'previous_level.gif', ICON_PREVIOUS_LEVEL) . '&nbsp;' . $entry . '</a>';
  28.     }
  29.     if($entry == '..' || $entry == '.') continue;
  30.     if (filetype($d->path . $entry) == "dir") {
  31.         $dirs[$entry] = '<a href="' . zen_href_link(FILENAME_POPUP_FILE_SELECT, 'sdir=' . $curdir . $entry . '/') . '">' . zen_image(DIR_WS_ICONS . 'folder.gif', ICON_FOLDER) . '&nbsp;' . $entry . '</a>';
  32.     } else {
  33.         $ext = explode('.', $entry);
  34.         if(!in_array(end($ext), $filter)) continue;
  35.         $files[$entry] = '<a href="javascript:previewImage(\'' . ltrim($curdir, '/') . $entry . '\');">' . zen_image(DIR_WS_ICONS . 'preview.gif', ICON_PREVIEW). '&nbsp;' . $entry . '</a>';
  36.     }
  37. }
  38. $d->close();
  39. @ksort($dirs);
  40. @ksort($files);
  41. ?>
  42. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  43. <html <?php echo HTML_PARAMS; ?>>
  44. <head>
  45. <meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">
  46. <title>Zen Cart!</title>
  47. <script type="text/javascript">
  48.   <!--
  49.   var DIR_WS_CATALOG_IMAGES='<?php echo DIR_WS_CATALOG_IMAGES; ?>';
  50. function getObject(elementID) {
  51.     if (document.getElementById) {
  52.       return document.getElementById(elementID);
  53.     } else if (document.all) {
  54.       return document.all[elementID];
  55.     } else if (document.layers) {
  56.       return document.layers[elementID];
  57.     }
  58.    return false;
  59. }
  60.  
  61.   function setImage(file) {
  62.     opener.document.getElementById(opener.selectFileID).value = file;
  63.     var iimg = opener.document.getElementById(opener.updateImgId);
  64.     iimg.src = DIR_WS_CATALOG_IMAGES+file;
  65. //    vardump(iimg);
  66. //    idiv.replaceChild(imgNew, iimg);
  67.     window.close();
  68.   }
  69.  
  70.   function previewImage(file) {
  71.     var idiv = getObject('fileinfo');
  72.     var iimg = getObject('fileimg');
  73.     idiv.style.display = 'block';
  74.     var imgNew=document.createElement('img');
  75.     imgNew.src = DIR_WS_CATALOG_IMAGES+file;
  76.     imgNew.id = 'fileimg';
  77.     idiv.replaceChild(imgNew, iimg);
  78.     getObject('imageSelectHref').href = "javascript:setImage('"+file+"');";
  79.     getObject('imageName').innerHTML = file;
  80.   }
  81.  
  82. function vardump(obj){
  83.   arr = obj;
  84.   s = '';
  85.   var i = 0;
  86.   if(typeof(obj) == 'object') {
  87.       for (var k in arr) {
  88.         i++;
  89.         s += k + "=>" + arr[k] + "\n";
  90.         if (typeof(arr[k]) == "object") {
  91.           arr1 = arr[k];
  92.           for (var k1 in arr1) {
  93.     //        alert(k + "=>" + k1 + " : " + arr1[k1]);
  94.     //           s += k + "=>" + k1 + " : " + arr1[k1] + "\n";
  95.           }
  96.         }
  97.         if(i>10){
  98.           alert(s);
  99.           s = '';
  100.           i = 0;
  101.         }
  102.     }
  103.   } else {
  104.     s += "" + obj + "\n";
  105.   }
  106.   if(s != '') alert(s);
  107. }
  108.   // -->
  109. </script>
  110. </head>
  111. <body>
  112. <table width="100%">
  113.   <tr>
  114.     <td valign="top" width="30%">
  115. <?php
  116. if(sizeof($dirs) > 0 ) {
  117.     foreach($dirs as $k => $val) {
  118.         echo $val . '<br />' . "\n";
  119.     }
  120. }
  121. ?>
  122.     </td>
  123.     <td valign="top" width="30%">
  124. <?php
  125. if(sizeof($files) > 0 ) {
  126.     foreach($files as $k => $val) {
  127.         echo $val . '<br />' . "\n";
  128.     }
  129. }
  130. ?>
  131.     </td>
  132.     <td valign="top" width="40%">
  133.       <div id="fileinfo" style="display:none;text-align:center">
  134.  
  135.       <img src="" border="0" alt="" title="" id="fileimg" />
  136.  
  137.       <br /><a href="" id="imageSelectHref">
  138.       Select
  139.       <br />
  140.       <span id="imageName"></span>
  141.         </a>
  142.       </div>
  143.     </td>
  144.     </tr>
  145.   </table>
  146. </body>
  147. </html>


cron