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

Zen Cart 源代码 email_archive_manager.php




下载文件

文件名: email_archive_manager.php
文件类型: PHP文件
文件大小: 25.92 KiB
MD5: 364fb2826b7d17616282db7892fcc76c

email_archive_manager.php - 关闭高亮
  1. <?php
  2. /*
  3. //////////////////////////////////////////////////////////
  4. //  EMAIL ARCHIVE SEARCH                                //
  5. //  Version 1.5                                         //
  6. //                                                      //
  7. //  By Frank Koehl  (PM: BlindSide)                     //
  8. //  Support by DrByte                                   //
  9. //  Delete button by That Software Guy                  //
  10. //                                                      //
  11. //  Powered by Zen Cart (www.zen-cart.com)              //
  12. //  Portions Copyright (c) 2010 The Zen Cart Team       //
  13. //                                                      //
  14. //  Released under the GNU General Public License       //
  15. //  available at www.zen-cart.com/license/2_0.txt       //
  16. //  or see "license.txt" in the downloaded zip          //
  17. //////////////////////////////////////////////////////////
  18. */
  19.  
  20.   require('includes/application_top.php');
  21.  
  22.   $action = (isset($_GET['action']) ? $_GET['action'] : '');
  23.   $isForDisplay = (($_GET['print_format'] < 1) ? true : false);
  24.   if ($action == 'prev_text' || $action == 'prev_html') {
  25.     //$isForDisplay = false;
  26.   }
  27.   if ($action == 'resend') {
  28.     // collect the e-mail data
  29.     $email_sql = $db->Execute("select * from " . TABLE_EMAIL_ARCHIVE . " where archive_id = " . $_GET['archive_id']);
  30.     $email = new objectInfo($email_sql->fields);
  31.     // resend the message
  32.     // we use 'cc_middle_digs' as the module because that is not archived (don't want to achive the same message twice)
  33.     zen_mail($email->email_to_name, $email->email_to_address, $email->email_subject, $email->email_text, $email->email_from_name, $email->email_from_address, $email->email_html, 'cc_middle_digs');
  34.     $messageStack->add_session(sprintf(SUCCESS_EMAIL_RESENT, $email->archive_id, $email->email_to_address), 'success');
  35.     zen_redirect(zen_href_link(FILENAME_EMAIL_HISTORY));
  36.   }
  37.   if ($action == 'delete') {
  38.       $db->Execute("delete from " . TABLE_EMAIL_ARCHIVE . "
  39.                                  where archive_id = '" . (int)$_GET['archive_id'] . "'");
  40.       zen_redirect(zen_href_link(FILENAME_EMAIL_HISTORY));
  41.   }
  42.   if ($action == 'trim_confirm') {
  43.     $age = $_GET['email_age'];
  44.     if ($age == '1_months') {
  45.       $cutoff_date = '1 MONTH';
  46.     }
  47.     if ($age == '6_months') {
  48.       $cutoff_date = '6 MONTH';
  49.     }
  50.     elseif ($age == '1_year') {
  51.       $cutoff_date = '12 MONTH';
  52.     }
  53.     $db->Execute("DELETE FROM " . TABLE_EMAIL_ARCHIVE . " WHERE
  54.                  date_sent <= DATE_SUB(NOW(), INTERVAL " . $cutoff_date . ")");
  55.     $db->Execute("OPTIMIZE TABLE " . TABLE_EMAIL_ARCHIVE);
  56.     $messageStack->add_session(sprintf(SUCCESS_TRIM_ARCHIVE, $cutoff_date), 'success');
  57.     zen_redirect(zen_href_link(FILENAME_EMAIL_HISTORY, '', 'NONSSL'));
  58.   }
  59.   $email_module = $db->Execute("SELECT DISTINCT module
  60.                                FROM " . TABLE_EMAIL_ARCHIVE . "
  61.                                ORDER BY module ASC");
  62.   $email_module_array[] = array('id' => 1,
  63.                                 'text' => TEXT_ALL_MODULES);
  64.   while (!$email_module->EOF) {
  65.     $email_module_array[] = array('id' => $email_module->fields['module'],
  66.                                   'text' => $email_module->fields['module']);
  67.     $email_module->MoveNext();
  68.   }
  69.   $search_sd = ((isset($_GET['start_date']) && zen_not_null($_GET['start_date'])) ? true : false);
  70.   $search_ed = ((isset($_GET['end_date']) && zen_not_null($_GET['end_date'])) ? true : false);
  71.   $search_text = ((isset($_GET['text']) && zen_not_null($_GET['text'])) ? true : false);
  72.   $search_module = ((isset($_GET['module']) && zen_not_null($_GET['module']) && $_GET['module'] != 1) ? true : false);
  73.   $sd_raw = zen_date_raw($_GET['start_date']);
  74.   $ed_raw = zen_date_raw($_GET['end_date']);
  75. ?>
  76. <!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
  77. <html <?php echo HTML_PARAMS; ?>>
  78. <head>
  79. <meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">
  80. <title><?php echo TITLE; ?></title>
  81. <link rel="stylesheet" type="text/css" href="includes/stylesheet.css">
  82. <?php if ($isForDisplay) { ?>
  83. <link rel="stylesheet" type="text/css" href="includes/cssjsmenuhover.css" media="all" id="hoverJS">
  84. <link rel="stylesheet" type="text/css" href="includes/javascript/spiffyCal/spiffyCal_v2_1.css">
  85. <script language="JavaScript" src="includes/javascript/spiffyCal/spiffyCal_v2_1.js"></script>
  86. <script language="javascript" src="includes/menu.js"></script>
  87. <script language="javascript" src="includes/general.js"></script>
  88. <script type="text/javascript">
  89. <!--
  90.   function init()
  91.   {
  92.     cssjsmenu('navbar');
  93.     if (document.getElementById)
  94.     {
  95.       var kill = document.getElementById('hoverJS');
  96.       kill.disabled = true;
  97.     }
  98.   }
  99.   function del_confirmation() {
  100.     var answer = confirm('<?php echo POPUP_CONFIRM_DELETE; ?>')
  101.     if (answer) {
  102.       window.location = "<?php echo zen_href_link(FILENAME_EMAIL_HISTORY, zen_get_all_get_params(array('action')) . 'action=delete'); ?>";
  103.     }
  104.   }
  105.  
  106.   function confirmation() {
  107.     var answer = confirm('<?php echo POPUP_CONFIRM_RESEND; ?>')
  108.     if (answer) {
  109.       window.location = "<?php echo zen_href_link(FILENAME_EMAIL_HISTORY, zen_get_all_get_params(array('action')) . 'action=resend'); ?>";
  110.     }
  111.   }
  112. // -->
  113. </script>
  114. <style type="text/css">
  115. <!--
  116. .warningBox{
  117. background-color:#FF9999;
  118. }
  119. .warningText{
  120. font-size:10px;
  121. font-weight:bold;
  122. border-color:#FF0000;
  123. border-style:solid;
  124. border-width:3px;
  125. }
  126. -->
  127. </style>
  128. <?php } ?>
  129. </head>
  130. <?php if ($action == 'prev_text' || $action == 'prev_html') { ?>
  131. <body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0" bgcolor="#FFFFFF">
  132. <?php }
  133.       if ($isForDisplay) { ?>
  134. <body onload="init()">
  135. <div id="spiffycalendar" class="text"></div>
  136. <?php require(DIR_WS_INCLUDES . 'header.php'); ?>
  137. <script language="javascript">
  138. <!--
  139. var StartDate = new ctlSpiffyCalendarBox("StartDate", "search", "start_date", "btnDate1","<?php echo (($_GET['start_date'] == '') ? '' : $_GET['start_date']); ?>",scBTNMODE_CUSTOMBLUE);
  140. var EndDate = new ctlSpiffyCalendarBox("EndDate", "search", "end_date", "btnDate2","<?php echo (($_GET['end_date'] == '') ? '' : $_GET['end_date']); ?>",scBTNMODE_CUSTOMBLUE);
  141. -->
  142. </script>
  143. <?php } ?>
  144. <table border="0" width="100%" cellspacing="2" cellpadding="2">
  145.   <tr>
  146. <?php
  147.     switch ($action) {
  148.  
  149.       case 'delete_confirm':
  150.       case 'resend_confirm':
  151.       case 'prev_text':
  152.       case 'prev_html':
  153.       $this_email = $db->Execute("select * from " . TABLE_EMAIL_ARCHIVE . "
  154.                                  where archive_id = '" . $_GET['archive_id'] . "'");
  155.  
  156.       if ($action=='prev_html') {
  157.         $html_content = $this_email->fields['email_html'];
  158.         $html_content = str_replace('__','><',$html_content);
  159.         $html_content = str_replace('_html','<html',$html_content);
  160.         $html_content = str_replace('_base','<base',$html_content);
  161.         $html_content = str_replace('_table_','<table>',$html_content);
  162.         $html_content = str_replace('_table ','<table ',$html_content);
  163.         $html_content = str_replace('_/table','</table',$html_content);
  164.         $html_content = str_replace(array('_tr_','_tr>'),'<tr>',$html_content);
  165.         $html_content = str_replace(array('_/tr_','_/tr>'),'</tr>',$html_content);
  166.         $html_content = str_replace(array('_td_','<td_'),'<td>',$html_content);
  167.         $html_content = str_replace('_td ','<td ',$html_content);
  168.         $html_content = str_replace(array('_/td_','_/td>','</td_'),'</td>',$html_content);
  169.         $html_content = str_replace('"_','">',$html_content);
  170.         $html_content = str_replace('_ ','> ',$html_content);
  171.         $html_content = str_replace('_li>','<li>',$html_content);
  172.         $html_content = str_replace('_div ','<div ',$html_content);
  173.         $html_content = str_replace('_/div_','</div>',$html_content);
  174.         $html_content = str_replace('_/div','</div',$html_content);
  175.         $html_content = str_replace('_strong_','<strong>',$html_content);
  176.         $html_content = str_replace('_/strong_','</strong>',$html_content);
  177.         $html_content = str_replace('strong_','strong>',$html_content);
  178.         $html_content = str_replace('_/strong','</strong',$html_content);
  179.         $html_content = str_replace('_!','<!',$html_content);
  180.         $html_content = str_replace(array('_br_','_br /_','_br />'),'<br />',$html_content);
  181.         $html_content = str_replace('_/style','</style',$html_content);
  182.         $html_content = str_replace('em_','em>',$html_content);
  183.         $html_content = str_replace('_/em','</em',$html_content);
  184.         $html_content = str_replace('_img ','<img ',$html_content);
  185.         $html_content = str_replace('_a href','<a href',$html_content);
  186.         $html_content = str_replace(array('_/a_','_/a>'),'</a>',$html_content);
  187.  
  188.         $html_content = str_replace(array('<html>','</html>','</html_'),'',$html_content);
  189.         $html_content = str_replace(array('<head>','</head>'),'',$html_content);
  190.         $html_content = str_replace(array('<body>','</body>'),'',$html_content);
  191.         $html_content = str_replace('&quot;_','">',$html_content);
  192.         $html_content = str_replace('_nobr','<nobr',$html_content);
  193.         $html_content = str_replace(';nbsp;','&nbsp;',$html_content);
  194.         $html_content = str_replace('&amp;','&',$html_content);
  195.         $html_content = str_replace('&amp&','&&',$html_content);
  196.         $html_content = str_replace('&&nbsp;','&nbsp;',$html_content);
  197.         $html_content = str_replace('&quot;','"',$html_content);
  198.       }
  199. ?>
  200.         <td><table border="0" width="100%" cellspacing="0" cellpadding="0">
  201.           <tr>
  202.             <td class="pageHeading" align="left"><?php echo '<a href="' . zen_href_link(FILENAME_EMAIL_HISTORY) . '">' . '</a>' . zen_image(DIR_WS_IMAGES . HEADER_LOGO_IMAGE, HEADER_ALT_TEXT); ?></td>
  203.             <td class="pageHeading" align="right"><?php echo TEXT_EMAIL_NUMBER . $this_email->fields['archive_id']; ?></td>
  204.           </tr>
  205.         </table></td>
  206.       </tr>
  207.       <tr>
  208.         <td><?php echo zen_draw_separator('pixel_trans.gif', 1, 5); ?></td>
  209.       </tr>
  210.       <tr>
  211.         <td><table border="0" cellspacing="0" cellpadding="2">
  212.           <tr>
  213.             <td class="main"><b><?php echo TEXT_EMAIL_TO; ?></b></td>
  214.             <td class="main"><?php echo $this_email->fields['email_to_name'] . ' [' . $this_email->fields['email_to_address'] . ']'; ?></td>
  215.           </tr>
  216.           <tr>
  217.             <td class="main"><b><?php echo TEXT_EMAIL_FROM; ?></b></td>
  218.             <td class="main"><?php echo $this_email->fields['email_from_name'] . ' [' . $this_email->fields['email_from_address'] . ']'; ?></td>
  219.           </tr>
  220.           <tr>
  221.             <td class="main"><b><?php echo TEXT_EMAIL_DATE_SENT; ?></b></td>
  222.             <td class="main"><?php echo zen_datetime_short($this_email->fields['date_sent']); ?></td>
  223.           </tr>
  224.           <tr>
  225.             <td class="main"><b><?php echo TEXT_EMAIL_SUBJECT; ?></b></td>
  226.             <td class="main"><?php echo $this_email->fields['email_subject']; ?></td>
  227.           </tr>
  228.         </table></td>
  229.       </tr>
  230.       <tr>
  231.         <td colspan="2"><?php echo zen_draw_separator('pixel_trans.gif', 1, 5); ?></td>
  232.       </tr>
  233.       <tr>
  234.         <td colspan="2"><?php echo zen_draw_separator(); ?></td>
  235.       </tr>
  236.       <tr>
  237.         <td colspan="2"><?php echo zen_draw_separator('pixel_trans.gif', 1, 5); ?></td>
  238.       </tr>
  239.       <tr>
  240.         <td><table border="1" cellspacing="0" cellpadding="10">
  241.           <tr>
  242.             <td class="main" colspan="2"><?php
  243.               if ($action == 'prev_html') {
  244.                 echo $html_content;
  245.               }
  246.               else {
  247.                 echo nl2br($this_email->fields['email_text']);
  248.               }
  249.             ?></td>
  250.           </tr>
  251.         </table></td>
  252.       </tr>
  253. <?php
  254.       break;
  255.  
  256.       case 'trim':
  257. ?>
  258.       <tr>
  259.         <td class="pageHeading" align="left"><?php echo TEXT_TRIM_ARCHIVE; ?></td>
  260.         <td class="pageHeading" align="right"><?php echo zen_draw_separator('pixel_trans.gif', HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td>
  261.       </tr>
  262.       <tr>
  263.         <td class="main" align="left"><?php echo HEADING_TRIM_INSTRUCT; ?></td>
  264.       </tr>
  265.       <?php echo zen_draw_form('trim_timeframe', FILENAME_EMAIL_HISTORY, '', 'get'); ?>
  266.       <?php echo zen_draw_hidden_field('action', 'trim_confirm'); ?>
  267.       <tr>
  268.         <td><table border="0" cellspacing="0" cellpadding="2">
  269.           <tr>
  270.             <td class="main"><?php echo zen_draw_radio_field('email_age', '1_months', true) . RADIO_1_MONTH . ' (' . date("m/d/Y", mktime(0, 0, 0, date("m") - 1, date("d"), date("Y"))) . ')'; ?></td>
  271.           </tr>
  272.           <tr>
  273.             <td class="main"><?php echo zen_draw_radio_field('email_age', '6_months') . RADIO_6_MONTHS . ' (' . date("m/d/Y", mktime(0, 0, 0, date("m") - 6, date("d"), date("Y"))) . ')'; ?></td>
  274.           </tr>
  275.           <tr>
  276.             <td class="main"><?php echo zen_draw_radio_field('email_age', '1_year') . RADIO_1_YEAR . ' (' . date("m/d/Y", mktime(0, 0, 0, date("m"), date("d"), date("Y") - 1)) . ')'; ?></td>
  277.           </tr>
  278.         </table></td>
  279.       </tr>
  280.       <tr>
  281.         <td><?php echo zen_draw_separator('pixel_trans.gif', 1, 5); ?></td>
  282.       </tr>
  283.       <tr>
  284.         <td><table border="0" cellspacing="0" cellpadding="5">
  285.           <tr class="warningBox">
  286.             <td class="warningText" align="middle" colspan="2">
  287.               <?php echo TRIM_CONFIRM_WARNING; ?>
  288.               <p><input type="submit" value="<?php echo BUTTON_TRIM_CONFIRM; ?>">
  289.               <input type="button" value="<?php echo BUTTON_CANCEL; ?>" onClick="<?php echo 'window.location.href=\'' . zen_href_link(FILENAME_EMAIL_HISTORY) . '\''; ?>">
  290.             </td>
  291.           </tr>
  292.         </table></td>
  293.       </tr></form>
  294. <?php
  295.       break;
  296.  
  297.       default:
  298. ?>
  299.     <td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="0">
  300.     <?php if (!$isForDisplay) { ?>
  301.       <tr>
  302.         <td><?php echo '<a href="' . zen_href_link(FILENAME_EMAIL_HISTORY, 'action=' . $action) . '"><span class="pageHeading">' .  HEADING_TITLE . '</span></a>'; ?></td>
  303.         <td class="pageHeading" align="right"><?php echo date('l M d, Y', time()); ?></td>
  304.       </tr>
  305.       <tr>
  306.         <td class="pageHeading"><?php echo $this_report; ?><br>&nbsp;</td>
  307.       </tr>
  308.     <?php } else { ?>
  309.       <tr>
  310.         <td class="pageHeading" align="left"><?php echo HEADING_TITLE; ?></td>
  311.         <td class="pageHeading" align="right"><?php echo
  312.         zen_draw_separator('pixel_trans.gif', HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td>
  313.       </tr>
  314.       <tr>
  315.         <td class="main" align="left"><?php echo HEADING_SEARCH_INSTRUCT; ?></td>
  316.         <td align="right"><?php echo '<a href="' . zen_href_link(FILENAME_EMAIL_HISTORY, 'action=trim') . '">' . TEXT_TRIM_ARCHIVE . '</a>'; ?></td>
  317.       </tr>
  318.       <tr>
  319.         <td colspan="2"><table border="0" width="100%" cellspacing="0" cellpadding="2">
  320.           <?php echo zen_draw_form('search', FILENAME_EMAIL_HISTORY, '', 'get'); ?>
  321.           <tr>
  322.             <td><table border="0" cellspacing="0" cellpadding="0">
  323.               <tr>
  324.                 <td class="smallText" align="left">
  325.                   <?php echo HEADING_START_DATE . '<br>'; ?>
  326.                   <script language="javascript">StartDate.writeControl(); StartDate.dateFormat="<?php echo DATE_FORMAT_SPIFFYCAL; ?>";</script>
  327.                 </td>
  328.               </tr>
  329.               <tr>
  330.                 <td class="smallText" align="left">
  331.                   <?php echo HEADING_END_DATE . '<br>'; ?>
  332.                   <script language="javascript">EndDate.writeControl(); EndDate.dateFormat="<?php echo DATE_FORMAT_SPIFFYCAL; ?>";</script>
  333.                 </td>
  334.               </tr>
  335.             </table></td>
  336.             <td><table border="0" cellspacing="0" cellpadding="0">
  337.               <tr>
  338.                 <td class="smallText" valign="top"><?php
  339.                   echo HEADING_SEARCH_TEXT . '<br>';
  340.                   echo zen_draw_input_field('text');
  341.                   if (isset($_GET['text']) && zen_not_null($_GET['text'])) {
  342.                     $keywords = zen_db_input(zen_db_prepare_input($_GET['text']));
  343.                     echo '<br>' . HEADING_SEARCH_TEXT_FILTER . $keywords;
  344.                   }
  345.                 ?></td>
  346.               </tr>
  347.               <tr>
  348.                 <td class="smallText" valign="top"><?php
  349.                   echo HEADING_MODULE_SELECT . '<br>';
  350.                   echo zen_draw_pull_down_menu('module', $email_module_array, $_GET['module']);
  351.                 ?></td>
  352.               </tr>
  353.             </table></td>
  354.             <td><table border="0" cellspacing="0" cellpadding="2">
  355.               <tr>
  356.                 <td class="smallText"><?php echo zen_draw_checkbox_field('print_format', 1) . HEADING_PRINT_FORMAT; ?></td>
  357.               </tr>
  358.               <tr>
  359.                 <td><?php echo zen_draw_separator('pixel_trans.gif', 1, 5); ?></td>
  360.               </tr>
  361.               <tr>
  362.                 <td class="main" valign="bottom"><input type="submit" value="<?php echo BUTTON_SEARCH; ?>"></td>
  363.               </tr>
  364.             </table></td>
  365.           </tr></form>
  366.         </table></td>
  367.       </tr>
  368.     <?php } ?>
  369.     </table></td>
  370.   </tr>
  371.   <tr>
  372.     <td><table border="0" width="100%" cellspacing="0" cellpadding="0">
  373.       <tr>
  374.         <td valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2">
  375.           <tr class="dataTableHeadingRow">
  376.             <td class="dataTableHeadingContent" align="left"><?php echo TABLE_HEADING_EMAIL_DATE; ?></td>
  377.             <td class="dataTableHeadingContent" align="left"><?php echo TABLE_HEADING_CUSTOMERS_NAME; ?></td>
  378.             <td class="dataTableHeadingContent" align="left"><?php echo TABLE_HEADING_CUSTOMERS_EMAIL; ?></td>
  379.             <td class="dataTableHeadingContent" align="left"><?php echo TABLE_HEADING_EMAIL_SUBJECT; ?></td>
  380.             <td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_EMAIL_FORMAT; ?></td>
  381.           </tr>
  382. <?php
  383.   // build search query
  384.  
  385.   $archive_search = "select * from " . TABLE_EMAIL_ARCHIVE . " ";
  386.   if ($search_sd || $search_ed || $search_text || $search_module) {
  387.     $archive_search .= " where ";
  388.   }
  389.  
  390.   if ($search_sd) $archive_search .= "date_sent >= '" . $sd_raw . "' ";
  391.  
  392.   if ($search_ed) {
  393.     if ($search_sd) $archive_search .= "and ";
  394.     $archive_search .= "date_sent <= DATE_ADD('" . $ed_raw . "', INTERVAL 1 DAY) ";
  395.   }
  396.  
  397.   if ($search_text) {
  398.     if ($search_sd || $search_ed) $archive_search .= "and ";
  399.  
  400.     $keywords = zen_db_input(zen_db_prepare_input($_GET['text']));
  401.     $archive_search .= "(email_to_address like '%" . $keywords . "%' or email_subject like '%" . $keywords . "%' or email_html like '%" . $keywords . "%' or email_text like '%" . $keywords . "%' or email_to_name like '%" . $keywords . "%') ";
  402.   }
  403.  
  404.   if ($search_module) {
  405.     if ($search_sd || $search_ed || $search_text) {
  406.       $archive_search .= "and ";
  407.     }
  408.     $archive_search .= "module = '" . $_GET['module'] . "' ";
  409.   }
  410.  
  411.   $archive_search .= "order by archive_id desc";
  412.  
  413.   $email_split = new splitPageResults($_GET['page'], MAX_DISPLAY_SEARCH_RESULTS_ORDERS, $archive_search, $email_query_numrows);
  414.  
  415.   // DEBUG
  416.   //echo '<br>' . $archive_search . '<br>';
  417.   $email_archive = $db->Execute($archive_search);
  418.  
  419.   while (!$email_archive->EOF) {
  420.  
  421.     if ((!isset($_GET['archive_id']) || (isset($_GET['archive_id']) && ($_GET['archive_id'] == $email_archive->fields['archive_id']))) && !isset($archive)) {
  422.         $archive = new objectInfo($email_archive->fields);
  423.       }
  424.  
  425.       if (isset($archive) && is_object($archive) && ($email_archive->fields['archive_id'] == $archive->archive_id) && $isForDisplay) {
  426.         echo '          <tr id="defaultSelected" class="dataTableRowSelected" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="document.location.href=\'' . zen_href_link(FILENAME_EMAIL_HISTORY, zen_get_all_get_params(array('archive_id', 'action')) . 'archive_id=' . $archive->archive_id . '&action=view', 'NONSSL') . '\'">' . "\n";
  427.       } else {
  428.         echo '          <tr class="dataTableRow" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="document.location.href=\'' . zen_href_link(FILENAME_EMAIL_HISTORY, zen_get_all_get_params(array('archive_id')) . 'archive_id=' . $email_archive->fields['archive_id'], 'NONSSL') . '\'">' . "\n";
  429.       }
  430.  
  431. ?>
  432.             <td class="dataTableContent" align="left"><?php echo zen_datetime_short($email_archive->fields['date_sent']); ?></td>
  433.             <td class="dataTableContent" align="left"><?php echo $email_archive->fields['email_to_name']; ?></td>
  434.             <td class="dataTableContent" align="left"><?php echo $email_archive->fields['email_to_address']; ?></td>
  435.             <td class="dataTableContent" align="left"><?php echo substr($email_archive->fields['email_subject'], 0, SUBJECT_SIZE_LIMIT) . MESSAGE_LIMIT_BREAK; ?></td>
  436.             <td class="dataTableContent" align="right"><?php
  437.               if (isset($archive) && is_object($archive) && ($email_archive->fields['archive_id'] == $archive->archive_id) && $isForDisplay) {
  438.                 echo zen_image(DIR_WS_IMAGES . 'icon_arrow_right.gif', '');
  439.               }
  440.               else {
  441.                 if ($email_archive->fields['email_html'] != '') {
  442.                   echo TABLE_FORMAT_HTML;
  443.                 }
  444.                 else {
  445.                   echo TABLE_FORMAT_TEXT;
  446.                 }
  447.               }
  448.             ?></td>
  449.           </tr>
  450. <?php
  451.     $email_archive->MoveNext();
  452.   }
  453. ?>
  454.           <tr>
  455.             <td class="smallText" colspan="3" valign="top"><?php echo $email_split->display_count($email_query_numrows, MAX_DISPLAY_SEARCH_RESULTS_ORDERS, $_GET['page'], TEXT_DISPLAY_NUMBER_OF_EMAILS); ?></td>
  456.             <td class="smallText" colspan="4" align="right"><?php echo $email_split->display_links($email_query_numrows, MAX_DISPLAY_SEARCH_RESULTS_ORDERS, MAX_DISPLAY_PAGE_LINKS, $_GET['page'], zen_get_all_get_params(array('archive_id', 'page'))); ?></td>
  457.           </tr>
  458.         </table></td>
  459. <?php
  460.   // create sidebox
  461.   $heading = array();
  462.   $contents = array();
  463.  
  464.   if (isset($archive) && is_object($archive)) {
  465.  
  466.     // get the customer ID
  467.     $customer = $db->Execute("select customers_id from " . TABLE_CUSTOMERS . "
  468.                              where customers_email_address like '" . $archive->email_to_address . "'");
  469.     if ($customer->RecordCount() == 1) {
  470.       $mail_button = '<a href="' . zen_href_link(FILENAME_MAIL, 'origin=' . FILENAME_EMAIL_HISTORY . '&mode=NONSSL&selected_box=tools&customer=' . $archive->email_to_address . '&cID=' . $customer->fields['customers_id'], 'NONSSL') . '">' . zen_image_button('button_email.gif', IMAGE_EMAIL) . '</a>';
  471.     }
  472.     else {
  473.       $mail_button = '<a href="mailto:' . $archive->email_to_address . '">' . zen_image_button('button_email.gif', IMAGE_EMAIL) . '</a>';
  474.     }
  475.  
  476.     $heading[] = array('text' => '<b>' . TEXT_ARCHIVE_ID . $archive->archive_id . '&nbsp; - &nbsp;' . zen_datetime_short($archive->date_sent) . '</b>');
  477.     $contents[] = array('align' => 'center', 'text' => $mail_button . '&nbsp;<a href="' . zen_href_link(FILENAME_EMAIL_HISTORY, 'archive_id=' . $archive->archive_id . '&action=resend_confirm') . '">' . zen_image_button('button_resend.gif', IMAGE_ICON_RESEND) . '</a>');
  478.     // Delete button
  479.     $contents[] = array('align' => 'center', 'text' => '<a href="' . zen_href_link(FILENAME_EMAIL_HISTORY, 'archive_id=' . $archive->archive_id . '&action=delete_confirm') . '">' . zen_image_button('button_delete.gif', IMAGE_ICON_DELETE) . '</a>' . $html_button);
  480.     $contents[] = array('align' => 'center', 'text' => '<a href="' . zen_href_link(FILENAME_EMAIL_HISTORY, 'archive_id=' . $archive->archive_id . '&action=prev_text') . '" TARGET="_blank">' . zen_image_button('button_prev_text.gif', IMAGE_ICON_TEXT) . '</a>' . $html_button);
  481.     if ($archive->email_html != '') {
  482.       $contents[] = array('align' => 'center', 'text' => '<a href="' . zen_href_link(FILENAME_EMAIL_HISTORY, 'archive_id=' . $archive->archive_id . '&action=prev_html') . '" TARGET="_blank">' . zen_image_button('button_prev_html.gif', IMAGE_ICON_HTML) . '</a>');
  483.     }
  484.     $contents[] = array('text' => '<br>' . zen_draw_separator());
  485.     $contents[] = array('text' => '<br><b>' . TEXT_EMAIL_MODULE . '</b>'. $archive->module);
  486.     $contents[] = array('text' => '<br><b>' . TEXT_EMAIL_TO . '</b>'. $archive->email_to_name . ' [' . $archive->email_to_address . ']');
  487.     $contents[] = array('text' => '<b>' . TEXT_EMAIL_FROM . '</b>' . $archive->email_from_name . ' [' . $archive->email_from_address . ']');
  488.     $contents[] = array('text' => '<b>' . TEXT_EMAIL_DATE_SENT . '</b>' . $archive->date_sent);
  489.     $contents[] = array('text' => '<b>' . TEXT_EMAIL_SUBJECT . '</b>' . $archive->email_subject);
  490.     $contents[] = array('text' => '<br><b>' . TEXT_EMAIL_EXCERPT . '</b>');
  491.     $contents[] = array('text' => '<br>' . nl2br(substr($archive->email_text, 0, MESSAGE_SIZE_LIMIT)) . MESSAGE_LIMIT_BREAK);
  492.   }
  493.  
  494.   // display sidebox
  495.   if (zen_not_null($heading) && zen_not_null($contents) && $isForDisplay) {
  496. ?>
  497.         <td width="25%" valign="top"><table border="0" cellspacing="0" cellpadding="0" width="100%" valign="top">
  498.           <tr>
  499.             <td colspan="2" valign="top">
  500. <?php
  501.               $box = new box;
  502.               echo $box->infoBox($heading, $contents);
  503. ?>
  504.             </td>
  505.           </tr>
  506.         </table></td>
  507. <?php } ?>
  508.  
  509.       </tr>
  510.     </table></td>
  511.   </tr>
  512. </table></td>
  513. <?php
  514. break;
  515. }
  516. ?>
  517. </tr></table>
  518. <?php
  519. if ($isForDisplay) {
  520.   require(DIR_WS_INCLUDES . 'footer.php');
  521.  
  522.   if ($action == 'resend_confirm') {
  523. ?>
  524. <script language="javascript">
  525.   confirmation()
  526. </script>
  527. <?php
  528.   } else if ($action == 'delete_confirm') {
  529. ?>
  530. <script language="javascript">
  531.   del_confirmation()
  532. </script>
  533. <?php
  534.   }
  535. }
  536. ?>
  537. </body>
  538. </html>
  539. <?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>
  540.  


cron