[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [17333] More on session handling
From: |
sigurdne |
Subject: |
[Fmsystem-commits] [17333] More on session handling |
Date: |
Sun, 19 Nov 2017 11:08:36 -0500 (EST) |
Revision: 17333
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=17333
Author: sigurdne
Date: 2017-11-19 11:08:35 -0500 (Sun, 19 Nov 2017)
Log Message:
-----------
More on session handling
Modified Paths:
--------------
trunk/logout.php
trunk/mobilefrontend/logout.php
trunk/phpgwapi/inc/class.sessions.inc.php
trunk/phpgwapi/inc/functions.inc.php
trunk/property/inc/class.fileuploader.inc.php
trunk/property/login.php
trunk/redirect.php
Modified: trunk/logout.php
===================================================================
--- trunk/logout.php 2017-11-18 16:37:45 UTC (rev 17332)
+++ trunk/logout.php 2017-11-19 16:08:35 UTC (rev 17333)
@@ -25,7 +25,7 @@
*/
include_once('header.inc.php');
- $sessionid = phpgw::get_var('sessionphpgwsessid');
+ $sessionid = $GLOBALS['phpgw']->session->get_session_id();
$verified = $GLOBALS['phpgw']->session->verify();
if ($verified)
@@ -63,7 +63,7 @@
if ( isset($GLOBALS['phpgw_info']['server']['usecookies'])
&& $GLOBALS['phpgw_info']['server']['usecookies'] )
{
-
$GLOBALS['phpgw']->session->phpgw_setcookie('sessionphpgwsessid');
+ $GLOBALS['phpgw']->session->phpgw_setcookie(session_name());
$GLOBALS['phpgw']->session->phpgw_setcookie('domain');
}
Modified: trunk/mobilefrontend/logout.php
===================================================================
--- trunk/mobilefrontend/logout.php 2017-11-18 16:37:45 UTC (rev 17332)
+++ trunk/mobilefrontend/logout.php 2017-11-19 16:08:35 UTC (rev 17333)
@@ -24,7 +24,7 @@
*/
include_once('../header.inc.php');
- $sessionid = phpgw::get_var('sessionphpgwsessid');
+ $sessionid = $GLOBALS['phpgw']->session->get_session_id();
$verified = $GLOBALS['phpgw']->session->verify();
if ($verified)
@@ -61,7 +61,7 @@
if (isset($GLOBALS['phpgw_info']['server']['usecookies']) &&
$GLOBALS['phpgw_info']['server']['usecookies'])
{
-
$GLOBALS['phpgw']->session->phpgw_setcookie('sessionphpgwsessid');
+ $GLOBALS['phpgw']->session->phpgw_setcookie(session_name());
$GLOBALS['phpgw']->session->phpgw_setcookie('domain');
}
Modified: trunk/phpgwapi/inc/class.sessions.inc.php
===================================================================
--- trunk/phpgwapi/inc/class.sessions.inc.php 2017-11-18 16:37:45 UTC (rev
17332)
+++ trunk/phpgwapi/inc/class.sessions.inc.php 2017-11-19 16:08:35 UTC (rev
17333)
@@ -38,7 +38,25 @@
}
else
{
- session_name('sessionphpgwsessid');
+// if(isset($_POST['logindomain']))
+// {
+// $_logindomain = phpgw::get_var('logindomain', 'string',
'POST', $GLOBALS['phpgw_info']['server']['default_domain']);
+// $_GET['domain'] = $_logindomain;
+// }
+//
+// if(!$session_prefix = phpgw::get_var('domain', 'string', 'GET',
false))
+// {
+// if(!$session_prefix = phpgw::get_var('domain',
'string', 'POST', false))
+// {
+// if(!$session_prefix = phpgw::get_var('domain',
'string', 'COOKIE', false))
+// {
+// $session_identifier = 'phpgw';
+// }
+// }
+// }
+// $session_identifier = str_replace('_', '' ,$session_prefix);
+ $session_identifier = 'phpgw';
+ session_name("session{$session_identifier}sessid");
}
/*
@@ -157,7 +175,7 @@
public function __construct()
{
$this->_db =&
$GLOBALS['phpgw']->db;
- $use_cookies = false;
+ $this->_use_cookies = false;
$GLOBALS['phpgw']->hooks->process('set_cookie_domain',
array('eventplannerfrontend','mobilefrontend', 'bookingfrontend',
'activitycalendarfrontend'));
if (
isset($GLOBALS['phpgw_info']['server']['usecookies'])
&&
$GLOBALS['phpgw_info']['server']['usecookies'] == 'True' )
@@ -186,6 +204,11 @@
ini_set('url_rewriter.tags', '');
}
+ public function get_session_id()
+ {
+ return $this->_sessionid;
+ }
+
/**
* Cache data for the user's current session
*
@@ -1160,18 +1183,7 @@
{
if(empty($sessionid) || !$sessionid)
{
- if($this->_use_cookies)
- {
- $sessionid =
phpgw::get_var(session_name());
- }
- else if ($_GET[session_name()])
- {
- $sessionid =
phpgw::get_var(session_name(),'string', 'GET');
- }
- else
- {
- $sessionid =
phpgw::get_var(session_name(), 'string', 'POST');
- }
+ $sessionid = $this->get_session_id();
}
if(!$sessionid)
Modified: trunk/phpgwapi/inc/functions.inc.php
===================================================================
--- trunk/phpgwapi/inc/functions.inc.php 2017-11-18 16:37:45 UTC (rev
17332)
+++ trunk/phpgwapi/inc/functions.inc.php 2017-11-19 16:08:35 UTC (rev
17333)
@@ -538,9 +538,10 @@
if (isset($_POST['login'])) // on login
{
$GLOBALS['login'] = $_POST['login'];
+ $_logindomain = phpgw::get_var('logindomain', 'string', 'POST',
$GLOBALS['phpgw_info']['server']['default_domain']);
if (strstr($GLOBALS['login'],'#') === False)
{
- $GLOBALS['login'] .= '#' .
phpgw::get_var('logindomain', 'string', 'POST',
$GLOBALS['phpgw_info']['server']['default_domain']);
+ $GLOBALS['login'] .= '#' . $_logindomain;
}
list(,$GLOBALS['phpgw_info']['user']['domain']) =
explode('#',$GLOBALS['login']);
}
Modified: trunk/property/inc/class.fileuploader.inc.php
===================================================================
--- trunk/property/inc/class.fileuploader.inc.php 2017-11-18 16:37:45 UTC
(rev 17332)
+++ trunk/property/inc/class.fileuploader.inc.php 2017-11-19 16:08:35 UTC
(rev 17333)
@@ -51,11 +51,12 @@
$upload_target = phpgw::get_var('upload_target');
$id = phpgw::get_var('id');
+ $session_name = session_name();
$oArgs = "{'menuaction':'$upload_target',"
. "'id':'$id',"
. "'last_loginid':'" .
phpgw::get_var('last_loginid') . "',"
. "'last_domain':'" .
phpgw::get_var('last_domain') . "',"
- . "'sessionphpgwsessid':'" .
phpgw::get_var('sessionphpgwsessid') . "',"
+ . "'{$session_name}':'" .
$GLOBALS['phpgw']->session->get_session_id() . "',"
. "'domain':'" . phpgw::get_var('domain') . "'";
foreach ($_GET as $varname => $value)
Modified: trunk/property/login.php
===================================================================
--- trunk/property/login.php 2017-11-18 16:37:45 UTC (rev 17332)
+++ trunk/property/login.php 2017-11-19 16:08:35 UTC (rev 17333)
@@ -82,37 +82,37 @@
{
switch($code)
{
- case 1:
- return lang('You have been successfully
logged out');
- case 2:
- return lang('Sorry, your login has
expired');
- case 5:
- return lang('Bad login or password');
- case 20:
- return lang('Cannot find the mapping !
(please advice your adminstrator)');
- case 21:
- return lang('you had inactive mapping
to %1 account', phpgw::get_var('phpgw_account', 'string', 'GET', ''));
- case 22:
-
$GLOBALS['phpgw']->session->phpgw_setcookie('sessionid');
-
$GLOBALS['phpgw']->session->phpgw_setcookie('kp3');
-
$GLOBALS['phpgw']->session->phpgw_setcookie('domain');
- return lang('you seemed to have an
active session elsewhere for the domain "%1", now set to expired - please try
again', phpgw::get_var('domain', 'string', 'COOKIE'));
- case 99:
- return lang('Blocked, too many
attempts');
- case 10:
-
$GLOBALS['phpgw']->session->phpgw_setcookie('sessionid');
-
$GLOBALS['phpgw']->session->phpgw_setcookie('kp3');
-
$GLOBALS['phpgw']->session->phpgw_setcookie('domain');
-
- // fix for bug php4 expired sessions bug
-
if($GLOBALS['phpgw_info']['server']['sessions_type'] == 'php')
- {
-
$GLOBALS['phpgw']->session->phpgw_setcookie('phpgwsessid');
- }
-
- return lang('Your session could not be
verified.');
- default:
- return ' ';
+ case 1:
+ return lang('You have been successfully
logged out');
+ case 2:
+ return lang('Sorry, your login has
expired');
+ case 5:
+ return lang('Bad login or password');
+ case 20:
+ return lang('Cannot find the mapping !
(please advice your adminstrator)');
+ case 21:
+ return lang('you had inactive mapping
to %1 account', phpgw::get_var('phpgw_account', 'string', 'GET', ''));
+ case 22:
+
$GLOBALS['phpgw']->session->phpgw_setcookie('sessionid');
+
$GLOBALS['phpgw']->session->phpgw_setcookie('kp3');
+
$GLOBALS['phpgw']->session->phpgw_setcookie('domain');
+ return lang('you seemed to have an
active session elsewhere for the domain "%1", now set to expired - please try
again', phpgw::get_var('domain', 'string', 'COOKIE'));
+ case 99:
+ return lang('Blocked, too many
attempts');
+ case 10:
+
$GLOBALS['phpgw']->session->phpgw_setcookie('sessionid');
+
$GLOBALS['phpgw']->session->phpgw_setcookie('kp3');
+
$GLOBALS['phpgw']->session->phpgw_setcookie('domain');
+
+ // fix for bug php4 expired sessions bug
+
if($GLOBALS['phpgw_info']['server']['sessions_type'] == 'php')
+ {
+
$GLOBALS['phpgw']->session->phpgw_setcookie('phpgwsessid');
+ }
+
+ return lang('Your session could not be
verified.');
+ default:
+ return ' ';
}
}
@@ -179,11 +179,11 @@
include(PHPGW_SERVER_ROOT . '/setup/lang.php');
}
/* Program starts here */
- $GLOBALS['phpgw']->session->phpgw_setcookie('sessionphpgwsessid');
-// $GLOBALS['phpgw']->session->phpgw_setcookie('sessionid');
- $GLOBALS['phpgw']->session->phpgw_setcookie('kp3');
- $GLOBALS['phpgw']->session->phpgw_setcookie('domain');
-
+ $GLOBALS['phpgw']->session->phpgw_setcookie(session_name());
+// $GLOBALS['phpgw']->session->phpgw_setcookie('sessionid');
+ $GLOBALS['phpgw']->session->phpgw_setcookie('kp3');
+ $GLOBALS['phpgw']->session->phpgw_setcookie('domain');
+
$login = phpgw::get_var('login', 'string', 'POST');
$passwd = phpgw::get_var('passwd', 'string', 'POST');
@@ -252,11 +252,11 @@
$_passwd = md5($passwd);
- $db->query("SELECT fm_tenant.id,
phpgw_accounts.account_lid,phpgw_accounts.account_pwd"
- . " FROM fm_tenant {$join} phpgw_accounts ON
fm_tenant.phpgw_account_id = phpgw_accounts.account_id"
- . " WHERE phpgw_accounts.account_status = 'A'
AND"
+ $db->query("SELECT fm_tenant.id,
phpgw_accounts.account_lid,phpgw_accounts.account_pwd"
+ . " FROM fm_tenant {$join} phpgw_accounts ON
fm_tenant.phpgw_account_id = phpgw_accounts.account_id"
+ . " WHERE phpgw_accounts.account_status = 'A'
AND"
. " fm_tenant.account_lid = '{$login}' AND"
- . " fm_tenant.account_pwd='{$_passwd}' AND"
+ . " fm_tenant.account_pwd='{$_passwd}' AND"
. " fm_tenant.account_status =1", __LINE__, __FILE__);
$db->next_record();
Modified: trunk/redirect.php
===================================================================
--- trunk/redirect.php 2017-11-18 16:37:45 UTC (rev 17332)
+++ trunk/redirect.php 2017-11-19 16:08:35 UTC (rev 17333)
@@ -13,8 +13,23 @@
*/
+ $GLOBALS['phpgw_info']['flags'] = array
+ (
+ 'currentapp' => 'logout',
+ 'noheader' => True,
+ 'nonavbar' => True,
+ 'noappheader' => True,
+ 'noappfooter' => True,
+ 'nofooter' => True
+ );
+
+ /**
+ * Include phpgroupware header
+ */
+ include_once('header.inc.php');
+
//Get the session variables set for non cookie based sessions
- if ( !isset($_COOKIES['sessionphpgwsessid']) ||
isset($_COOKIES['sessionid']) )
+ if ( !isset($_COOKIES[session_name()]) || isset($_COOKIES['sessionid'])
)
{
// nothing else we can do
if ( !isset($_SERVER['HTTP_REFERER']) && isset($_GET['go']) )
@@ -33,21 +48,6 @@
}
- $GLOBALS['phpgw_info']['flags'] = array
- (
- 'currentapp' => 'home',
- 'noheader' => True,
- 'nonavbar' => True,
- 'noappheader' => True,
- 'noappfooter' => True,
- 'nofooter' => True
- );
-
- /**
- * Include phpgroupware header
- */
- include_once('header.inc.php');
-
if( isset($_GET['go']) )
{
$_GET['go'] = htmlspecialchars_decode(urldecode($_GET['go']));
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [17333] More on session handling,
sigurdne <=