2015-03-12 16:28:08 -04:00
|
|
|
<html>
|
2012-11-15 13:07:06 -04:00
|
|
|
<head>
|
2012-11-16 20:13:09 +00:00
|
|
|
<title>Upload an Output Document</title>
|
2012-11-15 13:07:06 -04:00
|
|
|
<script type="text/javascript" src="../../tiny_mce_popup.js" ></script>
|
2012-11-16 20:13:09 +00:00
|
|
|
<script type="text/javascript" src="editor_plugin_src.js" ></script>
|
2012-11-15 13:07:06 -04:00
|
|
|
<base target="_self" />
|
2015-03-12 16:28:08 -04:00
|
|
|
<script type="text/javascript">
|
|
|
|
|
function validateForm()
|
|
|
|
|
{
|
|
|
|
|
var flagv = true;
|
|
|
|
|
var msgv = "";
|
|
|
|
|
|
|
|
|
|
var fileName = document.getElementById("File1").value;
|
|
|
|
|
|
|
|
|
|
if (fileName == "") {
|
|
|
|
|
flagv = false;
|
|
|
|
|
msgv = msgv + ((msgv != "")? "\n" : "") + "No file chosen";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (fileName != "" && !/\.html?$/i.test(fileName)) {
|
|
|
|
|
flagv = false;
|
|
|
|
|
msgv = msgv + ((msgv != "")? "\n" : "") + "Extension of file invalid, only allowed extensions html and htm";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (flagv) {
|
|
|
|
|
document.getElementById("containerDataForm").style.display = "none";
|
|
|
|
|
document.getElementById("containerProgressBar").style.display = "inline";
|
|
|
|
|
} else {
|
|
|
|
|
alert(msgv);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return flagv;
|
|
|
|
|
}
|
|
|
|
|
</script>
|
2012-11-15 13:07:06 -04:00
|
|
|
</head>
|
|
|
|
|
<body>
|
|
|
|
|
<?php
|
2015-03-20 17:21:22 -04:00
|
|
|
$filter = new InputFilter();
|
|
|
|
|
if(isset($_GET["q"])) {
|
|
|
|
|
$_GET["q"] = $filter->xssFilterHard($_GET["q"]);
|
|
|
|
|
$Action = $_GET["q"];
|
|
|
|
|
} else {
|
|
|
|
|
$Action = "none";
|
|
|
|
|
}
|
|
|
|
|
//$Action = isset($_GET["q"]) ? $_GET["q"] : "none";
|
2012-11-16 20:13:09 +00:00
|
|
|
if($Action =="none"){
|
2012-11-15 13:07:06 -04:00
|
|
|
displayUploadForm();
|
|
|
|
|
}else if($Action=="upload"){
|
2012-11-16 20:13:09 +00:00
|
|
|
uploadContentFile();
|
2012-11-15 13:07:06 -04:00
|
|
|
}
|
|
|
|
|
?>
|
|
|
|
|
</body>
|
|
|
|
|
</html>
|
|
|
|
|
|
|
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
// displays the upload form
|
|
|
|
|
function displayUploadForm()
|
|
|
|
|
{
|
2015-03-20 17:21:22 -04:00
|
|
|
$filter = new InputFilter();
|
|
|
|
|
if(isset($_SERVER["QUERY_STRING"])) {
|
|
|
|
|
$_SERVER["QUERY_STRING"] = $filter->xssFilterHard($_SERVER["QUERY_STRING"],'url');
|
|
|
|
|
}
|
|
|
|
|
|
2015-03-12 16:28:08 -04:00
|
|
|
$html = "
|
|
|
|
|
<div id=\"containerDataForm\">
|
|
|
|
|
<form method=\"post\" enctype=\"multipart/form-data\" action=\"uploader.php?" . $_SERVER["QUERY_STRING"] . "&q=upload\" onsubmit=\"return validateForm();\">
|
2015-06-09 14:36:43 -04:00
|
|
|
<br/>
|
2015-03-12 16:28:08 -04:00
|
|
|
File:
|
|
|
|
|
<input type=\"file\" id=\"File1\" name=\"upload_file\" /> (*.html, *.htm)
|
2015-06-09 14:36:43 -04:00
|
|
|
<br/>
|
2015-05-25 11:21:46 -04:00
|
|
|
<input type=\"submit\" name=\"Upload File\" value=\"Upload File\" style=\"border: 1px solid #1ba385; float: right; margin-top: 30px; margin-right: -4px; font-size: 10px; display: inline-block; text-decoration: none; padding: 8px 24px; -moz-border-radius: 2px; -ms-border-radius: 2px; -o-border-radius: 2px; background-color: #1fbc99; color: white;\" />
|
2015-06-09 14:36:43 -04:00
|
|
|
<input type=\"button\" onclick=\"tinyMCEPopup.close();\"name=\"Cancel\" value=\"Cancel\" style=\"border: 1px solid #e14333; float: right; margin-top: 30px; margin-right: 8px; font-size: 10px; display: inline-block; text-decoration: none; padding: 8px 24px; -moz-border-radius: 2px; -ms-border-radius: 2px; -o-border-radius: 2px; background-color: #e4655f; color: white;\" />
|
2015-03-12 16:28:08 -04:00
|
|
|
</form>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div id=\"containerProgressBar\" style=\"display: none;\">
|
|
|
|
|
Uploading... <img src=\"progress.gif\" alt=\"\" title=\"Uploading...\" />
|
|
|
|
|
</div>
|
|
|
|
|
";
|
|
|
|
|
|
|
|
|
|
echo $html;
|
2012-11-15 13:07:06 -04:00
|
|
|
}
|
|
|
|
|
// uploads the file to the destination path, and returns a link with link path substituted for destination path
|
|
|
|
|
function uploadContentFile()
|
|
|
|
|
{
|
2015-03-20 17:21:22 -04:00
|
|
|
$filter = new InputFilter();
|
|
|
|
|
$_FILES["upload_file"] = $filter->xssFilterHard($_FILES["upload_file"]);
|
|
|
|
|
|
2012-11-15 13:07:06 -04:00
|
|
|
$StatusMessage = "";
|
2012-11-16 20:13:09 +00:00
|
|
|
$ActualFileName = "";
|
|
|
|
|
$DestPath = sys_get_temp_dir();
|
|
|
|
|
$aux='';
|
2015-03-12 16:28:08 -04:00
|
|
|
$chain = preg_replace("/\r\n+|\r+|\n+|\t+/i", " ", file_get_contents($_FILES["upload_file"]["tmp_name"]));
|
2015-03-09 13:20:13 -04:00
|
|
|
$chain=preg_replace('#<head(.*?)>(.*?)</head>#is', ' ', $chain);
|
|
|
|
|
$chain=strip_tags($chain, '<address><label><canvas><option><ol><u><textarea><em><h1><h2><h3><h4><h5><h6><section><tbody><tr><th><td><hr><center><br><b><img><p><a><table><caption><thead><div><ul><li><form><input><strong><span><small><button><figure>');
|
2015-03-06 12:33:27 -04:00
|
|
|
$chain=str_replace ('"',"'",$chain);
|
|
|
|
|
updateEditorContent(trim($chain));
|
2012-11-16 20:13:09 +00:00
|
|
|
closeWindow();
|
2012-11-15 13:07:06 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function showPopUp($PopupText)
|
|
|
|
|
{
|
2017-08-02 16:06:56 -04:00
|
|
|
|
2015-03-20 17:21:22 -04:00
|
|
|
$filter = new InputFilter();
|
|
|
|
|
$PopupText = $filter->xssFilterHard($PopupText);
|
2012-11-15 13:07:06 -04:00
|
|
|
echo "<script type=\"text/javascript\" language=\"javascript\">alert (\"$PopupText\");</script>";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function updateEditorContent($serializedHTML)
|
|
|
|
|
{
|
2012-11-16 20:13:09 +00:00
|
|
|
echo "<script type=\"text/javascript\" language=\"javascript\">updateEditorContent(\"".$serializedHTML."\");</script>";
|
2012-11-15 13:07:06 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function closeWindow()
|
|
|
|
|
{
|
|
|
|
|
echo '
|
2012-11-16 20:13:09 +00:00
|
|
|
<script language="javascript" type="text/javascript">
|
2012-11-15 13:07:06 -04:00
|
|
|
closePluginPopup();
|
|
|
|
|
</script>
|
2012-11-16 20:13:09 +00:00
|
|
|
';
|
2012-11-15 13:07:06 -04:00
|
|
|
}
|
|
|
|
|
?>
|
|
|
|
|
|