$smarty->assign('pageTitle', $pageTitle); include_once 'filemanager.php'; $extArray = array('html', 'doc', 'txt', 'docx'); if (isset($_REQUEST['uploaddoc'])) { extract($_POST); $errorFlag = 0; if (preg_replace("/^\\s*\$/", "", $template_name) == "") { $errorFlag = 1; $errorList[] = "Template Name required."; } if (preg_replace("/^\\s*\$/", "", $_FILES['upfilecontent']['name']) == "") { $errorFlag = 1; $errorList[] = "Upload a file."; } else { $filename2 = trim($_FILES['upfilecontent']['name']); $extension2 = getFileDet($filename2, "ext"); $extension2 = strtolower($extension2); if (in_array($extension2, $extArray)) { $ext5 = strrpos($filename2, "."); $ext5 = substr($filename2, $ext5); $uploaddir = $foldername . "/"; $uploadfile2 = "upls/" . time() . $ext5; $file_name2 = time() . $ext5; if (file_exists($uploadfile2)) { unlink($uploadfile2); } move_uploaded_file(trim($_FILES['upfilecontent']['tmp_name']), $uploadfile2); chmod($uploadfile2, 0777); $page = file_get_contents($uploadfile2); $_POST['template_html_content'] = $template_html_content = preg_replace('%<script[^>]*>.*?</script>%is', '', $page); } else {
<?php include_once './includes.php'; if ($_POST["label"]) { $label = $_POST["label"]; } $returnVal = ""; $filePath = $configDetails['user_files'] . $_SESSION['SesUserId']; $allowedExts = array("gif", "jpeg", "jpg", "png", "html", "doc", "pdf", "docx"); $filename = trim($_FILES['file']['name']); $extension = getFileDet($filename, "ext"); $extension = strtolower($extension); if ($_FILES["file"]["size"] < 200000 && in_array($extension, $allowedExts)) { if ($_FILES["file"]["error"] > 0) { echo '<div class="error">Return Code: ' . $_FILES["file"]["error"] . "</div>"; } else { if (file_exists($filePath . "/" . $filename)) { echo '<div class="error">' . $filename . ' already exists. </div>'; } else { move_uploaded_file($_FILES["file"]["tmp_name"], $filePath . "/" . $filename); chmod($filePath . "/" . $filename, 0777); } } } else { echo '<div class="error">Invalid file</div>'; } $userFiles = array(); $files = scandir($filePath); $k = 0; foreach ($files as $file) { if ($file == '.' || $file == '..') {