HOR-2783
This commit is contained in:
@@ -1,19 +1,20 @@
|
|||||||
<?php
|
<?php
|
||||||
sleep( 1 );
|
|
||||||
global $RBAC;
|
sleep(1);
|
||||||
if ( $RBAC->userCanAccess('PM_FACTORY') == 1) {
|
global $RBAC;
|
||||||
if (isset( $_SESSION['processes_upload'] )) {
|
if ($RBAC->userCanAccess('PM_FACTORY') == 1) {
|
||||||
$form = $_SESSION['processes_upload'];
|
if (isset($_SESSION['processes_upload'])) {
|
||||||
G::LoadClass('processes');
|
$form = $_SESSION['processes_upload'];
|
||||||
$app = new Processes();
|
G::LoadClass('processes');
|
||||||
if (!$app->processExists($form['PRO_UID'])) {
|
$app = new Processes();
|
||||||
$result = 0;
|
if (!$app->processExists($form['PRO_UID'])) {
|
||||||
$msg = G::LoadTranslation('ID_PROCESS_UID_NOT_DEFINED');
|
$result = 0;
|
||||||
echo "{'result': $result, 'msg':'$msg'}";
|
$msg = G::LoadTranslation('ID_PROCESS_UID_NOT_DEFINED');
|
||||||
die;
|
echo "{'result': $result, 'msg':'$msg'}";
|
||||||
}
|
die;
|
||||||
|
}
|
||||||
switch ($form['MAIN_DIRECTORY']) {
|
switch ($form['MAIN_DIRECTORY']) {
|
||||||
case 'mailTemplates':
|
case 'mailTemplates':
|
||||||
$sDirectory = PATH_DATA_MAILTEMPLATES . $form['PRO_UID'] . PATH_SEP . ($form['CURRENT_DIRECTORY'] != '' ? $form['CURRENT_DIRECTORY'] . PATH_SEP : '');
|
$sDirectory = PATH_DATA_MAILTEMPLATES . $form['PRO_UID'] . PATH_SEP . ($form['CURRENT_DIRECTORY'] != '' ? $form['CURRENT_DIRECTORY'] . PATH_SEP : '');
|
||||||
break;
|
break;
|
||||||
case 'public':
|
case 'public':
|
||||||
@@ -22,18 +23,29 @@ if ( $RBAC->userCanAccess('PM_FACTORY') == 1) {
|
|||||||
default:
|
default:
|
||||||
die();
|
die();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($_FILES['form']['error'] == "0") {
|
$fileName = $_FILES['form']['name'];
|
||||||
G::uploadFile( $_FILES['form']['tmp_name'], $sDirectory, $_FILES['form']['name'] );
|
$canUploadPhpFile = true;
|
||||||
$msg = "Uploaded (" . (round( (filesize( $sDirectory . $_FILES['form']['name'] ) / 1024) * 10 ) / 10) . " kb)";
|
$extension = pathinfo($fileName, PATHINFO_EXTENSION);
|
||||||
|
if (\Bootstrap::getDisablePhpUploadExecution() === 1 && $extension === 'php') {
|
||||||
|
$message = \G::LoadTranslation('THE_UPLOAD_OF_PHP_FILES_WAS_DISABLED');
|
||||||
|
\Bootstrap::registerMonologPhpUploadExecution('phpUpload', 550, $message, $fileName);
|
||||||
|
$canUploadPhpFile = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($_FILES['form']['error'] == "0" && $canUploadPhpFile) {
|
||||||
|
G::uploadFile($_FILES['form']['tmp_name'], $sDirectory, $fileName);
|
||||||
|
$msg = "Uploaded (" . (round((filesize($sDirectory . $fileName) / 1024) * 10) / 10) . " kb)";
|
||||||
$result = 1;
|
$result = 1;
|
||||||
//echo $sDirectory.$_FILES['form']['name'];
|
|
||||||
} else {
|
} else {
|
||||||
$msg = "Failed";
|
$msg = "Failed";
|
||||||
|
if ($canUploadPhpFile === false) {
|
||||||
|
$msg = $message;
|
||||||
|
}
|
||||||
$result = 0;
|
$result = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
echo "{'result': $result, 'msg':'$msg'}";
|
echo "{'result': $result, 'msg':'$msg'}";
|
||||||
}
|
}
|
||||||
@@ -1,123 +1,96 @@
|
|||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<style>
|
<style>
|
||||||
li {list-style-type: none;margin: 2; padding: 0; }
|
li {list-style-type: none;margin: 2; padding: 0; }
|
||||||
body{
|
body{
|
||||||
background:#fff;
|
background:#fff;
|
||||||
}
|
|
||||||
#uxfiles{
|
|
||||||
font-size:10px;border-width: 1px; border-style: solid; border-color: #000;
|
|
||||||
padding:2px;
|
|
||||||
padding-left:4px;
|
|
||||||
padding-right:4px;
|
|
||||||
width:284px;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
<script src="/js/jquery/jquery-1.3.2.min.js" type="text/javascript"></script>
|
|
||||||
<script src="/js/jquery/jquery-ui-1.7.2.custom.min.js" type="text/javascript"></script>
|
|
||||||
<script type="text/javascript" src="/js/jquery/ajaxupload.3.6.js"></script>
|
|
||||||
|
|
||||||
<script type= "text/javascript">
|
|
||||||
|
|
||||||
var cClient = window.parent.getBrowserClient();
|
|
||||||
|
|
||||||
$(document).ready(function(){
|
|
||||||
|
|
||||||
/* example 1 */
|
|
||||||
var button = $('#button1'), interval;
|
|
||||||
new AjaxUpload(button,{
|
|
||||||
action: 'processes_doUpload', // I disabled uploads in this example for security reasons
|
|
||||||
//action: 'upload.htm',
|
|
||||||
name: 'form',
|
|
||||||
onSubmit : function(file, ext){
|
|
||||||
|
|
||||||
if(cClient.browser != 'msie'){
|
|
||||||
$("#uxmsg").html('Uploading...');
|
|
||||||
$("#uxmsg").fadeIn(2000);
|
|
||||||
//this.disable();
|
|
||||||
$('#button1').attr('disabled',true);
|
|
||||||
} else {
|
|
||||||
// document.getElementById("uxfiles").style.display = 'block';
|
|
||||||
//$("#uxmsg").html('Uploading....');
|
|
||||||
document.getElementById("uxfiles").innerHTML = 'Uploading...';
|
|
||||||
//document.getElementById("uxfiles").style.display = 'block';
|
|
||||||
}
|
}
|
||||||
|
#uxfiles{
|
||||||
if(cClient.browser != 'msie'){
|
font-size:10px;border-width: 1px; border-style: solid; border-color: #000;
|
||||||
interval = window.setInterval(function(){
|
padding:2px;
|
||||||
|
padding-left:4px;
|
||||||
var text = button.text();
|
padding-right:4px;
|
||||||
if (text.length < 13){
|
width:284px;
|
||||||
button.text(text + '.');
|
|
||||||
} else {
|
|
||||||
button.text('Uploading');
|
|
||||||
}
|
|
||||||
|
|
||||||
}, 200);
|
|
||||||
}
|
}
|
||||||
|
</style>
|
||||||
},
|
<script src="/js/jquery/jquery-1.3.2.min.js" type="text/javascript"></script>
|
||||||
onComplete: function(file, response){
|
<script src="/js/jquery/jquery-ui-1.7.2.custom.min.js" type="text/javascript"></script>
|
||||||
|
<script type="text/javascript" src="/js/jquery/ajaxupload.3.6.js"></script>
|
||||||
parent.xReaload();
|
<script type= "text/javascript">
|
||||||
|
var cClient = window.parent.getBrowserClient();
|
||||||
if(file.length>24) file = file.substr(0,24) + '..';
|
$(document).ready(function () {
|
||||||
|
var button = $('#button1'), interval;
|
||||||
resp = eval("("+response+")");
|
new AjaxUpload(button, {
|
||||||
xcolor = resp.result? 'green': red;
|
action: 'processes_doUpload', // I disabled uploads in this example for security reasons
|
||||||
if(cClient.browser != 'msie'){
|
name: 'form',
|
||||||
$("#uxmsg").fadeOut(1500, function(){
|
onSubmit: function (file, ext) {
|
||||||
$("#uxmsg").fadeIn(1100);
|
if (cClient.browser != 'msie') {
|
||||||
$("#uxmsg").html('<font color=black>'+file+'</font> <font color='+xcolor+'>'+resp.msg+'<font>');
|
$("#uxmsg").html('Uploading...');
|
||||||
});
|
$("#uxmsg").fadeIn(2000);
|
||||||
|
$('#button1').attr('disabled', true);
|
||||||
|
} else {
|
||||||
|
document.getElementById("uxfiles").innerHTML = 'Uploading...';
|
||||||
|
}
|
||||||
|
if (cClient.browser != 'msie') {
|
||||||
|
interval = window.setInterval(function () {
|
||||||
|
var text = button.text();
|
||||||
|
if (text.length < 13) {
|
||||||
|
button.text(text + '.');
|
||||||
|
} else {
|
||||||
|
button.text('Uploading');
|
||||||
|
}
|
||||||
|
}, 200);
|
||||||
|
}
|
||||||
|
|
||||||
|
},
|
||||||
|
onComplete: function (file, response) {
|
||||||
|
parent.xReaload();
|
||||||
|
if (file.length > 24) {
|
||||||
|
file = file.substr(0, 24) + '..';
|
||||||
|
}
|
||||||
|
resp = eval("(" + response + ")");
|
||||||
|
xcolor = resp.result ? 'green' : 'red';
|
||||||
|
if (cClient.browser != 'msie') {
|
||||||
|
$("#uxmsg").fadeOut(1500, function () {
|
||||||
|
$("#uxmsg").fadeIn(1100);
|
||||||
|
$("#uxmsg").html('<font color=black>' + file + '</font> <font color=' + xcolor + '>' + resp.msg + '<font>');
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
document.getElementById("uxfiles").innerHTML = '<font color=black>' + file + '</font> <font color=' + xcolor + '>' + resp.msg + '<font>';
|
||||||
|
}
|
||||||
|
button.text('Upload++');
|
||||||
|
window.clearInterval(interval);
|
||||||
|
document.getElementById('button1').disabled = false;
|
||||||
|
$('#button1').attr('disabled', false);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
var xclear = function () {
|
||||||
|
if (cClient.browser != 'msie') {
|
||||||
|
$("#uxmsg").fadeOut(1500);
|
||||||
} else {
|
} else {
|
||||||
document.getElementById("uxfiles").innerHTML = '<font color=black>'+file+'</font> <font color='+xcolor+'>'+resp.msg+'<font>';
|
$("#uxfiles").html('');
|
||||||
// document.getElementById("uxfiles").style.display = 'block';
|
|
||||||
}
|
}
|
||||||
button.text('Upload++');
|
}
|
||||||
window.clearInterval(interval);
|
</script>
|
||||||
|
</head>
|
||||||
document.getElementById('button1').disabled = false;
|
<body>
|
||||||
$('#button1').attr('disabled',false);
|
<table width="99%">
|
||||||
//alert(document.getElementById('button1').id);
|
<tbody>
|
||||||
//parent.xReaload();
|
<tr>
|
||||||
//setTimeout('xclear()', 4000);
|
<td valign="top">
|
||||||
}
|
<li id="e" class="e">
|
||||||
});
|
<div class="wrapper">
|
||||||
|
<table><tr>
|
||||||
|
<td><input type="button" id="button1" class="button" value="Browse"/></td>
|
||||||
|
<td><div id="uxfiles"> <span id="uxmsg" style="display:none">Select your file</span></div> </td>
|
||||||
|
</tr></table>
|
||||||
});
|
</div>
|
||||||
|
</li>
|
||||||
var xclear = function(){
|
</td>
|
||||||
if(cClient.browser != 'msie'){
|
</tr>
|
||||||
$("#uxmsg").fadeOut(1500);
|
</tbody>
|
||||||
} else {
|
</table>
|
||||||
$("#uxfiles").html('');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
</script>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<table width="99%">
|
|
||||||
<tbody>
|
|
||||||
<tr>
|
|
||||||
<td valign="top">
|
|
||||||
<li id="e" class="e">
|
|
||||||
<div class="wrapper">
|
|
||||||
<table><tr>
|
|
||||||
<td><input type="button" id="button1" class="button" value="Browse"/></td>
|
|
||||||
<td><div id="uxfiles"> <span id="uxmsg" style="display:none">Select your file</span></div> </td>
|
|
||||||
</tr></table>
|
|
||||||
</div>
|
|
||||||
</li>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
|
|||||||
Reference in New Issue
Block a user