예제 #1
0
 public function call(\Raptor\Raptor $app)
 {
     if (!$app->request()->isXhr()) {
         \Raptor\Raptor::getInstance()->hook('slim.after', array($this, 'createScript'));
     }
     return false;
 }
예제 #2
0
 /**
  * 
  * 
  */
 public function handleAuthenticationRequest(&$message, $conf)
 {
     if ($this->app->request()->isFormData() and !$this->app->request()->isXhr()) {
         if ($this->app->request()->post('username') and $this->app->request()->post('password')) {
             $username = $this->app->request()->post('username');
             $pass = $this->app->request()->post('password');
             $passCompare = $conf['raptor']['adminpass'];
             $obj = \Raptor\Configuration\ConfigurationLoader::getHash($passCompare);
             if ($obj->valid) {
                 $passCompare = \Raptor\Security\SecureHash::verify($pass, $obj->password);
             } else {
                 $passCompare = $pass === $conf['raptor']['adminpass'];
             }
             if ($conf['raptor']['admin'] == $username and $passCompare) {
                 $this->app->getSession()->set('admin_auth', true);
                 $this->app->getSession()->set('admin_auth_user', $username);
                 $this->app->redirect('');
             } else {
                 $message = "Wrong password or username";
             }
         } else {
             $message = "Wrong password or username";
         }
     }
 }
예제 #3
0
 public function call(\Raptor\Raptor $app)
 {
     if (!$app->config('debug')) {
         return false;
     }
     \Raptor\Raptor::getInstance()->hook('slim.after', array($this, 'registerLastPerformance'));
     if (!$app->request()->isXhr()) {
         \Raptor\Raptor::getInstance()->hook('slim.after', array($this, 'createPanel'));
     }
     return false;
 }
예제 #4
0
 public function call(\Raptor\Raptor $app)
 {
     /**
      * Add to the inyector container the Interactive Instance
      * 
      */
     $app->getInyector()->add(new \Raptor2\InteractiveBundle\Manager\InteractiveManager());
     $user = '******';
     if ($app->getSecurity()->isAuthenticated()) {
         $array = $app->getSecurity()->getUser();
         $user = $array['username'];
     }
     $store = json_encode(array('reject' => false, 'tutoriales' => array('interactive' => 'This is interactive')));
     if ($app->getCookie('Interactive_' . $user, true) == NULL) {
         $app->setCookie('Interactive_' . $user, $store, strtotime('+1 year'));
     } else {
         $store = $app->getCookie('Interactive_' . $user, true);
     }
     $app->setViewPlugin('core_library_outside', $app->render("@InteractiveBundle/core/core.js.twig", array('url' => $app->request()->getUrl() . $app->request()->getScriptName() . '/interactive/core', 'perfil' => $store)));
     /**
      * Return false to continue the flow of routing
      */
     return false;
 }
예제 #5
0
 /**
  * Pobla los atributos de la clase o objeto especificado con los parametros provenientes en el request actual
  * 
  * Si el primer parametro es una clase el colector crea un instancia de esta.
  * Si el primer paremtro es un objeto lo usa para poblar segun los parametros del request.
  * 
  * @param string/object $class clase u objeto a poblar
  * @param array $matcher un array con el macheo de parametros que no conciden con los atributos de la clase. ejemplo array('nombre'=>'nombre_c') en el ejemplo nombre es el parametro que viene en el request y nombre_c el que esta en la clase, el colector pone el valor de nombre en nombre_c
  * @return mixed
  */
 public function collector($class, $matcher = array())
 {
     $classTo = $class;
     if (!is_object($classTo)) {
         $alias = new ItemList(explode(':', $classTo));
         if ($alias->size() > 1) {
             $classTo = $alias->get(0);
             $namespace = $this->getStore()->getManager()->getConfiguration()->getEntityNamespace($classTo);
             $namespace .= '\\' . $alias->get(1);
             $classTo = $namespace;
         }
         $classTo = new $classTo();
     }
     return Collector::run($classTo, new ItemList($this->app->request()->params()), $matcher);
 }
예제 #6
0
 public function init(\Raptor\Raptor $app)
 {
     //        Place your init code here
     /**
      * This make Raptor load the control panel from the root path
      * if the config mode is debug wich is taken by Raptor like
      * DEV mode
      * 
      * PROBABLY YOU NEED TO REMOVE THIS IN PRODUCTION MODE
      */
     if ($app->config('debug')) {
         $app->any('/', function () use($app) {
             $app->redirect($app->request()->getScriptName() . '/raptor');
         });
     }
 }