echo '</a>'; } echo ' /'; } ?> </div> <?php $handle = opendir(DIR); $itemsFound = 0; $outputHTML = ''; $outputDirs = ''; $outputFiles = ''; while (false !== ($file = readdir($handle))) { $previewFile = getPreviewFileFromLive(DIR . '/' . $file); if (strstr($file, 'phpthumb') || strstr($file, 'phpthumb') || !file_exists($previewFile)) { continue; } if (!in_array($file, $reserved_filenames)) { $itemsFound++; if (is_dir(DIR . '/' . $file)) { // Directory $outputDirs .= "\n<li class=\"dir\">"; $outputDirs .= '<a href="?dir=' . DIR . '/' . $file . '" title="Browse ' . $file . '">'; $outputDirs .= $file; $outputDirs .= '</a></li>'; } else { if (getFileExtension($file) == 'html' || getFileExtension($file) == 'php') { // File $outputFiles .= "\n" . '<li class="file"><a href="javascript:selectPage(\'' . DIR . '/' . $file . '\');" >';
$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); }
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'; require 'check-login.php'; if (!isset($_GET['pagepath'])) { print 'error:No new page name passed.'; exit; } else { $newLivePagePath = pathFromID($_GET['pagepath'] . '.php'); $newPreviewPagePath = getPreviewFileFromLive($newLivePagePath); $pathToPage = dirname($newLivePagePath) . '/'; } if (isset($_GET['pt']) && strlen($_GET['pt'])) { // Fetch contents of Page Template $pt = $_GET['pt']; if (getFileExtension($pt) != 'php') { $pt .= '.php'; } $ptContents = @file_get_contents(PTSDIR . '/' . pathFromID($pt)); if (False === $ptContents) { echo 'error: Could not find PT ' . pathFromID($pt); exit; } } else { $ptContents = '';
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']; }
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)) { print('error:Delete preview copy of folder failed') ;
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/>. *********************************************************************** */ /* Expects: $_GET['file'] */ require 'check-login.php'; require '../cmsfns.php'; $fileName = getPreviewFileFromLive(pathFromID($_GET['file'])); $fileContents = @file_get_contents($fileName); if ($fileContents === False) { echo ' <html><head><script type="text/javascript"> <!-- alert("Could not load HTML file!") ; // --> </script></head></html> '; exit; } // Tidy up text $writeContent = ereg_replace("[[:space:]]+", ' ', $fileContents); // $writeContent = str_replace ('"', '\\"', $writeContent) ; // $writeContent = str_replace ('</textarea>', '</textarea>', $writeContent) ;
// We have a LCI. Get the live file from preview // Note: Use a generic function for this...!!! $killFile2 = str_replace('_cms_files/cms_preview/', '_cms_files/cms_live/', $killFile); } else { if (isPageTemplate($killFile)) { // PT name is strip slash, add ".php" $killFile2 = false; $includesDir = stripFileExtension($killFile) . '/'; } else { // Must be a page or Free Include, so find the corresponding Live file??? = $killFile2 if (strstr($killFile, '../')) { $killFile2 = getPreviewFileFromLive($killFile); } if (getFileExtension($killFile) == "php") { // File is a PAGE, try to delete its local folders too $includesDir = stripFileExtension(getPreviewFileFromLive($killFile)) . '_cms_files'; clearstatcache(); } } } if (isset($includesDir) && is_dir($includesDir)) { if (wipeDir($includesDir)) { $includesDirWiped = @rmdir($includesDir); /* if (!$includesDirWiped) { print('error:couldntwipepageincludesfolder') ; exit ; }*/ } } /* Delete the corresponding Page/FI
$newDirPath = dirname($filePath) . '/' . $newFileName; if (False === @rename($filePath, $newDirPath)) { echo 'error:Failed to rename folder: ' . $filePath . ' >>> ' . $newDirPath; exit; } $includesDirPath = getPreviewFileFromLive($filePath); $newIncludesDirPath = getPreviewFileFromLive($newDirPath); if (False === @rename($includesDirPath, $newIncludesDirPath)) { echo 'error:Failed to rename includes folder: ' . $includesDirPath . ' >>> ' . $newIncludesDirPath; exit; } echo 'regular'; exit; } else { // FREE INCLUDE --- rename it and its partner in Includes $newFilePath = $dir . '/' . $newFileName . '.' . $ext; if (False === @rename($filePath, $newFilePath)) { echo 'error:Failed to rename free include: ' . $filePath . ' >>> ' . $newFilePath; exit; } if (False === @rename(getPreviewFileFromLive($filePath), getPreviewFileFromLive($newFilePath))) { echo 'error:Failed to rename includes version of free include: ' . getPreviewFileFromLive($filePath) . ' >>> ' . getPreviewFileFromLive($newFilePath); exit; } echo 'regular'; exit; } } } } echo 'Not handled: ' . $filePath;