mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-06-26 21:01:30 +02:00
Switch back to prior setcookie method, but add path
This commit is contained in:
parent
6a08a48087
commit
27f2acb285
@ -65,55 +65,6 @@
|
|||||||
$this->db->Password = $GLOBALS['phpgw_domain'][$GLOBALS['ConfigDomain']]['db_pass'];
|
$this->db->Password = $GLOBALS['phpgw_domain'][$GLOBALS['ConfigDomain']]['db_pass'];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the domain used for cookies
|
|
||||||
*
|
|
||||||
* @return string domain
|
|
||||||
*/
|
|
||||||
function set_cookiedomain()
|
|
||||||
{
|
|
||||||
$dom = $_SERVER['HTTP_HOST'];
|
|
||||||
if(preg_match("/^(.*):(.*)$/",$dom,$arr))
|
|
||||||
{
|
|
||||||
$dom = $arr[1];
|
|
||||||
}
|
|
||||||
$parts = explode('.',$dom);
|
|
||||||
if(count($parts) > 2)
|
|
||||||
{
|
|
||||||
if(!ereg('[0-9]+',$parts[1]))
|
|
||||||
{
|
|
||||||
for($i=1;$i<count($parts);$i++)
|
|
||||||
{
|
|
||||||
$this->cookie_domain .= '.'.$parts[$i];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$this->cookie_domain = '';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$this->cookie_domain = '';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set a cookie
|
|
||||||
*
|
|
||||||
* @param string $cookiename name of cookie to be set
|
|
||||||
* @param string $cookievalue value to be used, if unset cookie is cleared (optional)
|
|
||||||
* @param int $cookietime when cookie should expire, 0 for session only (optional)
|
|
||||||
*/
|
|
||||||
function set_cookie($cookiename,$cookievalue='',$cookietime=0)
|
|
||||||
{
|
|
||||||
if(!$this->cookie_domain)
|
|
||||||
{
|
|
||||||
$this->set_cookiedomain();
|
|
||||||
}
|
|
||||||
setcookie($cookiename,$cookievalue,$cookietime,'/',$this->cookie_domain);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@function auth
|
@function auth
|
||||||
@abstract authenticate the setup user
|
@abstract authenticate the setup user
|
||||||
@ -151,15 +102,15 @@
|
|||||||
6. None of the above
|
6. None of the above
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$expire = time() + (1200*9); /* Expire login if idle for 20 minutes. */
|
$expire = (int)(time() + (1200*9)); /* Expire login if idle for 20 minutes. */
|
||||||
|
|
||||||
if(!empty($HeaderLogin) && $auth_type == 'Header')
|
if(!empty($HeaderLogin) && $auth_type == 'Header')
|
||||||
{
|
{
|
||||||
/* header admin login */
|
/* header admin login */
|
||||||
if($FormPW == stripslashes($GLOBALS['phpgw_info']['server']['header_admin_password']))
|
if($FormPW == stripslashes($GLOBALS['phpgw_info']['server']['header_admin_password']))
|
||||||
{
|
{
|
||||||
$this->set_cookie('HeaderPW',"$FormPW","$expire");
|
setcookie('HeaderPW',"$FormPW",$expire,'/');
|
||||||
$this->set_cookie('ConfigLang',"$ConfigLang","$expire");
|
setcookie('ConfigLang',"$ConfigLang",$expire,'/');
|
||||||
return True;
|
return True;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -174,9 +125,9 @@
|
|||||||
/* config login */
|
/* config login */
|
||||||
if(isset($GLOBALS['phpgw_domain'][$FormDomain]) && $FormPW == stripslashes(@$GLOBALS['phpgw_domain'][$FormDomain]['config_passwd']))
|
if(isset($GLOBALS['phpgw_domain'][$FormDomain]) && $FormPW == stripslashes(@$GLOBALS['phpgw_domain'][$FormDomain]['config_passwd']))
|
||||||
{
|
{
|
||||||
$this->set_cookie('ConfigPW',"$FormPW","$expire");
|
setcookie('ConfigPW',"$FormPW",$expire,'/');
|
||||||
$this->set_cookie('ConfigDomain',"$FormDomain","$expire");
|
setcookie('ConfigDomain',"$FormDomain",$expire,'/');
|
||||||
$this->set_cookie('ConfigLang',"$ConfigLang","$expire");
|
setcookie('ConfigLang',"$ConfigLang",$expire,'/');
|
||||||
return True;
|
return True;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -192,11 +143,11 @@
|
|||||||
if($FormLogout == 'config')
|
if($FormLogout == 'config')
|
||||||
{
|
{
|
||||||
/* config logout */
|
/* config logout */
|
||||||
$this->set_cookie('ConfigPW','');
|
setcookie('ConfigPW','');
|
||||||
$GLOBALS['phpgw_info']['setup']['LastDomain'] = $_COOKIE['ConfigDomain'];
|
$GLOBALS['phpgw_info']['setup']['LastDomain'] = $_COOKIE['ConfigDomain'];
|
||||||
$this->set_cookie('ConfigDomain','');
|
setcookie('ConfigDomain','');
|
||||||
$GLOBALS['phpgw_info']['setup']['ConfigLoginMSG'] = lang('You have successfully logged out');
|
$GLOBALS['phpgw_info']['setup']['ConfigLoginMSG'] = lang('You have successfully logged out');
|
||||||
$this->set_cookie('ConfigLang','');
|
setcookie('ConfigLang','');
|
||||||
$GLOBALS['phpgw_info']['setup']['HeaderLoginMSG'] = '';
|
$GLOBALS['phpgw_info']['setup']['HeaderLoginMSG'] = '';
|
||||||
|
|
||||||
return False;
|
return False;
|
||||||
@ -204,9 +155,9 @@
|
|||||||
elseif($FormLogout == 'header')
|
elseif($FormLogout == 'header')
|
||||||
{
|
{
|
||||||
/* header admin logout */
|
/* header admin logout */
|
||||||
$this->set_cookie('HeaderPW','');
|
setcookie('HeaderPW','');
|
||||||
$GLOBALS['phpgw_info']['setup']['HeaderLoginMSG'] = lang('You have successfully logged out');
|
$GLOBALS['phpgw_info']['setup']['HeaderLoginMSG'] = lang('You have successfully logged out');
|
||||||
$this->set_cookie('ConfigLang','');
|
setcookie('ConfigLang','');
|
||||||
$GLOBALS['phpgw_info']['setup']['ConfigLoginMSG'] = '';
|
$GLOBALS['phpgw_info']['setup']['ConfigLoginMSG'] = '';
|
||||||
|
|
||||||
return False;
|
return False;
|
||||||
@ -217,9 +168,9 @@
|
|||||||
/* Returning after login to config */
|
/* Returning after login to config */
|
||||||
if($ConfigPW == stripslashes($GLOBALS['phpgw_domain'][$ConfigDomain]['config_passwd']))
|
if($ConfigPW == stripslashes($GLOBALS['phpgw_domain'][$ConfigDomain]['config_passwd']))
|
||||||
{
|
{
|
||||||
$this->set_cookie('ConfigPW',"$ConfigPW","$expire");
|
setcookie('ConfigPW',"$ConfigPW",$expire,'/');
|
||||||
$this->set_cookie('ConfigDomain',"$ConfigDomain","$expire");
|
setcookie('ConfigDomain',"$ConfigDomain",$expire,'/');
|
||||||
$this->set_cookie('ConfigLang',"$ConfigLang","$expire");
|
setcookie('ConfigLang',"$ConfigLang",$expire,'/');
|
||||||
return True;
|
return True;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -234,8 +185,8 @@
|
|||||||
/* Returning after login to header admin */
|
/* Returning after login to header admin */
|
||||||
if($HeaderPW == stripslashes($GLOBALS['phpgw_info']['server']['header_admin_password']))
|
if($HeaderPW == stripslashes($GLOBALS['phpgw_info']['server']['header_admin_password']))
|
||||||
{
|
{
|
||||||
$this->set_cookie('HeaderPW',"$HeaderPW","$expire");
|
setcookie('HeaderPW',"$HeaderPW",$expire,'/');
|
||||||
$this->set_cookie('ConfigLang',"$ConfigLang","$expire");
|
setcookie('ConfigLang',"$ConfigLang",$expire,'/');
|
||||||
return True;
|
return True;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
Loading…
x
Reference in New Issue
Block a user