|
|
@@ -25,9 +25,14 @@ switch ($_GET['action']) {
|
|
|
|
|
|
function pass_contents($content)
|
|
|
{
|
|
|
+ if (trim($content) == '') {
|
|
|
+ show_form(); print("<span id='msg' style='font-size:9px;color: red;'>Error occured. Please try to upload again</span>");
|
|
|
+ return;
|
|
|
+ }
|
|
|
$type = $_GET['type'];
|
|
|
print <<<JS
|
|
|
- <script type="text/javascript">parent.App.Pages.WEB_DOMAIN.setSSL('{$contents}', '{$type}');</script>
|
|
|
+ <textarea id="result" style="display: none;">{$content}</textarea>
|
|
|
+ <script type="text/javascript">parent.App.Pages.WEB_DOMAIN.setSSL('{$type}', this);</script>
|
|
|
JS;
|
|
|
}
|
|
|
|
|
|
@@ -35,29 +40,17 @@ function handleUpload()
|
|
|
{
|
|
|
if ($_FILES["upload-ssl"]["size"] < 20000) {
|
|
|
if ($_FILES["upload-ssl"]["error"] > 0) {
|
|
|
- return show_form() . "Error occured. Please try to upload again";
|
|
|
+ show_form(); print("<span id='msg' style='font-size:9px;color: red;'>Error occured. Please try to upload again</span>");
|
|
|
+ return;
|
|
|
}
|
|
|
else {
|
|
|
- /*echo "Upload: " . $_FILES["file"]["name"] . "<br />";
|
|
|
- echo "Type: " . $_FILES["file"]["type"] . "<br />";
|
|
|
- echo "Size: " . ($_FILES["file"]["size"] / 1024) . " Kb<br />";
|
|
|
- echo "Temp file: " . $_FILES["file"]["tmp_name"] . "<br />";*/
|
|
|
-
|
|
|
$contents = file_get_contents($_FILES["upload-ssl"]['tmp_name']);
|
|
|
return show_form().pass_contents($contents);
|
|
|
-
|
|
|
- /*if (file_exists("upload/" . $_FILES["file"]["name"])) {
|
|
|
- echo $_FILES["file"]["name"] . " already exists. ";
|
|
|
- }
|
|
|
- else {
|
|
|
- move_uploaded_file($_FILES["file"]["tmp_name"],
|
|
|
- "upload/" . $_FILES["file"]["name"]);
|
|
|
- echo "Stored in: " . "upload/" . $_FILES["file"]["name"];
|
|
|
- }*/
|
|
|
}
|
|
|
}
|
|
|
else {
|
|
|
- return show_form() . "Filesize is too large. Please ensure you are uploading correct file";
|
|
|
+ show_form(); print("<span id='msg' style='font-size:9px;color: red;'>Filesize is too large. Please ensure you are uploading correct file</span>");
|
|
|
+ return;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -71,7 +64,29 @@ function show_form()
|
|
|
}
|
|
|
|
|
|
print <<<HTML
|
|
|
- <form action="" method="post" enctype="multipart/form-data"><input type="hidden" value="true" name="process"><input type="file" name="upload-ssl" onChange="document.forms[0].submit()"/></form>
|
|
|
+ <script type="text/javascript">
|
|
|
+ function upload()
|
|
|
+ {
|
|
|
+ var l_dot = '';
|
|
|
+ document.getElementById('form-upl').style.display = 'none';
|
|
|
+ try {
|
|
|
+ document.getElementById('msg').style.display = 'none';
|
|
|
+ } catch(e){};
|
|
|
+ document.getElementById('form-loading').style.display = 'block';
|
|
|
+ setInterval(function(){
|
|
|
+ if (l_dot == '...') {
|
|
|
+ l_dot = '';
|
|
|
+ }
|
|
|
+ l_dot += '.';
|
|
|
+ document.getElementById('form-loading').innerHTML = 'Processing'+l_dot;
|
|
|
+ }, 500);
|
|
|
+ setTimeout(function() {
|
|
|
+ document.forms[0].submit();
|
|
|
+ }, 1000);
|
|
|
+ }
|
|
|
+ </script>
|
|
|
+ <p id="form-loading" style="font-size:11px;color:#333;"></p>
|
|
|
+ <form id="form-upl" action="" method="post" style="padding:0;margin:0" enctype="multipart/form-data"><input type="hidden" value="true" name="process"><input type="file" name="upload-ssl" onChange="upload();"/></form>
|
|
|
HTML;
|
|
|
}
|
|
|
|