Merge pull request #2219 from marcoAntonioNina/BUG-FILES

BUG-FILES Upload files templates IMPROVEMENT
This commit is contained in:
julceslauhub
2013-12-19 12:59:25 -08:00
3 changed files with 90 additions and 64 deletions

View File

@@ -498,11 +498,19 @@ try {
case 'saveFile':
global $G_PUBLISH;
$G_PUBLISH = new Publisher();
global $RBAC;
if ( $RBAC->userCanAccess('PM_FACTORY') == 1) {
G::LoadClass('processes');
$app = new Processes();
if (!$app->processExists($_REQUEST['pro_uid'])) {
echo G::LoadTranslation('ID_PROCESS_UID_NOT_DEFINED');
die;
}
$sDir = "";
if (isset($_REQUEST['MAIN_DIRECTORY'])) {
$sDir = $_REQUEST['MAIN_DIRECTORY'];
}
switch ($sDir) {
case 'mailTemplates':
$sDirectory = PATH_DATA_MAILTEMPLATES . $_REQUEST['pro_uid'] . PATH_SEP . $_REQUEST['filename'];
@@ -514,7 +522,6 @@ try {
$sDirectory = PATH_DATA_MAILTEMPLATES . $_REQUEST['pro_uid'] . PATH_SEP . $_REQUEST['filename'];
break;
}
$fp = fopen($sDirectory, 'w');
$content = stripslashes($_REQUEST['fcontent']);
$content = str_replace("@amp@", "&", $content);
@@ -522,6 +529,7 @@ try {
fwrite($fp, $content);
fclose($fp);
echo 'saved: ' . $sDirectory;
}
break;
case 'events':
$oProcessMap->eventsList($oData->pro_uid, $oData->type);

View File

@@ -1,5 +1,12 @@
<?php
global $RBAC;
if ( $RBAC->userCanAccess('PM_FACTORY') == 1) {
G::LoadClass('processes');
$app = new Processes();
if (!$app->processExists($_POST['form']['PRO_UID'])) {
echo G::LoadTranslation('ID_PROCESS_UID_NOT_DEFINED');
die;
}
switch ($_POST['form']['MAIN_DIRECTORY']) {
case 'mailTemplates':
$sDirectory = PATH_DATA_MAILTEMPLATES . $_POST['form']['PRO_UID'] . PATH_SEP . ($_POST['form']['CURRENT_DIRECTORY'] != '' ? $_POST['form']['CURRENT_DIRECTORY'] . PATH_SEP : '');
@@ -16,4 +23,5 @@ for ($i = 1; $i <= 5; $i ++) {
G::uploadFile( $_FILES['form']['tmp_name']['FILENAME' . (string) $i], $sDirectory, $_FILES['form']['name']['FILENAME' . (string) $i] );
}
}
}
die( '<script type="text/javascript">parent.goToDirectoryforie(\'' . $_POST['form']['PRO_UID'] . '\', \'' . $_POST['form']['MAIN_DIRECTORY'] . '\', \'' . $_POST['form']['CURRENT_DIRECTORY'] . '\');</script>' );

View File

@@ -1,8 +1,17 @@
<?php
sleep( 1 );
global $RBAC;
if ( $RBAC->userCanAccess('PM_FACTORY') == 1) {
if (isset( $_SESSION['processes_upload'] )) {
$form = $_SESSION['processes_upload'];
G::LoadClass('processes');
$app = new Processes();
if (!$app->processExists($form['PRO_UID'])) {
$result = 0;
$msg = G::LoadTranslation('ID_PROCESS_UID_NOT_DEFINED');
echo "{'result': $result, 'msg':'$msg'}";
die;
}
switch ($form['MAIN_DIRECTORY']) {
case 'mailTemplates':
$sDirectory = PATH_DATA_MAILTEMPLATES . $form['PRO_UID'] . PATH_SEP . ($form['CURRENT_DIRECTORY'] != '' ? $form['CURRENT_DIRECTORY'] . PATH_SEP : '');
@@ -27,3 +36,4 @@ if ($_FILES['form']['error'] == "0") {
}
echo "{'result': $result, 'msg':'$msg'}";
}