diff --git a/.gitignore b/.gitignore index 5ff8889122f6b8c8d2fc37741a290e44ca0ed48f..5b50eef7f1e889e05590c55e2db6bdfe683f9940 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,5 @@ apps/maarch_entreprise/xml/log4php.xml .vscode/ .phplint-cache .phplint.yml +fonctionnel.log +technique.log diff --git a/core/Controllers/DocserverController.php b/core/Controllers/DocserverController.php index 7b0fbcb3d724daf670511c967272f311b35ea308..bbb638e343670149f918aced74969308743509be 100644 --- a/core/Controllers/DocserverController.php +++ b/core/Controllers/DocserverController.php @@ -22,7 +22,6 @@ use Core\Models\DocserverModel; class DocserverController { - public function getList(RequestInterface $request, ResponseInterface $response) { $obj = DocserverModel::getList(); @@ -42,7 +41,6 @@ class DocserverController 'id' => $id ]); } else { - return $response ->withStatus(500) ->withJson(['errors' => _ID . ' ' . _IS_EMPTY]); @@ -62,7 +60,6 @@ class DocserverController $errors = $this->control($request, 'create'); if (!empty($errors)) { - return $response ->withStatus(500) ->withJson(['errors' => $errors]); @@ -78,7 +75,6 @@ class DocserverController 'id' => $id ]); } else { - return $response ->withStatus(500) ->withJson(['errors' => _NOT_CREATE]); @@ -98,7 +94,6 @@ class DocserverController $errors = $this->control($request, 'update'); if (!empty($errors)) { - return $response ->withStatus(500) ->withJson(['errors' => $errors]); @@ -114,7 +109,6 @@ class DocserverController 'id' => $id ]); } else { - return $response ->withStatus(500) ->withJson(['errors' => _NOT_UPDATE]); @@ -135,7 +129,6 @@ class DocserverController 'id' => $id ]); } else { - return $response ->withStatus(500) ->withJson(['errors' => _NOT_DELETE]); @@ -152,13 +145,13 @@ class DocserverController { $errors = []; - if($mode == 'update') { + if ($mode == 'update') { $obj = DocserverModel::getById([ 'id' => $request->getParam('id') ]); if (empty($obj)) { array_push( - $errors, + $errors, _ID . ' ' . $request->getParam('id') . ' ' . _NOT_EXISTS ); } @@ -166,13 +159,13 @@ class DocserverController if (!Validator::notEmpty()->validate($request->getParam('id'))) { array_push($errors, _ID . ' ' . _IS_EMPTY); - } elseif($mode == 'create') { + } elseif ($mode == 'create') { $obj = DocserverModel::getById([ 'id' => $request->getParam('id') ]); if (!empty($obj)) { array_push( - $errors, + $errors, _ID . ' ' . $obj[0]['id'] . ' ' . _ALREADY_EXISTS ); } @@ -182,12 +175,12 @@ class DocserverController array_push($errors, _ID . ' ' . _NOT . ' ' . _VALID); } - if (!Validator::notEmpty()->validate($request->getParam('label_status'))) { + if (!Validator::notEmpty() + ->validate($request->getParam('label_status'))) { array_push($errors, _LABEL_STATUS . ' ' . _IS_EMPTY); } - if ( - Validator::notEmpty() + if (Validator::notEmpty() ->validate($request->getParam('is_system')) && !Validator::contains('Y') ->validate($request->getParam('is_system')) && @@ -197,8 +190,7 @@ class DocserverController array_push($errors, _IS_SYSTEM . ' ' . _NOT . ' ' . _VALID); } - if ( - Validator::notEmpty() + if (Validator::notEmpty() ->validate($request->getParam('is_folder_status')) && !Validator::contains('Y') ->validate($request->getParam('is_folder_status')) && @@ -208,8 +200,7 @@ class DocserverController array_push($errors, _IS_FOLDER_STATUS . ' ' . _NOT . ' ' . _VALID); } - if ( - Validator::notEmpty() + if (Validator::notEmpty() ->validate($request->getParam('img_filename')) && (!Validator::regex('/^[\w-.]+$/') ->validate($request->getParam('img_filename')) || @@ -219,8 +210,7 @@ class DocserverController array_push($errors, _IMG_FILENAME . ' ' . _NOT . ' ' . _VALID); } - if ( - Validator::notEmpty() + if (Validator::notEmpty() ->validate($request->getParam('maarch_module')) && !Validator::length(null, 255) ->validate($request->getParam('maarch_module')) @@ -228,8 +218,7 @@ class DocserverController array_push($errors, _MAARCH_MODULE . ' ' . _NOT . ' ' . _VALID); } - if ( - Validator::notEmpty() + if (Validator::notEmpty() ->validate($request->getParam('can_be_searched')) && !Validator::contains('Y') ->validate($request->getParam('can_be_searched')) && @@ -239,8 +228,7 @@ class DocserverController array_push($errors, _CAN_BE_SEARCHED . ' ' . _NOT . ' ' . _VALID); } - if ( - Validator::notEmpty() + if (Validator::notEmpty() ->validate($request->getParam('can_be_modified')) && !Validator::contains('Y') ->validate($request->getParam('can_be_modified')) && @@ -267,7 +255,6 @@ class DocserverController 'collId' => $collId ]); } else { - return ['errors' => 'collId ' . _EMPTY]; } @@ -286,7 +273,6 @@ class DocserverController */ public function checkSize($aArgs) { - $newDsSize = $aArgs['docserver']['actual_size_number'] + $aArgs['filesize']; if (empty($aArgs['docserver']['actual_size_number'])) { @@ -305,8 +291,7 @@ class DocserverController return $datas; } - if ( - $aArgs['docserver']['size_limit_number'] > 0 && + if ($aArgs['docserver']['size_limit_number'] > 0 && $newDsSize >= $aArgs['docserver']['size_limit_number'] ) { $datas = [ @@ -329,12 +314,10 @@ class DocserverController public function setSize($aArgs) { if (empty($aArgs['docserver_id'])) { - return ['errors' => 'docserver_id ' . _EMPTY]; } if (empty($aArgs['actual_size_number'])) { - return ['errors' => 'actual_size_number ' . _EMPTY]; } @@ -394,7 +377,7 @@ class DocserverController $nbFiles = count($fileTab); //Docserver is empty - if ($nbFiles == 0 ) { + if ($nbFiles == 0) { //Creates the directory if (!mkdir($pathOnDocserver . '0001', 0770)) { $datas = [ @@ -437,11 +420,12 @@ class DocserverController array_shift($fileTabBis); $nbFilesBis = count($fileTabBis); //If number of files => 1000 then creates a new subdirectory - if ($nbFilesBis >= 1000 ) { + if ($nbFilesBis >= 1000) { $newDir = ($nbFiles) + 1; if (!mkdir( $pathOnDocserver - . str_pad($newDir, 4, '0', STR_PAD_LEFT), 0770 + . str_pad($newDir, 4, '0', STR_PAD_LEFT), + 0770 ) ) { $datas = [ @@ -475,7 +459,7 @@ class DocserverController //Docserver contains less than 1000 files $newFileName = $nbFilesBis + 1; $greater = $newFileName; - for ($n = 0;$n < count($fileTabBis);$n++) { + for ($n = 0; $n < count($fileTabBis); $n++) { $currentFileName = array(); $currentFileName = explode('.', $fileTabBis[$n]); if ((int) $greater <= (int) $currentFileName[0]) { @@ -512,42 +496,35 @@ class DocserverController public function storeResourceOnDocserver($aArgs) { if (empty($aArgs['collId'])) { - return ['errors' => 'collId ' . _EMPTY]; } if (empty($aArgs['fileInfos'])) { - return ['errors' => 'fileInfos ' . _EMPTY]; } if (empty($aArgs['fileInfos']['tmpDir'])) { - return ['errors' => 'fileInfos.tmpDir ' . _EMPTY]; } if (empty($aArgs['fileInfos']['size'])) { - return ['errors' => 'fileInfos.size ' . _EMPTY]; } if (empty($aArgs['fileInfos']['format'])) { - return ['errors' => 'fileInfos.format ' . _EMPTY]; } if (empty($aArgs['fileInfos']['tmpFileName'])) { - return ['errors' => 'fileInfos.tmpFileName ' . _EMPTY]; } if (!is_dir($aArgs['fileInfos']['tmpDir'])) { - return ['errors' => 'fileInfos.tmpDir ' . _NOT_EXISTS]; } - if (!file_exists($aArgs['fileInfos']['tmpDir'] . $aArgs['fileInfos']['tmpFileName'])) { - + if (!file_exists($aArgs['fileInfos']['tmpDir'] + . $aArgs['fileInfos']['tmpFileName'])) { return ['errors' => 'fileInfos.tmpDir fileInfos.tmpFileName' . _NOT_EXISTS]; } @@ -564,25 +541,23 @@ class DocserverController $tmpSourceCopy = ''; if (empty($docserver)) { - return [ 'errors' => _DOCSERVER_ERROR . ' : ' - . _NO_AVAILABLE_DOCSERVER . ' . ' . _MORE_INFOS + . _NO_AVAILABLE_DOCSERVER . ' . ' . _MORE_INFOS ]; } $newSize = $this->checkSize( [ - 'docserver' => $docserver, + 'docserver' => $docserver, 'filesize' => $size, ] ); if ($newSize['newDsSize'] == 0) { - return [ 'errors' => _DOCSERVER_ERROR . ' : ' - . _NOT_ENOUGH_DISK_SPACE . ' . ' . _MORE_INFOS + . _NOT_ENOUGH_DISK_SPACE . ' . ' . _MORE_INFOS ]; } @@ -613,7 +588,6 @@ class DocserverController ); if ($docinfo['errors'] <> '') { - return ['errors' => _FILE_SEND_ERROR]; } @@ -639,7 +613,6 @@ class DocserverController ); if (isset($copyResult['errors']) && $copyResult['errors'] <> '') { - return ['errors' => $copyResult['errors']]; } @@ -659,7 +632,7 @@ class DocserverController $this->setSize( [ - 'docserver_id' => $docserver['docserver_id'], + 'docserver_id' => $docserver['docserver_id'], 'actual_size_number' => $newSize['newDsSize'] ] ); @@ -673,5 +646,4 @@ class DocserverController return $datas; } - -} \ No newline at end of file +} diff --git a/core/Controllers/DocserverToolsController.php b/core/Controllers/DocserverToolsController.php index 4a00964605e77c18aae8546ea86416501d55a02d..a8b05ea723d0388b746004476b55a3ff5b1b8d40 100644 --- a/core/Controllers/DocserverToolsController.php +++ b/core/Controllers/DocserverToolsController.php @@ -72,7 +72,7 @@ class DocserverToolsController } if (isset($GLOBALS['wb']) && $GLOBALS['wb'] <> '') { $path = $pathOnDocserver . date('Y') . DIRECTORY_SEPARATOR.date('m') - . DIRECTORY_SEPARATOR . 'BATCH' . DIRECTORY_SEPARATOR + . DIRECTORY_SEPARATOR . 'BATCH' . DIRECTORY_SEPARATOR . $GLOBALS['wb'] . DIRECTORY_SEPARATOR; if (!is_dir($path)) { mkdir($path, 0770, true); @@ -89,9 +89,9 @@ class DocserverToolsController . DIRECTORY_SEPARATOR; } - $datas = + $datas = [ - 'createPathOnDocServer' => + 'createPathOnDocServer' => [ 'destinationDir' => $path ] @@ -123,15 +123,13 @@ class DocserverToolsController return $datas; } - if ( - DIRECTORY_SEPARATOR == '/' + if (DIRECTORY_SEPARATOR == '/' && (isset($GLOBALS['apacheUserAndGroup']) && $GLOBALS['apacheUserAndGroup'] <> '') ) { - exec('chown ' - . escapeshellarg($GLOBALS['apacheUserAndGroup']) . ' ' - . escapeshellarg($aArgs['path']) - ); + exec('chown ' + . escapeshellarg($GLOBALS['apacheUserAndGroup']) . ' ' + . escapeshellarg($aArgs['path'])); } umask(0022); @@ -172,7 +170,7 @@ class DocserverToolsController if (file_exists(($aArgs['destinationDir'] . $aArgs['fileDestinationName']))) { $datas = [ - 'errors' => '' . $aArgs['destinationDir'] + 'errors' => '' . $aArgs['destinationDir'] . $aArgs['fileDestinationName'] . ' ' . _FILE_ALREADY_EXISTS, ]; @@ -211,7 +209,7 @@ class DocserverToolsController $this->setRights($aArgs); } - if(!copy($sourceFilePath, $destinationDir . $fileDestinationName)) { + if (!copy($sourceFilePath, $destinationDir . $fileDestinationName)) { $datas = [ 'errors' => _DOCSERVER_COPY_ERROR . ' source : ' . $sourceFilePath . ' dest : ' . $destinationDir . $fileDestinationName @@ -261,7 +259,7 @@ class DocserverToolsController ); $datas = [ - 'copyOnDocserver' => + 'copyOnDocserver' => [ 'destinationDir' => $destinationDir, 'fileDestinationName' => $fileDestinationName, @@ -304,8 +302,7 @@ class DocserverToolsController return $datas; } - if ( - $aArgs['fingerprintMode'] == 'NONE' || + if ($aArgs['fingerprintMode'] == 'NONE' || $aArgs['fingerprintMode'] == '' ) { $datas = [ @@ -315,7 +312,7 @@ class DocserverToolsController return $datas; } else { $fingerprint = hash_file( - strtolower($aArgs['fingerprintMode']), + strtolower($aArgs['fingerprintMode']), $aArgs['path'] ); @@ -449,5 +446,4 @@ class DocserverToolsController return $datas; } - -} \ No newline at end of file +} diff --git a/core/Controllers/DocserverTypeController.php b/core/Controllers/DocserverTypeController.php index f38e8aed85c726a6c7fdfdef08b7bc9cf4d41114..0f0c7c550ab4976f4737583d791d08d400ddc831 100644 --- a/core/Controllers/DocserverTypeController.php +++ b/core/Controllers/DocserverTypeController.php @@ -22,7 +22,6 @@ use Core\Models\DocserverTypeModel; class DocserverTypeController { - public function getList(RequestInterface $request, ResponseInterface $response) { $obj = DocserverTypeModel::getList(); @@ -44,7 +43,6 @@ class DocserverTypeController 'id' => $id ]); } else { - return $response ->withStatus(500) ->withJson(['errors' => _ID . ' ' . _IS_EMPTY]); @@ -66,7 +64,6 @@ class DocserverTypeController $errors = $this->control($request, 'create'); if (!empty($errors)) { - return $response ->withStatus(500) ->withJson(['errors' => $errors]); @@ -82,7 +79,6 @@ class DocserverTypeController 'id' => $id ]); } else { - return $response ->withStatus(500) ->withJson(['errors' => _NOT_CREATE]); @@ -104,7 +100,6 @@ class DocserverTypeController $errors = $this->control($request, 'update'); if (!empty($errors)) { - return $response ->withStatus(500) ->withJson(['errors' => $errors]); @@ -120,7 +115,6 @@ class DocserverTypeController 'id' => $id ]); } else { - return $response ->withStatus(500) ->withJson(['errors' => _NOT_UPDATE]); @@ -143,7 +137,6 @@ class DocserverTypeController 'id' => $id ]); } else { - return $response ->withStatus(500) ->withJson(['errors' => _NOT_DELETE]); @@ -162,13 +155,13 @@ class DocserverTypeController { $errors = []; - if($mode == 'update') { + if ($mode == 'update') { $obj = DocserverTypeModel::getById([ 'id' => $request->getParam('id') ]); if (empty($obj)) { array_push( - $errors, + $errors, _ID . ' ' . $request->getParam('id') . ' ' . _NOT_EXISTS ); } @@ -176,13 +169,13 @@ class DocserverTypeController if (!Validator::notEmpty()->validate($request->getParam('id'))) { array_push($errors, _ID . ' ' . _IS_EMPTY); - } elseif($mode == 'create') { + } elseif ($mode == 'create') { $obj = DocserverTypeModel::getById([ 'id' => $request->getParam('id') ]); if (!empty($obj)) { array_push( - $errors, + $errors, _ID . ' ' . $obj[0]['id'] . ' ' . _ALREADY_EXISTS ); } @@ -196,8 +189,7 @@ class DocserverTypeController array_push($errors, _LABEL_STATUS . ' ' . _IS_EMPTY); } - if ( - Validator::notEmpty() + if (Validator::notEmpty() ->validate($request->getParam('is_system')) && !Validator::contains('Y') ->validate($request->getParam('is_system')) && @@ -207,8 +199,7 @@ class DocserverTypeController array_push($errors, _IS_SYSTEM . ' ' . _NOT . ' ' . _VALID); } - if ( - Validator::notEmpty() + if (Validator::notEmpty() ->validate($request->getParam('is_folder_status')) && !Validator::contains('Y') ->validate($request->getParam('is_folder_status')) && @@ -218,8 +209,7 @@ class DocserverTypeController array_push($errors, _IS_FOLDER_STATUS . ' ' . _NOT . ' ' . _VALID); } - if ( - Validator::notEmpty() + if (Validator::notEmpty() ->validate($request->getParam('img_filename')) && (!Validator::regex('/^[\w-.]+$/') ->validate($request->getParam('img_filename')) || @@ -229,8 +219,7 @@ class DocserverTypeController array_push($errors, _IMG_FILENAME . ' ' . _NOT . ' ' . _VALID); } - if ( - Validator::notEmpty() + if (Validator::notEmpty() ->validate($request->getParam('maarch_module')) && !Validator::length(null, 255) ->validate($request->getParam('maarch_module')) @@ -238,8 +227,7 @@ class DocserverTypeController array_push($errors, _MAARCH_MODULE . ' ' . _NOT . ' ' . _VALID); } - if ( - Validator::notEmpty() + if (Validator::notEmpty() ->validate($request->getParam('can_be_searched')) && !Validator::contains('Y') ->validate($request->getParam('can_be_searched')) && @@ -249,8 +237,7 @@ class DocserverTypeController array_push($errors, _CAN_BE_SEARCHED . ' ' . _NOT . ' ' . _VALID); } - if ( - Validator::notEmpty() + if (Validator::notEmpty() ->validate($request->getParam('can_be_modified')) && !Validator::contains('Y') ->validate($request->getParam('can_be_modified')) && @@ -262,5 +249,4 @@ class DocserverTypeController return $errors; } - -} \ No newline at end of file +} diff --git a/core/Controllers/ResController.php b/core/Controllers/ResController.php index 87ed7232c351738542526041128416d49130fbcd..c8583d8b35883d5dbb9d3ee5c27f958eccb1c221 100644 --- a/core/Controllers/ResController.php +++ b/core/Controllers/ResController.php @@ -27,43 +27,37 @@ class ResController /** * Store resource on database. - * @param $encodedFile string + * @param $encodedFile string * @param $data array - * @param $collId string - * @param $table string - * @param $fileFormat string - * @param $status string + * @param $collId string + * @param $table string + * @param $fileFormat string + * @param $status string * @return res_id */ public function storeResource($aArgs) { if (empty($aArgs['encodedFile'])) { - return ['errors' => 'encodedFile ' . _EMPTY]; } if (empty($aArgs['data'])) { - return ['errors' => 'data ' . _EMPTY]; } if (empty($aArgs['collId'])) { - return ['errors' => 'collId ' . _EMPTY]; } if (empty($aArgs['table'])) { - return ['errors' => 'table ' . _EMPTY]; } if (empty($aArgs['fileFormat'])) { - return ['errors' => 'fileFormat ' . _EMPTY]; } if (empty($aArgs['status'])) { - return ['errors' => 'status ' . _EMPTY]; } $encodedFile = $aArgs['encodedFile']; @@ -75,17 +69,17 @@ class ResController try { $count = count($data); - for ($i=0;$i<$count;$i++) { + for ($i = 0; $i < $count; $i++) { $data[$i]['column'] = strtolower($data[$i]['column']); } $returnCode = 0; - //copy sended file on tmp + //copy sended file on tmp $fileContent = base64_decode($encodedFile); $random = rand(); $fileName = 'tmp_file_' . $random . '.' . $fileFormat; $Fnm = $_SESSION['config']['tmppath'] . $fileName; - $inF = fopen($Fnm,"w"); + $inF = fopen($Fnm, "w"); fwrite($inF, $fileContent); fclose($inF); @@ -93,7 +87,7 @@ class ResController $ds = new DocserverController(); $aArgs = [ 'collId' => $collId, - 'fileInfos' => + 'fileInfos' => [ 'tmpDir' => $_SESSION['config']['tmppath'], 'size' => filesize($Fnm), @@ -106,7 +100,6 @@ class ResController $storeResult = $ds->storeResourceOnDocserver($aArgs); if (!empty($storeResult['errors'])) { - return ['errors' => $storeResult['errors']]; } @@ -125,18 +118,17 @@ class ResController require_once 'core/class/class_resource.php'; $resource = new \resource(); $resId = $resource->load_into_db( - $table, + $table, $storeResult['destination_dir'], $storeResult['file_destination_name'], $storeResult['path_template'], - $storeResult['docserver_id'], + $storeResult['docserver_id'], $data, $_SESSION['config']['databasetype'], true ); if (!is_numeric($resId)) { - return ['errors' => 'Pb with SQL insertion : ' .$resId]; } @@ -145,9 +137,7 @@ class ResController } return [$resId]; - } catch (Exception $e) { - return ['errors' => 'unknown error' . $e->getMessage()]; } } @@ -163,22 +153,18 @@ class ResController public function prepareStorage($aArgs) { if (empty($aArgs['data'])) { - return ['errors' => 'data ' . _EMPTY]; } if (empty($aArgs['docserverId'])) { - return ['errors' => 'docserverId ' . _EMPTY]; } if (empty($aArgs['status'])) { - return ['errors' => 'status ' . _EMPTY]; } if (empty($aArgs['fileFormat'])) { - return ['errors' => 'fileFormat ' . _EMPTY]; } @@ -199,10 +185,8 @@ class ResController $entityModel = new \Entities\Models\EntitiesModel(); $countD = count($data); - for ($i=0;$i<$countD;$i++) { - - if ( - strtoupper($data[$i]['type']) == 'INTEGER' || + for ($i = 0; $i < $countD; $i++) { + if (strtoupper($data[$i]['type']) == 'INTEGER' || strtoupper($data[$i]['type']) == 'FLOAT' ) { if ($data[$i]['value'] == '') { @@ -211,9 +195,9 @@ class ResController } if (strtoupper($data[$i]['type']) == 'STRING') { - $data[$i]['value'] = $data[$i]['value']; - $data[$i]['value'] = str_replace(";", "", $data[$i]['value']); - $data[$i]['value'] = str_replace("--", "", $data[$i]['value']); + $data[$i]['value'] = $data[$i]['value']; + $data[$i]['value'] = str_replace(";", "", $data[$i]['value']); + $data[$i]['value'] = str_replace("--", "", $data[$i]['value']); } if (strtoupper($data[$i]['column']) == strtoupper('status')) { @@ -304,7 +288,7 @@ class ResController } if ($userPrimaryEntity) { - for ($i=0;$i<count($data);$i++) { + for ($i = 0; $i < count($data); $i++) { if (strtoupper($data[$i]['column']) == strtoupper('destination')) { if ($data[$i]['value'] == "") { $data[$i]['value'] = $userEntity; @@ -326,7 +310,7 @@ class ResController } if ($userPrimaryEntity) { - for ($i=0;$i<count($data);$i++) { + for ($i = 0; $i<count($data); $i++) { if (strtoupper($data[$i]['column']) == strtoupper('initiator')) { if ($data[$i]['value'] == "") { $data[$i]['value'] = $userEntity; @@ -345,7 +329,7 @@ class ResController ) ); } - } + } array_push( $data, array( @@ -391,14 +375,14 @@ class ResController $data = $func->object2array($data); $queryExtFields = '('; $queryExtValues = '('; - $queryExtValuesFinal = '('; + $queryExtValuesFinal = '('; $parameters = array(); $db = new Database(); $findProcessLimitDate = false; $findProcessNotes = false; $delayProcessNotes = 0; - for ($i=0;$i<count($data);$i++) { + for ($i = 0; $i < count($data); $i++) { if ($data[$i]['column'] == 'process_limit_date') { $findProcessLimitDate = true; } @@ -408,7 +392,7 @@ class ResController // } if ($data[$i]['column'] == 'process_notes') { $findProcessNotes = true; - $donnees = explode(',',$data[$i]['value']); + $donnees = explode(',', $data[$i]['value']); $delayProcessNotes = $donnees['0']; $calendarType = $donnees['1']; } @@ -417,7 +401,7 @@ class ResController if ($table == 'mlb_coll_ext') { if ($delayProcessNotes > 0) { $processLimitDate = $this->retrieveProcessLimitDate( - $resId, + $resId, $delayProcessNotes, $calendarType ); @@ -439,12 +423,12 @@ class ResController } //var_dump($data); - for ($i=0;$i<count($data);$i++) { + for ($i = 0; $i < count($data); $i++) { if (strtoupper($data[$i]['type']) == 'INTEGER' || strtoupper($data[$i]['type']) == 'FLOAT') { if ($data[$i]['value'] == '') { $data[$i]['value'] = '0'; } - $data[$i]['value'] = str_replace(',' , '.', $data[$i]['value']); + $data[$i]['value'] = str_replace(',', '.', $data[$i]['value']); } if (strtoupper($data[$i]['column']) == strtoupper('category_id')) { $categoryId = $data[$i]['value']; @@ -459,7 +443,8 @@ class ResController break; } } - $stmt = $db->query("SELECT destination, type_id FROM ".$resViewTable." WHERE res_id = ?", array($resId)); + $stmt = $db->query("SELECT destination, type_id FROM " . $resViewTable + . " WHERE res_id = ?", array($resId)); $resView = $stmt->fetchObject(); $myVars = array( 'entity_id' => $resView->destination, @@ -468,12 +453,14 @@ class ResController 'folder_id' => "", ); $myChrono = $chronoX->generate_chrono($categoryId, $myVars, 'false'); - $data[$i]['value'] = $myChrono; + $data[$i]['value'] = $myChrono; } - if (strtoupper($data[$i]['column']) == strtoupper('exp_contact_id') && $data[$i]['value'] <> "" && !is_numeric($data[$i]['value'])) { + if (strtoupper($data[$i]['column']) == strtoupper('exp_contact_id') && + $data[$i]['value'] <> "" && !is_numeric($data[$i]['value'])) { $theString = str_replace(">", "", $data[$i]['value']); $mail = explode("<", $theString); - $stmt = $db->query("SELECT contact_id FROM view_contacts WHERE email = ? and enabled = 'Y' order by creation_date asc", array($mail[count($mail) -1])); + $stmt = $db->query("SELECT contact_id FROM view_contacts WHERE email = ? " + . " and enabled = 'Y' order by creation_date asc", array($mail[count($mail) -1])); $contact = $stmt->fetchObject(); if ($contact->contact_id <> "") { @@ -482,10 +469,12 @@ class ResController $data[$i]['value'] = 0; } } - if (strtoupper($data[$i]['column']) == strtoupper('address_id') && $data[$i]['value'] <> "" && !is_numeric($data[$i]['value'])) { + if (strtoupper($data[$i]['column']) == strtoupper('address_id') && + $data[$i]['value'] <> "" && !is_numeric($data[$i]['value'])) { $theString = str_replace(">", "", $data[$i]['value']); $mail = explode("<", $theString); - $stmt = $db->query("SELECT ca_id FROM view_contacts WHERE email = ? and enabled = 'Y' order by creation_date asc", array($mail[count($mail) -1])); + $stmt = $db->query("SELECT ca_id FROM view_contacts WHERE email = ? " + . " and enabled = 'Y' order by creation_date asc", array($mail[count($mail) -1])); $contact = $stmt->fetchObject(); if ($contact->ca_id <> "") { $data[$i]['value'] = $contact->ca_id; @@ -507,10 +496,14 @@ class ResController } $queryExtFields = preg_replace('/,$/', ',res_id)', $queryExtFields); $queryExtValues = preg_replace( - '/,$/', ',' . $resId . ')', $queryExtValues + '/,$/', + ',' . $resId . ')', + $queryExtValues ); $queryExtValuesFinal = preg_replace( - '/,$/', ',' . $resId . ')', $queryExtValuesFinal + '/,$/', + ',' . $resId . ')', + $queryExtValuesFinal ); /*$queryExt = " insert into " . $table . " " . $queryExtFields . ' values ' . $queryExtValues ;*/ @@ -538,7 +531,7 @@ class ResController 'resId' => '', 'error' => 'resId is not set', ); - return $returnResArray; + return $returnResArray; } } catch (Exception $e) { $returnResArray = array( @@ -549,4 +542,4 @@ class ResController return $returnResArray; } } -} \ No newline at end of file +} diff --git a/core/Controllers/StatusController.php b/core/Controllers/StatusController.php index db71cc32506fa4460b4528503250fe5ec59b4fdc..fc4aa2a2f8290fb551625aa1ab6a886ec3f28532 100644 --- a/core/Controllers/StatusController.php +++ b/core/Controllers/StatusController.php @@ -22,7 +22,6 @@ use Core\Models\StatusModel; class StatusController { - public function getList(RequestInterface $request, ResponseInterface $response) { $obj = StatusModel::getList(); @@ -42,7 +41,6 @@ class StatusController 'id' => $id ]); } else { - return $response ->withStatus(500) ->withJson(['errors' => _ID . ' ' . _IS_EMPTY]); @@ -62,7 +60,6 @@ class StatusController $errors = $this->control($request, 'create'); if (!empty($errors)) { - return $response ->withStatus(500) ->withJson(['errors' => $errors]); @@ -78,7 +75,6 @@ class StatusController 'id' => $id ]); } else { - return $response ->withStatus(500) ->withJson(['errors' => _NOT_CREATE]); @@ -98,7 +94,6 @@ class StatusController $errors = $this->control($request, 'update'); if (!empty($errors)) { - return $response ->withStatus(500) ->withJson(['errors' => $errors]); @@ -114,7 +109,6 @@ class StatusController 'id' => $id ]); } else { - return $response ->withStatus(500) ->withJson(['errors' => _NOT_UPDATE]); @@ -135,7 +129,6 @@ class StatusController 'id' => $id ]); } else { - return $response ->withStatus(500) ->withJson(['errors' => _NOT_DELETE]); @@ -152,13 +145,13 @@ class StatusController { $errors = []; - if($mode == 'update') { + if ($mode == 'update') { $obj = StatusModel::getById([ 'id' => $request->getParam('id') ]); if (empty($obj)) { array_push( - $errors, + $errors, _ID . ' ' . $request->getParam('id') . ' ' . _NOT_EXISTS ); } @@ -166,13 +159,13 @@ class StatusController if (!Validator::notEmpty()->validate($request->getParam('id'))) { array_push($errors, _ID . ' ' . _IS_EMPTY); - } elseif($mode == 'create') { + } elseif ($mode == 'create') { $obj = StatusModel::getById([ 'id' => $request->getParam('id') ]); if (!empty($obj)) { array_push( - $errors, + $errors, _ID . ' ' . $obj[0]['id'] . ' ' . _ALREADY_EXISTS ); } @@ -186,8 +179,7 @@ class StatusController array_push($errors, _LABEL_STATUS . ' ' . _IS_EMPTY); } - if ( - Validator::notEmpty() + if (Validator::notEmpty() ->validate($request->getParam('is_system')) && !Validator::contains('Y') ->validate($request->getParam('is_system')) && @@ -197,8 +189,7 @@ class StatusController array_push($errors, _IS_SYSTEM . ' ' . _NOT . ' ' . _VALID); } - if ( - Validator::notEmpty() + if (Validator::notEmpty() ->validate($request->getParam('is_folder_status')) && !Validator::contains('Y') ->validate($request->getParam('is_folder_status')) && @@ -208,8 +199,7 @@ class StatusController array_push($errors, _IS_FOLDER_STATUS . ' ' . _NOT . ' ' . _VALID); } - if ( - Validator::notEmpty() + if (Validator::notEmpty() ->validate($request->getParam('img_filename')) && (!Validator::regex('/^[\w-.]+$/') ->validate($request->getParam('img_filename')) || @@ -219,8 +209,7 @@ class StatusController array_push($errors, _IMG_FILENAME . ' ' . _NOT . ' ' . _VALID); } - if ( - Validator::notEmpty() + if (Validator::notEmpty() ->validate($request->getParam('maarch_module')) && !Validator::length(null, 255) ->validate($request->getParam('maarch_module')) @@ -228,8 +217,7 @@ class StatusController array_push($errors, _MAARCH_MODULE . ' ' . _NOT . ' ' . _VALID); } - if ( - Validator::notEmpty() + if (Validator::notEmpty() ->validate($request->getParam('can_be_searched')) && !Validator::contains('Y') ->validate($request->getParam('can_be_searched')) && @@ -239,8 +227,7 @@ class StatusController array_push($errors, _CAN_BE_SEARCHED . ' ' . _NOT . ' ' . _VALID); } - if ( - Validator::notEmpty() + if (Validator::notEmpty() ->validate($request->getParam('can_be_modified')) && !Validator::contains('Y') ->validate($request->getParam('can_be_modified')) && @@ -252,5 +239,4 @@ class StatusController return $errors; } - -} \ No newline at end of file +} diff --git a/core/Models/DocserverModelAbstract.php b/core/Models/DocserverModelAbstract.php index 0f0e1d7624224ddefd6e95d19b23b04572ff10f5..d6971fdc2414e97178ba67c9b4551e35fbb1d114 100644 --- a/core/Models/DocserverModelAbstract.php +++ b/core/Models/DocserverModelAbstract.php @@ -19,7 +19,6 @@ require_once 'apps/maarch_entreprise/services/Table.php'; class DocserverModelAbstract extends \Apps_Table_Service { - public static function getList() { $aReturn = static::select([ @@ -63,7 +62,7 @@ class DocserverModelAbstract extends \Apps_Table_Service $where['docserver_id'] = $aArgs['docserver_id']; $aReturn = static::updateTable( - $aArgs, + $aArgs, 'docservers', $where ); @@ -110,7 +109,7 @@ class DocserverModelAbstract extends \Apps_Table_Service $where['id'] = $aArgs['id']; $aReturn = static::updateTable( - $aArgs, + $aArgs, 'docservers', $where ); diff --git a/core/Models/DocserverTypeModelAbstract.php b/core/Models/DocserverTypeModelAbstract.php index 619815db26b3fa7766394bdf1fc39730c693f353..5be79667fee49890659bf63c6702a513bae40f2d 100644 --- a/core/Models/DocserverTypeModelAbstract.php +++ b/core/Models/DocserverTypeModelAbstract.php @@ -19,7 +19,6 @@ require_once 'apps/maarch_entreprise/services/Table.php'; class DocserverTypeModelAbstract extends \Apps_Table_Service { - public static function getList() { $aReturn = static::select([ @@ -63,7 +62,7 @@ class DocserverTypeModelAbstract extends \Apps_Table_Service $where['id'] = $aArgs['id']; $aReturn = static::updateTable( - $aArgs, + $aArgs, 'docserver_types', $where ); @@ -84,5 +83,4 @@ class DocserverTypeModelAbstract extends \Apps_Table_Service return $aReturn; } - } diff --git a/core/Models/ResModelAbstract.php b/core/Models/ResModelAbstract.php index b1a990764ae45845e66215c02669aa82ee7dce5e..44817889c72f58a087b79a058c10383c5f4b2725 100644 --- a/core/Models/ResModelAbstract.php +++ b/core/Models/ResModelAbstract.php @@ -19,7 +19,4 @@ require_once 'apps/maarch_entreprise/services/Table.php'; class ResModelAbstract extends \Apps_Table_Service { - - - } diff --git a/core/Models/StatusModelAbstract.php b/core/Models/StatusModelAbstract.php index daa132b7a2a342d15a3e8fe2b8a7d42678782409..e649ca08ee9adc8f2178b32cc5514b4380ef5086 100644 --- a/core/Models/StatusModelAbstract.php +++ b/core/Models/StatusModelAbstract.php @@ -19,7 +19,6 @@ require_once 'apps/maarch_entreprise/services/Table.php'; class StatusModelAbstract extends \Apps_Table_Service { - public static function getList() { $aReturn = static::select([ @@ -63,7 +62,7 @@ class StatusModelAbstract extends \Apps_Table_Service $where['id'] = $aArgs['id']; $aReturn = static::updateTable( - $aArgs, + $aArgs, 'status', $where ); diff --git a/core/Models/UserModelAbstract.php b/core/Models/UserModelAbstract.php index e2033e535a6cc185afeaeae773d237c5e966e096..3da01862be3f4297690ba9222bd7ef8025cff9ca 100644 --- a/core/Models/UserModelAbstract.php +++ b/core/Models/UserModelAbstract.php @@ -19,7 +19,6 @@ require_once 'apps/maarch_entreprise/services/Table.php'; class UserModelAbstract extends \Apps_Table_Service { - public static function getByEmail(array $aArgs = []) { static::checkRequired($aArgs, ['mail']); @@ -35,6 +34,4 @@ class UserModelAbstract extends \Apps_Table_Service return $aReturn; } - - } diff --git a/core/Test/DocserverControllerTest.php b/core/Test/DocserverControllerTest.php index a3fd17d90001594af9c5eaa5934fcd0988fe4b1d..8fb412bd2d4d072d24fcb7997473e218afd7d4de 100644 --- a/core/Test/DocserverControllerTest.php +++ b/core/Test/DocserverControllerTest.php @@ -1,5 +1,7 @@ <?php +namespace MaarchTest; + /** * Copyright Maarch since 2008 under licence GPLv3. * See LICENCE.txt file at the root folder for more details. @@ -147,7 +149,7 @@ class DocserverControllerTest extends PHPUnit_Framework_TestCase $response = $action->getDocserverToInsert($aArgs); $this->assertSame( - $response[0]['coll_id'], + $response[0]['coll_id'], $aArgs['collId'] ); } @@ -212,7 +214,7 @@ class DocserverControllerTest extends PHPUnit_Framework_TestCase $path = $_SESSION['config']['tmppath'] . '/test/'; if (!is_dir($path)) { - mkdir($path); + mkdir($path); } $fileSource = 'test_source.txt'; @@ -223,7 +225,7 @@ class DocserverControllerTest extends PHPUnit_Framework_TestCase $aArgs = [ 'collId' => 'letterbox_coll', - 'fileInfos' => + 'fileInfos' => [ 'tmpDir' => $path, 'size' => 122345, @@ -237,9 +239,8 @@ class DocserverControllerTest extends PHPUnit_Framework_TestCase //print_r($response); $this->assertArrayHasKey( - 'path_template', + 'path_template', $response ); } - -} \ No newline at end of file +} diff --git a/core/Test/DocserverToolsControllerTest.php b/core/Test/DocserverToolsControllerTest.php index 2e8ba6a3126fe090e3876798dd968f5347df9361..3a1a48fbaa82527540b8b5dac8811dec4d3d91a7 100644 --- a/core/Test/DocserverToolsControllerTest.php +++ b/core/Test/DocserverToolsControllerTest.php @@ -1,5 +1,7 @@ <?php +namespace MaarchTest; + /** * Copyright Maarch since 2008 under licence GPLv3. * See LICENCE.txt file at the root folder for more details. @@ -31,7 +33,7 @@ class DocserverToolsControllerTest extends PHPUnit_Framework_TestCase $path = $_SESSION['config']['tmppath'] . '/test/'; if (!is_dir($path)) { - mkdir($path); + mkdir($path); } $fileSource = 'test_source.txt'; @@ -58,7 +60,7 @@ class DocserverToolsControllerTest extends PHPUnit_Framework_TestCase $path = $_SESSION['config']['tmppath'] . '/test/'; if (!is_dir($path)) { - mkdir($path); + mkdir($path); } $fileSource = 'test_source.txt'; @@ -85,11 +87,11 @@ class DocserverToolsControllerTest extends PHPUnit_Framework_TestCase $path = $_SESSION['config']['tmppath'] . '/test/'; if (!is_dir($path)) { - mkdir($path); + mkdir($path); } $fileSource = 'test_source.txt'; - $fileDest = 'test_dest.txt'; + $fileDest = 'test_dest.txt'; $fp = fopen($path . $fileSource, 'a'); fwrite($fp, 'a unit test'); @@ -114,7 +116,7 @@ class DocserverToolsControllerTest extends PHPUnit_Framework_TestCase $path = $_SESSION['config']['tmppath'] . '/test/'; if (!is_dir($path)) { - mkdir($path); + mkdir($path); } $aArgs = [ @@ -139,5 +141,4 @@ class DocserverToolsControllerTest extends PHPUnit_Framework_TestCase $this->assertArrayHasKey('destinationDir', $response['createPathOnDocServer']); } - -} \ No newline at end of file +} diff --git a/core/Test/DocserverTypeControllerTest.php b/core/Test/DocserverTypeControllerTest.php index 9b6e49c10fd7b6fe6ed21db4b42b19f5844eb3f3..fc1e6cebcc8d0a76db931edf73ca031428e2265a 100644 --- a/core/Test/DocserverTypeControllerTest.php +++ b/core/Test/DocserverTypeControllerTest.php @@ -1,5 +1,7 @@ <?php +namespace MaarchTest; + /** * Copyright Maarch since 2008 under licence GPLv3. * See LICENCE.txt file at the root folder for more details. @@ -138,5 +140,4 @@ class DocserverTypeControllerTest extends PHPUnit_Framework_TestCase // $this->assertSame((string)$response->getBody(), '[{"docserverType":true}]'); // } - -} \ No newline at end of file +} diff --git a/core/Test/ResControllerTest.php b/core/Test/ResControllerTest.php index 14e3b8290387ac24c5e3d5443087f9068f442d2d..9cc586e9e92d4b05af3a45e9a4de9ad774e38274 100644 --- a/core/Test/ResControllerTest.php +++ b/core/Test/ResControllerTest.php @@ -1,5 +1,7 @@ <?php +namespace MaarchTest; + /** * Copyright Maarch since 2008 under licence GPLv3. * See LICENCE.txt file at the root folder for more details. @@ -55,7 +57,7 @@ class ResControllerTest extends PHPUnit_Framework_TestCase $path = $_SESSION['config']['tmppath'] . '/test/'; if (!is_dir($path)) { - mkdir($path); + mkdir($path); } $fileSource = 'test_source.txt'; @@ -126,7 +128,7 @@ class ResControllerTest extends PHPUnit_Framework_TestCase $path = $_SESSION['config']['tmppath'] . '/test/'; if (!is_dir($path)) { - mkdir($path); + mkdir($path); } $fileSource = 'test_source.txt'; @@ -190,4 +192,4 @@ class ResControllerTest extends PHPUnit_Framework_TestCase $this->assertGreaterThanOrEqual(0, $response); } -} \ No newline at end of file +} diff --git a/core/Test/StatusControllerTest.php b/core/Test/StatusControllerTest.php index d2295ffd4aa02617d7bfab8b4af2bff9d559b436..1d28fd04d9c77df5c009c800820687d023805cf8 100644 --- a/core/Test/StatusControllerTest.php +++ b/core/Test/StatusControllerTest.php @@ -1,5 +1,7 @@ <?php +namespace MaarchTest; + /** * Copyright Maarch since 2008 under licence GPLv3. * See LICENCE.txt file at the root folder for more details. @@ -135,5 +137,4 @@ class StatusControllerTest extends PHPUnit_Framework_TestCase $this->assertSame((string)$response->getBody(), '[true]'); } - -} \ No newline at end of file +} diff --git a/core/Test/define.php b/core/Test/define.php index bd182b801ab167daa2f2c161dad40145db19564b..062c2701e2afb6a76c957980490b8a6fe10c30cd 100644 --- a/core/Test/define.php +++ b/core/Test/define.php @@ -68,5 +68,6 @@ $loginObj->execute_login_script($loginMethods, true); if ($_SESSION['error']) { //TODO : return http bad authent error - echo $_SESSION['error'];exit(); + echo $_SESSION['error']; + exit(); } diff --git a/modules/entities/Controllers/EntitiesController.php b/modules/entities/Controllers/EntitiesController.php index 297316cd9fd45a7516d04caede8550eff58325cf..714898023dd5735666e4622e6221c5c0c4d0afaf 100644 --- a/modules/entities/Controllers/EntitiesController.php +++ b/modules/entities/Controllers/EntitiesController.php @@ -18,302 +18,10 @@ namespace Core\Controllers; use Psr\Http\Message\RequestInterface; use Psr\Http\Message\ResponseInterface; use Respect\Validation\Validator; -use Core\Models\UserModel; -//use Entities\Models\EntitiesModel; +use Entities\Models\EntitiesModel; -class ResController +class EntitiesController { - /** - * Store resource on database. - * @param $resTable string - * @param $destinationDir string - * @param $pathTemplate string - * @param $docserverId string - * @param $data array - * @return res_id - */ - public function storeResourceOnDB($aArgs) - { - - // storeResult['destination_dir'], - // $storeResult['file_destination_name'] , - // $storeResult['path_template'], - // $storeResult['docserver_id'], $_SESSION['data'], - // $_SESSION['config']['databasetype'] - if (empty($aArgs['resTable'])) { - - return ['errors' => 'resTable ' . _EMPTY]; - } - - if (empty($aArgs['destinationDir'])) { - - return ['errors' => 'destinationDir ' . _EMPTY]; - } - - if (empty($aArgs['pathTemplate'])) { - - return ['errors' => 'pathTemplate ' . _EMPTY]; - } - - if (empty($aArgs['docserverId'])) { - - return ['errors' => 'docserverId ' . _EMPTY]; - } - - if (empty($aArgs['data'])) { - - return ['errors' => 'data ' . _EMPTY]; - } - - - - $datas = [ - 'docserver' => $obj, - ]; - - return $datas; - } - - /** - * Prepares storage on database. - * @param $data array - * @param $docserverId string - * @param $status string - * @param $fileFormat string - * @return array $data - */ - public function prepareStorage($aArgs) - { - if (empty($aArgs['data'])) { - - return ['errors' => 'data ' . _EMPTY]; - } - - if (empty($aArgs['docserverId'])) { - - return ['errors' => 'docserverId ' . _EMPTY]; - } - - if (empty($aArgs['status'])) { - - return ['errors' => 'status ' . _EMPTY]; - } - - if (empty($aArgs['fileFormat'])) { - - return ['errors' => 'fileFormat ' . _EMPTY]; - } - - $statusFound = false; - $typistFound = false; - $typeIdFound = false; - $toAddressFound = false; - $userPrimaryEntity = false; - $destinationFound = false; - $initiatorFound = false; - - $data = $aArgs['data']; - $docserverId = $aArgs['docserverId']; - $status = $aArgs['status']; - $fileFormat = $aArgs['fileFormat']; - - $userModel = new UserModel(); - //$entityModel = new EntityModel(); - - $countD = count($data); - for ($i=0;$i<$countD;$i++) { - - if ( - strtoupper($data[$i]['type']) == 'INTEGER' || - strtoupper($data[$i]['type']) == 'FLOAT' - ) { - if ($data[$i]['value'] == '') { - $data[$i]['value'] = '0'; - } - } - - if (strtoupper($data[$i]['type']) == 'STRING') { - $data[$i]['value'] = $data[$i]['value']; - $data[$i]['value'] = str_replace(";", "", $data[$i]['value']); - $data[$i]['value'] = str_replace("--", "", $data[$i]['value']); - } - - if (strtoupper($data[$i]['column']) == strtoupper('status')) { - $statusFound = true; - } - - if (strtoupper($data[$i]['column']) == strtoupper('typist')) { - $typistFound = true; - } - - if (strtoupper($data[$i]['column']) == strtoupper('type_id')) { - $typeIdFound = true; - } - - if (strtoupper($data[$i]['column']) == strtoupper('custom_t10')) { - $mail = array(); - $theString = str_replace(">", "", $data[$i]['value']); - $mail = explode("<", $theString); - - $user = $userModel->getByEmail(['mail' => $mail[count($mail) -1]]); - //print_r($user); - $userIdFound = $user[0]['user_id']; - print_r($userIdFound); - - if (!empty($userIdFound)) { - $toAddressFound = true; - $destUser = $userIdFound; - - $queryUserEntity = "SELECT entity_id FROM users_entities WHERE primary_entity = 'Y' and user_id = ?"; - $stmt = $db->query($queryUserEntity, array($destUser)); - $userEntityId = $stmt->fetchObject(); - - if (!empty($userEntityId->entity_id)) { - $userEntity = $userEntityId->entity_id; - $userPrimaryEntity = true; - } - } else { - $queryEntity = "SELECT entity_id FROM entities WHERE email = ? and enabled = 'Y'"; - $stmt = $db->query($queryEntity, array($mail[count($mail) -1])); - $entityIdFound = $stmt->fetchObject(); - $userEntity = $entityIdFound->entity_id; - - // if (!empty($userEntity))Â { - // $userPrimaryEntity = true; - // } - } - } - } - - if (!$typistFound && !$toAddressFound) { - array_push( - $data, - array( - 'column' => 'typist', - 'value' => 'auto', - 'type' => 'string', - ) - ); - } - - if (!$typeIdFound) { - array_push( - $data, - array( - 'column' => 'type_id', - 'value' => '10', - 'type' => 'string', - ) - ); - } - - if (!$statusFound) { - array_push( - $data, - array( - 'column' => 'status', - 'value' => $status, - 'type' => 'string', - ) - ); - } - - if ($toAddressFound) { - array_push( - $data, - array( - 'column' => 'dest_user', - 'value' => $destUser, - 'type' => 'string', - ) - ); - array_push( - $data, - array( - 'column' => 'typist', - 'value' => $destUser, - 'type' => 'string', - ) - ); - } - - if ($userPrimaryEntity) { - for ($i=0;$i<count($data);$i++) { - if (strtoupper($data[$i]['column']) == strtoupper('destination')) { - if ($data[$i]['value'] == "") { - $data[$i]['value'] = $userEntity; - } - $destinationFound = true; - break; - } - } - if (!$destinationFound) { - array_push( - $data, - array( - 'column' => 'destination', - 'value' => $userEntity, - 'type' => 'string', - ) - ); - } - } - - if ($userPrimaryEntity) { - for ($i=0;$i<count($data);$i++) { - if (strtoupper($data[$i]['column']) == strtoupper('initiator')) { - if ($data[$i]['value'] == "") { - $data[$i]['value'] = $userEntity; - } - $initiatorFound = true; - break; - } - } - if (!$initiatorFound) { - array_push( - $data, - array( - 'column' => 'initiator', - 'value' => $userEntity, - 'type' => 'string', - ) - ); - } - } - array_push( - $data, - array( - 'column' => 'format', - 'value' => $fileFormat, - 'type' => 'string', - ) - ); - array_push( - $data, - array( - 'column' => 'offset_doc', - 'value' => '', - 'type' => 'string', - ) - ); - array_push( - $data, - array( - 'column' => 'logical_adr', - 'value' => '', - 'type' => 'string', - ) - ); - array_push( - $data, - array( - 'column' => 'docserver_id', - 'value' => $docserverId, - 'type' => 'string', - ) - ); - - return $data; - } -} \ No newline at end of file + +} diff --git a/modules/entities/Models/EntitiesModelAbstract.php b/modules/entities/Models/EntitiesModelAbstract.php index 8795f479ca56c1b2bf61f6ada1f0b4052664f1e1..1050ceda06216c37ca7c808dc1aa73458695d22d 100644 --- a/modules/entities/Models/EntitiesModelAbstract.php +++ b/modules/entities/Models/EntitiesModelAbstract.php @@ -51,6 +51,4 @@ class EntitiesModelAbstract extends \Apps_Table_Service return $aReturn; } - - } diff --git a/rest/index.php b/rest/index.php index 2a32e3194405039978694ceec3828b77d9a9d580..c0dcc05af398a7e940863787352e1598fc87ab70 100644 --- a/rest/index.php +++ b/rest/index.php @@ -48,7 +48,7 @@ if (empty($_SESSION['user'])) { $path . PATH_SEPARATOR . $_SESSION['config']['corepath'] . PATH_SEPARATOR . get_include_path() ); - } else if (isset($_SESSION['config']['corepath']) + } elseif (isset($_SESSION['config']['corepath']) && ! empty($_SESSION['config']['corepath']) ) { set_include_path( @@ -81,7 +81,8 @@ if (empty($_SESSION['user'])) { if ($_SESSION['error']) { //TODO : return http bad authent error - echo $_SESSION['error'];exit(); + echo $_SESSION['error']; + exit(); } //$lifetime = 3600; diff --git a/test.php b/test.php new file mode 100644 index 0000000000000000000000000000000000000000..7f551ef6dd22024d95c5f6535a5dd6644ef0ce52 --- /dev/null +++ b/test.php @@ -0,0 +1,20 @@ +<?php + +namespace toto; + +/** + * class Toto + */ +class Toto extends \AnotherClass +{ + public function __construct($aArgs) + { + # code... + $aArgs['aBool'] = true; + } + + public function aFunction() + { + // code + } +}