Exemple #1
0
 function installDB()
 {
     global $DB, $APPLICATION;
     $this->errors = false;
     if (!$DB->query("SELECT 'x' FROM b_abtest", true)) {
         $createTestTemplates = true;
         $this->errors = $DB->runSQLBatch($_SERVER['DOCUMENT_ROOT'] . '/bitrix/modules/abtest/install/db/' . strtolower($DB->type) . '/install.sql');
     }
     if ($this->errors !== false) {
         $APPLICATION->throwException(implode('', $this->errors));
         return false;
     }
     $eventManager = Bitrix\Main\EventManager::getInstance();
     $eventManager->registerEventHandler('main', 'OnGetCurrentSiteTemplate', 'abtest', '\\Bitrix\\ABTest\\EventHandler', 'onGetCurrentSiteTemplate');
     $eventManager->registerEventHandler('main', 'OnFileRewrite', 'abtest', '\\Bitrix\\ABTest\\EventHandler', 'onFileRewrite');
     $eventManager->registerEventHandlerCompatible('main', 'OnPageStart', 'abtest', '\\Bitrix\\ABTest\\EventHandler', 'onPageStart');
     $eventManager->registerEventHandlerCompatible('main', 'OnPanelCreate', 'abtest', '\\Bitrix\\ABTest\\EventHandler', 'onPanelCreate');
     $eventManager->registerEventHandlerCompatible('conversion', 'OnGetAttributeTypes', 'abtest', '\\Bitrix\\ABTest\\EventHandler', 'onGetAttributeTypes');
     $eventManager->registerEventHandlerCompatible('conversion', 'OnSetDayContextAttributes', 'abtest', '\\Bitrix\\ABTest\\EventHandler', 'onConversionSetContextAttributes');
     registerModule($this->MODULE_ID);
     $defSite = Bitrix\Main\SiteTable::getList(array('order' => array('ACTIVE' => 'DESC', 'DEF' => 'DESC', 'SORT' => 'ASC'), 'select' => array('LID')))->fetch();
     if (!empty($createTestTemplates) && CModule::includeModule('abtest') && !empty($defSite)) {
         $arTestTemplates = array(100 => array('ENABLED' => 'T', 'NAME' => getMessage('ABTEST_SAMPLE1_NAME'), 'DESCR' => getMessage('ABTEST_SAMPLE1_DESCR'), 'TEST_DATA' => array('id' => 'sample1', 'list' => array(array('type' => 'template', 'old_value' => '', 'new_value' => '')))), 200 => array('ENABLED' => 'T', 'NAME' => getMessage('ABTEST_SAMPLE2_NAME'), 'DESCR' => getMessage('ABTEST_SAMPLE2_DESCR'), 'TEST_DATA' => array('id' => 'sample2', 'list' => array(array('type' => 'page', 'old_value' => '', 'new_value' => '')))), 300 => array('ENABLED' => 'T', 'NAME' => getMessage('ABTEST_SAMPLE3_NAME'), 'DESCR' => getMessage('ABTEST_SAMPLE3_DESCR'), 'TEST_DATA' => array('id' => 'sample3', 'list' => array(array('type' => 'page', 'old_value' => '', 'new_value' => '')))), 400 => array('ENABLED' => 'T', 'NAME' => getMessage('ABTEST_SAMPLE4_NAME'), 'DESCR' => getMessage('ABTEST_SAMPLE4_DESCR'), 'TEST_DATA' => array('id' => 'sample4', 'list' => array(array('type' => 'page', 'old_value' => '', 'new_value' => '')))), 500 => array('ENABLED' => 'T', 'NAME' => getMessage('ABTEST_SAMPLE5_NAME'), 'DESCR' => getMessage('ABTEST_SAMPLE5_DESCR'), 'TEST_DATA' => array('id' => 'sample5', 'list' => array(array('type' => 'page', 'old_value' => '', 'new_value' => '')))), 600 => array('ENABLED' => 'T', 'NAME' => getMessage('ABTEST_SAMPLE6_NAME'), 'DESCR' => getMessage('ABTEST_SAMPLE6_DESCR'), 'TEST_DATA' => array('id' => 'sample6', 'list' => array(array('type' => 'page', 'old_value' => '', 'new_value' => '')))), 700 => array('ENABLED' => 'N', 'NAME' => getMessage('ABTEST_SAMPLE7_NAME'), 'DESCR' => getMessage('ABTEST_SAMPLE7_DESCR'), 'TEST_DATA' => array('id' => 'sample7', 'list' => array(array('type' => 'composite', 'old_value' => 'N', 'new_value' => 'Y')))), 800 => array('ENABLED' => 'N', 'NAME' => getMessage('ABTEST_SAMPLE8_NAME'), 'DESCR' => getMessage('ABTEST_SAMPLE8_DESCR'), 'TEST_DATA' => array('id' => 'sample8', 'list' => array(array('type' => 'cdn', 'old_value' => 'N', 'new_value' => 'Y')))), 900 => array('ENABLED' => 'N', 'NAME' => getMessage('ABTEST_SAMPLE9_NAME'), 'DESCR' => getMessage('ABTEST_SAMPLE9_DESCR'), 'TEST_DATA' => array('id' => 'sample9', 'list' => array(array('type' => 'bigdata', 'old_value' => 'N', 'new_value' => 'Y')))));
         foreach ($arTestTemplates as $sort => $test) {
             $test['SITE_ID'] = $defSite['LID'];
             $test['ACTIVE'] = 'N';
             $test['DURATION'] = 0;
             $test['PORTION'] = 30;
             $test['SORT'] = $sort;
             Bitrix\ABTest\ABTestTable::add($test);
         }
     }
     return true;
 }
Exemple #2
0
 public static function getDomainsList()
 {
     static $arDomains = null;
     if ($arDomains === null) {
         $arDomains = array();
         $dbSites = Bitrix\Main\SiteDomainTable::getList(array('select' => array('DOMAIN', 'LID', 'SITE_NAME' => 'SITE.NAME', 'SITE_ACTIVE' => 'SITE.ACTIVE', 'SITE_DIR' => 'SITE.DIR', 'SITE_DOC_ROOT' => 'SITE.DOC_ROOT')));
         $defaultDomain = CBXPunycode::ToASCII(Bitrix\Main\Config\Option::getRealValue('main', 'server_name'), $e = null);
         $bCurrentHostFound = false;
         while ($arSite = $dbSites->fetch()) {
             $arDomains[] = $arSite;
             if ($arSite['DOMAIN'] == $defaultDomain) {
                 $bCurrentHostFound = true;
             }
         }
         if (!$bCurrentHostFound) {
             $dbDefSite = Bitrix\Main\SiteTable::getList(array('filter' => array('DEF' => 'Y'), 'select' => array('LID', 'NAME', 'ACTIVE')));
             $arDefSite = $dbDefSite->fetch();
             if ($arDefSite) {
                 array_unshift($arDomains, array('DOMAIN' => $defaultDomain, 'LID' => $arDefSite['LID'], 'SITE_NAME' => $arDefSite['NAME'], 'SITE_ACTIVE' => $arDefSite['ACTIVE'], 'SITE_DIR' => $arDefSite['DIR'], 'SITE_DOC_ROOT' => $arDefSite['DOC_ROOT']));
             }
         }
     }
     return $arDomains;
 }
 public static function init()
 {
     IncludeModuleLangFile(__FILE__);
     if (!self::$fInit) {
         self::$fInit = true;
         self::$siteCookieId = md5('SALE_REPORT_SITE_ID');
         // Initializing list of sites.
         $result = Bitrix\Main\SiteTable::getList(array('select' => array('LID', 'DEF', 'NAME')));
         $i = 0;
         while ($row = $result->fetch()) {
             self::$sitelist[$row['LID']] = $row['NAME'];
             if (++$i === 1) {
                 self::$defaultSiteId = $row['LID'];
             } else {
                 if ($row['DEF'] === 'Y') {
                     self::$defaultSiteId = $row['LID'];
                 }
             }
             self::$weightOptions[$row['LID']] = array('unit' => COption::GetOptionString('sale', 'weight_unit', null, $row['LID']), 'koef' => COption::GetOptionInt('sale', 'weight_koef', null, $row['LID']));
         }
         unset($i, $row, $result);
         // hack, add virtual ID field into StatusLang entity for filtering
         $statusEntity = Entity\Base::getInstance('\\Bitrix\\Sale\\Internals\\StatusLang');
         if ($statusEntity instanceof \Bitrix\Main\Entity\Base) {
             $statusEntity->addField(array('data_type' => 'string', 'expression' => array('%s', 'STATUS_ID')), 'ID');
         }
         unset($statusEntity);
         // hack, add virtual REPS_ORDER field into Shipment entity for filtering system records
         $shipmentEntity = Entity\Base::getInstance('\\Bitrix\\Sale\\Internals\\Shipment');
         if ($shipmentEntity instanceof \Bitrix\Main\Entity\Base) {
             $shipmentEntity->addField(array('data_type' => 'Order', 'reference' => array('=ref.ID' => 'this.ORDER_ID', '!=this.SYSTEM' => array('?', 'Y'))), 'REPS_ORDER');
         }
         unset($shipmentEntity);
         // Initializing list of statuses of orders.
         $result = Bitrix\Sale\Internals\StatusLangTable::getList(array('select' => array('STATUS_ID', 'NAME'), 'filter' => array('=LID' => LANGUAGE_ID)));
         while ($row = $result->fetch()) {
             self::$statuslist[$row['STATUS_ID']] = $row['NAME'];
         }
         unset($row, $result);
         self::$genders = array('M' => GetMessage('USER_MALE'), 'F' => GetMessage('USER_FEMALE'));
         // Initializing list of person types.
         $result = Bitrix\Sale\Internals\PersonTypeTable::getList(array('select' => array('ID', 'LID', 'NAME')));
         while ($row = $result->fetch()) {
             self::$personTypes[$row['ID']] = array('LID' => $row['LID'], 'NAME' => $row['NAME']);
         }
         unset($row, $result);
         // Initializing list of pay systems of orders.
         $result = Bitrix\Sale\PaySystemTable::getList(array('select' => array('ID', 'LID', 'NAME')));
         while ($row = $result->fetch()) {
             self::$paySystemList[$row['ID']] = array('value' => $row['NAME'], 'site_id' => $row['LID']);
         }
         unset($row, $result);
         // Initializing list of services and methods of delivery.
         $result = \Bitrix\Sale\Delivery\Services\Table::getList(array('select' => array('ID', 'NAME')));
         while ($row = $result->fetch()) {
             self::$deliveryList[$row['ID']] = array('value' => $row['NAME'], 'site_id' => '');
         }
         unset($row, $result);
         // Obtaining table of correspondences of iblocks to sites.
         $result = Bitrix\Iblock\IblockSiteTable::getList();
         while ($row = $result->fetch()) {
             self::$iblockSite[$row['SITE_ID']][] = $row['IBLOCK_ID'];
         }
         unset($row, $result);
         // Obtaining the list of iblocks which are directories and filling
         // a property $catalogSections with sections of these units.
         $ent = new CCatalog();
         $result = $ent->GetList();
         while ($ibRow = $result->Fetch()) {
             // Obtaining list of sections of the catalog.
             self::$catalogs[] = $ibRow;
             $path = array();
             $curLevel = $prevLevel = 0;
             $sections = CIBlockSection::GetTreeList(array('=IBLOCK_ID' => $ibRow['IBLOCK_ID']));
             $row = null;
             while ($row = $sections->GetNext()) {
                 // Formation of an array of identifiers of current and parent sections.
                 $curLevel = $row['DEPTH_LEVEL'];
                 for ($i = 0; $i <= $prevLevel - $curLevel; $i++) {
                     array_pop($path);
                 }
                 array_push($path, $row['ID']);
                 $prevLevel = $curLevel;
                 self::$catalogSections[$row['ID']] = array('name' => ltrim(str_repeat(' . ', $curLevel) . $row['NAME']), 'path' => $path, 'catalog' => array('ID' => $ibRow['ID'], 'NAME' => $ibRow['NAME']));
             }
         }
         unset($ent, $ibRow, $row, $sections, $result);
         // Initialization of the list of warehouses.
         $result = Bitrix\Catalog\StoreTable::getList(array('select' => array('ID', 'TITLE')));
         while ($row = $result->fetch()) {
             self::$productStores[$row['ID']] = $row['TITLE'];
         }
         unset($row, $result);
         // Getting currencies
         $obj = new CCurrency();
         $by = '';
         $order = '';
         $result = $obj->GetList($by, $order, LANGUAGE_ID);
         while ($row = $result->Fetch()) {
             self::$currencies[$row['CURRENCY']] = array('name' => $row['FULL_NAME']);
         }
         unset($row, $result, $obj, $by, $order);
         // Getting types of prices
         $obj = new CCatalogGroup();
         $result = $obj->GetListEx(array('SORT'), array(), false, false, array('ID', 'NAME', 'BASE', 'NAME_LANG'));
         while ($row = $result->Fetch()) {
             self::$priceTypes[$row['ID']] = array('name' => empty($row['NAME_LANG']) ? $row['NAME'] : $row['NAME_LANG'], 'base' => $row['BASE'] === 'Y' ? true : false);
         }
         unset($row, $result, $obj);
         // Getting option, which means, it is necessary to display a fractional quantity of goods of no.
         self::$fDecimalQuant = COption::GetOptionString('sale', 'QUANTITY_FACTORIAL') == 'Y';
         self::initOwners();
     }
 }
        }
    }
    foreach ($arID as $ID) {
        $ID = intval($ID);
        if ($ID <= 0) {
            continue;
        }
        switch ($_REQUEST['action']) {
            case "delete":
                SitemapRuntimeTable::clearByPid($ID);
                SitemapTable::delete($ID);
                break;
        }
    }
}
$dbSites = Bitrix\Main\SiteTable::getList(array('order' => array('DEF' => 'DESC', 'NAME' => 'ASC'), 'select' => array('NAME', 'LID')));
$arSites = array();
while ($arRes = $dbSites->fetch(Converter::getHtmlConverter())) {
    $arSites[$arRes['LID']] = $arRes;
}
$map = SitemapTable::getMap();
unset($map['SETTINGS']);
$sitemapList = SitemapTable::getList(array('order' => array($by => $order), "select" => array_keys($map)));
$data = new CAdminResult($sitemapList, $tableID);
$data->NavStart();
$arHeaders = array(array("id" => "ID", "content" => Loc::getMessage("SITEMAP_ID"), "sort" => "ID", "default" => true), array("id" => "TIMESTAMP_X", "content" => Loc::getMessage('SITEMAP_TIMESTAMP_X'), "sort" => "TIMESTAMP_X", "default" => true), array("id" => "NAME", "content" => Loc::getMessage('SITEMAP_NAME'), "sort" => "NAME", "default" => true), array("id" => "SITE_ID", "content" => Loc::getMessage('SITEMAP_SITE_ID'), "sort" => "SITE_ID", "default" => true), array("id" => "DATE_RUN", "content" => Loc::getMessage('SITEMAP_DATE_RUN'), "sort" => "DATE_RUN", "default" => true), array("id" => "RUN", "content" => "", "default" => true));
$adminList->AddHeaders($arHeaders);
$adminList->NavText($data->GetNavPrint(Loc::getMessage("PAGES")));
while ($sitemap = $data->NavNext()) {
    $id = intval($sitemap['ID']);
    $row =& $adminList->AddRow($sitemap["ID"], $sitemap, "seo_sitemap_pro_edit.php?ID=" . $sitemap["ID"] . "&lang=" . LANGUAGE_ID, Loc::getMessage("SITEMAP_EDIT_TITLE"));
Exemple #5
0
        "DIV"   => "edit2",
        "TAB"   => "Данные",
        "ICON"  => "store",
        "TITLE" => "Источник данных"
    ),
    array(
        "DIV"   => "edit3",
        "TAB"   => "Результат",
        "ICON"  => "store",
        "TITLE" => ""
    )
);

$arSite = array();
$siteIterator = Bitrix\Main\SiteTable::getList(array(
    'select' => array('LID', 'NAME'),
    'order' => array('SORT' => 'ASC')
));
while ($oneSite = $siteIterator->fetch())
{
    $arSite[] = array('ID' => $oneSite['LID'], 'NAME' => $oneSite['NAME']);
}
unset($oneSite, $siteIterator);

$tabControl = new CAdminTabControl("tabControl", $aTabs, false, true);
$tabControl->Begin();

// первая вкладка
$tabControl->BeginNextTab();
if ($STEP == 1)
{
    ?>
    ?>
] <?php 
    echo $site['NAME'];
    ?>
			<?php 
} else {
    ?>
			<select id="mailbox_site_id" name="LID"<?php 
    if ($mailbox_type == 'user') {
        ?>
 onchange="changeServicesList();"<?php 
    }
    ?>
>
			<?php 
    $result = Bitrix\Main\SiteTable::getList(array('order' => array('SORT' => 'ASC')));
    ?>
			<?php 
    while (($site = $result->fetch()) !== false) {
        ?>
				<?php 
        $defSite = $defSite ?: ($mailbox_type != 'user' || !empty($mailServices[$site['LID']]) ? $site['LID'] : false);
        ?>
				<option value="<?php 
        echo $site['LID'];
        ?>
"<?php 
        if ($mailbox_type == 'user' && empty($mailServices[$site['LID']])) {
            ?>
 disabled="disabled"<?php 
        }
Exemple #7
0
<?php

require_once $_SERVER['DOCUMENT_ROOT'] . '/bitrix/modules/main/include/prolog_admin_before.php';
IncludeModuleLangFile(__FILE__);
Bitrix\Main\Loader::includeModule('abtest');
$error = getMessage('ACCESS_DENIED');
if ($USER->canDoOperation('edit_php')) {
    $error = false;
    $arSites = array();
    $dbSites = Bitrix\Main\SiteTable::getList(array('select' => array('LID')));
    while ($arSite = $dbSites->fetch()) {
        $arSites[] = $arSite['LID'];
    }
    switch ($_REQUEST['action']) {
        case 'copy':
            $site = isset($_REQUEST['site']) ? $_REQUEST['site'] : null;
            $type = isset($_REQUEST['type']) ? $_REQUEST['type'] : null;
            $source = isset($_REQUEST['source']) ? $_REQUEST['source'] : null;
            if (!check_bitrix_sessid()) {
                $error = getMessage('ABTEST_CSRF_ERROR');
            }
            if (empty($site) || empty($type) || empty($source)) {
                $error = getMessage('ABTEST_AJAX_ERROR');
            }
            if (!in_array($type, array('page'))) {
                $error = getMessage('ABTEST_AJAX_ERROR');
            }
            if (!in_array($site, $arSites)) {
                $error = getMessage('ABTEST_AJAX_ERROR');
            }
            if ($error === false) {
Exemple #8
0
use Bitrix\Seo\RobotsFile;
Loc::loadMessages(__FILE__);
if (!$USER->CanDoOperation('seo_tools')) {
    $APPLICATION->AuthForm(Loc::getMessage("ACCESS_DENIED"));
}
if (!Main\Loader::includeModule('seo')) {
    require $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/prolog_admin_after.php";
    ShowError(Loc::getMessage("SEO_ERROR_NO_MODULE"));
    require $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/epilog_admin.php";
}
$errors = '';
$siteId = isset($_REQUEST['site_id']) ? $_REQUEST['site_id'] : '';
$arCurrentSite = array();
$arDefaultSite = array();
$arSites = array();
$dbSites = Bitrix\Main\SiteTable::getList(array('order' => array('DEF' => 'DESC', 'NAME' => 'ASC'), 'select' => array('LID', 'NAME', 'DEF', 'DIR', 'DOC_ROOT', 'SERVER_NAME')));
while ($arRes = $dbSites->fetch(Converter::getHtmlConverter())) {
    if ($arRes['DOC_ROOT'] == '') {
        $arRes['DOC_ROOT'] = Converter::getHtmlConverter()->encode(Main\SiteTable::getDocumentRoot($arRes['LID']));
    }
    if ($arRes['DEF'] == 'Y') {
        $arDefaultSite = $arRes;
    }
    $arSites[$arRes['LID']] = $arRes;
}
$arCurrentSite = isset($arSites[$siteId]) ? $arSites[$siteId] : $arDefaultSite;
$siteId = $arCurrentSite['LID'];
$arRobotsConfig = array('common' => array(array('*', Loc::getMessage('SEO_ROBOTS_COMMON'))), 'yandex' => array(array('Yandex', Loc::getMessage('SEO_ROBOTS_YANDEX')), array('YandexBot', Loc::getMessage('SEO_ROBOTS_YANDEXBOT')), array('YandexMedia', Loc::getMessage('SEO_ROBOTS_YANDEXMEDIA')), array('YandexImages', Loc::getMessage('SEO_ROBOTS_YANDEXIMAGES')), array('YandexBlogs', Loc::getMessage('SEO_ROBOTS_YANDEXBLOGS')), array('YandexNews', Loc::getMessage('SEO_ROBOTS_YANDEXNEWS')), array('YandexMetrika', Loc::getMessage('SEO_ROBOTS_YANDEXMETRIKA')), array('YandexMarket', Loc::getMessage('SEO_ROBOTS_YANDEXMARKET'))), 'google' => array(array('Googlebot', Loc::getMessage('SEO_ROBOTS_GOOGLEBOT')), array('Googlebot-News', Loc::getMessage('SEO_ROBOTS_GOOGLEBOT_NEWS')), array('Googlebot-Image', Loc::getMessage('SEO_ROBOTS_GOOGLEBOT_IMAGE')), array('Googlebot-Video', Loc::getMessage('SEO_ROBOTS_GOOGLEBOT_VIDEO')), array('Googlebot-Mobile', Loc::getMessage('SEO_ROBOTS_GOOGLEBOT_MOBILE'))));
$bVendor = COption::GetOptionString('main', 'vendor', '') == '1c_bitrix';
if (!$bVendor) {
    unset($arRobotsConfig['yandex']);
Exemple #9
0
<?php

require_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/prolog_admin_before.php";
IncludeModuleLangFile(__FILE__);
Bitrix\Main\Loader::includeModule('abtest');
if (!$USER->canDoOperation('edit_php')) {
    $APPLICATION->authForm(getMessage('ACCESS_DENIED'));
}
$ID = intval($ID);
$abtest = Bitrix\ABTest\ABTestTable::getById($ID)->fetch();
if (empty($abtest)) {
    $ID = 0;
}
$arSites = array();
$dbSites = Bitrix\Main\SiteTable::getList(array('order' => array('DEF' => 'DESC', 'SORT' => 'ASC')));
while ($arSite = $dbSites->fetch()) {
    $arSites[$arSite['LID']] = $arSite;
}
$arTemplates = array();
$dbTemplates = CSiteTemplate::getList(array('ID' => 'ASC'), array('TYPE' => ''), array('ID', 'NAME'));
while ($arTemplate = $dbTemplates->fetch()) {
    $arTemplates[$arTemplate['ID']] = $arTemplate;
}
if ($REQUEST_METHOD == "POST" && (strlen($save) > 0 || strlen($apply) > 0) && check_bitrix_sessid()) {
    $arFields = array('SITE_ID' => $SITE, 'NAME' => $NAME, 'DESCR' => $DESCR, 'DURATION' => intval($DURATION) > 0 ? intval($DURATION) : 0, 'PORTION' => intval($PORTION));
    if ($ID > 0) {
        $arFields['TEST_DATA'] = $abtest['TEST_DATA'];
        $arFields['TEST_DATA']['list'] = array();
    }
    if (empty($arFields['SITE_ID'])) {
        $message = new CAdminMessage(array('MESSAGE' => getMessage('ABTEST_EMPTY_SITE')));
?>
</td>
</tr>
<tr>
	<td nowrap><?php 
echo GetMessage("MAIL_MSERVICE_ADM_SITE_ID");
?>
:</td>
	<td nowrap>
		<select name="find_site_id">
			<option value=""><?php 
echo GetMessage("MAIL_MSERVICE_ADM_FILT_ANY");
?>
</option>
			<?php 
$result = Bitrix\Main\SiteTable::getList(array('filter' => array('ACTIVE' => 'Y'), 'order' => array('SORT' => 'ASC')));
?>
			<?php 
while (($site = $result->fetch()) !== false) {
    ?>
				?><option value="<?php 
    echo $site['LID'];
    ?>
"<?php 
    if ($find_lid == $site['LID']) {
        ?>
 selected="selected"<?php 
    }
    ?>
><?php 
    echo $site['NAME'];