[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文件
文件大小: 14.04 KiB
MD5: efc5e756a5cdeaf9f2bf44fdfbe681e0

template_select.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: template_select.php 19294 2011-07-28 18:15:46Z 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.         // @TODO: add duplicate-detection and empty-submission detection
  34.         $sql = "select * from " . TABLE_TEMPLATE_SELECT . " where template_language = :lang:";
  35.         $sql = $db->bindVars($sql, ':lang:', $_POST['lang'], 'string');
  36.         $check_query = $db->Execute($sql);
  37.         if ($check_query->RecordCount() < 1 ) {
  38.           $sql = "insert into " . TABLE_TEMPLATE_SELECT . " (template_dir, template_language) values (:tpl:, :lang:)";
  39.           $sql = $db->bindVars($sql, ':tpl:', $_POST['ln'], 'string');
  40.           $sql = $db->bindVars($sql, ':lang:', $_POST['lang'], 'string');
  41.           $db->Execute($sql);
  42.           $_GET['tID'] = $db->Insert_ID();
  43.         }
  44.         $action="";
  45.         break;
  46.       case 'save':
  47.         $sql = "update " . TABLE_TEMPLATE_SELECT . " set template_dir = :tpl: where template_id = :id:";
  48.         $sql = $db->bindVars($sql, ':tpl:', $_POST['ln'], 'string');
  49.         $sql = $db->bindVars($sql, ':id:', $_GET['tID'], 'integer');
  50.         $db->Execute($sql);
  51.         break;
  52.       case 'deleteconfirm':
  53.         $check_query = $db->Execute("select template_language from " . TABLE_TEMPLATE_SELECT . " where template_id = '" . (int)$_POST['tID'] . "'");
  54.         if ( $check_query->fields['template_language'] != 0 ) {
  55.           $db->Execute("delete from " . TABLE_TEMPLATE_SELECT . " where template_id = '" . (int)$_POST['tID'] . "'");
  56.           zen_redirect(zen_href_link(FILENAME_TEMPLATE_SELECT, 'page=' . $_GET['page']));
  57.         }
  58.         $action="";
  59.         break;
  60.     }
  61.   }
  62. ?>
  63. <!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
  64. <html <?php echo HTML_PARAMS; ?>>
  65. <head>
  66. <meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">
  67. <title><?php echo TITLE; ?></title>
  68. <link rel="stylesheet" type="text/css" href="includes/stylesheet.css">
  69. <link rel="stylesheet" type="text/css" href="includes/cssjsmenuhover.css" media="all" id="hoverJS">
  70. <script language="javascript" src="includes/menu.js"></script>
  71. <script language="javascript" src="includes/general.js"></script>
  72. <script type="text/javascript">
  73.   <!--
  74.   function init()
  75.   {
  76.     cssjsmenu('navbar');
  77.     if (document.getElementById)
  78.     {
  79.       var kill = document.getElementById('hoverJS');
  80.       kill.disabled = true;
  81.     }
  82.   }
  83.   // -->
  84. </script>
  85. </head>
  86. <body onLoad="init()">
  87. <!-- header //-->
  88. <?php require(DIR_WS_INCLUDES . 'header.php'); ?>
  89. <!-- header_eof //-->
  90. <!-- body //-->
  91. <table border="0" width="100%" cellspacing="2" cellpadding="2">
  92.   <tr>
  93.     <!-- body_text //-->
  94.     <td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2">
  95.         <tr>
  96.           <td><table border="0" width="100%" cellspacing="0" cellpadding="0">
  97.               <tr>
  98.                 <td class="pageHeading"><?php echo HEADING_TITLE; ?></td>
  99.                 <td class="pageHeading" align="right"><?php echo zen_draw_separator('pixel_trans.gif', HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td>
  100.               </tr>
  101.             </table></td>
  102.         </tr>
  103.         <tr>
  104.           <td><table border="0" width="100%" cellspacing="0" cellpadding="0">
  105.               <tr>
  106.                 <td valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2">
  107.                     <tr class="dataTableHeadingRow">
  108.                       <td class="dataTableHeadingContent"><?php echo TABLE_HEADING_LANGUAGE; ?></td>
  109.                       <td class="dataTableHeadingContent"><?php echo TABLE_HEADING_NAME; ?></td>
  110.                       <td class="dataTableHeadingContent" align="center"><?php echo TABLE_HEADING_DIRECTORY; ?></td>
  111.                       <td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_ACTION; ?>&nbsp;</td>
  112.                     </tr>
  113.                     <?php
  114.   $template_query_raw = "select * from " . TABLE_TEMPLATE_SELECT;
  115.   $template_split = new splitPageResults($_GET['page'], MAX_DISPLAY_SEARCH_RESULTS, $template_query_raw, $template_query_numrows);
  116.   $templates = $db->Execute($template_query_raw);
  117.   while (!$templates->EOF) {
  118.     if ((!isset($_GET['tID']) || (isset($_GET['tID']) && ($_GET['tID'] == $templates->fields['template_id']))) && !isset($tInfo) && (substr($action, 0, 3) != 'new')) {
  119.       $tInfo = new objectInfo($templates->fields);
  120.     }
  121.  
  122.     if (isset($tInfo) && is_object($tInfo) && ($templates->fields['template_id'] == $tInfo->template_id)) {
  123.       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";
  124.     } else {
  125.       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";
  126.     }
  127.     if ($templates->fields['template_language'] == 0) {
  128.       $template_language = "Default(All)";
  129.     } else {
  130.       $ln = $db->Execute("select name
  131.                          from " . TABLE_LANGUAGES . "
  132.                          where languages_id = '" . $templates->fields['template_language'] . "'");
  133.       $template_language = $ln->fields['name'];
  134.     }
  135. ?>
  136.                     <td class="dataTableContent"><?php echo $template_language; ?></td>
  137.                     <td class="dataTableContent"><?php echo $template_info[$templates->fields['template_dir']]['name']; ?></td>
  138.                     <td class="dataTableContent" align="center"><?php echo $templates->fields['template_dir']; ?></td>
  139.                     <td class="dataTableContent" align="right">
  140.                       <?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>'; } ?>
  141.                       &nbsp;</td>
  142.                     </tr>
  143. <?php
  144.     $templates->MoveNext();
  145.   }
  146. ?>
  147.                     <tr>
  148.                       <td colspan="4"><table border="0" width="100%" cellspacing="0" cellpadding="2">
  149.                           <tr>
  150.                             <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>
  151.                             <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>
  152.                           </tr>
  153.                           <?php
  154.   if (empty($action)) {
  155. ?>
  156.                           <tr>
  157.                             <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>
  158.                           </tr>
  159.                           <?php
  160.   }
  161. ?>
  162.                         </table></td>
  163.                     </tr>
  164.                   </table></td>
  165.                 <?php
  166.   $heading = array();
  167.   $contents = array();
  168.  
  169.   switch ($action) {
  170.     case 'new':
  171.       $heading[] = array('text' => '<b>' . TEXT_INFO_HEADING_NEW_TEMPLATE . '</b>');
  172.  
  173.       $contents = array('form' => zen_draw_form('zones', FILENAME_TEMPLATE_SELECT, 'page=' . $_GET['page'] . '&action=insert'));
  174.       $contents[] = array('text' => TEXT_INFO_INSERT_INTRO);
  175.       while (list ($key, $value) = each($template_info) ) {
  176.         $template_array[] = array('id' => $key, 'text' => $value['name']);
  177.       }
  178.       $lns = $db->Execute("select name, languages_id from " . TABLE_LANGUAGES);
  179.       while (!$lns->EOF) {
  180.         $language_array[] = array('text' => $lns->fields['name'], 'id' => $lns->fields['languages_id']);
  181.         $lns->MoveNext();
  182.       }
  183.       $contents[] = array('text' => '<br>' . TEXT_INFO_TEMPLATE_NAME . '<br>' . zen_draw_pull_down_menu('ln', $template_array));
  184.       $contents[] = array('text' => '<br>' . TEXT_INFO_LANGUAGE_NAME . '<br>' . zen_draw_pull_down_menu('lang', $language_array, $_POST['lang']));
  185.       $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>');
  186.       break;
  187.     case 'edit':
  188.       $heading[] = array('text' => '<b>' . TEXT_INFO_HEADING_EDIT_TEMPLATE . '</b>');
  189.  
  190.       $contents = array('form' => zen_draw_form('templateselect', FILENAME_TEMPLATE_SELECT, 'page=' . $_GET['page'] . '&tID=' . $tInfo->template_id . '&action=save'));
  191.       $contents[] = array('text' => TEXT_INFO_EDIT_INTRO);
  192.       reset($template_info);
  193.       while (list ($key, $value) = each($template_info) ) {
  194.         $template_array[] = array('id' => $key, 'text' => $value['name']);
  195.       }
  196.       $contents[] = array('text' => '<br>' . TEXT_INFO_TEMPLATE_NAME . '<br>' . zen_draw_pull_down_menu('ln', $template_array, $templates->fields['template_dir']));
  197.       $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>');
  198.       break;
  199.     case 'delete':
  200.       $heading[] = array('text' => '<b>' . TEXT_INFO_HEADING_DELETE_TEMPLATE . '</b>');
  201.  
  202.       $contents = array('form' => zen_draw_form('zones', FILENAME_TEMPLATE_SELECT, 'page=' . $_GET['page'] . '&action=deleteconfirm') . zen_draw_hidden_field('tID', $tInfo->template_id));
  203.       $contents[] = array('text' => TEXT_INFO_DELETE_INTRO);
  204.       $contents[] = array('text' => '<br><b>' . $template_info[$tInfo->template_dir]['name'] . '</b>');
  205.       $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>');
  206.       break;
  207.     default:
  208.       if (isset($tInfo) && is_object($tInfo)) {
  209.         $heading[] = array('text' => '<b>' . $template_info[$tInfo->template_dir]['name'] . '</b>');
  210.         if ($tInfo->template_language == 0) {
  211.           $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>');
  212.         } else {
  213.           $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>');
  214.         }
  215.         $contents[] = array('text' => '<br>' . TEXT_INFO_TEMPLATE_AUTHOR  . $template_info[$tInfo->template_dir]['author']);
  216.         $contents[] = array('text' => '<br>' . TEXT_INFO_TEMPLATE_VERSION  . $template_info[$tInfo->template_dir]['version']);
  217.         $contents[] = array('text' => '<br>' . TEXT_INFO_TEMPLATE_DESCRIPTION  . '<br />' . $template_info[$tInfo->template_dir]['description']);
  218.         $contents[] = array('text' => '<br>' . TEXT_INFO_TEMPLATE_INSTALLED  . '<br />');
  219.         while (list ($key, $value) = each($template_info) ) {
  220.           $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']);
  221.         }
  222.       }
  223.       break;
  224.   }
  225.  
  226.   if ( (zen_not_null($heading)) && (zen_not_null($contents)) ) {
  227.     echo '            <td width="25%" valign="top">' . "\n";
  228.  
  229.     $box = new box;
  230.     echo $box->infoBox($heading, $contents);
  231.  
  232.     echo '            </td>' . "\n";
  233.   }
  234. ?>
  235.               </tr>
  236.             </table></td>
  237.         </tr>
  238.       </table></td>
  239.     <!-- body_text_eof //-->
  240.   </tr>
  241. </table>
  242. <!-- body_eof //-->
  243. <!-- footer //-->
  244. <?php require(DIR_WS_INCLUDES . 'footer.php'); ?>
  245. <!-- footer_eof //-->
  246. <br>
  247. </body>
  248. </html>
  249. <?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>
  250.  


cron