Page Menu
Home
In-Portal Phabricator
Search
Configure Global Search
Log In
Files
F1068300
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
Thu, Jul 17, 1:43 PM
Size
18 KB
Mime Type
text/x-diff
Expires
Sat, Jul 19, 1:43 PM (20 h, 38 m)
Engine
blob
Format
Raw Data
Handle
691351
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 3886)
+++ trunk/kernel/units/general/inp_ses_storage.php (revision 3887)
@@ -1,117 +1,117 @@
<?php
class InpSession extends Session
{
function Init($prefix,$special)
{
$this->SessionTimeout = $this->Application->ConfigValue('SessionTimeout');
$path = (BASE_PATH == '') ? '/' : BASE_PATH;
if ( $this->Application->IsAdmin() ) $path = rtrim($path, '/').'/admin';
$this->SetCookiePath($path);
$cookie_name = $this->Application->ConfigValue('SessionCookieName');
$this->SetCookieName($cookie_name ? $cookie_name : 'sid');
$this->SetCookieDomain(SERVER_NAME);
if( $this->Application->IsAdmin() )
{
$mode = constOn('IS_INSTALL') ? smCOOKIES_ONLY : smAUTO;
}
else
{
$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;
}
$this->SetMode($mode);
parent::Init($prefix,$special);
if( !$this->Application->IsAdmin() && $this->GetField('PortalUserId') <= 0 )
{
$group_list = $this->Application->ConfigValue('User_GuestGroup').','.$this->Application->ConfigValue('User_LoggedInGroup');
$this->SetField('GroupId', $this->Application->ConfigValue('User_GuestGroup'));
$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, $additional_fields = Array())
{
- $fields_hash = Array( 'PortalUserId' => -2, // Guest
+ $fields_hash = Array( 'PortalUserId' => $this->Application->IsAdmin() ? 0 : -2, // Guest
'Language' => $this->Application->GetDefaultLanguageId(),
'Theme' => $this->Application->GetDefaultThemeId(),
'IpAddress' => $_SERVER['REMOTE_ADDR'],
'GroupList' => $this->Application->ConfigValue('User_GuestGroup'),
'CurrentTempKey'=> $session->SID,
);
parent::StoreSession($session, $fields_hash);
}
function GetExpiredSIDs()
{
$query = ' SELECT '.$this->IDField.' FROM '.$this->TableName.' WHERE '.adodb_mktime().' - '.$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.18
\ No newline at end of property
+1.19
\ No newline at end of property
Index: trunk/admin/logs/session_list.php
===================================================================
--- trunk/admin/logs/session_list.php (revision 3886)
+++ trunk/admin/logs/session_list.php (revision 3887)
@@ -1,264 +1,266 @@
<?php
##############################################################
##In-portal ##
##############################################################
## In-portal ##
##Intechnic Corporation ##
##All Rights Reserved, 1998-2002 ##
## ##
##No portion of this code may be copied, reproduced or ##
## otherwise redistributed without proper written ##
## consent of Intechnic Corporation. Violation will ##
## result in revocation of the license and support ##
## privileges along maximum prosecution allowed by law. ##
##############################################################
// new startup: begin
define('REL_PATH', 'admin/logs');
$relation_level = count( explode('/', REL_PATH) );
define('FULL_PATH', realpath(dirname(__FILE__) . str_repeat('/..', $relation_level) ) );
require_once FULL_PATH.'/kernel/startup.php';
// new startup: end
//admin only includes
require_once ($pathtoroot.$admin."/include/elements.php");
require_once ($pathtoroot."kernel/admin/include/navmenu.php");
require_once($pathtoroot.$admin."/toolbar.php");
require_once($pathtoroot.$admin."/listview/listview.php");
$pathtolocal = $pathtoroot;
/* -------------------------------------- Section configuration ------------------------------------------- */
$section = 'in-portal:sessionlog';
$envar = "env=" . BuildEnv();
$SortFieldVar = "Session_SortField";
$SortOrderVar = "Session_SortOrder";
$DefaultSortField = "UserName";
$PerPageVar = "Perpage_Sessions";
$CurrentPageVar = "Page_Sessions";
$CurrentFilterVar = "Session_View";
$ListForm = "sessionlistform";
$CheckClass = "UserChecks";
/* ------------------------------------- Configure the toolbar ------------------------------------------- */
$objListToolBar = new clsToolBar();
$objListToolBar->Set("section",$section);
$objListToolBar->Set("load_menu_func","");
$objListToolBar->Set("CheckClass",$CheckClass);
$objListToolBar->Set("CheckForm",$ListForm);
$listImages = array();
//$img, $alt, $link, $onMouseOver, $onMouseOut, $onClick
$objListToolBar->Add("log_refresh", "la_ToolTip_Refresh","#","swap('log_refresh','toolbar/tool_refresh_f2.gif');",
"swap('log_refresh', 'toolbar/tool_refresh.gif');","window.location.reload(true);",
"tool_refresh.gif");
$objListToolBar->Add("log_reset","la_ToolTip_Reset","#", "if (UserChecks.itemChecked()) swap('log_reset','toolbar/tool_disconnect_f2.gif');",
"if (UserChecks.itemChecked()) swap('log_reset', 'toolbar/tool_disconnect.gif');","if (UserChecks.itemChecked()) $CheckClass.check_submit('session_list', 'm_session_delete');",
"tool_disconnect.gif",TRUE,TRUE);
$listImages[] = "$CheckClass.addImage('log_reset','$imagesURL/toolbar/tool_disconnect.gif','$imagesURL/toolbar/tool_disconnect_f3.gif',1);\n ";
$objListToolBar->Add("divider");
$objListToolBar->Add("user_print", "la_ToolTip_Print","#","swap('user_print','toolbar/tool_print_f2.gif');",
"swap('user_print', 'toolbar/tool_print.gif');","window.print();","tool_print.gif");
$objListToolBar->Add("viewmenubutton", "la_ToolTip_View","#","swap('viewmenubutton','toolbar/tool_view_f2.gif'); ",
"swap('viewmenubutton', 'toolbar/tool_view.gif');",
"ShowViewMenu();","tool_view.gif");
$objListToolBar->AddToInitScript($listImages);
$objListToolBar->AddToInitScript("fwLoadMenus();");
/* ----------------------------------------- Set the View Filter ---------------------------------------- */
/* bit place holders for category view menu */
$Bit_Active=1;
$Bit_Inactive=2;
$Bit_Guest=4;
$Bit_All = 7;
$FilterLabels = array();
$FilterLabels[0] = admin_language("la_Text_Active");
$FilterLabels[1] = admin_language("la_Text_Expired");
$FilterLabels[2] = admin_language("la_Text_Guest");
if($_GET["resetpage"]==1)
$objSession->SetVariable("Page_Sessions","1");
if ($_POST['fieldname'] == "Perpage_Sessionlist")
$objSession->SetVariable("Page_Sessionlist","1");
/* determine current view menu settings */
$SessionView = $objConfig->Get("Session_View");
if(!is_numeric($SessionView))
{
$SessionView = $Bit_All; //Set all bits ON
$SessionFilter = "";
}
$filter = array();
$status=array();
if($SessionView & $Bit_Active)
{
$status[] = 1;
}
if($SessionView & $Bit_Inactive)
{
$status[] = 0;
}
$status = count($status) ? implode(',',$status) : '-1';
$filter[] = 'us.Status IN ('.$status.')';
if(!($SessionView & $Bit_Guest))
$filter[] = "p.Login IS NOT NULL";
$SessionFilter = join(" AND ",$filter);
$order = $objConfig->Get("Session_SortOrder");
$SearchWords = $objSession->GetVariable("SessionSearchWord");
if(strlen($SearchWords))
{
$where = " HAVING ".$objSession->AdminSearchWhereClause($SearchWords);
}
else
$where = "";
if(strlen($SessionFilter)>0)
{
//if(strlen($where))
// $SessionFilter.= " AND ";
$where = $SessionFilter.$where;
}
//echo $where;
$sql = "SELECT us.*,if (p.Login IS NULL,'".admin_language("la_Text_Guest")."',p.Login) as UserName, ";
$sql .="if(g.Name IS NULL,'".admin_language("la_Text_GuestUsers")."',g.Name) as GroupName, ";
$sql .="ELT(us.Status+1,'".admin_language("la_Text_Expired")."','".admin_language("la_Text_Active")."') as SessionStatus, ";
$sql .="FROM_UNIXTIME(us.LastAccessed,'%m-%d-%Y %h:%i:%s') as DateCreated ";
$sql .="FROM ".GetTablePrefix()."UserSession ";
$sql .=" as us LEFT JOIN ".GetTablePrefix()."PortalUser as p USING (PortalUserId) ";
$sql .="LEFT JOIN ".GetTablePrefix()."UserGroup as u ON (p.PortalUserId=u.PortalUserId AND u.PrimaryGroup=1) ";
$sql .="LEFT JOIN ".GetTablePrefix()."PortalGroup as g ON (u.GroupId=g.GroupId) ";
-$sql .= " WHERE (us.Status = 1) AND (us.PortalUserId <> -1) AND ( LENGTH(us.PortalUserId) > 0) ";
+$sql .= " WHERE (us.Status = 1) AND (us.PortalUserId NOT IN (0,-1)) ";
+
+// ProtalUserId = {0 - admin not logged-in session, -1 - root logged in admin}
if(strlen($where)) {
$sql .= "AND ".$where;
}
$orderBy = trim($objConfig->Get("Session_SortField")." ".$objConfig->Get("Session_SortOrder"));
if(strlen($orderBy))
$sql .=" ORDER BY ".$orderBy;
//$sql .=" ".GetLimitSQL($objSession->GetVariable("Page_Sessionlist"),$objConfig->Get("Perpage_Sessionlist"));
if($objSession->HasSystemPermission("DEBUG.LIST"))
echo htmlentities($sql,ENT_NOQUOTES)."<br>\n";
$objListView = new clsListView($objListToolBar);
$objListView->CurrentPageVar = "Page_Sessionlist";
$objListView->PerPageVar = "Perpage_Sessionlist";
$objUsers->Query_Item($sql);
$itemcount = 0;
foreach ($objUsers->Items as $value) {
$itemcount++;
}
//echo $itemcount;
$objUsers->Query_Item( $sql, $objListView->GetLimitSQL() );
$objListView->SetListItems($objUsers);
$objListView->IdField = "SessionKey";
$objListView->PageLinkTemplate = $pathtoroot.$admin."/templates/user_page_link.tpl";
$objListView->ColumnHeaders->Add("UserName",admin_language("la_prompt_Username"),1,0,$order,"width=\"35%\"","Session_SortField","Session_SortOrder","UserName");
$objListView->ColumnHeaders->Add("GroupName",admin_language("la_prompt_PrimaryGroup"),1,0,$order,"width=\"20%\"","Session_SortField","Session_SortOrder","GroupName");
if (IsDebugMode())
{
$objListView->ColumnHeaders->Add('SessionKey', admin_language('la_prompt_SessionKey'), 1, 0, $order, 'width="10%"', 'Session_SortField', 'Session_SortOrder', 'SessionKey');
}
$objListView->ColumnHeaders->Add("SessionStatus",admin_language("la_prompt_Status"),1,0,$order,"width=\"10%\"","Session_SortField","Session_SortOrder","SessionStatus");
$objListView->ColumnHeaders->Add("IpAddress",admin_language("la_prompt_IPAddress"),1,0,$order,"width=\"15%\"","Session_SortField","Session_SortOrder","IPAddress");
$objListView->ColumnHeaders->Add("DateCreated",admin_language("la_prompt_CreatedOn"),1,0,$order,"width=\"20%\"","Session_SortField","Session_SortOrder","us.LastAccessed");
$objListView->ColumnHeaders->SetSort($objConfig->Get("Session_SortField"),$order);
$objListView->PrintToolBar = FALSE;
$objListView->SearchBar = TRUE;
$objListView->SearchKeywords = $SearchWords;
$objListView->SearchAction="m_session_search";
$objListView->CheckboxName = "itemlist[]";
$objListView->TotalItemCount = $itemcount;
$objListView->ConfigureViewMenu($SortFieldVar,$SortOrderVar,$DefaultSortField,
$CurrentFilterVar,$SessionView,$Bit_All);
foreach($FilterLabels as $Bit=>$Label)
{
$objListView->AddViewMenuFilter($Label,$Bit);
}
$filter = false; // always initialize variables before use
if($objSession->GetVariable("SessionSearchWord") != '') {
$filter = true;
}
else {
if ($SessionView != $Bit_All) {
$filter = true;
}
}
$title = admin_language("la_Show_Log")." (".$itemcount.")";
$h = "\n\n<SCRIPT Language=\"JavaScript1.2\">\n".$objListView->GetViewMenu($imagesURL)."\n</SCRIPT>\n";
int_header($objListToolBar,NULL, $title,NULL,$h);
if ($filter) { ?>
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="toolbar">
<tr>
<td valign="top">
<?php int_hint_red(admin_language("la_Warning_Filter")); ?>
</td>
</tr>
</table>
<?php } ?>
<FORM method="POST" ACTION="" NAME="sessionlistform" ID="sessionlistform">
<?php
print $objListView->PrintList();
?>
<input type="hidden" name="Action" value="">
</FORM>
<!-- CODE FOR VIEW MENU -->
<form ID="viewmenu" method="post" action="<?php echo $_SERVER["PHP_SELF"]."?env=".BuildEnv(); ?>" name="viewmenu">
<input type="hidden" name="fieldname" value="">
<input type="hidden" name="varvalue" value="">
<input type="hidden" name="varvalue2" value="">
<input type="hidden" name="Action" value="">
</form>
<FORM ID="ListSearchForm" NAME="ListSearchForm" method="POST" action="<?php echo $_SERVER["PHP_SELF"]."?env=".BuildEnv(); ?>">
<INPUT TYPE="HIDDEN" NAME="Action" VALUE="">
<INPUT TYPE="HIDDEN" NAME="list_search">
</FORM>
<script src="<?php echo $adminURL; ?>/listview/listview.js"></script>
<script>
initSelectiorContainers();
<?php echo $objListToolBar->Get("CheckClass").".setImages();"; ?>
</script>
<!-- END CODE-->
<?php int_footer(); ?>
Property changes on: trunk/admin/logs/session_list.php
___________________________________________________________________
Modified: cvs2svn:cvs-rev
## -1 +1 ##
-1.14
\ No newline at end of property
+1.15
\ No newline at end of property
Index: trunk/core/units/general/inp_ses_storage.php
===================================================================
--- trunk/core/units/general/inp_ses_storage.php (revision 3886)
+++ trunk/core/units/general/inp_ses_storage.php (revision 3887)
@@ -1,117 +1,117 @@
<?php
class InpSession extends Session
{
function Init($prefix,$special)
{
$this->SessionTimeout = $this->Application->ConfigValue('SessionTimeout');
$path = (BASE_PATH == '') ? '/' : BASE_PATH;
if ( $this->Application->IsAdmin() ) $path = rtrim($path, '/').'/admin';
$this->SetCookiePath($path);
$cookie_name = $this->Application->ConfigValue('SessionCookieName');
$this->SetCookieName($cookie_name ? $cookie_name : 'sid');
$this->SetCookieDomain(SERVER_NAME);
if( $this->Application->IsAdmin() )
{
$mode = constOn('IS_INSTALL') ? smCOOKIES_ONLY : smAUTO;
}
else
{
$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;
}
$this->SetMode($mode);
parent::Init($prefix,$special);
if( !$this->Application->IsAdmin() && $this->GetField('PortalUserId') <= 0 )
{
$group_list = $this->Application->ConfigValue('User_GuestGroup').','.$this->Application->ConfigValue('User_LoggedInGroup');
$this->SetField('GroupId', $this->Application->ConfigValue('User_GuestGroup'));
$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, $additional_fields = Array())
{
- $fields_hash = Array( 'PortalUserId' => -2, // Guest
+ $fields_hash = Array( 'PortalUserId' => $this->Application->IsAdmin() ? 0 : -2, // Guest
'Language' => $this->Application->GetDefaultLanguageId(),
'Theme' => $this->Application->GetDefaultThemeId(),
'IpAddress' => $_SERVER['REMOTE_ADDR'],
'GroupList' => $this->Application->ConfigValue('User_GuestGroup'),
'CurrentTempKey'=> $session->SID,
);
parent::StoreSession($session, $fields_hash);
}
function GetExpiredSIDs()
{
$query = ' SELECT '.$this->IDField.' FROM '.$this->TableName.' WHERE '.adodb_mktime().' - '.$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.18
\ No newline at end of property
+1.19
\ No newline at end of property
Event Timeline
Log In to Comment