Ejemplo n.º 1
0
 public function Authenticate()
 {
     $Credentials = Input::getVar('Login', 'POST');
     $Authentication = false;
     $this->setLanguageFile();
     if (count($Credentials) == 2 && isset($Credentials['Email']) && isset($Credentials['Password'])) {
         if (Factory::getUser()->authenticate($Credentials['Email'], $Credentials['Password'], true)) {
             $Authentication = true;
         }
     }
     if ($Authentication) {
         Factory::getApplication()->redirectHome();
     } else {
         SystemMessage::addMessage('COM_AUTHENTICATION', SystemMessage::MSG_ERROR, 'COM_LOGIN-FAILED');
         if (isset($Credentials['Email'])) {
             Factory::getApplication()->redirect('Authentication/Login/', ['Login[Email]' => $Credentials['Email']]);
         } else {
             Factory::getApplication()->redirectLogin();
         }
     }
 }
Ejemplo n.º 2
0
 /**
  * @param PDOException $exception
  * @param null|string  $SSQL
  * @return bool
  */
 public static function catchException(PDOException $exception, $SSQL = null)
 {
     if (count($exception->errorInfo) == 3) {
         $DriverCode = $exception->errorInfo[1];
         $DriverMessage = htmlentities($exception->errorInfo[2]);
     } else {
         $DriverCode = 'PDO_ENGINE';
         $DriverMessage = htmlentities($exception->getMessage());
     }
     Factory::getLogger()->warning('DBH Exception: DriverCode: {DriverCode} Message: {Message} File: {File} ({Line})', ['DriverCode' => $DriverCode, 'Message' => $DriverMessage, 'Line' => $exception->getLine(), 'File' => $exception->getFile()]);
     if ($SSQL) {
         array_push(self::$arErrorDebugSSQL, $SSQL);
     }
     if (self::inDebug()) {
         SystemMessage::addMessage('_DBH', 'alert', $DriverMessage, false);
     }
     return true;
 }
Ejemplo n.º 3
0
 private function checkNotNulls()
 {
     if ($this->objPDO->getAttribute(PDO::ATTR_ERRMODE) != PDO::ERRMODE_EXCEPTION) {
         foreach ($this->arModifiedFields as $Key => $V) {
             $NotNull = isset($this->arRules[$Key]) && is_array($this->arRules[$Key]) ? $this->arRules[$Key][1] : false;
             if ($NotNull && is_null($this->{$Key})) {
                 $Message = "Field '{$Key}' can not be null";
                 if (!Debug::inDebug()) {
                     SystemMessage::addMessage('_system', SystemMessage::MSG_WARNING, $Message, false);
                 }
                 throw new PDOException($Message);
             }
         }
     }
 }