forked from extern/egroupware
Added the session_flags column to phpgw_sessions
This commit is contained in:
parent
e156a2626f
commit
c3e29775ab
@ -23,6 +23,13 @@
|
|||||||
|
|
||||||
/* $Id$ */
|
/* $Id$ */
|
||||||
|
|
||||||
|
/*
|
||||||
|
** Reserved session_flags
|
||||||
|
** A - anonymous session
|
||||||
|
** U - Force update of phpgw_info cache
|
||||||
|
** N - None, normal session
|
||||||
|
*/
|
||||||
|
|
||||||
class sessions
|
class sessions
|
||||||
{
|
{
|
||||||
var $login;
|
var $login;
|
||||||
@ -30,12 +37,12 @@
|
|||||||
var $account_id;
|
var $account_id;
|
||||||
var $account_lid;
|
var $account_lid;
|
||||||
var $account_domain;
|
var $account_domain;
|
||||||
|
var $session_flags;
|
||||||
var $sessionid;
|
var $sessionid;
|
||||||
var $kp3;
|
var $kp3;
|
||||||
var $data;
|
var $data;
|
||||||
var $db;
|
var $db;
|
||||||
var $db2;
|
var $db2;
|
||||||
var $variableNames;
|
|
||||||
|
|
||||||
/*************************************************************************\
|
/*************************************************************************\
|
||||||
* Constructor just loads up some defaults from cookies *
|
* Constructor just loads up some defaults from cookies *
|
||||||
@ -48,8 +55,6 @@
|
|||||||
$this->db2 = $phpgw->db;
|
$this->db2 = $phpgw->db;
|
||||||
$this->sessionid = $sessionid;
|
$this->sessionid = $sessionid;
|
||||||
$this->kp3 = $kp3;
|
$this->kp3 = $kp3;
|
||||||
// this want work because of crypto not ready at this point
|
|
||||||
#$this->restore();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*************************************************************************\
|
/*************************************************************************\
|
||||||
@ -88,8 +93,10 @@
|
|||||||
$db->query("select * from phpgw_sessions where session_id='" . $this->sessionid . "'",__LINE__,__FILE__);
|
$db->query("select * from phpgw_sessions where session_id='" . $this->sessionid . "'",__LINE__,__FILE__);
|
||||||
$db->next_record();
|
$db->next_record();
|
||||||
|
|
||||||
|
$this->session_flags = $db->f('session_flags');
|
||||||
|
|
||||||
// This is going to be replace with the session_flag field
|
// This is going to be replace with the session_flag field
|
||||||
if ($db->f('session_info') == '' || $db->f('session_info') == 'NULL')
|
if ($this->session_flags == 'U')
|
||||||
{
|
{
|
||||||
/* $this->account_lid = $db->f('session_lid');
|
/* $this->account_lid = $db->f('session_lid');
|
||||||
$phpgw_info['user']['sessionid'] = $this->sessionid;
|
$phpgw_info['user']['sessionid'] = $this->sessionid;
|
||||||
@ -124,6 +131,11 @@
|
|||||||
$this->update_dla();
|
$this->update_dla();
|
||||||
$this->account_id = $phpgw->accounts->name2id($this->account_lid);
|
$this->account_id = $phpgw->accounts->name2id($this->account_lid);
|
||||||
|
|
||||||
|
if (! $this->account_id)
|
||||||
|
{
|
||||||
|
return False;
|
||||||
|
}
|
||||||
|
|
||||||
if ($phpgw_info['server']['cache_phpgw_info'])
|
if ($phpgw_info['server']['cache_phpgw_info'])
|
||||||
{
|
{
|
||||||
$t = $this->appsession('phpgw_info_cache','phpgwapi');
|
$t = $this->appsession('phpgw_info_cache','phpgwapi');
|
||||||
@ -174,7 +186,7 @@
|
|||||||
if (!isset($phpgw_info['server']['cron_apps']) || ! $phpgw_info['server']['cron_apps'])
|
if (!isset($phpgw_info['server']['cron_apps']) || ! $phpgw_info['server']['cron_apps'])
|
||||||
{
|
{
|
||||||
$phpgw->db->query("delete from phpgw_sessions where session_dla <= '" . (time() - 7200)
|
$phpgw->db->query("delete from phpgw_sessions where session_dla <= '" . (time() - 7200)
|
||||||
. "'",__LINE__,__FILE__);
|
. "' and session_flags !='A'",__LINE__,__FILE__);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -255,10 +267,19 @@
|
|||||||
|
|
||||||
// If they are not useing cache, we need to store it somewhere
|
// If they are not useing cache, we need to store it somewhere
|
||||||
$this->appsession('password','phpgwapi',$this->passwd);
|
$this->appsession('password','phpgwapi',$this->passwd);
|
||||||
|
if ($phpgw->acl->check('anonymous',1,'phpgwapi'))
|
||||||
|
{
|
||||||
|
$session_flags = 'A';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$session_flags = 'N';
|
||||||
|
}
|
||||||
|
|
||||||
$phpgw->db->query("insert into phpgw_sessions values ('" . $this->sessionid
|
$phpgw->db->query("insert into phpgw_sessions values ('" . $this->sessionid
|
||||||
. "','".$login."','" . $this->getuser_ip() . "','"
|
. "','".$login."','" . $this->getuser_ip() . "','"
|
||||||
. $now . "','" . $now . "','".$info_string."')",__LINE__,__FILE__);
|
. $now . "','" . $now . "','".$info_string."','" . $session_flags
|
||||||
|
. "')",__LINE__,__FILE__);
|
||||||
|
|
||||||
$phpgw->db->query("insert into phpgw_access_log values ('" . $this->sessionid . "','"
|
$phpgw->db->query("insert into phpgw_access_log values ('" . $this->sessionid . "','"
|
||||||
. "$login','" . $this->getuser_ip() . "','$now','') ",__LINE__,__FILE__);
|
. "$login','" . $this->getuser_ip() . "','$now','') ",__LINE__,__FILE__);
|
||||||
@ -365,10 +386,8 @@
|
|||||||
|
|
||||||
// I added these into seperate steps for easier debugging
|
// I added these into seperate steps for easier debugging
|
||||||
$data = $phpgw->db->f('content');
|
$data = $phpgw->db->f('content');
|
||||||
$data = $phpgw->crypto->decrypt($data);
|
$data = $phpgw->common->decrypt($data);
|
||||||
# this is to much!! knecke
|
$data = stripslashes($data);
|
||||||
# please talk with me if you add it again
|
|
||||||
#$data = stripslashes($data);
|
|
||||||
|
|
||||||
return $data;
|
return $data;
|
||||||
} else {
|
} else {
|
||||||
@ -381,14 +400,12 @@
|
|||||||
// I added these into seperate steps for easier debugging
|
// I added these into seperate steps for easier debugging
|
||||||
$data = serialize($data);
|
$data = serialize($data);
|
||||||
$data = $phpgw->crypto->encrypt($data);
|
$data = $phpgw->crypto->encrypt($data);
|
||||||
$data = addslashes($data);
|
|
||||||
|
|
||||||
$phpgw->db->query("INSERT INTO phpgw_app_sessions (sessionid,loginid,app,location,content) "
|
$phpgw->db->query("INSERT INTO phpgw_app_sessions (sessionid,loginid,app,location,content) "
|
||||||
. "VALUES ('".$this->sessionid."','".$this->account_id."','".$appname
|
. "VALUES ('".$this->sessionid."','".$this->account_id."','".$appname
|
||||||
. "','".$location."','".$data."')",__LINE__,__FILE__);
|
. "','".$location."','".$data."')",__LINE__,__FILE__);
|
||||||
} else {
|
} else {
|
||||||
$data = $phpgw->crypto->encrypt(serialize($data));
|
$data = $phpgw->crypto->encrypt(serialize($data));
|
||||||
$data = addslashes($data);
|
|
||||||
$phpgw->db->query("update phpgw_app_sessions set content = '".$data."'"
|
$phpgw->db->query("update phpgw_app_sessions set content = '".$data."'"
|
||||||
. "where sessionid = '".$this->sessionid."'"
|
. "where sessionid = '".$this->sessionid."'"
|
||||||
. "and loginid = '".$this->account_id."' and app = '".$appname."'"
|
. "and loginid = '".$this->account_id."' and app = '".$appname."'"
|
||||||
@ -403,10 +420,8 @@
|
|||||||
{
|
{
|
||||||
global $phpgw;
|
global $phpgw;
|
||||||
|
|
||||||
$serializedData = $this->appsession('session');
|
$serializedData = $this->appsession();
|
||||||
#print "serializedData<br>$serializedData<br><br>";
|
|
||||||
$sessionData = unserialize($serializedData);
|
$sessionData = unserialize($serializedData);
|
||||||
#print "sessionData<br>$sessionData<br><br>";
|
|
||||||
|
|
||||||
if (is_array($sessionData))
|
if (is_array($sessionData))
|
||||||
{
|
{
|
||||||
@ -431,14 +446,13 @@
|
|||||||
reset($this->variableNames);
|
reset($this->variableNames);
|
||||||
while(list($key, $value) = each($this->variableNames))
|
while(list($key, $value) = each($this->variableNames))
|
||||||
{
|
{
|
||||||
if ($value == "registered")
|
if ($value == 'registered')
|
||||||
{
|
{
|
||||||
global $$key;
|
global $$key;
|
||||||
$sessionData[$key] = $$key;
|
$sessionData[$key] = $$key;
|
||||||
#print "save: ".$key." : ".$$key."<br>";
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$this->appsession('session','',$sessionData);
|
$this->appsession($sessionData);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -208,15 +208,16 @@
|
|||||||
$phpgw->db->Debug = 1;
|
$phpgw->db->Debug = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
$phpgw->db->Halt_On_Error = "no";
|
$phpgw->db->Halt_On_Error = 'no';
|
||||||
@$phpgw->db->query("select count(*) from phpgw_config");
|
@$phpgw->db->query("select count(*) from phpgw_config");
|
||||||
if (! @$phpgw->db->next_record()) {
|
if (! @$phpgw->db->next_record())
|
||||||
$setup_dir = ereg_replace($PHP_SELF,"index.php","setup/");
|
{
|
||||||
echo '<center><b>Fatal Error:</b> It appears that you have not created the database tables for '
|
$setup_dir = ereg_replace($PHP_SELF,'index.php','setup/');
|
||||||
.'phpGroupWare. Click <a href="' . $setup_dir . '">here</a> run for setup.</center>';
|
echo '<center><b>Fatal Error:</b> It appears that you have not created the database tables for '
|
||||||
exit;
|
.'phpGroupWare. Click <a href="' . $setup_dir . '">here</a> run for setup.</center>';
|
||||||
|
exit;
|
||||||
}
|
}
|
||||||
$phpgw->db->Halt_On_Error = "yes";
|
$phpgw->db->Halt_On_Error = 'yes';
|
||||||
|
|
||||||
/* Fill phpgw_info["server"] array */
|
/* Fill phpgw_info["server"] array */
|
||||||
$phpgw->db->query("select * from phpgw_config",__LINE__,__FILE__);
|
$phpgw->db->query("select * from phpgw_config",__LINE__,__FILE__);
|
||||||
|
@ -64,7 +64,7 @@
|
|||||||
}
|
}
|
||||||
if (isset($phpgw_info["navbar"]["admin"]) && isset($phpgw_info["user"]["preferences"]["common"]["show_currentusers"])) {
|
if (isset($phpgw_info["navbar"]["admin"]) && isset($phpgw_info["user"]["preferences"]["common"]["show_currentusers"])) {
|
||||||
$db = $phpgw->db;
|
$db = $phpgw->db;
|
||||||
$db->query("select count(*) from phpgw_sessions");
|
$db->query("select count(*) from phpgw_sessions where session_flags != 'A'");
|
||||||
$db->next_record();
|
$db->next_record();
|
||||||
$tpl->set_var("current_users",'<a href="' . $phpgw->link($phpgw_info["server"]["webserver_url"].'/admin/currentusers.php') . '"> '
|
$tpl->set_var("current_users",'<a href="' . $phpgw->link($phpgw_info["server"]["webserver_url"].'/admin/currentusers.php') . '"> '
|
||||||
. lang("Current users") . ': ' . $db->f(0) . '</a>');
|
. lang("Current users") . ': ' . $db->f(0) . '</a>');
|
||||||
|
@ -62,7 +62,7 @@
|
|||||||
|
|
||||||
if (isset($phpgw_info["navbar"]["admin"]) && isset($phpgw_info["user"]["preferences"]["common"]["show_currentusers"])) {
|
if (isset($phpgw_info["navbar"]["admin"]) && isset($phpgw_info["user"]["preferences"]["common"]["show_currentusers"])) {
|
||||||
$db = $phpgw->db;
|
$db = $phpgw->db;
|
||||||
$db->query("select count(*) from phpgw_sessions");
|
$db->query("select count(*) from phpgw_sessions where session_flags != 'A'");
|
||||||
$db->next_record();
|
$db->next_record();
|
||||||
$tpl->set_var("current_users",'<a href="' . $phpgw->link("/admin/currentusers.php") . '"> '
|
$tpl->set_var("current_users",'<a href="' . $phpgw->link("/admin/currentusers.php") . '"> '
|
||||||
. lang("Current users") . ': ' . $db->f(0) . '</a>');
|
. lang("Current users") . ': ' . $db->f(0) . '</a>');
|
||||||
|
Loading…
Reference in New Issue
Block a user