Se adicionan validaciones a PMUSER. Se modifica download y upload (incompleto) para FILESMANAGER

This commit is contained in:
Freddy Daniel Rojas Valda
2014-02-17 16:13:17 -04:00
parent ce4123d4df
commit 47e77ef1c1
3 changed files with 19 additions and 18 deletions

View File

@@ -391,18 +391,12 @@ class FilesManager
$sDirectory = PATH_DATA_MAILTEMPLATES . $sProcessUID . PATH_SEP . $sfile;
break;
}
$arrayTaskUid = $this->getFileManagerUid($sDirectory);
if (!$arrayTaskUid) {
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 :
*/
$url = $sDirectory;
$sPath = '/home/daniel/downloadTest/'.$sfile;//change the path to
set_time_limit(0);
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
$ch = curl_init($sDirectory);//Here is the file we are downloading
ini_set('display_errors',true);//Just in case we get some errors, let us know
$fp = fopen ($sPath, 'w');//This is the file where we save the information
$ch = curl_init(str_replace(" ","%20",$url));
curl_setopt($ch, CURLOPT_TIMEOUT, 50);
curl_setopt($ch, CURLOPT_FILE, $fp);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);

View File

@@ -286,7 +286,7 @@ class User
$aData['USR_LASTNAME'] = $form['USR_LASTNAME'];
}
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 {
if (!filter_var($form['USR_EMAIL'], FILTER_VALIDATE_EMAIL)) {
throw new \Exception('`usr_email`. '.\G::LoadTranslation('ID_INCORRECT_EMAIL'));
@@ -313,8 +313,8 @@ class User
$aData['USR_BIRTHDAY'] = date('Y-m-d');
$aData['USR_AUTH_USER_DN'] = $form['USR_AUTH_USER_DN'];
$statusWF = $form['USR_STATUS'];
if ($form['USR_STATUS'] == '') {
throw new \Exception('`usr_status`. User status is required');
if ($form['USR_STATUS'] == '') {
throw new \Exception('invalid value specified for `usr_status`, can`t be null');
} else {
if ($form['USR_STATUS'] == 'ACTIVE' || $form['USR_STATUS'] == 'INACTIVE' || $form['USR_STATUS'] == 'VACATION') {
$aData['USR_STATUS'] = $form['USR_STATUS'];
@@ -322,8 +322,8 @@ class User
throw new \Exception('`usr_status`. Invalid value for status field.');
}
}
if ($form['USR_ROLE'] == '') {
throw new \Exception('`usr_role`. User role is required');
if ($form['USR_ROLE'] == '') {
throw new \Exception('invalid value specified for `usr_role`, can`t be null');
} else {
$oCriteria = new \Criteria('rbac');
$oCriteria->add(\RolesPeer::ROL_CODE, $form['USR_ROLE']);

View File

@@ -67,10 +67,17 @@ class FilesManager extends Api
public function doPostProcessFilesManagerUpload($prjUid)
{
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();
// $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();
$arrayData = $filesManager->uploadProcessFilesManager($prjUid, $userUid);
$arrayData = $filesManager->uploadProcessFilesManager($prjUid, $userUid);*/
//Response
$response = $arrayData;
} catch (\Exception $e) {