Commit c126757c by Cyril Vazquez

Merge branch 'develop' into 'master'

Develop

See merge request !13
parents 0258a1c3 4561d453

Too many changes to show.

To preserve performance only 1000 of 1000+ files are displayed.

File mode changed from 100644 to 100755
/data/maarchRM/medona/
/data/maarchRM/log.txt
/data/maarchRM/repository/
/data/maarchRM/tmp/
/src/ext/archivesPubliques/
/src/ext/thirdPartyArchiving/
/web/public/dependency/
/nbproject/
data/maarchRM/log.txt
data/maarchRM/repository/
data/maarchRM/tmp/
data/maarchRM/medona/
data/maarchRM/luceneIndex/
data/maarchRM/conf/vhost.win.conf
data/maarchRM/conf/vhost.conf
web/tmp
web/public/dependency/
dependency/fileSystem/plugins/fid/cache/*
nbproject/
src/ext/*
data/maarchRM/conf/configuration.ini
data/maarchRM/conf/confvars.ini
\ No newline at end of file
File mode changed from 100644 to 100755
Description
===========
MaarchRM is a open source software that allows you to store, find and display
your digital resources in compliance with international regulation ISO.
It’s a full featured PHP PostgresSQL software.
your digital resources in compliance with international regulation ISO. It’s a
full featured PHP PostgresSQL software.
Licence
=======
MaarchRM is released under the GPL v3 (or later) license, see [LICENCE.txt](https://labs.maarch.org/maarch/maarchRM/blob/master/LICENCE.txt)
MaarchRM is released under the GPL v3 (or later) license, see
[LICENCE.txt](https://labs.maarch.org/maarch/maarchRM/blob/master/LICENCE.txt)
Requirements
============
- Server Apache 2.4 (or greater)
- Module Apache rewrite_module
- Module Apache env_module
- PHP 5.4 (or greater)
- Extension PHP fileinfo
- Extension PHP mcrypt
- Extension PHP pdo
- Extension PHP pdo_pgsql
- Extension PHP xsl
- Application 7z
- JAVA 1.7 (JRE)
Install
=======
- Upload MaarchRM to your webserver.
- Check your time zone configuration in php.ini
- Create the repository *\<MaarchRM_Path\>/web/public/dependency*.
- Create a symbolic link of *\<MaarchRM_Path\>/dependency/html/public* named
*html* in that folder.
- For linux users : Create a symbolic link of 7zip executable named *7z* in
that same folder.
- In *\<MaarchRM_Path\>/data/maarchRM/conf*, copy the files
configuration.ini.default and confvar.ini.default as configuration.ini and
confvar.ini
- For Windows users : Uncomment the “zipExecutable” line of the configuration
file *\<MaarchRM_Path\>/data/maarchRM/conf/conf.d/dependency\#fileSystem.ini* and write the right path of your 7zip executable.
- Configure MaarchRM to connect to your database in the file *\<MaarchRM_Path\>/data/maarchRM/conf/confvars.ini* .
- The structure of the database can be setup by the script file *\<MaarchRM\>/data/maarchRM/batch/pgsql/schema.sh* and the *\<MaarchRM\>/data/maarchRM/batch/pgsql/data.min.sh* will give you the data to start with.
- A default virtual host to run the application can be find in *\<MaarchRM\>/data/maarchRM/conf/vhost.conf* (vhost.win.conf for windows user). Export that virtual host to your apache server.
- Login to the application throw your web browser (default admin user/password is “superadmin”/”superadmin”).
- You are ready to go !
file
*\<MaarchRM_Path\>/data/maarchRM/conf/conf.d/dependency\#fileSystem.ini* and
write the right path of your 7zip executable.
- Configure MaarchRM to connect to your database in the file
*\<MaarchRM_Path\>/data/maarchRM/conf/confvars.ini* .
- The structure of the database can be setup by the script file
*\<MaarchRM\>/data/maarchRM/batch/pgsql/schema.sh* and the
*\<MaarchRM\>/data/maarchRM/batch/pgsql/data.min.sh* will give you the data
to start with.
- A default virtual host to run the application can be find in
*\<MaarchRM\>/data/maarchRM/conf/vhost.conf.default* (vhost.win.conf.default
for windows user). Copy that file and include the virtual host to your
apache server.
- Login to the application throw your web browser (default admin user/password
is “superadmin”/”superadmin”).
- You are ready to go !
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
......@@ -15,9 +15,10 @@ class BadRequestException
* @param string $message
* @param integer $code
* @param Exception $previous
* @param array $variables
*/
public function __construct($message="Bad request", $code=400, $previous=null)
public function __construct($message="Bad request", $code=400, $previous=null, $variables=array())
{
parent::__construct($message, $code, $previous);
parent::__construct($message, $code, $previous, $variables);
}
}
\ No newline at end of file
......@@ -13,8 +13,8 @@ class ConflictException
* @param integer $code
* @param Exception $previous
*/
public function __construct($message="Conflict", $code=409, $previous=null)
public function __construct($message="Conflict", $code=409, $previous=null, $variables=array())
{
parent::__construct($message, $code, $previous);
parent::__construct($message, $code, $previous, $variables);
}
}
\ No newline at end of file
......@@ -13,8 +13,8 @@ class ForbiddenException
* @param integer $code
* @param Exception $previous
*/
public function __construct($message="Forbidden", $code=403, $previous=null)
public function __construct($message="Forbidden", $code=403, $previous=null, $variables=array())
{
parent::__construct($message, $code, $previous);
parent::__construct($message, $code, $previous, $variables);
}
}
\ No newline at end of file
......@@ -13,8 +13,8 @@ class InternalServerErrorException
* @param integer $code
* @param Exception $previous
*/
public function __construct($message="Internal server error", $code=500, $previous=null)
public function __construct($message="Internal server error", $code=500, $previous=null, $variables=array())
{
parent::__construct($message, $code, $previous);
parent::__construct($message, $code, $previous, $variables);
}
}
\ No newline at end of file
......@@ -13,8 +13,8 @@ class NotFoundException
* @param integer $code
* @param Exception $previous
*/
public function __construct($message="Not found", $code=404, $previous=null)
public function __construct($message="Not found", $code=404, $previous=null, $variables=array())
{
parent::__construct($message, $code, $previous);
parent::__construct($message, $code, $previous, $variables);
}
}
\ No newline at end of file
......@@ -13,8 +13,8 @@ class UnauthorizedException
* @param integer $code
* @param Exception $previous
*/
public function __construct($message="Unauthorized", $code=401, $previous=null)
public function __construct($message="Unauthorized", $code=401, $previous=null, $variables=array())
{
parent::__construct($message, $code, $previous);
parent::__construct($message, $code, $previous, $variables);
}
}
\ No newline at end of file
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
......@@ -353,18 +353,38 @@ abstract class AbstractKernel
*/
protected function attachObservers()
{
foreach (\laabs::observers() as $observer) {
$observerObject = $observer->newInstance();
if (!\laabs::isServiceClient()) {
$presentation = \laabs::presentation();
foreach ($observer->getHandlers() as $handler) {
\core\Observer\Dispatcher::attach(
$observerObject,
$handler->name,
$handler->subject
);
foreach ($presentation->getObservers() as $observer) {
self::attachObserver($observer);
}
}
foreach (\laabs::bundles() as $bundle) {
foreach ($bundle->getObservers() as $observer) {
self::attachObserver($observer);
}
}
}
/**
* Attach an observet to event dispatcher
* @param object $observer
*
* @access protected
*/
protected function attachObserver($observer)
{
$observerObject = $observer->newInstance();
foreach ($observer->getHandlers() as $handler) {
\core\Observer\Dispatcher::attach(
$observerObject,
$handler->name,
$handler->subject
);
}
}
}
\ No newline at end of file
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
......@@ -57,14 +57,13 @@ class PresentationKernel
\core\Observer\Dispatcher::notify(LAABS_REQUEST, self::$instance->request);
/* Establish routes (input, action, output) */
self::$instance->setRoutes();
self::$instance->parseRequest();
/* Call Command */
try {
/* Establish routes (input, action, output) */
self::$instance->setRoutes();
self::$instance->parseRequest();
/* Call Command */
self::$instance->callUserCommand();
} catch (\Exception $exception) {
......@@ -323,34 +322,36 @@ class PresentationKernel
}
// Try to find view for the raised exception else send exception as string as response content
if (isset($this->viewRouter)) {
switch (true) {
case $this->viewRouter->presenter->hasView($exceptionName) :
$this->viewRouter->setView($exceptionName);
switch (true) {
case isset($this->viewRouter) && $this->viewRouter->presenter->hasView($exceptionName) :
$this->viewRouter->setView($exceptionName);
return true;
return true;
case $this->viewRouter->presenter->hasView('Exception'):
$this->viewRouter->setView('Exception');
case isset($this->viewRouter) && $this->viewRouter->presenter->hasView('Exception'):
$this->viewRouter->setView('Exception');
return true;
return true;
case \laabs::presentation()->hasPresenter('Exception'):
$reflectionRouter = new \ReflectionClass('core\Route\ViewRouter');
$this->viewRouter = $reflectionRouter->newInstanceWithoutConstructor();
case \laabs::presentation()->hasPresenter('Exception'):
$presenter = \laabs::presentation()->getPresenter('Exception');
$this->viewRouter->setPresenter("Exception");
switch (true) {
case $this->viewRouter->presenter->hasView($exceptionName) :
$this->viewRouter->setView($exceptionName);
$this->viewRouter->presentation = \laabs::presentation();
return true;
$presenter = \laabs::presentation()->getPresenter('Exception');
$this->viewRouter->setPresenter("Exception");
switch (true) {
case $this->viewRouter->presenter->hasView($exceptionName) :
$this->viewRouter->setView($exceptionName);
case $this->viewRouter->presenter->hasView('Exception'):
$this->viewRouter->setView('Exception');
return true;
return true;
}
}
case $this->viewRouter->presenter->hasView('Exception'):
$this->viewRouter->setView('Exception');
return true;
}
}
return false;
......
......@@ -4,13 +4,13 @@
* @package core\Kernel
*/
namespace core\Kernel;
/**
* Class Laabs Dynamic Kernel
*
* @extends core\Kernel\AbstractKernel
*/
class ServiceKernel
extends AbstractKernel
class ServiceKernel extends AbstractKernel
{
/* Constants */
......@@ -192,31 +192,31 @@ class ServiceKernel
}
$parser = $this->inputRouter->parser->newInstance();
$bodyArguments = $this->inputRouter->input->parse($parser, $this->request->body);
} else {
switch ($this->request->contentType) {
case 'php':
$bodyArguments = $this->request->body;
break;
case 'url':
$bodyArguments = \core\Encoding\url::decode($this->request->body);
break;
case 'json':
default:
default:
$bodyArguments = \core\Encoding\json::decode($this->request->body);
break;
break;
}
}
$requestArguments = array_merge($queryArguments, $bodyArguments);
$this->serviceRequest = $this->servicePath->getMessage($requestArguments);
$valid = \laabs::validateMessage($this->serviceRequest, $this->servicePath);
if (!$valid) {
$e = new \core\Exception\BadRequestException();
$e->errors = \laabs::getValidationErrors();
......@@ -242,7 +242,7 @@ class ServiceKernel
break;
// Value available from message parts: cast to model object
case isset($this->serviceRequest[$parameter->name]) :
case isset($this->serviceRequest[$parameter->name]):
$value = $this->serviceRequest[$parameter->name];
break;
......@@ -260,7 +260,7 @@ class ServiceKernel
default:
// Throw exception
$value = null;
}
}
$this->actionArguments[$parameter->name] = $value;
}
......@@ -280,10 +280,10 @@ class ServiceKernel
* @access protected
*/
protected function callAction()
{
{
// Notify of service for authorizations and log
//\core\Observer\Dispatcher::notify(LAABS_SERVICE_PATH, $this->servicePath, $this->actionArguments);
if ($this->response->mode == 'http') {
$this->response->setHeader("X-Laabs-Controller", $this->actionRouter->uri);
}
......@@ -321,13 +321,15 @@ class ServiceKernel
if (isset($this->outputRouter)) {
switch (true) {
case $this->outputRouter->serializer->hasOutput($exceptionName) :
case $this->outputRouter->serializer->hasOutput($exceptionName):
$this->outputRouter->setOutput($exceptionName);
$this->serviceReturn = $exception;
return true;
case $this->outputRouter->serializer->hasOutput('Exception'):
$this->outputRouter->setOutput('Exception');
$this->serviceReturn = $exception;
return true;
}
......@@ -349,7 +351,7 @@ class ServiceKernel
$serializer = $this->outputRouter->serializer->newInstance();
$content = $this->outputRouter->output->serialize($serializer, $this->serviceReturn);
$content = $this->outputRouter->output->serialize($serializer, $this->serviceReturn);
} else {
switch ($this->response->contentType) {
case 'json':
......@@ -358,11 +360,10 @@ class ServiceKernel
break;
case 'text':
default:
$content = \core\Encoding\text::encode($this->serviceReturn);
$content = \core\Encoding\text::encode($this->serviceReturn);
}
}
$this->response->setBody($content);
}
}
\ No newline at end of file
}
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
<