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 == '') {
            continue;
Exemple #2
0
	}

	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)
		{
			$strError .= $ST->LAST_ERROR."<br>";
			$bVarsFromForm = true;
		}
		else
		{
			$maxind = $_POST['maxind'];
			$str_CONTENT_for_save = "<?\n\$arStyles = array(\n";
			for ($i=0;$i<=$maxind;$i++)
			{
				if (trim($_POST["CODE_".$i]) == '')