@@ -16,9 +16,9 @@ |
||
| 16 | 16 | interface StatusInterface extends EntityInterface |
| 17 | 17 | { |
| 18 | 18 | |
| 19 | - const NONPUBLIC = /*@translate*/ 'private'; |
|
| 19 | + const NONPUBLIC = /*@translate*/ 'private'; |
|
| 20 | 20 | |
| 21 | - const PUBLIC_TO_ALL = /*@translate*/ 'public to all'; |
|
| 21 | + const PUBLIC_TO_ALL = /*@translate*/ 'public to all'; |
|
| 22 | 22 | |
| 23 | 23 | public function __construct($status = self::NONPUBLIC); |
| 24 | 24 | |
@@ -125,16 +125,16 @@ |
||
| 125 | 125 | |
| 126 | 126 | public function setParams($params) |
| 127 | 127 | { |
| 128 | - if(is_array($params)){ |
|
| 129 | - if(isset($params['paginatorParams'])){ |
|
| 128 | + if (is_array($params)) { |
|
| 129 | + if (isset($params['paginatorParams'])) { |
|
| 130 | 130 | $this->setPaginatorParams($params['paginatorParams']); |
| 131 | 131 | unset($params['paginatorParams']); |
| 132 | 132 | } |
| 133 | - if(isset($params['paginators'])){ |
|
| 133 | + if (isset($params['paginators'])) { |
|
| 134 | 134 | $this->setPaginators($params['paginators']); |
| 135 | 135 | unset($params['paginators']); |
| 136 | 136 | } |
| 137 | - if(isset($params['paginatorName'])){ |
|
| 137 | + if (isset($params['paginatorName'])) { |
|
| 138 | 138 | $this->setPaginatorName($params['paginatorName']); |
| 139 | 139 | unset($params['paginatorName']); |
| 140 | 140 | } |
@@ -47,7 +47,7 @@ |
||
| 47 | 47 | */ |
| 48 | 48 | protected $paginator; |
| 49 | 49 | |
| 50 | - /** |
|
| 50 | + /** |
|
| 51 | 51 | * @return string |
| 52 | 52 | */ |
| 53 | 53 | public function getPaginatorName() |
@@ -129,7 +129,7 @@ discard block |
||
| 129 | 129 | |
| 130 | 130 | /** |
| 131 | 131 | * @param $resource |
| 132 | - * @param null $privilege |
|
| 132 | + * @param null|string $privilege |
|
| 133 | 133 | * @throws \Auth\Exception\UnauthorizedImageAccessException |
| 134 | 134 | * @throws \Auth\Exception\UnauthorizedAccessException |
| 135 | 135 | */ |
@@ -155,8 +155,8 @@ discard block |
||
| 155 | 155 | } |
| 156 | 156 | |
| 157 | 157 | /** |
| 158 | - * @param null $resource |
|
| 159 | - * @param null $privilege |
|
| 158 | + * @param null|string $resource |
|
| 159 | + * @param null|string $privilege |
|
| 160 | 160 | * @param string $mode |
| 161 | 161 | * @return $this|bool |
| 162 | 162 | */ |
@@ -138,14 +138,14 @@ |
||
| 138 | 138 | if (!$this->test($resource, $privilege)) { |
| 139 | 139 | $msg = null === $privilege |
| 140 | 140 | ? sprintf( |
| 141 | - 'You are not allowed to access resource "%s"', |
|
| 142 | - is_object($resource) ? $resource->getResourceId() : $resource |
|
| 143 | - ) |
|
| 141 | + 'You are not allowed to access resource "%s"', |
|
| 142 | + is_object($resource) ? $resource->getResourceId() : $resource |
|
| 143 | + ) |
|
| 144 | 144 | : sprintf( |
| 145 | - 'You are not allowed to execute operation "%s" on resource "%s"', |
|
| 146 | - $privilege, |
|
| 147 | - is_object($resource) ? $resource->getResourceId() : $resource |
|
| 148 | - ); |
|
| 145 | + 'You are not allowed to execute operation "%s" on resource "%s"', |
|
| 146 | + $privilege, |
|
| 147 | + is_object($resource) ? $resource->getResourceId() : $resource |
|
| 148 | + ); |
|
| 149 | 149 | |
| 150 | 150 | if ($resource instanceof FileInterface && 0 == strpos($resource->getType(), 'image/')) { |
| 151 | 151 | throw new UnauthorizedImageAccessException(str_replace('resource', 'image', $msg)); |
@@ -233,7 +233,7 @@ discard block |
||
| 233 | 233 | */ |
| 234 | 234 | public function getParent($returnSelf = false) |
| 235 | 235 | { |
| 236 | - return $this->parent ? : ($returnSelf ? $this : null); |
|
| 236 | + return $this->parent ?: ($returnSelf ? $this : null); |
|
| 237 | 237 | } |
| 238 | 238 | |
| 239 | 239 | /** |
@@ -465,7 +465,7 @@ discard block |
||
| 465 | 465 | */ |
| 466 | 466 | public function getPermissionsResourceId() |
| 467 | 467 | { |
| 468 | - return 'organization:' . $this->getId(); |
|
| 468 | + return 'organization:'.$this->getId(); |
|
| 469 | 469 | } |
| 470 | 470 | |
| 471 | 471 | /** |
@@ -34,7 +34,7 @@ |
||
| 34 | 34 | * |
| 35 | 35 | * @var array $attachmentsMimeType |
| 36 | 36 | */ |
| 37 | - protected $attachmentsMimeType = array('image','applications/pdf', |
|
| 37 | + protected $attachmentsMimeType = array('image', 'applications/pdf', |
|
| 38 | 38 | 'application/x-pdf', |
| 39 | 39 | 'application/acrobat', |
| 40 | 40 | 'applications/vnd.pdf', |
@@ -93,7 +93,7 @@ |
||
| 93 | 93 | /** |
| 94 | 94 | * Gets the the maximum number of allowed attachments |
| 95 | 95 | * |
| 96 | - * @return string |
|
| 96 | + * @return integer |
|
| 97 | 97 | */ |
| 98 | 98 | public function getAttachmentsCount() |
| 99 | 99 | { |
@@ -57,9 +57,9 @@ discard block |
||
| 57 | 57 | if ($exception instanceof UnauthorizedImageAccessException) { |
| 58 | 58 | $image = __DIR__ . '/../../../../../public/images/unauthorized-access.png'; |
| 59 | 59 | $response->setStatusCode(Response::STATUS_CODE_403) |
| 60 | - ->setContent(file_get_contents($image)) |
|
| 61 | - ->getHeaders() |
|
| 62 | - ->addHeaderLine('Content-Type', 'image/png'); |
|
| 60 | + ->setContent(file_get_contents($image)) |
|
| 61 | + ->getHeaders() |
|
| 62 | + ->addHeaderLine('Content-Type', 'image/png'); |
|
| 63 | 63 | $e->stopPropagation(); |
| 64 | 64 | $response->sendHeaders(); |
| 65 | 65 | //echo file_get_contents($image); |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | } |
| 71 | 71 | |
| 72 | 72 | $application = $e->getApplication(); |
| 73 | - $auth = $application->getServiceManager()->get('AuthenticationService'); |
|
| 73 | + $auth = $application->getServiceManager()->get('AuthenticationService'); |
|
| 74 | 74 | |
| 75 | 75 | if (!$auth->hasIdentity()) { |
| 76 | 76 | $routeMatch = $e->getRouteMatch(); |
@@ -102,9 +102,9 @@ discard block |
||
| 102 | 102 | $model->setTemplate($this->getExceptionTemplate()); |
| 103 | 103 | $e->setResult($model); |
| 104 | 104 | |
| 105 | - // $statusCode = $response->getStatusCode(); |
|
| 106 | - // if ($statusCode === 200) { |
|
| 105 | + // $statusCode = $response->getStatusCode(); |
|
| 106 | + // if ($statusCode === 200) { |
|
| 107 | 107 | $response->setStatusCode(Response::STATUS_CODE_403); |
| 108 | - // } |
|
| 108 | + // } |
|
| 109 | 109 | } |
| 110 | 110 | } |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | * Return an image, if an image was requested. |
| 56 | 56 | */ |
| 57 | 57 | if ($exception instanceof UnauthorizedImageAccessException) { |
| 58 | - $image = __DIR__ . '/../../../../../public/images/unauthorized-access.png'; |
|
| 58 | + $image = __DIR__.'/../../../../../public/images/unauthorized-access.png'; |
|
| 59 | 59 | $response->setStatusCode(Response::STATUS_CODE_403) |
| 60 | 60 | ->setContent(file_get_contents($image)) |
| 61 | 61 | ->getHeaders() |
@@ -78,7 +78,7 @@ discard block |
||
| 78 | 78 | $routeMatch->setParam('action', 'index'); |
| 79 | 79 | $query = $e->getRequest()->getQuery(); |
| 80 | 80 | $ref = $e->getRequest()->getRequestUri(); |
| 81 | - $ref = preg_replace('~^' . preg_quote($e->getRouter()->getBaseUrl()) . '~', '', $ref); |
|
| 81 | + $ref = preg_replace('~^'.preg_quote($e->getRouter()->getBaseUrl()).'~', '', $ref); |
|
| 82 | 82 | $query->set('ref', $ref); |
| 83 | 83 | $query->set('req', 1); |
| 84 | 84 | $response->setStatusCode(Response::STATUS_CODE_401); |
@@ -173,6 +173,9 @@ |
||
| 173 | 173 | return $this->redirect()->refresh(); |
| 174 | 174 | } |
| 175 | 175 | |
| 176 | + /** |
|
| 177 | + * @param \Cv\Repository\Cv $repository |
|
| 178 | + */ |
|
| 176 | 179 | private function getCv($repository, $user) |
| 177 | 180 | { |
| 178 | 181 | $id = |
@@ -28,27 +28,27 @@ |
||
| 28 | 28 | */ |
| 29 | 29 | class ManageController extends AbstractActionController |
| 30 | 30 | { |
| 31 | - private $repositories; |
|
| 31 | + private $repositories; |
|
| 32 | 32 | |
| 33 | - private $formElements; |
|
| 33 | + private $formElements; |
|
| 34 | 34 | |
| 35 | - private $viewHelper; |
|
| 35 | + private $viewHelper; |
|
| 36 | 36 | |
| 37 | - static public function factory(ContainerInterface $container) |
|
| 38 | - { |
|
| 39 | - $controller = new static(); |
|
| 40 | - $controller->init($container); |
|
| 41 | - return $controller; |
|
| 42 | - } |
|
| 37 | + static public function factory(ContainerInterface $container) |
|
| 38 | + { |
|
| 39 | + $controller = new static(); |
|
| 40 | + $controller->init($container); |
|
| 41 | + return $controller; |
|
| 42 | + } |
|
| 43 | 43 | |
| 44 | - public function init(ContainerInterface $container) |
|
| 45 | - { |
|
| 46 | - $this->repositories = $container->get('repositories'); |
|
| 47 | - $this->formElements = $container->get('FormElementManager'); |
|
| 48 | - $this->viewHelper = $container->get('ViewHelperManager'); |
|
| 49 | - } |
|
| 44 | + public function init(ContainerInterface $container) |
|
| 45 | + { |
|
| 46 | + $this->repositories = $container->get('repositories'); |
|
| 47 | + $this->formElements = $container->get('FormElementManager'); |
|
| 48 | + $this->viewHelper = $container->get('ViewHelperManager'); |
|
| 49 | + } |
|
| 50 | 50 | |
| 51 | - public function formAction() |
|
| 51 | + public function formAction() |
|
| 52 | 52 | { |
| 53 | 53 | $repositories = $this->repositories; |
| 54 | 54 | /* @var $cvRepository \Cv\Repository\Cv */ |
@@ -119,8 +119,7 @@ |
||
| 119 | 119 | if ('file-uri' === $params->fromPost('return')) { |
| 120 | 120 | $content = $viewHelperManager->get('basepath') |
| 121 | 121 | ->__invoke($form->getHydrator()->getLastUploadedFile()->getUri()); |
| 122 | - } |
|
| 123 | - else { |
|
| 122 | + } else { |
|
| 124 | 123 | if ($form instanceof SummaryFormInterface) { |
| 125 | 124 | $form->setRenderMode(SummaryFormInterface::RENDER_SUMMARY); |
| 126 | 125 | $viewHelper = 'summaryForm'; |
@@ -22,7 +22,7 @@ |
||
| 22 | 22 | * Look for an drafted Document of a given user |
| 23 | 23 | * |
| 24 | 24 | * @param $user |
| 25 | - * @return CvEntity|null |
|
| 25 | + * @return \MongoCursor |
|
| 26 | 26 | */ |
| 27 | 27 | public function findDraft($user) |
| 28 | 28 | { |
@@ -10,10 +10,10 @@ |
||
| 10 | 10 | use Core\Entity\IdentifiableEntityInterface; |
| 11 | 11 | |
| 12 | 12 | interface CvInterface extends EntityInterface, |
| 13 | - IdentifiableEntityInterface, |
|
| 14 | - DraftableEntityInterface, |
|
| 15 | - PermissionsAwareInterface, |
|
| 16 | - ModificationDateAwareEntityInterface |
|
| 13 | + IdentifiableEntityInterface, |
|
| 14 | + DraftableEntityInterface, |
|
| 15 | + PermissionsAwareInterface, |
|
| 16 | + ModificationDateAwareEntityInterface |
|
| 17 | 17 | { |
| 18 | 18 | |
| 19 | 19 | /** |