本文整理汇总了PHP中Bitrix\Main\SiteTable类的典型用法代码示例。如果您正苦于以下问题:PHP SiteTable类的具体用法?PHP SiteTable怎么用?PHP SiteTable使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了SiteTable类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: getDefaultSiteId
public static function getDefaultSiteId()
{
static $result = null;
if ($result === null) {
$res = \Bitrix\Main\SiteTable::getList(array('filter' => array('DEF' => 'Y'), 'select' => array('LID')));
if ($item = $res->fetch()) {
$result = $item['LID'];
}
}
return $result;
}
开发者ID:Satariall,项目名称:izurit,代码行数:11,代码来源:helper.php
示例2: getList
/**
* @param string $dbName
* @return array List of all sites & their params
*/
public static function getList($dbName = false)
{
if (!$dbName) {
$connection = \Bitrix\Main\Application::getConnection();
$dbName = $connection->getDbName();
}
$result = array();
$shellAdapter = new ShellAdapter();
$execRes = $shellAdapter->syncExec("sudo -u root /opt/webdir/bin/bx-sites -o json -a list -d " . $dbName);
$sitesData = $shellAdapter->getLastOutput();
if ($execRes) {
$arData = json_decode($sitesData, true);
if (isset($arData["params"])) {
$result = $arData["params"];
}
$rsSite = \Bitrix\Main\SiteTable::getList();
while ($site = $rsSite->fetch()) {
foreach ($result as $siteId => $siteInfo) {
$docRoot = strlen($site["DOC_ROOT"]) > 0 ? $site["DOC_ROOT"] : \Bitrix\Main\Application::getDocumentRoot();
if ($siteInfo["DocumentRoot"] == $docRoot) {
$result[$siteId]["NAME"] = $site["NAME"] . " (" . $site["LID"] . ") ";
} else {
$result[$siteId]["NAME"] = $siteId;
}
}
}
}
return $result;
}
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:33,代码来源:sitesdata.php
示例3: acrit_exportpro
function acrit_exportpro()
{
require __DIR__ . '/version.php';
$path = str_replace("\\", "/", __FILE__);
$path = substr($path, 0, strlen($path) - strlen("/index.php"));
include $path . "/version.php";
if (is_array($arModuleVersion) && array_key_exists("VERSION", $arModuleVersion)) {
$this->MODULE_VERSION = $arModuleVersion["VERSION"];
$this->MODULE_VERSION_DATE = $arModuleVersion["VERSION_DATE"];
}
$this->MODULE_NAME = GetMessage('ACRIT_EXPORTPRO_MODULE_NAME');
$this->MODULE_DESCRIPTION = GetMessage('ACRIT_EXPORTPRO_MODULE_DESC');
$this->PARTNER_NAME = GetMessage("ACRIT_EXPORTPRO_PARTNER_NAME");
$this->PARTNER_URI = GetMessage("ACRIT_EXPORTPRO_PARTNER_URI");
$app = \Bitrix\Main\Application::getInstance();
$dbSite = \Bitrix\Main\SiteTable::getList();
while ($arSite = $dbSite->Fetch()) {
if (!$arSite['DOC_ROOT']) {
$this->siteArray[$arSite['LID']] = $app->getDocumentRoot() . $arSite['DIR'];
} else {
$this->siteArray[$arSite['LID']] = $arSite['DOC_ROOT'];
}
$this->siteArray[$arSite['LID']] = \Bitrix\Main\IO\Path::normalize($this->siteArray[$arSite['LID']]);
}
}
开发者ID:akniyev,项目名称:itprom_dobrohost,代码行数:25,代码来源:index.php
示例4: __construct
public function __construct($fileName, $settings)
{
$this->settings = array(
'SITE_ID' => $settings['SITE_ID'],
'PROTOCOL' => $settings['PROTOCOL'] == 'https' ? 'https' : 'http',
'DOMAIN' => $settings['DOMAIN'],
);
$site = SiteTable::getRow(array("filter" => array("LID" => $this->settings['SITE_ID'])));
$this->siteRoot = Path::combine(
SiteTable::getDocumentRoot($this->settings['SITE_ID']),
$site['DIR']
);
if(substr($fileName, -strlen(self::FILE_EXT)) != self::FILE_EXT)
{
$fileName .= self::FILE_EXT;
}
if($this->partFile == '')
{
$this->partFile = $fileName;
}
$this->pathPhysical = null; // hack for object reconstuct during file splitting
parent::__construct($this->siteRoot.'/'.$fileName, $this->settings['SITE_ID']);
$this->partChanged = $this->isExists() && !$this->isSplitNeeded();
}
开发者ID:nycmic,项目名称:bittest,代码行数:31,代码来源:sitemapfile.php
示例5: seoSitemapGetFilesData
function seoSitemapGetFilesData($PID, $arSitemap, $arCurrentDir, $sitemapFile)
{
global $NS;
$arDirList = array();
if ($arCurrentDir['ACTIVE'] == SitemapRuntimeTable::ACTIVE) {
$list = \CSeoUtils::getDirStructure($arSitemap['SETTINGS']['logical'] == 'Y', $arSitemap['SITE_ID'], $arCurrentDir['ITEM_PATH']);
foreach ($list as $dir) {
$dirKey = "/" . ltrim($dir['DATA']['ABS_PATH'], "/");
if ($dir['TYPE'] == 'F') {
if (!isset($arSitemap['SETTINGS']['FILE'][$dirKey]) || $arSitemap['SETTINGS']['FILE'][$dirKey] == 'Y') {
if (preg_match($arSitemap['SETTINGS']['FILE_MASK_REGEXP'], $dir['FILE'])) {
$f = new IO\File($dir['DATA']['PATH'], $arSitemap['SITE_ID']);
$sitemapFile->addFileEntry($f);
$NS['files_count']++;
}
}
} else {
if (!isset($arSitemap['SETTINGS']['DIR'][$dirKey]) || $arSitemap['SETTINGS']['DIR'][$dirKey] == 'Y') {
$arDirList[] = $dirKey;
}
}
}
} else {
$len = strlen($arCurrentDir['ITEM_PATH']);
if (!empty($arSitemap['SETTINGS']['DIR'])) {
foreach ($arSitemap['SETTINGS']['DIR'] as $dirKey => $checked) {
if ($checked == 'Y') {
if (strncmp($arCurrentDir['ITEM_PATH'], $dirKey, $len) === 0) {
$arDirList[] = $dirKey;
}
}
}
}
if (!empty($arSitemap['SETTINGS']['FILE'])) {
foreach ($arSitemap['SETTINGS']['FILE'] as $dirKey => $checked) {
if ($checked == 'Y') {
if (strncmp($arCurrentDir['ITEM_PATH'], $dirKey, $len) === 0) {
$fileName = IO\Path::combine(SiteTable::getDocumentRoot($arSitemap['SITE_ID']), $dirKey);
if (!is_dir($fileName)) {
$f = new IO\File($fileName, $arSitemap['SITE_ID']);
if ($f->isExists() && !$f->isSystem() && preg_match($arSitemap['SETTINGS']['FILE_MASK_REGEXP'], $f->getName())) {
$sitemapFile->addFileEntry($f);
$NS['files_count']++;
}
}
}
}
}
}
}
if (count($arDirList) > 0) {
foreach ($arDirList as $dirKey) {
$arRuntimeData = array('PID' => $PID, 'ITEM_PATH' => $dirKey, 'PROCESSED' => SitemapRuntimeTable::UNPROCESSED, 'ACTIVE' => SitemapRuntimeTable::ACTIVE, 'ITEM_TYPE' => SitemapRuntimeTable::ITEM_TYPE_DIR);
SitemapRuntimeTable::add($arRuntimeData);
}
}
SitemapRuntimeTable::update($arCurrentDir['ID'], array('PROCESSED' => SitemapRuntimeTable::PROCESSED));
}
开发者ID:Satariall,项目名称:izurit,代码行数:58,代码来源:seo_sitemap_run.php
示例6: getParamsStructure
public static function getParamsStructure()
{
$siteList = array();
$rsSite = \Bitrix\Main\SiteTable::getList();
while ($site = $rsSite->fetch()) {
$siteList[$site["LID"]] = $site["NAME"] . " (" . $site["LID"] . ")";
}
return array("SITE_ID" => array("TYPE" => "ENUM", 'MULTIPLE' => 'Y', "DEFAULT" => SITE_ID, "LABEL" => Loc::getMessage("SALE_DLVR_RSTR_BY_SITE_SITE_ID"), "OPTIONS" => $siteList));
}
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:9,代码来源:bysite.php
示例7: getRewriteRules
/**
* Returns urlrewrite array
*
* @param string $site Site ID.
* @return array
*/
private static function getRewriteRules($site)
{
$docRoot = rtrim(\Bitrix\Main\SiteTable::getDocumentRoot($site), '/');
$rewriteRules = array();
$arUrlRewrite =& $rewriteRules;
$rewriteFile = new \Bitrix\Main\IO\File($docRoot . '/urlrewrite.php');
if ($rewriteFile->isExists()) {
include $rewriteFile->getPath();
}
return $rewriteRules;
}
开发者ID:vim84,项目名称:b-markt,代码行数:17,代码来源:adminhelper.php
示例8: installBitrix24MailService
public function installBitrix24MailService()
{
if (CModule::IncludeModule("mail")) {
$result = \Bitrix\Main\SiteTable::getList();
while (($site = $result->fetch()) !== false) {
if (CModule::IncludeModule('extranet') && CExtranet::IsExtranetSite($site['LID'])) {
continue;
}
\Bitrix\Mail\MailServicesTable::add(array('SITE_ID' => $site['LID'], 'ACTIVE' => 'Y', 'NAME' => 'bitrix24', 'SERVICE_TYPE' => 'controller'));
}
}
}
开发者ID:Satariall,项目名称:izurit,代码行数:12,代码来源:index.php
示例9: __construct
public function __construct($path, $siteId = null)
{
if (empty($path)) {
throw new InvalidPathException($path);
}
$this->originalPath = $path;
$this->path = Path::normalize($path);
if ($siteId === null) {
$this->documentRoot = Main\Application::getDocumentRoot();
} else {
$this->documentRoot = Main\SiteTable::getDocumentRoot($siteId);
}
if (empty($this->path)) {
throw new InvalidPathException($path);
}
}
开发者ID:rasuldev,项目名称:torino,代码行数:16,代码来源:filesystementry.php
示例10: delete
public static function delete($id)
{
//We know for sure that languages and sites can refer to the culture.
//Other entities should place CultureOnBeforeDelete event handler.
$result = new Entity\DeleteResult();
$res = LanguageTable::getList(array('filter' => array('=CULTURE_ID' => $id)));
while ($language = $res->fetch()) {
$result->addError(new Entity\EntityError(Loc::getMessage("culture_err_del_lang", array("#LID#" => $language["LID"]))));
}
$res = \Bitrix\Main\SiteTable::getList(array('filter' => array('=CULTURE_ID' => $id)));
while ($site = $res->fetch()) {
$result->addError(new Entity\EntityError(Loc::getMessage("culture_err_del_site", array("#LID#" => $site["LID"]))));
}
if (!$result->isSuccess()) {
return $result;
}
return parent::delete($id);
}
开发者ID:Satariall,项目名称:izurit,代码行数:18,代码来源:culture.php
示例11: checkFields
public static function checkFields(Entity\Result $result, $primary, array $data)
{
parent::checkFields($result, $primary, $data);
if (isset($data['SITE_ID'])) {
$selectResult = \Bitrix\Main\SiteTable::getByPrimary($data['SITE_ID']);
if (!$selectResult->fetch()) {
$field = static::getEntity()->getField('SITE_ID');
$result->addError(new Entity\FieldError($field, Localization\Loc::getMessage('MAIN_ENTITY_FIELD_INVALID', array('#FIELD_TITLE#' => $field->getTitle())), Entity\FieldError::INVALID_VALUE));
}
}
if (!empty($data['ICON'])) {
if (!is_scalar($data['ICON']) || !preg_match('/[0-9]+/', $data['ICON'])) {
$field = static::getEntity()->getField('ICON');
$result->addError(new Entity\FieldError($field, Localization\Loc::getMessage('MAIN_ENTITY_FIELD_INVALID', array('#FIELD_TITLE#' => $field->getTitle())), Entity\FieldError::INVALID_VALUE));
}
}
return $result;
}
开发者ID:webgksupport,项目名称:alpina,代码行数:18,代码来源:mailservices.php
示例12: getDocumentRoot
public static function getDocumentRoot($siteId = null)
{
if ($siteId === null) {
$context = Application::getInstance()->getContext();
$siteId = $context->getSite();
}
if (!isset(self::$documentRootCache[$siteId])) {
$ar = SiteTable::getRow(array("filter" => array("LID" => $siteId)));
if ($ar && ($docRoot = $ar["DOC_ROOT"]) && strlen($docRoot) > 0) {
if (!IO\Path::isAbsolute($docRoot)) {
$docRoot = IO\Path::combine(Application::getDocumentRoot(), $docRoot);
}
self::$documentRootCache[$siteId] = $docRoot;
} else {
self::$documentRootCache[$siteId] = Application::getDocumentRoot();
}
}
return self::$documentRootCache[$siteId];
}
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:19,代码来源:site.php
示例13: initializeSite
protected function initializeSite()
{
$request = $this->getRequest();
$currentDirectory = $request->getRequestedPageDirectory();
$currentDomain = $request->getHttpHost(false);
$site = SiteTable::getByDomainAndPath($currentDomain, $currentDirectory);
if ($site === false) {
$siteList = SiteTable::getList(array('filter' => array('ACTIVE' => 'Y'), 'order' => array('DEF' => 'DESC', 'SORT' => 'ASC'), 'select' => array('*', 'ID' => 'LID')));
$site = $siteList->fetch();
}
if ($site === false) {
throw new SystemException("Site not found");
}
$culture = Context\Culture::wakeUp($site["CULTURE_ID"]);
if ($culture === null) {
$culture = new Context\Culture();
}
$this->site = new Context\Site($site);
$this->site->setCulture($culture);
$this->setContextCulture($culture, $this->site->getLanguage());
}
开发者ID:Satariall,项目名称:izurit,代码行数:21,代码来源:publicpage.php
示例14: actionAdd
protected static function actionAdd($name, $arFields)
{
if ($name == 'ADDELEMENT') {
if (!self::checkElement($arFields)) {
return;
}
// we don't have the GLOBAL_ACTIVE flag in $arFields so we should check it manually
if (is_array($arFields['IBLOCK_SECTION']) && count($arFields['IBLOCK_SECTION']) > 0) {
$arNewSections = array();
$arFilter = array('ID' => $arFields['IBLOCK_SECTION'], 'IBLOCK_ID' => $arFields['IBLOCK_ID'], 'GLOBAL_ACTIVE' => 'Y');
$dbRes = \CIBlockSection::getList(array(), $arFilter, false, array('ID'));
while ($ar = $dbRes->fetch()) {
$arNewSections[] = $ar['ID'];
}
if (count($arNewSections) <= 0) {
// element is added to inactive sections
return;
}
$arFields['IBLOCK_SECTION'] = $arNewSections;
}
} elseif ($name == 'ADDSECTION') {
$dbRes = \CIBlockSection::getList(array(), array('ID' => $arFields['ID'], 'GLOBAL_ACTIVE' => 'Y'), false, array('ID'));
if (!$dbRes->fetch()) {
// section is added to inactive branch
return;
}
}
$arSitemaps = SitemapIblockTable::getByIblock($arFields, $name == 'ADDSECTION' ? SitemapIblockTable::TYPE_SECTION : SitemapIblockTable::TYPE_ELEMENT);
$arFields['TIMESTAMP_X'] = ConvertTimeStamp(false, "FULL");
if (isset($arFields['IBLOCK_SECTION']) && is_array($arFields['IBLOCK_SECTION']) && count($arFields['IBLOCK_SECTION']) > 0) {
$arFields['IBLOCK_SECTION_ID'] = min($arFields['IBLOCK_SECTION']);
}
if (count($arSitemaps) > 0) {
$arSiteDirs = array();
$dbSite = SiteTable::getList(array('select' => array('LID', 'DIR')));
while ($arSite = $dbSite->fetch()) {
$arSiteDirs[$arSite['LID']] = $arSite['DIR'];
}
foreach ($arSitemaps as $arSitemap) {
$arFields['LANG_DIR'] = $arSiteDirs[$arSitemap['SITE_ID']];
$rule = array('url' => $name == 'ADDSECTION' ? \CIBlock::replaceDetailUrl($arSitemaps[0]['SECTION_PAGE_URL'], $arFields, false, "S") : \CIBlock::replaceDetailUrl($arSitemaps[0]['DETAIL_PAGE_URL'], $arFields, false, "E"), 'lastmod' => MakeTimeStamp($arFields['TIMESTAMP_X']));
$fileName = str_replace(array('#IBLOCK_ID#', '#IBLOCK_CODE#', '#IBLOCK_XML_ID#'), array($arFields['IBLOCK_ID'], $arSitemap['IBLOCK_CODE'], $arSitemap['IBLOCK_XML_ID']), $arSitemap['SITEMAP_FILE_IBLOCK']);
$sitemapFile = new SitemapFile($fileName, $arSitemap);
$sitemapFile->appendIblockEntry($rule['url'], $rule['lastmod']);
$sitemapIndex = new SitemapIndex($arSitemap['SITEMAP_FILE'], $arSitemap);
$sitemapIndex->appendIndexEntry($sitemapFile);
if ($arSitemap['ROBOTS'] == 'Y') {
$robotsFile = new RobotsFile($arSitemap['SITE_ID']);
$robotsFile->addRule(array(RobotsFile::SITEMAP_RULE, $sitemapIndex->getUrl()));
}
}
}
}
开发者ID:rasuldev,项目名称:torino,代码行数:53,代码来源:sitemapiblock.php
示例15: InstallDB
function InstallDB()
{
global $APPLICATION;
global $DB;
global $errors;
$bitrix24 = ModuleManager::isModuleInstalled('bitrix24');
if (!$DB->Query("SELECT 'x' FROM b_catalog_group", true)) {
$errors = $DB->RunSQLBatch($_SERVER['DOCUMENT_ROOT'] . "/bitrix/modules/catalog/install/db/" . strtolower($DB->type) . "/install.sql");
}
if (!empty($errors)) {
$APPLICATION->ThrowException(implode("", $errors));
return false;
}
ModuleManager::registerModule('catalog');
$eventManager = \Bitrix\Main\EventManager::getInstance();
$eventManager->registerEventHandler('sale', 'onBuildCouponProviders', 'catalog', '\\Bitrix\\Catalog\\DiscountCouponTable', 'couponManager');
RegisterModuleDependences("iblock", "OnIBlockDelete", "catalog", "CCatalog", "OnIBlockDelete");
RegisterModuleDependences("iblock", "OnIBlockElementDelete", "catalog", "CCatalogProduct", "OnIBlockElementDelete");
RegisterModuleDependences("iblock", "OnIBlockElementDelete", "catalog", "CPrice", "OnIBlockElementDelete");
RegisterModuleDependences("iblock", "OnIBlockElementDelete", "catalog", "CCatalogStoreProduct", "OnIBlockElementDelete");
RegisterModuleDependences("iblock", "OnIBlockElementDelete", "catalog", "CCatalogDocs", "OnIBlockElementDelete");
RegisterModuleDependences("iblock", "OnBeforeIBlockElementDelete", "catalog", "CCatalogDocs", "OnBeforeIBlockElementDelete");
RegisterModuleDependences("currency", "OnCurrencyDelete", "catalog", "CPrice", "OnCurrencyDelete");
RegisterModuleDependences("main", "OnGroupDelete", "catalog", "CCatalogProductGroups", "OnGroupDelete");
RegisterModuleDependences("iblock", "OnAfterIBlockElementUpdate", "catalog", "CCatalogProduct", "OnAfterIBlockElementUpdate");
RegisterModuleDependences("currency", "OnModuleUnInstall", "catalog", "", "CurrencyModuleUnInstallCatalog");
RegisterModuleDependences("iblock", "OnBeforeIBlockDelete", "catalog", "CCatalog", "OnBeforeCatalogDelete", 300);
RegisterModuleDependences("iblock", "OnBeforeIBlockElementDelete", "catalog", "CCatalog", "OnBeforeIBlockElementDelete", 10000);
RegisterModuleDependences("main", "OnEventLogGetAuditTypes", "catalog", "CCatalogEvent", "GetAuditTypes");
RegisterModuleDependences('main', 'OnBuildGlobalMenu', 'catalog', 'CCatalogAdmin', 'OnBuildGlobalMenu');
RegisterModuleDependences('main', 'OnAdminListDisplay', 'catalog', 'CCatalogAdmin', 'OnAdminListDisplay');
RegisterModuleDependences('main', 'OnBuildGlobalMenu', 'catalog', 'CCatalogAdmin', 'OnBuildSaleMenu');
RegisterModuleDependences("catalog", "OnCondCatControlBuildList", "catalog", "CCatalogCondCtrlGroup", "GetControlDescr", 100);
RegisterModuleDependences("catalog", "OnCondCatControlBuildList", "catalog", "CCatalogCondCtrlIBlockFields", "GetControlDescr", 200);
RegisterModuleDependences("catalog", "OnCondCatControlBuildList", "catalog", "CCatalogCondCtrlIBlockProps", "GetControlDescr", 300);
RegisterModuleDependences("catalog", "OnDocumentBarcodeDelete", "catalog", "CCatalogStoreDocsElement", "OnDocumentBarcodeDelete");
RegisterModuleDependences("catalog", "OnBeforeDocumentDelete", "catalog", "CCatalogStoreDocsBarcode", "OnBeforeDocumentDelete");
RegisterModuleDependences("catalog", "OnCatalogStoreDelete", "catalog", "CCatalogDocs", "OnCatalogStoreDelete");
RegisterModuleDependences("iblock", "OnBeforeIBlockPropertyDelete", "catalog", "CCatalog", "OnBeforeIBlockPropertyDelete");
RegisterModuleDependences("sale", "OnCondSaleControlBuildList", "catalog", "CCatalogCondCtrlBasketProductFields", "GetControlDescr", 1100);
RegisterModuleDependences("sale", "OnCondSaleControlBuildList", "catalog", "CCatalogCondCtrlBasketProductProps", "GetControlDescr", 1200);
RegisterModuleDependences("sale", "OnCondSaleActionsControlBuildList", "catalog", "CCatalogActionCtrlBasketProductFields", "GetControlDescr", 1200);
RegisterModuleDependences("sale", "OnCondSaleActionsControlBuildList", "catalog", "CCatalogActionCtrlBasketProductProps", "GetControlDescr", 1300);
RegisterModuleDependences("sale", "OnExtendBasketItems", "catalog", "CCatalogDiscount", "ExtendBasketItems", 100);
RegisterModuleDependences('iblock', 'OnModuleUnInstall', 'catalog', 'CCatalog', 'OnIBlockModuleUnInstall');
if (!$bitrix24) {
CAgent::AddAgent('\\Bitrix\\Catalog\\CatalogViewedProductTable::clearAgent();', 'catalog', 'N', (int) COption::GetOptionString("catalog", "viewed_period") * 24 * 3600);
}
$this->InstallTasks();
$arCount = $DB->Query("select count(ID) as COUNT from b_catalog_measure", true)->Fetch();
if (is_array($arCount) && isset($arCount['COUNT']) && intval($arCount['COUNT']) <= 0) {
$DB->Query("insert into b_catalog_measure (CODE, SYMBOL_INTL, SYMBOL_LETTER_INTL, IS_DEFAULT) values(6, 'm', 'MTR', 'N')", true);
$DB->Query("insert into b_catalog_measure (CODE, SYMBOL_INTL, SYMBOL_LETTER_INTL, IS_DEFAULT) values(112, 'l', 'LTR', 'N')", true);
$DB->Query("insert into b_catalog_measure (CODE, SYMBOL_INTL, SYMBOL_LETTER_INTL, IS_DEFAULT) values(163, 'g', 'GRM', 'N')", true);
$DB->Query("insert into b_catalog_measure (CODE, SYMBOL_INTL, SYMBOL_LETTER_INTL, IS_DEFAULT) values(166, 'kg', 'KGM', 'N')", true);
$DB->Query("insert into b_catalog_measure (CODE, SYMBOL_INTL, SYMBOL_LETTER_INTL, IS_DEFAULT) values(796, 'pc. 1', 'PCE. NMB', 'Y')", true);
}
if (!$bitrix24) {
$languageID = '';
$siteIterator = SiteTable::getList(array('select' => array('LID', 'LANGUAGE_ID'), 'filter' => array('=DEF' => 'Y', '=ACTIVE' => 'Y')));
if ($site = $siteIterator->fetch()) {
$languageID = (string) $site['LANGUAGE_ID'];
}
if ($languageID == '') {
$languageID = 'en';
}
if ($languageID == 'ru') {
$mess = Loc::getMessage('CATALOG_INSTALL_PROFILE_IRR2', null, 'ru');
if ($mess == '') {
$mess = 'irr.ru';
}
$strQuery = "select COUNT(CE.ID) as CNT from b_catalog_export CE where CE.IS_EXPORT = 'Y' and CE.FILE_NAME ='yandex' and CE.NAME = '" . $DB->ForSql($mess) . "'";
$rsProfiles = $DB->Query($strQuery, true);
if (false !== $rsProfiles) {
$arProfile = $rsProfiles->Fetch();
if ((int) $arProfile['CNT'] == 0) {
$arFields = array('FILE_NAME' => 'yandex', 'NAME' => $mess, 'DEFAULT_PROFILE' => 'N', 'IN_MENU' => 'N', 'IN_AGENT' => 'N', 'IN_CRON' => 'N', 'NEED_EDIT' => 'Y', 'IS_EXPORT' => 'Y');
$arInsert = $DB->PrepareInsert("b_catalog_export", $arFields);
$strQuery = "INSERT INTO b_catalog_export(" . $arInsert[0] . ") VALUES(" . $arInsert[1] . ")";
$DB->Query($strQuery, true);
}
}
}
}
return true;
}
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:86,代码来源:index.php
示例16: checkSiteId
private static function checkSiteId($siteId)
{
$siteId = Assert::expectStringNotNull($siteId, '$siteId');
$res = Main\SiteTable::getList(array('filter' => array('LID' => $siteId)))->fetch();
if (!$res) {
throw new Main\ArgumentOutOfRangeException(Loc::getMessage('SALE_LOCATION_DEFAULTSITE_ENTITY_SITE_ID_UNKNOWN_EXCEPTION'));
}
return $siteId;
}
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:9,代码来源:defaultsite.php
示例17: Update
function Update($ID, $arFields)
{
global $DB;
if (!$this->CheckFields($arFields, $ID)) {
return false;
}
if (is_set($arFields, "ACTIVE") && $arFields["ACTIVE"] != "Y") {
$arFields["ACTIVE"] = "N";
}
$arLID = array();
if (is_set($arFields, "LID")) {
if (is_array($arFields["LID"])) {
$arLID = $arFields["LID"];
} else {
$arLID[] = $arFields["LID"];
}
$arFields["LID"] = false;
foreach ($arLID as $v) {
$arFields["LID"] = $v;
}
}
$arATTACHMENT_FILE = array();
if (is_set($arFields, "ATTACHMENT_FILE")) {
if (is_array($arFields["ATTACHMENT_FILE"])) {
$arATTACHMENT_FILE = $arFields["ATTACHMENT_FILE"];
} else {
$arATTACHMENT_FILE[] = $arFields["ATTACHMENT_FILE"];
}
$arATTACHMENT_FILE_tmp = array();
foreach ($arATTACHMENT_FILE as $v) {
$v = intval($v);
$arATTACHMENT_FILE_tmp[] = $v;
}
$arATTACHMENT_FILE = $arATTACHMENT_FILE_tmp;
unset($arFields['ATTACHMENT_FILE']);
}
if (array_key_exists('NAME', $arFields)) {
unset($arFields['NAME']);
}
$ID = intval($ID);
Mail\Internal\EventMessageTable::update($ID, $arFields);
if (count($arLID) > 0) {
Mail\Internal\EventMessageSiteTable::delete($ID);
$resultDb = \Bitrix\Main\SiteTable::getList(array('select' => array('LID'), 'filter' => array('LID' => $arLID)));
while ($arResultSite = $resultDb->fetch()) {
Mail\Internal\EventMessageSiteTable::add(array('EVENT_MESSAGE_ID' => $ID, 'SITE_ID' => $arResultSite['LID']));
}
}
if (count($arATTACHMENT_FILE) > 0) {
foreach ($arATTACHMENT_FILE as $file_id) {
Mail\Internal\EventMessageAttachmentTable::add(array('EVENT_MESSAGE_ID' => $ID, 'FILE_ID' => $file_id));
}
}
return true;
}
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:55,代码来源:event.php
示例18: array
}
$dbRes = SitemapEntityTable::getList(array("filter" => array("SITEMAP_ID" => $ID)));
while ($arRes = $dbRes->fetch()) {
if (!is_array($arSitemap['SETTINGS'][$arRes["ENTITY_TYPE"] . '_AUTO'])) {
$arSitemap['SETTINGS'][$arRes["ENTITY_TYPE"] . '_AUTO'] = array();
}
$arSitemap['SETTINGS'][$arRes["ENTITY_TYPE"] . '_AUTO'][$arRes['ENTITY_ID']] = 'Y';
}
if (empty($arSitemap['SETTINGS']['FILENAME_FORUM'])) {
$arSitemap['SETTINGS']['FILENAME_FORUM'] = "sitemap_forum_#FORUM_ID#.xml";
}
$SITE_ID = $arSitemap['SITE_ID'];
}
}
if (strlen($SITE_ID) > 0) {
$dbSite = Main\SiteTable::getByPrimary($SITE_ID);
$arSite = $dbSite->fetch();
if (!is_array($arSite)) {
$SITE_ID = '';
} else {
$arSite['DOMAINS'] = array();
$robotsFile = new RobotsFile($SITE_ID);
if ($robotsFile->isExists()) {
$arHostsList = $robotsFile->getRules('Host');
foreach ($arHostsList as $rule) {
$host = $rule[1];
if (strncmp($host, 'https://', 8) === 0) {
$host = substr($host, 8);
$bDefaultHttps = true;
}
$arSite['DOMAINS'][] = $host;
开发者ID:webgksupport,项目名称:alpina,代码行数:31,代码来源:seo_sitemap_edit.php
示例19: sendInternal
/**
* @param $mailingChainId
* @param array $params
* @return string
* @throws \Bitrix\Main\ArgumentException
* @throws \Bitrix\Main\DB\Exception
*/
protected static function sendInternal($mailingChainId, array $params)
{
if (static::$currentMailingChainFields !== null) {
if (static::$currentMailingChainFields['ID'] != $mailingChainId) {
static::$currentMailingChainFields = null;
}
}
if (static::$currentMailingChainFields === null) {
$mailingChainDb = MailingChainTable::getList(array('select' => array('*', 'SITE_ID' => 'MAILING.SITE_ID'), 'filter' => array('ID' => $mailingChainId)));
if (!($mailingChain = $mailingChainDb->fetch())) {
return PostingRecipientTable::SEND_RESULT_ERROR;
}
$charset = false;
$siteDb = \Bitrix\Main\SiteTable::getList(array('select' => array('SERVER_NAME', 'NAME', 'CULTURE_CHARSET' => 'CULTURE.CHARSET'), 'filter' => array('LID' => $mailingChain['SITE_ID'])));
if ($site = $siteDb->fetch()) {
$charset = $site['CULTURE_CHARSET'];
$serverName = $site['SERVER_NAME'];
} else {
throw new \Bitrix\Main\DB\Exception(Loc::getMessage('SENDER_POSTING_MANAGER_ERR_SITE', array('#SITE_ID#' => $mailingChain['SITE_ID'])));
}
if (!$charset) {
throw new \Bitrix\Main\DB\Exception(Loc::getMessage('SENDER_POSTING_MANAGER_ERR_CHARSET', array('#SITE_ID#' => "[" . $mailingChain['SITE_ID'] . "]" . $site['NAME'])));
}
$attachmentList = array();
$attachmentDb = \Bitrix\Sender\MailingAttachmentTable::getList(array('select' => array('FILE_ID'), 'filter' => array('CHAIN_ID' => $mailingChainId)));
while ($attachment = $attachmentDb->fetch()) {
$attachmentList[] = $attachment['FILE_ID'];
}
static::$currentMailingChainFields = array();
static::$currentMailingChainFields['EVENT'] = array('FILE' => $attachmentList);
static::$currentMailingChainFields['ID'] = $mailingChain['ID'];
static::$currentMailingChainFields['MESSAGE'] = array('BODY_TYPE' => 'html', 'EMAIL_FROM' => $mailingChain['EMAIL_FROM'], 'EMAIL_TO' => '#EMAIL_TO#', 'SUBJECT' => $mailingChain['SUBJECT'], 'MESSAGE' => $mailingChain['MESSAGE'], 'MESSAGE_PHP' => \Bitrix\Main\Mail\Internal\EventMessageTable::replaceTemplateToPhp($mailingChain['MESSAGE']));
static::$currentMailingChainFields['SITE'] = array($mailingChain['SITE_ID']);
static::$currentMailingChainFields['CHARSET'] = $charset;
static::$currentMailingChainFields['SERVER_NAME'] = $serverName;
static::$currentMailingChainFields['LINK_PROTOCOL'] = \Bitrix\Main\Config\Option::get("sender", "link_protocol", 'http');
}
$messageParams = array('EVENT' => static::$currentMailingChainFields['EVENT'], 'FIELDS' => $params['FIELDS'], 'MESSAGE' => static::$currentMailingChainFields['MESSAGE'], 'SITE' => static::$currentMailingChainFields['SITE'], 'CHARSET' => static::$currentMailingChainFields['CHARSET']);
if (!empty($params['FIELDS']['UNSUBSCRIBE_LINK'])) {
if (substr($params['FIELDS']['UNSUBSCRIBE_LINK'], 0, 4) !== 'http') {
if (!empty(static::$currentMailingChainFields['SERVER_NAME'])) {
$serverName = static::$currentMailingChainFields['SERVER_NAME'];
} else {
$serverName = \Bitrix\Main\Config\Option::get("main", "server_name", $GLOBALS["SERVER_NAME"]);
}
$linkProtocol = static::$currentMailingChainFields['LINK_PROTOCOL'];
$params['FIELDS']['UNSUBSCRIBE_LINK'] = $linkProtocol . '://' . $serverName . $params['FIELDS']['UNSUBSCRIBE_LINK'];
}
}
$message = Mail\EventMessageCompiler::createInstance($messageParams);
$message->compile();
$mailHeaders = $message->getMailHeaders();
if (!empty($params['FIELDS']['UNSUBSCRIBE_LINK'])) {
$unsubUrl = $params['FIELDS']['UNSUBSCRIBE_LINK'];
$mailHeaders['List-Unsubscribe'] = '<' . $unsubUrl . '>';
}
// send mail
$result = Mail\Mail::send(array('TO' => $message->getMailTo(), 'SUBJECT' => $message->getMailSubject(), 'BODY' => $message->getMailBody(), 'HEADER' => $mailHeaders, 'CHARSET' => $message->getMailCharset(), 'CONTENT_TYPE' => $message->getMailContentType(), 'MESSAGE_ID' => '', 'ATTACHMENT' => $message->getMailAttachment(), 'LINK_PROTOCOL' => static::$currentMailingChainFields['LINK_PROTOCOL'], 'LINK_DOMAIN' => static::$currentMailingChainFields['SERVER_NAME'], 'TRACK_READ' => isset($params['TRACK_READ']) ? $params['TRACK_READ'] : null, 'TRACK_CLICK' => isset($params['TRACK_CLICK']) ? $params['TRACK_CLICK'] : null));
if ($result) {
return PostingRecipientTable::SEND_RESULT_SUCCESS;
} else {
return PostingRecipientTable::SEND_RESULT_ERROR;
}
}
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:71,代码来源:postingmanager.php
示例20: getSiteCapacity
/**
* Returns site traffic capacity
*
* @param string $id Site ID.
* @return array
*/
public static function getSiteCapacity($id)
{
$cache = new \CPHPCache();
if ($cache->initCache(time() - strtotime('today'), 'abtest_site_capacity', '/abtest')) {
$capacity = $cache->getVars();
} else {
if (Loader::includeModule('conversion')) {
if ($conversionRates = Conversion\RateManager::getTypes(array('ACTIVE' => true))) {
$baseRate = array_slice($conversionRates, 0, 1, true);
$reportContext = new Conversion\ReportContext();
$from = new \DateTime('first day of last month');
$to = new \DateTime('today');
$capacity = array();
$res = \Bitrix\Main\SiteTable::getList();
while ($site = $res->fetch()) {
$lid = $site['LID'];
$reportContext->setAttribute('conversion_site', $lid);
$rateData = reset($reportContext->getRatesDeprecated($baseRate, array('>=DAY' => Type\Date::createFromPhp($from), '<=DAY' => Type\Date::createFromPhp($to)), null));
$reportContext->unsetAttribute('conversion_site', $lid);
$rate = $rateData['RATE'];
$hits = $rateData['DENOMINATOR'];
$daily = floor($hits / (date_diff($from, $to)->format('%a') + 1));
$min = $rate > 0 && $rate < 1 ? ceil(16 * (1 / $rate - 1) / pow(MIN_EFFECT, 2)) : 0;
$est = $daily ? $min / ($daily / 2) : 0;
$capacity[$lid] = array('daily' => $daily, 'min' => $min, 'est' => $est);
}
$cache->startDataCache(strtotime('tomorrow') - time());
$cache->endDataCache($capacity);
}
}
}
$result = array();
foreach ((array) $id as $lid) {
$result[$lid] = isset($capacity[$lid]) ? $capacity[$lid] : array('min' => 0, 'est' => 0);
}
return is_array($id) ? $result : reset($result);
}
开发者ID:webgksupport,项目名称:alpina,代码行数:43,代码来源:adminhelper.php
注:本文中的Bitrix\Main\SiteTable类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论