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

Zen Cart 源代码 store_manager.php




下载文件

文件名: store_manager.php
文件类型: PHP文件
文件大小: 16.31 KiB
MD5: 67f1e4dcee1e340acf513a6a4922527d

store_manager.php - 关闭高亮
  1. <?php
  2. /**
  3.  * @package admin
  4.  * @copyright Copyright 2003-2012 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 GIT: $Id: Author: DrByte  Tue Aug 28 16:48:39 2012 -0400 Modified in v1.5.1 $
  8.  */
  9.  
  10.   require('includes/application_top.php');
  11.  
  12.   require(DIR_WS_CLASSES . 'currencies.php');
  13.   $currencies = new currencies();
  14.  
  15.   $languages = zen_get_languages();
  16.  
  17.   $products_filter = (isset($_GET['products_filter']) ? $_GET['products_filter'] : $products_filter);
  18.  
  19.   $action = (isset($_GET['action']) ? $_GET['action'] : '');
  20.  
  21.   $current_category_id = (isset($_GET['current_category_id']) ? (int)$_GET['current_category_id'] : (int)$current_category_id);
  22.  
  23.   $processing_message = '';
  24.   $processing_action_url = '';
  25.  
  26.   zen_set_time_limit(600);
  27.   switch($action) {
  28.  
  29. // update all products in catalog
  30.     case ('update_all_products_attributes_sort_order'):
  31.       if (isset($_POST['confirm']) && $_POST['confirm'] == 'yes')
  32.       {
  33.         $all_products_attributes= $db->Execute("select p.products_id, pa.products_attributes_id from " .
  34.         TABLE_PRODUCTS . " p, " .
  35.         TABLE_PRODUCTS_ATTRIBUTES . " pa " . "
  36.        where p.products_id= pa.products_id"
  37.         );
  38.         while (!$all_products_attributes->EOF)
  39.         {
  40.           $count++;
  41.           $product_id_updated .= ' - ' . $all_products_attributes->fields['products_id'] . ':' . $all_products_attributes->fields['products_attributes_id'];
  42.           zen_update_attributes_products_option_values_sort_order($all_products_attributes->fields['products_id']);
  43.           $all_products_attributes->MoveNext();
  44.         }
  45.         $messageStack->add_session(SUCCESS_PRODUCT_UPDATE_SORT_ALL, 'success');
  46.         $action='';
  47.         zen_redirect(zen_href_link(FILENAME_STORE_MANAGER));
  48.       }
  49.       break;
  50.  
  51.     case ('update_all_products_price_sorter'):
  52.       if (isset($_POST['confirm']) && $_POST['confirm'] == 'yes')
  53.       {
  54.       // reset products_price_sorter for searches etc.
  55.         $sql = "select products_id from " . TABLE_PRODUCTS;
  56.         $update_prices = $db->Execute($sql);
  57.  
  58.         while (!$update_prices->EOF)
  59.         {
  60.           zen_update_products_price_sorter($update_prices->fields['products_id']);
  61.           $update_prices->MoveNext();
  62.         }
  63.         $messageStack->add_session(SUCCESS_PRODUCT_UPDATE_PRODUCTS_PRICE_SORTER, 'success');
  64.         $action='';
  65.         zen_redirect(zen_href_link(FILENAME_STORE_MANAGER));
  66.       }
  67.     break;
  68.  
  69.     case ('update_all_products_viewed'):
  70.     // reset products_viewed to 0
  71.       if (isset($_POST['confirm']) && $_POST['confirm'] == 'yes')
  72.       {
  73.         $sql = "update " . TABLE_PRODUCTS_DESCRIPTION . " set products_viewed= '0'";
  74.         $update_viewed = $db->Execute($sql);
  75.  
  76.         $messageStack->add_session(SUCCESS_PRODUCT_UPDATE_PRODUCTS_VIEWED, 'success');
  77.         $action='';
  78.         zen_redirect(zen_href_link(FILENAME_STORE_MANAGER));
  79.       }
  80.     break;
  81.  
  82.     case ('update_all_products_ordered'):
  83.       if (isset($_POST['confirm']) && $_POST['confirm'] == 'yes')
  84.       {
  85.       // reset products_ordered to 0
  86.         $sql = "update " . TABLE_PRODUCTS . " set products_ordered= '0'";
  87.         $update_viewed = $db->Execute($sql);
  88.  
  89.         $messageStack->add_session(SUCCESS_PRODUCT_UPDATE_PRODUCTS_ORDERED, 'success');
  90.         $action='';
  91.         zen_redirect(zen_href_link(FILENAME_STORE_MANAGER));
  92.       }
  93.     break;
  94.  
  95.     case ('update_counter'):
  96.     if ($_POST['new_counter'] == '' || strval($_POST['new_counter']) != strval((int)$_POST['new_counter'])) break;
  97.     $sql = "update " . TABLE_COUNTER . " set counter= '" . (int)$_POST['new_counter'] . "'";
  98.     $update_counter = $db->Execute($sql);
  99.  
  100.     $messageStack->add_session(SUCCESS_UPDATE_COUNTER . (int)$_POST['new_counter'], 'success');
  101.     $action='';
  102.     zen_redirect(zen_href_link(FILENAME_STORE_MANAGER));
  103.     break;
  104.  
  105.     case ('optimize_db_start'):
  106.       $processing_message = TEXT_INFO_OPTIMIZING_DATABASE_TABLES;
  107.       $processing_action_url = zen_href_link(FILENAME_STORE_MANAGER, 'action=optimize_db_do');
  108.     break;
  109.     case ('optimize_db_do'):
  110.     // clean out unused space in database
  111.       if (isset($_POST['confirm']) && $_POST['confirm'] == 'yes')
  112.       {
  113.         $sql = "SHOW TABLE STATUS FROM `" . DB_DATABASE ."`";
  114.         $tables = $db->Execute($sql);
  115.         while(!$tables->EOF) {
  116.           // skip tables not matching prefixes
  117.           if (DB_PREFIX != '' && substr($tables->fields['Name'], 0, strlen(DB_PREFIX)) != DB_PREFIX) {
  118.             $tables->MoveNext();
  119.             continue;
  120.           }
  121.           zen_set_time_limit(600);
  122.           $db->Execute("OPTIMIZE TABLE `" . $tables->fields['Name'] . "`");
  123.           $i++;
  124.           if ($i/7 == (int)($i/7)) sleep(2);
  125.           $tables->MoveNext();
  126.         }
  127.         $messageStack->add_session(SUCCESS_DB_OPTIMIZE . ' ' . $i, 'success');
  128.         $action='';
  129.         zen_redirect(zen_href_link(FILENAME_STORE_MANAGER));
  130.       }
  131.     break;
  132.  
  133. // clean out old DEBUG logfiles
  134.     case 'clean_debug_files':
  135.       foreach(array(DIR_FS_LOGS, DIR_FS_SQL_CACHE, DIR_FS_CATALOG . '/includes/modules/payment/paypal/logs') as $purgeFolder) {
  136.         $purgeFolder = rtrim($purgeFolder, '/');
  137.         $dir = dir($purgeFolder);
  138.         while ($file = $dir->read()) {
  139.           if ( ($file != '.') && ($file != '..') && substr($file, 0, 1) != '.') {
  140.             if (preg_match('/^(myDEBUG-|AIM_Debug_|SIM_Debug_|FirstData_Debug_|Linkpoint_Debug_|Paypal|paypal|ipn_|zcInstall).*\.log$/', $file)) {
  141.               if (is_writeable($purgeFolder . '/' . $file)) {
  142.                 zen_remove($purgeFolder . '/' . $file);
  143.               }
  144.             }
  145.           }
  146.         }
  147.         $dir->close();
  148.         unset($dir);
  149.       }
  150.       $messageStack->add_session(SUCCESS_CLEAN_DEBUG_FILES, 'success');
  151.       zen_redirect(zen_href_link(FILENAME_STORE_MANAGER));
  152.     break;
  153.  
  154.     case ('update_all_master_categories_id'):
  155.     // reset products master categories ID
  156.       if (isset($_POST['confirm']) && $_POST['confirm'] == 'yes')
  157.       {
  158.  
  159.         $sql = "select products_id from " . TABLE_PRODUCTS;
  160.         $check_products = $db->Execute($sql);
  161.         while (!$check_products->EOF) {
  162.  
  163.           $sql = "select products_id, categories_id from " . TABLE_PRODUCTS_TO_CATEGORIES . " where products_id='" . $check_products->fields['products_id'] . "'";
  164.           $check_category = $db->Execute($sql);
  165.  
  166.           $sql = "update " . TABLE_PRODUCTS . " set master_categories_id='" . $check_category->fields['categories_id'] . "' where products_id='" . $check_products->fields['products_id'] . "'";
  167.           $update_viewed = $db->Execute($sql);
  168.  
  169.           $check_products->MoveNext();
  170.         }
  171.  
  172.         $messageStack->add_session(SUCCESS_UPDATE_ALL_MASTER_CATEGORIES_ID, 'success');
  173.         $action='';
  174.         zen_redirect(zen_href_link(FILENAME_STORE_MANAGER));
  175.       }
  176.     break;
  177.  
  178.     case ('update_orders_id'):
  179.       global $db;
  180.       $new_orders_id = zen_db_prepare_input((int)$_POST['new_orders_id']);
  181.       $result = $db->Execute("select max(orders_id) as maxorder from " . TABLE_ORDERS);
  182.       $max_order1 = $result->fields['maxorder'];
  183.       $result = $db->Execute("select max(orders_id) as maxorder from " . TABLE_ORDERS_PRODUCTS);
  184.       $max_order2 = $result->fields['maxorder'];
  185.       if ($new_orders_id <= $max_order1 || $new_orders_id <= $max_order2)
  186.       {
  187.         $new_orders_id = max($max_order1, $max_order2) + 1;
  188.         $messageStack->add_session(sprintf(TEXT_MSG_NEXT_ORDER_MAX, $new_orders_id), 'caution');
  189.       } elseif ($new_orders_id > 2000000000) {
  190.         $messageStack->add_session(TEXT_MSG_NEXT_ORDER_TOO_LARGE, 'error');
  191.       } else {
  192.         $db->Execute("ALTER TABLE " . TABLE_ORDERS . " AUTO_INCREMENT = " . $new_orders_id);
  193.         $messageStack->add_session(sprintf(TEXT_MSG_NEXT_ORDER, $new_orders_id), 'success');
  194.       }
  195.       zen_redirect(zen_href_link(FILENAME_STORE_MANAGER));
  196.     break;
  197.  
  198.     } // eof: action
  199.  
  200. ?>
  201. <!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
  202. <html <?php echo HTML_PARAMS; ?>>
  203. <head>
  204. <meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">
  205. <title><?php echo TITLE; ?></title>
  206. <link rel="stylesheet" type="text/css" href="includes/stylesheet.css">
  207. <link rel="stylesheet" type="text/css" href="includes/cssjsmenuhover.css" media="all" id="hoverJS">
  208. <script language="javascript" src="includes/menu.js"></script>
  209. <script language="javascript" src="includes/general.js"></script>
  210. <script type="text/javascript">
  211.   <!--
  212.   function init()
  213.   {
  214.     cssjsmenu('navbar');
  215.     if (document.getElementById)
  216.     {
  217.       var kill = document.getElementById('hoverJS');
  218.       kill.disabled = true;
  219.     }
  220.   }
  221.   // -->
  222. </script>
  223. <?php if ($processing_message != '' && $processing_action_url != '') echo '<meta http-equiv="refresh" content="2;URL=' . $processing_action_url . '">'; ?>
  224.  
  225. </head>
  226. <body onLoad="init()">
  227. <!-- header //-->
  228. <?php require(DIR_WS_INCLUDES . 'header.php'); ?>
  229. <!-- header_eof //-->
  230.  
  231. <!-- body //-->
  232. <table border="0" width="100%" cellspacing="2" cellpadding="2">
  233.   <tr>
  234. <!-- body_text //-->
  235.     <td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="0">
  236.       <tr>
  237.         <td class="pageHeading"><?php echo HEADING_TITLE; ?></td>
  238.         <td class="pageHeading" align="right"><?php echo zen_draw_separator('pixel_trans.gif', HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td>
  239.       </tr>
  240.  
  241. <?php
  242. if ($processing_message != '') {
  243. ?>
  244.   <tr><td><?php echo $processing_message; ?></td></tr>
  245.   <tr><td align="center"><?php echo zen_image(DIR_WS_IMAGES . 'loadingsmall.gif'); ?></td></tr>
  246. <?php
  247. } else {
  248. ?>
  249.  
  250. <!-- bof: update all option values sort orders -->
  251.       <tr>
  252.         <td colspan="2"><br /><table border="0" cellspacing="0" cellpadding="2">
  253.           <tr>
  254.             <td class="main" align="left" valign="top"><?php echo TEXT_INFO_ATTRIBUTES_FEATURES_UPDATES; ?></td>
  255.             <td class="main" align="right" valign="middle"><?php echo zen_draw_form('update_all_products_attributes_sort_order', FILENAME_STORE_MANAGER, 'action=update_all_products_attributes_sort_order')?><input type="hidden" name="confirm" value="yes" /><?php echo zen_image_submit('button_update.gif', IMAGE_UPDATE); ?></form></td>
  256.           </tr>
  257.         </table></td>
  258.       </tr>
  259. <!-- eof: update all option values sort orders -->
  260.  
  261. <!-- bof: update all products price sorter -->
  262.       <tr>
  263.         <td colspan="2"><br /><table border="0" cellspacing="0" cellpadding="2">
  264.           <tr>
  265.             <td class="main" align="left" valign="top"><?php echo TEXT_INFO_PRODUCTS_PRICE_SORTER_UPDATE; ?></td>
  266.             <td class="main" align="right" valign="middle"><?php echo zen_draw_form('update_all_products_price_sorter', FILENAME_STORE_MANAGER, 'action=update_all_products_price_sorter')?><input type="hidden" name="confirm" value="yes" /><?php echo zen_image_submit('button_update.gif', IMAGE_UPDATE); ?></form></td>
  267.           </tr>
  268.         </table></td>
  269.       </tr>
  270. <!-- eof: update all products price sorter -->
  271.  
  272. <!-- bof: reset all counter to 0 -->
  273.       <tr>
  274.         <td colspan="2"><br /><table border="0" cellspacing="0" cellpadding="2">
  275.           <tr><form name = "update_counter" action="<?php echo zen_href_link(FILENAME_STORE_MANAGER, 'action=update_counter', 'NONSSL'); ?>" method="post">
  276.           <?php echo zen_draw_hidden_field('securityToken', $_SESSION['securityToken']); ?>
  277.             <td class="main" align="left" valign="top"><?php echo TEXT_INFO_COUNTER_UPDATE; ?></td>
  278.             <td class="main" align="left" valign="bottom"><?php echo zen_draw_input_field('new_counter'); ?></td>
  279.             <td class="main" align="right" valign="middle"><?php echo zen_image_submit('button_reset.gif', IMAGE_RESET); ?></td>
  280.           </form></tr>
  281.         </table></td>
  282.       </tr>
  283. <!-- eof: reset all counter to 0 -->
  284.  
  285. <!-- bof: reset all products_viewed to 0 -->
  286.       <tr>
  287.         <td colspan="2"><br /><table border="0" cellspacing="0" cellpadding="2">
  288.           <tr>
  289.             <td class="main" align="left" valign="top"><?php echo TEXT_INFO_PRODUCTS_VIEWED_UPDATE; ?></td>
  290.             <td class="main" align="right" valign="middle"><?php echo zen_draw_form('update_all_products_viewed', FILENAME_STORE_MANAGER, 'action=update_all_products_viewed')?><input type="hidden" name="confirm" value="yes" /><?php echo zen_image_submit('button_reset.gif', IMAGE_UPDATE); ?></form></td>
  291.           </tr>
  292.         </table></td>
  293.       </tr>
  294. <!-- eof: reset all products_viewed to 0 -->
  295.  
  296. <!-- bof: reset all products_ordered to 0 -->
  297.       <tr>
  298.         <td colspan="2"><br /><table border="0" cellspacing="0" cellpadding="2">
  299.           <tr>
  300.             <td class="main" align="left" valign="top"><?php echo TEXT_INFO_PRODUCTS_ORDERED_UPDATE; ?></td>
  301.             <td class="main" align="right" valign="middle"><?php echo zen_draw_form('update_all_products_ordered', FILENAME_STORE_MANAGER, 'action=update_all_products_ordered')?><input type="hidden" name="confirm" value="yes" /><?php echo zen_image_submit('button_reset.gif', IMAGE_UPDATE); ?></form></td>
  302.           </tr>
  303.         </table></td>
  304.       </tr>
  305. <!-- eof: reset all products_ordered to 0 -->
  306.  
  307. <!-- bof: reset all master_categories_id -->
  308.       <tr>
  309.         <td colspan="2"><br /><table border="0" cellspacing="0" cellpadding="2">
  310.           <tr>
  311.             <td class="main" align="left" valign="top"><?php echo TEXT_INFO_MASTER_CATEGORIES_ID_UPDATE; ?></td>
  312.             <td class="main" align="right" valign="middle"><?php echo zen_draw_form('update_all_master_categories_id', FILENAME_STORE_MANAGER, 'action=update_all_master_categories_id')?><input type="hidden" name="confirm" value="yes" /><?php echo zen_image_submit('button_reset.gif', IMAGE_UPDATE); ?></form></td>
  313.           </tr>
  314.         </table></td>
  315.       </tr>
  316. <!-- eof: reset all master_categories_id -->
  317.  
  318. <!-- bof: reset next order to new order number -->
  319.       <tr>
  320.         <td colspan="2"><br /><table border="0" cellspacing="0" cellpadding="2">
  321.           <tr><form name="update_orders" action="<?php echo zen_href_link(FILENAME_STORE_MANAGER, 'action=update_orders_id', 'NONSSL'); ?>" method="post">
  322.           <?php echo zen_draw_hidden_field('securityToken', $_SESSION['securityToken']); ?>
  323.             <td class="main" align="left" valign="top"><?php echo TEXT_INFO_SET_NEXT_ORDER_NUMBER; ?>
  324.             <br />
  325.             <?php echo TEXT_NEW_ORDERS_ID . '&nbsp;' . zen_draw_input_field('new_orders_id', $nextOrderNumber); ?>
  326.             <?php echo zen_image_submit('button_reset.gif', IMAGE_RESET); ?></td>
  327.             </form>
  328.           </tr>
  329.         </table>
  330.         </td>
  331.       </tr>
  332. <!-- eof: reset next order to new order number -->
  333.  
  334. <!-- bof: database table-optimize -->
  335.       <tr>
  336.         <td colspan="2"><br /><br /><table border="0" cellspacing="0" cellpadding="2">
  337.           <tr>
  338.             <td class="main" align="left" valign="top"><?php echo TEXT_INFO_DATABASE_OPTIMIZE; ?></td>
  339.             <td class="main" align="right" valign="middle"><?php echo zen_draw_form('optimize_db_start', FILENAME_STORE_MANAGER, 'action=optimize_db_start')?><input type="hidden" name="confirm" value="yes" /><?php echo zen_image_submit('button_reset.gif', IMAGE_UPDATE); ?></form></td>
  340.           </tr>
  341.         </table></td>
  342.       </tr>
  343. <!-- eof: database table-optimize -->
  344.  
  345. <!-- bof: clean_debug_files -->
  346.       <tr>
  347.         <td colspan="2"><br /><br /><table border="0" cellspacing="0" cellpadding="2">
  348.           <tr>
  349.             <td class="main" align="left" valign="top"><?php echo TEXT_INFO_PURGE_DEBUG_LOG_FILES; ?></td>
  350.             <td class="main" align="right" valign="middle"><?php echo zen_draw_form('clean_debug_files', FILENAME_STORE_MANAGER, 'action=clean_debug_files', 'post') . zen_image_submit('button_confirm.gif', IMAGE_UPDATE) . '</form>'; ?>
  351.           </tr>
  352.         </table></td>
  353.       </tr>
  354. <!-- eof: clean_debug_files -->
  355.  
  356. <?php
  357. } // eof configure
  358. ?>
  359.       <tr>
  360.         <td colspan="2"><?php echo '<br />' . zen_draw_separator('pixel_black.gif', '100%', '2'); ?></td>
  361.       </tr>
  362.     </table></td>
  363. <!-- body_text_eof //-->
  364.   </tr>
  365. </table>
  366. <!-- body_eof //-->
  367.  
  368. <!-- footer //-->
  369. <?php require(DIR_WS_INCLUDES . 'footer.php'); ?>
  370. <!-- footer_eof //-->
  371. </body>
  372. </html>
  373. <?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>


cron