Ignore:
Timestamp:
Aug 21, 2013, 9:27:56 PM (11 years ago)
Author:
chronos
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Modules/Log/Log.php

    r567 r568  
    1313    $this->License = 'GNU/GPL';
    1414    $this->Description = 'Log various application events';
    15     $this->Dependencies = array();
     15    $this->Dependencies = array('Error');
    1616   
    1717    $this->Excludes = array();
     
    2121  {
    2222        $this->System->RegisterPage('log.php', 'PageLog');
     23        $this->System->ModuleManager->Modules['Error']->OnError[] = array($this, 'DoAddItem');
    2324  } 
     25 
     26  function DoAddItem($Message)
     27  {
     28        WriteLog($Message, LOG_TYPE_ERROR);
     29  }
    2430}
    2531
     
    4147
    4248        if(!isset($_SERVER['REMOTE_ADDR'])) $IP = 'Konzole';
    43         else $IP = addslashes($_SERVER['REMOTE_ADDR']);
     49          else $IP = addslashes($_SERVER['REMOTE_ADDR']);
    4450
    4551        if(!is_null($User->Id)) $UserId = $User->Id;
    46         else $UserId = 'NULL';
    47         $Query = 'INSERT INTO `Log` ( `User` , `Type` , `Text` , `Date` , `IP`, `URL` )
    48         VALUES ('.$UserId.', '.$Type.', "'.addslashes($Text).'", NOW(), "'.$IP.'", "'.$_SERVER['REQUEST_URI'].'")';
     52          else $UserId = 'NULL';
     53        $Query = 'INSERT INTO `Log` ( `User` , `Type` , `Text` , `Date` , `IP`, `URL` ) '.
     54          'VALUES ('.$UserId.', '.$Type.', "'.addslashes($Text).'", NOW(), "'.$IP.'", "'.$_SERVER['REQUEST_URI'].'")';
    4955        $System->Database->query($Query);
     56        echo($Query);
    5057}
    5158
Note: See TracChangeset for help on using the changeset viewer.