diff --git a/kona3engine/action/login.inc.php b/kona3engine/action/login.inc.php index ce7bdc0..33ee0e2 100644 --- a/kona3engine/action/login.inc.php +++ b/kona3engine/action/login.inc.php @@ -101,13 +101,13 @@ function kona3_action_login() { } // login form $kona3conf["robots"] = "noindex"; - kona3template('login.html', array( + kona3template('login.html', [ "page_title" => $page, "msg" => $msg, "action" => $action, "signup_link" => kona3getPageURL($page, 'signup'), "edit_token" => kona3_getEditToken($editTokenKey, TRUE), - )); + ]); } diff --git a/kona3engine/index.inc.php b/kona3engine/index.inc.php index 0b059c1..c776105 100644 --- a/kona3engine/index.inc.php +++ b/kona3engine/index.inc.php @@ -31,8 +31,9 @@ } } // session -$wiki_title = isset($kona3conf['wiki_title']) ? $kona3conf['wiki_title'] : '_def'; -session_start(['name' => urlencode("kona3{$wiki_title}")]); +$wiki_title = isset($kona3conf['wiki_title']) ? $kona3conf['wiki_title'] : 'KonaWiki3'; +$session_name = isset($kona3conf['session_name']) ? $kona3conf['session_name'] : 'kona3session'; +session_start(['name' => $session_name]); // -------------------- // include library diff --git a/kona3engine/kona3conf.inc.php b/kona3engine/kona3conf.inc.php index 87d895e..5d55ce8 100644 --- a/kona3engine/kona3conf.inc.php +++ b/kona3engine/kona3conf.inc.php @@ -18,6 +18,7 @@ // -------------------- function kona3conf_init(&$conf) { check_conf($conf, 'wiki_title', 'KonaWiki3'); + check_conf($conf, 'session_name', 'kona3session'); check_conf($conf, 'admin_email', 'admin@example.com'); check_conf($conf, 'wiki_private', TRUE); check_conf($conf, 'lang', 'ja'); diff --git a/kona3engine/kona3lib.inc.php b/kona3engine/kona3lib.inc.php index 9abf070..e682966 100644 --- a/kona3engine/kona3lib.inc.php +++ b/kona3engine/kona3lib.inc.php @@ -695,13 +695,13 @@ function kona3_getEditTokenForceUpdate($key = 'default') { $sname = kona3_getEditTokenKeyName($key); $sname_time = "{$sname}.time"; // update token - if (empty($kona3conf["{$sname}_token"])) { + if (empty($kona3conf[$sname])) { $token = bin2hex(random_bytes(32)); $_SESSION[$sname] = $token; $_SESSION[$sname_time] = time(); - $kona3conf["{$sname}_token"] = $token; + $kona3conf[$sname] = $token; } - return $kona3conf["{$sname}_token"]; + return $kona3conf[$sname]; } function kona3_getEditToken($key = 'default', $update = TRUE) { @@ -716,7 +716,7 @@ function kona3_getEditToken($key = 'default', $update = TRUE) { return kona3_getEditTokenForceUpdate($key); } // check time - $ONE_DAY = 60 * 60 * 24; // 1day + $ONE_DAY = 3;// 60 * 60 * 24; // 1day $time = isset($_SESSION[$sname_time]) ? $_SESSION[$sname_time] : time(); $expire_time = $time + $ONE_DAY; if (time() > $expire_time) {