Ejemplo n.º 1
0
 public static function __FindTemplates($root, &$arTemplates, $arCurrentValues = array(), $init = "")
 {
     if (is_dir($_SERVER['DOCUMENT_ROOT'] . $root . $init)) {
         $arTemplateDescription = array();
         if (file_exists($_SERVER['DOCUMENT_ROOT'] . $root . $init . "/.description.php")) {
             include $_SERVER['DOCUMENT_ROOT'] . $root . $init . "/.description.php";
             foreach ($arTemplateDescription as $path => $desc) {
                 $desc["REAL_PATH"] = $root . $init . "/" . $path;
                 if (strlen($desc["PARENT"]) > 0) {
                     $desc["PARENT"] = $init . "/" . $desc["PARENT"];
                 }
                 $arTemplates[$init . "/" . $path] = $desc;
             }
         }
         if ($handle = @opendir($_SERVER["DOCUMENT_ROOT"] . $root . $init)) {
             while (($file = readdir($handle)) !== false) {
                 if ($file == "." || $file == "..") {
                     continue;
                 }
                 CTemplates::__FindTemplates($root, $arTemplates, $arCurrentValues, $init . "/" . $file);
             }
         }
     }
 }
Ejemplo n.º 2
0
        foreach ($aComponents as $component) {
            $arRes = PHPParser::CheckForComponent($component[2]);
            if ($arRes && $arRes["SCRIPT_NAME"] == $_GET["path"]) {
                $arValues = $arRes["PARAMS"];
                $aComponent = $component;
                break;
            }
        }
    }
    if ($aComponent === false) {
        $strWarning .= GetMessage("comp_prop_err_comp") . "<br>";
    }
}
//$_SERVER["REQUEST_METHOD"] == "POST" && $_GET["action"] == "refresh"
if ($strWarning == "") {
    $arTemplate = CTemplates::GetByID($_GET["path"], $arValues, $_GET["template_id"]);
    /* save parameters to file */
    if ($_SERVER["REQUEST_METHOD"] == "POST" && $_GET["action"] == "save" && $aComponent !== false && $arTemplate !== false) {
        if (!check_bitrix_sessid()) {
            $strWarning .= GetMessage("comp_prop_err_save") . "<br>";
        } else {
            $params = PHPParser::ReturnPHPStr($_POST, $arTemplate["PARAMS"]);
            if ($params != "") {
                $code = "<" . "?" . ($arRes["VARIABLE"] ? $arRes["VARIABLE"] . "=" : "") . "\$APPLICATION->IncludeFile(\"" . $_GET["path"] . "\", Array(\r\n\t" . $params . "\r\n\t)\r\n);?" . ">";
            } else {
                $code = "<" . "?" . ($arRes["VARIABLE"] ? $arRes["VARIABLE"] . "=" : "") . "\$APPLICATION->IncludeFile(\"" . $_GET["path"] . "\");?" . ">";
            }
            $filesrc_for_save = substr($filesrc, 0, $aComponent[0]) . $code . substr($filesrc, $aComponent[1]);
            if ($APPLICATION->SaveFileContent($abs_path, $filesrc_for_save)) {
                $obJSPopup->Close();
            } else {