Exemple #1
0
function __DSGetInitData()
{
    $map = new \Bitrix\MobileApp\Designer\ConfigMap();
    $params = $map->getParamsByGroups();
    $groups = array_keys($params);
    $tmpLangs = array_change_key_case($map->getLangMessages(), CASE_LOWER);
    $langs = array();
    foreach ($tmpLangs as $k => $v) {
        $langs[str_replace("_", "/", $k)] = $v;
    }
    $result = \Bitrix\Mobileapp\Designer\AppTable::getList(array("select" => array("CODE", "FOLDER", "DESCRIPTION", "SHORT_NAME", "NAME", "CONFIG.PLATFORM", "CONFIG.PARAMS")));
    $fetchedApps = $result->fetchAll();
    $apps = array();
    $count = count($fetchedApps);
    for ($i = 0; $i < $count; $i++) {
        $apps[] = array("code" => $fetchedApps[$i]["CODE"], "name" => $fetchedApps[$i]["NAME"], "folder" => $fetchedApps[$i]["FOLDER"], "desc" => $fetchedApps[$i]["DESCRIPTION"], "params" => $fetchedApps[$i]["MOBILEAPP_DESIGNER_APP_CONFIG_PARAMS"], "platform" => $fetchedApps[$i]["MOBILEAPP_DESIGNER_APP_CONFIG_PLATFORM"]);
    }
    $dbres = \CSiteTemplate::GetList();
    $templates = array();
    while ($t = $dbres->Fetch()) {
        $templates[] = $t;
    }
    $data = array("map" => array("groups" => $groups, "groupedParams" => $params, "params" => $map->getDescriptionConfig(), "lang" => $tmpLangs), "apps" => $apps, "templates" => $templates);
    return $data;
}
 public static function GetComponentProperties($name = '', $template = '', $siteTemplate = '', $currentValues = array())
 {
     $template = !$template || $template == '.default' ? '' : $template;
     $arTemplates = CComponentUtil::GetTemplatesList($name, $siteTemplate);
     $result = array('templates' => array());
     $arSiteTemplates = array(".default" => GetMessage("PAR_MAN_DEFAULT"));
     if (!empty($siteTemplate)) {
         $dbst = CSiteTemplate::GetList(array(), array("ID" => $siteTemplate), array());
         while ($siteTempl = $dbst->Fetch()) {
             $arSiteTemplates[$siteTempl['ID']] = $siteTempl['NAME'];
         }
     }
     foreach ($arTemplates as $k => $templ) {
         $showTemplateName = $templ["TEMPLATE"] !== '' && $arSiteTemplates[$templ["TEMPLATE"]] != '' ? $arSiteTemplates[$templ["TEMPLATE"]] : GetMessage("PAR_MAN_DEF_TEMPLATE");
         $arTemplates[$k]['DISPLAY_NAME'] = $templ['NAME'] . ' (' . $showTemplateName . ')';
     }
     $arTemplateProps = array();
     if (is_array($arTemplates)) {
         foreach ($arTemplates as $arTemplate) {
             $result['templates'][] = $arTemplate;
             $tName = !$arTemplate['NAME'] || $arTemplate['NAME'] == '.default' ? '' : $arTemplate['NAME'];
             if ($tName == $template) {
                 $arTemplateProps = CComponentUtil::GetTemplateProps($name, $arTemplate['NAME'], $siteTemplate, $currentValues);
             }
         }
     }
     $result['parameters'] = array();
     $arProps = CComponentUtil::GetComponentProps($name, $currentValues, $arTemplateProps);
     $result['tooltips'] = self::FetchHelp($name);
     if (!isset($arProps['GROUPS']) || !is_array($arProps['GROUPS'])) {
         $arProps['GROUPS'] = array();
     }
     if (!isset($arProps['PARAMETERS']) || !is_array($arProps['PARAMETERS'])) {
         $arProps['PARAMETERS'] = array();
     }
     $result['groups'] = array();
     foreach ($arProps['GROUPS'] as $k => $arGroup) {
         $arGroup['ID'] = $k;
         $result['groups'][] = $arGroup;
     }
     foreach ($arProps['PARAMETERS'] as $k => $arParam) {
         $arParam['ID'] = preg_replace("/[^a-zA-Z0-9_-]/is", "_", $k);
         if (!isset($arParam['PARENT'])) {
             $arParam['PARENT'] = 'ADDITIONAL_SETTINGS';
         }
         $result['parameters'][] = $arParam;
         if ($arParam['TYPE'] == 'FILE') {
             self::$fileDialogs[] = array('NAME' => $arParam['ID'], 'TARGET' => isset($arParam['FD_TARGET']) ? $arParam['FD_TARGET'] : 'F', 'EXT' => isset($arParam['FD_EXT']) ? $arParam['FD_EXT'] : '', 'UPLOAD' => isset($arParam['FD_UPLOAD']) && $arParam['FD_UPLOAD'] && $arParam['FD_TARGET'] == 'F', 'USE_ML' => isset($arParam['FD_USE_MEDIALIB']) && $arParam['FD_USE_MEDIALIB'], 'ONLY_ML' => isset($arParam['FD_USE_ONLY_MEDIALIB']) && $arParam['FD_USE_ONLY_MEDIALIB'], 'ML_TYPES' => isset($arParam['FD_MEDIALIB_TYPES']) ? $arParam['FD_MEDIALIB_TYPES'] : false);
         }
         // TOOLTIPS FROM .parameters langs
         if (!isset($result['tooltips'][$arParam['ID'] . '_TIP'])) {
             $tip = GetMessage($arParam['ID'] . '_TIP');
             if ($tip) {
                 $result['tooltips'][$arParam['ID'] . '_TIP'] = $tip;
             }
         }
     }
     return $result;
 }
Exemple #3
0
 function DirsRecursive($ID, $path = "", $depth = 0, $maxDepth = 1)
 {
     $arRes = array();
     $depth++;
     GetDirList(BX_PERSONAL_ROOT . "/templates/" . $ID . "/" . $path, $arDirsTmp, $arResTmp);
     foreach ($arResTmp as $file) {
         switch ($file["NAME"]) {
             case "chain_template.php":
                 $file["DESCRIPTION"] = GetMessage("MAIN_TEMPLATE_NAV");
                 break;
             case "":
                 $file["DESCRIPTION"] = "";
                 break;
             default:
                 if (($p = strpos($file["NAME"], ".menu_template.php")) !== false) {
                     $file["DESCRIPTION"] = str_replace("#MENU_TYPE#", substr($file["NAME"], 0, $p), GetMessage("MAIN_TEMPLATE_MENU"));
                 } elseif (($p = strpos($file["NAME"], "authorize_registration.php")) !== false) {
                     $file["DESCRIPTION"] = GetMessage("MAIN_TEMPLATE_AUTH_REG");
                 } elseif (($p = strpos($file["NAME"], "forgot_password.php")) !== false) {
                     $file["DESCRIPTION"] = GetMessage("MAIN_TEMPLATE_SEND_PWD");
                 } elseif (($p = strpos($file["NAME"], "change_password.php")) !== false) {
                     $file["DESCRIPTION"] = GetMessage("MAIN_TEMPLATE_CHN_PWD");
                 } elseif (($p = strpos($file["NAME"], "authorize.php")) !== false) {
                     $file["DESCRIPTION"] = GetMessage("MAIN_TEMPLATE_AUTH");
                 } elseif (($p = strpos($file["NAME"], "registration.php")) !== false) {
                     $file["DESCRIPTION"] = GetMessage("MAIN_TEMPLATE_REG");
                 }
         }
         $arRes[] = $file;
     }
     $nTemplateLen = strlen(BX_PERSONAL_ROOT . "/templates/" . $ID . "/");
     foreach ($arDirsTmp as $dir) {
         $arDir = $dir;
         $arDir["DEPTH_LEVEL"] = $depth;
         $arRes[] = $arDir;
         if ($depth < $maxDepth) {
             $dirPath = substr($arDir["ABS_PATH"], $nTemplateLen);
             $arRes = array_merge($arRes, CSiteTemplate::DirsRecursive($ID, $dirPath, $depth, $maxDepth));
         }
     }
     return $arRes;
 }
                $arAuthResult = $GLOBALS["USER"]->ChangePassword($_REQUEST["USER_LOGIN"], $_REQUEST["USER_CHECKWORD"], $_REQUEST["USER_PASSWORD"], $_REQUEST["USER_CONFIRM_PASSWORD"], $USER_LID);
            } elseif (COption::GetOptionString("main", "new_user_registration", "N") == "Y" && $_SERVER['REQUEST_METHOD'] == 'POST' && $_REQUEST["TYPE"] == "REGISTRATION" && (!defined("ADMIN_SECTION") || ADMIN_SECTION !== true)) {
                $arAuthResult = $GLOBALS["USER"]->Register($_REQUEST["USER_LOGIN"], $_REQUEST["USER_NAME"], $_REQUEST["USER_LAST_NAME"], $_REQUEST["USER_PASSWORD"], $_REQUEST["USER_CONFIRM_PASSWORD"], $_REQUEST["USER_EMAIL"], $USER_LID, $_REQUEST["captcha_word"], $_REQUEST["captcha_sid"]);
            }
        }
        $GLOBALS["APPLICATION"]->SetAuthResult($arAuthResult);
    } elseif (!$GLOBALS["USER"]->IsAuthorized()) {
        //Authorize by unique URL
        $GLOBALS["USER"]->LoginHitByHash();
    }
}
//define the site template
if (!defined("ADMIN_SECTION") || ADMIN_SECTION !== true) {
    if (array_key_exists("bitrix_preview_site_template", $_REQUEST) && $_REQUEST["bitrix_preview_site_template"] != "" && $GLOBALS["USER"]->CanDoOperation('view_other_settings')) {
        //preview of site template
        $aTemplates = CSiteTemplate::GetByID($_REQUEST["bitrix_preview_site_template"]);
        if ($template = $aTemplates->Fetch()) {
            define("SITE_TEMPLATE_ID", $template["ID"]);
        } else {
            define("SITE_TEMPLATE_ID", CSite::GetCurTemplate());
        }
    } else {
        define("SITE_TEMPLATE_ID", CSite::GetCurTemplate());
    }
    define("SITE_TEMPLATE_PATH", BX_PERSONAL_ROOT . '/templates/' . SITE_TEMPLATE_ID);
}
//magic parameters: show page creation time
if (isset($_GET["show_page_exec_time"])) {
    if ($_GET["show_page_exec_time"] == "Y" || $_GET["show_page_exec_time"] == "N") {
        $_SESSION["SESS_SHOW_TIME_EXEC"] = $_GET["show_page_exec_time"];
    }
Exemple #5
0
 public static function SaveStyleDescription($stylesDesc = array(), $stylesPath)
 {
     /** @global CMain $APPLICATION */
     global $APPLICATION;
     if (isset($stylesDesc) && is_array($stylesDesc)) {
         $curStylesDesc = CSiteTemplate::__GetByStylesTitle($stylesPath);
         if (is_array($curStylesDesc)) {
             foreach ($curStylesDesc as $code => $val) {
                 if (!is_array($curStylesDesc[$code])) {
                     unset($curStylesDesc[$code]);
                 }
             }
         }
         foreach ($stylesDesc as $code => $val) {
             if (!isset($curStylesDesc[EscapePHPString($code)]) || !is_array($curStylesDesc[EscapePHPString($code)])) {
                 $curStylesDesc[EscapePHPString($code)] = EscapePHPString($val);
             }
         }
         $APPLICATION->SaveFileContent($stylesPath, '<' . '?' . "\nreturn " . var_export($curStylesDesc, 1) . ";\n" . '?' . '>');
     }
 }
Exemple #6
0
 /**
  * @return array
  * @throws \Bitrix\Main\ArgumentException
  */
 public static function onPresetTemplateListSite($templateType = null, $templateId = null)
 {
     $resultList = array();
     if ($templateType && $templateType !== 'SITE_TMPL') {
         return $resultList;
     }
     $by = 'SORT';
     $order = 'ASC';
     $filter = array('TYPE' => 'mail');
     if ($templateId) {
         $filter['ID'] = $templateId;
     }
     $templateDb = \CSiteTemplate::GetList(array($by => $order), $filter, array("ID", "NAME", "CONTENT", "SCREENSHOT"));
     \Bitrix\Main\Loader::includeModule('fileman');
     $replaceAttr = Editor::BLOCK_PLACE_ATTR . '="' . Editor::BLOCK_PLACE_ATTR_DEF_VALUE . '"';
     $replaceText = '<div style="padding: 20px; border: 2px dashed #868686;"><span style="color: #868686; font-size: 20px;">' . Loc::getMessage('PRESET_TEMPLATE_LIST_SITE_DEF_TEXT') . '</span></div>';
     while ($template = $templateDb->Fetch()) {
         if ($template['ID'] == 'mail_user') {
             continue;
         }
         $replaceTo = $replaceText;
         $html = $template['CONTENT'];
         $html = preg_replace('/<\\?[\\w\\w].*?B_PROLOG_INCLUDED[^>].*?\\?>/is', '', $html);
         if (stripos($html, $replaceAttr) === false) {
             $replaceTo = '<div id="bxStylistBody" ' . $replaceAttr . '>' . $replaceText . '</div>';
         }
         $html = str_replace('#WORK_AREA#', $replaceTo, $html);
         $resultList[] = array('TYPE' => 'SITE_TMPL', 'ID' => $template['ID'], 'NAME' => $template['NAME'], 'ICON' => $template['SCREENSHOT'], 'HTML' => $html);
     }
     return $resultList;
 }
:</td>
		<td>
			<select name="NEW_COMPONENT_TEMPLATE" onchange="<?php 
        echo $obJSPopup->jsPopup . ".PostParameters('" . PageParams() . "&amp;action=refresh&amp;scroll='+" . $obJSPopup->jsPopup . ".GetContent().scrollTop);";
        ?>
">
<?php 
        $arTemplateID = array();
        foreach ($arComponentTemplates as $template) {
            if ($template["TEMPLATE"] != '' && $template["TEMPLATE"] != '.default') {
                $arTemplateID[] = $template["TEMPLATE"];
            }
        }
        $arTemplates = array(".default" => GetMessage("comp_prop_default_templ"));
        if (!empty($arTemplateID)) {
            $db_site_templates = CSiteTemplate::GetList(array(), array("ID" => $arTemplateID), array());
            while ($ar_site_templates = $db_site_templates->Fetch()) {
                $arTemplates[$ar_site_templates['ID']] = $ar_site_templates['NAME'];
            }
        }
        foreach ($arComponentTemplates as $template) {
            $showTemplateName = $template["TEMPLATE"] != '' && $arTemplates[$template["TEMPLATE"]] != '' ? $arTemplates[$template["TEMPLATE"]] : GetMessage("comp_prop_template_sys");
            ?>
				<option value="<?php 
            echo htmlspecialcharsbx($template["NAME"]);
            ?>
"<?php 
            if ($template["NAME"] == $curTemplate || $curTemplate == '' && $template["NAME"] == ".default") {
                echo " selected";
            }
            ?>
$edit_php = $USER->CanDoOperation('edit_php');
if (!$edit_php && !$USER->CanDoOperation('view_other_settings') && !$USER->CanDoOperation('lpa_template_edit')) {
    $APPLICATION->AuthForm(GetMessage("ACCESS_DENIED"));
}
IncludeModuleLangFile(__FILE__);
$sTableID = "tbl_template";
$lAdmin = new CAdminList($sTableID, $oSort);
if ($_REQUEST['mode'] == 'list' || $_REQUEST['mode'] == 'frame') {
    CFile::DisableJSFunction(true);
}
if ($lAdmin->EditAction() && $edit_php) {
    foreach ($FIELDS as $ID => $arFields) {
        if (!$lAdmin->IsUpdated($ID)) {
            continue;
        }
        $ob = new CSiteTemplate();
        if (!$ob->Update($ID, $arFields)) {
            $lAdmin->AddUpdateError(GetMessage("SAVE_ERROR") . $ID . ": " . $ob->LAST_ERROR, $ID);
        }
    }
}
if (($arID = $lAdmin->GroupAction()) && $edit_php) {
    if ($_REQUEST['action_target'] == 'selected') {
        $arID = array();
        $rsData = CSiteTemplate::GetList($by, $order, array());
        while ($arRes = $rsData->Fetch()) {
            $arID[] = $arRes['ID'];
        }
    }
    foreach ($arID as $ID) {
        if ($ID == '') {
Exemple #9
0
	public static function AddPagerSettings(&$arComponentParameters, $pager_title, $bDescNumbering=true, $bShowAllParam=false)
	{
		$arHiddenTemplates = array(
			'js' => true
		);
		if (!isset($arComponentParameters['GROUPS']))
			$arComponentParameters['GROUPS'] = array();
		$arComponentParameters["GROUPS"]["PAGER_SETTINGS"] = array(
			"NAME" => GetMessage("T_IBLOCK_DESC_PAGER_SETTINGS"),
		);

		$arTemplateInfo = CComponentUtil::GetTemplatesList('freetrix:system.pagenavigation');
		if (empty($arTemplateInfo))
		{
			$arComponentParameters["PARAMETERS"]["PAGER_TEMPLATE"] = Array(
				"PARENT" => "PAGER_SETTINGS",
				"NAME" => GetMessage("T_IBLOCK_DESC_PAGER_TEMPLATE"),
				"TYPE" => "STRING",
				"DEFAULT" => "",
			);
		}
		else
		{
			sortByColumn($arTemplateInfo, array('TEMPLATE' => SORT_ASC, 'NAME' => SORT_ASC));
			$arTemplateList = array();
			$arSiteTemplateList = array(
				'.default' => GetMessage('T_IBLOCK_DESC_PAGER_TEMPLATE_SITE_DEFAULT')
			);
			$arTemplateID = array();
			foreach ($arTemplateInfo as &$template)
			{
				if ('' != $template["TEMPLATE"] && '.default' != $template["TEMPLATE"])
					$arTemplateID[] = $template["TEMPLATE"];
				if (!isset($template['TITLE']))
					$template['TITLE'] = $template['NAME'];
			}
			unset($template);

			if (!empty($arTemplateID))
			{
				$rsSiteTemplates = CSiteTemplate::GetList(
					array(),
					array("ID"=>$arTemplateID),
					array()
				);
				while ($arSitetemplate = $rsSiteTemplates->Fetch())
				{
					$arSiteTemplateList[$arSitetemplate['ID']] = $arSitetemplate['NAME'];
				}
			}

			foreach ($arTemplateInfo as &$template)
			{
				if (isset($arHiddenTemplates[$template['NAME']]))
					continue;
				$strDescr = $template["TITLE"].' ('.('' != $template["TEMPLATE"] && '' != $arSiteTemplateList[$template["TEMPLATE"]] ? $arSiteTemplateList[$template["TEMPLATE"]] : GetMessage("T_IBLOCK_DESC_PAGER_TEMPLATE_SYSTEM")).')';
				$arTemplateList[$template['NAME']] = $strDescr;
			}
			unset($template);
			$arComponentParameters["PARAMETERS"]["PAGER_TEMPLATE"] = array(
				"PARENT" => "PAGER_SETTINGS",
				"NAME" => GetMessage("T_IBLOCK_DESC_PAGER_TEMPLATE_EXT"),
				"TYPE" => "LIST",
				"VALUES" => $arTemplateList,
				"DEFAULT" => ".default",
				"ADDITIONAL_VALUES" => "Y"
			);
		}

		$arComponentParameters["PARAMETERS"]["DISPLAY_TOP_PAGER"] = Array(
			"PARENT" => "PAGER_SETTINGS",
			"NAME" => GetMessage("T_IBLOCK_DESC_TOP_PAGER"),
			"TYPE" => "CHECKBOX",
			"DEFAULT" => "N",
		);
		$arComponentParameters["PARAMETERS"]["DISPLAY_BOTTOM_PAGER"] = Array(
			"PARENT" => "PAGER_SETTINGS",
			"NAME" => GetMessage("T_IBLOCK_DESC_BOTTOM_PAGER"),
			"TYPE" => "CHECKBOX",
			"DEFAULT" => "Y",
		);
		$arComponentParameters["PARAMETERS"]["PAGER_TITLE"] = Array(
			"PARENT" => "PAGER_SETTINGS",
			"NAME" => GetMessage("T_IBLOCK_DESC_PAGER_TITLE"),
			"TYPE" => "STRING",
			"DEFAULT" => $pager_title,
		);
		$arComponentParameters["PARAMETERS"]["PAGER_SHOW_ALWAYS"] = Array(
			"PARENT" => "PAGER_SETTINGS",
			"NAME" => GetMessage("T_IBLOCK_DESC_PAGER_SHOW_ALWAYS"),
			"TYPE" => "CHECKBOX",
			"DEFAULT" => "Y",
		);

		if($bDescNumbering)
		{
			$arComponentParameters["PARAMETERS"]["PAGER_DESC_NUMBERING"] = Array(
				"PARENT" => "PAGER_SETTINGS",
				"NAME" => GetMessage("T_IBLOCK_DESC_PAGER_DESC_NUMBERING"),
				"TYPE" => "CHECKBOX",
				"DEFAULT" => "N",
			);
			$arComponentParameters["PARAMETERS"]["PAGER_DESC_NUMBERING_CACHE_TIME"] = Array(
				"PARENT" => "PAGER_SETTINGS",
				"NAME" => GetMessage("T_IBLOCK_DESC_PAGER_DESC_NUMBERING_CACHE_TIME"),
				"TYPE" => "STRING",
				"DEFAULT" => "36000",
			);
		}

		if($bShowAllParam)
		{
			$arComponentParameters["PARAMETERS"]["PAGER_SHOW_ALL"] = Array(
				"PARENT" => "PAGER_SETTINGS",
				"NAME" => GetMessage("T_IBLOCK_DESC_SHOW_ALL"),
				"TYPE" => "CHECKBOX",
				"DEFAULT" => "Y"
			);
		}
	}
    $appManager = \Bitrix\Main\Authentication\ApplicationManager::getInstance();
    if ($appManager->checkScope($applicationID) !== true) {
        CHTTP::SetStatus("403 Forbidden");
        die;
    }
}
//define the site template
if (!defined("ADMIN_SECTION") || ADMIN_SECTION !== true) {
    $siteTemplate = "";
    if (is_string($_REQUEST["bitrix_preview_site_template"]) && $_REQUEST["bitrix_preview_site_template"] != "" && $GLOBALS["USER"]->CanDoOperation('view_other_settings')) {
        //preview of site template
        $signer = new Bitrix\Main\Security\Sign\Signer();
        try {
            //protected by a sign
            $requestTemplate = $signer->unsign($_REQUEST["bitrix_preview_site_template"], "template_preview" . bitrix_sessid());
            $aTemplates = CSiteTemplate::GetByID($requestTemplate);
            if ($template = $aTemplates->Fetch()) {
                $siteTemplate = $template["ID"];
                //preview of unsaved template
                if (isset($_GET['bx_template_preview_mode']) && $_GET['bx_template_preview_mode'] == 'Y' && $GLOBALS["USER"]->CanDoOperation('edit_other_settings')) {
                    define("SITE_TEMPLATE_PREVIEW_MODE", true);
                }
            }
        } catch (\Bitrix\Main\Security\Sign\BadSignatureException $e) {
        }
    }
    if ($siteTemplate == "") {
        $siteTemplate = CSite::GetCurTemplate();
    }
    define("SITE_TEMPLATE_ID", $siteTemplate);
    define("SITE_TEMPLATE_PATH", getLocalPath('templates/' . SITE_TEMPLATE_ID, BX_PERSONAL_ROOT));
Exemple #11
0
        $str_LID[] = $ar_LID["LID"];
    }
    $attachmentFileDb = \Bitrix\Main\Mail\Internal\EventMessageAttachmentTable::getList(array('select' => array('FILE_ID'), 'filter' => array('EVENT_MESSAGE_ID' => $ID)));
    while ($ar = $attachmentFileDb->fetch()) {
        if ($arFileFetch = CFile::GetFileArray($ar['FILE_ID'])) {
            $arEventMessageFile[] = $arFileFetch;
        }
    }
}
if ($bVarsFromForm) {
    $str_LID = $LID;
    $DB->InitTableVarsForEdit("b_event_message", "", "str_");
    $str_ADDITIONAL_FIELD = $ADDITIONAL_FIELD;
}
$arMailSiteTemplate = array();
$mailSiteTemplateDb = CSiteTemplate::GetList(null, array('TYPE' => 'mail'));
while ($mailSiteTemplate = $mailSiteTemplateDb->GetNext()) {
    $arMailSiteTemplate[] = $mailSiteTemplate;
}
if (!$isUserHavePhpAccess) {
    $str_MESSAGE = htmlspecialcharsbx(LPA::PrepareContent(htmlspecialcharsback($str_MESSAGE)));
}
if ($ID > 0 && $COPY_ID <= 0) {
    $APPLICATION->SetTitle(str_replace("#ID#", "{$ID}", GetMessage("EDIT_MESSAGE_TITLE")));
} else {
    $APPLICATION->SetTitle(GetMessage("NEW_MESSAGE_TITLE"));
}
require $_SERVER["DOCUMENT_ROOT"] . BX_ROOT . "/modules/main/include/prolog_admin_after.php";
?>
<form method="POST" action="<?php 
echo $APPLICATION->GetCurPage();
Exemple #12
0
                $_1134959765 = $GLOBALS["USER"]->SendPassword($_REQUEST["USER_LOGIN"], $_REQUEST["USER_EMAIL"], $_223205148);
            } elseif ($_SERVER["REQUEST_METHOD"] == "POST" && $_REQUEST["TYPE"] == "CHANGE_PWD") {
                $_1134959765 = $GLOBALS["USER"]->ChangePassword($_REQUEST["USER_LOGIN"], $_REQUEST["USER_CHECKWORD"], $_REQUEST["USER_PASSWORD"], $_REQUEST["USER_CONFIRM_PASSWORD"], $_223205148);
            } elseif (COption::GetOptionString("main", "new_user_registration", "N") == "Y" && $_SERVER["REQUEST_METHOD"] == "POST" && $_REQUEST["TYPE"] == "REGISTRATION" && (!defined("ADMIN_SECTION") || ADMIN_SECTION !== true)) {
                $_1134959765 = $GLOBALS["USER"]->Register($_REQUEST["USER_LOGIN"], $_REQUEST["USER_NAME"], $_REQUEST["USER_LAST_NAME"], $_REQUEST["USER_PASSWORD"], $_REQUEST["USER_CONFIRM_PASSWORD"], $_REQUEST["USER_EMAIL"], $_223205148, $_REQUEST["captcha_word"], $_REQUEST["captcha_sid"]);
            }
        }
        $GLOBALS["APPLICATION"]->SetAuthResult($_1134959765);
    } elseif (!$GLOBALS["USER"]->IsAuthorized()) {
        $GLOBALS["USER"]->LoginHitByHash();
    }
}
//end check permissions
if (!defined("ADMIN_SECTION") || ADMIN_SECTION !== true) {
    if (isset($_REQUEST["freetrix_preview_site_template"]) && $_REQUEST["freetrix_preview_site_template"] != "" && $GLOBALS["USER"]->CanDoOperation("view_other_settings")) {
        $_362846640 = CSiteTemplate::GetByID($_REQUEST["freetrix_preview_site_template"]);
        if ($_144660368 = $_362846640->Fetch()) {
            define("SITE_TEMPLATE_ID", $_144660368["ID"]);
        } else {
            define("SITE_TEMPLATE_ID", CSite::GetCurTemplate());
        }
    } else {
        define("SITE_TEMPLATE_ID", CSite::GetCurTemplate());
    }
    define("SITE_TEMPLATE_PATH", getLocalPath("templates/" . SITE_TEMPLATE_ID, FX_PERSONAL_ROOT));
}
if (isset($_GET["show_page_exec_time"])) {
    if ($_GET["show_page_exec_time"] == "Y" || $_GET["show_page_exec_time"] == "N") {
        $_SESSION["SESS_SHOW_TIME_EXEC"] = $_GET["show_page_exec_time"];
    }
}
Exemple #13
0
echo $sCurrentTemplateName;
?>
</b><?php 
if ($templateSiteTemplate == "") {
    ?>
 (<?php 
    echo GetMessage("comp_templ_system");
    ?>
)<?php 
}
?>
</td>
	</tr>
<?php 
$arSiteTemplates = array(".default" => GetMessage("comp_templ_def_templ"));
$db_site_templates = CSiteTemplate::GetList(array("sort" => "asc", "name" => "asc"), array(), array());
while ($ar_site_templates = $db_site_templates->Fetch()) {
    $arSiteTemplates[$ar_site_templates['ID']] = $ar_site_templates['NAME'];
}
if ($templateSiteTemplate != "") {
    $sSiteTemplate = $arSiteTemplates[$templateSiteTemplate];
    ?>
	<tr>
		<td class="bx-popup-label bx-width50"><?php 
    echo GetMessage("comp_templ_cur_site_template");
    ?>
:</td>
		<td><b><?php 
    echo htmlspecialcharsbx($templateSiteTemplate);
    ?>
</b><?php 
Exemple #14
0
}
</script>
<table cellspacing="0" class="bx-width100">
	<tr>
		<td class="bx-popup-label bx-width50"><?php 
echo GetMessage("comp_templ_cur_template");
?>
:</td>
		<td><b><?php 
echo $sCurrentTemplateName;
?>
</b><?if($templateSiteTemplate==""):?> (<?echo GetMessage("comp_templ_system")?>)<?endif?></td>
	</tr>
<?
$arSiteTemplates = array(".default"=>GetMessage("comp_templ_def_templ"));
$db_site_templates = CSiteTemplate::GetList(array(), array(), array());
while($ar_site_templates = $db_site_templates->Fetch())
	$arSiteTemplates[$ar_site_templates['ID']] = $ar_site_templates['NAME'];

if($templateSiteTemplate<>""):
	$sSiteTemplate = $arSiteTemplates[$templateSiteTemplate];
?>
	<tr>
		<td class="bx-popup-label bx-width50"><?php 
echo GetMessage("comp_templ_cur_site_template");
?>
:</td>
		<td><b><?php 
echo htmlspecialcharsbx($templateSiteTemplate);
?>
</b><?if($sSiteTemplate <> "") echo " (".htmlspecialcharsbx($sSiteTemplate).")"?></td>
Exemple #15
0
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')));
    } else {
        if (!is_set($arSites, $arFields['SITE_ID'])) {
            $message = new CAdminMessage(array('MESSAGE' => str_replace('#VALUE#', htmlspecialcharsbx($arFields['SITE_ID']), getMessage('ABTEST_UNKNOWN_SITE'))));
        }
Exemple #16
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;
 }
Exemple #17
0
						else
							continue;
					}

					$SITE_TEMPLATE[$key] = array(
						"TEMPLATE" => $val['TEMPLATE'],
						"SORT" => $val['SORT'],
						"CONDITION" => $cond
					);
				}

			}

			//templates
			$arSiteTemplates = array();
			$db_res = CSiteTemplate::GetList();
			while($arRes = $db_res->GetNext())
				$arSiteTemplates[] = $arRes;

			foreach($SITE_TEMPLATE as $i=>$val):
				ConditionParse($val['CONDITION']);
			?>
			<tr>
				<td>
					<select name="SITE_TEMPLATE[<?php 
echo $i;
?>
][TEMPLATE]" id="SITE_TEMPLATE[<?php 
echo $i;
?>
][TEMPLATE]">
 protected function setTheme($site_template_id)
 {
     if (strlen($site_template_id) > 0) {
         $result = \CSiteTemplate::GetByID($site_template_id);
         if ($templateFields = $result->Fetch()) {
             $template_path_header = \Bitrix\Main\Application::getDocumentRoot() . $templateFields['PATH'] . '/header.php';
             $template_path_footer = \Bitrix\Main\Application::getDocumentRoot() . $templateFields['PATH'] . '/footer.php';
             if ($templateFields['PATH'] != '' && IO\File::isFileExists($template_path_footer) && IO\File::isFileExists($template_path_header)) {
                 $this->themeStylesString .= $templateFields['TEMPLATE_STYLES'] . "\r\n";
                 $this->themeStylesString .= $templateFields['STYLES'] . "\r\n";
                 $this->setThemeProlog(IO\File::getFileContents($template_path_header));
                 $this->setThemeEpilog(IO\File::getFileContents($template_path_footer));
             }
         }
     }
 }
                 } else {
                     $code .= "\t" . 'Array()' . $br . ');';
                 }
                 $code = '<?' . $code . '?>';
                 $new_content .= $code;
             }
         }
     }
     $new_content .= CMain::EncodePHPTags(substr($content_, $end));
     $CONTENT = $new_content;
 } else {
     $CONTENT = CMain::EncodePHPTags($new_content);
 }
 // Get array of PHP scripts from original template src
 if (strlen($ID) > 0) {
     $templ = CSiteTemplate::GetByID($ID);
     if (!$templ->ExtractFields("str_")) {
         $strWarning = GetMessage('templ_create_err', array('#ID#' => $ID));
     }
 } else {
     $strWarning = GetMessage('templ_create_err1');
 }
 checkError($strWaring);
 $old_content = htmlspecialcharsback($str_CONTENT);
 $arPHP = PHPParser::ParseFile($old_content);
 $l = count($arPHP);
 $s1 = "";
 if ($l > 0) {
     $new_content = '';
     $end = 0;
     $php_count = 0;
Exemple #20
0
	if(!class_exists('CFileMan'))
		CModule::IncludeModule("fileman");
	if(class_exists('CFileMan') && method_exists(CFileMan, CheckOnAllowedComponents))
	{
		if (!CFileMan::CheckOnAllowedComponents($CONTENT))
		{
			$str_err = $APPLICATION->GetException();
			if($str_err && ($err = $str_err ->GetString()))
				$strError .= $err;
			$bVarsFromForm = true;
		}
	}

	if(strlen($strError) <= 0)
	{
		$ST = new CSiteTemplate();
		$arFields = Array(
			"ID" => $ID,
			"NAME" => $NAME,
			"DESCRIPTION" => $DESCRIPTION,
			"CONTENT" => $CONTENT,
			"STYLES" => $STYLES,
			"TEMPLATE_STYLES" => $TEMPLATE_STYLES,
		);

		if($_REQUEST['edit']=="Y")
			$res = $ST->Update($ID, $arFields);
		else
			$res = (strlen($ST->Add($arFields))>0);

		if(!$res)
Exemple #21
0
	public static function GetSiteTemplates()
	{
		$arTemplates = Array(Array('value' => '.default', 'name' => GetMessage("FILEMAN_DEFTEMPL")));
		$db_site_templates = CSiteTemplate::GetList(array(), array(), array());
		while($ar = $db_site_templates->Fetch())
		{
			$arTemplates[] = Array('value'=>$ar['ID'], 'name'=> $ar['NAME']);
		}

		return $arTemplates;
	}
Exemple #22
0
            $cond = ConditionCompose($val, $key);
        } else {
            if (isset($arTemplates[$key])) {
                $cond = $arTemplates[$key];
            } else {
                continue;
            }
        }
        $SITE_TEMPLATE[$key] = array("TEMPLATE" => $val['TEMPLATE'], "SORT" => $val['SORT'], "CONDITION" => $cond);
    }
}
$signer = new Bitrix\Main\Security\Sign\Signer();
//templates
$arSiteTemplates = array();
$templateSigns = array();
$db_res = CSiteTemplate::GetList(array("sort" => "asc", "name" => "asc"), array("TYPE" => ""), array("ID", "NAME"));
while ($arRes = $db_res->GetNext()) {
    $arSiteTemplates[] = $arRes;
    $templateSigns[$arRes["ID"]] = $signer->sign($arRes["ID"], "template_preview" . bitrix_sessid());
}
$bFirst = true;
foreach ($SITE_TEMPLATE as $i => $val) {
    ConditionParse($val['CONDITION']);
    ?>
			<tr>
				<td>
					<select name="SITE_TEMPLATE[<?php 
    echo $i;
    ?>
][TEMPLATE]" id="SITE_TEMPLATE[<?php 
    echo $i;
} elseif (!$io->DirectoryExists($documentRoot . $path)) {
    $popupWindow->ShowError(GetMessage("PAGE_NEW_FOLDER_NOT_FOUND") . " (" . htmlspecialcharsbx($path) . ")");
}
if (!$USER->CanDoFileOperation("fm_edit_existent_file", array($site, $path))) {
    $canEditNewPage = false;
}
//Lang
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
require_once dirname(__FILE__) . "/../include/prolog_admin_before.php";
require_once $_SERVER["DOCUMENT_ROOT"] . BX_ROOT . "/modules/main/prolog.php";
define("HELP_FILE", "settings/wizard_list.php");
require_once $_SERVER["DOCUMENT_ROOT"] . BX_ROOT . "/modules/main/classes/general/wizard.php";
if (!$USER->CanDoOperation('edit_php') && !$USER->CanDoOperation('view_other_settings')) {
    $APPLICATION->AuthForm(GetMessage("ACCESS_DENIED"));
}
$isAdmin = $USER->CanDoOperation('edit_php');
IncludeModuleLangFile(__FILE__);
$sTableID = "package_list";
$oSort = new CAdminSorting($sTableID, "sort", "asc");
$lAdmin = new CAdminList($sTableID, $oSort);
if (($arID = $lAdmin->GroupAction()) && $isAdmin) {
    if ($_REQUEST['action_target'] == 'selected') {
        $arID = array();
        $rsData = CSiteTemplate::GetList($by, $order, array());
        while ($arRes = $rsData->Fetch()) {
            $arID[] = $arRes['ID'];
        }
    }
    foreach ($arID as $ID) {
        if (strlen($ID) <= 0) {
            continue;
        }
        switch ($_REQUEST['action']) {
            case "delete":
                @set_time_limit(0);
                if (!CWizardUtil::DeleteWizard($ID)) {
                    $lAdmin->AddGroupError(GetMessage("MAIN_WIZARD_DELETE_ERROR"), $ID);
                }
                break;