コード例 #1
0
ファイル: posting_admin.php プロジェクト: spas-viktor/books
                    ?>
?lang=<?php 
                    echo LANGUAGE_ID;
                    ?>
', MoveProgress());
					</script><?php 
                }
            } else {
                CAdminMessage::ShowMessage($cPosting->LAST_ERROR);
            }
        } elseif ($arPosting["STATUS"] == "P") {
            if ($arPosting["AUTO_SEND_TIME"] != "") {
                //Wait for agent
            } else {
                $cPosting = new CPosting();
                if ($cPosting->SendMessage($ID, COption::GetOptionString("subscribe", "posting_interval")) !== false) {
                    $arEmailStatuses = CPosting::GetEmailStatuses($ID);
                    $nEmailsSent = intval($arEmailStatuses["N"]);
                    $nEmailsError = intval($arEmailStatuses["E"]);
                    $nEmailsTotal = intval($arEmailStatuses["Y"]) + $nEmailsSent + $nEmailsError;
                    CAdminMessage::ShowMessage(array("DETAILS" => '<p>' . GetMessage("POST_ADM_SENDING_NOTE_LINE1") . '<br>' . GetMessage("POST_ADM_SENDING_NOTE_LINE2") . '</p>' . '#PROGRESS_BAR#' . '<p>' . GetMessage("posting_addr_processed") . ' <b>' . ($nEmailsSent + $nEmailsError) . '</b> ' . GetMessage("posting_addr_of") . ' <b>' . $nEmailsTotal . '</b></p>' . '<p>' . GetMessage("POST_ADM_WITH_ERRORS") . ': <b>' . $nEmailsError . '</b>.</p>', "HTML" => true, "TYPE" => "PROGRESS", "PROGRESS_TOTAL" => $nEmailsTotal, "PROGRESS_VALUE" => $nEmailsSent + $nEmailsError, "BUTTONS" => array(array("ID" => "btn_stop", "VALUE" => GetMessage("POST_ADM_BTN_STOP"), "ONCLICK" => "Stop()"), array("ID" => "btn_cont", "VALUE" => GetMessage("posting_continue_button"), "ONCLICK" => "Cont()"))));
                    ?>
<script>
						MoveProgress();
					</script><?php 
                } else {
                    CAdminMessage::ShowMessage($cPosting->LAST_ERROR);
                }
            }
        } elseif ($arPosting["STATUS"] == "S" || $arPosting["STATUS"] == "E") {
            $arEmailStatuses = CPosting::GetEmailStatuses($ID);
コード例 #2
0
ファイル: posting.php プロジェクト: k-kalashnikov/geekcon_new
 function AutoSend($ID = false, $limit = false, $site_id = false)
 {
     if ($ID === false) {
         //Here is cron job entry
         $cPosting = new CPosting();
         $rsPosts = $cPosting->GetList(array("AUTO_SEND_TIME" => "ASC", "ID" => "ASC"), array("STATUS_ID" => "P", "AUTO_SEND_TIME_2" => ConvertTimeStamp(false, "FULL")));
         while ($arPosts = $rsPosts->Fetch()) {
             if ($limit === true) {
                 $maxcount = COption::GetOptionInt("subscribe", "subscribe_max_emails_per_hit") - self::$current_emails_per_hit;
                 if ($maxcount <= 0) {
                     break;
                 }
             } else {
                 $maxcount = 0;
             }
             $cPosting->SendMessage($arPosts["ID"], 0, $maxcount);
         }
     } else {
         if ($site_id && $site_id != SITE_ID) {
             return "CPosting::AutoSend(" . $ID . ($limit ? ",true" : ",false") . ",\"" . $site_id . "\");";
         }
         //Here is agent entry
         if ($limit === true) {
             $maxcount = COption::GetOptionInt("subscribe", "subscribe_max_emails_per_hit") - self::$current_emails_per_hit;
             if ($maxcount <= 0) {
                 return "CPosting::AutoSend(" . $ID . ",true" . ($site_id ? ",\"" . $site_id . "\"" : "") . ");";
             }
         } else {
             $maxcount = 0;
         }
         $cPosting = new CPosting();
         $res = $cPosting->SendMessage($ID, COption::GetOptionString("subscribe", "posting_interval"), $maxcount, true);
         if ($res == "CONTINUE") {
             return "CPosting::AutoSend(" . $ID . ($limit ? ",true" : ",false") . ($site_id ? ",\"" . $site_id . "\"" : "") . ");";
         }
     }
     return "";
 }