From 5661e32b1ce977d4fe98b73f468bdf5695464c56 Mon Sep 17 00:00:00 2001 From: Michael Save Date: Wed, 30 Jan 2013 04:45:38 +1100 Subject: Instead of showing $config['error']['malformed'] on corrupt session, just go straight to the login form --- inc/mod/auth.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'inc/mod/auth.php') diff --git a/inc/mod/auth.php b/inc/mod/auth.php index 8fb01ecb..b3b23553 100644 --- a/inc/mod/auth.php +++ b/inc/mod/auth.php @@ -98,8 +98,10 @@ if (isset($_COOKIE[$config['cookies']['mod']])) { // Should be username:hash:salt $cookie = explode(':', $_COOKIE[$config['cookies']['mod']]); if (count($cookie) != 3) { + // Malformed cookies destroyCookies(); - error($config['error']['malformed']); + // error($config['error']['malformed']); + mod_login(); } $query = prepare("SELECT `id`, `type`, `boards`, `password` FROM `mods` WHERE `username` = :username LIMIT 1"); @@ -111,7 +113,8 @@ if (isset($_COOKIE[$config['cookies']['mod']])) { if ($cookie[1] !== mkhash($cookie[0], $user['password'], $cookie[2])) { // Malformed cookies destroyCookies(); - error($config['error']['malformed']); + // error($config['error']['malformed']); + mod_login(); } $mod = array( -- cgit v1.3 From 2051018ba170ef1bb4d47afdcdee78156563c719 Mon Sep 17 00:00:00 2001 From: Michael Save Date: Wed, 30 Jan 2013 05:07:09 +1100 Subject: ... --- inc/mod/auth.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'inc/mod/auth.php') diff --git a/inc/mod/auth.php b/inc/mod/auth.php index b3b23553..73a24c44 100644 --- a/inc/mod/auth.php +++ b/inc/mod/auth.php @@ -100,8 +100,8 @@ if (isset($_COOKIE[$config['cookies']['mod']])) { if (count($cookie) != 3) { // Malformed cookies destroyCookies(); - // error($config['error']['malformed']); mod_login(); + exit; } $query = prepare("SELECT `id`, `type`, `boards`, `password` FROM `mods` WHERE `username` = :username LIMIT 1"); @@ -113,8 +113,8 @@ if (isset($_COOKIE[$config['cookies']['mod']])) { if ($cookie[1] !== mkhash($cookie[0], $user['password'], $cookie[2])) { // Malformed cookies destroyCookies(); - // error($config['error']['malformed']); mod_login(); + exit; } $mod = array( -- cgit v1.3 From 3bcc87caf294cd67f221854d1dc13065706f5a81 Mon Sep 17 00:00:00 2001 From: Macil Tech Date: Wed, 27 Mar 2013 22:09:39 +0800 Subject: Fix PM count caching. cache::get() returns null if the key wasn't found (at least when using the Redis cache backend). --- inc/mod/auth.php | 2 +- inc/mod/pages.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'inc/mod/auth.php') diff --git a/inc/mod/auth.php b/inc/mod/auth.php index f594af4b..d4a2ea1c 100644 --- a/inc/mod/auth.php +++ b/inc/mod/auth.php @@ -125,7 +125,7 @@ if (isset($_COOKIE[$config['cookies']['mod']])) { function create_pm_header() { global $mod, $config; - if ($config['cache']['enabled'] && ($header = cache::get('pm_unread_' . $mod['id'])) !== false) { + if ($config['cache']['enabled'] && ($header = cache::get('pm_unread_' . $mod['id'])) != false) { if ($header === true) return false; diff --git a/inc/mod/pages.php b/inc/mod/pages.php index cf06e7d9..726ed735 100644 --- a/inc/mod/pages.php +++ b/inc/mod/pages.php @@ -89,7 +89,7 @@ function mod_dashboard() { } } - if (!$config['cache']['enabled'] || ($args['unread_pms'] = cache::get('pm_unreadcount_' . $mod['id'])) === false) { + if (!$config['cache']['enabled'] || ($args['unread_pms'] = cache::get('pm_unreadcount_' . $mod['id'])) == false) { $query = prepare('SELECT COUNT(*) FROM `pms` WHERE `to` = :id AND `unread` = 1'); $query->bindValue(':id', $mod['id']); $query->execute() or error(db_error($query)); -- cgit v1.3