function UnInstallDB($arParams = array()) { global $DB, $APPLICATION; $errors = null; if (CModule::IncludeModule("socialnetwork")) { $dbLog = CSocNetLog::GetList(array(), array("ENTITY_TYPE" => array("R", "T"), "EVENT_ID" => array("timeman_entry", "report")), false, false, array("ID")); while ($arLog = $dbLog->Fetch()) { CSocNetLog::Delete($arLog["ID"]); } } if (true == array_key_exists("savedata", $arParams) && $arParams["savedata"] != 'Y') { $errors = $DB->RunSQLBatch($_SERVER["DOCUMENT_ROOT"] . '/bitrix/modules/' . $this->MODULE_ID . '/install/db/' . strtolower($DB->type) . '/uninstall.sql'); if (!empty($errors)) { $APPLICATION->ThrowException(implode("", $errors)); return false; } $this->UnInstallTasks(); } UnRegisterModuleDependences('socialnetwork', 'OnFillSocNetLogEvents', 'timeman', 'CReportNotifications', 'AddEvent'); UnRegisterModuleDependences('socialnetwork', 'OnFillSocNetAllowedSubscribeEntityTypes', 'timeman', 'CReportNotifications', 'OnFillSocNetAllowedSubscribeEntityTypes'); UnRegisterModuleDependences('socialnetwork', 'OnFillSocNetLogEvents', 'timeman', 'CTimeManNotify', 'OnFillSocNetLogEvents'); UnRegisterModuleDependences('socialnetwork', 'OnFillSocNetAllowedSubscribeEntityTypes', 'timeman', 'CTimeManNotify', 'OnFillSocNetAllowedSubscribeEntityTypes'); UnRegisterModuleDependences("im", "OnGetNotifySchema", "timeman", "CTimemanNotifySchema", "OnGetNotifySchema"); UnRegisterModuleDependences('main', 'OnAfterUserUpdate', 'timeman', 'CTimeManNotify', 'OnAfterUserUpdate'); UnRegisterModuleDependences('main', 'OnAfterUserUpdate', 'timeman', 'CReportNotifications', 'OnAfterUserUpdate'); UnRegisterModule($this->MODULE_ID); return true; }
function UnInstallDB($arParams = array()) { global $DB, $DBType, $APPLICATION; $this->errors = false; CModule::IncludeModule("sender"); \Bitrix\Sender\TriggerManager::activateAllHandlers(false); if (!array_key_exists("save_tables", $arParams) || $arParams["save_tables"] != "Y") { $this->errors = $DB->RunSQLBatch($_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/sender/install/db/" . $DBType . "/uninstall.sql"); } CAgent::RemoveModuleAgents('sender'); UnRegisterModuleDependences("main", "OnMailEventMailRead", "sender", "bitrix\\sender\\postingmanager", "onMailEventMailRead"); UnRegisterModuleDependences("main", "OnMailEventMailClick", "sender", "bitrix\\sender\\postingmanager", "onMailEventMailClick"); UnRegisterModuleDependences("main", "OnMailEventSubscriptionDisable", "sender", "Bitrix\\Sender\\Subscription", "onMailEventSubscriptionDisable"); UnRegisterModuleDependences("main", "OnMailEventSubscriptionEnable", "sender", "Bitrix\\Sender\\Subscription", "onMailEventSubscriptionEnable"); UnRegisterModuleDependences("main", "OnMailEventSubscriptionList", "sender", "Bitrix\\Sender\\Subscription", "onMailEventSubscriptionList"); UnRegisterModuleDependences("sender", "OnConnectorList", "sender", "bitrix\\sender\\connectormanager", "onConnectorListContact"); UnRegisterModuleDependences("sender", "OnConnectorList", "sender", "bitrix\\sender\\connectormanager", "onConnectorListRecipient"); UnRegisterModuleDependences("sender", "OnPresetTemplateList", "sender", "Bitrix\\Sender\\Preset\\TemplateBase", "onPresetTemplateList"); UnRegisterModuleDependences("sender", "OnPresetTemplateList", "sender", "Bitrix\\Sender\\TemplateTable", "onPresetTemplateList"); UnRegisterModuleDependences("sender", "OnPresetMailBlockList", "sender", "Bitrix\\Sender\\Preset\\MailBlockBase", "OnPresetMailBlockList"); UnRegisterModuleDependences("sender", "OnPresetTemplateList", "sender", "Bitrix\\Sender\\Preset\\TemplateBase", "onPresetTemplateListSite"); UnRegisterModuleDependences("sender", "OnTriggerList", "sender", "bitrix\\sender\\triggermanager", "onTriggerList"); UnRegisterModuleDependences("sender", "OnAfterRecipientUnsub", "sender", "Bitrix\\Sender\\TriggerManager", "onAfterRecipientUnsub"); UnRegisterModuleDependences("sender", "OnAfterRecipientClick", "sender", "Bitrix\\Sender\\Internals\\ConversionHandler", "onAfterRecipientClick"); UnRegisterModuleDependences("conversion", "OnSetDayContextAttributes", "sender", "Bitrix\\Sender\\Internals\\ConversionHandler", "onSetDayContextAttributes"); UnRegisterModuleDependences("main", "OnBeforeProlog", "sender", "Bitrix\\Sender\\Internals\\ConversionHandler", "onBeforeProlog"); UnRegisterModuleDependences("conversion", "OnGetAttributeTypes", "sender", "Bitrix\\Sender\\Internals\\ConversionHandler", "onGetAttributeTypes"); UnRegisterModule("sender"); if ($this->errors !== false) { $APPLICATION->ThrowException(implode("<br>", $this->errors)); return false; } return true; }
/** * [addPriceProducts description] * @param array $arParams * @return bool */ protected function addPriceProducts($arParams){ if (!CModule::IncludeModule("iblock") && !CModule::IncludeModule("catalog") && !CModule::IncludeModule("sale")): return false; endif; $PRICE_TYPE_ID = 1; // идентификатор типы базовой цены $arFields = Array( "PRODUCT_ID" => $arParams["PRODUCT_ID"], "CATALOG_GROUP_ID" => $PRICE_TYPE_ID, "PRICE" => $arParams["OLD_PRICE"], "CURRENCY" => "RUB", "QUANTITY_FROM" => 1, ); $res = CPrice::GetList( array(), array( "PRODUCT_ID" => $arParams["PRODUCT_ID"], "CATALOG_GROUP_ID" => $PRICE_TYPE_ID ) ); if ($arr = $res->Fetch()): if (!CPrice::Update($arr["ID"], $arFields)): return false; endif; else: if (!CPrice::Add($arFields)): return false; endif; endif; if (!$this->addCatalogProducts($arParams)): return false; endif; return true; }
function UnInstallDB($arParams = array()) { global $DB, $DBType, $APPLICATION; $this->errors = false; if (!array_key_exists("save_tables", $arParams) || $arParams["save_tables"] != "Y") { // remove user data CModule::IncludeModule("highloadblock"); $result = \Bitrix\Highloadblock\HighloadBlockTable::getList(); while ($hldata = $result->fetch()) { \Bitrix\Highloadblock\HighloadBlockTable::delete($hldata['ID']); } // remove hl system data $this->errors = $DB->RunSQLBatch($_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/highloadblock/install/db/" . strtolower($DB->type) . "/uninstall.sql"); } UnRegisterModule("highloadblock"); UnRegisterModuleDependences("main", "OnBeforeUserTypeAdd", "highloadblock", '\\Bitrix\\Highloadblock\\HighloadBlockTable', "OnBeforeUserTypeAdd"); UnRegisterModuleDependences("main", "OnAfterUserTypeAdd", "highloadblock", '\\Bitrix\\Highloadblock\\HighloadBlockTable', "onAfterUserTypeAdd"); UnRegisterModuleDependences("main", "OnBeforeUserTypeDelete", "highloadblock", '\\Bitrix\\Highloadblock\\HighloadBlockTable', "OnBeforeUserTypeDelete"); UnRegisterModuleDependences('main', 'OnUserTypeBuildList', 'highloadblock', 'CUserTypeHlblock', 'GetUserTypeDescription'); UnRegisterModuleDependences('iblock', 'OnIBlockPropertyBuildList', 'highloadblock', 'CIBlockPropertyDirectory', 'GetUserTypeDescription'); if ($this->errors !== false) { $APPLICATION->ThrowException(implode("<br>", $this->errors)); return false; } return true; }
function InstallDB() { global $DB, $APPLICATION; $this->errors = false; if (!$DB->Query("SELECT 'x' FROM b_seo_keywords", true)) { $this->errors = $DB->RunSQLBatch($_SERVER['DOCUMENT_ROOT'] . "/bitrix/modules/seo/install/db/" . strtolower($DB->type) . "/install.sql"); } if ($this->errors !== false) { $APPLICATION->ThrowException(implode("", $this->errors)); return false; } RegisterModule("seo"); require_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/seo/install/tasks/install.php"; RegisterModuleDependences('main', 'OnPanelCreate', 'seo', 'CSeoEventHandlers', 'SeoOnPanelCreate'); if (COption::GetOptionString('seo', 'searchers_list', '') == '' && CModule::IncludeModule('statistic')) { $arFilter = array('ACTIVE' => 'Y', 'NAME' => 'Google|MSN|Bing', 'NAME_EXACT_MATCH' => 'Y'); if (COption::GetOptionString('main', 'vendor') == '1c_bitrix') { $arFilter['NAME'] .= '|Yandex'; } $strSearchers = ''; $dbRes = CSearcher::GetList($by = 's_id', $order = 'asc', $arFilter, $is_filtered); while ($arRes = $dbRes->Fetch()) { $strSearchers .= ($strSearchers == '' ? '' : ',') . $arRes['ID']; } COption::SetOptionString('seo', 'searchers_list', $strSearchers); } return true; }
public function Execute() { if (!CModule::IncludeModule("socialnetwork")) { return CBPActivityExecutionStatus::Closed; } $rootActivity = $this->GetRootActivity(); $documentId = $rootActivity->GetDocumentId(); $ownerId = CBPHelper::ExtractUsers($this->OwnerId, $documentId, true); $users = array_unique(CBPHelper::ExtractUsers($this->Users, $documentId, false)); $dbSubjects = CSocNetGroupSubject::GetList(array("SORT" => "ASC", "NAME" => "ASC"), array("SITE_ID" => SITE_ID), false, false, array("ID")); $row = $dbSubjects->fetch(); if (!$row) { $this->WriteToTrackingService(GetMessage("BPCWG_ERROR_SUBJECT_ID")); return CBPActivityExecutionStatus::Closed; } $subjectId = $row['ID']; unset($dbSubjects, $row); $options = array("SITE_ID" => SITE_ID, "NAME" => $this->GroupName, "VISIBLE" => "Y", "OPENED" => "N", "CLOSED" => "N", "SUBJECT_ID" => $subjectId, "INITIATE_PERMS" => SONET_ROLES_OWNER, "SPAM_PERMS" => SONET_ROLES_USER); $groupId = CSocNetGroup::CreateGroup($ownerId, $options); if (!$groupId) { $this->WriteToTrackingService(GetMessage("BPCWG_ERROR_CREATE_GROUP")); return CBPActivityExecutionStatus::Closed; } $this->GroupId = $groupId; foreach ($users as $user) { if ($user == $ownerId) { continue; } CSocNetUserToGroup::Add(array("USER_ID" => $user, "GROUP_ID" => $groupId, "ROLE" => SONET_ROLES_USER, "=DATE_CREATE" => $GLOBALS["DB"]->CurrentTimeFunction(), "=DATE_UPDATE" => $GLOBALS["DB"]->CurrentTimeFunction(), "INITIATED_BY_TYPE" => SONET_INITIATED_BY_GROUP, "INITIATED_BY_USER_ID" => $ownerId, "MESSAGE" => false)); } return CBPActivityExecutionStatus::Closed; }
public static function execute() { global $USER; $result = array(); $error = false; if (!CModule::IncludeModule('voximplant')) { $error = 'Module voximplant is not installed.'; } else { if (!is_object($USER) || !$USER->IsAuthorized()) { $error = GetMessage('ACCESS_DENIED'); } else { if (!CVoxImplantMain::CheckAccess()) { $error = GetMessage('ACCESS_DENIED'); } else { if (!check_bitrix_sessid()) { $error = GetMessage('ACCESS_DENIED'); } else { if ($_REQUEST["act"] == "edit") { $result = self::executeEditPhones($error); } else { if ($_REQUEST["act"] == "getInfo") { $result = self::executeGetInfo($error); } else { if ($_REQUEST["act"] == "option") { $result = self::executeSaveOption($error); } } } } } } } self::returnJson(array_merge(array('result' => $error === false ? 'ok' : 'error', 'error' => CharsetConverter::ConvertCharset($error, SITE_CHARSET, 'UTF-8')), $result)); }
function createSmartFilterSeoXML() { if (CModule::IncludeModule("iblock")) { $resElDB = CIBlockElement::GetList(array("SORT" => "ASC"), array('IBLOCK_ID' => SEO_IBLOCK), false, false, array('PROPERTY_TARGET_ON', 'PROPERTY_INDEX', 'PROPERTY_FOLLOW', 'IBLOCK_ID', 'ID', 'NAME')); $protocol = CMain::IsHTTPS() ? "https" : "http"; $host = $_SERVER['HTTP_HOST']; if ($_SERVER['SERVER_PORT'] != 80 && $_SERVER['SERVER_PORT'] != 443 && $_SERVER['SERVER_PORT'] > 0 && strpos($_SERVER['HTTP_HOST'], ":") === false) { $host .= ":" . $_SERVER['SERVER_PORT']; } $curDate = date("Y-m-d\\TH:i:s P"); $strBeginSmartFilter = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<urlset xmlns=\"http://www.sitemaps.org/schemas/sitemap/0.9\">\n"; $index = 0; while ($res = $resElDB->fetch()) { $exp = explode('*', $res['PROPERTY_TARGET_ON_VALUE']['TEXT']); $urlFilter = trim($exp[0]); //clean url of smart filter if ($index == 0) { $strBeginSmartFilter .= "\t<url>\n\t\t"; $index++; } else { $strBeginSmartFilter .= "<url>\n\t\t"; } $strBeginSmartFilter .= "<loc>" . $protocol . "://" . $host . $urlFilter . "</loc>\n\t\t"; $strBeginSmartFilter .= "<lastmod>" . $curDate . "</lastmod>\n\t"; $strBeginSmartFilter .= "</url>"; } $strBeginSmartFilter .= "</urlset\n>"; $smartXmlFileName = 'sitemap_iblock_' . SEO_IBLOCK . '.xml'; $el = fopen($_SERVER['DOCUMENT_ROOT'] . '/' . $smartXmlFileName, "w"); fwrite($el, $strBeginSmartFilter); fclose($el); return "createSmartFilterSeoXML();"; } }
public static function GetUserWorkflowTaskCount($workflowIDs, $userID = 0) { if (!is_array($workflowIDs)) { return 0; } if (!(IsModuleInstalled('bizproc') && CModule::IncludeModule('bizproc'))) { return 0; } $userID = intval($userID); if ($userID <= 0) { $userID = CCrmSecurityHelper::GetCurrentUserID(); } $filter = array('USER_ID' => $userID); $workflowQty = count($workflowIDs); if ($workflowQty > 1) { //IMPORTANT: will produce SQL error due to CBPTaskService::GetList bug //$filter['@WORKFLOW_ID'] = $workflowIDs; $filter['WORKFLOW_ID'] = $workflowIDs[0]; } /*elseif($workflowQty === 1) { $filter['WORKFLOW_ID'] = $workflowIDs[0]; }*/ $result = CBPTaskService::GetList(array(), $filter, array(), false, array()); return is_int($result) ? $result : 0; }
public function Execute() { if (!CModule::IncludeModule("intranet")) { return CBPActivityExecutionStatus::Closed; } $absenceIblockId = COption::GetOptionInt("intranet", 'iblock_absence', 0); if ($absenceIblockId <= 0) { return CBPActivityExecutionStatus::Closed; } $rootActivity = $this->GetRootActivity(); $documentId = $rootActivity->GetDocumentId(); $documentService = $this->workflow->GetService("DocumentService"); $arAbsenceUserTmp = $this->AbsenceUser; $arAbsenceUser = CBPHelper::ExtractUsers($arAbsenceUserTmp, $documentId, false); $arAbsenceTypes = array(); $dbTypeRes = CIBlockPropertyEnum::GetList(array("SORT" => "ASC", "VALUE" => "ASC"), array('IBLOCK_ID' => $absenceIblockId, 'PROPERTY_ID' => 'ABSENCE_TYPE')); while ($arTypeValue = $dbTypeRes->GetNext()) { $arAbsenceTypes[$arTypeValue['XML_ID']] = $arTypeValue['ID']; } foreach ($arAbsenceUser as $absenceUser) { $arFields = array("ACTIVE" => "Y", "IBLOCK_ID" => $absenceIblockId, 'ACTIVE_FROM' => $this->AbsenceFrom, 'ACTIVE_TO' => $this->AbsenceTo, "NAME" => $this->AbsenceName, "PREVIEW_TEXT" => $this->AbsenceDesrc, "PREVIEW_TEXT_TYPE" => "text", "PROPERTY_VALUES" => array("USER" => $absenceUser, "STATE" => $this->AbsenceState, "FINISH_STATE" => $this->AbsenceFinishState, "ABSENCE_TYPE" => $arAbsenceTypes[$this->AbsenceType])); $el = new CIBlockElement(); $el->Add($arFields); } return CBPActivityExecutionStatus::Closed; }
function Request($server, $page, $port, $method, $namespace, $login, $password, $arParams) { if (!CModule::IncludeModule("webservice")) { return false; } global $APPLICATION; $client = new CSOAPClient($server, $page, $port); $client->setLogin($login); $client->setPassword($password); $request = new CSOAPRequest($method, $namespace, $arParams); $response = $client->send($request); if (is_object($response) && $response->isFault()) { if (XDI_XML_ERROR_DEBUG) { CXDImport::WriteToLog("ERROR: Incorrect webservice response. Raw response: " . $client->getRawResponse(), "RXML"); } return false; } else { if (XDI_XML_DEBUG) { CXDImport::WriteToLog("Successfull webservice response. Raw response: " . $client->getRawResponse(), "RXML"); } if (is_object($response)) { return $response->Value; } else { return false; } } }
function CheckPermission() { if (!CModule::IncludeModule('wiki') || !CWikiUtils::IsReadable()) { return false; } return true; }
function __construct($component = null) { parent::__construct($component); CModule::IncludeModule('iblock'); CModule::IncludeModule('aqw.shop'); CBitrixComponent::includeComponentClass('aqw:store.product'); }
public function __construct() { $this->config = json_decode(file_get_contents(BFactory::getDir() . '/config/block.json')); $this->setLanguage($this->config->languages->default); CModule::IncludeModule("iblock"); CModule::AddAutoloadClasses('', array('BitrixAdapterBlockPrototype' => '/bitrixadapter/core/prototype.php')); }
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; } }
/** * @param int $idUserFrom * @param int $idUserTo * @param string $title * @param string $type * @param string $idQuestion * @param string $textMessage * @return int */ public static function sendMes($idUserFrom = 1, $idUserTo = 1, $title, $idQuestion, $textMessage = "", $type = "P") { $res = false; $senderUserID = $idUserFrom; $targetUserID = $idUserTo; $arFieldsMes = array("FROM_USER_ID" => $senderUserID, "TO_USER_ID" => $targetUserID, "TITLE" => $title, "MESSAGE" => $idQuestion, "DATE_CREATE" => date("d.m.Y H:i:s", time() - DIFFERENT_WITH_MOSCOW_TIME), "DATE_VIEW" => false, "MESSAGE_TYPE" => $type, "FROM_DELETED" => "N", "TO_DELETED" => "N", "SEND_MAIL" => "Y"); if (CModule::IncludeModule("socialnetwork")) { $res = CSocNetMessages::Add($arFieldsMes); if ($res) { if (CModule::IncludeModule("iblock")) { if (CModule::IncludeModule('payments')) { $userInfo = new CLawPayment(); $InfoUserFrom = $userInfo->userInfo($idUserFrom); $InfoUserTo = $userInfo->userInfo($idUserTo); $emailFrom = $InfoUserFrom["EMAIL"]; $emailUser = $InfoUserTo["EMAIL"]; SendMessage::sendMessOnEmail($emailFrom, $emailUser, $title, $textMessage); } } } else { $errorMessage = ""; if ($err = $GLOBALS["APPLICATION"]->GetException()) { $errorMessage = $err->GetString(); } if (StrLen($errorMessage) <= 0) { $errorMessage = GetMessage("SONET_UR_ERROR_CREATE_MESSAGE"); } $GLOBALS["APPLICATION"]->ThrowException($errorMessage, "ERROR_CREATE_MESSAGE"); } } return $res; }
function OnSearchGetURL($arFields) { global $DB, $BX_NEWS_DETAIL_URL, $BX_NEWS_SECTION_URL; static $arIBlockCache = array(); if ($arFields["MODULE_ID"] !== "iblock" || substr($arFields["URL"], 0, 1) !== "=") { return $arFields["URL"]; } if (!CModule::IncludeModule('iblock')) { return ""; } $IBLOCK_ID = IntVal($arFields["PARAM2"]); if (!array_key_exists($IBLOCK_ID, $arIBlockCache)) { $res = $DB->Query("\n\t\t\t\tSELECT\n\t\t\t\t\tDETAIL_PAGE_URL,\n\t\t\t\t\tSECTION_PAGE_URL,\n\t\t\t\t\tCODE as IBLOCK_CODE,\n\t\t\t\t\tXML_ID as IBLOCK_EXTERNAL_ID,\n\t\t\t\t\tIBLOCK_TYPE_ID\n\t\t\t\tFROM\n\t\t\t\t\tb_iblock\n\t\t\t\tWHERE ID = " . $IBLOCK_ID . "\n\t\t\t"); $arIBlockCache[$IBLOCK_ID] = $res->Fetch(); } if (!is_array($arIBlockCache[$IBLOCK_ID])) { return ""; } $arFields["URL"] = LTrim($arFields["URL"], " ="); parse_str($arFields["URL"], $arr); $arr = $arIBlockCache[$IBLOCK_ID] + $arr; $arr["LANG_DIR"] = $arFields["DIR"]; if (substr($arFields["ITEM_ID"], 0, 1) !== 'S') { return CIBlock::ReplaceDetailUrl($BX_NEWS_DETAIL_URL, $arr, true, "E"); } else { return CIBlock::ReplaceDetailUrl($BX_NEWS_SECTION_URL, $arr, true, "S"); } }
/** * ’эндлер, отслеживающий изменени¤ в инфоблоках * @param $arFields * @return bool */ static function getCradoBaners() { //$arResult = array(); CModule::IncludeModule('iblock'); global $DB; $result = $DB->Query('SELECT * FROM b_cradobaners'); $arResult = array(); $i = 0; while ($res = $result->fetch()) { $arResult[$i]['ID'] = $res['ID']; $arResult[$i]['COUNT_CLICK'] = $res['UF_COUNTCLICK']; $arResult[$i]['COUNT_VIEW'] = $res['UF_COUNTVIEW']; $arResult[$i]['DATE_LAST_CLICK'] = $res['UF_DATECLICK']; $obElement = CIBlockElement::GetByID($res['UF_IDBANERS']); if ($arEl = $obElement->GetNext()) { //$arResult[$i]['BANNER'] = $arEl; $arResult[$i]['BANNER']['ID'] = $arEl['ID']; $arResult[$i]['BANNER']['NAME'] = $arEl['NAME']; //Баннер в категории if ($arEl['PREVIEW_PICTURE'] != '') { $arResult[$i]['BANNER']['BANNER_CATEGORY'] = CFile::ResizeImageGet($arEl['PREVIEW_PICTURE'], array('width' => 140, 'height' => 95), BX_RESIZE_IMAGE_PROPORTIONAL, true); } if ($arEl['DETAIL_PICTURE'] != '') { $arResult[$i]['BANNER']['BANNER_ELEMENT'] = CFile::ResizeImageGet($arEl['DETAIL_PICTURE'], array('width' => 82, 'height' => 140), BX_RESIZE_IMAGE_PROPORTIONAL, true); } } $i++; } return $arResult; }
public static function GetPropertiesDialog($documentType, $activityName, $arWorkflowTemplate, $arWorkflowParameters, $arWorkflowVariables, $arCurrentValues = null, $formName = '') { if (!CModule::IncludeModule('crm')) { return false; } $runtime = CBPRuntime::GetRuntime(); $arMap = array('EventType' => 'event_type', 'EventText' => 'event_text'); if (!is_array($arWorkflowParameters)) { $arWorkflowParameters = array(); } if (!is_array($arWorkflowVariables)) { $arWorkflowVariables = array(); } if (!is_array($arCurrentValues)) { $arCurrentActivity =& CBPWorkflowTemplateLoader::FindActivityByName($arWorkflowTemplate, $activityName); if (is_array($arCurrentActivity['Properties'])) { foreach ($arMap as $k => $v) { if (array_key_exists($k, $arCurrentActivity['Properties'])) { $arCurrentValues[$arMap[$k]] = $arCurrentActivity['Properties'][$k]; } else { $arCurrentValues[$arMap[$k]] = ''; } } } else { foreach ($arMap as $k => $v) { $arCurrentValues[$arMap[$k]] = ''; } } } return $runtime->ExecuteResourceFile(__FILE__, 'properties_dialog.php', array('arCurrentValues' => $arCurrentValues, 'arTypes' => CCrmStatus::GetStatusList('EVENT_TYPE'), 'formName' => $formName)); }
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; } }
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; } }
function InitStep() { global $DB; $wizard =& $this->GetWizard(); $node_id = intval($wizard->GetVar('node_id')); if (!CModule::IncludeModule('cluster')) { $this->SetError(GetMessage('CLUWIZ_NO_MODULE_ERROR')); } elseif ($DB->type != "MYSQL") { $this->SetError(GetMessage('CLUWIZ_DATABASE_NOT_SUPPORTED')); } elseif ($node_id <= 1) { $this->SetError(GetMessage('CLUWIZ_NO_NODE_ERROR')); } else { $this->arNode = CClusterDBNode::GetByID($node_id); if (!is_array($this->arNode)) { $this->SetError(GetMessage('CLUWIZ_NO_NODE_ERROR')); } else { // $arNode["ROLE_ID"] == "SLAVE" // $arNode["STATUS"] == "READY" $this->nodeDB = CDatabase::GetDBNodeConnection($this->arNode["ID"], true, false); if (!is_object($this->nodeDB)) { $this->SetError(GetMessage('CLUWIZ_NO_CONN_ERROR')); } } } }
/** * Method will be invoked after an database record updated. * * @param array $oldRecord All fields before update. * @param array $newRecord All fields after update. * * @return void */ public static function afterUpdateTrigger(array $oldRecord, array $newRecord) { if ($oldRecord['TITLE'] !== $newRecord['TITLE']) { if (\CModule::IncludeModule("pull")) { $ar = \CIMChat::GetRelationById($newRecord['CHAT_ID']); foreach ($ar as $rel) { \CIMContactList::CleanChatCache($rel['USER_ID']); \CPullStack::AddByUser($rel['USER_ID'], array('module_id' => 'im', 'command' => 'chatRename', 'params' => array('chatId' => $newRecord['CHAT_ID'], 'chatTitle' => htmlspecialcharsbx($newRecord['TITLE'])))); } } } if ($oldRecord['AVATAR'] !== $newRecord['AVATAR']) { if (\CModule::IncludeModule('pull')) { $avatarImage = \CIMChat::GetAvatarImage($newRecord['AVATAR']); $ar = \CIMChat::GetRelationById($newRecord['CHAT_ID']); foreach ($ar as $relation) { \CIMContactList::CleanChatCache($relation['USER_ID']); \CPullStack::AddByUser($relation['USER_ID'], array('module_id' => 'im', 'command' => 'chatAvatar', 'params' => array('chatId' => $newRecord['CHAT_ID'], 'chatAvatar' => $avatarImage))); } } } if ($oldRecord['COLOR'] !== $newRecord['COLOR']) { if (\CModule::IncludeModule('pull')) { $ar = \CIMChat::GetRelationById($newRecord['CHAT_ID']); foreach ($ar as $relation) { \CIMContactList::CleanChatCache($relation['USER_ID']); \CPullStack::AddByUser($relation['USER_ID'], array('module_id' => 'im', 'command' => 'chatChangeColor', 'params' => array('chatId' => $newRecord['CHAT_ID'], 'chatColor' => \Bitrix\Im\Color::getColor($newRecord['COLOR'])))); } } } }
/** * Удаление остатков привязанных к каталогу * * @param int $ID - идентификатор удаляемого элемента */ public function OnIBlockElementDelete($ID) { global $APPLICATION; if(!CModule::IncludeModule("iblock")) return; $rs = CIBlockElement::GetList( array(), array("IBLOCK_ID" => REMAINS_IBLOCK_ID, "PROPERTY_ELEMENT_ID" => $ID), false, false, array("ID", "IBLOCK_ID")); while($ar = $rs -> Fetch()) CIBlockElement::Delete($ar["ID"]); $rs = CIBlockElement::GetList( array(), array("IBLOCK_ID" => REMAINS_IBLOCK_ID, "PROPERTY_ELEMENT_ID" => $ID), false, false, array("ID", "IBLOCK_ID")); if($rs -> SelectedRowsCount()) return false; return true; }
public static function GetList($arSort=array(), $arFilter=array(), $arNavParams=false, $arUserField) { $rs = false; if(\CModule::IncludeModule("statistic")) { $arAliases = array("ID" => "CITY_ID", "NAME" => "CITY_NAME"); $ob = new \CCity(); $rs = new CUserTypeLocationEnum($ob->GetList( static::__makeArrayFromAlias($arSort, $arAliases), static::__makeArrayFromAlias($arFilter, $arAliases) )); // getlist is not supported pagenavigation yet if(is_array($arNavParams) && is_set($arNavParams, "nTopCount")) { $arr = array(); while($ar = $rs->Fetch()) { if(count($arr) >= intval($arNavParams["nTopCount"])) break; $arr[] = $ar; } $rs = new CUserTypeLocationEnum(); $rs->InitFromArray($arr); } } return $rs; }
public static function Notify($addresseeID, $internalMessage, $externalMessage, $schemeTypeID, $tag = '') { self::ClearErrors(); if (!(IsModuleInstalled('im') && CModule::IncludeModule('im'))) { self::RegisterError('IM module is not installed.'); return false; } if ($addresseeID <= 0) { self::RegisterError('Addressee is not assigned.'); return false; } $arMessage = array('TO_USER_ID' => $addresseeID, 'FROM_USER_ID' => 0, 'NOTIFY_TYPE' => IM_NOTIFY_SYSTEM, 'NOTIFY_MODULE' => 'crm', 'NOTIFY_MESSAGE' => strval($internalMessage), 'NOTIFY_MESSAGE_OUT' => strval($externalMessage)); $schemeTypeName = CCrmNotifierSchemeType::ResolveName($schemeTypeID); if ($schemeTypeName !== '') { $arMessage['NOTIFY_EVENT'] = $schemeTypeName; } $tag = strval($tag); if ($tag !== '') { $arMessage['NOTIFY_TAG'] = $tag; } $msgID = CIMNotify::Add($arMessage); if (!$msgID) { $e = $GLOBALS['APPLICATION']->GetException(); $errorMessage = $e ? $e->GetString() : 'Unknown sending error. message not send.'; self::RegisterError($errorMessage); return false; } return true; }
function CSeoPageChecker($site, $url, $get = true, $check_errors = true) { global $APPLICATION; if (CModule::IncludeModule('search')) { $this->bSearch = true; } else { $APPLICATION->ThrowException(GetMessage('SEO_ERROR_NO_SEARCH')); } // don't return false or set bError! $this->__bCheckErrors = $check_errors; $this->__site = $site; $dbRes = CSite::GetByID($this->__site); if ($arRes = $dbRes->Fetch()) { $this->__lang = $arRes['LANGUAGE_ID']; $this->__server_name = $arRes['SERVER_NAME']; if (strlen($this->__server_name) <= 0) { $this->__server_name = COption::GetOptionString('main', 'server_name', ''); } if (strlen($this->__server_name) > 0) { $this->__url = 'http://' . $this->__server_name . $url; return $get ? $this->GetHTTPData() : true; } else { $this->bError = true; $APPLICATION->ThrowException(str_replace('#SITE_ID#', $this->__site, GetMessage('SEO_ERROR_NO_SERVER_NAME'))); return false; } } return false; }
public function Execute() { if (!CModule::IncludeModule("socialnetwork")) { CBPActivityExecutionStatus::Closed; } $rootActivity = $this->GetRootActivity(); $documentId = $rootActivity->GetDocumentId(); $documentService = $this->workflow->GetService("DocumentService"); $document = $documentService->GetDocument($documentId); $entityType = $this->EntityType; if ($entityType == "user") { $entityType = SONET_ENTITY_USER; } elseif ($entityType == "group") { $entityType = SONET_ENTITY_GROUP; } $USER_ID = false; if ($GLOBALS["USER"]->IsAuthorized()) { $USER_ID = $GLOBALS["USER"]->GetID(); } $logID = CSocNetLog::Add(array("ENTITY_TYPE" => $entityType, "ENTITY_ID" => $this->EntityId, "EVENT_ID" => $this->Event, "=LOG_DATE" => $GLOBALS["DB"]->CurrentTimeFunction(), "TITLE_TEMPLATE" => $this->LogTitle, "TITLE" => $document["NAME"], "MESSAGE" => nl2br($this->LogText), "TEXT_MESSAGE" => $this->LogText, "URL" => $documentService->GetDocumentAdminPage($documentId), "MODULE_ID" => false, "CALLBACK_FUNC" => false, "USER_ID" => $USER_ID), false); if (intval($logID > 0)) { CSocNetLog::Update($logID, array("TMP_ID" => $logID)); } CSocNetLog::SendEvent($logID, "SONET_NEW_EVENT", $logID); return CBPActivityExecutionStatus::Closed; }
public function __construct($aOptions = array(), $mParent = null) { parent::__construct($aOptions, $mParent); if (!CModule::IncludeModule('iblock')) { throw new Exception('IBlock Module must be installed!'); } }
function InstallDB() { global $APPLICATION, $DB, $errors; if (!$DB->Query("SELECT 'x' FROM b_adv_banner", true)) { $EMPTY = "Y"; } else { $EMPTY = "N"; } if ($EMPTY == "Y") { $errors = $DB->RunSQLBatch($_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/advertising/install/db/" . strtolower($DB->type) . "/install.sql"); if (!empty($errors)) { $APPLICATION->ThrowException(implode("", $errors)); return false; } } RegisterModule("advertising"); RegisterModuleDependences("main", "OnBeforeProlog", "advertising"); RegisterModuleDependences("main", "OnEndBufferContent", "advertising", "CAdvBanner", "FixShowAll"); RegisterModuleDependences("main", "OnBeforeRestartBuffer", "advertising", "CAdvBanner", "BeforeRestartBuffer"); CAgent::AddAgent("CAdvContract::SendInfo();", "advertising", "N", 7200); CAgent::AddAgent("CAdvBanner::CleanUpDynamics();", "advertising", "N", 86400); if ($EMPTY == "Y") { CModule::IncludeModule('advertising'); $arSites = array(); $rs = CSite::GetList($b = "sort", $o = "asc"); while ($ar = $rs->Fetch()) { $arSites[] = $ar['ID']; } $ac = new CAdvContract(); $arFields = array('ACTIVE' => 'Y', 'NAME' => 'Default', 'SORT' => 10000, 'DESCRIPTION' => 'all site without any restrictions', 'EMAIL_COUNT' => 1, 'arrTYPE' => array('ALL'), 'arrWEEKDAY' => array('MONDAY' => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23), 'SATURDAY' => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23), 'SUNDAY' => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23), 'THURSDAY' => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23), 'TUESDAY' => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23), 'WEDNESDAY' => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23), 'FRIDAY' => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23)), 'arrSITE' => $arSites); $ac->Set($arFields, 0, 'N'); } return true; }