Esempio n. 1
0
 function InstallDB($arParams = array())
 {
     global $DB, $DBType, $APPLICATION;
     $this->errors = false;
     // Database tables creation
     if (!$DB->Query("SELECT 'x' FROM b_sender_contact WHERE 1=0", true)) {
         $this->errors = $DB->RunSQLBatch($_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/sender/install/db/" . $DBType . "/install.sql");
     }
     if ($this->errors !== false) {
         $APPLICATION->ThrowException(implode("<br>", $this->errors));
         return false;
     } else {
         RegisterModule("sender");
         CModule::IncludeModule("sender");
         // read and click notifications
         RegisterModuleDependences("main", "OnMailEventMailRead", "sender", "bitrix\\sender\\postingmanager", "onMailEventMailRead");
         RegisterModuleDependences("main", "OnMailEventMailClick", "sender", "bitrix\\sender\\postingmanager", "onMailEventMailClick");
         // unsubscription notifications
         RegisterModuleDependences("main", "OnMailEventSubscriptionDisable", "sender", "Bitrix\\Sender\\Subscription", "onMailEventSubscriptionDisable");
         RegisterModuleDependences("main", "OnMailEventSubscriptionEnable", "sender", "Bitrix\\Sender\\Subscription", "onMailEventSubscriptionEnable");
         RegisterModuleDependences("main", "OnMailEventSubscriptionList", "sender", "Bitrix\\Sender\\Subscription", "onMailEventSubscriptionList");
         // connectors of module sender
         RegisterModuleDependences("sender", "OnConnectorList", "sender", "bitrix\\sender\\connectormanager", "onConnectorListContact");
         RegisterModuleDependences("sender", "OnConnectorList", "sender", "bitrix\\sender\\connectormanager", "onConnectorListRecipient");
         // mail templates and blocks
         RegisterModuleDependences("sender", "OnPresetTemplateList", "sender", "Bitrix\\Sender\\Preset\\TemplateBase", "onPresetTemplateList");
         RegisterModuleDependences("sender", "OnPresetTemplateList", "sender", "Bitrix\\Sender\\TemplateTable", "onPresetTemplateList");
         RegisterModuleDependences("sender", "OnPresetMailBlockList", "sender", "Bitrix\\Sender\\Preset\\MailBlockBase", "OnPresetMailBlockList");
         CTimeZone::Disable();
         \Bitrix\Sender\MailingManager::actualizeAgent();
         CAgent::AddAgent(\Bitrix\Sender\MailingManager::getAgentNamePeriod(), "sender", "N", COption::GetOptionString("sender", "reiterate_interval"));
         CTimeZone::Enable();
         return true;
     }
 }
Esempio n. 2
0
 /**
  * @param Entity\Event $event
  * @return Entity\EventResult
  */
 public static function onAfterUpdate(Entity\Event $event)
 {
     $result = new Entity\EventResult();
     $data = $event->getParameters();
     if (array_key_exists('ACTIVE', $data['fields'])) {
         MailingManager::actualizeAgent($data['primary']['ID']);
     }
     if (array_key_exists('ACTIVE', $data['fields']) || array_key_exists('TRIGGER_FIELDS', $data['fields'])) {
         static::updateChainTrigger($data['primary']['ID']);
     }
     if (!empty($data['fields']['EMAIL_FROM'])) {
         $chainListDb = MailingChainTable::getList(array('select' => array('ID'), 'filter' => array('=MAILING_ID' => $data['primary']['ID'], '=IS_TRIGGER' => 'Y', '=MAILING.IS_TRIGGER' => 'Y')));
         while ($chain = $chainListDb->fetch()) {
             MailingChainTable::update(array('ID' => $chain['ID']), array('EMAIL_FROM' => $data['fields']['EMAIL_FROM']));
         }
     }
     return $result;
 }
Esempio n. 3
0
 /**
  * @param Entity\Event $event
  * @return Entity\EventResult
  */
 public static function onAfterUpdate(Entity\Event $event)
 {
     $result = new Entity\EventResult();
     $data = $event->getParameters();
     if (array_key_exists('STATUS', $data['fields']) || array_key_exists('AUTO_SEND_TIME', $data['fields'])) {
         if (array_key_exists('STATUS', $data['fields']) && $data['fields']['STATUS'] == static::STATUS_NEW) {
             static::initPosting($data['primary']['ID']);
         }
         MailingManager::actualizeAgent(null, $data['primary']['ID']);
     }
     if (isset($data['fields']['PARENT_ID'])) {
         TriggerManager::actualizeHandlerForChild();
     }
     return $result;
 }
     }
 } else {
     switch ($arMailingChain["STATUS"]) {
         case MailingChainTable::STATUS_NEW:
             $messageDetails = '<br><p>' . GetMessage("MAILING_ADM_SENDING_NOTE_LINE1") . '<br>' . GetMessage("MAILING_ADM_SENDING_NOTE_LINE2") . '</p>';
             $message = array("MESSAGE" => GetMessage("MAILING_ADM_SENDING_SEND"), "BUTTONS" => array(array("ID" => "btn_stop", "VALUE" => GetMessage("MAILING_ADM_BTN_STOP"), "ONCLICK" => "Stop()"), array("ID" => "btn_cont", "VALUE" => GetMessage("MAILING_ADM_BTN_CONT"), "ONCLICK" => "Cont()")));
             MailingChainTable::initPosting($mailingChainId);
             MailingChainTable::update($mailingChainPrimary, array('STATUS' => MailingChainTable::STATUS_SEND));
             $actionJsList = true;
             $actionJsMoveProgress = true;
             break;
         case MailingChainTable::STATUS_SEND:
             \Bitrix\Main\Application::getInstance()->getConnection()->startTransaction();
             \Bitrix\Sender\MailingManager::chainSend($mailingChainId);
             \Bitrix\Main\Application::getInstance()->getConnection()->commitTransaction();
             $sendErrors = \Bitrix\Sender\MailingManager::getErrors();
             if (empty($sendErrors)) {
                 $messageDetails = '<br><p>' . GetMessage("MAILING_ADM_SENDING_NOTE_LINE1") . '<br>' . GetMessage("MAILING_ADM_SENDING_NOTE_LINE2") . '</p>';
                 $message = array("MESSAGE" => GetMessage("MAILING_ADM_SENDING_SEND"), "BUTTONS" => array(array("ID" => "btn_stop", "VALUE" => GetMessage("MAILING_ADM_BTN_STOP"), "ONCLICK" => "Stop()"), array("ID" => "btn_cont", "VALUE" => GetMessage("MAILING_ADM_BTN_CONT"), "ONCLICK" => "Cont()")));
                 $actionJsMoveProgress = true;
             } else {
                 $message = $sendErrors->getMessage();
             }
             break;
         case MailingChainTable::STATUS_PAUSE:
             $message = array("MESSAGE" => GetMessage("MAILING_ADM_SENDING_PAUSE"), "BUTTONS" => array(array("ID" => "btn_stop", "VALUE" => GetMessage("MAILING_ADM_BTN_STOP"), "ONCLICK" => "Stop()"), array("ID" => "btn_cont", "VALUE" => GetMessage("MAILING_ADM_BTN_CONT"), "ONCLICK" => "Cont()")));
             $actionJs = 'list';
             break;
         case MailingChainTable::STATUS_END:
             $message = array("MESSAGE" => GetMessage("MAILING_ADM_SENDING_RESULT_OK"));
             $actionJsList = true;
Esempio n. 5
0
                     }
                 }
             } else {
                 $val = ${$name};
             }
             if ($arOption[2][0] == "checkbox" && $val != "Y") {
                 $val = "N";
             }
             COption::SetOptionString($module_id, $name, $val);
         }
     }
     CModule::IncludeModule('sender');
     \Bitrix\Sender\MailingManager::actualizeAgent();
     CAgent::RemoveAgent(\Bitrix\Sender\MailingManager::getAgentNamePeriod(), "sender");
     if (COption::GetOptionString("sender", "reiterate_method") !== "cron") {
         CAgent::AddAgent(\Bitrix\Sender\MailingManager::getAgentNamePeriod(), "sender", "N", COption::GetOptionString("sender", "reiterate_interval"));
     }
     $Update = $Update . $Apply;
     ob_start();
     require_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/admin/group_rights.php";
     ob_end_clean();
     if (strlen($_REQUEST["back_url_settings"]) > 0) {
         if (strlen($Apply) > 0 || strlen($RestoreDefaults) > 0) {
             LocalRedirect($APPLICATION->GetCurPage() . "?mid=" . urlencode($module_id) . "&lang=" . urlencode(LANGUAGE_ID) . "&back_url_settings=" . urlencode($_REQUEST["back_url_settings"]) . "&" . $tabControl->ActiveTabParam());
         } else {
             LocalRedirect($_REQUEST["back_url_settings"]);
         }
     } else {
         LocalRedirect($APPLICATION->GetCurPage() . "?mid=" . urlencode($module_id) . "&lang=" . urlencode(LANGUAGE_ID) . "&" . $tabControl->ActiveTabParam());
     }
 }
Esempio n. 6
0
<?php

$_SERVER["DOCUMENT_ROOT"] = realpath(dirname(__FILE__) . "/../../../..");
$DOCUMENT_ROOT = $_SERVER["DOCUMENT_ROOT"];
define("NO_KEEP_STATISTIC", true);
define("NOT_CHECK_PERMISSIONS", true);
define("BX_CRONTAB", true);
define('BX_NO_ACCELERATOR_RESET', true);
require $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/prolog_before.php";
@set_time_limit(0);
@ignore_user_abort(true);
CEvent::CheckEvents();
if (CModule::IncludeModule('sender')) {
    \Bitrix\Sender\MailingManager::checkPeriod(false);
    \Bitrix\Sender\MailingManager::checkSend();
}
require $_SERVER['DOCUMENT_ROOT'] . "/bitrix/modules/main/tools/backup.php";