[Phpslash-commit] CVS: phpslash-ft/class functions.inc,1.115,1.116
Brought to you by:
joestewart,
nhruby
From: Joe S. <joe...@us...> - 2002-11-23 14:02:07
|
Update of /cvsroot/phpslash/phpslash-ft/class In directory sc8-pr-cvs1:/tmp/cvs-serv14316/phpslash-ft/class Modified Files: functions.inc Log Message: set_TZ sets cookie on change only Index: functions.inc =================================================================== RCS file: /cvsroot/phpslash/phpslash-ft/class/functions.inc,v retrieving revision 1.115 retrieving revision 1.116 diff -C2 -d -r1.115 -r1.116 *** functions.inc 21 Nov 2002 18:59:06 -0000 1.115 --- functions.inc 23 Nov 2002 14:02:05 -0000 1.116 *************** *** 1193,1230 **** */ function set_TZ($new_tzname='',$method='') { ! global $_PSL, $HTTP_GET_VARS, $HTTP_COOKIE_VARS, $HTTP_SERVER_VARS; ! $fn = "set_TZ"; $default_TZ = ''; $host = ''; ! // debug("$fn: start",$new_tzname); ! // default: value in _PSL array. if (!empty($_PSL['timezone']['name'])) { ! $default_TZ = $_PSL['timezone']['name']; } ! if (!$default_TZ && !empty($_PSL['timezone']['native']) && !empty($_PSL['timezone']['default'])) { ! $default_TZ = $_PSL['timezone']['default']; } ! // start with cookie value if it's set ! $cookie_TZ = $HTTP_COOKIE_VARS['TZ']; ! if (!empty($cookie_TZ)) ! $tzname = $cookie_TZ; ! // override if an argument is passed. ! if ($new_tzname) ! $tzname = $new_tzname; ! // check it. tz_select returns a success value. ! if (empty($tzname) || !tz_select($tzname)) { /* Try the default. Yes, I *do* want a single equals there. If ! * $default_TZ is true, this will succeed. */ if ($tzname = $default_TZ) { ! if (!tz_select($tzname)) ! { ! // complain if the default is set, because it's bad. ! error("specified default time zone is invalid: $default_TZ"); return false; ! } ! } ! else { // given timezone is bad and no default, so just exit quietly return false; --- 1193,1229 ---- */ function set_TZ($new_tzname='',$method='') { ! global $_PSL, $HTTP_GET_VARS, $HTTP_COOKIE_VARS, $HTTP_SERVER_VARS; ! $fn = "set_TZ"; $default_TZ = ''; $host = ''; ! // debug("$fn: start",$new_tzname); ! // default: value in _PSL array. if (!empty($_PSL['timezone']['name'])) { ! $default_TZ = $_PSL['timezone']['name']; } ! if (!$default_TZ && !empty($_PSL['timezone']['native']) && !empty($_PSL['timezone']['default'])) { ! $default_TZ = $_PSL['timezone']['default']; } ! // start with cookie value if it's set ! $cookie_TZ = $HTTP_COOKIE_VARS['TZ']; ! if (!empty($cookie_TZ)) { ! $tzname = $cookie_TZ; ! } ! // override if an argument is passed. ! if ($new_tzname) ! $tzname = $new_tzname; ! // check it. tz_select returns a success value. ! if (empty($tzname) || !tz_select($tzname)) { /* Try the default. Yes, I *do* want a single equals there. If ! * $default_TZ is true, this will succeed. */ if ($tzname = $default_TZ) { ! if (!tz_select($tzname)) { ! // complain if the default is set, because it's bad. ! echo getError("specified default time zone is invalid: $default_TZ"); return false; ! } ! } else { // given timezone is bad and no default, so just exit quietly return false; *************** *** 1232,1242 **** } //$host = str_replace('www.','',$HTTP_SERVER_VARS['SERVER_NAME']); ! if ('cookie'==$method) { // save the cookie setcookie('TZ',$tzname,time() + 15552000,'/',$host); - /* - * in setSkinTpl a redirect is called. Is that really - * necessary? - */ } elseif (!empty($cookie_TZ) && $tzname != $cookie_TZ) { --- 1231,1237 ---- } //$host = str_replace('www.','',$HTTP_SERVER_VARS['SERVER_NAME']); ! if (('cookie'==$method) && ($tzname != $cookie_TZ)){ // save the cookie setcookie('TZ',$tzname,time() + 15552000,'/',$host); } elseif (!empty($cookie_TZ) && $tzname != $cookie_TZ) { |