Fix multidomain not working when domain is IDN

This commit is contained in:
Kijin Sung 2020-03-26 22:12:33 +09:00
parent 7c9b356662
commit 3ca551e5f2
2 changed files with 14 additions and 13 deletions

View file

@ -54,16 +54,16 @@ class Session
$data = $value; $data = $value;
} }
/** /**
* Start the session. * Start the session.
* *
* This method is called automatically at Rhymix startup. * This method is called automatically at Rhymix startup.
* There is usually no need to call it manually. * There is usually no need to call it manually.
* *
* @param bool $force (optional) * @param bool $force (optional)
* @param bool $relax_key_checks (optional) * @param bool $relax_key_checks (optional)
* @return bool * @return bool
*/ */
public static function start($force = false, $relax_key_checks = false) public static function start($force = false, $relax_key_checks = false)
{ {
// Do not start the session if it is already started. // Do not start the session if it is already started.
@ -80,7 +80,7 @@ class Session
ini_set('session.use_cookies', 1); ini_set('session.use_cookies', 1);
ini_set('session.use_only_cookies', 1); ini_set('session.use_only_cookies', 1);
ini_set('session.use_strict_mode', 1); ini_set('session.use_strict_mode', 1);
session_set_cookie_params($lifetime, $path, null, $ssl_only, $ssl_only); session_set_cookie_params($lifetime, $path, $domain, $ssl_only, $ssl_only);
session_name($session_name = Config::get('session.name') ?: session_name()); session_name($session_name = Config::get('session.name') ?: session_name());
// Get session ID from POST parameter if using relaxed key checks. // Get session ID from POST parameter if using relaxed key checks.
@ -462,14 +462,14 @@ class Session
return self::_setKeys(); return self::_setKeys();
} }
/** /**
* Close the session and write its data. * Close the session and write its data.
* *
* This method is called automatically at the end of a request, but you can * This method is called automatically at the end of a request, but you can
* call it sooner if you don't plan to write any more data to the session. * call it sooner if you don't plan to write any more data to the session.
* *
* @return bool * @return bool
*/ */
public static function close() public static function close()
{ {
// Restore member_srl from XE-compatible variable if it has changed. // Restore member_srl from XE-compatible variable if it has changed.

View file

@ -177,10 +177,11 @@ class moduleModel extends module
/** /**
* @brief Get the default mid according to the domain * @brief Get the default mid according to the domain
*/ */
function getDefaultMid() function getDefaultMid($domain = null)
{ {
// Get current domain. // Get current domain.
$domain = strtolower(preg_replace('/:\d+$/', '', $_SERVER['HTTP_HOST'])); $domain = $domain ?: strtolower(preg_replace('/:\d+$/', '', $_SERVER['HTTP_HOST']));
$domain = Rhymix\Framework\URL::decodeIdna($domain);
// Find the domain information. // Find the domain information.
$domain_info = $this->getSiteInfoByDomain($domain); $domain_info = $this->getSiteInfoByDomain($domain);