Example #1
0
 /**
  * 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;
 }
Example #2
0
         $source = Bitrix\ABTest\AdminHelper::getRealPath($site, $source);
         if (empty($source)) {
             $error = getMessage('ABTEST_UNKNOWN_PAGE');
         }
         if ($error === false) {
             $docRoot = rtrim(\Bitrix\Main\SiteTable::getDocumentRoot($site), '/');
             $source = new Bitrix\Main\IO\File($docRoot . $source);
             $k = 0;
             do {
                 $targetPath = BX_ROOT . '/abtest/' . date('Ymd') . '/' . sprintf('%u', crc32(rand() . time())) . $source->getName();
                 $target = new Bitrix\Main\IO\File($docRoot . $targetPath);
             } while ($target->isExists() && $k++ < 10);
             if ($target->isExists()) {
                 $error = getMessage('ABTEST_AJAX_ERROR');
             } else {
                 $success = copyDirFiles($source->getPath(), $target->getPath(), false, false, false);
                 if ($success) {
                     $result = $targetPath;
                 } else {
                     $error = getMessage('ABTEST_AJAX_ERROR');
                 }
             }
         }
     }
     break;
 case 'check':
     $site = isset($_REQUEST['site']) ? $_REQUEST['site'] : null;
     $type = isset($_REQUEST['type']) ? $_REQUEST['type'] : null;
     $value = isset($_REQUEST['value']) ? $_REQUEST['value'] : null;
     if (empty($site) || empty($type) || empty($value)) {
         $error = getMessage('ABTEST_AJAX_ERROR');