home *** CD-ROM | disk | FTP | other *** search
/ Practical Internet Web Designer 90 / PIWD90.iso / pc / contents / ecommerce / software / osCommerce.exe / oscommerce-2.2ms2 / catalog / admin / cache.php < prev    next >
PHP Script  |  2003-06-29  |  5KB  |  132 lines

  1. <?php
  2. /*
  3.   $Id: cache.php,v 1.23 2003/06/29 22:50:51 hpdl Exp $
  4.  
  5.   osCommerce, Open Source E-Commerce Solutions
  6.   http://www.oscommerce.com
  7.  
  8.   Copyright (c) 2003 osCommerce
  9.  
  10.   Released under the GNU General Public License
  11. */
  12.  
  13.   require('includes/application_top.php');
  14.  
  15.   $action = (isset($HTTP_GET_VARS['action']) ? $HTTP_GET_VARS['action'] : '');
  16.  
  17.   if (tep_not_null($action)) {
  18.     if ($action == 'reset') {
  19.       tep_reset_cache_block($HTTP_GET_VARS['block']);
  20.     }
  21.  
  22.     tep_redirect(tep_href_link(FILENAME_CACHE));
  23.   }
  24.  
  25. // check if the cache directory exists
  26.   if (is_dir(DIR_FS_CACHE)) {
  27.     if (!is_writeable(DIR_FS_CACHE)) $messageStack->add(ERROR_CACHE_DIRECTORY_NOT_WRITEABLE, 'error');
  28.   } else {
  29.     $messageStack->add(ERROR_CACHE_DIRECTORY_DOES_NOT_EXIST, 'error');
  30.   }
  31. ?>
  32. <!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
  33. <html <?php echo HTML_PARAMS; ?>>
  34. <head>
  35. <meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">
  36. <title><?php echo TITLE; ?></title>
  37. <link rel="stylesheet" type="text/css" href="includes/stylesheet.css">
  38. <script language="javascript" src="includes/general.js"></script>
  39. </head>
  40. <body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0" bgcolor="#FFFFFF">
  41. <!-- header //-->
  42. <?php require(DIR_WS_INCLUDES . 'header.php'); ?>
  43. <!-- header_eof //-->
  44.  
  45. <!-- body //-->
  46. <table border="0" width="100%" cellspacing="2" cellpadding="2">
  47.   <tr>
  48.     <td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="1" cellpadding="1" class="columnLeft">
  49. <!-- left_navigation //-->
  50. <?php require(DIR_WS_INCLUDES . 'column_left.php'); ?>
  51. <!-- left_navigation_eof //-->
  52.     </table></td>
  53. <!-- body_text //-->
  54.     <td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2">
  55.       <tr>
  56.         <td><table border="0" width="100%" cellspacing="0" cellpadding="0">
  57.           <tr>
  58.             <td class="pageHeading"><?php echo HEADING_TITLE; ?></td>
  59.             <td class="pageHeading" align="right"><?php echo tep_draw_separator('pixel_trans.gif', HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td>
  60.           </tr>
  61.         </table></td>
  62.       </tr>
  63.       <tr>
  64.         <td><table border="0" width="100%" cellspacing="0" cellpadding="0">
  65.           <tr>
  66.             <td valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2">
  67.               <tr class="dataTableHeadingRow">
  68.                 <td class="dataTableHeadingContent"><?php echo TABLE_HEADING_CACHE; ?></td>
  69.                 <td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_DATE_CREATED; ?></td>
  70.                 <td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_ACTION; ?> </td>
  71.               </tr>
  72. <?php
  73.   if ($messageStack->size < 1) {
  74.     $languages = tep_get_languages();
  75.  
  76.     for ($i=0, $n=sizeof($languages); $i<$n; $i++) {
  77.       if ($languages[$i]['code'] == DEFAULT_LANGUAGE) {
  78.         $language = $languages[$i]['directory'];
  79.       }
  80.     }
  81.  
  82.     for ($i=0, $n=sizeof($cache_blocks); $i<$n; $i++) {
  83.       $cached_file = ereg_replace('-language', '-' . $language, $cache_blocks[$i]['file']);
  84.  
  85.       if (file_exists(DIR_FS_CACHE . $cached_file)) {
  86.         $cache_mtime = strftime(DATE_TIME_FORMAT, filemtime(DIR_FS_CACHE . $cached_file));
  87.       } else {
  88.         $cache_mtime = TEXT_FILE_DOES_NOT_EXIST;
  89.         $dir = dir(DIR_FS_CACHE);
  90.  
  91.         while ($cache_file = $dir->read()) {
  92.           $cached_file = ereg_replace('-language', '-' . $language, $cache_blocks[$i]['file']);
  93.  
  94.           if (ereg('^' . $cached_file, $cache_file)) {
  95.             $cache_mtime = strftime(DATE_TIME_FORMAT, filemtime(DIR_FS_CACHE . $cache_file));
  96.             break;
  97.           }
  98.         }
  99.  
  100.         $dir->close();
  101.       }
  102. ?>
  103.               <tr class="dataTableRow" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)">
  104.                 <td class="dataTableContent"><?php echo $cache_blocks[$i]['title']; ?></td>
  105.                 <td class="dataTableContent" align="right"><?php echo $cache_mtime; ?></td>
  106.                 <td class="dataTableContent" align="right"><?php echo '<a href="' . tep_href_link(FILENAME_CACHE, 'action=reset&block=' . $cache_blocks[$i]['code'], 'NONSSL') . '">' . tep_image(DIR_WS_IMAGES . 'icon_reset.gif', 'Reset', 13, 13) . '</a>'; ?> </td>
  107.               </tr>
  108. <?php
  109.     }
  110.   }
  111. ?>
  112.               <tr>
  113.                 <td class="smallText" colspan="3"><?php echo TEXT_CACHE_DIRECTORY . ' ' . DIR_FS_CACHE; ?></td>
  114.               </tr>
  115.             </table></td>
  116.           </tr>
  117.         </table></td>
  118.       </tr>
  119.     </table></td>
  120. <!-- body_text_eof //-->
  121.   </tr>
  122. </table>
  123. <!-- body_eof //-->
  124.  
  125. <!-- footer //-->
  126. <?php require(DIR_WS_INCLUDES . 'footer.php'); ?>
  127. <!-- footer_eof //-->
  128. <br>
  129. </body>
  130. </html>
  131. <?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>
  132.