Beispiel #1
0
 public function sign_in()
 {
     $this->setTitle("Sign in");
     //todo redirect if logged
     $authHandler = Application::getInstance()->authenticationHandler;
     $f = new Form('signin');
     if ($f->isValid()) {
         $data = $f->getValues();
         $authHandlerInst = call_user_func_array(array($authHandler, 'getInstance'), array());
         if ($authHandlerInst->setUserSession($data["login_user"], $data["password_user"])) {
             Go::to();
         } else {
             Logs::write("Tentative de connexion au front <" . $data["login_user"] . ":" . $data["password_user"] . ">", Logs::WARNING);
             $this->addContent("error", "Le login ou le mot de passe est incorrect");
         }
     } else {
         trace("aaaah");
         trace($f->getError());
         $this->addContent('error', $f->getError());
     }
     $this->addForm('sign_in', $f);
 }
Beispiel #2
0
 /**
  * Gestionnaire des erreurs de scripts Php
  * Peut stopper l'application en cas d'erreur bloquante
  * @param Number $pErrorLevel						Niveau d'erreur
  * @param String $pErrorMessage						Message renvoyé
  * @param String $pErrorFile						Adresse du fichier qui a déclenché l'erreur
  * @param Number $pErrorLine						Ligne où se trouve l'erreur
  * @param String $pErrorContext						Contexte
  * @return void
  */
 public static function errorHandler($pErrorLevel, $pErrorMessage, $pErrorFile, $pErrorLine, $pErrorContext)
 {
     $stopApplication = false;
     switch ($pErrorLevel) {
         case E_ERROR:
         case E_CORE_ERROR:
         case E_COMPILE_ERROR:
         case E_USER_ERROR:
             $stopApplication = true;
             $type = "error";
             break;
         case E_WARNING:
         case E_CORE_WARNING:
         case E_COMPILE_WARNING:
         case E_USER_WARNING:
             $type = "warning";
             break;
         case E_NOTICE:
         case E_USER_NOTICE:
             $type = "notice";
             break;
         default:
         case self::E_USER_EXCEPTION:
             $stopApplication = true;
             $type = "error";
             break;
     }
     $pErrorFile = pathinfo($pErrorFile);
     $pErrorFile = $pErrorFile["basename"];
     if (preg_match('/href=/', $pErrorMessage, $matches)) {
         $pErrorMessage = preg_replace('/href=\'([a-z\\.\\-\\_]*)\'/', 'href=\'http://www.php.net/$1\' target=\'_blank\'', $pErrorMessage);
     }
     self::addToConsole($type, $pErrorMessage, $pErrorFile, $pErrorLine);
     if ($stopApplication) {
         if (!Core::debug()) {
             Logs::write($pErrorMessage . " " . $pErrorFile . " " . $pErrorLine . " " . $pErrorContext, $pErrorLevel);
         }
         Header::content_type("text/html", Configuration::$global_encoding);
         self::$open = true;
         self::render(true, true);
         Core::endApplication();
     }
 }