X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=classes%2Fcorelogger.php;h=611a7b1377141afe570c9903eb1bac4c0fca7d97;hb=e31c2e8a5cb7c811cbab5e248936ec95bd37b124;hp=c4b909b7f9216bada0e8c9824ba3f813a5e543ea;hpb=9ffe0e777ce0b2cd9f9fd6ff52390d826c368db5;p=platal.git diff --git a/classes/corelogger.php b/classes/corelogger.php index c4b909b..611a7b1 100644 --- a/classes/corelogger.php +++ b/classes/corelogger.php @@ -22,19 +22,24 @@ class CoreLogger { /** user id */ - private $uid; + public $uid; /** id of the session */ private $session; /** list of available actions */ private $actions; + public $ip; + public $host; + public $proxy_ip; + public $proxy_host; + /** The constructor, creates a new entry in the sessions table * * @param $uid the id of the logged user * @param $suid the id of the administrator who has just su'd to the user * @return VOID */ - public function __construct($uid, $suid = null) + public function __construct($uid, $suid = 0) { // write the session entry $this->uid = $uid; @@ -54,7 +59,7 @@ class CoreLogger * @param $suid the id of the administrator who has just su'd to the user * @return session the session id */ - private function writeSession($uid, $suid = null) + private function writeSession($uid, $suid = 0) { $ip = $_SERVER['REMOTE_ADDR']; $host = strtolower(gethostbyaddr($_SERVER['REMOTE_ADDR'])); @@ -73,6 +78,15 @@ class CoreLogger XDB::execute("INSERT INTO logger.sessions SET uid={?}, host={?}, ip={?}, forward_ip={?}, forward_host={?}, browser={?}, suid={?}, flags={?}", $uid, $host, $ip, $forward_ip, $forward_host, $browser, $suid, $proxy); + if ($forward_ip) { + $this->proxy_ip = $ip; + $this->proxy_host = $host; + $this->ip = $forward_ip; + $this->host = $forward_host; + } else { + $this->ip = $ip; + $this->host = $host; + } return XDB::insertId(); }