Se adicionan validaciones a PMUSER. Se modifica download y upload (incompleto) para FILESMANAGER
This commit is contained in:
@@ -391,18 +391,12 @@ class FilesManager
|
|||||||
$sDirectory = PATH_DATA_MAILTEMPLATES . $sProcessUID . PATH_SEP . $sfile;
|
$sDirectory = PATH_DATA_MAILTEMPLATES . $sProcessUID . PATH_SEP . $sfile;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
$arrayTaskUid = $this->getFileManagerUid($sDirectory);
|
$url = $sDirectory;
|
||||||
if (!$arrayTaskUid) {
|
$sPath = '/home/daniel/downloadTest/'.$sfile;//change the path to
|
||||||
throw (new \Exception( 'invalid value specified for `path`.'));
|
|
||||||
}
|
|
||||||
/*
|
|
||||||
This is usefull when you are downloading big files, as it
|
|
||||||
will prevent time out of the script :
|
|
||||||
*/
|
|
||||||
set_time_limit(0);
|
set_time_limit(0);
|
||||||
ini_set('display_errors',true);//Just in case we get some errors, let us know....
|
ini_set('display_errors',true);//Just in case we get some errors, let us know
|
||||||
$fp = fopen ($sDirectory, 'w+');//This is the file where we save the information
|
$fp = fopen ($sPath, 'w');//This is the file where we save the information
|
||||||
$ch = curl_init($sDirectory);//Here is the file we are downloading
|
$ch = curl_init(str_replace(" ","%20",$url));
|
||||||
curl_setopt($ch, CURLOPT_TIMEOUT, 50);
|
curl_setopt($ch, CURLOPT_TIMEOUT, 50);
|
||||||
curl_setopt($ch, CURLOPT_FILE, $fp);
|
curl_setopt($ch, CURLOPT_FILE, $fp);
|
||||||
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
|
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
|
||||||
|
|||||||
@@ -286,7 +286,7 @@ class User
|
|||||||
$aData['USR_LASTNAME'] = $form['USR_LASTNAME'];
|
$aData['USR_LASTNAME'] = $form['USR_LASTNAME'];
|
||||||
}
|
}
|
||||||
if ($form['USR_EMAIL'] == '') {
|
if ($form['USR_EMAIL'] == '') {
|
||||||
throw new \Exception('`usr_email`. E-mail is required');
|
throw new \Exception('invalid value specified for `usr_email`, can`t be null.');
|
||||||
} else {
|
} else {
|
||||||
if (!filter_var($form['USR_EMAIL'], FILTER_VALIDATE_EMAIL)) {
|
if (!filter_var($form['USR_EMAIL'], FILTER_VALIDATE_EMAIL)) {
|
||||||
throw new \Exception('`usr_email`. '.\G::LoadTranslation('ID_INCORRECT_EMAIL'));
|
throw new \Exception('`usr_email`. '.\G::LoadTranslation('ID_INCORRECT_EMAIL'));
|
||||||
@@ -314,7 +314,7 @@ class User
|
|||||||
$aData['USR_AUTH_USER_DN'] = $form['USR_AUTH_USER_DN'];
|
$aData['USR_AUTH_USER_DN'] = $form['USR_AUTH_USER_DN'];
|
||||||
$statusWF = $form['USR_STATUS'];
|
$statusWF = $form['USR_STATUS'];
|
||||||
if ($form['USR_STATUS'] == '') {
|
if ($form['USR_STATUS'] == '') {
|
||||||
throw new \Exception('`usr_status`. User status is required');
|
throw new \Exception('invalid value specified for `usr_status`, can`t be null');
|
||||||
} else {
|
} else {
|
||||||
if ($form['USR_STATUS'] == 'ACTIVE' || $form['USR_STATUS'] == 'INACTIVE' || $form['USR_STATUS'] == 'VACATION') {
|
if ($form['USR_STATUS'] == 'ACTIVE' || $form['USR_STATUS'] == 'INACTIVE' || $form['USR_STATUS'] == 'VACATION') {
|
||||||
$aData['USR_STATUS'] = $form['USR_STATUS'];
|
$aData['USR_STATUS'] = $form['USR_STATUS'];
|
||||||
@@ -323,7 +323,7 @@ class User
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ($form['USR_ROLE'] == '') {
|
if ($form['USR_ROLE'] == '') {
|
||||||
throw new \Exception('`usr_role`. User role is required');
|
throw new \Exception('invalid value specified for `usr_role`, can`t be null');
|
||||||
} else {
|
} else {
|
||||||
$oCriteria = new \Criteria('rbac');
|
$oCriteria = new \Criteria('rbac');
|
||||||
$oCriteria->add(\RolesPeer::ROL_CODE, $form['USR_ROLE']);
|
$oCriteria->add(\RolesPeer::ROL_CODE, $form['USR_ROLE']);
|
||||||
|
|||||||
@@ -67,10 +67,17 @@ class FilesManager extends Api
|
|||||||
public function doPostProcessFilesManagerUpload($prjUid)
|
public function doPostProcessFilesManagerUpload($prjUid)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
//echo $request_data; die();
|
require_once (PATH_TRUNK . "workflow" . PATH_SEP . "engine" . PATH_SEP . "src" . PATH_SEP . "Extension" . PATH_SEP . "Restler" . PATH_SEP . "UploadFormat.php");
|
||||||
|
// $objCurlFileUploader = new CurlFileUploader("D:\\Program Files\\Apache\\htdocs\\test.txt", "http://localhost/fileUploaderTest.php",'file1');
|
||||||
|
// $objCurlFileUploader->UploadFile();
|
||||||
|
|
||||||
$userUid = $this->getUserId();
|
$userUid = $this->getUserId();
|
||||||
|
// $objCurlFileUploader = new CurlFileUploader("D:\\Program Files\\Apache\\htdocs\\test.txt", "http://localhost/fileUploaderTest.php",'file1');
|
||||||
|
$filesManager = new \Extension\Restler\UploadFormat("/home/daniel/info.txt", "http://daniel.pmos.colosa.net/api/1.0/daniel/project/1265557095225ff5c688f46031700471/process-file-manager/upload",'file1');
|
||||||
|
$filesManager->UploadFormat();
|
||||||
|
/*
|
||||||
$filesManager = new \BusinessModel\FilesManager();
|
$filesManager = new \BusinessModel\FilesManager();
|
||||||
$arrayData = $filesManager->uploadProcessFilesManager($prjUid, $userUid);
|
$arrayData = $filesManager->uploadProcessFilesManager($prjUid, $userUid);*/
|
||||||
//Response
|
//Response
|
||||||
$response = $arrayData;
|
$response = $arrayData;
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
|
|||||||
Reference in New Issue
Block a user