Example #1
0
 public function __construct()
 {
     parent::__construct();
     header('Content-Type: text/html; charset=' . $this->getCharacterSet());
     setlocale(LC_TIME, explode(',', $this->getLocale()));
     $this->loadIniFile();
     $this->loadIniFile(OSCOM::getSiteApplication() . '.php');
 }
 public static function import($filename)
 {
     if (!is_resource(self::$_dbh) && !self::connect()) {
         return false;
     }
     $error_log = file($filename);
     unlink($filename);
     foreach ($error_log as $error) {
         $error = Language::toUTF8($error);
         if (preg_match('/^\\[([0-9]{2})-([A-Za-z]{3})-([0-9]{4}) ([0-9]{2}):([0-5][0-9]):([0-5][0-9])\\] (.*)$/', $error)) {
             $timestamp = DateTime::getTimestamp(substr($error, 1, 20), 'd-M-Y H:i:s');
             $message = substr($error, 23);
             $Qinsert = self::$_dbh->prepare('insert into error_log (timestamp, message) values (:timestamp, :message)');
             $Qinsert->bindInt(':timestamp', $timestamp);
             $Qinsert->bindValue(':message', $message);
             $Qinsert->execute();
         }
     }
 }