예제 #1
0
	public static function CheckExpireAgent()
	{
		global $DB;
		if (!CPullOptions::ModuleEnable())
			return false;

		CAgent::RemoveAgent("CPullWatch::CheckExpireAgent();", "pull");

		$strSql = "SELECT count(ID) CNT FROM b_pull_watch WHERE DATE_CREATE < DATE_SUB(NOW(), INTERVAL 30 MINUTE)";
		$dbRes = $DB->Query($strSql, false, "File: ".__FILE__."<br>Line: ".__LINE__);
		if ($arRes = $dbRes->Fetch())
		{
			$strSql = "DELETE FROM b_pull_watch WHERE DATE_CREATE < DATE_SUB(NOW(), INTERVAL 30 MINUTE) LIMIT 1000";
			$DB->Query($strSql, false, "File: ".__FILE__."<br>Line: ".__LINE__);

			if ($arRes['CNT'] > 1000)
			{
				CAgent::AddAgent("CPullWatch::CheckExpireAgent();", "pull", "N", 180, "", "Y", ConvertTimeStamp(time()+CTimeZone::GetOffset()+180, "FULL"));
				return false;
			}
		}

		CAgent::AddAgent("CPullWatch::CheckExpireAgent();", "pull", "N", 600, "", "Y", ConvertTimeStamp(time()+CTimeZone::GetOffset()+600, "FULL"));
		return false;
	}
예제 #2
0
파일: index.php 프로젝트: spas-viktor/books
 function InstallDB($arParams = array())
 {
     global $DB, $DBType, $APPLICATION;
     $this->errors = false;
     // Database tables creation
     if (!$DB->Query("SELECT 'x' FROM b_sec_iprule WHERE 1=0", true)) {
         $this->errors = $DB->RunSQLBatch($_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/security/install/db/" . strtolower($DB->type) . "/install.sql");
     }
     if ($this->errors !== false) {
         $APPLICATION->ThrowException(implode("<br>", $this->errors));
         return false;
     } else {
         $this->InstallTasks();
         RegisterModule("security");
         RegisterModuleDependences("main", "OnUserDelete", "security", "CSecurityUser", "OnUserDelete");
         RegisterModuleDependences("main", "OnEventLogGetAuditTypes", "security", "CSecurityFilter", "GetAuditTypes");
         RegisterModuleDependences("main", "OnEventLogGetAuditTypes", "security", "CSecurityAntiVirus", "GetAuditTypes");
         RegisterModuleDependences("main", "OnAdminInformerInsertItems", "security", "CSecurityFilter", "OnAdminInformerInsertItems");
         RegisterModuleDependences("main", "OnAdminInformerInsertItems", "security", "CSecuritySiteChecker", "OnAdminInformerInsertItems");
         CModule::IncludeModule("security");
         //agents
         CAgent::RemoveAgent("CSecuritySession::CleanUpAgent();", "security");
         CAgent::Add(array("NAME" => "CSecuritySession::CleanUpAgent();", "MODULE_ID" => "security", "ACTIVE" => "Y", "AGENT_INTERVAL" => 1800, "IS_PERIOD" => "N"));
         CAgent::RemoveAgent("CSecurityIPRule::CleanUpAgent();", "security");
         CAgent::Add(array("NAME" => "CSecurityIPRule::CleanUpAgent();", "MODULE_ID" => "security", "ACTIVE" => "Y", "AGENT_INTERVAL" => 3600, "IS_PERIOD" => "N"));
         if (!COption::GetOptionString("security", "ipcheck_disable_file")) {
             COption::SetOptionString("security", "ipcheck_disable_file", "/bitrix/modules/ipcheck_disable_" . md5(mt_rand()));
         }
         CAgent::RemoveAgent("CSecurityFilter::ClearTmpFiles();", "security");
         CSecurityFilter::SetActive(true);
         CSecurityAntiVirus::SetActive(true);
         return true;
     }
 }
예제 #3
0
 public static function AgentRun($profileID, $in_agent = "N")
 {
     global $DB;
     $agent_ID = 0;
     $pr = CProfileAdmin::GetByID($profileID)->Fetch();
     $datacheck = date("d.m.Y H:i:s", $pr["DATA_START"]);
     $agent_period = intval($pr["PERIOD"]);
     if ($agent_period <= 0) {
         $agent_period = 86400;
     }
     if ($profileID > 0) {
         if ($in_agent == "Y") {
             CAgent::RemoveAgent("CGM::ReturnXMLData(" . $profileID . ");", "acrit.googlemerchant");
         } else {
             $arAgent = CAgent::GetList(array(), array("NAME" => "CGM::ReturnXMLData(" . $profileID . ");"))->Fetch();
             if (!$arAgent) {
                 $agent_ID = CAgent::AddAgent("CGM::ReturnXMLData(" . $profileID . ");", "acrit.googlemerchant", "N", $agent_period, $datacheck, "Y", $datacheck, 100);
             } elseif ($arAgent) {
                 if ($arAgent['NEXT_EXEC'] > $datacheck) {
                     $datacheck = $arAgent['NEXT_EXEC'];
                 }
                 CAgent::Update($arAgent['ID'], array("AGENT_INTERVAL" => $agent_period, "ACTIVE" => "Y", "NEXT_EXEC" => $datacheck));
             }
         }
     }
     return $agent_ID;
 }
예제 #4
0
 function InstallDB($arParams = array())
 {
     global $DB, $DBType, $APPLICATION;
     $this->errors = false;
     // Database tables creation
     if (!$DB->Query("SELECT 'x' FROM b_list_rubric WHERE 1=0", true)) {
         $this->errors = $DB->RunSQLBatch($_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/subscribe/install/db/" . $DBType . "/install.sql");
     }
     if ($this->errors !== false) {
         $APPLICATION->ThrowException(implode("<br>", $this->errors));
         return false;
     } else {
         RegisterModule("subscribe");
         CModule::IncludeModule("subscribe");
         RegisterModuleDependences("main", "OnBeforeLangDelete", "subscribe", "CRubric", "OnBeforeLangDelete");
         RegisterModuleDependences("main", "OnUserDelete", "subscribe", "CSubscription", "OnUserDelete");
         RegisterModuleDependences("main", "OnUserLogout", "subscribe", "CSubscription", "OnUserLogout");
         RegisterModuleDependences("main", "OnGroupDelete", "subscribe", "CPosting", "OnGroupDelete");
         //agents
         CAgent::RemoveAgent("CSubscription::CleanUp();", "subscribe");
         CTimeZone::Disable();
         CAgent::Add(array("NAME" => "CSubscription::CleanUp();", "MODULE_ID" => "subscribe", "ACTIVE" => "Y", "NEXT_EXEC" => date("d.m.Y H:i:s", mktime(3, 0, 0, date("m"), date("j") + 1, date("Y"))), "AGENT_INTERVAL" => 86400, "IS_PERIOD" => "Y"));
         CTimeZone::Enable();
         return true;
     }
 }
예제 #5
0
파일: index.php 프로젝트: nProfessor/Mytb
	function UnInstallDB($arParams = array())
	{
		global $APPLICATION, $DB, $DOCUMENT_ROOT;

		if(!array_key_exists("savedata", $arParams) || $arParams["savedata"] != "Y")
		{
			$errors = $DB->RunSQLBatch($DOCUMENT_ROOT."/bitrix/modules/socialservices/install/db/".strtolower($DB->type)."/uninstall.sql");
			if (!empty($errors))
			{
				$APPLICATION->ThrowException(implode("", $errors));
				return false;
			}
		}
		UnRegisterModuleDependences("main", "OnUserDelete", "socialservices", "CSocServAuthDB", "OnUserDelete");
		UnRegisterModuleDependences('socialnetwork', 'OnFillSocNetLogEvents', 'socialservices', 'CSocServEventHandlers', 'OnFillSocNetLogEvents');
		UnRegisterModuleDependences('timeman', 'OnAfterTMReportDailyAdd', 'socialservices', 'CSocServAuthDB', 'OnAfterTMReportDailyAdd');
		UnRegisterModuleDependences('timeman', 'OnAfterTMDayStart', 'socialservices', 'CSocServAuthDB', 'OnAfterTMDayStart');
		UnRegisterModuleDependences('timeman', 'OnTimeManShow', 'socialservices', 'CSocServEventHandlers', 'OnTimeManShow');

		$dbSites = CSite::GetList(($b="sort"), ($o="asc"), array("ACTIVE" => "Y"));
		while ($arSite = $dbSites->Fetch())
		{
			$siteId = $arSite['ID'];
			CAgent::RemoveAgent("CSocServAuthManager::GetTwitMessages($siteId);", "socialservices");
		}

		UnRegisterModule("socialservices");

		return true;
	}
예제 #6
0
파일: index.php 프로젝트: Satariall/izurit
 function InstallDB($arParams = array())
 {
     global $DB, $DBType, $APPLICATION;
     $this->errors = false;
     // Database tables creation
     $bDBInstall = !$DB->Query("SELECT 'x' FROM b_workflow_document WHERE 1=0", true);
     if ($bDBInstall) {
         $this->errors = $DB->RunSQLBatch($_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/workflow/install/db/" . $DBType . "/install.sql");
     }
     if ($this->errors !== false) {
         $APPLICATION->ThrowException(implode("<br>", $this->errors));
         return false;
     } else {
         RegisterModule("workflow");
         CModule::IncludeModule("workflow");
         if ($bDBInstall) {
             $obWorkflowStatus = new CWorkflowStatus();
             $obWorkflowStatus->Add(array("~TIMESTAMP_X" => $DB->GetNowFunction(), "C_SORT" => 300, "ACTIVE" => "Y", "TITLE" => GetMessage("FLOW_INSTALL_PUBLISHED"), "IS_FINAL" => "Y", "NOTIFY" => "N"));
             $obWorkflowStatus->Add(array("~TIMESTAMP_X" => $DB->GetNowFunction(), "C_SORT" => 100, "ACTIVE" => "Y", "TITLE" => GetMessage("FLOW_INSTALL_DRAFT"), "IS_FINAL" => "N", "NOTIFY" => "N"));
             $obWorkflowStatus->Add(array("~TIMESTAMP_X" => $DB->GetNowFunction(), "C_SORT" => 200, "ACTIVE" => "Y", "TITLE" => GetMessage("FLOW_INSTALL_READY"), "IS_FINAL" => "N", "NOTIFY" => "Y"));
         }
         RegisterModuleDependences("main", "OnPanelCreate", "workflow", "CWorkflow", "OnPanelCreate", "200");
         RegisterModuleDependences("main", "OnChangeFile", "workflow", "CWorkflow", "OnChangeFile");
         //agents
         CAgent::RemoveAgent("CWorkflow::CleanUp();", "workflow");
         CAgent::AddAgent("CWorkflow::CleanUp();", "workflow", "N");
         return true;
     }
 }
예제 #7
0
 public function deleteAgentIfExists($moduleName, $name)
 {
     /** @noinspection PhpDynamicAsStaticMethodCallInspection */
     $aAgent = \CAgent::GetList(array("ID" => "DESC"), array('MODULE_ID' => $moduleName, 'NAME' => $name))->Fetch();
     if (!$aAgent) {
         return false;
     }
     /** @noinspection PhpDynamicAsStaticMethodCallInspection */
     \CAgent::RemoveAgent($name, $moduleName);
     return true;
 }
예제 #8
0
 function UnInstallDB($arParams = array())
 {
     global $DB;
     UnRegisterModuleDependences("perfmon", "OnGetTableSchema", "controller", "controller", "OnGetTableSchema");
     CAgent::RemoveAgent('CControllerMember::UnregisterExpiredAgent();');
     CAgent::RemoveAgent('CControllerAgent::CleanUp();');
     if (!array_key_exists("savedata", $arParams) || $arParams["savedata"] != "Y") {
         if ($DB->Query("SELECT 'x' FROM b_controller_member", true)) {
             $errors = $DB->RunSQLBatch($_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/controller/install/db/" . strtolower($DB->type) . "/uninstall.sql");
         }
     }
     UnRegisterModule("controller");
     return true;
 }
예제 #9
0
function __InTaskDeleteTask($delTaskId, $iblockId, $taskType, $ownerId, $arParams)
{
    $delTaskId = IntVal($delTaskId);
    $iblockId = IntVal($iblockId);
    $ownerId = IntVal($ownerId);
    if ($delTaskId <= 0 || $iblockId <= 0 || $ownerId <= 0) {
        return "";
    }
    $errorMessage = "";
    if (StrLen($errorMessage) <= 0) {
        $sectionId = 0;
        $dbElementSections = CIBlockElement::GetElementGroups($delTaskId);
        while ($arElementSection = $dbElementSections->Fetch()) {
            if ($arElementSection["IBLOCK_ID"] == $iblockId) {
                $sectionId = $arElementSection["ID"];
                break;
            }
        }
        if ($sectionId <= 0) {
            $errorMessage .= GetMessage("INTL_TASK_NOT_FOUND") . ".";
        }
    }
    if (StrLen($errorMessage) <= 0) {
        $dbSectionsChain = CIBlockSection::GetNavChain($iblockId, $sectionId);
        if ($arSect = $dbSectionsChain->GetNext()) {
            if ($taskType == 'group' && $arSect["XML_ID"] != $ownerId) {
                $errorMessage .= GetMessage("INTL_TASK_INTERNAL_ERROR") . " GTK003" . ". ";
            } elseif ($taskType != 'group' && $arSect["XML_ID"] != "users_tasks") {
                $errorMessage .= GetMessage("INTL_TASK_INTERNAL_ERROR") . " GTK004" . ". ";
            }
        } else {
            $errorMessage .= GetMessage("INTL_FOLDER_NOT_FOUND") . ". ";
        }
    }
    if (StrLen($errorMessage) <= 0) {
        if (!CIBlockElement::Delete($delTaskId)) {
            $errorMessage .= GetMessage("INTL_ERROR_DELETE_TASK") . ". ";
        }
        CAgent::RemoveAgent("CIntranetTasks::SendRemindEventAgent(" . $iblockId . ", " . $delTaskId . ", \"" . $arParams[$taskType == "user" ? "PATH_TO_USER_TASKS_TASK" : "PATH_TO_GROUP_TASKS_TASK"] . "\");", "intranet");
    }
    return $errorMessage;
}
예제 #10
0
 public function replaceAgent($moduleName, $name, $interval, $nextExec)
 {
     /* @global $APPLICATION \CMain */
     global $APPLICATION;
     /** @noinspection PhpDynamicAsStaticMethodCallInspection */
     $aAgent = \CAgent::GetList(array("ID" => "DESC"), array('MODULE_ID' => $moduleName, 'NAME' => $name))->Fetch();
     if ($aAgent) {
         /** @noinspection PhpDynamicAsStaticMethodCallInspection */
         \CAgent::RemoveAgent($name, $moduleName);
     }
     /** @noinspection PhpDynamicAsStaticMethodCallInspection */
     $agentId = \CAgent::AddAgent($name, $moduleName, 'N', $interval, '', 'Y', $nextExec);
     if ($agentId) {
         return $agentId;
     }
     if ($APPLICATION->GetException()) {
         $this->throwException(__METHOD__, $APPLICATION->GetException()->GetString());
     } else {
         $this->throwException(__METHOD__, 'Agent %s not added', $name);
     }
 }
예제 #11
0
		if ($boolFlag && $boolCatalogUpdate)
		{
			$strOK .= Loc::getMessage('CAT_IBLOCK_CATALOG_SUCCESSFULLY_UPDATE').'<br />';
		}

		CAgent::RemoveAgent('CCatalog::PreGenerateXML("yandex");', 'catalog');
		if ($bNeedAgent)
		{
			CAgent::AddAgent('CCatalog::PreGenerateXML("yandex");', 'catalog', 'N', (int)Option::get('catalog', 'yandex_xml_period')*3600);
		}
	}

	if ($_SERVER['REQUEST_METHOD'] == 'POST' && !empty($_POST['agent_start']) && !$bReadOnly && check_bitrix_sessid())
	{
		CAgent::RemoveAgent('CCatalog::PreGenerateXML("yandex");', 'catalog');
		$intCount = (int)CCatalog::GetList(array(), array('YANDEX_EXPORT' => 'Y'), array());
		if ($intCount > 0)
		{
			CAgent::AddAgent('CCatalog::PreGenerateXML("yandex");', 'catalog', 'N', (int)Option::get('catalog', 'yandex_xml_period') * 3600);
			$strOK .= Loc::getMessage('CAT_AGENT_ADD_SUCCESS').'. ';
		}
		else
		{
			$strWarning .= Loc::getMessage('CAT_AGENT_ADD_NO_EXPORT').'. ';
		}
	}

	if(!empty($strWarning))
		CAdminMessage::ShowMessage($strWarning);
예제 #12
0
         } else {
             COption::SetOptionString($module_id, "SKIP_STATISTIC_GROUPS", implode(",", $arSKIP_STATISTIC_GROUPS));
         }
     } else {
         COption::SetOptionString($module_id, "SKIP_STATISTIC_GROUPS", "");
     }
     if ($SKIP_STATISTIC_WHAT == 'ranges' || $SKIP_STATISTIC_WHAT == 'both') {
         if ($SKIP_STATISTIC_IP_RANGES == "") {
             $strError .= GetMessage("STAT_OPT_ERR_NO_RANGES") . "<br>";
         } else {
             COption::SetOptionString($module_id, "SKIP_STATISTIC_IP_RANGES", $SKIP_STATISTIC_IP_RANGES);
         }
     } else {
         COption::SetOptionString($module_id, "SKIP_STATISTIC_IP_RANGES", "");
     }
     CAgent::RemoveAgent("SendDailyStatistics();", "statistic");
     if (strlen($next_exec) > 0) {
         CAgent::AddAgent("SendDailyStatistics();", "statistic", "Y", 86400, "", "Y", $next_exec);
     }
     if ($DEFENCE_ON != "Y") {
         $DEFENCE_ON = "N";
     }
     COption::SetOptionString($module_id, "DEFENCE_ON", $DEFENCE_ON);
     if ($DEFENCE_ON == "Y") {
         COption::SetOptionString($module_id, "DEFENCE_STACK_TIME", $DEFENCE_STACK_TIME);
         COption::SetOptionString($module_id, "DEFENCE_MAX_STACK_HITS", $DEFENCE_MAX_STACK_HITS);
         COption::SetOptionString($module_id, "DEFENCE_DELAY", $DEFENCE_DELAY);
         COption::SetOptionString($module_id, "DEFENCE_LOG", $DEFENCE_LOG === "Y" ? "Y" : "N");
     }
 }
 $Update = $Update . $Apply;
예제 #13
0
             $strWarning .= $ex->GetString() . "<br>";
             $bVarsFromForm = true;
         }
     }
 }
 if (!$bVarsFromForm) {
     if ($bBizproc && $_REQUEST['BIZ_PROC_ADD_DEFAULT_TEMPLATES'] == 'Y' && CBPDocument::GetNumberOfWorkflowTemplatesForDocumentType(array("iblock", "CIBlockDocument", "iblock_" . $ID)) <= 0 && $arFields["BIZPROC"] == "Y") {
         CBPDocument::AddDefaultWorkflowTemplates(array("iblock", "CIBlockDocument", "iblock_" . $ID));
     }
     $DB->Commit();
     //Check if index needed
     CIBlock::CheckForIndexes($ID);
     if ($bCatalog) {
         if (isset($boolNeedAgent) && $boolNeedAgent == true) {
             $intYandexExport = CCatalog::GetList(array(), array('YANDEX_EXPORT' => 'Y'), array());
             CAgent::RemoveAgent("CCatalog::PreGenerateXML(\"yandex\");", "catalog");
             if (0 < $intYandexExport) {
                 CAgent::AddAgent("CCatalog::PreGenerateXML(\"yandex\");", "catalog", "N", IntVal(COption::GetOptionString("catalog", "yandex_xml_period", "24")) * 60 * 60, "", "Y");
             }
         }
     }
     $ob = new CAutoSave();
     if (strlen($apply) <= 0) {
         if (strlen($_REQUEST["return_url"]) > 0) {
             LocalRedirect($_REQUEST["return_url"]);
         } else {
             LocalRedirect("/bitrix/admin/iblock_admin.php?type=" . $type . "&lang=" . LANG . "&admin=" . ($_REQUEST["admin"] == "Y" ? "Y" : "N"));
         }
     }
     LocalRedirect("/bitrix/admin/iblock_edit.php?type=" . $type . "&tabControl_active_tab=" . urlencode($tabControl_active_tab) . "&lang=" . LANG . "&ID=" . $ID . "&admin=" . ($_REQUEST["admin"] == "Y" ? "Y" : "N") . (strlen($_REQUEST["return_url"]) > 0 ? "&return_url=" . urlencode($_REQUEST["return_url"]) : ""));
 }
예제 #14
0
 public static function __UpdateAgentPeriod($server_id, $time)
 {
     $server_id = IntVal($server_id);
     $time = IntVal($time);
     CAgent::RemoveAgent("CLdapServer::SyncAgent(" . $server_id . ");", "ldap");
     if ($time > 0) {
         CAgent::AddAgent("CLdapServer::SyncAgent(" . $server_id . ");", "ldap", "N", $time * 60 * 60);
     }
 }
예제 #15
0
파일: options.php 프로젝트: Hawkart/megatv
                 if (strlen(trim(${$name}[$j])) > 0) {
                     $val .= ($val != "" ? "," : "") . trim(${$name}[$j]);
                 }
             }
         } 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());
예제 #16
0
	function Delete($ID)
	{
		global $DB;
		$ID = IntVal($ID);
		$db_msg = CMailMessage::GetList(Array(), Array("MAILBOX_ID"=>$ID));
		while($msg = $db_msg->Fetch())
		{
			if(!CMailMessage::Delete($msg["ID"]))
				return false;
		}

		$db_flt = CMailFilter::GetList(Array(), Array("MAILBOX_ID"=>$ID));
		while($flt = $db_flt->Fetch())
		{
			if(!CMailFilter::Delete($flt["ID"]))
				return false;
		}

		$db_log = CMailLog::GetList(Array(), Array("MAILBOX_ID"=>$ID));
		while($log = $db_log->Fetch())
		{
			if(!CMailLog::Delete($log["ID"]))
				return false;
		}

		$db_mbox = CMailbox::GetList(array('ID' => $ID, 'ACTIVE' => 'Y', '!USER_ID' => 0));
		if ($mbox = $db_mbox->fetch())
		{
			CUserCounter::Clear($mbox['USER_ID'], 'mail_unseen', $mbox['LID']);

			CUserOptions::DeleteOption('global', 'last_mail_check_'.$mbox['LID'], false, $mbox['USER_ID']);
			CUserOptions::DeleteOption('global', 'last_mail_check_success_'.$mbox['LID'], false, $mbox['USER_ID']);
		}

		CAgent::RemoveAgent("CMailbox::CheckMailAgent(".$ID.");", "mail");

		$strSql = "DELETE FROM b_mail_message_uid WHERE MAILBOX_ID=".$ID;
		if(!$DB->Query($strSql, true))
			return false;

		CMailbox::SMTPReload();
		$strSql = "DELETE FROM b_mail_mailbox WHERE ID=".$ID;
		return $DB->Query($strSql, true);
	}
예제 #17
0
 function UnInstallDB($arParams = array())
 {
     $this->errors = false;
     $arSQLErrors = array();
     if (CModule::IncludeModule("search")) {
         CSearch::DeleteIndex("forum");
     }
     if (array_key_exists("savedata", $arParams) && $arParams["savedata"] != "Y") {
         $this->UnInstallUserFields();
         $db_res = $GLOBALS["DB"]->Query("SELECT ID FROM b_file WHERE MODULE_ID = 'forum'");
         while ($res = $db_res->Fetch()) {
             CFile::Delete($res["ID"]);
         }
         $this->errors = $GLOBALS["DB"]->RunSQLBatch($_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/forum/install/" . $GLOBALS["DBType"] . "/uninstall.sql");
     }
     if (!empty($this->errors)) {
         $GLOBALS["APPLICATION"]->ThrowException(implode("", $arSQLErrors));
         return false;
     }
     UnRegisterModuleDependences("main", "OnAfterRegisterModule", "main", "forum", "InstallUserFields", "/modules/forum/install/index.php");
     UnRegisterModuleDependences("iblock", "OnIBlockPropertyBuildList", "main", "CIBlockPropertyTopicID", "GetUserTypeDescription");
     UnRegisterModuleDependences("iblock", "OnBeforeIBlockElementDelete", "forum", "CForumTopic", "OnBeforeIBlockElementDelete");
     UnRegisterModuleDependences("main", "OnUserDelete", "forum", "CForumUser", "OnUserDelete");
     UnRegisterModuleDependences("main", "OnFileDelete", "forum", "CForumFiles", "OnFileDelete");
     UnRegisterModuleDependences("search", "OnReindex", "forum", "CForumNew", "OnReindex");
     UnRegisterModuleDependences("main", "OnPanelCreate", "forum", "CForumNew", "OnPanelCreate");
     UnRegisterModuleDependences("main", "OnBeforeLangDelete", "forum", "CForumNew", "OnBeforeLangDelete");
     UnRegisterModuleDependences("main", "OnGroupDelete", "forum", "CForumNew", "OnGroupDelete");
     UnRegisterModuleDependences("main", "OnEventLogGetAuditTypes", "forum", "CForumEventLog", "GetAuditTypes");
     UnRegisterModuleDependences("main", "OnEventLogGetAuditHandlers", "forum", "CEventForum", "MakeForumObject");
     UnRegisterModuleDependences("socialnetwork", "OnSocNetGroupDelete", "forum", "CForumUser", "OnSocNetGroupDelete");
     UnRegisterModuleDependences("main", "OnAfterAddRating", "forum", "CRatingsComponentsForum", "OnAfterAddRating");
     UnRegisterModuleDependences("main", "OnAfterUpdateRating", "forum", "CRatingsComponentsForum", "OnAfterUpdateRating");
     UnRegisterModuleDependences("main", "OnSetRatingsConfigs", "forum", "CRatingsComponentsForum", "OnSetRatingConfigs");
     UnRegisterModuleDependences("main", "OnGetRatingsConfigs", "forum", "CRatingsComponentsForum", "OnGetRatingConfigs");
     UnRegisterModuleDependences("main", "OnGetRatingsObjects", "forum", "CRatingsComponentsForum", "OnGetRatingObject");
     UnRegisterModuleDependences("main", "OnGetRatingContentOwner", "forum", "CRatingsComponentsForum", "OnGetRatingContentOwner");
     UnRegisterModuleDependences("im", "OnGetNotifySchema", "forum", "CForumNotifySchema", "OnGetNotifySchema");
     CAgent::RemoveAgent("CForumTopic::CleanUp();", "forum");
     CAgent::RemoveAgent("CForumStat::CleanUp();", "forum");
     CAgent::RemoveAgent("CForumFiles::CleanUp();", "forum");
     UnRegisterModule("forum");
     return true;
 }
예제 #18
0
				}
			}
			//////////////////////////////////////////////
			// DEL_PROFILE
			//////////////////////////////////////////////
			elseif ($bCanEdit && $_REQUEST["ACTION"]=="DEL_PROFILE")
			{
				$ar_profile = CCatalogImport::GetByID($PROFILE_ID);
				if (!$ar_profile)
					$strErrorMessage .= GetMessage("CES_ERROR_NO_PROFILE1").$PROFILE_ID." ".GetMessage("CES_ERROR_NO_PROFILE2")."\n";

				if (strlen($strErrorMessage)<=0)
				{
					if ($ar_profile["IN_AGENT"]=="Y")
					{
						CAgent::RemoveAgent("CCatalogImport::PreGenerateImport(".$PROFILE_ID.");", "catalog");
					}
					if ($ar_profile["IN_CRON"]=="Y")
					{
						$cfg_data = "";
						if (file_exists($_SERVER["DOCUMENT_ROOT"]."/bitrix/crontab/crontab.cfg"))
						{
							$cfg_file_size = filesize($_SERVER["DOCUMENT_ROOT"]."/bitrix/crontab/crontab.cfg");
							$fp = fopen($_SERVER["DOCUMENT_ROOT"]."/bitrix/crontab/crontab.cfg", "rb");
							$cfg_data = fread($fp, $cfg_file_size);
							fclose($fp);

							$cfg_data = preg_replace("#^.*?".preg_quote(CATALOG_PATH2IMPORTS)."cron_frame.php +".$PROFILE_ID." *>.*?$#im", "", $cfg_data);

							$cfg_data = preg_replace("#[\r\n]{2,}#im", "\n", $cfg_data);
							$fp = fopen($_SERVER["DOCUMENT_ROOT"]."/bitrix/crontab/crontab.cfg", "wb");
예제 #19
0
 public static function DataSync($paramUserId = 0)
 {
     $exchangeScheme = COption::GetOptionString("dav", "exchange_scheme", "http");
     $exchangeServer = COption::GetOptionString("dav", "exchange_server", "");
     $exchangePort = COption::GetOptionString("dav", "exchange_port", "80");
     $exchangeUsername = COption::GetOptionString("dav", "exchange_username", "");
     $exchangePassword = COption::GetOptionString("dav", "exchange_password", "");
     if (empty($exchangeServer)) {
         CAgent::RemoveAgent("CDavExchangeTasks::DataSync();", "dav");
         COption::SetOptionString("dav", "agent_tasks", "N");
         return "";
     }
     $exchange = new CDavExchangeTasks($exchangeScheme, $exchangeServer, $exchangePort, $exchangeUsername, $exchangePassword);
     $exchangeMailbox = COption::GetOptionString("dav", "exchange_mailbox", "");
     $exchangeUseLogin = COption::GetOptionString("dav", "exchange_use_login", "Y");
     self::InitUserEntity();
     $maxNumber = 5;
     $index = 0;
     $paramUserId = intval($paramUserId);
     $arUserFilter = array("ACTIVE" => "Y", "!UF_DEPARTMENT" => false);
     if ($paramUserId > 0) {
         $arUserFilter["ID_EQUAL_EXACT"] = $paramUserId;
     }
     if ($exchangeUseLogin == "N") {
         $arUserFilter["!UF_BXDAVEX_MAILBOX"] = false;
     }
     $arAdditionalExtendedProperties = array(array('DistinguishedPropertySetId' => 'PublicStrings', 'PropertyName' => 'BX_TASKS_GUID', 'PropertyType' => 'String'), array('DistinguishedPropertySetId' => 'PublicStrings', 'PropertyName' => 'BX_TASKS_SERIALIZED_DATA', 'PropertyType' => 'String'));
     $dbUserList = CUser::GetList($by = "UF_BXDAVEX_TSKSYNC", $order = "asc", $arUserFilter, array("SELECT" => array("ID", "LOGIN", "UF_BXDAVEX_MAILBOX", "UF_BXDAVEX_TSKSYNC")));
     while ($arUser = $dbUserList->Fetch()) {
         $index++;
         if ($index > $maxNumber) {
             break;
         }
         $GLOBALS["USER_FIELD_MANAGER"]->Update("USER", $arUser["ID"], array("UF_BXDAVEX_TSKSYNC" => ConvertTimeStamp(time(), FULL)));
         $mailbox = $exchangeUseLogin == "Y" ? $arUser["LOGIN"] . $exchangeMailbox : $arUser["UF_BXDAVEX_MAILBOX"];
         if (empty($mailbox)) {
             continue;
         }
         $arFoldersList = $exchange->GetFoldersList(array("mailbox" => $mailbox));
         if (!is_array($arFoldersList)) {
             if (DAV_CALDAV_DEBUG) {
                 CDav::WriteToLog('Error during tasks exchange: $exchange->GetFoldersList() returns unexpected result', '');
             }
             return;
         }
         $arUserFolders = array("tasks" => GetMessage("DAV_EC_TASKS"));
         foreach ($arFoldersList as $value) {
             $arUserFolders[$value["XML_ID"]] = $value["NAME"];
         }
         $arUserTaskItems = array();
         $arUserTaskItemsFolder = array();
         foreach ($arUserFolders as $userFolderXmlId => $userFolder) {
             $arTaskItemsList = $exchange->GetList(array("mailbox" => $mailbox, "FolderId" => $userFolderXmlId), array("ItemShape" => "IdOnly"), $arAdditionalExtendedProperties);
             if (!is_array($arTaskItemsList)) {
                 if (DAV_CALDAV_DEBUG) {
                     CDav::WriteToLog('Error during tasks exchange: $exchange->GetList() returns unexpected result', '');
                 }
                 return;
             }
             foreach ($arTaskItemsList as $value) {
                 $arUserTaskItems[] = array("XML_ID" => $value["XML_ID"], "MODIFICATION_LABEL" => $value["MODIFICATION_LABEL"]);
                 $arUserTaskItemsFolder[$value["XML_ID"]] = $userFolderXmlId;
             }
         }
         $arModifiedUserTaskItems = CTaskSync::SyncTaskItems("exchange", $arUser["ID"], $arUserTaskItems);
         foreach ($arModifiedUserTaskItems as $value) {
             $arModifiedTaskItem = $exchange->GetById($value["XML_ID"], $arAdditionalExtendedProperties);
             if (is_array($arModifiedTaskItem) && count($arModifiedTaskItem) > 0) {
                 $arModifiedTaskItem = $arModifiedTaskItem[0];
                 $arModifyEventArray = array_merge($arModifiedTaskItem, array("ID" => $value["ID"], "USER_ID" => $arUser["ID"], "FOLDER_ID" => $arUserFolders[$arUserTaskItemsFolder[$arModifiedTaskItem["XML_ID"]]]));
                 //XML_ID, MODIFICATION_LABEL, SUBJECT, BODY, BODY_TYPE, DATE_CREATE, IMPORTANCE, REMINDER_MINUTES_BEFORE_START, ACTUAL_WORK, BILLING_INFORMATION, MILEAGE, START_DATE, DUE_DATE, IS_COMPLETE, IS_RECURRING, PERCENT_COMPLETE, STATUS, STATUS_DESCRIPTION, TOTAL_WORK, OWNER, RECURRING_TYPE, RECURRING_INTERVAL, RECURRING_DAYOFMONTH, RECURRING_DAYSOFWEEK, RECURRING_DAYOFWEEKINDEX, RECURRING_MONTH, RECURRING_STARTDATE, RECURRING_NUMBEROFOCCURRENCES, RECURRING_ENDDATE
                 CTaskSync::SyncModifyTaskItem($arModifyEventArray);
             }
         }
     }
     return "CDavExchangeTasks::DataSync();";
 }
예제 #20
0
	public static function __CounterUpdateAgentPeriod($group_id, $time)
	{
		$group_id = IntVal($group_id);
		$time = IntVal($time);

		CAgent::RemoveAgent("CControllerGroup::__UpdateCountersAgent(".$group_id.");", "controller");
		if($time>0)
			CAgent::AddAgent("CControllerGroup::__UpdateCountersAgent(".$group_id.");", "controller", "N", $time*60);
	}
예제 #21
0
 public static function DoDataSync($paramUserId, &$lastError)
 {
     if (DAV_EXCH_DEBUG) {
         CDav::WriteToLog("Starting EXCHANGE sync...", "SYNCE");
     }
     $exchangeScheme = COption::GetOptionString("dav", "exchange_scheme", "http");
     $exchangeServer = COption::GetOptionString("dav", "exchange_server", "");
     $exchangePort = COption::GetOptionString("dav", "exchange_port", "80");
     $exchangeUsername = COption::GetOptionString("dav", "exchange_username", "");
     $exchangePassword = COption::GetOptionString("dav", "exchange_password", "");
     if (empty($exchangeServer)) {
         CAgent::RemoveAgent("CDavExchangeCalendar::DataSync();", "dav");
         COption::SetOptionString("dav", "agent_calendar", "N");
         return null;
     }
     static $arWeekDayMap = array("sunday" => 6, "monday" => 0, "tuesday" => 1, "wednesday" => 2, "thursday" => 3, "friday" => 4, "saturday" => 5);
     $exchange = new CDavExchangeCalendar($exchangeScheme, $exchangeServer, $exchangePort, $exchangeUsername, $exchangePassword);
     if (GW_DEBUG) {
         $exchange->Debug();
     }
     $exchangeMailbox = COption::GetOptionString("dav", "exchange_mailbox", "");
     $exchangeUseLogin = COption::GetOptionString("dav", "exchange_use_login", "Y");
     self::InitUserEntity();
     $maxNumber = 15;
     $index = 0;
     $bShouldClearCache = null;
     $paramUserId = intval($paramUserId);
     $arUserFilter = array("ACTIVE" => "Y", "!UF_DEPARTMENT" => false);
     if ($paramUserId > 0) {
         $arUserFilter["ID_EQUAL_EXACT"] = $paramUserId;
     }
     if ($exchangeUseLogin == "N") {
         $arUserFilter["!UF_BXDAVEX_MAILBOX"] = false;
     }
     $dbUserList = CUser::GetList($by = "UF_BXDAVEX_CALSYNC", $order = "asc", $arUserFilter, array("SELECT" => array("ID", "LOGIN", "UF_BXDAVEX_MAILBOX", "UF_BXDAVEX_CALSYNC")));
     while ($arUser = $dbUserList->Fetch()) {
         $index++;
         if ($index > $maxNumber) {
             break;
         }
         if (DAV_EXCH_DEBUG) {
             CDav::WriteToLog("Processing user [" . $arUser["ID"] . "] " . $arUser["LOGIN"], "SYNCE");
         }
         $GLOBALS["USER_FIELD_MANAGER"]->Update("USER", $arUser["ID"], array("UF_BXDAVEX_CALSYNC" => ConvertTimeStamp(time(), FULL)));
         $mailbox = $exchangeUseLogin == "Y" ? $arUser["LOGIN"] . $exchangeMailbox : $arUser["UF_BXDAVEX_MAILBOX"];
         if (empty($mailbox)) {
             $lastError = GetMessage("DAV_EC_EMPTY_MAILBOX");
             continue;
         }
         $arCalendarsList = $exchange->GetCalendarsList(array("mailbox" => $mailbox));
         $arErrorsTmp = $exchange->GetErrors();
         if (count($arErrorsTmp) > 0) {
             $txt = '';
             foreach ($arErrorsTmp as $v) {
                 if (!empty($txt)) {
                     $txt .= ", ";
                 }
                 $txt .= "[" . $v[0] . "] " . $v[1];
             }
             if (DAV_EXCH_DEBUG) {
                 CDav::WriteToLog("ERROR: " . $txt, "SYNCE");
             }
             $lastError = $txt;
             continue;
         }
         if (!is_array($arCalendarsList)) {
             $lastError = "Incorrect Data from Exchange Server";
             continue;
         }
         $bShouldClearCache = false;
         $arUserCalendars = array(array("XML_ID" => "calendar_" . $arUser["ID"], "NAME" => GetMessage("DAV_EC_CALENDAR"), "MODIFICATION_LABEL" => ""));
         foreach ($arCalendarsList as $value) {
             $arUserCalendars[] = array("XML_ID" => $value["XML_ID"], "NAME" => $value["NAME"], "MODIFICATION_LABEL" => $value["MODIFICATION_LABEL"]);
         }
         $tmpNumCals = count($arUserCalendars);
         $arUserCalendars = CCalendar::SyncCalendars("exchange", $arUserCalendars, "user", $arUser["ID"]);
         $tmpNumItems = 0;
         foreach ($arUserCalendars as $userCalendar) {
             $userCalendarXmlId = $userCalendar["XML_ID"];
             $userCalendarXmlId = $userCalendarXmlId == "calendar_" . $arUser["ID"] ? "calendar" : $userCalendarXmlId;
             $arCalendarItemsList = $exchange->GetList(array("mailbox" => $mailbox, "CalendarId" => $userCalendarXmlId), array("ItemShape" => "IdOnly"));
             $arUserCalendarItems = array();
             foreach ($arCalendarItemsList as $value) {
                 $arUserCalendarItems[] = array("XML_ID" => $value["XML_ID"], "MODIFICATION_LABEL" => $value["MODIFICATION_LABEL"]);
             }
             $arModifiedUserCalendarItems = CCalendar::SyncCalendarItems("exchange", $userCalendar["CALENDAR_ID"], $arUserCalendarItems);
             $tmpNumItems += count($arModifiedUserCalendarItems);
             if (is_array($arModifiedUserCalendarItems)) {
                 foreach ($arModifiedUserCalendarItems as $value) {
                     $arModifiedCalendarItem = $exchange->GetById($value["XML_ID"]);
                     if (is_array($arModifiedCalendarItem) && count($arModifiedCalendarItem) > 0) {
                         $arModifiedCalendarItem = $arModifiedCalendarItem[0];
                         $arModifyEventArray = array("ID" => $value["ID"], "NAME" => $arModifiedCalendarItem["NAME"], "DESCRIPTION" => $arModifiedCalendarItem["DESCRIPTION"], "XML_ID" => $arModifiedCalendarItem["XML_ID"], "PROPERTY_LOCATION" => $arModifiedCalendarItem["PROPERTY_LOCATION"], "DATE_FROM" => $arModifiedCalendarItem["ACTIVE_FROM"], "DATE_TO" => $arModifiedCalendarItem["ACTIVE_TO"], "SKIP_TIME" => $arModifiedCalendarItem["SKIP_TIME"], "PROPERTY_IMPORTANCE" => $arModifiedCalendarItem["PROPERTY_IMPORTANCE"], "PROPERTY_ACCESSIBILITY" => $arModifiedCalendarItem["PROPERTY_FREEBUSY"], "PROPERTY_REMIND_SETTINGS" => $arModifiedCalendarItem["PROPERTY_REMIND_SETTINGS"], "PROPERTY_PERIOD_TYPE" => "NONE", "PROPERTY_BXDAVEX_LABEL" => $arModifiedCalendarItem["MODIFICATION_LABEL"], "PRIVATE_EVENT" => strtolower($arModifiedCalendarItem["PROPERTY_SENSITIVITY"]) == 'private');
                         if ($arModifiedCalendarItem["IS_RECURRING"]) {
                             if ($arModifiedCalendarItem["RECURRING_TYPE"] == "MONTHLY_ABSOLUTE" || $arModifiedCalendarItem["RECURRING_TYPE"] == "MONTHLY_RELATIVE" || $arModifiedCalendarItem["RECURRING_TYPE"] == "MONTHLY") {
                                 $arModifyEventArray["PROPERTY_PERIOD_TYPE"] = "MONTHLY";
                             } elseif ($arModifiedCalendarItem["RECURRING_TYPE"] == "YEARLY_ABSOLUTE" || $arModifiedCalendarItem["RECURRING_TYPE"] == "YEARLY_RELATIVE" || $arModifiedCalendarItem["RECURRING_TYPE"] == "YEARLY") {
                                 $arModifyEventArray["PROPERTY_PERIOD_TYPE"] = "YEARLY";
                             } elseif ($arModifiedCalendarItem["RECURRING_TYPE"] == "WEEKLY") {
                                 $arModifyEventArray["PROPERTY_PERIOD_TYPE"] = "WEEKLY";
                             } elseif ($arModifiedCalendarItem["RECURRING_TYPE"] == "DAILY") {
                                 $arModifyEventArray["PROPERTY_PERIOD_TYPE"] = "DAILY";
                             }
                             if (isset($arModifiedCalendarItem["RECURRING_INTERVAL"])) {
                                 $arModifyEventArray["PROPERTY_PERIOD_COUNT"] = $arModifiedCalendarItem["RECURRING_INTERVAL"];
                             }
                             if ($arModifyEventArray["PROPERTY_PERIOD_TYPE"] == "WEEKLY") {
                                 if (isset($arModifiedCalendarItem["RECURRING_DAYSOFWEEK"])) {
                                     $ar = preg_split("/[;,\\s]/i", $arModifiedCalendarItem["RECURRING_DAYSOFWEEK"]);
                                     $ar1 = array();
                                     foreach ($ar as $v) {
                                         $ar1[] = $arWeekDayMap[strtolower($v)];
                                     }
                                     $arModifyEventArray["PROPERTY_PERIOD_ADDITIONAL"] = implode(",", $ar1);
                                 }
                             }
                             $arModifyEventArray["PROPERTY_EVENT_LENGTH"] = MakeTimeStamp($arModifyEventArray["ACTIVE_TO"]) - MakeTimeStamp($arModifyEventArray["ACTIVE_FROM"]);
                             if ($arModifyEventArray["PROPERTY_EVENT_LENGTH"] <= 0) {
                                 $arModifyEventArray["PROPERTY_EVENT_LENGTH"] = 86400;
                             }
                             if (isset($arModifiedCalendarItem["RECURRING_ENDDATE"])) {
                                 $arModifyEventArray["ACTIVE_TO"] = $arModifiedCalendarItem["RECURRING_ENDDATE"];
                             } elseif (isset($arResultItem["RECURRING_NUMBEROFOCCURRENCES"])) {
                                 $eventTime = self::GetPeriodicEventTime(MakeTimeStamp($arModifyEventArray["ACTIVE_TO"]), array("freq" => $arModifyEventArray["PROPERTY_PERIOD_TYPE"], "interval" => $arModifyEventArray["PROPERTY_PERIOD_COUNT"], "byday" => $arModifyEventArray["PROPERTY_PERIOD_ADDITIONAL"]), $arResultItem["RECURRING_NUMBEROFOCCURRENCES"]);
                                 $arModifyEventArray["ACTIVE_TO"] = date($GLOBALS["DB"]->DateFormatToPHP(FORMAT_DATETIME), $eventTime);
                             } else {
                                 $arModifyEventArray["ACTIVE_TO"] = ConvertTimeStamp(mktime(0, 0, 0, 12, 31, 2025), "FULL");
                             }
                         }
                         CCalendar::ModifyEvent($userCalendar["CALENDAR_ID"], $arModifyEventArray);
                         $bShouldClearCache = true;
                     }
                 }
             }
         }
         if (DAV_EXCH_DEBUG) {
             CDav::WriteToLog("Sync " . intval($tmpNumCals) . " calendars, " . intval($tmpNumItems) . " items", "SYNCE");
         }
     }
     if ($bShouldClearCache) {
         CCalendar::SyncClearCache();
     }
     if (DAV_EXCH_DEBUG) {
         CDav::WriteToLog("EXCHANGE sync finished", "SYNCE");
     }
     return $bShouldClearCache;
 }
예제 #22
0
 /**
  * <p>Метод удаляет рейтинг с идентификатором ID. Динамичный метод.</p>
  *
  *
  * @param int $id  Идентификатор рейтинга
  *
  * @return bool 
  *
  * <h4>Example</h4> 
  * <pre>
  * &lt;?
  * // удаление рейтинга
  * $ID = 1;
  * $result = CRatings::Delete($ID);
  * if ($result)
  *     echo "Рейтинг успешно удален.";
  * ?&gt;
  * </pre>
  *
  *
  * @static
  * @link http://dev.1c-bitrix.ru/api_help/main/reference/cratings/Delete.php
  * @author Bitrix
  */
 public static function Delete($ID)
 {
     global $DB, $stackCacheManager;
     $ID = intval($ID);
     $err_mess = CRatings::err_mess() . "<br>Function: Delete<br>Line: ";
     foreach (GetModuleEvents("main", "OnBeforeDeleteRating", true) as $arEvent) {
         ExecuteModuleEventEx($arEvent, array($ID));
     }
     $DB->Query("DELETE FROM b_rating WHERE ID={$ID}", false, $err_mess . __LINE__);
     $DB->Query("DELETE FROM b_rating_user WHERE RATING_ID={$ID}", false, $err_mess . __LINE__);
     $DB->Query("DELETE FROM b_rating_component WHERE RATING_ID={$ID}", false, $err_mess . __LINE__);
     $DB->Query("DELETE FROM b_rating_component_results WHERE RATING_ID={$ID}", false, $err_mess . __LINE__);
     $DB->Query("DELETE FROM b_rating_results WHERE RATING_ID={$ID}", false, $err_mess . __LINE__);
     CAgent::RemoveAgent("CRatings::Calculate({$ID});", "main");
     $stackCacheManager->Clear("b_rating");
     return true;
 }
예제 #23
0
파일: options.php 프로젝트: ASDAFF/open_bx
	{
		CAgent::AddAgent("CUser::CleanUpAgent();", "main", "N", 24*60*60);
	}
	else
	{
		CAgent::RemoveAgent("CUser::CleanUpAgent();", "main");
	}

	$cleanup_days = COption::GetOptionInt("main", "event_log_cleanup_days", 7);
	if($cleanup_days > 0)
	{
		CAgent::AddAgent("CEventLog::CleanUpAgent();", "main", "N", 24*60*60);
	}
	else
	{
		CAgent::RemoveAgent("CEventLog::CleanUpAgent();", "main");
	}

	if((COption::GetOptionString("main", "new_user_email_uniq_check", "N") === "Y") && !$DB->IndexExists("b_user", array("EMAIL")))
	{
		if(strtolower($DB->type) === "oracle")
			$DB->Query("CREATE INDEX ix_b_user_email on b_user(UPPER(EMAIL))", true);
		else
			$DB->Query("CREATE INDEX ix_b_user_email on b_user(EMAIL)", true);
	}
	$bEmailIndex = (COption::GetOptionString("main", "new_user_email_uniq_check", "N") !== "Y") && !$DB->IndexExists("b_user", array("EMAIL"));
	foreach($arAllOptions["auth"] as $i => $arOption)
		if($arOption[0] === "new_user_email_uniq_check")
			$arAllOptions["auth"][$i][1] = GetMessage("MAIN_REGISTER_EMAIL_UNIQ_CHECK").($bEmailIndex? "<br>".GetMessage("MAIN_REGISTER_EMAIL_INDEX_WARNING"): "");

	// установка прав групп
예제 #24
0
파일: step1.php 프로젝트: ASDAFF/entask.ru
			elseif($key == "PHONE")
				$arProp["VALUE"] = "8 495 2312121";
			elseif($key == "ZIP")
				$arProp["VALUE"] = "101000";
			elseif($key == "LOCATION")
				$arProp["VALUE"] = $location;
			elseif($key == "CITY")
				$arProp["VALUE"] = $shopLocation;
			$arData["PROPS"][] = $arProp;
		}
		$orderID = __MakeOrder(3, $arData);
		CSaleOrder::DeliverOrder($orderID, "Y");
		CSaleOrder::PayOrder($orderID, "Y");
		CSaleOrder::StatusOrder($orderID, "F");
		$orderID = __MakeOrder(4, $arData);
		CSaleOrder::DeliverOrder($orderID, "Y");
		CSaleOrder::PayOrder($orderID, "Y");
		CSaleOrder::StatusOrder($orderID, "F");
		$orderID = __MakeOrder(2, $arData);
		CSaleOrder::PayOrder($orderID, "Y");
		CSaleOrder::StatusOrder($orderID, "P");
		$orderID = __MakeOrder(1, $arData);
		$orderID = __MakeOrder(3, $arData);
		CSaleOrder::CancelOrder($orderID, "Y");
		CAgent::RemoveAgent("CSaleProduct::RefreshProductList();", "sale");
		CAgent::AddAgent("CSaleProduct::RefreshProductList();", "sale", "N", 60*60*24*4, "", "Y");
	}

}
return true;
?>
예제 #25
0
파일: options.php 프로젝트: nProfessor/Mytb
	{
		COption::RemoveOption($module_id);
	}
	else
	{
		COption::SetOptionString("socialservices", "use_on_sites", serialize($_POST["use_on_sites"]));
		foreach($arSiteList as $site)
		{
			$sendTwit = 'N';
			$allowAuthorization = 'N';
			$suffix = ($site <> ''? '_bx_site_'.$site:'');
			$siteId = ($site <> '' ? $site : SITE_ID);

			COption::SetOptionString("socialservices", "auth_services".$suffix, serialize($_POST["AUTH_SERVICES".$suffix]));
			COption::SetOptionString("socialservices", "twitter_search_hash".$suffix, $_POST["twitter_search_hash".$suffix]);
			CAgent::RemoveAgent("CSocServAuthManager::GetTwitMessages($siteId);", "socialservices");
			if($_POST["allow_socserv_authorization".$suffix] == 'Y')
				$allowAuthorization = 'Y';
			COption::SetOptionString("socialservices", "allow_socserv_authorization".$suffix, $allowAuthorization);
			if($_POST["send_message_to_twitter".$suffix] == 'Y')
			{
				$sendTwit = 'Y';
				CAgent::AddAgent("CSocServAuthManager::GetTwitMessages($site);", "socialservices", "N", 60, "", "Y", "");
			}

			COption::SetOptionString("socialservices", "send_message_to_twitter".$suffix, $sendTwit);
			foreach($arOptions as $option)
			{
				if(is_array($option))
					$option[0] .= $suffix;
				__AdmSettingsSaveOption($module_id, $option);
예제 #26
0
             if ($ex = $GLOBALS["APPLICATION"]->GetException()) {
                 $errorMessage .= $ex->GetString() . ".<br>";
             } else {
                 $errorMessage .= "Unknown error." . "<br>";
             }
         }
     }
     if (strlen($errorMessage) <= 0) {
         $dbAgents = CAgent::GetList(array(), array("NAME" => "CCrmExternalSaleImport::DataSync(" . intval($res) . ");", "MODULE_ID" => "crm"));
         if ($arAgent = $dbAgents->Fetch()) {
             if ($arResult["BP"]["DATA_SYNC_PERIOD"] > 0) {
                 if ($arAgent["ACTIVE"] != "Y" || intval($arAgent["AGENT_INTERVAL"] / 60) != $arResult["BP"]["DATA_SYNC_PERIOD"]) {
                     CAgent::Update($arAgent["ID"], array("ACTIVE" => "Y", "AGENT_INTERVAL" => 60 * $arResult["BP"]["DATA_SYNC_PERIOD"]));
                 }
             } else {
                 CAgent::RemoveAgent("CCrmExternalSaleImport::DataSync(" . intval($res) . ");", "crm");
             }
         } else {
             if ($arResult["BP"]["DATA_SYNC_PERIOD"] > 0) {
                 CAgent::AddAgent("CCrmExternalSaleImport::DataSync(" . intval($res) . ");", "crm", "N", 60 * $arResult["BP"]["DATA_SYNC_PERIOD"]);
             }
         }
         if (isset($_POST['apply'])) {
             LocalRedirect(CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_EDIT"], array("id" => intval($res))));
         }
         LocalRedirect(CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_SYNC"], array("id" => intval($res))));
         //LocalRedirect($arResult["PATH_TO_INDEX"]);
     } else {
         $arResult["ErrorMessage"] .= $errorMessage;
     }
 }
예제 #27
0
 public static function ClearAgent()
 {
     global $CACHE_MANAGER;
     $CACHE_MANAGER->Clean("pull_cnr");
     if (self::ModuleEnable()) {
         CAgent::AddAgent("CPullChannel::CheckOnlineChannel();", "pull", "N", 100, "", "Y", ConvertTimeStamp(time() + CTimeZone::GetOffset() + 100, "FULL"));
         CAgent::AddAgent("CPullChannel::CheckExpireAgent();", "pull", "N", 43200, "", "Y", ConvertTimeStamp(time() + CTimeZone::GetOffset() + 43200, "FULL"));
         CAgent::AddAgent("CPullStack::CheckExpireAgent();", "pull", "N", 86400, "", "Y", ConvertTimeStamp(time() + CTimeZone::GetOffset() + 86400, "FULL"));
         CAgent::AddAgent("CPullWatch::CheckExpireAgent();", "pull", "N", 600, "", "Y", ConvertTimeStamp(time() + CTimeZone::GetOffset() + 600, "FULL"));
     } else {
         CAgent::RemoveAgent("CPullChannel::CheckOnlineChannel();", "pull");
         CAgent::RemoveAgent("CPullChannel::CheckExpireAgent();", "pull");
         CAgent::RemoveAgent("CPullStack::CheckExpireAgent();", "pull");
         CAgent::RemoveAgent("CPullWatch::CheckExpireAgent();", "pull");
         CAgent::RemoveAgent("CPushManager::SendAgent();", "pull");
     }
 }
예제 #28
0
     $arOptions[] = array("shared_kernel_path", GetMessage("CTRLR_OPTIONS_SHARED_KERNEL_PATH"), "", array("text", 50));
 }
 $aTabs = array(array("DIV" => "edit1", "TAB" => GetMessage("MAIN_TAB_SET"), "ICON" => "main_settings", "TITLE" => GetMessage("MAIN_TAB_TITLE_SET")), array("DIV" => "edit3", "TAB" => GetMessage("MAIN_TAB_RIGHTS"), "ICON" => "main_settings", "TITLE" => GetMessage("MAIN_TAB_TITLE_RIGHTS")));
 $tabControl = new CAdminTabControl("tabControl", $aTabs);
 if ($REQUEST_METHOD == "POST" && strlen($Update . $Apply . $RestoreDefaults) > 0 && $M_RIGHT >= "W" && check_bitrix_sessid()) {
     if (strlen($RestoreDefaults) > 0) {
         COption::RemoveOption("controller");
         $z = CGroup::GetList($v1 = "id", $v2 = "asc", array("ACTIVE" => "Y", "ADMIN" => "N"));
         while ($zr = $z->Fetch()) {
             $APPLICATION->DelGroupRight($module_id, array($zr["ID"]));
         }
     } else {
         $prev_group_update_time = COption::GetOptionInt("controller", "group_update_time");
         __AdmSettingsSaveOptions("controller", $arOptions);
         if ($prev_group_update_time != COption::GetOptionInt("controller", "group_update_time")) {
             CAgent::RemoveAgent("CControllerGroup::CheckDefaultUpdate();", "controller");
             if (COption::GetOptionInt("controller", "group_update_time") > 0) {
                 CAgent::AddAgent("CControllerGroup::CheckDefaultUpdate();", "controller", "N", COption::GetOptionInt("controller", "group_update_time") * 60);
             }
         }
     }
     $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"]);
         }
예제 #29
0
파일: log.php 프로젝트: ASDAFF/bxApiDocs
	public static function SendEvent($ID, $mailTemplate = "SONET_NEW_EVENT", $tmp_id = false, $bAgent = false, $bTransport = false)
	{
		$ID = IntVal($ID);
		if ($ID <= 0)
			return false;

		if (intval($tmp_id) > 0)
			$arFilter = array("ID" => $tmp_id);
		else
			$arFilter = array("ID" => $ID);

		$dbLog = CSocNetLog::GetList(
			array(),
			$arFilter,
			false,
			false,
			array("ID", "ENTITY_TYPE", "ENTITY_ID", "USER_ID", "USER_NAME", "USER_LAST_NAME", "USER_SECOND_NAME", "USER_LOGIN", "EVENT_ID", "LOG_DATE", "TITLE_TEMPLATE", "TITLE", "MESSAGE", "TEXT_MESSAGE", "URL", "MODULE_ID", "CALLBACK_FUNC", "SITE_ID", "PARAMS", "SOURCE_ID", "GROUP_NAME", "CREATED_BY_NAME", "CREATED_BY_SECOND_NAME", "CREATED_BY_LAST_NAME", "CREATED_BY_LOGIN", "LOG_SOURCE_ID"),
			array("MIN_ID_JOIN" => true)
		);
		$arLog = $dbLog->Fetch();
		if (!$arLog)
			return $bAgent;

		if (MakeTimeStamp($arLog["LOG_DATE"]) > (time() + CTimeZone::GetOffset()))
		{
			$agent = "CSocNetLog::SendEventAgent(".$ID.", '".$mailTemplate."', ".($tmp_id ? $tmp_id : 'false').");";
			$rsAgents = CAgent::GetList(array("ID"=>"DESC"), array("NAME" => $agent));
			if(!$rsAgents->Fetch())
			{
				$res = CAgent::AddAgent($agent, "socialnetwork", "N", 0, $arLog["LOG_DATE"], "Y", $arLog["LOG_DATE"]);
				if(!$res)
					$GLOBALS["APPLICATION"]->ResetException();
			}
			elseif ($bAgent)
			{
				CAgent::RemoveAgent($agent, "socialnetwork");
				CAgent::AddAgent($agent, "socialnetwork", "N", 0, $arLog["LOG_DATE"], "Y", $arLog["LOG_DATE"]);
				return true;
			}
			return false;
		}

		$arEvent = CSocNetLogTools::FindLogEventByID($arLog["EVENT_ID"], $arLog["ENTITY_TYPE"]);
		if (
			$arEvent
			&& array_key_exists("CLASS_FORMAT", $arEvent)
			&& array_key_exists("METHOD_FORMAT", $arEvent)
		)
		{
			$dbSiteCurrent = CSite::GetByID(SITE_ID);
			if ($arSiteCurrent = $dbSiteCurrent->Fetch())
				if ($arSiteCurrent["LANGUAGE_ID"] != LANGUAGE_ID)
					$arLog["MAIL_LANGUAGE_ID"] = $arSiteCurrent["LANGUAGE_ID"];

			$arLog["FIELDS_FORMATTED"] = call_user_func(array($arEvent["CLASS_FORMAT"], $arEvent["METHOD_FORMAT"]), $arLog, array(), true);
		}

		if (
			array_key_exists($arLog["ENTITY_TYPE"], $GLOBALS["arSocNetAllowedSubscribeEntityTypesDesc"])
			&& array_key_exists("HAS_MY", $GLOBALS["arSocNetAllowedSubscribeEntityTypesDesc"][$arLog["ENTITY_TYPE"]])
			&& $GLOBALS["arSocNetAllowedSubscribeEntityTypesDesc"][$arLog["ENTITY_TYPE"]]["HAS_MY"] == "Y"
			&& array_key_exists("CLASS_OF", $GLOBALS["arSocNetAllowedSubscribeEntityTypesDesc"][$arLog["ENTITY_TYPE"]])
			&& array_key_exists("METHOD_OF", $GLOBALS["arSocNetAllowedSubscribeEntityTypesDesc"][$arLog["ENTITY_TYPE"]])
			&& strlen($GLOBALS["arSocNetAllowedSubscribeEntityTypesDesc"][$arLog["ENTITY_TYPE"]]["CLASS_OF"]) > 0
			&& strlen($GLOBALS["arSocNetAllowedSubscribeEntityTypesDesc"][$arLog["ENTITY_TYPE"]]["METHOD_OF"]) > 0
			&& method_exists($GLOBALS["arSocNetAllowedSubscribeEntityTypesDesc"][$arLog["ENTITY_TYPE"]]["CLASS_OF"], $GLOBALS["arSocNetAllowedSubscribeEntityTypesDesc"][$arLog["ENTITY_TYPE"]]["METHOD_OF"])
		)
			$arOfEntities = call_user_func(array($GLOBALS["arSocNetAllowedSubscribeEntityTypesDesc"][$arLog["ENTITY_TYPE"]]["CLASS_OF"], $GLOBALS["arSocNetAllowedSubscribeEntityTypesDesc"][$arLog["ENTITY_TYPE"]]["METHOD_OF"]), $arLog["ENTITY_ID"]);

		if ($bTransport)
		{
			$arListParams = array(
				"USE_SUBSCRIBE" => "Y",
				"ENTITY_TYPE" => $arLog["ENTITY_TYPE"],
				"ENTITY_ID" => $arLog["ENTITY_ID"],
				"EVENT_ID" => $arLog["EVENT_ID"],
				"USER_ID" => $arLog["USER_ID"],
				"OF_ENTITIES" => $arOfEntities,
				"TRANSPORT" => array("M", "X")
			);

			$arLogSites = array();
			$rsLogSite = CSocNetLog::GetSite($ID);

			while($arLogSite = $rsLogSite->Fetch())
				$arLogSites[] = $arLogSite["LID"];

			if (CModule::IncludeModule("extranet"))
			{
				$arSites = array();
				$dbSite = CSite::GetList($by="sort", $order="desc", array("ACTIVE" => "Y"));
				while($arSite = $dbSite->Fetch())
					$arSites[$arSite["ID"]] = array(
						"DIR" => (strlen(trim($arSite["DIR"])) > 0 ? $arSite["DIR"] : "/"),
						"SERVER_NAME" => (strlen(trim($arSite["SERVER_NAME"])) > 0 ? $arSite["SERVER_NAME"] : COption::GetOptionString("main", "server_name", $_SERVER["HTTP_HOST"]))
					);

				$extranet_site_id = CExtranet::GetExtranetSiteID();
				$intranet_site_id = CSite::GetDefSite();

				$arIntranetUsers = CExtranet::GetIntranetUsers();
			}

			$dbSubscribers = CSocNetLogEvents::GetList(
				array("TRANSPORT" => "DESC"),
				array(
					"USER_ACTIVE" => "Y",
					"SITE_ID" => array_merge($arLogSites, array(false))
				),
				false,
				false,
				array("USER_ID", "SITE_ID", "ENTITY_TYPE", "ENTITY_ID", "ENTITY_CB", "ENTITY_MY", "USER_NAME", "USER_LAST_NAME", "USER_LOGIN", "USER_LID", "USER_EMAIL", "TRANSPORT"),
				$arListParams
			);

			$arListParams = array(
				"USE_SUBSCRIBE" => "Y",
				"ENTITY_TYPE" => $arLog["ENTITY_TYPE"],
				"ENTITY_ID" => $arLog["ENTITY_ID"],
				"EVENT_ID" => $arLog["EVENT_ID"],
				"USER_ID" => $arLog["USER_ID"],
				"OF_ENTITIES" => $arOfEntities,
				"TRANSPORT" => "N"
			);

			$dbUnSubscribers = CSocNetLogEvents::GetList(
				array("TRANSPORT" => "DESC"),
				array(
					"USER_ACTIVE" => "Y",
					"SITE_ID" => array_merge($arLogSites, array(false))
				),
				false,
				false,
				array("USER_ID", "SITE_ID", "ENTITY_TYPE", "ENTITY_ID", "ENTITY_CB", "ENTITY_MY", "TRANSPORT", "EVENT_ID"),
				$arListParams
			);

			$arUnSubscribers = array();
			while ($arUnSubscriber = $dbUnSubscribers->Fetch())
				$arUnSubscribers[] = $arUnSubscriber["USER_ID"]."_".$arUnSubscriber["ENTITY_TYPE"]."_".$arUnSubscriber["ENTITY_ID"]."_".$arUnSubscriber["ENTITY_MY"]."_".$arUnSubscriber["ENTITY_CB"]."_".$arUnSubscriber["EVENT_ID"];

			$bHasAccessAll = CSocNetLogRights::CheckForUserAll($arLog["ID"]);

			$arSentUserID = array("M" => array(), "X" => array());
			while ($arSubscriber = $dbSubscribers->Fetch())
			{
				if (
					is_array($arIntranetUsers)
					&& !in_array($arSubscriber["USER_ID"], $arIntranetUsers)
					&& !in_array($extranet_site_id, $arLogSites)
				)
					continue;

				if (
					array_key_exists($arSubscriber["TRANSPORT"], $arSentUserID)
					&& in_array($arSubscriber["USER_ID"], $arSentUserID[$arSubscriber["TRANSPORT"]])
				)
					continue;

				if (
					intval($arSubscriber["ENTITY_ID"]) != 0
					&& $arSubscriber["EVENT_ID"] == "all"
					&&
					(
						in_array($arSubscriber["USER_ID"]."_".$arSubscriber["ENTITY_TYPE"]."_".$arSubscriber["ENTITY_ID"]."_N_".$arSubscriber["ENTITY_CB"]."_".$arLog["EVENT_ID"], $arUnSubscribers)
						|| in_array($arSubscriber["USER_ID"]."_".$arSubscriber["ENTITY_TYPE"]."_".$arSubscriber["ENTITY_ID"]."_Y_".$arSubscriber["ENTITY_CB"]."_".$arLog["EVENT_ID"], $arUnSubscribers)
					)
				)
					continue;
				elseif (
					intval($arSubscriber["ENTITY_ID"]) == 0
					&& $arSubscriber["ENTITY_CB"] == "N"
					&& $arSubscriber["EVENT_ID"] != "all"
					&&
					(
						in_array($arSubscriber["USER_ID"]."_".$arSubscriber["ENTITY_TYPE"]."_".$arLog["ENTITY_ID"]."_Y_N_all", $arUnSubscribers)
						|| in_array($arSubscriber["USER_ID"]."_".$arSubscriber["ENTITY_TYPE"]."_".$arLog["ENTITY_ID"]."_N_N_all", $arUnSubscribers)
						|| in_array($arSubscriber["USER_ID"]."_".$arSubscriber["ENTITY_TYPE"]."_".$arLog["ENTITY_ID"]."_Y_N_".$arLog["EVENT_ID"], $arUnSubscribers)
						|| in_array($arSubscriber["USER_ID"]."_".$arSubscriber["ENTITY_TYPE"]."_".$arLog["ENTITY_ID"]."_N_N_".$arLog["EVENT_ID"], $arUnSubscribers)
					)
				)
					continue;

				$arSentUserID[$arSubscriber["TRANSPORT"]][] = $arSubscriber["USER_ID"];

				if (!$bHasAccessAll)
				{
					$bHasAccess = CSocNetLogRights::CheckForUserOnly($arLog["ID"], $arSubscriber["USER_ID"]);
					if (!$bHasAccess)
						continue;
				}

				if (CModule::IncludeModule("extranet"))
				{
					$server_name = $arSites[((!in_array($arSubscriber["USER_ID"], $arIntranetUsers) && $extranet_site_id) ? $extranet_site_id : $intranet_site_id)]["SERVER_NAME"];
					$arLog["FIELDS_FORMATTED"]["EVENT_FORMATTED"]["URL_TO_SEND"] = str_replace(
						array("#SERVER_NAME#", "#GROUPS_PATH#"),
						array(
							$server_name,
							COption::GetOptionString("socialnetwork", "workgroups_page", false, ((!in_array($arSubscriber["USER_ID"], $arIntranetUsers) && $extranet_site_id) ? $extranet_site_id : $intranet_site_id))
						),
						$arLog["FIELDS_FORMATTED"]["EVENT_FORMATTED"]["URL"]
					);
					$arLog["FIELDS_FORMATTED"]["EVENT_FORMATTED"]["MESSAGE_TO_SEND"] = str_replace(
						array("#SERVER_NAME#", "#GROUPS_PATH#"),
						array(
							$server_name,
							COption::GetOptionString("socialnetwork", "workgroups_page", false, ((!in_array($arSubscriber["USER_ID"], $arIntranetUsers) && $extranet_site_id) ? $extranet_site_id : $intranet_site_id))
						),
						$arLog["FIELDS_FORMATTED"]["EVENT_FORMATTED"]["MESSAGE"]
					);
				}
				else
					$arLog["FIELDS_FORMATTED"]["EVENT_FORMATTED"]["MESSAGE_TO_SEND"] = $arLog["FIELDS_FORMATTED"]["EVENT_FORMATTED"]["MESSAGE"];

				switch ($arSubscriber["TRANSPORT"])
				{
					case "X":

						if (
							array_key_exists("URL_TO_SEND", $arLog["FIELDS_FORMATTED"]["EVENT_FORMATTED"])
							&& strlen($arLog["FIELDS_FORMATTED"]["EVENT_FORMATTED"]["URL_TO_SEND"]) > 0
						)
							$link = GetMessage("SONET_GL_SEND_EVENT_LINK").$arLog["FIELDS_FORMATTED"]["EVENT_FORMATTED"]["URL_TO_SEND"];
						elseif (
							array_key_exists("URL", $arLog["FIELDS_FORMATTED"]["EVENT_FORMATTED"])
							&& strlen($arLog["FIELDS_FORMATTED"]["EVENT_FORMATTED"]["URL"]) > 0
						)
							$link = GetMessage("SONET_GL_SEND_EVENT_LINK").$arLog["FIELDS_FORMATTED"]["EVENT_FORMATTED"]["URL"];
						else
							$link = "";

						$arMessageFields = array(
							"FROM_USER_ID" => (intval($arLog["USER_ID"]) > 0 ? $arLog["USER_ID"] : 1),
							"TO_USER_ID" => $arSubscriber["USER_ID"],
							"MESSAGE" => $arLog["FIELDS_FORMATTED"]["EVENT_FORMATTED"]["TITLE"]." #BR#".$arLog["FIELDS_FORMATTED"]["EVENT_FORMATTED"]["MESSAGE_TO_SEND"].(strlen($link) > 0 ? "#BR# ".$link : ""),
							"=DATE_CREATE" => $GLOBALS["DB"]->CurrentTimeFunction(),
							"MESSAGE_TYPE" => SONET_MESSAGE_SYSTEM,
							"IS_LOG" => "Y"
						);
						CSocNetMessages::Add($arMessageFields);
						break;
					case "M":
						$arFields["SUBSCRIBER_ID"] = $arSubscriber["USER_ID"];
						$arFields["SUBSCRIBER_NAME"] = $arSubscriber["USER_NAME"];
						$arFields["SUBSCRIBER_LAST_NAME"] = $arSubscriber["USER_LAST_NAME"];
						$arFields["SUBSCRIBER_LOGIN"] = $arSubscriber["USER_LOGIN"];
						$arFields["SUBSCRIBER_EMAIL"] = $arSubscriber["USER_EMAIL"];
						$arFields["EMAIL_TO"] = $arSubscriber["USER_EMAIL"];
						$arFields["TITLE"] = str_replace("#BR#", "\n", $arLog["FIELDS_FORMATTED"]["EVENT_FORMATTED"]["TITLE"]);
						$arFields["MESSAGE"] = str_replace("#BR#", "\n", $arLog["FIELDS_FORMATTED"]["EVENT_FORMATTED"]["MESSAGE_TO_SEND"]);
						$arFields["ENTITY"] = $arLog["FIELDS_FORMATTED"]["ENTITY"]["FORMATTED"];
						$arFields["ENTITY_TYPE"] = $arLog["FIELDS_FORMATTED"]["ENTITY"]["TYPE_MAIL"];

						if (
							array_key_exists("URL_TO_SEND", $arLog["FIELDS_FORMATTED"]["EVENT_FORMATTED"])
							&& strlen($arLog["FIELDS_FORMATTED"]["EVENT_FORMATTED"]["URL_TO_SEND"]) > 0
						)
							$arFields["URL"] = $arLog["FIELDS_FORMATTED"]["EVENT_FORMATTED"]["URL_TO_SEND"];
						elseif (
							array_key_exists("URL", $arLog["FIELDS_FORMATTED"]["EVENT_FORMATTED"])
							&& strlen($arLog["FIELDS_FORMATTED"]["EVENT_FORMATTED"]["URL"]) > 0
						)
							$arFields["URL"] = $arLog["FIELDS_FORMATTED"]["EVENT_FORMATTED"]["URL"];
						else
							$arFields["URL"] = $arLog["URL"];

						if (CModule::IncludeModule("extranet"))
							$arUserGroup = CUser::GetUserGroup($arSubscriber["USER_ID"]);

						foreach ($arLogSites as $site_id_tmp)
						{
							if (IsModuleInstalled("extranet"))
							{
								if (
									(
										CExtranet::IsExtranetSite($site_id_tmp)
										&& in_array(CExtranet::GetExtranetUserGroupID(), $arUserGroup)
									)
									||
									(
										!CExtranet::IsExtranetSite($site_id_tmp)
										&& !in_array(CExtranet::GetExtranetUserGroupID(), $arUserGroup)
									)
								)
								{
									$siteID = $site_id_tmp;
									break;
								}
								else
									continue;
							}
							else
							{
								$siteID = $site_id_tmp;
								break;
							}
						}

						if (!$siteID)
							$siteID = (defined("SITE_ID") ? SITE_ID : $arSubscriber["SITE_ID"]);

						if (StrLen($siteID) <= 0)
							$siteID = $arSubscriber["USER_LID"];
						if (StrLen($siteID) <= 0)
							continue;

						$event = new CEvent;
						$event->Send($mailTemplate, $siteID, $arFields, "N");
						break;
					default:
				}
			}
		}

		CSocNetLog::CounterIncrement($arLog["ID"], $arLog["EVENT_ID"], $arOfEntities);

		return true;
	}
예제 #30
0
파일: session.php 프로젝트: rasuldev/torino
 public static function deactivate()
 {
     COption::SetOptionString("security", "session", "N");
     CAgent::RemoveAgent(self::GC_AGENT_NAME, "security");
 }