oscommerce + register_globals 更新

前面的register_globals v1.5的版本还是有虫,所以要更改includes/functions/session.php及admin/includes/functions/session.php这两个档。

这个函式有问题,要改成下面这个:
function link_session_variable($var_name, $map)
  {
    if ($map)
    {
      // Map global to session variable. If the global variable is already set to some value
      // then its value overwrites the session variable. I **THINK** this is correct behaviour
      if (array_key_exists($var_name,$GLOBALS)) {
        $_SESSION[$var_name] =& $GLOBALS[$var_name];
      } else {
        $GLOBALS[$var_name] =& $_SESSION[$var_name];
      }
    }
    else
    {
      // Unmap global from session variable. Note that the global variable keeps the value of
      // the session variable. This should be unnecessary but it reflects the same behaviour
      // as having register_globals enabled, so in case the OSC code assumes this behaviour,
      // it is reproduced here
      $nothing = 0;
      $GLOBALS[$var_name] =& $nothing;
      unset($GLOBALS[$var_name]);
      $GLOBALS[$var_name] = $_SESSION[$var_name];
    }
  }

这个函式也有问题,要改成下面这个:
function tep_session_is_registered($variable) {
// >>> BEGIN REGISTER_GLOBALS
//    return session_is_registered($variable);
    return array_key_exists($variable,$_SESSION);
// <<< END REGISTER_GLOBALS
  }