use PMA_Config class for cookie needs, do not unset not set cookie

This commit is contained in:
Sebastian Mendel
2006-07-31 15:06:25 +00:00
parent 8c3acfa642
commit ed52b071a1
2 changed files with 10 additions and 7 deletions

View File

@@ -9,6 +9,8 @@ $Source$
* lang/czech: Updated.
2006-07-31 Sebastian Mendel <cybot_tm@users.sourceforge.net>
* libraries/common.lib.php: use PMA_Config class for cookie needs,
do not unset not set cookie
* css\phpmyadmin.css.php, libraries\Config.class.php, main.php,
themes\*: make font size user configurable

View File

@@ -2544,8 +2544,8 @@ window.parent.updateTableTitle('<?php echo $uni_tbl; ?>', '<?php echo PMA_jsForm
/**
* removes cookie
*
* @uses $GLOBALS['cookie_path']
* @uses $GLOBALS['is_https']
* @uses PMA_Config::isHttps()
* @uses PMA_Config::getCookiePath()
* @uses setcookie()
* @uses time()
* @param string $cookie name of cookie to remove
@@ -2554,15 +2554,15 @@ window.parent.updateTableTitle('<?php echo $uni_tbl; ?>', '<?php echo PMA_jsForm
function PMA_removeCookie($cookie)
{
return setcookie($cookie, '', time() - 3600,
$GLOBALS['cookie_path'], '', $GLOBALS['is_https']);
PMA_Config::getCookiePath(), '', PMA_Config::isHttps());
}
/**
* sets cookie if value is different from current cokkie value,
* or removes if value is equal to default
*
* @uses $GLOBALS['cookie_path']
* @uses $GLOBALS['is_https']
* @uses PMA_Config::isHttps()
* @uses PMA_Config::getCookiePath()
* @uses $_COOKIE
* @uses PMA_removeCookie()
* @uses setcookie()
@@ -2574,7 +2574,8 @@ window.parent.updateTableTitle('<?php echo $uni_tbl; ?>', '<?php echo PMA_jsForm
*/
function PMA_setCookie($cookie, $value, $default = null)
{
if (strlen($value) && null !== $default && $value === $default) {
if (strlen($value) && null !== $default && $value === $default
&& isset($_COOKIE[$cookie])) {
// remove cookie, default value is used
return PMA_removeCookie($cookie);
}
@@ -2587,7 +2588,7 @@ window.parent.updateTableTitle('<?php echo $uni_tbl; ?>', '<?php echo PMA_jsForm
if (! isset($_COOKIE[$cookie]) || $_COOKIE[$cookie] !== $value) {
// set cookie with new value
return setcookie($cookie, $value, time() + 60*60*24*30,
$GLOBALS['cookie_path'], '', $GLOBALS['is_https']);
PMA_Config::getCookiePath(), '', PMA_Config::isHttps());
}
// cookie has already $value as value