Page Menu
Home
In-Portal Phabricator
Search
Configure Global Search
Log In
Files
F1092823
in-portal
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Mon, Aug 11, 1:40 AM
Size
7 KB
Mime Type
text/x-diff
Expires
Wed, Aug 13, 1:40 AM (14 h, 6 m)
Engine
blob
Format
Raw Data
Handle
707787
Attached To
rINP In-Portal
in-portal
View Options
Index: trunk/kernel/units/general/inp_ses_storage.php
===================================================================
--- trunk/kernel/units/general/inp_ses_storage.php (revision 2783)
+++ trunk/kernel/units/general/inp_ses_storage.php (revision 2784)
@@ -1,102 +1,102 @@
<?php
class InpSession extends Session
{
function Init($prefix,$special)
{
$this->SessionTimeout = $this->Application->ConfigValue('SessionTimeout');
if (BASE_PATH == '') {
$path = '/';
}
else {
$path = BASE_PATH;
}
if ( defined('ADMIN') && ADMIN )
{
$path = rtrim($path, '/');
$path .= '/admin';
}
$this->SetCookiePath( $path );
$ses_mode = $this->Application->ConfigValue('CookieSessions');
if ($ses_mode == 2) $mode = smAUTO;
if ($ses_mode == 1) $mode = smCOOKIES_ONLY;
if ($ses_mode == 0) $mode = smGET_ONLY;
if ( defined('ADMIN') && ADMIN ) $mode = smAUTO;
$this->SetMode( $mode );
- $this->SetCookieDomain( SERVER_NAME );
+ $this->SetCookieDomain( $this->Application->IsAdmin() ? SERVER_NAME : '.'.SERVER_NAME );
parent::Init($prefix,$special);
if (!defined('ADMIN')) {
$group_list = $this->Application->ConfigValue('User_GuestGroup').','.$this->Application->ConfigValue('User_LoggedInGroup');
$this->SetField('GroupList', $group_list);
}
}
}
class InpSessionStorage extends SessionStorage {
function Init($prefix,$special)
{
parent::Init($prefix,$special);
$this->setTableName(TABLE_PREFIX.'UserSession');
$this->SessionDataTable = TABLE_PREFIX.'SessionData';
$this->setIDField('SessionKey');
$this->TimestampField = 'LastAccessed';
$this->DataValueField = 'VariableValue';
$this->DataVarField = 'VariableName';
}
function LocateSession($sid)
{
$query = ' SELECT '.$this->TimestampField.' FROM '.$this->TableName.' WHERE '.$this->IDField.' = '.$this->Conn->qstr($sid);
$result = $this->Conn->GetOne($query);
if($result===false) return false;
$this->Expiration = $result + $this->SessionTimeout;
return true;
}
function UpdateSession(&$session)
{
$query = ' UPDATE '.$this->TableName.' SET '.$this->TimestampField.' = unix_timestamp() WHERE '.$this->IDField.' = '.$this->Conn->qstr($session->SID);
$this->Conn->Query($query);
}
function StoreSession(&$session)
{
parent::StoreSession($session);
$this->SetField($session, 'IpAddress', $_SERVER['REMOTE_ADDR']);
$this->SetField($session, 'GroupList', $this->Application->ConfigValue('User_GuestGroup'));
}
function GetExpiredSIDs()
{
$query = ' SELECT '.$this->IDField.' FROM '.$this->TableName.' WHERE '.time().' - '.$this->TimestampField.' > '.$this->SessionTimeout;
$ret = $this->Conn->GetCol($query);
if($ret) $this->DeleteEditTables();
return $ret;
}
function DeleteEditTables()
{
$tables = $this->Conn->GetCol('SHOW TABLES');
$mask_edit_table = '/'.TABLE_PREFIX.'ses_(.*)_edit_(.*)/';
$mask_search_table = '/'.TABLE_PREFIX.'ses_(.*)_(.*)/';
$sql='SELECT COUNT(*) FROM '.$this->TableName.' WHERE '.$this->IDField.' = \'%s\'';
foreach($tables as $table)
{
if( preg_match($mask_edit_table,$table,$rets) || preg_match($mask_search_table,$table,$rets) )
{
$sid=$rets[1];
$is_alive = $this->Conn->GetOne( sprintf($sql,$sid) );
if(!$is_alive) $this->Conn->Query('DROP TABLE IF EXISTS '.$table);
}
}
}
}
?>
\ No newline at end of file
Property changes on: trunk/kernel/units/general/inp_ses_storage.php
___________________________________________________________________
Modified: cvs2svn:cvs-rev
## -1 +1 ##
-1.9
\ No newline at end of property
+1.10
\ No newline at end of property
Index: trunk/core/units/general/inp_ses_storage.php
===================================================================
--- trunk/core/units/general/inp_ses_storage.php (revision 2783)
+++ trunk/core/units/general/inp_ses_storage.php (revision 2784)
@@ -1,102 +1,102 @@
<?php
class InpSession extends Session
{
function Init($prefix,$special)
{
$this->SessionTimeout = $this->Application->ConfigValue('SessionTimeout');
if (BASE_PATH == '') {
$path = '/';
}
else {
$path = BASE_PATH;
}
if ( defined('ADMIN') && ADMIN )
{
$path = rtrim($path, '/');
$path .= '/admin';
}
$this->SetCookiePath( $path );
$ses_mode = $this->Application->ConfigValue('CookieSessions');
if ($ses_mode == 2) $mode = smAUTO;
if ($ses_mode == 1) $mode = smCOOKIES_ONLY;
if ($ses_mode == 0) $mode = smGET_ONLY;
if ( defined('ADMIN') && ADMIN ) $mode = smAUTO;
$this->SetMode( $mode );
- $this->SetCookieDomain( SERVER_NAME );
+ $this->SetCookieDomain( $this->Application->IsAdmin() ? SERVER_NAME : '.'.SERVER_NAME );
parent::Init($prefix,$special);
if (!defined('ADMIN')) {
$group_list = $this->Application->ConfigValue('User_GuestGroup').','.$this->Application->ConfigValue('User_LoggedInGroup');
$this->SetField('GroupList', $group_list);
}
}
}
class InpSessionStorage extends SessionStorage {
function Init($prefix,$special)
{
parent::Init($prefix,$special);
$this->setTableName(TABLE_PREFIX.'UserSession');
$this->SessionDataTable = TABLE_PREFIX.'SessionData';
$this->setIDField('SessionKey');
$this->TimestampField = 'LastAccessed';
$this->DataValueField = 'VariableValue';
$this->DataVarField = 'VariableName';
}
function LocateSession($sid)
{
$query = ' SELECT '.$this->TimestampField.' FROM '.$this->TableName.' WHERE '.$this->IDField.' = '.$this->Conn->qstr($sid);
$result = $this->Conn->GetOne($query);
if($result===false) return false;
$this->Expiration = $result + $this->SessionTimeout;
return true;
}
function UpdateSession(&$session)
{
$query = ' UPDATE '.$this->TableName.' SET '.$this->TimestampField.' = unix_timestamp() WHERE '.$this->IDField.' = '.$this->Conn->qstr($session->SID);
$this->Conn->Query($query);
}
function StoreSession(&$session)
{
parent::StoreSession($session);
$this->SetField($session, 'IpAddress', $_SERVER['REMOTE_ADDR']);
$this->SetField($session, 'GroupList', $this->Application->ConfigValue('User_GuestGroup'));
}
function GetExpiredSIDs()
{
$query = ' SELECT '.$this->IDField.' FROM '.$this->TableName.' WHERE '.time().' - '.$this->TimestampField.' > '.$this->SessionTimeout;
$ret = $this->Conn->GetCol($query);
if($ret) $this->DeleteEditTables();
return $ret;
}
function DeleteEditTables()
{
$tables = $this->Conn->GetCol('SHOW TABLES');
$mask_edit_table = '/'.TABLE_PREFIX.'ses_(.*)_edit_(.*)/';
$mask_search_table = '/'.TABLE_PREFIX.'ses_(.*)_(.*)/';
$sql='SELECT COUNT(*) FROM '.$this->TableName.' WHERE '.$this->IDField.' = \'%s\'';
foreach($tables as $table)
{
if( preg_match($mask_edit_table,$table,$rets) || preg_match($mask_search_table,$table,$rets) )
{
$sid=$rets[1];
$is_alive = $this->Conn->GetOne( sprintf($sql,$sid) );
if(!$is_alive) $this->Conn->Query('DROP TABLE IF EXISTS '.$table);
}
}
}
}
?>
\ No newline at end of file
Property changes on: trunk/core/units/general/inp_ses_storage.php
___________________________________________________________________
Modified: cvs2svn:cvs-rev
## -1 +1 ##
-1.9
\ No newline at end of property
+1.10
\ No newline at end of property
Event Timeline
Log In to Comment