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

Zen Cart 源代码 template_select.php




下载文件

文件名: template_select.php
文件类型: PHP文件
文件大小: 13.6 KiB
MD5: 6403df994b5bbbf7218fbe04c65c7d09

template_select.php - 关闭高亮
  1. <?php
  2. /**
  3.  * @package admin
  4.  * @copyright Copyright 2003-2007 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: template_select.php 6131 2007-04-08 06:56:51Z drbyte $
  8.  */
  9.  
  10.   require('includes/application_top.php');
  11. // get an array of template info
  12.   $dir = @dir(DIR_FS_CATALOG_TEMPLATES);
  13.   if (!$dir) die('DIR_FS_CATALOG_TEMPLATES NOT SET');
  14.   while ($file = $dir->read()) {
  15.     if (is_dir(DIR_FS_CATALOG_TEMPLATES . $file) && strtoupper($file) != 'CVS' && $file != 'template_default') {
  16.       if (file_exists(DIR_FS_CATALOG_TEMPLATES . $file . '/template_info.php')) {
  17.         require(DIR_FS_CATALOG_TEMPLATES . $file . '/template_info.php');
  18.         $template_info[$file] = array('name' => $template_name,
  19.                                       'version' => $template_version,
  20.                                       'author' => $template_author,
  21.                                       'description' => $template_description,
  22.                                       'screenshot' => $template_screenshot);
  23.       }
  24.     }
  25.   }
  26.   $dir->close();
  27.  
  28.   $action = (isset($_GET['action']) ? $_GET['action'] : '');
  29.  
  30.   if (zen_not_null($action)) {
  31.     switch ($action) {
  32.       case 'insert':
  33.         $check_query = $db->Execute("select * from " . TABLE_TEMPLATE_SELECT . " where template_language = '" . $_POST['lang'] . "'");
  34.         if ($check_query->RecordCount() < 1 ) {
  35.           $db->Execute("insert into " . TABLE_TEMPLATE_SELECT . " (template_dir, template_language) values ('" . $_POST['ln'] . "', '" . $_POST['lang'] . "')");
  36.           $_GET['tID'] = $db->Insert_ID();
  37.         }
  38.         $action="";
  39.         break;
  40.       case 'save':
  41.         $db->Execute("update " . TABLE_TEMPLATE_SELECT . " set template_dir = '" . $_POST['ln'] . "' where template_id = '" . $_GET['tID'] . "'");
  42.         break;
  43.       case 'deleteconfirm':
  44.         $check_query = $db->Execute("select template_language from " . TABLE_TEMPLATE_SELECT . " where template_id = '" . $_GET['tID'] . "'");
  45.         if ( $check_query->fields['template_language'] != 0 ) {
  46.           $db->Execute("delete from " . TABLE_TEMPLATE_SELECT . " where template_id = '" . $_GET['tID'] . "'");
  47.           zen_redirect(zen_href_link(FILENAME_TEMPLATE_SELECT, 'page=' . $_GET['page']));
  48.         }
  49.         $action="";
  50.         break;
  51.     }
  52.   }
  53. ?>
  54. <!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
  55. <html <?php echo HTML_PARAMS; ?>>
  56. <head>
  57. <meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">
  58. <title><?php echo TITLE; ?></title>
  59. <link rel="stylesheet" type="text/css" href="includes/stylesheet.css">
  60. <link rel="stylesheet" type="text/css" href="includes/cssjsmenuhover.css" media="all" id="hoverJS">
  61. <script language="javascript" src="includes/menu.js"></script>
  62. <script language="javascript" src="includes/general.js"></script>
  63. <script type="text/javascript">
  64.   <!--
  65.   function init()
  66.   {
  67.     cssjsmenu('navbar');
  68.     if (document.getElementById)
  69.     {
  70.       var kill = document.getElementById('hoverJS');
  71.       kill.disabled = true;
  72.     }
  73.   }
  74.   // -->
  75. </script>
  76. </head>
  77. <body onLoad="init()">
  78. <!-- header //-->
  79. <?php require(DIR_WS_INCLUDES . 'header.php'); ?>
  80. <!-- header_eof //-->
  81. <!-- body //-->
  82. <table border="0" width="100%" cellspacing="2" cellpadding="2">
  83.   <tr>
  84.     <!-- body_text //-->
  85.     <td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2">
  86.         <tr>
  87.           <td><table border="0" width="100%" cellspacing="0" cellpadding="0">
  88.               <tr>
  89.                 <td class="pageHeading"><?php echo HEADING_TITLE; ?></td>
  90.                 <td class="pageHeading" align="right"><?php echo zen_draw_separator('pixel_trans.gif', HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td>
  91.               </tr>
  92.             </table></td>
  93.         </tr>
  94.         <tr>
  95.           <td><table border="0" width="100%" cellspacing="0" cellpadding="0">
  96.               <tr>
  97.                 <td valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2">
  98.                     <tr class="dataTableHeadingRow">
  99.                       <td class="dataTableHeadingContent"><?php echo TABLE_HEADING_LANGUAGE; ?></td>
  100.                       <td class="dataTableHeadingContent"><?php echo TABLE_HEADING_NAME; ?></td>
  101.                       <td class="dataTableHeadingContent" align="center"><?php echo TABLE_HEADING_DIRECTORY; ?></td>
  102.                       <td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_ACTION; ?>&nbsp;</td>
  103.                     </tr>
  104.                     <?php
  105.   $template_query_raw = "select * from " . TABLE_TEMPLATE_SELECT;
  106.   $template_split = new splitPageResults($_GET['page'], MAX_DISPLAY_SEARCH_RESULTS, $template_query_raw, $template_query_numrows);
  107.   $templates = $db->Execute($template_query_raw);
  108.   while (!$templates->EOF) {
  109.     if ((!isset($_GET['tID']) || (isset($_GET['tID']) && ($_GET['tID'] == $templates->fields['template_id']))) && !isset($tInfo) && (substr($action, 0, 3) != 'new')) {
  110.       $tInfo = new objectInfo($templates->fields);
  111.     }
  112.  
  113.     if (isset($tInfo) && is_object($tInfo) && ($templates->fields['template_id'] == $tInfo->template_id)) {
  114.       echo '              <tr id="defaultSelected" class="dataTableRowSelected" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="document.location.href=\'' . zen_href_link(FILENAME_TEMPLATE_SELECT, 'page=' . $_GET['page'] . '&tID=' . $tInfo->template_id . '&action=edit') . '\'">' . "\n";
  115.     } else {
  116.       echo '              <tr class="dataTableRow" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="document.location.href=\'' . zen_href_link(FILENAME_TEMPLATE_SELECT, 'page=' . $_GET['page'] . '&tID=' . $templates->fields['template_id']) . '\'">' . "\n";
  117.     }
  118.     if ($templates->fields['template_language'] == 0) {
  119.       $template_language = "Default(All)";
  120.     } else {
  121.       $ln = $db->Execute("select name
  122.                          from " . TABLE_LANGUAGES . "
  123.                          where languages_id = '" . $templates->fields['template_language'] . "'");
  124.       $template_language = $ln->fields['name'];
  125.     }
  126. ?>
  127.                     <td class="dataTableContent"><?php echo $template_language; ?></td>
  128.                     <td class="dataTableContent"><?php echo $template_info[$templates->fields['template_dir']]['name']; ?></td>
  129.                     <td class="dataTableContent" align="center"><?php echo $templates->fields['template_dir']; ?></td>
  130.                     <td class="dataTableContent" align="right">
  131.                       <?php if (isset($tInfo) && is_object($tInfo) && ($templates->fields['template_id'] == $tInfo->template_id) ) { echo zen_image(DIR_WS_IMAGES . 'icon_arrow_right.gif', ''); } else { echo '<a href="' . zen_href_link(FILENAME_TEMPLATE_SELECT, 'page=' . $_GET['page'] . '&tID=' . $templates->fields['template_id']) . '">' . zen_image(DIR_WS_IMAGES . 'icon_info.gif', IMAGE_ICON_INFO) . '</a>'; } ?>
  132.                       &nbsp;</td>
  133.                     </tr>
  134. <?php
  135.     $templates->MoveNext();
  136.   }
  137. ?>
  138.                     <tr>
  139.                       <td colspan="4"><table border="0" width="100%" cellspacing="0" cellpadding="2">
  140.                           <tr>
  141.                             <td class="smallText" valign="top"><?php echo $template_split->display_count($template_query_numrows, MAX_DISPLAY_SEARCH_RESULTS, $_GET['page'], TEXT_DISPLAY_NUMBER_OF_TEMPLATES); ?></td>
  142.                             <td class="smallText" align="right"><?php echo $template_split->display_links($template_query_numrows, MAX_DISPLAY_SEARCH_RESULTS, MAX_DISPLAY_PAGE_LINKS, $_GET['page']); ?></td>
  143.                           </tr>
  144.                           <?php
  145.   if (empty($action)) {
  146. ?>
  147.                           <tr>
  148.                             <td colspan="2" align="right"><?php echo '<a href="' . zen_href_link(FILENAME_TEMPLATE_SELECT, 'page=' . $_GET['page'] . '&action=new') . '">' . zen_image_button('button_new_language.gif', IMAGE_NEW_TEMPLATE) . '</a>'; ?></td>
  149.                           </tr>
  150.                           <?php
  151.   }
  152. ?>
  153.                         </table></td>
  154.                     </tr>
  155.                   </table></td>
  156.                 <?php
  157.   $heading = array();
  158.   $contents = array();
  159.  
  160.   switch ($action) {
  161.     case 'new':
  162.       $heading[] = array('text' => '<b>' . TEXT_INFO_HEADING_NEW_TEMPLATE . '</b>');
  163.  
  164.       $contents = array('form' => zen_draw_form('zones', FILENAME_TEMPLATE_SELECT, 'page=' . $_GET['page'] . '&action=insert'));
  165.       $contents[] = array('text' => TEXT_INFO_INSERT_INTRO);
  166.       while (list ($key, $value) = each($template_info) ) {
  167.         $template_array[] = array('id' => $key, 'text' => $value['name']);
  168.       }
  169.       $lns = $db->Execute("select name, languages_id from " . TABLE_LANGUAGES);
  170.       while (!$lns->EOF) {
  171.         $language_array[] = array('text' => $lns->fields['name'], 'id' => $lns->fields['languages_id']);
  172.         $lns->MoveNext();
  173.       }
  174.       $contents[] = array('text' => '<br>' . TEXT_INFO_TEMPLATE_NAME . '<br>' . zen_draw_pull_down_menu('ln', $template_array));
  175.       $contents[] = array('text' => '<br>' . TEXT_INFO_LANGUAGE_NAME . '<br>' . zen_draw_pull_down_menu('lang', $language_array, $_POST['lang']));
  176.       $contents[] = array('align' => 'center', 'text' => '<br>' . zen_image_submit('button_insert.gif', IMAGE_INSERT) . '&nbsp;<a href="' . zen_href_link(FILENAME_TEMPLATE_SELECT, 'page=' . $_GET['page']) . '">' . zen_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>');
  177.       break;
  178.     case 'edit':
  179.       $heading[] = array('text' => '<b>' . TEXT_INFO_HEADING_EDIT_TEMPLATE . '</b>');
  180.  
  181.       $contents = array('form' => zen_draw_form('templateselect', FILENAME_TEMPLATE_SELECT, 'page=' . $_GET['page'] . '&tID=' . $tInfo->template_id . '&action=save'));
  182.       $contents[] = array('text' => TEXT_INFO_EDIT_INTRO);
  183.       reset($template_info);
  184.       while (list ($key, $value) = each($template_info) ) {
  185.         $template_array[] = array('id' => $key, 'text' => $value['name']);
  186.       }
  187.       $contents[] = array('text' => '<br>' . TEXT_INFO_TEMPLATE_NAME . '<br>' . zen_draw_pull_down_menu('ln', $template_array, $templates->fields['template_dir']));
  188.       $contents[] = array('align' => 'center', 'text' => '<br>' . zen_image_submit('button_update.gif', IMAGE_UPDATE) . '&nbsp;<a href="' . zen_href_link(FILENAME_TEMPLATE_SELECT, 'page=' . $_GET['page'] . '&tID=' . $tInfo->template_id) . '">' . zen_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>');
  189.       break;
  190.     case 'delete':
  191.       $heading[] = array('text' => '<b>' . TEXT_INFO_HEADING_DELETE_TEMPLATE . '</b>');
  192.  
  193.       $contents = array('form' => zen_draw_form('zones', FILENAME_TEMPLATE_SELECT, 'page=' . $_GET['page'] . '&tID=' . $tInfo->template_id . '&action=deleteconfirm'));
  194.       $contents[] = array('text' => TEXT_INFO_DELETE_INTRO);
  195.       $contents[] = array('text' => '<br><b>' . $template_info[$tInfo->template_dir]['name'] . '</b>');
  196.       $contents[] = array('align' => 'center', 'text' => '<br>' . zen_image_submit('button_delete.gif', IMAGE_DELETE) . '&nbsp;<a href="' . zen_href_link(FILENAME_TEMPLATE_SELECT, 'page=' . $_GET['page'] . '&tID=' . $tInfo->template_id) . '">' . zen_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>');
  197.       break;
  198.     default:
  199.       if (isset($tInfo) && is_object($tInfo)) {
  200.         $heading[] = array('text' => '<b>' . $template_info[$tInfo->template_dir]['name'] . '</b>');
  201.         if ($tInfo->template_language == 0) {
  202.           $contents[] = array('align' => 'center', 'text' => '<a href="' . zen_href_link(FILENAME_TEMPLATE_SELECT, 'page=' . $_GET['page'] . '&tID=' . $tInfo->template_id . '&action=edit') . '">' . zen_image_button('button_edit.gif', IMAGE_EDIT) . '</a>');
  203.         } else {
  204.           $contents[] = array('align' => 'center', 'text' => '<a href="' . zen_href_link(FILENAME_TEMPLATE_SELECT, 'page=' . $_GET['page'] . '&tID=' . $tInfo->template_id . '&action=edit') . '">' . zen_image_button('button_edit.gif', IMAGE_EDIT) . '</a> <a href="' . zen_href_link(FILENAME_TEMPLATE_SELECT, 'page=' . $_GET['page'] . '&tID=' . $tInfo->template_id . '&action=delete') . '">' . zen_image_button('button_delete.gif', IMAGE_DELETE) . '</a>');
  205.         }
  206.         $contents[] = array('text' => '<br>' . TEXT_INFO_TEMPLATE_AUTHOR  . $template_info[$tInfo->template_dir]['author']);
  207.         $contents[] = array('text' => '<br>' . TEXT_INFO_TEMPLATE_VERSION  . $template_info[$tInfo->template_dir]['version']);
  208.         $contents[] = array('text' => '<br>' . TEXT_INFO_TEMPLATE_DESCRIPTION  . '<br />' . $template_info[$tInfo->template_dir]['description']);
  209.         $contents[] = array('text' => '<br>' . TEXT_INFO_TEMPLATE_INSTALLED  . '<br />');
  210.         while (list ($key, $value) = each($template_info) ) {
  211.           $contents[] = array('text' => '<a href="' . DIR_WS_CATALOG_TEMPLATE . $key . '/images/' . $value['screenshot'] . '" target = "_blank">' . zen_image_button('button_preview.gif', IMAGE_PREVIEW) . '</a>&nbsp;&nbsp;' . $value['name']);
  212.         }
  213.       }
  214.       break;
  215.   }
  216.  
  217.   if ( (zen_not_null($heading)) && (zen_not_null($contents)) ) {
  218.     echo '            <td width="25%" valign="top">' . "\n";
  219.  
  220.     $box = new box;
  221.     echo $box->infoBox($heading, $contents);
  222.  
  223.     echo '            </td>' . "\n";
  224.   }
  225. ?>
  226.               </tr>
  227.             </table></td>
  228.         </tr>
  229.       </table></td>
  230.     <!-- body_text_eof //-->
  231.   </tr>
  232. </table>
  233. <!-- body_eof //-->
  234. <!-- footer //-->
  235. <?php require(DIR_WS_INCLUDES . 'footer.php'); ?>
  236. <!-- footer_eof //-->
  237. <br>
  238. </body>
  239. </html>
  240. <?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>
  241.  


cron