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; }
public function getConfiguredDomains() { $result = array(); $converter = CBXPunycode::GetConverter(); $domainName = COption::GetOptionString("main", "server_name", ""); if ($domainName != "") { $result[$domainName] = $domainName; } $by = ""; $order = ""; $siteList = CSite::GetList($by, $order, array("ACTIVE" => "Y")); while ($site = $siteList->Fetch()) { $domains = explode("\r\n", $site["DOMAINS"]); foreach ($domains as $domainName) { if ($domainName != "") { $punyName = $converter->Encode($domainName); if ($punyName !== false) { $result[$punyName] = $domainName; } } } } ksort($result); return $result; }
/** * Creates events for sending e-mail. * @return bool */ public static function installEvents() { $dbEvent = \CEventMessage::GetList($b = "ID", $order = "ASC", array("EVENT_NAME" => "SALE_EBAY_ERROR")); if (!$dbEvent->Fetch()) { $langs = \CLanguage::GetList($b = "", $o = ""); while ($lang = $langs->Fetch()) { $lid = $lang["LID"]; $obEventType = new \CEventType(); $obEventType->Add(array("EVENT_NAME" => "SALE_EBAY_ERROR", "NAME" => Loc::getMessage("SALE_EBAY_HLP_EVNT_TYPE_ERROR"), "LID" => $lid, "DESCRIPTION" => "\n\t\t\t\t\t#ERROR_TYPE# - " . Loc::getMessage("SALE_EBAY_HLP_EVNT_TYPE_ERROR_TYPE") . "\n\t\t\t\t\t#ERROR_DETAILS# - " . Loc::getMessage("SALE_EBAY_HLP_EVNT_TYPE_ERROR_DETAIL") . "\n\t\t\t\t\t#EMAIL_FROM# - " . Loc::getMessage("SALE_EBAY_HLP_EVNT_TYPE_FROM") . "\n\t\t\t\t\t#EMAIL_TO# - " . Loc::getMessage("SALE_EBAY_HLP_EVNT_TYPE_TO") . "\n\t\t\t\t\t#BCC# - " . Loc::getMessage("SALE_EBAY_HLP_EVNT_TYPE_BCC"))); $arSites = array(); $sites = \CSite::GetList($b = "", $o = "", array("LANGUAGE_ID" => $lid)); while ($site = $sites->Fetch()) { $arSites[] = $site["LID"]; } if (count($arSites) > 0) { $arr = array(); $arr["ACTIVE"] = "Y"; $arr["EVENT_NAME"] = "SALE_EBAY_ERROR"; $arr["LID"] = $arSites; $arr["EMAIL_FROM"] = "#DEFAULT_EMAIL_FROM#"; $arr["EMAIL_TO"] = "#EMAIL_TO#"; $arr["BCC"] = "#BCC#"; $arr["SUBJECT"] = "#SITE_NAME# " . Loc::getMessage("SALE_EBAY_EVNT_MSG_SBUJ']") . "."; $arr["BODY_TYPE"] = "text"; $arr["MESSAGE"] = Loc::getMessage("SALE_EBAY_EVNT_MSG_INFO_SITE") . " #SITE_NAME#.\n\n" . Loc::getMessage("SALE_EBAY_EVNT_MSG") . ":\n\n" . "#ERROR_TYPE#\n\n" . "#ERROR_DETAILS#"; $obTemplate = new \CEventMessage(); $obTemplate->Add($arr); } } } return true; }
function DoInstall() { global $APPLICATION, $USER, $step, $arSitesList; if ($USER->IsAdmin()) { $arSitesList = array(); $rsSites = CSite::GetList($by = "sort", $order = "desc", array()); while ($arSite = $rsSites->Fetch()) { $arSitesList[$arSite['ID']] = $arSite['NAME']; } $step = IntVal($step); if ($step < 2) { $APPLICATION->IncludeAdminFile(GetMessage("CONTENT_INCLUDER_MODULE_INSTALL_TITLE") . $this->MODULE_ID, $this->sModuleInstallFullPath . "step1.php"); } elseif ($step == 2) { RegisterModule($this->MODULE_ID); RegisterModuleDependences("main", "OnEndBufferContent", $this->MODULE_ID, '\\Bit\\Includer\\Handlers', "OnEndBufferContentHandler"); RegisterModuleDependences("fileman", "OnIncludeHTMLEditorScript", $this->MODULE_ID, '\\Bit\\Includer\\Handlers', "OnIncludeHTMLEditorScriptHandler"); $this->InstallFiles(); $sSiteId = array_key_exists($_REQUEST['site_id'], $arSitesList) ? $_REQUEST['site_id'] : SITE_ID; if ($_REQUEST['install_sample_iblock'] === "Y") { $this->createSampleIblock($sSiteId); } if ($_REQUEST['disable_new_editor'] === "Y") { COption::setOptionString("fileman", "use_editor_3", ""); } COption::SetOptionString("bit.includer", "include_jquery", $_REQUEST['include_jquery_for_component'] === "Y" ? "Y" : "N"); $APPLICATION->IncludeAdminFile(GetMessage("CONTENT_INCLUDER_MODULE_INSTALL_TITLE"), $this->sModuleInstallFullPath . "step2.php"); } } }
function CreateWizardIndex($wizardName, &$errorMessage) { $indexContent = '<' . '?' . 'define("WIZARD_DEFAULT_SITE_ID", "' . (defined("WIZARD_DEFAULT_SITE_ID") ? WIZARD_DEFAULT_SITE_ID : "s1") . '");' . 'require(' . '$' . '_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/main/include/prolog_before.php");' . 'require_once(' . '$' . '_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/main/classes/general/wizard.php");' . '$' . 'wizard = new CWizard("' . $wizardName . '");' . '$' . 'wizard->Install();' . 'require($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/main/include/epilog_after.php");' . '?' . '>'; $p = $_SERVER["DOCUMENT_ROOT"] . "/index.php"; if (defined("WIZARD_DEFAULT_SITE_ID")) { $rsSite = CSite::GetList($by = "sort", $order = "asc", array("ID" => WIZARD_DEFAULT_SITE_ID)); $arSite = $rsSite->GetNext(); $p = CSite::GetSiteDocRoot($arSite["LID"]) . $arSite["DIR"] . "/index.php"; } $handler = @fopen($p, "wb"); if (!$handler) { $errorMessage = InstallGetMessage("INST_WIZARD_INDEX_ACCESS_ERROR"); return false; } $success = @fwrite($handler, $indexContent); if (!$success) { $errorMessage = InstallGetMessage("INST_WIZARD_INDEX_ACCESS_ERROR"); return false; } if (defined("BX_FILE_PERMISSIONS")) { @chmod($_SERVER["DOCUMENT_ROOT"] . "/index.php", BX_FILE_PERMISSIONS); } fclose($handler); return true; }
function ShowStep() { CModule::IncludeModule("currency"); $arSites = array(); //$dbSite = CSite::GetList($b="SORT", $o="ASC", Array("ACTIVE"=>"Y", "ID"=>"ru")); $dbSite = CSite::GetList($b = "SORT", $o = "ASC", array("ACTIVE" => "Y")); while ($arSite = $dbSite->Fetch()) { $arSites[$arSite["ID"]] = $arSite["NAME"]; if ($arSite["DEF"] == "Y") { $defSite = $arSite["ID"]; } } /*if(empty($arSites)) { $dbSite = CSite::GetList($b="SORT", $o="ASC", Array("ACTIVE"=>"Y", "ID"=>"s1")); while($arSite = $dbSite -> Fetch()) { $arSites[$arSite["ID"]] = $arSite["NAME"]; if($arSite["DEF"]=="Y") $defSite = $arSite["ID"]; } }*/ $this->content = "<link rel=\"stylesheet\" type=\"text/css\" href=\"/bitrix/wizards/bitrix/sale.install/styles.css\">"; $this->content .= GetMessage("WW_STEP1_1") . '<br /><table class="data-table">'; $this->content .= "<tr><th>" . GetMessage("WW_STEP1_2") . ":</th><td>" . $this->ShowSelectField("siteID", $arSites) . "</td></tr>"; $this->content .= "<tr><th>" . GetMessage("WW_STEP1_3") . "</th><td>" . $this->ShowInputField("text", "orderEmail", array("size" => "20")) . "</td></tr>"; $this->content .= "<tr><th>" . GetMessage("WW_STEP1_4") . "</th><td>" . $this->ShowInputField("text", "saveBasket", array("size" => "10")) . "</td></tr>"; $dbCurrency = CCurrency::GetList($b = "SORT", $o = "ASC"); while ($arCurrency = $dbCurrency->Fetch()) { $arCurrencies[$arCurrency["CURRENCY"]] = $arCurrency["CURRENCY"] . " (" . $arCurrency["FULL_NAME"] . ")"; } $this->content .= "<tr><th>" . GetMessage("WW_STEP1_5") . "</th><td>" . $this->ShowSelectField("currencyID", $arCurrencies) . "</td></tr>"; $this->content .= "</table>"; }
function UnInstallDB($arParams = array()) { global $DB, $APPLICATION; $this->errors = false; if (!array_key_exists("savedata", $arParams) || $arParams["savedata"] != "Y") { $this->errors = $DB->RunSQLBatch($_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/meeting/install/db/" . strtolower($DB->type) . "/uninstall.sql"); if ($this->errors === false && CModule::IncludeModule('forum')) { $dbRes = CSite::GetList($by = 'sort', $order = 'asc', array()); while ($arSite = $dbRes->Fetch()) { $forumId = COption::GetOptionInt('meeting', 'comments_forum_id', 0, $arSite['ID']); if ($forumId > 0) { CForumNew::Delete($forumId); } } } } UnRegisterModuleDependences("calendar", "OnAfterCalendarConvert", "meeting", "CMeetingEventHandlers", "OnAfterCalendarConvert"); UnRegisterModuleDependences("tasks", "OnTaskDelete", "meeting", "CMeetingEventHandlers", "OnTaskDelete"); UnRegisterModule("meeting"); if ($this->errors !== false) { $APPLICATION->ThrowException(implode("<br>", $this->errors)); return false; } return true; }
function Fetch() { static $arSite = array(); $r = parent::Fetch(); if ($r) { $site_id = $r["SITE_ID"]; if (!isset($arSite[$site_id])) { $rsSite = CSite::GetList($b, $o, array("ID" => $site_id)); $arSite[$site_id] = $rsSite->Fetch(); } $r["DIR"] = $arSite[$site_id]["DIR"]; $r["SERVER_NAME"] = $arSite[$site_id]["SERVER_NAME"]; if (strlen($r["SITE_URL"]) > 0) { $r["URL"] = $r["SITE_URL"]; } if (substr($r["URL"], 0, 1) == "=") { foreach (GetModuleEvents("search", "OnSearchGetURL", true) as $arEvent) { $r["URL"] = ExecuteModuleEventEx($arEvent, array($r)); } } $r["URL"] = str_replace(array("#LANG#", "#SITE_DIR#", "#SERVER_NAME#"), array($r["DIR"], $r["DIR"], $r["SERVER_NAME"]), $r["URL"]); $r["URL"] = preg_replace("'(?<!:)/+'s", "/", $r["URL"]); unset($r["SITE_URL"]); } return $r; }
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; }
public function Load() { global $USER; if (!isset($_SESSION["SESS_AUTH"]["USER_ID"]) || !$_SESSION["SESS_AUTH"]["USER_ID"]) { $USER = new CUser(); } $this->isLogged = true; $defaultSite = CSite::GetList($by = "def", $order = "desc", array())->Fetch(); $this->encodingDefault = $defaultSite["CHARSET"]; $this->PrepareSettings(); $this->fp = $this->PrepareFile($this->filename . '.tmp'); if ($this->isLogged) { $this->fpLog = $this->PrepareFile($this->logFile); $this->WriteLog("Start Loading"); } $this->PreWriteCatalog(); $categories = $this->GetCategories(); $this->WriteCategories($categories); $this->PreWriteOffers(); $this->BuildOffers($categories); $this->PostWriteOffers(); $this->PostWriteCatalog(); if ($this->isLogged) { $this->WriteLog("Loading was ended successfully (peek memory usage: " . memory_get_peak_usage() . ")"); } $this->CloseFile($this->fp); $this->CloseFile($this->fpLog); unlink($_SERVER["DOCUMENT_ROOT"] . $this->filename); rename($_SERVER["DOCUMENT_ROOT"] . $this->filename . '.tmp', $_SERVER["DOCUMENT_ROOT"] . $this->filename); return true; }
private function fetchSites() { if (!isset($this->sites)) { $res = \CSite::GetList(); self::$sites = $res->arResult; } }
function InstallDB($arParams = array()) { RegisterModuleDependences('main', 'OnBuildGlobalMenu', self::MODULE_ID, 'CIpdesignK', 'OnBuildGlobalMenu'); $arsites = array(); $rsSites = CSite::GetList($by="sort", $order="desc", false); while ($arSite = $rsSites->Fetch()){ $arsites[] = $arSite['ID']; } $arFilter = array( "TYPE_ID" => "SENDWISHLIST", ); $rsET = CEventType::GetList($arFilter); $arET = $rsET->Fetch(); if(empty($arET)){ $et = new CEventType; $arMessageFields = array("USER_ID" => $UserProduct['USER']['ID'], "USER_NAME" => $UserProduct['USER']["NAME"].' '.$UserProduct['USER']["LAST_NAME"], "USER_EMAIL" => $UserProduct['USER']["EMAIL"], "PRODUCTS_LIST" => $strListProduct); $DESCRIPTION = '#USER_ID# - '.GetMessage("IT_BASKET_SENDER_USER_ID"); $DESCRIPTION .= '\n#USER_NAME# - '.GetMessage("IT_BASKET_SENDER_USER_NAME"); $DESCRIPTION .= '\n#USER_EMAIL# - '.GetMessage("IT_BASKET_SENDER_USER_EMAIL"); $DESCRIPTION .= '\n#PRODUCTS_LIST# - '.GetMessage("IT_BASKET_SENDER_PRODUCTS_LIST"); $sendType = $et->Add(array( "LID" => 'ru', "EVENT_NAME" => "SENDWISHLIST", "NAME" => GetMessage("IT_SENDER_TYPE_NAME"), "DESCRIPTION" => $DESCRIPTION )); }else{ $sendType = $arET['ID']; } $rsMess = CEventMessage::GetList($by="site_id", $order="desc", array('TYPE' => 'SENDWISHLIST')); $arMess = $rsMess->Fetch(); if(empty($arMess)){ $message = ''; $message .= '<h2>'.GetMessage("IT_BASKET_SENDER_TEMPLATE_HELLO").',#USER_NAME#</h2>'; $message .= '<p>'.GetMessage("IT_BASKET_SENDER_TEMPLATE_WHISHLIST").'</p>'; $message .= '<hr />'; $message .= '#PRODUCTS_LIST#'; $arFields = array("ACTIVE" => 'Y', "EVENT_NAME" => "SENDWISHLIST", "LID" => $arsites, "EMAIL_FROM" => "#DEFAULT_EMAIL_FROM#", "EMAIL_TO" => "#USER_EMAIL#", "BCC" => "", "MESSAGE" => $message, "BODY_TYPE" => "html", "SUBJECT" => GetMessage("IT_SENDER_MESSAGE_SUBJECT"). " #SERVER_NAME# ", ); $emess = new CEventMessage; if($emess->Add($arFields)){ } }; RegisterModuleDependences("sale", "OnCondSaleActionsControlBuildList", self::MODULE_ID, "CSaleActionCtrlBasketMain", "GetControlDescr"); RegisterModuleDependences("main", "OnBeforeProlog", "main", "", "", 110, '/modules/ipdesign.k1785/itdiscount.php'); return true; }
function InstallOptions(){ $rSites = CSite::GetList($by="sort", $order="desc", array() ); while( $aSite = $rSites->Fetch() ){ $aSites[$aSite['NAME'].' '.$aSite['ID']] = $aSite['ID']; }; COption::SetOptionString('tagsmanager', 'SITE_ID', implode( ',',$aSites )); return true; }
public static function getSites() { $ss = array(); $dbs = CSite::GetList($b = "sort", $o = "desc"); while ($s = $dbs->Fetch()) { $ss[] = $s["LID"]; } return $ss; }
/** * @return array Возвращает список сайтов */ function getSiteList() { $arSites = array(); $rsSites = CSite::GetList($by = 'sort', $order = 'asc', array()); while ($arRes = $rsSites->GetNext()) { $arSites[] = array('ID' => $arRes['ID'], 'NAME' => $arRes['NAME']); } return $arSites; }
/** * @param MailPackage $package * @param bool $duplicate * @return int */ public function send(MailPackage $package, $duplicate = false) { $rsSites = \CSite::GetList($by = "sort", $order = "desc", array()); $siteIds = array(); while ($arSite = $rsSites->Fetch()) { $siteIds[] = $arSite['ID']; } return \CEvent::Send($package->getEventName(), $siteIds, $package->getFields(), $duplicate ? 'Y' : 'N', $package->getMessageId()); }
function CreateTemplateMailEvent() { $rsSites = CSite::GetList($by = "sort", $order = "desc", array()); while ($arSite = $rsSites->Fetch()) { $oEventMessage = new CEventMessage(); $oEventMessage->Add(array("ACTIVE" => "Y", "EVENT_NAME" => "STALL_EMAIL", "LID" => $arSite["ID"], "EMAIL_FROM" => "#DEFAULT_EMAIL_FROM#", "EMAIL_TO" => "#EMAIL#", "SUBJECT" => GetMessage("STALL_CREATE_TEMPLATE_SUBJECT"), "MESSAGE" => GetMessage("STALL_CREATE_TEMPLATE_MESSAGE"), "BODY_TYPE" => "html")); $oEventMessage->Add(array("ACTIVE" => "Y", "EVENT_NAME" => "STALL_EMAIL", "LID" => $arSite["ID"], "EMAIL_FROM" => "#DEFAULT_EMAIL_FROM#", "EMAIL_TO" => "#MANAGER_EMAIL#", "SUBJECT" => GetMessage("STALL_CREATE_TEMPLATE_SUBJECT_MANAGER"), "MESSAGE" => GetMessage("STALL_CREATE_TEMPLATE_MESSAGE_MANAGER"), "BODY_TYPE" => "html")); $oEventMessage->Add(array("ACTIVE" => "Y", "EVENT_NAME" => "STALL_EMAIL", "LID" => $arSite["ID"], "EMAIL_FROM" => "#DEFAULT_EMAIL_FROM#", "EMAIL_TO" => "#EMAIL#", "SUBJECT" => GetMessage("STALL_CREATE_TEMPLATE_SUBJECT_STATUS"), "MESSAGE" => GetMessage("STALL_CREATE_TEMPLATE_MESSAGE_STATUS"), "BODY_TYPE" => "html")); } }
/** * Return all sites (and domains) on current kernel * * @since 14.5.4 * @return array */ protected static function getSites() { $result = array(); $dbSites = CSite::GetList($b = 'sort', $o = 'asc', array('ACTIVE' => 'Y')); while ($arSite = $dbSites->Fetch()) { $domains = explode("\n", str_replace("\r", "\n", $arSite["DOMAINS"])); $domains = array_filter($domains); $result[] = array('ID' => $arSite['ID'], 'DOMAINS' => $domains); } return $result; }
public function getSites($filter = array()) { $by = 'def'; $order = 'desc'; $sids = array(); /** @noinspection PhpDynamicAsStaticMethodCallInspection */ $dbRes = \CSite::GetList($by, $order, $filter); while ($aItem = $dbRes->Fetch()) { $sids[] = $aItem; } return $sids; }
function ShowPanel() { global $USER, $APPLICATION; if (defined("ADMIN_SECTION") && ADMIN_SECTION == true) { return; } if ($USER->IsAdmin()) { if ($_REQUEST['add_new_site_sol'] == 'sol' && check_bitrix_sessid()) { $dbrSites = CSite::GetList($by, $ord); $arSitesID = array(); $arSitesPath = array(); $siteCnt = 0; while ($arSite = $dbrSites->Fetch()) { if ($arSite["ACTIVE"] == "Y") { $siteCnt++; } $arSitesID[] = strtolower($arSite["ID"]); $arSitesPath[] = strtolower($arSite["PATH"]); } $newSiteID = ""; while (true) { $newSiteID = chr(rand(ord("a"), ord("z"))) . chr(rand(ord("a"), ord("z"))); if (!in_array($newSiteID, $arSitesID) && !in_array("/site" . $newSiteID . "/", $arSitesPath) && !file_exists($_SERVER['DOCUMENT_ROOT'] . "/site" . $newSiteID)) { break; } } $culture = CultureTable::getRow(array('filter' => array("=FORMAT_DATE" => FORMAT_DATE, "=FORMAT_DATETIME" => FORMAT_DATETIME, "=FORMAT_NAME" => CSite::GetDefaultNameFormat(), "=CHARSET" => SITE_CHARSET))); if ($culture) { $cultureId = $culture["ID"]; } else { $addResult = CultureTable::add(array("NAME" => $newSiteID, "CODE" => $newSiteID, "FORMAT_DATE" => FORMAT_DATE, "FORMAT_DATETIME" => FORMAT_DATETIME, "FORMAT_NAME" => CSite::GetDefaultNameFormat(), "CHARSET" => SITE_CHARSET)); $cultureId = $addResult->getId(); } $arFields = array("LID" => $newSiteID, "ACTIVE" => "Y", "SORT" => 100, "DEF" => "N", "NAME" => $newSiteID, "DIR" => "/site_" . $newSiteID . "/", "SITE_NAME" => $newSiteID, "SERVER_NAME" => $_SERVER["SERVER_NAME"], "EMAIL" => COption::GetOptionString("main", "email_from"), "LANGUAGE_ID" => LANGUAGE_ID, "DOC_ROOT" => "", "CULTURE_ID" => $cultureId); $obSite = new CSite(); $result = $obSite->Add($arFields); if ($result) { LocalRedirect("/bitrix/admin/wizard_install.php?lang=" . LANGUAGE_ID . "&wizardName=bitrix:portal&wizardSiteID=" . $newSiteID . "&" . bitrix_sessid_get()); } else { echo $obSite->LAST_ERROR; } } $arMenu = array(array("ACTION" => "jsUtils.Redirect([], '" . CUtil::JSEscape(SITE_DIR) . "?add_new_site_sol=sol&" . bitrix_sessid_get() . "')", "TEXT" => "<b>" . GetMessage("SOL_BUTTON_TEST_TEXT", array("#BR#" => " ")) . "</b>", "TITLE" => GetMessage("SOL_BUTTON_TEST_TITLE"))); $arSites = array(); $dbrSites = CSite::GetList($by, $ord, array("ACTIVE" => "Y")); while ($arSite = $dbrSites->GetNext()) { $arSites[] = array("ACTION" => "jsUtils.Redirect([], '" . CUtil::JSEscape($arSite["DIR"]) . "');", "ICON" => $arSite["LID"] == SITE_ID ? "checked" : "", "TEXT" => $arSite["NAME"], "TITLE" => GetMessage("SOL_BUTTON_GOTOSITE") . " " . $arSite["NAME"]); } $arMenu[] = array("SEPARATOR" => true); $arMenu[] = array("TEXT" => GetMessage("SOL_BUTTON_GOTOSITE"), "MENU" => $arSites); $APPLICATION->AddPanelButton(array("HREF" => SITE_DIR . "?add_new_site_sol=sol&" . bitrix_sessid_get(), "ID" => "solutions_wizard", "ICON" => "bx-panel-install-solution-icon", "TYPE" => "BIG", "ALT" => GetMessage("SOL_BUTTON_TEST_TITLE"), "TEXT" => GetMessage("SOL_BUTTON_TEST_TEXT"), "MAIN_SORT" => 2520, "SORT" => 20, "MENU" => $arMenu, 'HINT' => array('TITLE' => str_replace('#BR#', ' ', GetMessage("SOL_BUTTON_TEST_TEXT")), 'TEXT' => GetMessage('SOL_BUTTON_TEST_TEXT_HINT')), 'HINT_MENU' => array('TITLE' => str_replace('#BR#', ' ', GetMessage("SOL_BUTTON_TEST_TEXT")), 'TEXT' => GetMessage('SOL_BUTTON_TEST_MENU_HINT')))); } }
public static final function getSitesIDList() { if (null === self::$cacheSitesIDList) { self::$cacheSitesIDList = array(); /** @noinspection PhpDynamicAsStaticMethodCallInspection */ $rsSiteList = \CSite::GetList($by = 'SORT', $order = 'ASC'); while ($arSite = $rsSiteList->Fetch()) { self::$cacheSitesIDList[] = $arSite['ID']; } } return self::$cacheSitesIDList; }
public static function getSitesList() { static $arSites = array(); if (empty($arSites)) { $by = "sort"; $order = "asc"; $dbSites = CSite::GetList($by, $order); while ($arSite = $dbSites->Fetch()) { $arSites[$arSite["LID"]] = "[" . $arSite["LID"] . "] " . $arSite["NAME"]; } } return $arSites; }
/** * Delete * @param $ID * @return mixed * @throws \Exception */ public static function Delete($ID) { $obSite = new \CSite(); $dbSite = $obSite->GetList($by = "sort", $order = "desc", array('ID' => $ID)); if ($arSite = $dbSite->Fetch()) { $res = $obSite->Delete($ID); if ($res) { return $ID; } else { throw new BimException($obSite->LAST_ERROR); } } }
private static function getDefaultSiteID() { if (self::$defaultSiteID !== null) { return self::$defaultSiteID; } $siteEntity = new \CSite(); $dbSites = $siteEntity->GetList($by = 'sort', $order = 'desc', array('DEFAULT' => 'Y', 'ACTIVE' => 'Y')); $defaultSite = is_object($dbSites) ? $dbSites->Fetch() : null; if (is_array($defaultSite)) { return self::$defaultSiteID = $defaultSite['LID']; } return self::$defaultSiteID = 's1'; }
function CheckSettings(&$arParams) { $arSettings = is_array($arParams["SETTINGS"]) ? $arParams["SETTINGS"] : @unserialize($arParams["SETTINGS"]); $arSettings = is_array($arSettings) ? $arSettings : array($arSettings); if (array_key_exists("CHANNEL_ID", $arSettings)) { $arSettings["CHANNEL_ID"] = intval($arSettings["CHANNEL_ID"]); if ($arSettings["CHANNEL_ID"] <= 0 && CModule::IncludeModule("vote")) { $db_res = CVoteChannel::GetList($by = "ID", $order = "ASC", array("SYMBOLIC_NAME" => $arSettings["CHANNEL_SYMBOLIC_NAME"], "SYMBOLIC_NAME_EXACT_MATCH" => "Y"), $is_filtered); if (!($db_res && ($arChannel = $db_res->Fetch()) && !!$arChannel)) { $res = array("TITLE" => $arSettings["CHANNEL_TITLE"], "SYMBOLIC_NAME" => $arSettings["CHANNEL_SYMBOLIC_NAME"], "ACTIVE" => "Y", "HIDDEN" => "Y", "C_SORT" => 100, "VOTE_SINGLE" => "N", "USE_CAPTCHA" => $arSettings["CHANNEL_USE_CAPTCHA"], "SITE" => array(), "GROUP_ID" => array()); $by = "sort"; $order = "asc"; $db_res = CSite::GetList($by, $order); while ($site = $db_res->GetNext()) { $res["SITE"][] = $site["ID"]; } $db_res = CGroup::GetList($by = "sort", $order = "asc", array("ADMIN" => "N")); while ($group = $db_res->GetNext()) { $res["GROUP_ID"][$group["ID"]] = $group["ID"] == 2 ? 1 : 4; } $res["GROUP_ID"] = is_array($arSettings["GROUP_ID"]) ? array_intersect_key($arSettings["GROUP_ID"], $res["GROUP_ID"]) : $res["GROUP_ID"]; $channelId = CVoteChannel::Add($res); } else { $channelId = $arChannel["ID"]; } $arSettings["CHANNEL_ID"] = $channelId; unset($arSettings["CHANNEL_TITLE"]); unset($arSettings["CHANNEL_SYMBOLIC_NAME"]); unset($arSettings["CHANNEL_USE_CAPTCHA"]); if (!$arSettings["CHANNEL_ID"]) { return false; } } $uniqType = $arSettings["UNIQUE"]; if (is_array($arSettings["UNIQUE"])) { foreach ($arSettings["UNIQUE"] as $res) { $uniqType |= $res; } $uniqType += 5; } $arSettings["UNIQUE"] = $uniqType; $arSettings["UNIQUE_IP_DELAY"] = is_array($arSettings["UNIQUE_IP_DELAY"]) ? $arSettings["UNIQUE_IP_DELAY"] : array("DELAY" => "10", "DELAY_TYPE" => "D"); $arParams["SETTINGS"] = serialize($arSettings); $arParams["MULTIPLE"] = "N"; $arParams["MANDATORY"] = "N"; $arParams["SHOW_FILTER"] = "N"; $arParams["IS_SEARCHABLE"] = "N"; } return true; }
public static function __spreadHandlerData($SID) { global $DB; $siteList = array(); $rsSites = CSite::GetList($by = "sort", $order = "asc", array()); while ($arRes = $rsSites->Fetch()) { $siteList[] = $arRes["ID"]; } foreach ($siteList as $SITE_ID) { $query = "INSERT INTO b_sale_delivery_handler (SELECT '','" . $DB->ForSql($SITE_ID) . "',ACTIVE,HID,NAME,SORT,DESCRIPTION,HANDLER,SETTINGS,PROFILES,TAX_RATE,LOGOTIP, BASE_CURRENCY FROM b_sale_delivery_handler WHERE HID='" . $DB->ForSql($SID) . "' AND LID='')"; $DB->Query($query); } $DB->Query("DELETE FROM b_sale_delivery_handler WHERE HID='" . $DB->ForSql($SID) . "' AND LID=''"); return; }
function InstallEvent() { //Создаем тип почтового события $fields = "\n#USER_NAME# имя отправителя\n#USER_PHONE# телефон отправителя\n#USER_COMMENT# комментарий отправителя"; $et = new CEventType(); $et->Add(array("LID" => "ru", "EVENT_NAME" => $this->EVENT_NAME, "NAME" => "Заказ звонка с сайта", "DESCRIPTION" => $fields)); //формируем массив из идентификаторов сайтов $arSite = array(); $dbSites = CSite::GetList($b = "", $o = "", array("ACTIVE" => "Y")); while ($site = $dbSites->Fetch()) { $arSite[] = $site["LID"]; } //создаем почтовый шаблон для всех сайтов $arr = array("ACTIVE" => "Y", "EVENT_NAME" => $this->EVENT_NAME, "LID" => $arSite, "EMAIL_FROM" => "#DEFAULT_EMAIL_FROM#", "EMAIL_TO" => "#DEFAULT_EMAIL_FROM#", "BCC" => "#BCC#", "SUBJECT" => GetMessage("EVENT_SUBJECT"), "BODY_TYPE" => "text", "MESSAGE" => Getmessage("EVENT_MESSAGE")); $emess = new CEventMessage(); $emess->Add($arr); }
function ParseParams($lastPath = false, $lastSite = false) { CModule::IncludeModule("fileman"); include_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/fileman/classes/general/fileman_utils.php"; self::$start_time = microtime(true); if ($lastPath != "" && $lastSite != "") { self::$bSkip = true; self::$lastSite = $lastSite; self::$lastPath = $lastPath; } else { self::$types = array('user' => array('sys' => true, 'title' => GetMessage('CAL_CONVERT_USERS'), 'iblockType' => 0, 'iblockId' => 0, 'checked' => true), 'group' => array('sys' => true, 'title' => GetMessage('CAL_CONVERT_GROUPS'), 'iblockType' => 0, 'iblockId' => 0, 'checked' => true)); CCalendarConvert::SetOption('__convert_types', self::$types); CCalendarConvert::SetOption('__convert_ibl_types', array()); CCalendarConvert::SetOption('__convert_settings', array()); CCalendarConvert::SetOption('__convert_doc_roots', array()); } $dbSites = CSite::GetList($by = 'sort', $order = 'asc', array('ACTIVE' => 'Y')); $arSites = array(); $default_site = ''; $arDocRoots = CCalendarConvert::GetOption('__convert_doc_roots', serialize(array())); while ($arRes = $dbSites->GetNext()) { self::$curSite = $arRes['ID']; $docRoot = CSite::GetSiteDocRoot($arRes['ID']); if (count($arDocRoots) > 0 && in_array($docRoot, $arDocRoots)) { continue; } $arDocRoots[] = $docRoot; CCalendarConvert::SetOption('__convert_doc_roots', $arDocRoots); if (self::$bSkip && self::$curSite != self::$lastSite) { continue; } $oDir = new CFilemanUtilDir($docRoot, array('obj' => $this, 'site' => $arRes['ID'], 'callBack' => "ParseFile", 'checkBreak' => "CheckBreak", 'checkSubdirs' => false)); $bSuccess = $oDir->Start(); $bBreak = $oDir->bBreak; $nextPath = $oDir->nextPath; if ($bBreak) { $this->ParseStop(CFilemanUtils::TrimPath($nextPath, $docRoot), self::$curSite); } } $this->AddTypesFromIblockType(); ?> <script>top.location = "/bitrix/admin/calendar_convert.php?lang=<?php echo LANG; ?> &content_parsed=Y";</script><?php }
/** For a given site ID, issues generated site title. * @param $siteId * @return string */ function getSiteTitle($siteId) { static $rsSites = ''; static $arSitesShop = array(); $siteTitle = $siteId; if ($rsSites === '') { $rsSites = CSite::GetList($b = "id", $o = "asc", array("ACTIVE" => "Y")); while ($arSite = $rsSites->GetNext()) { $arSitesShop[] = array("ID" => $arSite["ID"], "NAME" => $arSite["NAME"]); } } foreach ($arSitesShop as $arSite) { if ($arSite["ID"] == $siteId) { $siteTitle = $arSite["NAME"] . " (" . $arSite["ID"] . ")"; } } return $siteTitle; }
public function __construct($arParams) { $this->SITE_ID = $arParams["SITE_ID"]; $this->REWRITE = $arParams["REWRITE"]; $this->ModuleBlogGroup = '[' . $this->SITE_ID . '] ' . GetMessage("IDEA_BLOG_GROUP_NAME"); $this->ModuleBlogUrl .= "_" . $this->SITE_ID; //NULL CACHE BXClearCache(True, '/' . $this->SITE_ID . '/idea/'); BXClearCache(True, '/' . SITE_ID . '/idea/'); global $CACHE_MANAGER; if (CACHED_b_user_field_enum !== false) { $CACHE_MANAGER->CleanDir("b_user_field_enum"); } //Statuses List (for demo) $this->arResult["SETTINGS"]["STATUS"] = CIdeaManagment::getInstance()->Idea()->GetStatusList(); foreach ($this->arResult["SETTINGS"]["STATUS"] as $arStatus) { $this->arResult["SETTINGS"]["STATUS_ID"][$arStatus["XML_ID"]] = $arStatus["ID"]; } //Lang List $l = CLanguage::GetList($by = "sort", $order = "asc"); while ($r = $l->Fetch()) { $this->arResult["SETTINGS"]["LANG"][] = $r; } //Sites List $oSites = CSite::GetList($b = "", $o = "", array("ACTIVE" => "Y")); while ($site = $oSites->Fetch()) { $this->arResult["SETTINGS"]["SITE"][$site["LID"]] = array("LANGUAGE_ID" => $site["LANGUAGE_ID"], "ABS_DOC_ROOT" => $site["ABS_DOC_ROOT"], "DIR" => $site["DIR"], "SITE_ID" => $site["LID"], "SERVER_NAME" => $site["SERVER_NAME"], "NAME" => $site["NAME"]); } if (array_key_exists($this->SITE_ID, $this->arResult["SETTINGS"]["SITE"])) { $this->PublicDir = str_replace(array("#SITE_DIR#"), array($this->arResult["SETTINGS"]["SITE"][$this->SITE_ID]["DIR"]), $this->PublicDir); } $site = CFileMan::__CheckSite($this->SITE_ID); $this->DOCUMENT_ROOT = CSite::GetSiteDocRoot($site); $this->IO = CBXVirtualIo::GetInstance(); //SetDefault $this->arResult["INSTALLATION"]["IBLOCK_TYPE_INSTALL"] = true; $this->arResult["INSTALLATION"]["IBLOCK_INSTALL"] = true; $this->arResult["INSTALLATION"]["BLOG_GROUP_INSTALL"] = true; $this->arResult["INSTALLATION"]["BLOG_INSTALL"] = true; $this->CheckParams(); }