session_write_close(); require_once("common.php"); require_once("loggedinuser.php"); require_once("contenthandler.php"); session_start(); if (isset($_GET['file'])) { $targetFile = $_GET['file']; if (!isVarGood($targetFile, false)) { die("Form variables are incomplete and/or invalid!"); } $targetFile = str_replace("\\", "", $targetFile); $targetFile = str_replace("..", "", $targetFile); global $CMS_CONTENT_FS_PATH; if (!is_readable($CMS_CONTENT_FS_PATH . $targetFile)) { die("Cannot read file " . $targetFile); } $hFile = fopen($CMS_CONTENT_FS_PATH . $targetFile, "r"); $content = fread($hFile, filesize($CMS_CONTENT_FS_PATH . $targetFile)); fclose($hFile); $beginPos = strpos($content, ""); $endPos = strpos($content, ""); if (($beginPos === false) || ($endPos === false)) { die("Cannot read file " . $targetFile); } else $beginPos += 19; $contentLen = $endPos - $beginPos; $content = substr($content, $beginPos, $contentLen); ?>