コード例 #1
0
ファイル: Logger.php プロジェクト: falmar/Epsilon
 /**
  * Logs with an arbitrary level.
  *
  * @param mixed  $level
  * @param string $message
  * @param array  $context
  * @return null
  */
 public function log($level, $message, array $context = [])
 {
     $message = $this->interpolateMessage($message, $context);
     if (Config::APP_DEBUG) {
         echo $message, PHP_EOL;
     }
     if ($level == LogLevel::EMERGENCY || $level == LogLevel::ALERT || !Factory::getDBH()) {
         if (is_writeable('error_log')) {
             $handle = fopen('error_log', 'a');
             fwrite($handle, $message . PHP_EOL);
             fclose($handle);
         }
         exit;
     } else {
         array_push($this->logs, ['UserID' => Factory::getUser()->get('ID'), 'SessionID' => Factory::getSession()->getPHP_SessionID(), 'ApplicationID' => Factory::getApplication()->getApplicationID(), 'Level' => $level, 'ErrorString' => $message, 'RegisteredDate' => Utility::getDateForDB()]);
     }
 }
コード例 #2
0
ファイル: Application.php プロジェクト: falmar/Epsilon
 public function getRelativePath()
 {
     if (!$this->RelativePath) {
         $this->RelativePath = Utility::getRelativePath(EPSILON_PATH);
     }
     return $this->RelativePath;
 }
コード例 #3
0
ファイル: Controller.php プロジェクト: falmar/Epsilon
 /**
  * Depend on the path in disk get the relative path on server
  * e.g http://localhost.com/etc/etc
  *
  * @return string
  */
 protected function getRelativePath()
 {
     if (!isset($this->RelativePath)) {
         $this->RelativePath = Utility::getRelativePath($this->getPath());
     }
     return $this->RelativePath;
 }
コード例 #4
0
ファイル: SystemMessage.php プロジェクト: falmar/Epsilon
 /**
  * @param           $Element
  * @param           $Type
  * @param           $Message
  * @param bool|true $Language
  */
 public static function addMessage($Element, $Type, $Message, $Language = true)
 {
     if ($Language) {
         $Message = Factory::getLanguage()->_($Message);
     }
     try {
         $Message = new SystemMessage(Factory::getDBH(), ['UserID' => Factory::getUser()->get('ID'), 'SessionID' => Factory::getSession()->getPHP_SessionID(), 'Element' => $Element, 'Message' => $Message, 'Type' => $Type, 'Viewed' => 0, 'RegisteredDate' => Utility::getDateForDB()], false);
         $Message->save();
     } catch (PDOException $e) {
         Factory::getDBH()->catchException($e);
     }
 }
コード例 #5
0
ファイル: User.php プロジェクト: falmar/Epsilon
 public function impress()
 {
     if (!$this->isGuest()) {
         $this->set('LastLogin', Utility::getDateForDB());
         $this->save();
     }
 }