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

Zen Cart 源代码 gv_queue.php




下载文件

文件名: gv_queue.php
文件类型: PHP文件
文件大小: 13.47 KiB
MD5: 5a7dd3cdbe0bec5b404fbf520df8f839

gv_queue.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: gv_queue.php 18695 2011-05-04 05:24:19Z drbyte $
  8.  */
  9.  
  10.   require('includes/application_top.php');
  11.  
  12.   require(DIR_WS_CLASSES . 'currencies.php');
  13.   $currencies = new currencies();
  14.  
  15.   if (isset($_GET['order'])) $_GET['order'] = (int)$_GET['order'];
  16.   if (isset($_GET['gid'])) $_GET['gid'] = (int)$_GET['gid'];
  17.  
  18. // bof: find gv for a particular order and set page
  19.   if ($_GET['order'] != '') {
  20.     $gv_check = $db->Execute("select order_id, unique_id
  21.                                  from " . TABLE_COUPON_GV_QUEUE . "
  22.                                  where order_id = '" . $_GET['order'] . "' and release_flag= 'N' limit 1");
  23.  
  24.     $_GET['gid'] = $gv_check->fields['unique_id'];
  25.  
  26.     $gv_page = $db->Execute("select c.customers_firstname, c.customers_lastname, gv.unique_id, gv.date_created, gv.amount, gv.order_id from " . TABLE_CUSTOMERS . " c, " . TABLE_COUPON_GV_QUEUE . " gv where (gv.customer_id = c.customers_id and gv.release_flag = 'N')" . " order by gv.order_id, gv.unique_id");
  27.     $page_cnt=1;
  28.     while (!$gv_page->EOF) {
  29.       if ($gv_page->fields['order_id'] == $_GET['order']) {
  30.         break;
  31.       }
  32.       $page_cnt++;
  33.       $gv_page->MoveNext();
  34.     }
  35.     $_GET['page'] = round(($page_cnt/MAX_DISPLAY_SEARCH_RESULTS));
  36.     zen_redirect(zen_href_link(FILENAME_GV_QUEUE, 'gid=' . $gv_check->fields['unique_id'] . '&page=' . $_GET['page']));
  37.   }
  38. // eof: find gv for a particular order and set page
  39.  
  40.   if ($_GET['action'] == 'confirmrelease' && isset($_POST['gid'])) {
  41.     $gv_result = $db->Execute("select release_flag
  42.                               from " . TABLE_COUPON_GV_QUEUE . "
  43.                               where unique_id='" . (int)$_POST['gid'] . "'");
  44.  
  45.     if ($gv_result->fields['release_flag'] == 'N') {
  46.       $gv_resulta = $db->Execute("select customer_id, amount, order_id
  47.                                  from " . TABLE_COUPON_GV_QUEUE . "
  48.                                  where unique_id='" . (int)$_POST['gid'] . "'");
  49.  
  50.       if ($gv_resulta->RecordCount() > 0) {
  51.       $gv_amount = $gv_resulta->fields['amount'];
  52.  
  53.     // Begin composing email content
  54. //      //Let's build a message object using the email class
  55.       $mail = $db->Execute("select customers_firstname, customers_lastname, customers_email_address
  56.                           from " . TABLE_CUSTOMERS . "
  57.                           where customers_id = '" . $gv_resulta->fields['customer_id'] . "'");
  58.  
  59.       $message  = TEXT_REDEEM_GV_MESSAGE_HEADER . "\n" . HTTP_CATALOG_SERVER . DIR_WS_CATALOG . "\n\n" . TEXT_REDEEM_GV_MESSAGE_RELEASED;
  60.       $message .= sprintf(TEXT_REDEEM_GV_MESSAGE_AMOUNT, $currencies->format($gv_amount)) . "\n\n";
  61.       $message .= TEXT_REDEEM_GV_MESSAGE_THANKS . "\n" . STORE_OWNER . "\n\n" . HTTP_CATALOG_SERVER . DIR_WS_CATALOG;
  62.       $message .= TEXT_REDEEM_GV_MESSAGE_BODY;
  63.       $message .= TEXT_REDEEM_GV_MESSAGE_FOOTER;
  64.       $message .= "\n-----\n" . sprintf(EMAIL_DISCLAIMER, STORE_OWNER_EMAIL_ADDRESS) . "\n\n";
  65.  
  66.       $html_msg['EMAIL_FIRST_NAME'] = $mail->fields['customers_firstname'];
  67.       $html_msg['EMAIL_LAST_NAME']  = $mail->fields['customers_lastname'];
  68.       $html_msg['GV_NOTICE_HEADER']  = TEXT_REDEEM_GV_MESSAGE_HEADER;
  69.       $html_msg['GV_NOTICE_RELEASED']  = TEXT_REDEEM_GV_MESSAGE_RELEASED;
  70.       $html_msg['GV_NOTICE_AMOUNT_REDEEM'] = sprintf(TEXT_REDEEM_GV_MESSAGE_AMOUNT, '<strong>' . $currencies->format($gv_amount) . '</strong>');
  71.       $html_msg['GV_NOTICE_VALUE'] = $currencies->format($gv_amount);
  72.       $html_msg['GV_NOTICE_THANKS'] = TEXT_REDEEM_GV_MESSAGE_THANKS;
  73.       $html_msg['TEXT_REDEEM_GV_MESSAGE_BODY'] = TEXT_REDEEM_GV_MESSAGE_BODY;
  74.       $html_msg['TEXT_REDEEM_GV_MESSAGE_FOOTER'] = TEXT_REDEEM_GV_MESSAGE_FOOTER;
  75.  
  76. //send the message
  77.         zen_mail($mail->fields['customers_firstname'] . ' ' . $mail->fields['customers_lastname'], $mail->fields['customers_email_address'], TEXT_REDEEM_GV_SUBJECT . TEXT_REDEEM_GV_SUBJECT_ORDER . $gv_resulta->fields['order_id'] , $message, STORE_NAME, EMAIL_FROM, $html_msg, 'gv_queue');
  78.  
  79.  
  80.  
  81.       $gv_amount=$gv_resulta->fields['amount'];
  82.       $gv_result=$db->Execute("select amount
  83.                               from " . TABLE_COUPON_GV_CUSTOMER . "
  84.                               where customer_id='" . $gv_resulta->fields['customer_id'] . "'");
  85.  
  86.       $customer_gv=false;
  87.       $total_gv_amount=0;
  88.       if ($gv_result->RecordCount() > 0) {
  89.         $total_gv_amount=$gv_result->fields['amount'];
  90.         $customer_gv=true;
  91.       }
  92.       $total_gv_amount=$total_gv_amount+$gv_amount;
  93.       if ($customer_gv) {
  94.         $db->Execute("update " . TABLE_COUPON_GV_CUSTOMER . "
  95.                      set amount='" . $total_gv_amount . "'
  96.                      where customer_id='" . $gv_resulta->fields['customer_id'] . "'");
  97.       } else {
  98.         $db->Execute("insert into " . TABLE_COUPON_GV_CUSTOMER . "
  99.                    (customer_id, amount)
  100.                    values ('" . $gv_resulta->fields['customer_id']. "', '" . $total_gv_amount . "')");
  101.       }
  102.         $db->Execute("update " . TABLE_COUPON_GV_QUEUE . "
  103.                      set release_flag= 'Y'
  104.                      where unique_id='" . (int)$_POST['gid'] . "'");
  105.       }
  106.     }
  107.     // return back to same page after release
  108.     zen_redirect(zen_href_link(FILENAME_GV_QUEUE, 'page=' . (int)$_GET['page']));
  109.   }
  110. ?>
  111. <!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
  112. <html <?php echo HTML_PARAMS; ?>>
  113. <head>
  114. <meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">
  115. <title><?php echo TITLE; ?></title>
  116. <link rel="stylesheet" type="text/css" href="includes/stylesheet.css">
  117. <link rel="stylesheet" type="text/css" href="includes/cssjsmenuhover.css" media="all" id="hoverJS">
  118. <script language="javascript" src="includes/menu.js"></script>
  119. <script type="text/javascript">
  120.   <!--
  121.   function init()
  122.   {
  123.     cssjsmenu('navbar');
  124.     if (document.getElementById)
  125.     {
  126.       var kill = document.getElementById('hoverJS');
  127.       kill.disabled = true;
  128.     }
  129.   }
  130.   // -->
  131. </script>
  132. </head>
  133. <body onload="init()">
  134. <!-- header //-->
  135. <?php require(DIR_WS_INCLUDES . 'header.php'); ?>
  136. <!-- header_eof //-->
  137.  
  138. <!-- body //-->
  139. <table border="0" width="100%" cellspacing="2" cellpadding="2">
  140.   <tr>
  141. <!-- body_text //-->
  142.     <td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2">
  143.       <tr>
  144.         <td width="100%"><table border="0" width="100%" cellspacing="0" cellpadding="0">
  145.           <tr>
  146.             <td class="pageHeading"><?php echo HEADING_TITLE; ?></td>
  147.             <td class="pageHeading" align="right"><?php echo zen_draw_separator('pixel_trans.gif', HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td>
  148.           </tr>
  149.         </table></td>
  150.       </tr>
  151.       <tr>
  152.         <td><table border="0" width="100%" cellspacing="0" cellpadding="0">
  153.           <tr>
  154.             <td valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2">
  155.               <tr class="dataTableHeadingRow">
  156.                 <td class="dataTableHeadingContent"><?php echo TABLE_HEADING_CUSTOMERS; ?></td>
  157.                 <td class="dataTableHeadingContent" align="center"><?php echo TABLE_HEADING_ORDERS_ID; ?></td>
  158.                 <td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_VOUCHER_VALUE; ?></td>
  159.                 <td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_DATE_PURCHASED; ?></td>
  160.                 <td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_ACTION; ?>&nbsp;</td>
  161.               </tr>
  162. <?php
  163.   $gv_query_raw = "select c.customers_firstname, c.customers_lastname, gv.unique_id, gv.date_created, gv.amount, gv.order_id from " . TABLE_CUSTOMERS . " c, " . TABLE_COUPON_GV_QUEUE . " gv where (gv.customer_id = c.customers_id and gv.release_flag = 'N')" . " order by gv.order_id, gv.unique_id";
  164.   $gv_split = new splitPageResults($_GET['page'], MAX_DISPLAY_SEARCH_RESULTS, $gv_query_raw, $gv_query_numrows);
  165.   $gv_list = $db->Execute($gv_query_raw);
  166.   while (!$gv_list->EOF) {
  167.     if (((!$_GET['gid']) || (@$_GET['gid'] == $gv_list->fields['unique_id'])) && (!$gInfo)) {
  168.       $gInfo = new objectInfo($gv_list->fields);
  169.     }
  170.     if ( (is_object($gInfo)) && ($gv_list->fields['unique_id'] == $gInfo->unique_id) ) {
  171.       echo '              <tr class="dataTableRowSelected" onmouseover="this.style.cursor=\'hand\'" onclick="document.location.href=\'' . zen_href_link('gv_queue.php', zen_get_all_get_params(array('gid', 'action')) . 'gid=' . $gInfo->unique_id . '&action=edit') . '\'">' . "\n";
  172.     } else {
  173.       echo '              <tr class="dataTableRow" onmouseover="this.className=\'dataTableRowOver\';this.style.cursor=\'hand\'" onmouseout="this.className=\'dataTableRow\'" onclick="document.location.href=\'' . zen_href_link('gv_queue.php', zen_get_all_get_params(array('gid', 'action')) . 'gid=' . $gv_list->fields['unique_id']) . '\'">' . "\n";
  174.     }
  175. ?>
  176.                 <td class="dataTableContent"><?php echo $gv_list->fields['customers_firstname'] . ' ' . $gv_list->fields['customers_lastname']; ?></td>
  177.                 <td class="dataTableContent" align="center"><?php echo $gv_list->fields['order_id']; ?></td>
  178.                 <td class="dataTableContent" align="right"><?php echo $currencies->format($gv_list->fields['amount']); ?></td>
  179.                 <td class="dataTableContent" align="right"><?php echo zen_datetime_short($gv_list->fields['date_created']); ?></td>
  180.                 <td class="dataTableContent" align="right"><?php if ( (is_object($gInfo)) && ($gv_list->fields['unique_id'] == $gInfo->unique_id) ) { echo zen_image(DIR_WS_IMAGES . 'icon_arrow_right.gif'); } else { echo '<a href="' . zen_href_link(FILENAME_GV_QUEUE, 'page=' . $_GET['page'] . '&gid=' . $gv_list->fields['unique_id']) . '">' . zen_image(DIR_WS_IMAGES . 'icon_info.gif', IMAGE_ICON_INFO) . '</a>'; } ?>&nbsp;</td>
  181.               </tr>
  182. <?php
  183.     $gv_list->MoveNext();
  184.   }
  185. ?>
  186.               <tr>
  187.                 <td colspan="5"><table border="0" width="100%" cellspacing="0" cellpadding="2">
  188.                   <tr>
  189.                     <td class="smallText" valign="top"><?php echo $gv_split->display_count($gv_query_numrows, MAX_DISPLAY_SEARCH_RESULTS, $_GET['page'], TEXT_DISPLAY_NUMBER_OF_GIFT_VOUCHERS); ?></td>
  190.                     <td class="smallText" align="right"><?php echo $gv_split->display_links($gv_query_numrows, MAX_DISPLAY_SEARCH_RESULTS, MAX_DISPLAY_PAGE_LINKS, $_GET['page']); ?></td>
  191.                   </tr>
  192.                 </table></td>
  193.               </tr>
  194.             </table></td>
  195. <?php
  196.   $heading = array();
  197.   $contents = array();
  198.   switch ($_GET['action']) {
  199.     case 'release':
  200.       $heading[] = array('text' => '[' . $gInfo->unique_id . '] ' . zen_datetime_short($gInfo->date_created) . ' ' . $currencies->format($gInfo->amount));
  201.       $contents[] = array('align' => 'center', 'text' => zen_draw_form('gv_release', FILENAME_GV_QUEUE, 'action=confirmrelease&page=' . $_GET['page']) . zen_image_submit('button_confirm_red.gif', IMAGE_CONFIRM) . '<input type="hidden" name="gid" value="' . $gInfo->unique_id . '" /></form>' . '<a href="' . zen_href_link('gv_queue.php', 'action=cancel&gid=' . $gInfo->unique_id . '&page=' . $_GET['page'],'NONSSL') . '">' . zen_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>');
  202. //      $contents[] = array('align' => 'center', 'text' => '<a href="' . zen_href_link('gv_queue.php', 'action=confirmrelease&gid=' . $gInfo->unique_id . '&page=' . $_GET['page'],'NONSSL') . '">' . zen_image_button('button_confirm_red.gif', IMAGE_CONFIRM) . '</a> <a href="' . zen_href_link('gv_queue.php', 'action=cancel&gid=' . $gInfo->unique_id . '&page=' . $_GET['page'],'NONSSL') . '">' . zen_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>');
  203.       break;
  204.     default:
  205.       $heading[] = array('text' => '[' . $gInfo->unique_id . '] ' . zen_datetime_short($gInfo->date_created) . ' ' . $currencies->format($gInfo->amount));
  206.  
  207.       if ($gv_list->RecordCount() == 0) {
  208.         $contents[] = array('align' => 'center','text' => TEXT_GV_NONE);
  209.       } else {
  210.         $contents[] = array('align' => 'center','text' => '<a href="' . zen_href_link('gv_queue.php','action=release&gid=' . $gInfo->unique_id . '&page=' . $_GET['page'],'NONSSL'). '">' . zen_image_button('button_release_gift.gif', IMAGE_RELEASE) . '</a>');
  211.  
  212. // quick link to order
  213.         $contents[] = array('align' => 'center', 'text' => '<br />' . zen_image(DIR_WS_IMAGES . 'pixel_black.gif','','90%','3'));
  214.         $contents[] = array('align' => 'center', 'text' => TEXT_EDIT_ORDER . $gInfo->order_id);
  215.         $contents[] = array('align' => 'center', 'text' => '<a href="' . zen_href_link(FILENAME_ORDERS, 'oID=' . $gInfo->order_id . '&action=edit', 'NONSSL') . '">' . zen_image_button('button_order.gif', IMAGE_ORDER) . '</a>');
  216.       }
  217.       break;
  218.    }
  219.  
  220.   if ( (zen_not_null($heading)) && (zen_not_null($contents)) ) {
  221.     echo '            <td width="25%" valign="top">' . "\n";
  222.  
  223.     $box = new box;
  224.     echo $box->infoBox($heading, $contents);
  225.  
  226.     echo '            </td>' . "\n";
  227.   }
  228. ?>
  229.           </tr>
  230.         </table></td>
  231.       </tr>
  232.     </table></td>
  233. <!-- body_text_eof //-->
  234.   </tr>
  235. </table>
  236. <!-- body_eof //-->
  237.  
  238. <!-- footer //-->
  239. <?php require(DIR_WS_INCLUDES . 'footer.php'); ?>
  240. <!-- footer_eof //-->
  241. <br />
  242. </body>
  243. </html>
  244. <?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>


cron