Beispiel #1
0
 /**
  * handles logging of error messages
  * 
  * @param $text	the message to log
  * @return void
  */
 public static function log_error($text)
 {
     /*
      * Always log errors.
      */
     //if(ADA_LOGGING_LEVEL & ADA_LOG_ERROR) {
     switch (ADA_LOG_ERROR_SELECTED_LOGGER) {
         case ADA_LOGGER_SCREEN_LOG:
             ADAScreenLogger::log_error($text);
             break;
         case ADA_LOGGER_FILE_LOG:
             ADAFileLogger::log_error($text, ADA_LOG_ERROR_FILE_LOG_OUTPUT_FILE);
             break;
         case ADA_LOGGER_NULL_LOG:
         default:
     }
     //}
 }
Beispiel #2
0
 /**
  * Handle this error
  *
  * @return void
  */
 public function handleError()
 {
     $action = $this->getAction();
     /**
      * Non chiamare translateFN sul messaggio di errore.
      */
     /**
      * Error logging
      */
     if ($action & ADA_ERROR_LOG_TO_FILE) {
         ADALogger::log('ADA ERROR LOG TO FILE');
         ADAFileLogger::log_error($this->asTextToLogInFile());
     }
     if ($action & ADA_ERROR_LOG_TO_HTML_COMMENT) {
         ADALogger::log('ADA ERROR LOG TO HTML COMMENT');
     }
     if ($action & ADA_ERROR_LOG_TO_HTML) {
         ADAScreenLogger::log_error($this->asTextToLogInHTML());
     }
     if ($action & ADA_ERROR_LOG_TO_EMAIL) {
         ADALogger::log('ADA ERROR LOG TO EMAIL');
         // TODO: log via email
         /*
          * Richiamare classe mailer per il log, passando come contenuto
          * $this->asTextToLogInFile()
          */
     }
     if ($action & ADA_ERROR_LOG_TO_DB) {
         ADALogger::log('ADA ERROR LOG TO DB');
         // TODO: log su database
         /*
          * Richiamare classe MultiPort per il log su tabella DB passando
          * come argomento $this->asArrayToLogInDB()
          */
     }
     /**
      * Redirect user
      */
     if (is_null($this->redirectTo)) {
         if ($action & ADA_ERROR_REDIRECT_TO_LOGIN) {
             // FIXME: login location == index?
             header('Location:' . HTTP_ROOT_DIR);
             exit;
         }
         if ($action & ADA_ERROR_REDIRECT_TO_HOMEPAGE) {
             $sess_userObj = $_SESSION['sess_userObj'];
             if ($sess_userObj instanceof ADALoggableUser) {
                 header('Location:' . $sess_userObj->getHomePage());
                 exit;
             } else {
                 header('Location:' . HTTP_ROOT_DIR);
                 exit;
             }
         }
         if ($action & ADA_ERROR_REDIRECT_TO_ERROR_PAGE) {
             header('Location:' . HTTP_ROOT_DIR . '/error.php');
             exit;
         }
     } else {
         /*
          * Controlliamo se il programmatore ha specificato un indirizzo commpleto
          * contenente HTTP_ROOT_DIR, altrimenti lo appende.
          */
         if (strncmp(HTTP_ROOT_DIR, $this->redirectTo, sizeof(HTTP_ROOT_DIR)) == 0) {
             header('Location: ' . $this->redirectTo);
             exit;
         }
         header('Location:' . HTTP_ROOT_DIR . '/' . $this->redirectTo);
         exit;
     }
 }