예제 #1
0
                $DB->Commit();
                break;
            case "stop":
                $cPosting = new CPosting();
                $cPosting->ChangeStatus($ID, "W");
                $rsAgents = CAgent::GetList(array("ID" => "DESC"), array("MODULE_ID" => "subscribe", "NAME" => "CPosting::AutoSend(" . $ID . ",%"));
                while ($arAgent = $rsAgents->Fetch()) {
                    CAgent::Delete($arAgent["ID"]);
                }
                break;
        }
    }
}
$lAdmin->AddHeaders(array(array("id" => "ID", "content" => "ID", "sort" => "id", "align" => "right", "default" => true), array("id" => "TIMESTAMP_X", "content" => GetMessage("post_updated"), "sort" => "timestamp", "default" => true), array("id" => "SUBJECT", "content" => GetMessage("post_subj"), "sort" => "subject", "default" => true), array("id" => "BODY_TYPE", "content" => GetMessage("post_body_type"), "sort" => "body_type", "default" => true), array("id" => "STATUS", "content" => GetMessage("post_stat"), "sort" => "status", "default" => true), array("id" => "DATE_SENT", "content" => GetMessage("post_sent"), "sort" => "date_sent", "default" => true), array("id" => "SENT_TO", "content" => GetMessage("post_report"), "sort" => false, "default" => false), array("id" => "FROM_FIELD", "content" => GetMessage("post_from"), "sort" => "from_field", "default" => false), array("id" => "TO_FIELD", "content" => GetMessage("post_to"), "sort" => "to_field", "default" => false)));
$cData = new CPosting();
$rsData = $cData->GetList(array($by => $order), $arFilter);
$rsData = new CAdminResult($rsData, $sTableID);
$rsData->NavStart();
$lAdmin->NavText($rsData->GetNavPrint(GetMessage("post_nav")));
while ($arRes = $rsData->NavNext(true, "f_")) {
    $row =& $lAdmin->AddRow($f_ID, $arRes);
    $row->AddViewField("SUBJECT", '<a href="posting_edit.php?ID=' . $f_ID . '&amp;lang=' . LANG . '" title="' . GetMessage("post_act_edit") . '">' . $f_SUBJECT . '</a>');
    $row->AddInputField("SUBJECT", array("size" => 20));
    $row->AddSelectField("BODY_TYPE", array("text" => GetMessage("POST_TEXT"), "html" => GetMessage("POST_HTML")));
    $strStatus = "";
    switch ($f_STATUS) {
        case "S":
            $strStatus = '[S] ' . GetMessage("POST_STATUS_SENT");
            break;
        case "P":
            $strStatus = '[P] ' . GetMessage("POST_STATUS_PART");
예제 #2
0
 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 "";
 }