projects
/
platal.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge commit 'origin/fusionax' into account
[platal.git]
/
classes
/
platallogger.php
diff --git
a/classes/platallogger.php
b/classes/platallogger.php
index
a7a8d02
..
447ff9e
100644
(file)
--- a/
classes/platallogger.php
+++ b/
classes/platallogger.php
@@
-1,6
+1,6
@@
<?php
/*
<?php
/*
- * Copyright (C) 2003-200
4
Polytechnique.org
+ * Copyright (C) 2003-200
9
Polytechnique.org
* http://opensource.polytechnique.org/
*
* This program is free software; you can redistribute it and/or modify
* http://opensource.polytechnique.org/
*
* This program is free software; you can redistribute it and/or modify
@@
-45,11
+45,8
@@
class PlatalLogger extends PlLogger
$this->session = $this->writeSession($uid, $suid);
// retrieve available actions
$this->session = $this->writeSession($uid, $suid);
// retrieve available actions
- $res = XDB::iterRow("SELECT id, text FROM logger.actions");
-
- while (list($action_id, $action_text) = $res->next()) {
- $this->actions[$action_text] = $action_id;
- }
+ $this->actions = XDB::fetchAllAssoc('text', 'SELECT id, text
+ FROM logger.actions');
}
/** Creates a new session entry in database and return its ID.
}
/** Creates a new session entry in database and return its ID.
@@
-74,8
+71,8
@@
class PlatalLogger extends PlLogger
$proxy = 'proxy';
}
$proxy = 'proxy';
}
- XDB::execute("INSERT INTO logger.sessions
-
SET
uid={?}, host={?}, ip={?}, forward_ip={?}, forward_host={?}, browser={?}, suid={?}, flags={?}",
+ XDB::execute("INSERT INTO
logger.sessions
+
SET
uid={?}, host={?}, ip={?}, forward_ip={?}, forward_host={?}, browser={?}, suid={?}, flags={?}",
$uid, $host, ip_to_uint($ip), ip_to_uint($forward_ip), $forward_host, $browser, $suid, $proxy);
if ($forward_ip) {
$this->proxy_ip = $ip;
$uid, $host, ip_to_uint($ip), ip_to_uint($forward_ip), $forward_host, $browser, $suid, $proxy);
if ($forward_ip) {
$this->proxy_ip = $ip;
@@
-87,15
+84,18
@@
class PlatalLogger extends PlLogger
$this->host = $host;
}
$this->host = $host;
}
- $id = XDB::insertId();
- if ($uid and !$suid) {
- XDB::execute('REPLACE INTO logger.last_sessions (uid, id)
- VALUES ({?}, {?})',
- $uid, $id);
- }
- return $id;
+ return XDB::insertId();
}
}
+ public function saveLastSession() {
+ XDB::execute('REPLACE INTO logger.last_sessions (uid, id)
+ VALUES ({?}, {?})',
+ $this->uid, $this->session);
+ }
+
+ public function isValid($uid) {
+ return $uid == $this->uid;
+ }
/** Logs an action and its related data.
*
/** Logs an action and its related data.
*
@@
-106,8
+106,8
@@
class PlatalLogger extends PlLogger
public function log($action, $data = null)
{
if (isset($this->actions[$action])) {
public function log($action, $data = null)
{
if (isset($this->actions[$action])) {
- XDB::execute("INSERT INTO logger.events
-
SET
session={?}, action={?}, data={?}",
+ XDB::execute("INSERT INTO
logger.events
+
SET
session={?}, action={?}, data={?}",
$this->session, $this->actions[$action], $data);
} else {
trigger_error("PlLogger: unknown action, $action", E_USER_WARNING);
$this->session, $this->actions[$action], $data);
} else {
trigger_error("PlLogger: unknown action, $action", E_USER_WARNING);