// ???????????????? $previewFile = pathFromID($_POST['sourcefile']); $liveFile = False; break; case "pagetemplate": // ???????????????? $previewFile = pathFromID($_POST['sourcefile']); $liveFile = False; break; default: if (isLCI(pathFromID($_POST['sourcefile']))) { // We have an LCI $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);
- Return list of local child includes, with status code for each LCI Note: LIVE is the master collection... */ header("Content-type: text/xml"); require "../cmsfns.php"; // DEBUG echo $_GET['file'] ; exit ; if (!isset($_GET['file'])) { echo 'error:No file name provided.'; exit; } /* Get details of file itself (Page/FI) */ $matchStatus = false; $liveFile = pathFromID($_GET['file']); /* If $liveFile starts with "pagetemplates/"... it's a PT In which case, get the LCIs from pagetemplates/ptname/ */ // echo 'error:' . $isPT ; exit ; if (isPageTemplate($liveFile)) { $xmlr = '<xml>'; $xmlr .= '<file>' . $_GET['file'] . '</file>'; $xmlr .= '<filestatus>0</filestatus>'; getPTChildIncludes($liveFile); } else { $previewFile = getPreviewFileFromLive($liveFile); $matchStatus = matchFiles($previewFile, $liveFile); $xmlr = '<xml>'; $xmlr .= '<file>' . $_GET['file'] . '</file>';
<form action="save-set.php" method="post" id="setForm"> <div> <button type="button" onclick="banish();"><?php echo translate('Cancel'); ?> </button> <button type="button" onclick="submitForm();" style="width:10em; margin-left:3em;"><?php echo translate('Save & Close'); ?> </button> </div> <h1>Edit set: <?php echo stripFileExtension(basename(pathFromID($file))); ?> </h1> <table border="0" cellpadding="0" cellspacing="0" id="setGrid" style="display:none;"> <thead> <tr id="tableHeadRow"></tr> </thead> <tbody id="tableBody"> </tbody> </table> <button type="button" onClick="addRowManual(true);" id="addRowsButton">Add Row</button> <?php if ($_SESSION['loginStatus'] > 1) { echo '<button title="Add column" id="addColumnButton" type="button" onClick="getNewColDetails();">Add column</button>';
Cmsfromscratch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with Cmsfromscratch. If not, see <http://www.gnu.org/licenses/>. *********************************************************************** */ require '../cmsfns.php'; if (!isset($_GET['dir'])) { print 'error:nonewfoldername'; exit; } $newFolderPath = pathFromID($_GET['dir']); $created = @mkdir($newFolderPath, 0755); chmod($newFolderPath, 0755); if (False === $created) { print 'error: Couldn\'t create folder [' . $_GET['dir'] . ']'; exit; } // Any new folders created will also be created in /cms/includes/ $createdPreview = @mkdir(getPreviewFileFromLive($newFolderPath), 0755); chmod(getPreviewFileFromLive($newFolderPath), 0755); if (False === $createdPreview) { print 'error: Failed to create child folder [' . getPreviewFileFromLive($newFolderPath) . ']'; exit; } else { print $_GET['dir']; }
You should have received a copy of the GNU General Public License along with Cmsfromscratch. If not, see <http://www.gnu.org/licenses/>. *********************************************************************** */ header("Content-type: text/xml"); require 'check-login.php'; require '../cmsfns.php'; if (!isset($_GET['dir'])) { exit; } // Strip off trailing slash if one exists define("DIR", rtrim($_GET['dir'], '/')); $xmlr = '<xml>'; $xmlr .= '<parentdir>' . DIR . '</parentdir>'; $handle = opendir(pathFromID(DIR)); $arrDirs = array(); $arrFiles = array(); while (false !== ($file = readdir($handle))) { if (!in_array($file, $reserved_filenames) && !in_array(DIR . '/' . $file, $reserved_filenames)) { if (is_dir(DIR . '/' . $file)) { // Directory if ($_SESSION['loginStatus'] < 2 && DIR . '/' . $file == '../private') { continue; } array_push($arrDirs, $file); } else { array_push($arrFiles, $file); } } }
exit; } else { /* CHILD INCLUDES (1 or more) Expects: - $_GET['action'] as "publish" or "restore" - $_GET['file'] = relative path to 1 or more PREVIEW INCLUDE file(s) (i.e. includes/path/blah.ext) */ if (!isset($_GET['action'])) { print 'error: No action'; exit; } elseif (!isset($_GET['file'])) { print 'error: No file set'; exit; } $previewFile = pathFromID($_GET['file']); $liveFile = getLiveLCIFromPreview($previewFile); if ($_GET['action'] == 'publish' && file_exists($previewFile)) { // PUBLISH if (False === @copy($previewFile, $liveFile)) { print 'error: Publishing failed - ' . $previewFile . ' -> ' . $liveFile; exit; } } else { // RESTORE if (False === @copy($liveFile, $previewFile)) { print 'error: Restoring failed - ' . $liveFile . ' -> ' . $previewFile; exit; } } // SUCCESS
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); } } closedir($ptLocalIncludeHandle); } // Parse PT for any references to child includes (i.e. <<includes>>) $nextIncludeEnd = 0; /*
define("DIR", dirname($_POST['newfilepath'])); // Read in template $templateArray = @unserialize(file_get_contents(STDIR . $_POST['template'])); $newArray = array(); $newArray[0] = $_POST['template']; $newArray[1] = $newArray[0]; $newArray[2] = $templateArray['cols']; // If it's going to belong to a PT, there's only one copy! if (isset($_POST['parentpage'])) { if (isPageTemplate(pathFromID($_POST['parentpage']))) { // strip the .php and append a / $newPreviewFilePath = stripFileExtension(pathFromID($_POST['parentpage'])) . '/' . $_POST['newfilepath'] . '.set'; $newLiveFilePath = False; $successReturnValue = $newPreviewFilePath; } else { $includesRoot = getLCIRootFolderFromPagePath(pathFromID($_POST['parentpage'])); makeSureFoldersExist($includesRoot); $newPreviewFilePath = $includesRoot . '/cms_preview/' . $_POST['newfilepath'] . '.set'; $newLiveFilePath = getLiveLCIFromPreview($newPreviewFilePath); $successReturnValue = $_POST['parentpage'] . '/' . $_POST['newfilepath'] . '.set'; // Note: Simpler line below works in new text... // $returnFile = $_GET['parentpage'] . '/' . $fileName ; } } else { // FREE INCLUDE: there are also 2 copies (i.e. parentpage not set) $newLiveFilePath = $newFilePath; // echo "debug:$newLiveFilePath" ; exit ; $newPreviewFilePath = getPreviewFileFromLive($newFilePath); $successReturnValue = $newLiveFilePath; } if (False !== $newPreviewFilePath && is_file($newPreviewFilePath)) {
Cmsfromscratch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with Cmsfromscratch. If not, see <http://www.gnu.org/licenses/>. *********************************************************************** */ require 'check-login.php'; require '../cmsfns.php'; if (!isset($_POST['pagePath'])) { echo 'error:No page path provided.'; exit; } else { $pagePath = getPreviewFileFromLive(pathFromID($_POST['pagePath'])); } if (!isset($_POST['newPTName'])) { echo 'error:No new page template name provided.'; exit; } else { $newPTName = $_POST['newPTName']; } // Check PT name is not already used if (file_exists(PTSDIR . '/' . $newPTName . PTEXTENSION)) { echo 'error: A page template of that name already exists.'; exit; } $fileContents = @file_get_contents($pagePath); if ($fileContents === False) { echo 'error: Could not read source page file: ' . $pagePath;
Cmsfromscratch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with Cmsfromscratch. If not, see <http://www.gnu.org/licenses/>. *********************************************************************** */ require '../cmsfns.php'; if (!isset($_GET['dir'])) { print 'error:nodirectorytodelete'; exit; } $liveDir = pathFromID($_GET['dir']); $previewDir = getPreviewFileFromLive($liveDir); if (is_dir($liveDir)) { // Delete directory $dirWiped = wipeDir($liveDir); @rmdir($liveDir); /* if (False === @rmdir($liveDir)) { print('error:Delete live copy of folder failed') ; exit ; }*/ } if (is_dir($previewDir)) { // Delete directory $dirWiped = wipeDir($previewDir); @rmdir($previewDir); /* if (False === @rmdir($previewDir)) {
top:1em; right:3em; width:8em; } #close_button { top:3.25em; right:4.5em; width:5em; } </style> </head> <body style="margin:0; padding:0;"> <form action="save-text.php" method="post" style="margin:0; padding:0;" onSubmit="return false;"> <input type="hidden" id="sourcefile" name="sourcefile" value="<?php echo pathFromID($_GET['file']); ?> " /> <?php include "FCKeditor/fckeditor.php"; $oFCKeditor = new FCKeditor('textcontent'); // $oFCKeditor->BasePath = '/cms/06/1_1_3/cms/FCKeditor/' ; $oFCKeditor->BasePath = 'FCKeditor/'; $oFCKeditor->Value = $writeContent; $oFCKeditor->Height = '100%'; $oFCKeditor->Create(); ?> </form> <button onclick="saveHTML();" id="saveHTMLButton">Save</button> <button onclick="banish();" id="close_button">Close</button> <!-- <button onclick="top.saveTextEditor(this, true);" id="save_and_continue_button">Save & continue editing</button> -->
exit; } $includesRoot = getLCIRootFolderFromPagePath(pathFromID($_GET['parentpage'])); makeSureFoldersExist($includesRoot); $newPreviewFilePath = $includesRoot . '/cms_preview/' . $fileName; $newLiveFilePath = getLiveLCIFromPreview($newPreviewFilePath); // parentpage = e.g. DOTDOTSLASHpageDOTphp $returnFile = $_GET['parentpage'] . '/' . $fileName; break; case "ptchildinclude": // New text/html file belongs to a Page Template $newPreviewFilePath = stripFileExtension($_GET['parentpage']) . '/' . $fileName; $newLiveFilePath = False; break; case "freeinclude": $newPreviewFilePath = pathFromID($_GET['newfilepath']); $newLiveFilePath = getPreviewFileFromLive($newPreviewFilePath); break; } if ($newPreviewFilePath) { if (is_file($newPreviewFilePath)) { print 'error:newpreviewfilealreadyexists - ' . $newPreviewFilePath; } $createdPreview = @fopen($newPreviewFilePath, 'w'); if (False === $createdPreview) { print 'error:Could not create new Preview text file.'; fclose($createdPreview); } chmod($newPreviewFilePath, 0644); fclose($createdPreview); }
*/ @(require_once '../cmsfns.php'); $killFile2 = False; /* Expects: - $_GET['file'] Deletes - Free includes (both live and preview copies) - Pages (both live and preview copies, including LCI folders) - LCIs (deletes both Preview and Live versions) */ if (!isset($_GET['file'])) { print 'error:nodeletefilesupplied'; } else { $killFile = pathFromID($_GET['file']); } // Checks if (!file_exists($killFile)) { print 'error:filedoesnotexist - ' . $_GET['file']; exit; } // Delete primary File if (False === @unlink($killFile)) { print 'error:deletefilefailed - ' . $killFile; exit; } // DEBUG print ('error:' . $killFile); exit ; if (strstr($killFile, '_cms_files/')) { // We have a LCI. Get the live file from preview // Note: Use a generic function for this...!!!
You should have received a copy of the GNU General Public License along with Cmsfromscratch. If not, see <http://www.gnu.org/licenses/>. *********************************************************************** */ /* Expects: $_GET['filePath'] ; $_GET['newFileName'] ; */ require '../cmsfns.php'; if (!isset($_GET['filePath'])) { echo 'error:No original file name sent'; exit; } else { $filePath = pathFromID($_GET['filePath']); } if (!file_exists($filePath)) { echo 'error:Original file not found.'; exit; } if (!isset($_GET['newFileName'])) { echo 'error:No new file name sent'; exit; } else { $newFileName = $_GET['newFileName']; } $dir = dirname($filePath); $ext = getFileExtension($filePath); /* If it's a SET TEMPLATE ???