function SaveStatusToDB($i) { global $messageid; if ($i % 10 != 0) { return; } $count = $_REQUEST['startLimit'] + $i; $conn = dbConnect(); $body = mysql_real_escape_string($_REQUEST['titleEmail'], $conn); mysql_query("UPDATE fb_messages SET count={$count} WHERE id={$messageid}", $conn); echo mysql_error($conn); mysql_close($conn); PrintStatus($i); }
function PageCodeMassmailer() { global $sActionResult, $action; return array('page_code_status' => PrintStatus($sActionResult), 'page_code_new_message' => getEmailMessage($action), 'page_code_preview_message' => $action == 'preview' && $_POST['body'] ? PreviewMessage() : '', 'page_code_all_messages' => getAllMessagesBox(), 'page_code_queue_message' => getQueueMessage()); }
} } if (!$demo_mode && $action == 'empty') { if (EmptyQueue()) { $action_result .= "Queue empty.<br>"; } else { $action_result .= "Queue emptying failed.<br>"; } } if (!$demo_mode && $action == 'queue' && $_POST['msgs_id']) { $action_result .= QueueMessage(); } if (strlen($action_result)) { echo "<br><center><div class=\"err\">{$action_result}</div></center><br>\n"; } PrintStatus(); // Print combobox with all messages ?> <form name="form_messages" method="POST" action="<?php echo $_SERVER['PHP_SELF']; ?> "> <input type="hidden" name="action" value="view"> <center class="text">Messages: <select name=msgs_id onChange="javascript: document.forms['form_messages'].submit();"> <option value=0>NONE</option> <?php $res_msgs = db_res("SELECT `ID`, `Subj`, `Text`, `HTML`, (`ID` = " . (int) $_POST['msgs_id'] . " OR `Subj` = '" . process_db_input($_POST['subj']) . "' ) AS `Selected` FROM `NotifyMsgs`"); while ($arr_msgs = mysql_fetch_array($res_msgs)) { $sel = $arr_msgs['Selected'] ? "selected" : ""; echo "\n\t\t\t\t<option value=\"{$arr_msgs['ID']}\" {$sel}>{$arr_msgs['Subj']}</option>";
} if ($_POST['add_message']) { $action = 'add'; } if ($_POST['delete_message'] && $_POST['msgs_id']) { $sActionResult = DeleteMessage() ? _t('_adm_mmail_Message_was_deleted') : _t('_adm_mmail_Message_was_not_deleted'); } if ($_POST['preview_message'] && $_POST['msgs_id']) { $action = 'preview'; } if (bx_get('action') == 'empty') { $sActionResult = EmptyQueue() ? _t('_adm_mmail_Queue_empty') : _t('_adm_mmail_Queue_emptying_failed'); } $iNameIndex = 13; $_page = array('name_index' => $iNameIndex, 'css_name' => array('forms_adv.css'), 'header' => _t('_adm_mmail_title')); $_page_cont[$iNameIndex] = array('page_code_status' => PrintStatus($sActionResult), 'page_code_new_message' => getEmailMessage($action), 'page_code_preview_message' => $action == 'preview' && strlen($_POST['body']) ? PreviewMessage() : '', 'page_code_all_messages' => getAllMessagesBox(), 'page_code_queue_message' => getQueueMessage()); PageCodeAdmin(); function PrintStatus($sActionResult) { $sSubjC = _t('_Subject'); $sEmailsC = _t('_adm_mmail_emails'); $sEmptyQueueC = _t('_adm_mmail_Empty_Queue'); $sCupidStatusC = _t('_adm_mmail_Cupid_mails_status'); $sSingleEmailsTRs = ''; // Select count of emails in queue per one message $iCount = (int) $GLOBALS['MySQL']->getOne("SELECT COUNT(`id`) AS `count` FROM `sys_sbs_queue`"); if ($iCount <= 0) { $sSingleEmailsTRs .= "<tr><td align=center><b><font color=red>" . _t('_adm_mmail_no_emails_in_queue') . "</font></b></td></tr>"; } else { $sSingleEmailsTRs .= "<tr><td align=center>" . _t('_adm_mmail_mails_in_queue', $iCount) . "</td></tr>"; }