Current path: home/webdevt/cryptoimpot.fr/module/Application/src/
?? Go up: /home/webdevt/cryptoimpot.fr/module/Application
<?php
/**
* @link http://github.com/zendframework/ZendSkeletonApplication for the canonical source repository
* @copyright Copyright (c) 2005-2016 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
namespace Application;
use Laminas\ModuleManager\Feature\ConfigProviderInterface;
use \Application\Form\Element\ReCaptcha;
class Module implements ConfigProviderInterface {
const VERSION = '3.0.3-dev';
public function getConfig() {
return include __DIR__ . '/../config/module.config.php';
}
public function getConfigRoles() {
return include __DIR__ . '/../config/module.acl.roles.php';
}
// public function getViewHelperConfig() {
// return array(
// 'invokables' => array(
// //'formradio' => 'Application\Form\View\Helper\FormRadio'
// )
// );
// }
public function onBootstrap($event) {
$application = $event->getApplication();
$serviceManager = $application->getServiceManager();
$eventManager = $application->getEventManager();
/* ACL */
// Register closure on event DISPATCH, call your checkProtectedRoutes() method
// $eventManager->attach(\Laminas\Mvc\MvcEvent::EVENT_DISPATCH, function (\Laminas\Mvc\MvcEvent $e) use ($serviceManager) {
// $match = $e->getRouteMatch();
// $auth = $serviceManager->get(Middleware\AuthorizationMiddleware::class);
// $res = $auth->checkProtectedRoutes($match);
// if ($res instanceof Response) {
// return $res;
// }
// }, 1);
// Init ACL : could be improved
//$this->initAcl($event);
/* ACL */
// The following line instantiates the SessionManager and automatically
// makes the SessionManager the 'default' one.
// Pb de timeout de session
//$sessionManager = $serviceManager->get(\Laminas\Session\SessionManager::class);
//$serviceManager->get('ViewHelperManager')->get('FormElement')->addType(ReCaptcha::ELEMENT_TYPE, ReCaptcha::ELEMENT_TYPE);
// var_dump(session_save_path());
// exit;
}
// public function initAcl(\Laminas\Mvc\MvcEvent $event) {
// $acl = new \Laminas\Permissions\Acl\Acl();
// //$roles = '/config/module.acl.roles.php';
// $configRoles = $this->getConfigRoles();
// $roles = $configRoles['acl'];
// $allResources = array();
// foreach ($roles as $role => $resources) {
//
// $role = new \Laminas\Permissions\Acl\Role\GenericRole($role);
// $acl->addRole($role);
//
// $allResources = array_merge($resources, $allResources);
//
// //adding resources
// foreach ($resources as $resource) {
// // Edit 4
// if (!$acl->hasResource($resource))
// $acl->addResource(new \Laminas\Permissions\Acl\Resource\GenericResource($resource));
// }
// //adding restrictions
// foreach ($allResources as $resource) {
// $acl->allow($role, $resource);
// }
// }
// }
}