Пример #1
0
            $previewFile = pathFromID($_POST['sourcefile']);
            $liveFile = getLiveLCIFromPreview(pathFromID($previewFile));
        } else {
            $liveFile = pathFromID($_POST['sourcefile']);
            $previewFile = getPreviewFileFromLive($liveFile);
        }
        break;
}
/* 
DEBUGGING
echo $previewFile, "\n\n", $liveFile ;
exit ;
*/
// Correct path to include for general, for Pages only
if ($mode == "page") {
    $fileContent = correctGeneralInclude(stripslashes($fileContent), $previewFile);
    $fileContent = unSimplifyContents($fileContent, $previewFile);
} else {
    $fileContent = stripslashes($fileContent);
}
// Open handle to Preview file
if (False === ($fileHandle = @fopen($previewFile, 'w'))) {
    print 'error:Could not open preview file - ' . $previewFile;
    exit;
}
chmod($previewFile, 0644);
// Try to save Preview copy
if (False === @fwrite($fileHandle, $fileContent)) {
    fclose($fileHandle);
    print 'error:Could not save preview file - ' . $previewFile;
    exit;
Пример #2
0
        exit;
    } else {
        chmod($previewIncludesDirectory, 0755);
    }
}
if (!is_dir($liveIncludesDirectory)) {
    if (mkdir($liveIncludesDirectory, 0755) === False) {
        print 'error:Couldn\'t create Live Includes folder: ' . $liveIncludesDirectory;
        exit;
    } else {
        chmod($liveIncludesDirectory, 0755);
    }
}
// Put in the right path to cms/general.php
// 2nd parameter below is source file path, i.e. relative path from web root to new page...
$ptContents = correctGeneralInclude($ptContents, $pathToPage);
// Replace any << includes >> with appropriate put() function calls...
$ptContents = unSimplifyContents($ptContents);
// Read filenames of any PT include files that exist into array
$ptLocalIncludes = PTSDIR . '/';
if ($pt) {
    $ptLocalIncludes .= pathFromID(stripFileExtension($pt));
}
// Builds an array of any files that exist in "pagetemplates/ptname"
$ptIncludeFilesArray = array();
if (is_dir($ptLocalIncludes)) {
    $ptLocalIncludeHandle = opendir($ptLocalIncludes);
    while (false !== ($ptIncludeFile = readdir($ptLocalIncludeHandle))) {
        if ($ptIncludeFile != '.' && $ptIncludeFile != '..' && !is_dir($ptLocalIncludes . '/' . $ptIncludeFile)) {
            array_push($ptIncludeFilesArray, $ptIncludeFile);
        }