Beispiel #1
0
 function InstallFiles()
 {
     if ($_ENV['COMPUTERNAME'] != 'BX') {
         CopyDirFiles($_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/im/install/js", $_SERVER["DOCUMENT_ROOT"] . "/bitrix/js", true, true);
         CopyDirFiles($_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/im/install/components", $_SERVER["DOCUMENT_ROOT"] . "/bitrix/components", true, true);
         CopyDirFiles($_SERVER['DOCUMENT_ROOT'] . '/bitrix/modules/im/install/activities', $_SERVER['DOCUMENT_ROOT'] . '/bitrix/activities', true, true);
         CopyDirFiles($_SERVER['DOCUMENT_ROOT'] . '/bitrix/modules/im/install/admin', $_SERVER['DOCUMENT_ROOT'] . '/bitrix/admin', true, true);
         CopyDirFiles($_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/im/install/templates", $_SERVER["DOCUMENT_ROOT"] . "/bitrix/templates", True, True);
         CopyDirFiles($_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/im/install/public", $_SERVER["DOCUMENT_ROOT"] . "/", True, True);
         $default_site_id = CSite::GetDefSite();
         if ($default_site_id) {
             $arAppTempalate = array("SORT" => 1, "CONDITION" => "CSite::InDir('/desktop_app/')", "TEMPLATE" => "desktop_app");
             $arFields = array("TEMPLATE" => array());
             $dbTemplates = CSite::GetTemplateList($default_site_id);
             $desktopAppFound = false;
             while ($template = $dbTemplates->Fetch()) {
                 if ($template["TEMPLATE"] == "desktop_app") {
                     $desktopAppFound = true;
                     $template = $arAppTempalate;
                 }
                 $arFields["TEMPLATE"][] = array("TEMPLATE" => $template['TEMPLATE'], "SORT" => $template['SORT'], "CONDITION" => $template['CONDITION']);
             }
             if (!$desktopAppFound) {
                 $arFields["TEMPLATE"][] = $arAppTempalate;
             }
             $obSite = new CSite();
             $arFields["LID"] = $default_site_id;
             $obSite->Update($default_site_id, $arFields);
         }
         $GLOBALS["APPLICATION"]->SetFileAccessPermission('/desktop_app/', array("*" => "R"));
     }
     return true;
 }
Beispiel #2
0
 function InstallFiles($site_dir = "/", $default_site_id = false)
 {
     CopyDirFiles($_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/eshopapp/install/components", $_SERVER["DOCUMENT_ROOT"] . "/bitrix/components", true, true);
     CopyDirFiles($_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/eshopapp/install/templates/", $_SERVER["DOCUMENT_ROOT"] . "/bitrix/templates/", true, true);
     if (!$default_site_id) {
         $default_site_id = CSite::GetDefSite();
     }
     if ($default_site_id) {
         $arAppTempalate = array("SORT" => 1, "CONDITION" => "CSite::InDir('" . $site_dir . "eshop_app/')", "TEMPLATE" => "eshop_app");
         $arFields = array("TEMPLATE" => array());
         $dbTemplates = CSite::GetTemplateList($default_site_id);
         $eshopAppFound = false;
         while ($template = $dbTemplates->Fetch()) {
             if ($template["TEMPLATE"] == "eshop_app") {
                 $eshopAppFound = true;
                 $template = $arAppTempalate;
             }
             $arFields["TEMPLATE"][] = array("TEMPLATE" => $template['TEMPLATE'], "SORT" => $template['SORT'], "CONDITION" => $template['CONDITION']);
         }
         if (!$eshopAppFound) {
             $arFields["TEMPLATE"][] = $arAppTempalate;
         }
         $obSite = new CSite();
         $arFields["LID"] = $default_site_id;
         $obSite->Update($default_site_id, $arFields);
     }
     return true;
 }
Beispiel #3
0
 function InstallFiles()
 {
     CopyDirFiles($_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/mobile/public/mobile/", $_SERVER["DOCUMENT_ROOT"] . "/mobile/", True, True);
     CopyDirFiles($_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/mobile/install/templates/", $_SERVER["DOCUMENT_ROOT"] . "/bitrix/templates/", True, True);
     CopyDirFiles($_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/mobile/install/components/", $_SERVER["DOCUMENT_ROOT"] . "/bitrix/components", true, true);
     $default_site_id = CSite::GetDefSite();
     if ($default_site_id) {
         $arAppTempalate = array("SORT" => 1, "CONDITION" => "CSite::InDir('/mobile/')", "TEMPLATE" => "mobile_app");
         $arFields = array("TEMPLATE" => array());
         $dbTemplates = CSite::GetTemplateList($default_site_id);
         $mobileAppFound = false;
         while ($template = $dbTemplates->Fetch()) {
             if ($template["TEMPLATE"] == "mobile_app") {
                 $mobileAppFound = true;
                 $template = $arAppTempalate;
             }
             $arFields["TEMPLATE"][] = array("TEMPLATE" => $template['TEMPLATE'], "SORT" => $template['SORT'], "CONDITION" => $template['CONDITION']);
         }
         if (!$mobileAppFound) {
             $arFields["TEMPLATE"][] = $arAppTempalate;
         }
         $obSite = new CSite();
         $arFields["LID"] = $default_site_id;
         $obSite->Update($default_site_id, $arFields);
     }
     CUrlRewriter::ReindexFile("/mobile/webdav/index.php");
     CUrlRewriter::ReindexFile("/mobile/disk/index.php");
     CUrlRewriter::Add(array("CONDITION" => "#^/mobile/disk/(?<hash>[0-9]+)/download#", "RULE" => "download=1&objectId=\$1", "ID" => "bitrix:mobile.disk.file.detail", "PATH" => "/mobile/disk/index.php"));
     return true;
 }
Beispiel #4
0
        echo GetMessageJS("FORM_FIELD_MULTIPLE_WARNING");
        ?>
'
}
</script><script src="/bitrix/js/form/form_taskbar.js?<?php 
        echo @filemtime($_SERVER['DOCUMENT_ROOT'] . '/bitrix/js/form/form_taskbar.js');
        ?>
"></script>
	<tr>
		<td colspan="2"><div id="form_tpl_editor" style="display: <?php 
        echo $str_USE_DEFAULT_TEMPLATE == "Y" ? "none" : "block";
        ?>
;">
<?php 
        $site = is_array($arSITE) ? $arSITE[0] : LANG;
        $arTplList = CSite::GetTemplateList($site);
        $tpl = "";
        while ($ar = $arTplList->Fetch()) {
            if (strlen($tpl) == 0) {
                $tpl = $ar["TEMPLATE"];
            }
            if (strlen(trim($ar["CONDITION"])) == 0) {
                $tpl = $ar["TEMPLATE"];
                break;
            }
        }
        CFileMan::ShowHTMLEditControl("FORM_TEMPLATE", htmlspecialcharsback($str_FORM_TEMPLATE), array("site" => $arSITE[0], "templateID" => $tpl, "bUseOnlyDefinedStyles" => COption::GetOptionString("fileman", "show_untitled_styles", "N") != "Y", "bWithoutPHP" => false, "arToolbars" => array("standart", "style", "formating", "source", "template", "table"), "arTaskbars" => array("BXFormElementsTaskbar", "BXPropertiesTaskbar"), "toolbarConfig" => CFileman::GetEditorToolbarConfig("form_edit" . (defined('BX_PUBLIC_MODE') && BX_PUBLIC_MODE == 1 ? "_public" : "")), "sBackUrl" => "", "fullscreen" => false, 'width' => '100%', 'height' => '500', 'use_editor_3' => 'N'));
        ?>
<script>
oBXEditorUtils.addPHPParser(oForm.PHPParser);
oBXEditorUtils.addTaskBar('BXFormElementsTaskbar', 2, "<?php 
Beispiel #5
0
	function __InstallTemplate($templateID)
	{
		if (!array_key_exists($templateID, $this->arTemplates))
			return;

		//Copy template
		$canCopyTemplate = !(
			file_exists($_SERVER["DOCUMENT_ROOT"].FX_PERSONAL_ROOT."/templates/".$templateID) &&
			isset($this->arTemplates[$templateID]["REWRITE"]) && $this->arTemplates[$templateID]["REWRITE"] == "N"
		);

		//If the main module was not included
		global $DB, $DBType, $APPLICATION, $USER;
		require_once($_SERVER['DOCUMENT_ROOT']."/freetrix/modules/main/include.php");

		if ($canCopyTemplate)
		{
			CopyDirFiles(
				$_SERVER["DOCUMENT_ROOT"].$this->__GetTemplatesPath()."/".$templateID,
				$_SERVER["DOCUMENT_ROOT"].FX_PERSONAL_ROOT."/templates/".$templateID,
				$rewrite = true,
				$recursive = true
			);
		}

		//Attach template to default site
		$obSite = CSite::GetList($by = "def", $order = "desc", Array("ACTIVE" => "Y"));
		if ($arSite = $obSite->Fetch())
		{
			$arTemplates = Array();
			$found = false;
			$obTemplate = CSite::GetTemplateList($arSite["LID"]);
			while($arTemplate = $obTemplate->Fetch())
			{
				if(!$found && strlen(Trim($arTemplate["CONDITION"]))<=0)
				{
					$arTemplate["TEMPLATE"] = $templateID;
					$found = true;
				}
				$arTemplates[]= $arTemplate;
			}

			if (!$found)
				$arTemplates[]= Array("CONDITION" => "", "SORT" => 150, "TEMPLATE" => $templateID);

			$arFields = Array(
				"TEMPLATE" => $arTemplates,
				"NAME" => $arSite["NAME"],
			);

			$obSite = new CSite();
			$obSite->Update($arSite["LID"], $arFields);
		}

		//Copy files
		$this->__MoveDirFiles($this->arTemplates[$templateID]);
	}
Beispiel #6
0
 function GetAllTemplateParams($templateID, $site, $findcomponent = true, $arAdditionalParams = array())
 {
     global $APPLICATION;
     $db_templ = CSiteTemplate::GetByID($templateID);
     if (!($ar_templ = $db_templ->Fetch())) {
         $templateID = "";
         $db_site_templ = CSite::GetTemplateList($site);
         while ($ar_site_templ = $db_site_templ->Fetch()) {
             if (strlen($ar_site_templ["CONDITION"]) <= 0) {
                 $templateID = $ar_site_templ["TEMPLATE"];
                 break;
             }
         }
         if (strlen($templateID) > 0) {
             $db_templ = CSiteTemplate::GetByID($templateID);
             $ar_templ = $db_templ->Fetch();
         }
     }
     if ($ar_templ) {
         $arResult = array("ID" => $ar_templ["ID"], "NAME" => $ar_templ["NAME"]);
         if (is_set($ar_templ, "STYLES")) {
             // Fetch @import and include it to CSS - will include css from comments also :(.
             $pattern = '/^@import(.*)$/im';
             $matches = array();
             if (preg_match_all($pattern, $ar_templ["STYLES"], $matches)) {
                 for ($j = 0, $l = count($matches[0]); $j < $l; $j++) {
                     $str = $matches[0][$j];
                     $url = trim(trim($matches[1][$j]), '"\';');
                     $css = "";
                     if (substr($url, -5) != 'print') {
                         $url = trim(trim($url), ' "\';');
                         if (substr($url, 0, 4) == 'url(' && substr($url, -1) == ')') {
                             $url = trim(substr($url, 4, -1), ' "\'');
                         }
                         $url = trim(trim($url), '\'";');
                         if (substr($url, 0, 1) != '/' && file_exists($_SERVER["DOCUMENT_ROOT"] . BX_PERSONAL_ROOT . "/templates/" . $ar_templ["ID"] . "/" . $url)) {
                             $css = "\n" . $APPLICATION->GetFileContent($_SERVER["DOCUMENT_ROOT"] . BX_PERSONAL_ROOT . "/templates/" . $ar_templ["ID"] . "/" . $url) . "\n";
                         } else {
                             if (file_exists($_SERVER["DOCUMENT_ROOT"] . $url)) {
                                 $css = "\n" . $APPLICATION->GetFileContent($_SERVER["DOCUMENT_ROOT"] . $url) . "\n";
                             }
                         }
                     }
                     $ar_templ["STYLES"] = str_replace($matches[0][$j], $css, $ar_templ["STYLES"]);
                 }
             }
             $arResult["STYLES"] = $ar_templ["STYLES"];
             $arResult["STYLES_TITLE"] = $ar_templ["STYLES_TITLE"];
             $arResult["EDITOR_STYLES"] = $ar_templ["EDITOR_STYLES"];
         }
     } else {
         $arResult = array("ID" => ".default", "NAME" => GetMessage("FILEMAN_DDEF_TEMPLATE"));
         $templateID = "";
     }
     if (!is_set($arResult, "STYLES") || $arResult["STYLES"] == false) {
         if (file_exists($_SERVER["DOCUMENT_ROOT"] . BX_PERSONAL_ROOT . "/php_interface/" . (strlen($site) <= 0 ? LANGUAGE_ID : $site) . "/styles.css")) {
             $arResult["STYLES"] = $APPLICATION->GetFileContent($_SERVER["DOCUMENT_ROOT"] . BX_PERSONAL_ROOT . "/php_interface/" . (strlen($site) <= 0 ? LANGUAGE_ID : $site) . "/styles.css");
             $arResult["STYLES_TITLE"] = CSiteTemplate::__GetByStylesTitle($_SERVER["DOCUMENT_ROOT"] . BX_PERSONAL_ROOT . "/php_interface/" . (strlen($site) <= 0 ? LANGUAGE_ID : $site) . "/.styles.php");
         } elseif (file_exists($_SERVER["DOCUMENT_ROOT"] . BX_PERSONAL_ROOT . "/php_interface/styles.css")) {
             $arResult["STYLES"] = $APPLICATION->GetFileContent($_SERVER["DOCUMENT_ROOT"] . BX_PERSONAL_ROOT . "/php_interface/styles.css");
             $arResult["STYLES_TITLE"] = CSiteTemplate::__GetByStylesTitle($_SERVER["DOCUMENT_ROOT"] . BX_PERSONAL_ROOT . "/php_interface/.styles.php");
         } else {
             $arResult["STYLES"] = $APPLICATION->GetFileContent($_SERVER["DOCUMENT_ROOT"] . BX_PERSONAL_ROOT . "/templates/.default/styles.css");
             $arResult["STYLES_TITLE"] = CSiteTemplate::__GetByStylesTitle($_SERVER["DOCUMENT_ROOT"] . BX_PERSONAL_ROOT . "/templates/.default/.styles.php");
         }
     }
     if (isset($arAdditionalParams['additionalCSS'])) {
         $additionalCSS = $arAdditionalParams['additionalCSS'];
         for ($i = 0, $l = count($additionalCSS); $i < $l; $i++) {
             $css_file_path = $additionalCSS[$i];
             $arResult["STYLES"] .= "\r\n" . $APPLICATION->GetFileContent($css_file_path);
         }
     }
     if (strlen($templateID) > 0 && file_exists($_SERVER["DOCUMENT_ROOT"] . BX_PERSONAL_ROOT . "/templates/" . $templateID . "/editor.css")) {
         $arResult["STYLES"] .= "\r\n" . $APPLICATION->GetFileContent($_SERVER["DOCUMENT_ROOT"] . BX_PERSONAL_ROOT . "/templates/" . $templateID . "/editor.css");
     } elseif (file_exists($_SERVER["DOCUMENT_ROOT"] . BX_PERSONAL_ROOT . "/templates/.default/editor.css")) {
         $arResult["STYLES"] .= "\r\n" . $APPLICATION->GetFileContent($_SERVER["DOCUMENT_ROOT"] . BX_PERSONAL_ROOT . "/templates/.default/editor.css");
     } elseif (file_exists($_SERVER["DOCUMENT_ROOT"] . BX_PERSONAL_ROOT . "/php_interface/" . $site . "/editor.css")) {
         $arResult["STYLES"] .= "\r\n" . $APPLICATION->GetFileContent($_SERVER["DOCUMENT_ROOT"] . BX_PERSONAL_ROOT . "/php_interface/" . (strlen($site) <= 0 ? LANGUAGE_ID : $site) . "/editor.css");
     } elseif (file_exists($_SERVER["DOCUMENT_ROOT"] . BX_PERSONAL_ROOT . "/php_interface/editor.css")) {
         $arResult["STYLES"] .= "\r\n" . $APPLICATION->GetFileContent($_SERVER["DOCUMENT_ROOT"] . BX_PERSONAL_ROOT . "/php_interface/editor.css");
     }
     $arResult["STYLES"] = preg_replace("/\r\n/", " ", $arResult["STYLES"]);
     $arResult["STYLES"] = preg_replace("/\n/", " ", $arResult["STYLES"]);
     $arResult["SITE_TEMPLATE_PATH"] = getLocalPath('templates/' . $templateID, BX_PERSONAL_ROOT);
     return $arResult;
 }
Beispiel #7
0
if (IsModuleInstalled('intranet')) {
    $arComponentParameters["PARAMETERS"]["PATH_TO_CONPANY_DEPARTMENT"] = array("NAME" => GetMessage("SONET_PATH_TO_CONPANY_DEPARTMENT"), "DEFAULT" => "/company/structure.php?set_filter_structure=Y&structure_UF_DEPARTMENT=#ID#", "PARENT" => "URL_TEMPLATES");
}
$arSMThemesMessages = array("grey" => GetMessage("SONET_SM_THEME_GREY"), "red" => GetMessage("SONET_SM_THEME_RED"), "green" => GetMessage("SONET_SM_THEME_GREEN"), "blue" => GetMessage("SONET_SM_THEME_BLUE"), "lightblue" => GetMessage("SONET_SM_THEME_LIGHTBLUE"), "brown" => GetMessage("SONET_SM_THEME_BROWN"));
$arSMThemes = array();
$dir = trim(preg_replace("'[\\\\/]+'", "/", $_SERVER['DOCUMENT_ROOT'] . "/bitrix/components/bitrix/socialnetwork.menu/templates/.default/themes/"));
if (is_dir($dir) && ($directory = opendir($dir))) {
    while (($file = readdir($directory)) !== false) {
        if ($file != "." && $file != ".." && is_dir($dir . $file)) {
            $arSMThemes[$file] = !empty($arSMThemesMessages[$file]) ? $arSMThemesMessages[$file] : strtoupper(substr($file, 0, 1)) . strtolower(substr($file, 1));
        }
    }
    closedir($directory);
}
$tmp_site = $_REQUEST["site"] != '' ? $_REQUEST["site"] : ($_REQUEST["src_site"] != '' ? $_REQUEST["src_site"] : false);
$dbSiteRes = CSite::GetTemplateList($tmp_site);
while ($arSiteRes = $dbSiteRes->Fetch()) {
    if (empty($arSiteRes["CONDITION"])) {
        $site_template = $arSiteRes["TEMPLATE"];
        break;
    }
}
if (strpos($site_template, "bright") === 0) {
    $DefaultSMTheme = "grey";
} else {
    if (CModule::IncludeModule('extranet') && CExtranet::IsExtranetSite($tmp_site)) {
        $theme_id = COption::GetOptionString("main", "wizard_" . $site_template . "_theme_id_extranet");
    } else {
        $theme_id = COption::GetOptionString("main", "wizard_" . $site_template . "_theme_id");
    }
    if (strlen($theme_id) > 0) {
Beispiel #8
0
 function InstallService($serviceID, $serviceStage)
 {
     $wizard =& $this->GetWizard();
     $siteID = COption::GetOptionString("main", "wizard_site_code_extranet");
     $siteFolder = COption::GetOptionString("main", "wizard_site_folder_extranet");
     $siteName = COption::GetOptionString("main", "wizard_site_name_extranet");
     if (COption::GetOptionString("main", "wizard_extranet_rerun") == "Y") {
         define("WIZARD_IS_RERUN", true);
     }
     if (WIZARD_IS_RERUN === true) {
         $rsSites = CSite::GetByID(COption::GetOptionString("extranet", "extranet_site"));
         if ($arSite = $rsSites->Fetch()) {
             define("WIZARD_SITE_ID", $arSite["ID"]);
             define("WIZARD_SITE_DIR", $arSite["DIR"]);
             define("WIZARD_SITE_NAME", $siteName);
             define("WIZARD_SITE_PATH", $_SERVER["DOCUMENT_ROOT"] . $arSite["DIR"]);
             $bFound = true;
         }
     }
     if (!$bFound) {
         define("WIZARD_SITE_ID", $siteID);
         define("WIZARD_SITE_DIR", $siteFolder);
         define("WIZARD_SITE_NAME", $siteName);
         define("WIZARD_SITE_PATH", $_SERVER["DOCUMENT_ROOT"] . $siteFolder);
     }
     $wizardPath = $wizard->GetPath();
     define("WIZARD_RELATIVE_PATH", $wizardPath);
     define("WIZARD_ABSOLUTE_PATH", $_SERVER["DOCUMENT_ROOT"] . $wizardPath);
     $templatesPath = "";
     $templatesPath = CExtranetWizardServices::GetTemplatesPath(WIZARD_RELATIVE_PATH . "/site");
     $arTemplates = CExtranetWizardServices::GetTemplates($templatesPath);
     $templateID = $wizard->GetVar("templateID");
     if ($templateID == "current_intranet_template") {
         $rsDefSiteTemplates = CSite::GetTemplateList(CSite::GetDefSite());
         while ($arDefSiteTemplates = $rsDefSiteTemplates->Fetch()) {
             if ($arDefSiteTemplates["CONDITION"] == "") {
                 $templateID = $arDefSiteTemplates["TEMPLATE"];
                 break;
             }
         }
     }
     define("WIZARD_TEMPLATE_ID", $templateID);
     if (in_array($templateID, array("bright_extranet", "classic_extranet", "modern_extranet"))) {
         define("WIZARD_TEMPLATE_RELATIVE_PATH", $templatesPath . "/" . WIZARD_TEMPLATE_ID);
         define("WIZARD_TEMPLATE_ABSOLUTE_PATH", $_SERVER["DOCUMENT_ROOT"] . WIZARD_TEMPLATE_RELATIVE_PATH);
         $themeID = $wizard->GetVar($templateID . "_themeID");
         $arThemes = CExtranetWizardServices::GetThemes(WIZARD_TEMPLATE_RELATIVE_PATH . "/themes");
         define("WIZARD_THEME_ID", $themeID);
         define("WIZARD_THEME_RELATIVE_PATH", WIZARD_TEMPLATE_RELATIVE_PATH . "/themes/" . WIZARD_THEME_ID);
         define("WIZARD_THEME_ABSOLUTE_PATH", $_SERVER["DOCUMENT_ROOT"] . WIZARD_THEME_RELATIVE_PATH);
     }
     $servicePath = WIZARD_RELATIVE_PATH . "/site/services/" . $serviceID;
     define("WIZARD_SERVICE_RELATIVE_PATH", $servicePath);
     define("WIZARD_SERVICE_ABSOLUTE_PATH", $_SERVER["DOCUMENT_ROOT"] . $servicePath);
     $b24ToCp = file_exists(WIZARD_SITE_PATH . ".superleft.menu.php") ? true : false;
     define("WIZARD_B24_TO_CP", $b24ToCp);
     define("WIZARD_SITE_LOGO", intval($wizard->GetVar("siteLogo")));
     if (!file_exists(WIZARD_SERVICE_ABSOLUTE_PATH . "/" . $serviceStage)) {
         return false;
     }
     if (LANGUAGE_ID != "en" && LANGUAGE_ID != "ru") {
         if (file_exists(WIZARD_SERVICE_ABSOLUTE_PATH . "/lang/en/" . $serviceStage)) {
             __IncludeLang(WIZARD_SERVICE_ABSOLUTE_PATH . "/lang/en/" . $serviceStage);
         }
     }
     $dbGroups = CGroup::GetList($by = "id", $order = "asc", array("ACTIVE" => "Y"));
     while ($arGroup = $dbGroups->Fetch()) {
         define("WIZARD_" . $arGroup["STRING_ID"] . "_GROUP", $arGroup["ID"]);
     }
     if (file_exists(WIZARD_SERVICE_ABSOLUTE_PATH . "/lang/" . LANGUAGE_ID . "/" . $serviceStage)) {
         __IncludeLang(WIZARD_SERVICE_ABSOLUTE_PATH . "/lang/" . LANGUAGE_ID . "/" . $serviceStage);
     }
     @set_time_limit(3600);
     global $DB, $DBType, $APPLICATION, $USER, $CACHE_MANAGER;
     include WIZARD_SERVICE_ABSOLUTE_PATH . "/" . $serviceStage;
 }
Beispiel #9
0
        return;
    }
    $success = $package->ImportPackage();
    if ($success) {
        $dbResult = CCourse::GetList(array(), array("CODE" => "BX-ADM001"));
        $arCourse = $dbResult->Fetch();
    }
}
if (isset($arCourse["ID"])) {
    CCourse::SetPermission($arCourse["ID"], array("2" => "R"));
}
//Public files
CopyDirFiles($pathToService . "/" . LANGUAGE_ID . "/public", $_SERVER["DOCUMENT_ROOT"] . "/communication/learning", $rewrite = false, $recursive = true);
//Left menu
DemoSiteUtil::AddMenuItem("/communication/.left.menu.php", array(GetMessage("SERVICE_LEARNING"), "/communication/learning/", array(), array(), ""));
//Template
CopyDirFiles($pathToService . "/" . LANGUAGE_ID . "/template", $_SERVER["DOCUMENT_ROOT"] . BX_PERSONAL_ROOT . "/templates/learning", $rewrite = true, $recursive = true);
$obSite = CSite::GetByID("s1");
if (!($arSite = $obSite->Fetch())) {
    return;
}
$arTemplates = array();
$obTemplate = CSite::GetTemplateList("s1");
while ($arTemplate = $obTemplate->Fetch()) {
    $arTemplates[] = $arTemplate;
}
$arTemplates[] = array("CONDITION" => "CSite::InDir('/communication/learning/course/')", "SORT" => 150, "TEMPLATE" => "learning");
$obSite = new CSite();
$obSite->Update("s1", array("TEMPLATE" => $arTemplates, "NAME" => $arSite["NAME"]));
//Communication section
include dirname(__FILE__) . "/../communication/install.php";
Beispiel #10
0
	private function Init($arParams)
	{
		global $USER, $APPLICATION;

		?>
		<script>
			(function() {
				if (!window.BXHtmlEditor)
				{
					var BXHtmlEditor = {
						ajaxResponse: {},
						editors: {},
						configs: {},
						dialogs: {},
						Controls: {},
						SaveConfig: function(config)
						{
							BX.ready(function()
								{
									if (config && config.id)
									{
										BXHtmlEditor.configs[config.id] = config;
									}
								}
							);
						},
						Show: function(config, id)
						{
							BX.ready(function()
								{
									if ((!config || typeof config != 'object') && id && BXHtmlEditor.configs[id])
									{
										config = BXHtmlEditor.configs[id];
									}

									if (config && typeof config == 'object')
									{
										if (!BXHtmlEditor.editors[config.id] || !BXHtmlEditor.editors[config.id].Check())
										{
											BXHtmlEditor.editors[config.id] = new window.BXEditor(config);
											BXHtmlEditor.editors[config.id].Show();
											BX.onCustomEvent(BXHtmlEditor, 'OnEditorCreated',[BXHtmlEditor.editors[config.id]]);
										}
										else
										{
											BXHtmlEditor.editors[config.id].CheckAndReInit();
										}
									}
								}
							);
						},
						Hide: function(id)
						{
							if (BXHtmlEditor.editors[id])
							{
								BXHtmlEditor.editors[config.id].Hide();
							}
						},
						Get: function(id)
						{
							return BXHtmlEditor.editors[id] || false;
						},
						OnBeforeUnload: function(e)
						{
							for (var id in BXHtmlEditor.editors)
							{
								if (BXHtmlEditor.editors.hasOwnProperty(id) &&
									BXHtmlEditor.editors[id].config.askBeforeUnloadPage === true &&
									BXHtmlEditor.editors[id].IsShown() &&
									BXHtmlEditor.editors[id].IsContentChanged() &&
									!BXHtmlEditor.editors[id].IsSubmited() &&
									BXHtmlEditor.editors[id].beforeUnloadHandlerAllowed !== false)
								{
									return BXHtmlEditor.editors[id].config.beforeUnloadMessage || BX.message('BXEdExitConfirm');
								}
							}
						}
					};
					top.BXHtmlEditor = window.BXHtmlEditor = BXHtmlEditor;
					window.onbeforeunload = BXHtmlEditor.OnBeforeUnload;
				}
				BX.onCustomEvent(window, "OnBXHtmlEditorInit");
			})();
		</script><?

		$basePath = '/bitrix/js/fileman/html_editor/';
		$this->id = (isset($arParams['id']) && strlen($arParams['id']) > 0) ? $arParams['id'] : 'bxeditor'.substr(uniqid(mt_rand(), true), 0, 4);
		$this->id = preg_replace("/[^a-zA-Z0-9_:\.]/is", "", $this->id);
		if (isset($arParams['name']))
		{
			$this->name = preg_replace("/[^a-zA-Z0-9_:\.]/is", "", $arParams['name']);
		}
		else
		{
			$this->name = $this->id;
		}

		$this->cssIframePath = $this->GetActualPath($basePath.'iframe-style.css');

		CJSCore::RegisterExt('html_editor', array(
			'js' => array(
				$basePath.'range.js',
				$basePath.'html-actions.js',
				$basePath.'html-views.js',
				$basePath.'html-parser.js',
				$basePath.'html-base-controls.js',
				$basePath.'html-controls.js',
				$basePath.'html-components.js',
				$basePath.'html-snippets.js',
				$basePath.'html-editor.js',
				'/bitrix/js/main/dd.js'
			),
			'css' => $basePath.'html-editor.css',
			'rel' => array('date', 'timer')
		));
		CUtil::InitJSCore(array('html_editor'));

		$db_events = GetModuleEvents("fileman", "OnBeforeHTMLEditorScriptRuns");
		while($arEvent = $db_events->Fetch())
		{
			ExecuteModuleEventEx($arEvent);
		}

		$this->bAutorized = is_object($USER) && $USER->IsAuthorized();
		if (isset($arParams['allowPhp']) && !isset($arParams['bAllowPhp']))
		{
			$arParams['bAllowPhp'] = $arParams['allowPhp'];
		}

		$this->bAllowPhp = $arParams['bAllowPhp'] !== false;
		$arParams['limitPhpAccess'] = $arParams['limitPhpAccess'] === true;
		$this->display = !isset($arParams['display']) || $arParams['display'];

		$arParams["bodyClass"] = COption::GetOptionString("fileman", "editor_body_class", "");
		$arParams["bodyId"] = COption::GetOptionString("fileman", "editor_body_id", "");

		$this->content = $arParams['content'];
		$this->inputName = isset($arParams['inputName']) ? $arParams['inputName'] : 'html_editor_content';
		$this->inputId = isset($arParams['inputId']) ? $arParams['inputId'] : 'html_editor_content_id';

		$arParams["bbCode"] = (isset($arParams["bbCode"]) && $arParams["bbCode"]) || (isset($arParams["BBCode"]) && $arParams["BBCode"]);

		// Site id
		if (!isset($arParams['siteId']))
		{
			$siteId = CSite::GetDefSite();
		}
		else
		{
			$siteId = $arParams['siteId'];
			$res = CSite::GetByID($siteId);
			if (!$res->Fetch())
			{
				$siteId = CSite::GetDefSite();
			}
		}
		if (!isset($siteId) && defined(SITE_ID))
		{
			$siteId = SITE_ID;
			$res = CSite::GetByID($siteId);
			if (!$res->Fetch())
			{
				$siteId = CSite::GetDefSite();
			}
		}

		$templateId = null;
		if (isset($arParams['templateId']))
		{
			$templateId = $arParams['templateId'];
		}
		elseif (defined(SITE_TEMPLATE_ID))
		{
			$templateId = SITE_TEMPLATE_ID;
		}

		if ($arParams["bbCode"])
		{
			$arTemplates = array();
			$arSnippets = array();
			$templateParams = array();
		}
		else
		{
			if (isset($arParams['arTemplates']))
			{
				$arTemplates = $arParams['arTemplates'];
			}
			else
			{
				$arTemplates = self::GetSiteTemplates();
			}

			if (!isset($templateId) && isset($siteId))
			{
				$dbSiteRes = CSite::GetTemplateList($siteId);
				$first = false;
				while($arSiteRes = $dbSiteRes->Fetch())
				{
					if (!$first)
					{
						$first = $arSiteRes['TEMPLATE'];
					}
					if ($arSiteRes['CONDITION'] == "")
					{
						$templateId = $arSiteRes['TEMPLATE'];
						break;
					}
				}

				if (!isset($templateId))
				{
					$templateId = $first;
				}
			}

			$arSnippets = array($templateId => self::GetSnippets($templateId));
			$templateParams = self::GetSiteTemplateParams($templateId, $siteId);
		}

		$userSettings = array(
			'view' => isset($arParams["view"]) ? $arParams["view"] : 'wysiwyg',
			'split_vertical' => 0,
			'split_ratio' => 1,
			'taskbar_shown' => 0,
			'taskbar_width' => 250,
			'specialchars' => false,
			'clean_empty_spans' => 'Y'
		);
		$settingsKey = "user_settings_".$arParams["bbCode"];

		$curSettings = CUserOptions::GetOption("html_editor", $settingsKey, false, $USER->GetId());
		if (is_array($curSettings))
		{
			foreach ($userSettings as $k => $val)
			{
				if (isset($curSettings[$k]))
				{
					$userSettings[$k] = $curSettings[$k];
				}
			}
		}

		if(!isset($arParams["usePspell"]))
		{
			$arParams["usePspell"] = COption::GetOptionString("fileman", "use_pspell", "N");
		}

		if(!isset($arParams["useCustomSpell"]))
		{
			$arParams["useCustomSpell"] = COption::GetOptionString("fileman", "use_custom_spell", "Y");
		}

		$arParams["showComponents"] = isset($arParams["showComponents"]) ? $arParams["showComponents"] : true;
		$arParams["showSnippets"] = isset($arParams["showSnippets"]) ? $arParams["showSnippets"] : true;

		if(!isset($arParams["initConponentParams"]))
			$arParams["initConponentParams"] = $arParams["showTaskbars"] !== false && $arParams["showComponents"] && ($arParams['limitPhpAccess'] || $arParams['bAllowPhp']);

		$arParams["actionUrl"] = $arParams["bbCode"] ? '/bitrix/tools/html_editor_action.php' : '/bitrix/admin/fileman_html_editor_action.php';

		$this->jsConfig = array(
			'id' => $this->id,
			'inputName' => $this->name,
			'content' => $this->content,
			'width' => $arParams['width'],
			'height' => $arParams['height'],
			'allowPhp' => $this->bAllowPhp,
			'limitPhpAccess' => $arParams['limitPhpAccess'],
			'templates' => $arTemplates,
			'templateId' => $templateId,
			'templateParams' => $templateParams,
			'snippets' => $arSnippets,
			'placeholder' => isset($arParams['placeholder']) ? $arParams['placeholder'] : 'Text here...',
			'actionUrl' => $arParams["actionUrl"],
			'cssIframePath' => $this->cssIframePath,
			'bodyClass' => $arParams["bodyClass"],
			'bodyId' => $arParams["bodyId"],
			'spellcheck_path' => $basePath.'html-spell.js?v='.filemtime($_SERVER['DOCUMENT_ROOT'].$basePath.'html-spell.js'),
			'usePspell' => $arParams["usePspell"],
			'useCustomSpell' => $arParams["useCustomSpell"],
			'bbCode' => $arParams["bbCode"],
			'askBeforeUnloadPage' => $arParams["askBeforeUnloadPage"] !== false,
			'settingsKey' => $settingsKey,
			'showComponents' => $arParams["showComponents"],
			'showSnippets' => $arParams["showSnippets"],
			// user settings
			'view' => $userSettings['view'],
			'splitVertical' => $userSettings['split_vertical'] ? true : false,
			'splitRatio' => $userSettings['split_ratio'],
			'taskbarShown' => $userSettings['taskbar_shown'] ? true : false,
			'taskbarWidth' => $userSettings['taskbar_width'],
			'lastSpecialchars' => $userSettings['specialchars'] ? explode('|', $userSettings['specialchars']) : false,
			'cleanEmptySpans' => $userSettings['clean_empty_spans'] != 'N'
		);
		if (($this->bAllowPhp || $arParams['limitPhpAccess']) && $arParams["showTaskbars"] !== false)
		{
			$this->jsConfig['components'] = self::GetComponents($templateId);
		}

		if (isset($arParams["showTaskbars"]))
			$this->jsConfig["showTaskbars"] = $arParams["showTaskbars"];

		if (isset($arParams["showNodeNavi"]))
			$this->jsConfig["showNodeNavi"] = $arParams["showNodeNavi"];

		if (isset($arParams["controlsMap"]))
			$this->jsConfig["controlsMap"] = $arParams["controlsMap"];

		if (isset($arParams["arSmiles"]))
			$this->jsConfig["smiles"] = $arParams["arSmiles"];

		if (isset($arParams["iframeCss"]))
			$this->jsConfig["iframeCss"] = $arParams["iframeCss"];

		if (isset($arParams["beforeUnloadMessage"]))
			$this->jsConfig["beforeUnloadMessage"] = $arParams["beforeUnloadMessage"];

		if (isset($arParams["setFocusAfterShow"]))
			$this->jsConfig["setFocusAfterShow"] = $arParams["setFocusAfterShow"];

		// autoresize
		if (isset($arParams["autoResize"]))
		{
			$this->jsConfig["autoResize"] = $arParams["autoResize"];
			if (isset($arParams['autoResizeOffset']))
				$this->jsConfig['autoResizeOffset'] = $arParams['autoResizeOffset'];
			if (isset($arParams['autoResizeMaxHeight']))
				$this->jsConfig['autoResizeMaxHeight'] = $arParams['autoResizeMaxHeight'];
			if (isset($arParams['autoResizeSaveSize']))
				$this->jsConfig['autoResizeSaveSize'] = $arParams['autoResizeSaveSize'] !== false;
		}

		if (isset($arParams["minBodyWidth"]))
			$this->jsConfig["minBodyWidth"] = $arParams["minBodyWidth"];
		if (isset($arParams["minBodyHeight"]))
			$this->jsConfig["minBodyHeight"] = $arParams["minBodyHeight"];
		if (isset($arParams["normalBodyWidth"]))
			$this->jsConfig["normalBodyWidth"] = $arParams["normalBodyWidth"];

		return $arParams;
	}
Beispiel #11
0
if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true) {
    die;
}
if (!CModule::IncludeModule("socialnetwork")) {
    return false;
}
$site_dir = "/";
$tmp_site_id = isset($_REQUEST["site"]) && is_string($_REQUEST["site"]) ? trim($_REQUEST["site"]) : (isset($_REQUEST["src_site"]) && is_string($_REQUEST["src_site"]) ? trim($_REQUEST["src_site"]) : false);
if ($tmp_site_id) {
    $tmp_site_id = substr(preg_replace("/[^a-z0-9_]/i", "", $tmp_site_id), 0, 2);
    $dbSite = CSite::GetByID($tmp_site_id);
    if ($arSite = $dbSite->Fetch()) {
        $site_dir = strlen($arSite["DIR"]) > 0 ? trim($arSite["DIR"]) : "/";
    }
    $dbSiteTemplate = CSite::GetTemplateList($tmp_site_id);
    while ($arSiteTemplate = $dbSiteTemplate->Fetch()) {
        if (empty($arSiteTemplate["CONDITION"])) {
            $site_template = $arSiteTemplate["TEMPLATE"];
            break;
        }
    }
}
$arRes = $GLOBALS["USER_FIELD_MANAGER"]->GetUserFields("USER", 0, LANGUAGE_ID);
$userProp = array();
if (!empty($arRes)) {
    foreach ($arRes as $key => $val) {
        $userProp[$val["FIELD_NAME"]] = strLen($val["EDIT_FORM_LABEL"]) > 0 ? $val["EDIT_FORM_LABEL"] : $val["FIELD_NAME"];
    }
}
$userPropEdit = $userProp1 = CSocNetUser::GetFields(true);
Beispiel #12
0
</td>
				<td align="center"><?php 
echo GetMessage("MAIN_SITE_EDIT_SORT");
?>
</td>
				<td align="center"><?php 
echo GetMessage("MAIN_SITE_EDIT_TYPE");
?>
</td>
				<td align="center"><?php 
echo GetMessage("MAIN_SITE_EDIT_COND");
?>
</td>
			</tr>
			<?php 
$dbSiteRes = CSite::GetTemplateList($LID);
if (!$bVarsFromForm) {
    $SITE_TEMPLATE = array();
    $max_sort = 0;
    while ($arSiteRes = $dbSiteRes->Fetch()) {
        $SITE_TEMPLATE[$arSiteRes["ID"]] = $arSiteRes;
        if ($max_sort < $arSiteRes["SORT"]) {
            $max_sort = $arSiteRes["SORT"];
        }
    }
    for ($i = 0; $i < 3; $i++) {
        $SITE_TEMPLATE["N" . $i] = array("SORT" => $max_sort + 1 + $i);
    }
} else {
    $SITE_TEMPLATE = array();
    foreach ($_POST["SITE_TEMPLATE"] as $key => $val) {
Beispiel #13
0
							$new_name = md5(uniqid(rand()));
							rename($_SERVER["DOCUMENT_ROOT"].FX_PERSONAL_ROOT."/templates/".$ID."/".$file, $_SERVER["DOCUMENT_ROOT"].FX_PERSONAL_ROOT."/templates/".$ID."/".$new_name);
							CopyDirFiles($_SERVER["DOCUMENT_ROOT"].FX_PERSONAL_ROOT."/templates/".$ID."/".$new_name, $_SERVER["DOCUMENT_ROOT"].FX_PERSONAL_ROOT."/templates/".$ID, true, true, true);
							break;
						}
						closedir($dh);
					}

					$SITE_ID = $_POST["SITE_ID"];
					if(strlen($SITE_ID)>0 && $SITE_ID!="NOT_REF")
					{
						$db_site = CSite::GetByID($SITE_ID);
						if($ar_site = $db_site->Fetch())
						{
							$arTemplates = Array();
							$dbSiteRes = CSite::GetTemplateList($SITE_ID);
							$bW = false;
							while($v = $dbSiteRes->Fetch())
							{
								if(!$bW && strlen(Trim($v["CONDITION"]))<=0)
								{
									$v["TEMPLATE"] = $ID;
									$bW = true;
								}
								$arTemplates[]= $v;
							}

							if(!$bW)
								$arTemplates[]= Array('CONDITION' => '', 'SORT' => 150, 'TEMPLATE' => $ID);

							$arFields = array(
Beispiel #14
0
    private function Init($arParams)
    {
        global $USER;
        ?>
		<script>
			(function(window) {
				if (!window.BXHtmlEditor)
				{
					var BXHtmlEditor = {
						editors: {},
						configs: {},
						dialogs: {},
						Controls: {},
						SaveConfig: function(config)
						{
							BX.ready(function()
								{
									if (config && config.id)
									{
										BXHtmlEditor.configs[config.id] = config;
									}
								}
							);
						},
						Show: function(config, id)
						{
							BX.ready(function()
								{
									if ((!config || typeof config != 'object') && id && BXHtmlEditor.configs[id])
									{
										config = BXHtmlEditor.configs[id];
									}

									if (config && typeof config == 'object')
									{
										if (!BXHtmlEditor.editors[config.id] || !BXHtmlEditor.editors[config.id].Check())
										{
											BXHtmlEditor.editors[config.id] = new window.BXEditor(config);
										}
										else
										{
											BXHtmlEditor.editors[config.id].CheckAndReInit();
										}
									}
								}
							);
						},
						Hide: function(id)
						{
							if (BXHtmlEditor.editors[id])
							{
								BXHtmlEditor.editors[config.id].Hide();
							}
						},
						Get: function(id)
						{
							return BXHtmlEditor.editors[id] || false;
						},
						OnBeforeUnload: function(e)
						{
							for (var id in BXHtmlEditor.editors)
							{
								if (BXHtmlEditor.editors.hasOwnProperty(id) &&
									BXHtmlEditor.editors[id].config.askBeforeUnloadPage === true &&
									BXHtmlEditor.editors[id].IsShown() &&
									BXHtmlEditor.editors[id].IsContentChanged() &&
									!BXHtmlEditor.editors[id].IsSubmited() &&
									BXHtmlEditor.editors[id].beforeUnloadHandlerAllowed !== false)
								{
									if (typeof(BX.PULL) != 'undefined' && typeof(BX.PULL.tryConnectDelay) == 'function') // TODO change to right code in near future (e.shelenkov)
									{
										BX.PULL.tryConnectDelay();
									}
									if(typeof(BX.desktopUtils) != 'undefined' && typeof(BX.desktopUtils.isChangedLocationToBx) == 'function' && BX.desktopUtils.isChangedLocationToBx())
									{
										return;
									}
									return BXHtmlEditor.editors[id].config.beforeUnloadMessage || BX.message('BXEdExitConfirm');
								}
							}
						},

						ReplaceNewLines : function(content)
						{
							content = content.replace(/<[^<>]*br>\n/ig, '#BX_BR#');
							var contentTmp;
							while (true)
							{
								contentTmp = content.replace(/([\s|\S]+)\n([\s|\S]+)/gi, function (s, s1, s2)
									{
										if (s1.match(/>\s*$/) || s2.match(/^\s*</))
											return s;
										return s1 + '#BX_BR#' + s2;
									}
								);
								if (contentTmp == content)
								{
									break;
								}
								else
								{
									content = contentTmp;
								}
							}

							content = content.replace(/#BX_BR#/ig, "<br>\n");

							return content;
						},

						ReplaceNewLinesBack: function(content)
						{
							content = content.replace(/<[^<>]*br>\n/ig, '#BX_BR#');
							var contentTmp;
							while (true)
							{
								contentTmp = content.replace(/([\s|\S]+)#BX_BR#([\s|\S]+)/gi, function (s, s1, s2)
									{
										if (s1.match(/>\s*$/) || s2.match(/^\s*</))
											return s;
										return s1 + '\n' + s2;
									}
								);
								if (contentTmp == content)
								{
									break;
								}
								else
								{
									content = contentTmp;
								}
							}

							content = content.replace(/#BX_BR#/ig, "<br>\n");

							return content;
						}
					};

					window.BXHtmlEditor = BXHtmlEditor;
					window.onbeforeunload = BXHtmlEditor.OnBeforeUnload;
				}

				BX.onCustomEvent(window, "OnBXHtmlEditorInit");
				top.BXHtmlEditorAjaxResponse = {};
			})(window);
		</script><?php 
        $basePath = '/bitrix/js/fileman/html_editor/';
        $this->id = isset($arParams['id']) && strlen($arParams['id']) > 0 ? $arParams['id'] : 'bxeditor' . substr(uniqid(mt_rand(), true), 0, 4);
        $this->id = preg_replace("/[^a-zA-Z0-9_:\\.]/is", "", $this->id);
        if (isset($arParams['name'])) {
            $this->name = preg_replace("/[^a-zA-Z0-9_:\\.]/is", "", $arParams['name']);
        } else {
            $this->name = $this->id;
        }
        $this->cssIframePath = $this->GetActualPath($basePath . 'iframe-style.css');
        CJSCore::RegisterExt('html_editor', array('js' => array($basePath . 'range.js', $basePath . 'html-actions.js', $basePath . 'html-views.js', $basePath . 'html-parser.js', $basePath . 'html-base-controls.js', $basePath . 'html-controls.js', $basePath . 'html-components.js', $basePath . 'html-snippets.js', $basePath . 'html-editor.js', '/bitrix/js/main/dd.js'), 'css' => $basePath . 'html-editor.css', 'rel' => array('date', 'timer')));
        CUtil::InitJSCore(array('html_editor'));
        foreach (GetModuleEvents("fileman", "OnBeforeHTMLEditorScriptRuns", true) as $arEvent) {
            ExecuteModuleEventEx($arEvent);
        }
        $this->bAutorized = is_object($USER) && $USER->IsAuthorized();
        if (isset($arParams['allowPhp']) && !isset($arParams['bAllowPhp'])) {
            $arParams['bAllowPhp'] = $arParams['allowPhp'];
        }
        $this->bAllowPhp = $arParams['bAllowPhp'] !== false;
        $arParams['limitPhpAccess'] = $arParams['limitPhpAccess'] === true;
        $this->display = !isset($arParams['display']) || $arParams['display'];
        $arParams["bodyClass"] = COption::GetOptionString("fileman", "editor_body_class", "");
        $arParams["bodyId"] = COption::GetOptionString("fileman", "editor_body_id", "");
        $this->content = $arParams['content'];
        $this->inputName = isset($arParams['inputName']) ? $arParams['inputName'] : $this->name;
        $this->inputId = isset($arParams['inputId']) ? $arParams['inputId'] : 'html_editor_content_id';
        $arParams["bbCode"] = isset($arParams["bbCode"]) && $arParams["bbCode"] || isset($arParams["BBCode"]) && $arParams["BBCode"];
        // Site id
        if (!isset($arParams['siteId'])) {
            $siteId = CSite::GetDefSite();
        } else {
            $siteId = $arParams['siteId'];
            $res = CSite::GetByID($siteId);
            if (!$res->Fetch()) {
                $siteId = CSite::GetDefSite();
            }
        }
        if (!isset($siteId) && defined(SITE_ID)) {
            $siteId = SITE_ID;
            $res = CSite::GetByID($siteId);
            if (!$res->Fetch()) {
                $siteId = CSite::GetDefSite();
            }
        }
        $templateId = null;
        if (isset($arParams['templateId'])) {
            $templateId = $arParams['templateId'];
        } elseif (defined('SITE_TEMPLATE_ID')) {
            $templateId = SITE_TEMPLATE_ID;
        }
        if (!isset($templateId) && isset($_GET['siteTemplateId'])) {
            $templateId = $_GET['siteTemplateId'];
        }
        if ($arParams["bbCode"]) {
            $arTemplates = array();
            $arSnippets = array();
            $templateParams = array();
        } else {
            if (isset($arParams['arTemplates'])) {
                $arTemplates = $arParams['arTemplates'];
            } else {
                $arTemplates = self::GetSiteTemplates();
            }
            if (!isset($templateId) && isset($siteId)) {
                $dbSiteRes = CSite::GetTemplateList($siteId);
                $first = false;
                while ($arSiteRes = $dbSiteRes->Fetch()) {
                    if (!$first) {
                        $first = $arSiteRes['TEMPLATE'];
                    }
                    if ($arSiteRes['CONDITION'] == "") {
                        $templateId = $arSiteRes['TEMPLATE'];
                        break;
                    }
                }
                if (!isset($templateId)) {
                    $templateId = $first ? $first : '';
                }
            }
            $arSnippets = array($templateId => self::GetSnippets($templateId));
            $templateParams = self::GetSiteTemplateParams($templateId, $siteId);
        }
        $userSettings = array('view' => isset($arParams["view"]) ? $arParams["view"] : 'wysiwyg', 'split_vertical' => 0, 'split_ratio' => 1, 'taskbar_shown' => 0, 'taskbar_width' => 250, 'specialchars' => false, 'clean_empty_spans' => 'Y', 'paste_clear_colors' => 'Y', 'paste_clear_borders' => 'Y', 'paste_clear_decor' => 'Y', 'paste_clear_table_dimen' => 'Y', 'show_snippets' => 'Y', 'link_dialog_type' => 'internal');
        $settingsKey = "user_settings_" . $arParams["bbCode"] . "_" . $this->id;
        $curSettings = CUserOptions::GetOption("html_editor", $settingsKey, false, $USER->GetId());
        if (is_array($curSettings)) {
            foreach ($userSettings as $k => $val) {
                if (isset($curSettings[$k])) {
                    $userSettings[$k] = $curSettings[$k];
                }
            }
        }
        if (!isset($arParams["usePspell"])) {
            $arParams["usePspell"] = COption::GetOptionString("fileman", "use_pspell", "N");
        }
        if (!isset($arParams["useCustomSpell"])) {
            $arParams["useCustomSpell"] = COption::GetOptionString("fileman", "use_custom_spell", "Y");
        }
        $arParams["showComponents"] = isset($arParams["showComponents"]) ? $arParams["showComponents"] : true;
        $arParams["showSnippets"] = isset($arParams["showSnippets"]) ? $arParams["showSnippets"] : true;
        $arParams["showSnippets"] = $arParams["showSnippets"] && $userSettings['show_snippets'] != 'N';
        if (!isset($arParams["initConponentParams"])) {
            $arParams["initConponentParams"] = $arParams["showTaskbars"] !== false && $arParams["showComponents"] && ($arParams['limitPhpAccess'] || $arParams['bAllowPhp']);
        }
        $arParams["actionUrl"] = $arParams["bbCode"] ? '/bitrix/tools/html_editor_action.php' : '/bitrix/admin/fileman_html_editor_action.php';
        $arParams["lazyLoad"] = isset($arParams["lazyLoad"]) ? $arParams["lazyLoad"] : false;
        $this->jsConfig = array('id' => $this->id, 'inputName' => $this->inputName, 'content' => $this->content, 'width' => $arParams['width'], 'height' => $arParams['height'], 'allowPhp' => $this->bAllowPhp, 'limitPhpAccess' => $arParams['limitPhpAccess'], 'templates' => $arTemplates, 'templateId' => $templateId, 'templateParams' => $templateParams, 'componentFilter' => $arParams['componentFilter'], 'snippets' => $arSnippets, 'placeholder' => isset($arParams['placeholder']) ? $arParams['placeholder'] : 'Text here...', 'actionUrl' => $arParams["actionUrl"], 'cssIframePath' => $this->cssIframePath, 'bodyClass' => $arParams["bodyClass"], 'bodyId' => $arParams["bodyId"], 'spellcheck_path' => $basePath . 'html-spell.js?v=' . filemtime($_SERVER['DOCUMENT_ROOT'] . $basePath . 'html-spell.js'), 'usePspell' => $arParams["usePspell"], 'useCustomSpell' => $arParams["useCustomSpell"], 'bbCode' => $arParams["bbCode"], 'askBeforeUnloadPage' => $arParams["askBeforeUnloadPage"] !== false, 'settingsKey' => $settingsKey, 'showComponents' => $arParams["showComponents"], 'showSnippets' => $arParams["showSnippets"], 'view' => $userSettings['view'], 'splitVertical' => $userSettings['split_vertical'] ? true : false, 'splitRatio' => $userSettings['split_ratio'], 'taskbarShown' => $userSettings['taskbar_shown'] ? true : false, 'taskbarWidth' => $userSettings['taskbar_width'], 'lastSpecialchars' => $userSettings['specialchars'] ? explode('|', $userSettings['specialchars']) : false, 'cleanEmptySpans' => $userSettings['clean_empty_spans'] != 'N', 'pasteSetColors' => $userSettings['paste_clear_colors'] != 'N', 'pasteSetBorders' => $userSettings['paste_clear_borders'] != 'N', 'pasteSetDecor' => $userSettings['paste_clear_decor'] != 'N', 'pasteClearTableDimen' => $userSettings['paste_clear_table_dimen'] != 'N', 'linkDialogType' => $userSettings['link_dialog_type'], 'lazyLoad' => $arParams["lazyLoad"]);
        if (($this->bAllowPhp || $arParams['limitPhpAccess']) && $arParams["showTaskbars"] !== false) {
            $this->jsConfig['components'] = self::GetComponents($templateId, false, $arParams['componentFilter']);
        }
        if (isset($arParams["initAutosave"])) {
            $this->jsConfig["initAutosave"] = $arParams["initAutosave"];
        }
        if (isset($arParams["useFileDialogs"])) {
            $this->jsConfig["useFileDialogs"] = $arParams["useFileDialogs"];
        }
        if (isset($arParams["showTaskbars"])) {
            $this->jsConfig["showTaskbars"] = $arParams["showTaskbars"];
        }
        if (isset($arParams["showNodeNavi"])) {
            $this->jsConfig["showNodeNavi"] = $arParams["showNodeNavi"];
        }
        if (isset($arParams["controlsMap"])) {
            $this->jsConfig["controlsMap"] = $arParams["controlsMap"];
        }
        if (isset($arParams["arSmiles"])) {
            $this->jsConfig["smiles"] = $arParams["arSmiles"];
        }
        if (isset($arParams["arSmilesSet"])) {
            $this->jsConfig["smileSets"] = $arParams["arSmilesSet"];
        }
        if (isset($arParams["iframeCss"])) {
            $this->jsConfig["iframeCss"] = $arParams["iframeCss"];
        }
        if (isset($arParams["beforeUnloadMessage"])) {
            $this->jsConfig["beforeUnloadMessage"] = $arParams["beforeUnloadMessage"];
        }
        if (isset($arParams["setFocusAfterShow"])) {
            $this->jsConfig["setFocusAfterShow"] = $arParams["setFocusAfterShow"];
        }
        if (isset($arParams["relPath"])) {
            $this->jsConfig["relPath"] = $arParams["relPath"];
        }
        // autoresize
        if (isset($arParams["autoResize"])) {
            $this->jsConfig["autoResize"] = $arParams["autoResize"];
            if (isset($arParams['autoResizeOffset'])) {
                $this->jsConfig['autoResizeOffset'] = $arParams['autoResizeOffset'];
            }
            if (isset($arParams['autoResizeMaxHeight'])) {
                $this->jsConfig['autoResizeMaxHeight'] = $arParams['autoResizeMaxHeight'];
            }
            if (isset($arParams['autoResizeSaveSize'])) {
                $this->jsConfig['autoResizeSaveSize'] = $arParams['autoResizeSaveSize'] !== false;
            }
        }
        if (isset($arParams["minBodyWidth"])) {
            $this->jsConfig["minBodyWidth"] = $arParams["minBodyWidth"];
        }
        if (isset($arParams["minBodyHeight"])) {
            $this->jsConfig["minBodyHeight"] = $arParams["minBodyHeight"];
        }
        if (isset($arParams["normalBodyWidth"])) {
            $this->jsConfig["normalBodyWidth"] = $arParams["normalBodyWidth"];
        }
        return $arParams;
    }
Beispiel #15
0
                while ($template = $dbTemplates->Fetch()) {
                    if ($template["TEMPLATE"] == "eshop_app") {
                        $eshopAppFound = true;
                        $template = $arAppTempalate;
                    }
                    $arFields["TEMPLATE"][] = array("TEMPLATE" => $template['TEMPLATE'], "SORT" => $template['SORT'], "CONDITION" => $template['CONDITION']);
                }
                if (!$eshopAppFound) {
                    $arFields["TEMPLATE"][] = $arAppTempalate;
                }
                $obSite = new CSite();
                $arFields["LID"] = WIZARD_SITE_ID;
                $obSite->Update(WIZARD_SITE_ID, $arFields);
            }
        } else {
            if (!$module->UnInstallPublic(WIZARD_SITE_DIR)) {
                return false;
            }
            $arFields = array("TEMPLATE" => array());
            $dbTemplates = CSite::GetTemplateList(WIZARD_SITE_ID);
            while ($template = $dbTemplates->Fetch()) {
                if ($template["TEMPLATE"] != "eshop_app") {
                    $arFields["TEMPLATE"][] = array("TEMPLATE" => $template['TEMPLATE'], "SORT" => $template['SORT'], "CONDITION" => $template['CONDITION']);
                }
            }
            $obSite = new CSite();
            $arFields["LID"] = WIZARD_SITE_ID;
            $obSite->Update(WIZARD_SITE_ID, $arFields);
        }
    }
}
Beispiel #16
0
//echo "WIZARD_SERVICE_RELATIVE_PATH=".WIZARD_SERVICE_RELATIVE_PATH." | ";
//echo "WIZARD_SERVICE_ABSOLUTE_PATH=".WIZARD_SERVICE_ABSOLUTE_PATH." | ";
//echo "WIZARD_IS_RERUN=".WIZARD_IS_RERUN." | ";
//die();
if (!defined("WIZARD_TEMPLATE_ID")) {
    return;
}
$bitrixTemplateDir = $_SERVER["DOCUMENT_ROOT"] . BX_PERSONAL_ROOT . "/templates/" . WIZARD_TEMPLATE_ID;
CopyDirFiles($_SERVER["DOCUMENT_ROOT"] . WizardServices::GetTemplatesPath(WIZARD_RELATIVE_PATH . "/site") . "/" . WIZARD_TEMPLATE_ID, $bitrixTemplateDir, $rewrite = true, $recursive = true, $delete_after_copy = false);
//Attach template to default site
$obSite = CSite::GetList($by = "def", $order = "desc", array("LID" => WIZARD_SITE_ID));
if ($arSite = $obSite->Fetch()) {
    $arTemplates = array();
    $found = false;
    $foundEmpty = false;
    $obTemplate = CSite::GetTemplateList($arSite["LID"]);
    while ($arTemplate = $obTemplate->Fetch()) {
        if (!$found && strlen(trim($arTemplate["CONDITION"])) <= 0) {
            $arTemplate["TEMPLATE"] = WIZARD_TEMPLATE_ID;
            $found = true;
        }
        if ($arTemplate["TEMPLATE"] == "empty") {
            $foundEmpty = true;
            continue;
        }
        $arTemplates[] = $arTemplate;
    }
    if (!$found) {
        $arTemplates[] = array("CONDITION" => "", "SORT" => 150, "TEMPLATE" => WIZARD_TEMPLATE_ID);
    }
    $arFields = array("TEMPLATE" => $arTemplates, "NAME" => $arSite["NAME"]);
Beispiel #17
0
		$strWarning = GetMessage("FILEMAN_FILEEDIT_FOLDER_EXISTS")." ";
	else
		$bEdit = true;
}

if(strlen($strWarning)<=0)
{
	if($bEdit)
	{
		$f = $io->GetFile($abs_path);
		$filesrc_tmp = $f->GetContents();
	}
	else
	{
		$site_template = false;
		$rsSiteTemplates = CSite::GetTemplateList($site);
		while($arSiteTemplate = $rsSiteTemplates->Fetch())
		{
			if(strlen($arSiteTemplate["CONDITION"])<=0)
			{
				$site_template = $arSiteTemplate["TEMPLATE"];
				break;
			}
		}

		$arTemplates = CFileman::GetFileTemplates(LANGUAGE_ID, array($site_template));
		if(strlen($template)>0)
		{
			for ($i=0; $i<count($arTemplates); $i++)
			{
				if($arTemplates[$i]["file"] == $template)
Beispiel #18
0
	private function Init($arParams)
	{
		global $USER, $APPLICATION;

		?>
		<script>
			(function() {
				if (!window.BXHtmlEditor)
				{
					var BXHtmlEditor = {
						ajaxResponse: {},
						editors: {},
						configs: {},
						SaveConfig: function(config)
						{
							BX.ready(function()
								{
									if (config && config.id)
									{
										BXHtmlEditor.configs[config.id] = config;
									}
								}
							);
						},
						Show: function(config, id)
						{
							BX.ready(function()
								{
									if ((!config || typeof config != 'object') && id && BXHtmlEditor.configs[id])
									{
										config = BXHtmlEditor.configs[id];
									}

									if (config && typeof config == 'object')
									{
										BXHtmlEditor.editors[config.id] = new window.BXEditor(config);
										BXHtmlEditor.editors[config.id].Show();
									}
								}
							);
						},
						Hide: function(id)
						{
							if (BXHtmlEditor.editors[id])
							{
								BXHtmlEditor.editors[config.id].Hide();
							}
						},
						Get: function(id)
						{
							return BXHtmlEditor.editors[id] || false;
						},
						OnBeforeUnload: function(e)
						{
							for (var id in BXHtmlEditor.editors)
							{
								if (BXHtmlEditor.editors.hasOwnProperty(id) &&
									BXHtmlEditor.editors[id].IsShown() &&
									BXHtmlEditor.editors[id].IsContentChanged() &&
									!BXHtmlEditor.editors[id].IsSubmited())
								{
									return BX.message('BXEdExitConfirm');
								}
							}
						}
					};
					top.BXHtmlEditor = window.BXHtmlEditor = BXHtmlEditor;
					window.onbeforeunload = BXHtmlEditor.OnBeforeUnload;
				}
				BX.onCustomEvent(window, "OnBXHtmlEditorInit");
			})();
		</script><?

		$basePath = '/freetrix/js/fileman/html_editor/';
		$this->id = (isset($arParams['id']) && strlen($arParams['id']) > 0) ? $arParams['id'] : 'bxeditor'.substr(uniqid(mt_rand(), true), 0, 4);
		$this->id = preg_replace("/[^a-zA-Z0-9_:\.]/is", "", $this->id);
		if (isset($arParams['name']))
		{
			$this->name = preg_replace("/[^a-zA-Z0-9_:\.]/is", "", $arParams['name']);
		}
		else
		{
			$this->name = $this->id;
		}

		$arJSPath = array(
			$basePath.'range.js',
			$basePath.'html-actions.js',
			$basePath.'html-views.js',
			$basePath.'html-parser.js',
			$basePath.'html-controls.js',
			$basePath.'html-components.js',
			$basePath.'html-editor.js'
		);

		$this->cssPath = $this->GetActualPath($basePath.'html-editor.css');
		$this->cssIframePath = $this->GetActualPath($basePath.'iframe-style.css');
		$APPLICATION->SetAdditionalCss($this->cssPath);

		foreach ($arJSPath as $path)
		{
			$APPLICATION->AddHeadScript($path);
		}

		$this->bAutorized = is_object($USER) && $USER->IsAuthorized();
		$this->bAllowPhp = $arParams['bAllowPhp'] !== false;
		$arParams['limitPhpAccess'] = $arParams['limitPhpAccess'] === true;
		$this->display = !isset($arParams['display']) || $arParams['display'];

		$arParams["bodyClass"] = COption::GetOptionString("fileman", "editor_body_class", "");
		$arParams["bodyId"] = COption::GetOptionString("fileman", "editor_body_id", "");

		$this->content = $arParams['content'];
		$this->inputName = isset($arParams['inputName']) ? $arParams['inputName'] : 'html_editor_content';
		$this->inputId = isset($arParams['inputId']) ? $arParams['inputId'] : 'html_editor_content_id';

		// Site id
		if (!isset($arParams['siteId']))
		{
			$siteId = CSite::GetDefSite();
		}
		else
		{
			$siteId = $arParams['siteId'];
		}
		if (!isset($siteId) && defined(SITE_ID))
		{
			$siteId = SITE_ID;
		}

		$arTemplates = self::GetSiteTemplates();
		if (isset($arParams['templateId']))
		{
			$templateId = $arParams['templateId'];
		}
		elseif (defined(SITE_TEMPLATE_ID))
		{
			$templateId = SITE_TEMPLATE_ID;
		}

		if (!isset($templateId) && isset($siteId))
		{
			$dbSiteRes = CSite::GetTemplateList($siteId);
			$first = false;
			while($arSiteRes = $dbSiteRes->Fetch())
			{
				if (!$first)
				{
					$first = $arSiteRes['TEMPLATE'];
				}
				if ($arSiteRes['CONDITION'] == "")
				{
					$templateId = $arSiteRes['TEMPLATE'];
					break;
				}
			}

			if (!isset($templateId))
			{
				$templateId = $first;
			}
		}

		$arSnippets = array($templateId => self::GetSnippets($templateId));

		$arComponents = self::GetComponents($templateId);
		$templateParams = self::GetSiteTemplateParams($templateId, $siteId);

		$userSettings = array(
			'view' => 'wysiwyg',
			'split_vertical' => 0,
			'split_ratio' => 1,
			'taskbar_shown' => 0,
			'taskbar_width' => 250,
			'specialchars' => false
		);

		$curSettings = CUserOptions::GetOption("html_editor", "user_settings", false, $USER->GetId());
		if (is_array($curSettings))
		{
			foreach ($userSettings as $k => $val)
			{
				if (isset($curSettings[$k]))
				{
					$userSettings[$k] = $curSettings[$k];
				}
			}
		}

		$this->jsConfig = array(
			'id' => $this->id,
			'inputName' => $this->name,
			'content' => $this->content,
			'width' => $arParams['width'],
			'height' => $arParams['height'],
			'allowPhp' => $this->bAllowPhp,
			'bLPA' => $arParams['limitPhpAccess'],
			'templates' => $arTemplates,
			'templateId' => $templateId,
			'templateParams' => $templateParams,
			'snippets' => $arSnippets,
			'components' => $arComponents,
			'placeholder' => isset($arParams['placeholder']) ? $arParams['placeholder'] : 'Text here...',
			'actionUrl' => '/freetrix/admin/fileman_html_editor_action.php',
			'cssIframePath' => $this->cssIframePath,
			'bodyClass' => $arParams["bodyClass"],
			'bodyId' => $arParams["bodyId"],
			// user settings
			'view' => $userSettings['view'],
			'splitVertical' => $userSettings['split_vertical'] ? true : false,
			'splitRatio' => $userSettings['split_ratio'],
			'taskbarShown' => $userSettings['taskbar_shown'] ? true : false,
			'taskbarWidth' => $userSettings['taskbar_width'],
			'lastSpecialchars' => $userSettings['specialchars'] ? explode('|', $userSettings['specialchars']) : false
		);
	}
echo $siteName;
?>
" title="<?php 
echo GetMessage('CARROTQUEST_TEMPLATES_MOD_SITE');
?>
" <?php 
echo $siteChecked;
?>
>
				<span>
					<?php 
echo GetMessage('CARROTQUEST_TEMPLATES_SITE') . ' "' . $site["NAME"] . ' (ID = \'' . $site["LID"] . '\')"';
?>
				</span>
				<ul class="carrotquest_inner_menu">
					<?	$rsTemplates = CSite::GetTemplateList($site["LID"]);
					while ($template = $rsTemplates->Fetch())
					{
						$templateName = 'carrotquest_template_'.$site["LID"]."^".$template["TEMPLATE"];
						if ($_REQUEST['install'] == 'Y')
							$checked = "checked";
						else
							$checked = $content[$templateName];
						?>
						<li class="carrotquest_menu_item" title="<?php 
echo GetMessage('CARROTQUEST_TEMPLATES_MOD_TEMPLATE');
?>
">
							<input type="checkbox" name="<?php 
echo $name;
?>
Beispiel #20
0
 private static function getCurTemplate($path, $mp_mode = false)
 {
     if (!$mp_mode) {
         $dbSiteRes = CSite::GetTemplateList(CSite::GetSiteByFullPath($path, true));
         if (($arSiteRes = $dbSiteRes->Fetch()) !== false) {
             return $arSiteRes['TEMPLATE'];
         }
     }
     return '.default';
 }
Beispiel #21
0
if (!isset($_REQUEST["lang"]) || strlen($_REQUEST["lang"]) <= 0) {
    $lang = LANGUAGE_ID;
}
//BackUrl
$back_url = isset($_REQUEST["back_url"]) ? $_REQUEST["back_url"] : "";
//Template ID
$templateID = false;
if (isset($_REQUEST["templateID"]) && strlen($_REQUEST["templateID"]) > 0) {
    $obTemplate = CSiteTemplate::GetByID($_REQUEST["templateID"]);
    if ($arSiteTemplate = $obTemplate->Fetch()) {
        $templateID = $_REQUEST["templateID"];
    }
}
if ($templateID === false) {
    //Get default template if templateID not set
    $obTemplate = CSite::GetTemplateList($site);
    while ($arSiteTemplate = $obTemplate->Fetch()) {
        if (strlen($arSiteTemplate["CONDITION"]) <= 0) {
            $templateID = $arSiteTemplate["TEMPLATE"];
            break;
        }
    }
}
//default edit groups - need to limit access
$edit_groups = explode(",", COption::GetOptionString('fileman', 'default_edit_groups', ''));
$arGroupList = array();
$arEditGroups = array();
$gr = CGroup::GetList($v1 = "sort", $v2 = "asc", array("ACTIVE" => "Y", "ADMIN" => "N", "ANONYMOUS" => "N"));
while ($group = $gr->Fetch()) {
    $arGroupList[$group["ID"]] = $group;
    if (in_array($group["ID"], $edit_groups)) {
Beispiel #22
0
 /**
  * Binds (and creates if it's necessary) template to the application folder
  *
  * @param $templateId - symbolic code of the template
  * @param $folder - the application folder
  * @param bool $createNew - flag of the necessity of creating a new template
  */
 public static function bindTemplate($templateId, $folder, $createNew)
 {
     $arFields = array("TEMPLATE" => array());
     if ($createNew) {
         CopyDirFiles(Application::getDocumentRoot() . "/bitrix/modules/mobileapp/templates/default_app/", Application::getDocumentRoot() . "/bitrix/templates/" . $templateId, True, True);
         File::putFileContents(Application::getDocumentRoot() . "/bitrix/templates/" . $templateId . "/description.php", str_replace(array("#mobile_template_name#"), array($templateId), File::getFileContents(Application::getDocumentRoot() . "/bitrix/templates/" . $templateId . "/description.php")));
         $arFields["TEMPLATE"][] = array("SORT" => 1, "CONDITION" => "CSite::InDir('/" . $folder . "/')", "TEMPLATE" => $templateId);
     }
     $default_site_id = \CSite::GetDefSite();
     if ($default_site_id) {
         $dbTemplates = \CSite::GetTemplateList($default_site_id);
         $arFields["LID"] = $default_site_id;
         $isTemplateFound = false;
         while ($template = $dbTemplates->Fetch()) {
             $arFields["TEMPLATE"][] = array("TEMPLATE" => $template['TEMPLATE'], "SORT" => $template['SORT'], "CONDITION" => $template['CONDITION']);
             if ($template["TEMPLATE"] == $templateId && !$createNew && !$isTemplateFound) {
                 $isTemplateFound = true;
                 $arFields["TEMPLATE"][] = array("SORT" => 1, "CONDITION" => "CSite::InDir('/" . $folder . "/')", "TEMPLATE" => $templateId);
             }
         }
         $obSite = new \CSite();
         $obSite->Update($default_site_id, $arFields);
     }
 }