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

Zen Cart 源代码 coupon_restrict.php




下载文件

文件名: coupon_restrict.php
文件类型: PHP文件
文件大小: 25.17 KiB
MD5: b592e47edda0dae9e27658215b2fa65d

coupon_restrict.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: coupon_restrict.php 18695 2011-05-04 05:24:19Z drbyte $
  8.  */
  9.   //define('MAX_DISPLAY_RESTRICT_ENTRIES', 10);
  10.   require('includes/application_top.php');
  11.   $restrict_array = array();
  12.   $restrict_array[] = array('id'=>'Deny', text=>'Deny');
  13.   $restrict_array[] = array('id'=>'Allow', text=>'Allow');
  14.  
  15.   if (isset($_GET['cid'])) $_GET['cid'] = (int)$_GET['cid'];
  16.   if (isset($_GET['info'])) $_GET['info'] = (int)$_GET['info'];
  17.   if (isset($_POST['cPath'])) $_POST['cPath'] = (int)$_POST['cPath'];
  18.   if (isset($_POST['cPath_prod'])) $_POST['cPath_prod'] = (int)$_POST['cPath_prod'];
  19.   if (isset($_GET['build_cat'])) $_GET['build_cat'] = (int)$_GET['build_cat'];
  20.  
  21.   $the_path = $_POST['cPath'];
  22.   if (isset($_GET['action']) && $_GET['action']=='switch_status') {
  23.     if (isset($_POST['switchStatusProto']))
  24.     {
  25.       $status = $db->Execute("select coupon_restrict
  26.                              from " . TABLE_COUPON_RESTRICT . "
  27.                              where restrict_id = '" . $_GET['info'] . "'");
  28.  
  29.       $new_status = 'N';
  30.       if ($status->fields['coupon_restrict'] == 'N') $new_status = 'Y';
  31.       $db->Execute("update " . TABLE_COUPON_RESTRICT . "
  32.                    set coupon_restrict = '" . $new_status . "'
  33.                    where restrict_id = '" . $_GET['info'] . "'");
  34.     }
  35.   }
  36.   if ($_GET['action']=='add_category' && isset($_POST['cPath'])) {
  37.     if ($_POST['cPath'] == 0) $_POST['cPath'] = -1;
  38.     $test_query=$db->Execute("select * from " . TABLE_COUPON_RESTRICT . "
  39.                              where coupon_id = '" . $_GET['cid'] . "'
  40.                              and category_id = '" . $_POST['cPath'] . "'");
  41.  
  42.     if ($test_query->RecordCount() < 1) {
  43.       $status = 'N';
  44.       if ($_POST['restrict_status']=='Deny') $status = 'Y';
  45.       $db->Execute("insert into " . TABLE_COUPON_RESTRICT . "
  46.                  (coupon_id, category_id, coupon_restrict)
  47.                  values ('" . $_GET['cid'] . "', '" . $_POST['cPath'] . "', '" . $status . "')");
  48.     } else {
  49.       // message that nothing is done
  50.       $messageStack->add(ERROR_DISCOUNT_COUPON_DEFINED_CATEGORY . ' ' . $_POST['cPath'], 'caution');
  51.     }
  52.   }
  53.  
  54.  
  55. // from products dropdown selection
  56.   if ($_GET['action']=='add_product' && $_POST['products_drop']) {
  57.     $test_query=$db->Execute("select * from " . TABLE_COUPON_RESTRICT . " where coupon_id = '" . $_GET['cid'] . "' and product_id = '" . (int)$_POST['products_drop'] . "'");
  58.     if ($test_query->RecordCount() < 1) {
  59.       $status = 'N';
  60.       if ($_POST['restrict_status']=='Deny') $status = 'Y';
  61.  
  62. // ==================================
  63. // bof: ALL ADD/DELETE of Products in one Category
  64.         if ($_POST['products_drop'] < 0) {
  65.         // adding new records
  66.           if ($_POST['products_drop'] == -1) {
  67.           // to insert new products from a given categories_id for a coupon_code that are not already in the table
  68.           // products in the table from the catategories_id are skipped
  69.             $new_products_query = "select products_id from " . TABLE_PRODUCTS_TO_CATEGORIES . " where categories_id = '" . $_GET['build_cat'] . "' and products_id not in (select product_id from " . TABLE_COUPON_RESTRICT . " where coupon_id = '" . $_GET['cid'] . "')";
  70.             $new_products = $db->Execute($new_products_query);
  71.           }
  72.  
  73.           if ($_POST['products_drop'] == -2) {
  74.           // to delete existing products from a given categories_id for a coupon_code that are already in the table
  75.           // products in the table from the catategories_id are skipped
  76.             $new_products_query = "select products_id from " . TABLE_PRODUCTS_TO_CATEGORIES . " where categories_id = '" . $_GET['build_cat'] . "' and products_id in (select product_id from " . TABLE_COUPON_RESTRICT . " where coupon_restrict = '" . $status . "' and coupon_id = '" . $_GET['cid'] . "')";
  77.             $new_products = $db->Execute($new_products_query);
  78.           }
  79.  
  80.           // nothing to be done
  81.           if ($new_products->RecordCount() == 0) {
  82.             $messageStack->add(ERROR_DISCOUNT_COUPON_DEFINED_CATEGORY . ' ' . $_POST['cPath'], 'caution');
  83.           }
  84.           while(!$new_products->EOF) {
  85.             // product passed and needs to be added/deleted
  86.             // add all products from select category for each product not already defined in coupons_restrict
  87.             if ($_POST['products_drop'] == -1) {
  88.               $db->Execute("insert into " . TABLE_COUPON_RESTRICT . "
  89.                          (coupon_id, product_id, coupon_restrict)
  90.                          values ('" . $_GET['cid'] . "', '" . $new_products->fields['products_id'] . "', '" . $status . "')");
  91.             } else {
  92.             // removed as defined in coupons_restrict for either DENY or ALLOW
  93.               $db->Execute("delete from " . TABLE_COUPON_RESTRICT . "
  94.                            WHERE coupon_id = '" . $_GET['cid'] . "'
  95.                            and product_id = '" . $new_products->fields['products_id'] . "'
  96.                            and coupon_restrict = '" . $status . "'");
  97.             }
  98.  
  99.             $new_products->MoveNext();
  100.           }
  101. // eof: ALL ADD/DELETE of Products in one Category
  102. // ==================================
  103.  
  104.       } else {
  105. // normal insert of product one by one allow/deny to coupon
  106.       $db->Execute("insert into " . TABLE_COUPON_RESTRICT . "
  107.                  (coupon_id, product_id, coupon_restrict)
  108.                  values ('" . $_GET['cid'] . "', '" . (int)$_POST['products_drop'] . "', '" . $status . "')");
  109.       } // not all deny allow
  110.     } else {
  111.       $messageStack->add(ERROR_DISCOUNT_COUPON_DEFINED_PRODUCT . ' ' . (int)$_POST['products_drop'], 'caution');
  112.     }
  113.   }
  114.   if ($_GET['action']=='remove') {
  115.     if (isset($_GET['info']) && isset($_POST['actionRemoveProto'])) {
  116.       $db->Execute("delete from " . TABLE_COUPON_RESTRICT . " where restrict_id = '" . $_GET['info'] . "'");
  117.     }
  118.   }
  119. ?>
  120. <!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
  121. <html <?php echo HTML_PARAMS; ?>>
  122. <head>
  123. <meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">
  124. <title><?php echo TITLE; ?></title>
  125. <link rel="stylesheet" type="text/css" href="includes/stylesheet.css">
  126. <link rel="stylesheet" type="text/css" href="includes/cssjsmenuhover.css" media="all" id="hoverJS">
  127. <script language="javascript" src="includes/menu.js"></script>
  128. <script type="text/javascript">
  129.   <!--
  130.   function init()
  131.   {
  132.     cssjsmenu('navbar');
  133.     if (document.getElementById)
  134.     {
  135.       var kill = document.getElementById('hoverJS');
  136.       kill.disabled = true;
  137.     }
  138.   }
  139.   // -->
  140. </script>
  141. </head>
  142. <body onload="init()">
  143. <body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0" bgcolor="#FFFFFF">
  144. <!-- header //-->
  145. <?php require(DIR_WS_INCLUDES . 'header.php'); ?>
  146. <!-- header_eof //-->
  147. <!-- body //-->
  148. <table border="0" width="100%" cellspacing="2" cellpadding="2">
  149.   <tr>
  150. <!-- body_text //-->
  151.     <td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2">
  152.       <tr>
  153.         <td><table border="0" width="100%" cellspacing="0" cellpadding="0">
  154.           <tr>
  155.             <td class="pageHeading"><?php echo HEADING_TITLE; ?></td>
  156.             <td class="pageHeading" align="right"><?php echo zen_draw_separator('pixel_trans.gif', HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td>
  157.           </tr>
  158.         </table></td>
  159.       </tr>
  160.       <tr>
  161.         <td><table border="0" width="100%" cellspacing="0" cellpadding="0">
  162.           <tr>
  163.             <td><table border="0" width="100%" cellspacing="0" cellpadding="0">
  164.               <tr>
  165.                 <td class="pageHeading"><?php echo HEADING_TITLE_CATEGORY; ?></td>
  166.               </tr>
  167.             </table></td>
  168.           </tr>
  169.           <tr>
  170.             <td><table border="0" width="100%" cellspacing="0" cellpadding="0">
  171.               <tr>
  172.                 <td valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2">
  173.                   <tr class="dataTableHeadingRow">
  174.                     <td class="dataTableHeadingContent"><?php echo HEADER_COUPON_ID; ?></td>
  175.                     <td class="dataTableHeadingContent" align="center"><?php echo HEADER_COUPON_NAME; ?></td>
  176.                     <td class="dataTableHeadingContent" align="center"><?php echo HEADER_CATEGORY_ID; ?></td>
  177.                     <td class="dataTableHeadingContent" align="center"><?php echo HEADER_CATEGORY_NAME; ?></td>
  178.                     <td class="dataTableHeadingContent" align="center"><?php echo HEADER_RESTRICT_ALLOW; ?></td>
  179.                     <td class="dataTableHeadingContent" align="center"><?php echo HEADER_RESTRICT_DENY; ?></td>
  180.                     <td class="dataTableHeadingContent" align="center"><?php echo HEADER_RESTRICT_REMOVE; ?></td>
  181.                   </tr>
  182. <?php
  183.     $cr_query_raw = "select * from " . TABLE_COUPON_RESTRICT . " where coupon_id = '" . $_GET['cid'] . "' and category_id != '0'";
  184.     $cr_split = new splitPageResults($_GET['cpage'], MAX_DISPLAY_RESTRICT_ENTRIES, $cr_query_raw, $cr_query_numrows);
  185.     $cr_list = $db->Execute($cr_query_raw);
  186.     while (!$cr_list->EOF) {
  187.       $rows++;
  188.       if (strlen($rows) < 2) {
  189.         $rows = '0' . $rows;
  190.       }
  191.       if (((!$_GET['cid']) || (@$_GET['cid'] == $cr_list->fields['restrict_id'])) && (!$cInfo)) {
  192.         $cInfo = new objectInfo($cr_list->fields);
  193.       }
  194.         echo '          <tr class="dataTableRow">' . "\n";
  195.      if ($cr_list->fields['category_id'] != -1) {
  196.      $coupon = $db->Execute("select coupon_name from " . TABLE_COUPONS_DESCRIPTION . "
  197.                             where coupon_id = '" . $_GET['cid'] . "' and language_id = '" . (int)$_SESSION['languages_id'] . "'");
  198.      $category_name = zen_get_category_name($cr_list->fields['category_id'], $_SESSION['languages_id']);
  199.      } else {
  200.         $category_name = TEXT_ALL_CATEGORIES;
  201.      }
  202. ?>
  203.                 <td class="dataTableContent"><?php echo $_GET['cid']; ?></td>
  204.                 <td class="dataTableContent" align="center"><?php echo $coupon->fields['coupon_name']; ?></td>
  205.                 <td class="dataTableContent" align="center"><?php echo $cr_list->fields['category_id']; ?></td>
  206.                 <td class="dataTableContent" align="center"><?php echo $category_name; ?></td>
  207. <?php
  208.         if ($cr_list->fields['coupon_restrict']=='N') {
  209.           echo '<td class="dataTableContent" align="center"><a href="' . zen_href_link('coupon_restrict.php', zen_get_all_get_params(array('info', 'action', 'x', 'y')) . 'action=switch_status&info=' . $cr_list->fields['restrict_id'], 'NONSSL') . '" onClick="divertClickSwitchStatus(this.href);return false;" >' . zen_image(DIR_WS_IMAGES . 'icon_status_green.gif', IMAGE_ALLOW) . '</a></td>';
  210.         } else {
  211.           echo '<td class="dataTableContent" align="center"><a href="' . zen_href_link('coupon_restrict.php', zen_get_all_get_params(array('info', 'action', 'x', 'y')) . 'action=switch_status&info=' . $cr_list->fields['restrict_id'], 'NONSSL') . '" onClick="divertClickSwitchStatus(this.href);return false;" >' . zen_image(DIR_WS_IMAGES . 'icon_status_red.gif', IMAGE_DENY) . '</a></td>';
  212.         }
  213.         if ($cr_list->fields['coupon_restrict']=='Y') {
  214.           echo '<td class="dataTableContent" align="center"><a href="' . zen_href_link('coupon_restrict.php', zen_get_all_get_params(array('info', 'action', 'x', 'y')) . 'action=switch_status&info=' . $cr_list->fields['restrict_id'], 'NONSSL') . '"  onClick="divertClickSwitchStatus(this.href);return false;" >' . zen_image(DIR_WS_IMAGES . 'icon_status_green.gif', IMAGE_ALLOW) . '</a></td>';
  215.         } else {
  216.           echo '<td class="dataTableContent" align="center"><a href="' . zen_href_link('coupon_restrict.php', zen_get_all_get_params(array('info', 'action', 'x', 'y')) . 'action=switch_status&info=' . $cr_list->fields['restrict_id'], 'NONSSL') . '"  onClick="divertClickSwitchStatus(this.href);return false;" >' . zen_image(DIR_WS_IMAGES . 'icon_status_red.gif', IMAGE_DENY) . '</a></td>';
  217.         }
  218.           echo '<td class="dataTableContent" align="center"><a href="' . zen_href_link('coupon_restrict.php', zen_get_all_get_params(array('info', 'action', 'x', 'y')) . 'action=remove&info=' . $cr_list->fields['restrict_id'], 'NONSSL') . '" onClick="divertClickActionRemove(this.href);return false;" >' . zen_image(DIR_WS_IMAGES . 'icons/delete.gif', IMAGE_REMOVE) . '</a></td>';
  219. ?>
  220.               </tr>
  221. <?php
  222.     $cr_list->MoveNext();
  223.     }
  224. ?>
  225.               <tr>
  226.                 <td colspan="7"><table border="0" width="100%" cellspacing="0" cellpadding="2">
  227.                   <tr>
  228.                     <td class="smallText" valign="top"><?php echo $cr_split->display_count($cr_query_numrows, MAX_DISPLAY_RESTRICT_ENTRIES, $_GET['cpage'], TEXT_DISPLAY_NUMBER_OF_CATEGORIES); ?></td>
  229.                     <td class="smallText" align="right"><?php echo $cr_split->display_links($cr_query_numrows, MAX_DISPLAY_RESTRICT_ENTRIES, MAX_DISPLAY_PAGE_LINKS, $_GET['cpage'],zen_get_all_get_params(array('cpage','action', 'x', 'y')),'cpage'); ?></td>
  230.                   </tr>
  231.                 </table></td>
  232.               </tr>
  233.               <tr><form name="restrict_category" method="post" action="<?php echo zen_href_link('coupon_restrict.php', zen_get_all_get_params(array('info', 'action', 'x', 'y')) . 'action=add_category&info=' . $cInfo->restrict_id, 'NONSSL'); ?>"><?php echo zen_draw_hidden_field('securityToken', $_SESSION['securityToken']); ?>
  234.                 <td colspan="7"><table border="0" width="100%" cellspacing="0" cellpadding="2">
  235.                   <tr>
  236.                     <td class="smallText" valign="top"><?php echo HEADER_CATEGORY_NAME; ?></td>
  237.                     <td class="smallText" align="left"></td>
  238.                     <td class="smallText" align="left"><?php echo zen_draw_pull_down_menu('cPath', zen_get_category_tree(), $current_category_id); ?></td>
  239.                     <td class="smallText" align="left"><?php echo zen_draw_pull_down_menu('restrict_status', $restrict_array, $current_category_id); ?></td>
  240.                     <td class="smallText" align="left"><input type="submit" name="add" value="Add"></td>
  241.                     <td class="smallText" align="left">&nbsp;</td>
  242.                     <td class="smallText" align="left">&nbsp;</td>
  243.                   </tr>
  244.                 </table></td>
  245.               </tr></form>
  246.                 </table></td>
  247.               </tr>
  248.             </table></td>
  249.           </tr>
  250.           <tr>
  251.             <td><?php echo zen_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
  252.           </tr>
  253.           <tr>
  254.             <td><?php echo zen_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
  255.           </tr>
  256.           <tr>
  257.             <td><table border="0" width="100%" cellspacing="0" cellpadding="0">
  258.               <tr>
  259.                 <td class="pageHeading"><?php echo HEADING_TITLE_PRODUCT; ?></td>
  260.               </tr>
  261.             </table></td>
  262.           </tr>
  263.           <tr>
  264.             <td><table border="0" width="100%" cellspacing="0" cellpadding="0">
  265.               <tr>
  266.                 <td valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2">
  267.                   <tr class="dataTableHeadingRow">
  268.                     <td class="dataTableHeadingContent"><?php echo HEADER_COUPON_ID; ?></td>
  269.                     <td class="dataTableHeadingContent" align="center"><?php echo HEADER_COUPON_NAME; ?></td>
  270.                     <td class="dataTableHeadingContent" align="center"><?php echo HEADER_PRODUCT_ID; ?></td>
  271.                     <td class="dataTableHeadingContent" align="center"><?php echo HEADER_PRODUCT_NAME; ?></td>
  272.                     <td class="dataTableHeadingContent" align="center"><?php echo HEADER_RESTRICT_ALLOW; ?></td>
  273.                     <td class="dataTableHeadingContent" align="center"><?php echo HEADER_RESTRICT_DENY; ?></td>
  274.                     <td class="dataTableHeadingContent" align="center"><?php echo HEADER_RESTRICT_REMOVE; ?></td>
  275.                   </tr>
  276. <?php
  277.     $pr_query_raw = "select * from " . TABLE_COUPON_RESTRICT . " where coupon_id = '" . $_GET['cid'] . "' and product_id != '0'";
  278.     $pr_split = new splitPageResults($_GET['ppage'], MAX_DISPLAY_RESTRICT_ENTRIES, $pr_query_raw, $pr_query_numrows);
  279.     $pr_list = $db->Execute($pr_query_raw);
  280.     while (!$pr_list->EOF) {
  281.       $rows++;
  282.       if (strlen($rows) < 2) {
  283.         $rows = '0' . $rows;
  284.       }
  285.       if (((!$_GET['cid']) || (@$_GET['cid'] == $cr_list->fields['restrict_id'])) && (!$pInfo)) {
  286.         $pInfo = new objectInfo($pr_list);
  287.       }
  288.         echo '          <tr class="dataTableRow">' . "\n";
  289.  
  290.      $coupon = $db->Execute("select coupon_name from " . TABLE_COUPONS_DESCRIPTION . " where coupon_id = '" . $_GET['cid'] . "' and language_id = '" . (int)$_SESSION['languages_id'] . "'");
  291.      $product_name = zen_get_products_name($pr_list->fields['product_id'], $_SESSION['languages_id']);
  292. ?>
  293.                 <td class="dataTableContent"><?php echo $_GET['cid']; ?></td>
  294.                 <td class="dataTableContent" align="center"><?php echo $coupon->fields['coupon_name']; ?></td>
  295.                 <td class="dataTableContent" align="center"><?php echo $pr_list->fields['product_id']; ?></td>
  296.                 <td class="dataTableContent" align="left"><?php echo '<strong>' . $product_name . '</strong><br />' . TEXT_CATEGORY . zen_get_categories_name_from_product($pr_list->fields['product_id']) . '<br />' . TEXT_MANUFACTURER . zen_get_products_manufacturers_name($pr_list->fields['product_id']); ?></td>
  297. <?php
  298.         if ($pr_list->fields['coupon_restrict']=='N') {
  299.           echo '<td class="dataTableContent" align="center"><a href="' . zen_href_link('coupon_restrict.php', zen_get_all_get_params(array('info', 'action', 'x', 'y')) . 'action=switch_status&info=' . $pr_list->fields['restrict_id'], 'NONSSL') . '" onClick="divertClickSwitchStatus(this.href);return false;" >' . zen_image(DIR_WS_IMAGES . 'icon_status_green.gif', IMAGE_ALLOW) . '</a></td>';
  300.         } else {
  301.           echo '<td class="dataTableContent" align="center"><a href="' . zen_href_link('coupon_restrict.php', zen_get_all_get_params(array('info', 'action', 'x', 'y')) . 'action=switch_status&info=' . $pr_list->fields['restrict_id'], 'NONSSL') . '" onClick="divertClickSwitchStatus(this.href);return false;" >' . zen_image(DIR_WS_IMAGES . 'icon_status_red.gif', IMAGE_DENY) . '</a></td>';
  302.         }
  303.         if ($pr_list->fields['coupon_restrict']=='Y') {
  304.           echo '<td class="dataTableContent" align="center"><a href="' . zen_href_link('coupon_restrict.php', zen_get_all_get_params(array('info', 'action', 'x', 'y')) . 'action=switch_status&info=' . $pr_list->fields['restrict_id'], 'NONSSL') . '" onClick="divertClickSwitchStatus(this.href);return false;" >' . zen_image(DIR_WS_IMAGES . 'icon_status_green.gif', IMAGE_DENY) . '</a></td>';
  305.         } else {
  306.           echo '<td class="dataTableContent" align="center"><a href="' . zen_href_link('coupon_restrict.php', zen_get_all_get_params(array('info', 'action', 'x', 'y')) . 'action=switch_status&info=' . $pr_list->fields['restrict_id'], 'NONSSL') . '" onClick="divertClickSwitchStatus(this.href);return false;" >' . zen_image(DIR_WS_IMAGES . 'icon_status_red.gif', IMAGE_ALLOW) . '</a></td>';
  307.         }
  308.           echo '<td class="dataTableContent" align="center"><a href="' . zen_href_link('coupon_restrict.php', zen_get_all_get_params(array('info', 'action', 'x', 'y')) . 'action=remove&info=' . $pr_list->fields['restrict_id'], 'NONSSL') . '" onClick="divertClickActionRemove(this.href);return false;" >' . zen_image(DIR_WS_IMAGES . 'icons/delete.gif', IMAGE_REMOVE) . '</a></td>';
  309. ?>
  310.               </tr>
  311. <?php
  312.     $pr_list->MoveNext();
  313.     }
  314. ?>
  315.               <tr>
  316.                 <td colspan="7"><table border="0" width="100%" cellspacing="0" cellpadding="2">
  317.                   <tr>
  318.                     <td class="smallText" valign="top"><?php echo $pr_split->display_count($pr_query_numrows, MAX_DISPLAY_RESTRICT_ENTRIES, $_GET['ppage'], TEXT_DISPLAY_NUMBER_OF_PRODUCTS); ?></td>
  319.                     <td class="smallText" align="right"><?php echo $pr_split->display_links($pr_query_numrows, MAX_DISPLAY_RESTRICT_ENTRIES, MAX_DISPLAY_PAGE_LINKS, $_GET['ppage'],zen_get_all_get_params(array('ppage','action', 'x', 'y')),'ppage'); ?></td>
  320.                   </tr>
  321.                 </table></td>
  322.               </tr>
  323.               <tr><form name="restrict_category" method="post" action="<?php echo zen_href_link('coupon_restrict.php', zen_get_all_get_params(array('info', 'action', 'x', 'y')) . 'action=add_category&info=' . $cInfo->restrict_id, 'NONSSL'); ?>"><?php echo zen_draw_hidden_field('securityToken', $_SESSION['securityToken']); ?>
  324.                 <td colspan="7"><table border="0" width="100%" cellspacing="0" cellpadding="2">
  325.                   <tr>
  326. <?php
  327.       if (isset($_POST['cPath_prod'])) $current_category_id = $_POST['cPath_prod'];
  328.       $products = $db->Execute("select p.products_id, pd.products_name from " .
  329.       TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c
  330.      where p.products_id = pd.products_id and pd.language_id = '" . (int)$_SESSION['languages_id'] . "'
  331.      and p.products_id = p2c.products_id and p2c.categories_id = '" . $_POST['cPath_prod'] . "'
  332.      order by pd.products_name");
  333.       $products_array = array();
  334.  
  335.       if (!$products->EOF) {
  336.         $products_array[] = array('id' => '-1',
  337.                                    'text' => TEXT_ALL_PRODUCTS_ADD);
  338.         $products_array[] = array('id' => '-2',
  339.                                    'text' => TEXT_ALL_PRODUCTS_REMOVE);
  340.       }
  341.  
  342.       while (!$products->EOF) {
  343.         $products_array[] = array('id'=>$products->fields['products_id'],
  344.                                    'text'=>$products->fields['products_name']);
  345.         $products->MoveNext();
  346.       }
  347. ?>
  348.                     <td class="smallText" valign="top"><?php echo HEADER_CATEGORY_NAME; ?></td>
  349.                     <td class="smallText" align="left"></td><form name="restrict_product" method="post" action="<?php echo zen_href_link('coupon_restrict.php', zen_get_all_get_params(array('info', 'action', 'x', 'y')) . 'info=' . $cInfo->restrict_id, 'NONSSL'); ?>">
  350.                     <?php echo zen_hide_session_id(); ?>
  351.                     <td class="smallText" align="left"><?php echo zen_draw_pull_down_menu('cPath_prod', zen_get_category_tree(), $current_category_id, 'onChange="this.form.submit();"'); ?></td></form>
  352. <?php if (sizeof($products_array) > 0) { ?>
  353.                     <form name="restrict_category" method="post" action="<?php echo zen_href_link('coupon_restrict.php', zen_get_all_get_params(array('info', 'action', 'x', 'y')) . 'action=add_product&info=' . $cInfo->restrict_id . '&build_cat=' . $current_category_id, 'NONSSL'); ?>"><?php echo zen_draw_hidden_field('securityToken', $_SESSION['securityToken']); ?>
  354.                     <td class="smallText" valign="top"><?php echo HEADER_PRODUCT_NAME; ?></td>
  355.                     <td class="smallText" align="left"><?php echo zen_draw_pull_down_menu('products_drop', $products_array, $current_category_id); ?></td>
  356.                     <td class="smallText" align="left"><?php echo zen_draw_pull_down_menu('restrict_status', $restrict_array); ?></td>
  357.                     <td class="smallText" align="left"><input type="submit" name="add" value="Update"></td>
  358.                     <td class="smallText" align="left">&nbsp;</td>
  359.                     <td class="smallText" align="left">&nbsp;</td>
  360. <?php } else { ?>
  361.                     <td class="smallText" align="left" colspan="6">&nbsp;</td>
  362. <?php } ?>
  363.                   </tr>
  364.                   <tr>
  365.                     <td class="smallText" align="left" colspan = "9"><?php echo TEXT_INFO_ADD_DENY_ALL; ?></td>
  366.                   </tr>
  367.                 </table></td>
  368.               </tr></form>
  369.                 </table></td>
  370.               </tr>
  371.             </table></td>
  372.           </tr>
  373.           <tr>
  374.             <td><?php echo zen_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
  375.           </tr>
  376.           <tr>
  377.             <td align="right" colspan="2" class="smallText"><?php echo '<a href="' . zen_href_link(FILENAME_COUPON_ADMIN, 'page=' . $_GET['page'] . '&cid=' . (!empty($cInfo->coupon_id) ? $cInfo->coupon_id : $_GET['cid']) . (isset($_GET['status']) ? '&status=' . $_GET['status'] : '')) . '">' . zen_image_button('button_back.gif', IMAGE_BACK) . '</a>'; ?></td>
  378.           </tr>
  379.         </table></td>
  380.       </tr>
  381.       <tr>
  382.         <td><?php echo zen_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
  383.       </tr>
  384.     </table></td>
  385. <!-- body_text_eof //-->
  386.   </tr>
  387. </table>
  388. <!-- body_eof //-->
  389.  
  390. <!-- footer //-->
  391. <?php require(DIR_WS_INCLUDES . 'footer.php'); ?>
  392. <!-- footer_eof //-->
  393. <br>
  394. <form name="actionRemove" id="actionRemove" action="#" method="post">
  395. <input type="hidden" name="securityToken" value="<?php echo $_SESSION['securityToken']; ?>" />
  396. <input type="hidden" name="actionRemoveProto" value="" />
  397. </form>
  398. <form name="switchStatus" id="switchStatus" action="#" method="post">
  399. <input type="hidden" name="securityToken" value="<?php echo $_SESSION['securityToken']; ?>" />
  400. <input type="hidden" name="switchStatusProto" value="" />
  401. </form>
  402. <script type="text/javascript">
  403. function divertClickActionRemove(href)
  404. {
  405.     document.getElementById('actionRemove').action = href;
  406.     document.getElementById('actionRemove').submit();
  407.     return false;
  408. }
  409. function divertClickSwitchStatus(href)
  410. {
  411.     document.getElementById('switchStatus').action = href;
  412.     document.getElementById('switchStatus').submit();
  413.     return false;
  414. }
  415. </script>
  416. </body>
  417. </html>
  418. <?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>
  419.  


cron