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

Zen Cart 源代码 define_pages_editor.php




下载文件

文件名: define_pages_editor.php
文件类型: PHP文件
文件大小: 10.02 KiB
MD5: 4327e02848f214354dacd5b50bf7f479

define_pages_editor.php - 关闭高亮
  1. <?php
  2. /**
  3.  * @package admin
  4.  * @copyright Copyright 2003-2011 Zen Cart Development Team
  5.  * @copyright Portions Copyright 2003 osCommerce
  6.  * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
  7.  * @version $Id: define_pages_editor.php 19330 2011-08-07 06:32:56Z drbyte $
  8.  */
  9.  
  10.   require('includes/application_top.php');
  11.  
  12.   function zen_display_files() {
  13.     global $check_directory, $found, $configuration_key_lookup;
  14.     for ($i = 0, $n = sizeof($check_directory); $i < $n; $i++) {
  15. //echo 'I SEE ' . $check_directory[$i] . '<br>';
  16.  
  17.       $dir_check = $check_directory[$i];
  18.       $file_extension = '.php';
  19.  
  20.       if ($dir = @dir($dir_check)) {
  21.         while ($file = $dir->read()) {
  22.           if (!is_dir($dir_check . $file)) {
  23.             if (substr($file, strrpos($file, '.')) == $file_extension) {
  24.               $directory_array[] = $file;
  25.             }
  26.           }
  27.         }
  28.         if (sizeof($directory_array)) {
  29.           sort($directory_array);
  30.         }
  31.         $dir->close();
  32.       }
  33.     }
  34.     return $directory_array;
  35.   }
  36.  
  37.   $action = (isset($_GET['action']) ? $_GET['action'] : '');
  38.  
  39.   $za_who = $_GET['za_lookup'];
  40.  
  41.   if ($action == 'new_page') {
  42.     $page = $_GET['define_it'];
  43.  
  44.     $check_directory = array();
  45.     $check_directory[] = DIR_FS_CATALOG . DIR_WS_LANGUAGES . $_SESSION['language'] . '/html_includes/';
  46.     $directory_files = zen_display_files();
  47.  
  48.     $za_lookup = array();
  49.     for ($i = 0, $n = sizeof($directory_files); $i < $n; $i++) {
  50.       $za_lookup[] = array('id' => $i, 'text' => $directory_files[$i]);
  51.     }
  52.  
  53. // This will cause it to look for 'define_conditions.php'
  54.     $_GET['filename'] = $za_lookup[$page]['text'];
  55.     $_GET['box_name'] = BOX_TOOLS_DEFINE_CONDITIONS;
  56.   }
  57.  
  58. // define template specific file name defines
  59.   $file = zen_get_file_directory(DIR_FS_CATALOG_LANGUAGES . $_SESSION['language'] . '/html_includes/', $_GET['filename'], 'false');
  60. ?>
  61. <?php
  62.   switch ($_GET['action']) {
  63.       case 'set_editor':
  64.         // Reset will be done by init_html_editor.php. Now we simply redirect to refresh page properly.
  65.         $action='';
  66.         zen_redirect(zen_href_link(FILENAME_DEFINE_PAGES_EDITOR));
  67.         break;
  68.     case 'save':
  69.       if ( ($_GET['lngdir']) && ($_GET['filename']) ) {
  70.         if (file_exists($file)) {
  71.           if (file_exists('bak' . $file)) {
  72.             @unlink('bak' . $file);
  73.           }
  74.           @rename($file, 'bak' . $file);
  75.           $new_file = fopen($file, 'w');
  76.           $file_contents = stripslashes($_POST['file_contents']);
  77.           fwrite($new_file, $file_contents, strlen($file_contents));
  78.           fclose($new_file);
  79.         }
  80.         zen_redirect(zen_href_link(FILENAME_DEFINE_PAGES_EDITOR));
  81.       }
  82.       break;
  83.   }
  84.  
  85.   if (!$_SESSION['language']) $_SESSION['language'] = $language;
  86.  
  87.   $languages_array = array();
  88.   $languages = zen_get_languages();
  89.   $lng_exists = false;
  90.   for ($i=0; $i<sizeof($languages); $i++) {
  91.     if ($languages[$i]['directory'] == $_SESSION['language']) $lng_exists = true;
  92.  
  93.     $languages_array[] = array('id' => $languages[$i]['directory'],
  94.                                'text' => $languages[$i]['name']);
  95.   }
  96.   if (!$lng_exists) $_SESSION['language'] = $language;
  97. ?>
  98. <!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
  99. <html <?php echo HTML_PARAMS; ?>>
  100. <head>
  101. <meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">
  102. <title><?php echo TITLE; ?></title>
  103. <link rel="stylesheet" type="text/css" href="includes/stylesheet.css">
  104. <link rel="stylesheet" type="text/css" href="includes/cssjsmenuhover.css" media="all" id="hoverJS">
  105. <script language="javascript" src="includes/menu.js"></script>
  106. <script language="javascript" src="includes/general.js"></script>
  107. <script type="text/javascript">
  108.   <!--
  109.   function init()
  110.   {
  111.     cssjsmenu('navbar');
  112.     if (document.getElementById)
  113.     {
  114.       var kill = document.getElementById('hoverJS');
  115.       kill.disabled = true;
  116.     }
  117.   if (typeof _editor_url == "string") HTMLArea.replaceAll();
  118.   }
  119.   // -->
  120. </script>
  121. <?php if ($editor_handler != '') include ($editor_handler); ?>
  122. </head>
  123. <body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0" bgcolor="#FFFFFF" onLoad="init()">
  124. <div id="spiffycalendar" class="text"></div>
  125. <!-- header //-->
  126. <?php require(DIR_WS_INCLUDES . 'header.php'); ?>
  127. <!-- header_eof //-->
  128.  
  129. <!-- body //-->
  130. <table border="0" width="100%" cellspacing="2" cellpadding="2">
  131.   <tr>
  132. <!-- body_text //-->
  133.     <td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2">
  134.       <tr>
  135.         <td class="pageHeading"><?php echo HEADING_TITLE . '&nbsp;' . $_SESSION['language']; ?> &nbsp;&nbsp;
  136.           <?php
  137.             $check_directory = array();
  138.             $check_directory[] = DIR_FS_CATALOG . DIR_WS_LANGUAGES . $_SESSION['language'] . '/html_includes/';
  139.             $directory_files = zen_display_files();
  140.  
  141.             $za_lookup = array();
  142.             $za_lookup[] = array('id' => -1, 'text' => TEXT_INFO_SELECT_FILE);
  143.  
  144.             for ($i = 0, $n = sizeof($directory_files); $i < $n; $i++) {
  145.               $za_lookup[] = array('id' => $i, 'text' => $directory_files[$i]);
  146.             }
  147.  
  148.             echo zen_draw_form('new_page', FILENAME_DEFINE_PAGES_EDITOR, '', 'get') . '&nbsp;&nbsp;' . zen_draw_pull_down_menu('define_it', $za_lookup, '-1', 'onChange="this.form.submit();"') .
  149.             zen_hide_session_id() .
  150.             zen_draw_hidden_field('action', 'new_page') . '&nbsp;&nbsp;</form>';
  151.           ?>
  152. <?php
  153. // toggle switch for editor
  154.         echo TEXT_EDITOR_INFO . zen_draw_form('set_editor_form', FILENAME_DEFINE_PAGES_EDITOR, '', 'get') . '&nbsp;&nbsp;' . zen_draw_pull_down_menu('reset_editor', $editors_pulldown, $current_editor_key, 'onChange="this.form.submit();"') .
  155.         zen_draw_hidden_field('action', 'set_editor') .
  156.         zen_hide_session_id() .
  157.         '</form>';
  158. ?>
  159.         </td>
  160.       </tr>
  161. <?php
  162. // show editor
  163. if (isset($_GET['filename'])) {
  164. ?>
  165.       <tr>
  166.         <td><table border="0" width="100%" cellspacing="0" cellpadding="2">
  167. <?php
  168.   if ( ($_SESSION['language']) && ($_GET['filename']) ) {
  169.     if (file_exists($file)) {
  170.       $file_array = @file($file);
  171.       $file_contents = @implode('', $file_array);
  172.  
  173.       $file_writeable = true;
  174.       if (!is_writeable($file)) {
  175.         $file_writeable = false;
  176.         $messageStack->reset();
  177.         $messageStack->add(sprintf(ERROR_FILE_NOT_WRITEABLE, $file), 'error');
  178.         echo $messageStack->output();
  179.       }
  180.  
  181. ?>
  182.               <tr>
  183.             <td class="main"><b><?php echo TEXT_INFO_CAUTION . '<br /><br />' . TEXT_INFO_EDITING . '<br />' . $file . '<br />'; ?></b></td>
  184.               </tr>
  185.           <tr><?php echo zen_draw_form('language', FILENAME_DEFINE_PAGES_EDITOR, 'lngdir=' . $_SESSION['language'] . '&filename=' . $_GET['filename'] . '&action=save'); ?>
  186.             <td><table border="0" cellspacing="0" cellpadding="2">
  187.               <tr>
  188.                 <td class="main"><?php echo zen_draw_textarea_field('file_contents', 'soft', '100%', '30', htmlspecialchars($file_contents, ENT_COMPAT, CHARSET, TRUE), (($file_writeable) ? '' : 'readonly') . ' id="file_contents"'); ?></td>
  189.               </tr>
  190.               <tr>
  191.                 <td><?php echo zen_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
  192.               </tr>
  193.               <tr>
  194.                 <td align="right"><?php if ($file_writeable) { echo zen_image_submit('button_save.gif', IMAGE_SAVE) . '&nbsp;<a href="' . zen_href_link(FILENAME_DEFINE_PAGES_EDITOR, 'define_it=' .$_GET['define_it'] . '&action=new_page') . '">' . zen_image_button('button_reset.gif', IMAGE_RESET) . '</a>' . '&nbsp;' . '<a href="' . zen_href_link(FILENAME_DEFINE_PAGES_EDITOR . '.php') . '">' . zen_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>'; } else { echo '<a href="' . zen_href_link(FILENAME_DEFINE_PAGES_EDITOR, 'lngdir=' . $_SESSION['language']) . '">' . zen_image_button('button_back.gif', IMAGE_BACK) . '</a>'; } ?></td>
  195.               </tr>
  196.             </table></td>
  197.           </form></tr>
  198. <?php
  199.     } else {
  200. ?>
  201.           <tr>
  202.             <td class="main"><b><?php echo sprintf(TEXT_FILE_DOES_NOT_EXIST, $file); ?></b></td>
  203.           </tr>
  204.           <tr>
  205.             <td><?php echo zen_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
  206.           </tr>
  207.           <tr>
  208.             <td><?php echo '<a href="' . zen_href_link($_GET['filename'], 'lngdir=' . $_SESSION['language']) . '">' . zen_image_button('button_back.gif', IMAGE_BACK) . '</a>'; ?></td>
  209.           </tr>
  210. <?php
  211.     }
  212.   } else {
  213.     $filename = $_SESSION['language'] . '.php';
  214. ?>
  215.           <tr>
  216.             <td><table width="100%" border="0" cellspacing="0" cellpadding="0">
  217.               <tr>
  218.                 <td class="smallText"><a href="<?php echo zen_href_link($_GET['filename'], 'lngdir=' . $_SESSION['language'] . '&filename=' . $filename); ?>"><b><?php echo $filename; ?></b></a></td>
  219. <?php
  220.     $dir = dir(DIR_FS_CATALOG_LANGUAGES . $_SESSION['language']);
  221.     $left = false;
  222.     if ($dir) {
  223.       $file_extension = substr($PHP_SELF, strrpos($PHP_SELF, '.'));
  224.       while ($file = $dir->read()) {
  225.         if (substr($file, strrpos($file, '.')) == $file_extension) {
  226.           echo '                <td class="smallText"><a href="' . zen_href_link($_GET['filename'], 'lngdir=' . $_SESSION['language'] . '&filename=' . $file) . '">' . $file . '</a></td>' . "\n";
  227.           if (!$left) {
  228.             echo '              </tr>' . "\n" .
  229.                  '              <tr>' . "\n";
  230.           }
  231.           $left = !$left;
  232.         }
  233.       }
  234.       $dir->close();
  235.     }
  236. ?>
  237.  
  238.               </tr>
  239.             </table></td>
  240.           </tr>
  241. <?php
  242.   }
  243. ?>
  244.         </table></td>
  245. <?php } // filename ?>
  246.       </tr>
  247.     </table></td>
  248. <!-- body_text_eof //-->
  249.   </tr>
  250. </table>
  251. <!-- body_eof //-->
  252.  
  253. <!-- footer //-->
  254. <?php require(DIR_WS_INCLUDES . 'footer.php'); ?>
  255. <!-- footer_eof //-->
  256. <br />
  257. </body>
  258. </html>
  259. <?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>
  260.  


cron