diff --git a/.htaccess b/.htaccess index bf2496d3..ebae6b97 100644 --- a/.htaccess +++ b/.htaccess @@ -22,9 +22,9 @@ AddDefaultCharset utf8 RewriteEngine on # Mapper-Helper: If you cant provide maps for all locales, redirect the browser - RewriteRule ^(.*/)static/images/wow/maps/(frfr|dede|eses|ruru)/(.*)$ $1static/images/wow/maps/enus/$3 [NC] + RewriteRule ^(.*/?)static/images/wow/maps/(frfr|dede|eses|ruru)/(.*)$ $1static/images/wow/maps/enus/$3 [NC] # accept flattened urls | NYI - need more work :x - RewriteRule ^([a-z0-9\-]+)$ ?$1 [NC] # /items => ?items - RewriteRule ^([a-z0-9\-]+)=([^?&]*)$ ?$1=$2 [NC] # /items=4.1 => ?items=4.1 - RewriteRule ^([a-z0-9\-]+)=([^?&]*)[&?](.*)$ ?$1=$2&$3 [NC] # /items=4.1?filter=sl=7 => ?items=4.1&filter=sl=7 +# RewriteRule ^([a-z0-9\-]+)$ ?$1 [NC] # /items => ?items +# RewriteRule ^([a-z0-9\-]+)=([^?&]*)$ ?$1=$2 [NC] # /items=4.1 => ?items=4.1 +# RewriteRule ^([a-z0-9\-]+)=([^?&]*)[&?](.*)$ ?$1=$2&$3 [NC] # /items=4.1?filter=sl=7 => ?items=4.1&filter=sl=7 diff --git a/includes/ajaxHandler.class.php b/includes/ajaxHandler.class.php index 80b5657c..b2d1c462 100644 --- a/includes/ajaxHandler.class.php +++ b/includes/ajaxHandler.class.php @@ -42,7 +42,7 @@ class AjaxHandler return; if ($_ = DB::Aowow()->selectRow('SELECT IFNULL(c2.id, c1.id) AS id, IFNULL(c2.type, c1.type) AS type, IFNULL(c2.typeId, c1.typeId) AS typeId FROM ?_comments c1 LEFT JOIN ?_comments c2 ON c1.replyTo = c2.id WHERE c1.id = ?d', $this->get['id'])) - header('Location: ?'.Util::$typeStrings[$_['type']].'='.$_['typeId'].'#comments:id='.$_['id'].($_['id'] != $this->get['id'] ? ':reply='.$this->get['id'] : null)); + header('Location: ?'.Util::$typeStrings[$_['type']].'='.$_['typeId'].'#comments:id='.$_['id'].($_['id'] != $this->get['id'] ? ':reply='.$this->get['id'] : null), true, 302); } /* responses @@ -303,7 +303,7 @@ class AjaxHandler } } - header('Location: ?'.Util::$typeStrings[$this->get['type']].'='.$this->get['typeid'].'#comments'); + header('Location: ?'.Util::$typeStrings[$this->get['type']].'='.$this->get['typeid'].'#comments', true, 302); break; case 'edit': if ((!User::canComment() && !User::isInGroup(U_GROUP_MODERATOR)) || empty($this->get['id']) || empty($this->post['body'])) @@ -588,7 +588,7 @@ class AjaxHandler User::setLocale($this->params[0]); User::save(); - header('Location: '.(isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '.')); + header('Location: '.(isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '.'), true, 302); } private function handleAccount() diff --git a/includes/types/basetype.class.php b/includes/types/basetype.class.php index e2c89762..e5130a1b 100644 --- a/includes/types/basetype.class.php +++ b/includes/types/basetype.class.php @@ -617,7 +617,7 @@ abstract class Filter } // do get request - header('Location: '.HOST_URL.'?'.$_SERVER['QUERY_STRING'].'='.$this->urlize()); + header('Location: '.HOST_URL.'?'.$_SERVER['QUERY_STRING'].'='.$this->urlize(), true, 302); } // sanitize input and build sql else if (!empty($_GET['filter'])) diff --git a/pages/account.php b/pages/account.php index 4484561e..b9b0de13 100644 --- a/pages/account.php +++ b/pages/account.php @@ -38,7 +38,7 @@ class AccountPage extends GenericPage $this->forwardToSignIn('account='.$pageParam); // doesn't require auth && authed else if (!$this->validCats[$pageParam][0] && User::$id) - header('Location: ?account'); // goto dashboard + header('Location: ?account', true, 302); // goto dashboard } } @@ -60,7 +60,7 @@ class AccountPage extends GenericPage $this->resetPass = false; if ($this->createRecoverPass($nStep)) // location-header after final step - header('Location: ?account=signin'); + header('Location: ?account=signin', true, 302); $this->head = sprintf(Lang::$account['recoverPass'], $nStep); break; @@ -95,7 +95,7 @@ class AccountPage extends GenericPage else { session_regenerate_id(true); // user status changed => regenerate id - header('Location: '.$this->getNext(true)); + header('Location: '.$this->getNext(true), true, 302); } } else if (!empty($_GET['token']) && ($_ = DB::Aowow()->selectCell('SELECT user FROM ?_account WHERE status IN (?a) AND token = ? AND statusTimer > UNIX_TIMESTAMP()', [ACC_STATUS_RECOVER_USER, ACC_STATUS_OK], $_GET['token']))) @@ -136,7 +136,7 @@ class AccountPage extends GenericPage case 'signout': User::destroy(); default: - header('Location: '.$this->getNext(true)); + header('Location: '.$this->getNext(true), true, 302); break; } } diff --git a/pages/event.php b/pages/event.php index f8350d58..619f8d93 100644 --- a/pages/event.php +++ b/pages/event.php @@ -37,7 +37,7 @@ class EventPage extends GenericPage // redirect if associated with a holiday if ($this->hId && $this->typeId != $this->hId) - header('Location: '.HOST_URL.'?event='.$this->hId); + header('Location: '.HOST_URL.'?event='.$this->hId, true, 302); $this->name = $this->subject->getField('name', true); } diff --git a/pages/genericPage.class.php b/pages/genericPage.class.php index aa2aab77..87ae4908 100644 --- a/pages/genericPage.class.php +++ b/pages/genericPage.class.php @@ -336,7 +336,7 @@ class GenericPage protected function forwardToSignIn($next = '') { $next = $next ? '&next='.$next : ''; - header('Location: ?account=signin'.$next); + header('Location: ?account=signin'.$next, true, 302); } /*******************/ @@ -380,6 +380,14 @@ class GenericPage public function display($override = '') // load given template string or GenericPage::$tpl { + // Heisenbug: IE11 and FF32 will sometimes (under unknown circumstances) cache 302 redirects and stop + // re-requesting them from the server but load them from local cache, thus breaking menu features. + header('Expires: Sat, 01 Jan 2000 01:00:00 GMT'); + header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT'); + header('Cache-Control: no-store, no-cache, must-revalidate'); + header('Cache-Control: post-check=0, pre-check=0', false); + header('Pragma: no-cache'); + if ($override) { $this->addAnnouncements(); diff --git a/pages/search.php b/pages/search.php index 01c7ac5c..89ba315d 100644 --- a/pages/search.php +++ b/pages/search.php @@ -173,7 +173,7 @@ class SearchPage extends GenericPage $type = Util::$typeStrings[$_['type']]; $typeId = key($_['data']); - header("Location: ?".$type.'='.$typeId); + header('Location: ?'.$type.'='.$typeId, true, 302); exit(); } } @@ -200,7 +200,7 @@ class SearchPage extends GenericPage { // empty queries go home if (!$this->query) - header("Location:?"); + header('Location: .', true, 302); parent::display(); // errors are handled in the search-template itself } diff --git a/pages/utility.php b/pages/utility.php index da1d8742..4c949f4b 100644 --- a/pages/utility.php +++ b/pages/utility.php @@ -64,7 +64,7 @@ class UtilityPage extends GenericPage $type = array_rand(array_filter(Util::$typeStrings)); $typeId = (new Util::$typeClasses[$type](null))->getRandomId(); - header('Location: ?'.Util::$typeStrings[$type].'='.$typeId); + header('Location: ?'.Util::$typeStrings[$type].'='.$typeId, true, 302); die(); case 'latest-comments': $this->lvTabs[] = array( @@ -125,7 +125,7 @@ class UtilityPage extends GenericPage break; case 'most-comments': if ($this->category && !in_array($this->category[0], [1, 7, 30])) - header('Location: ?most-comments=1'.($this->rss ? '&rss' : null)); + header('Location: ?most-comments=1'.($this->rss ? '&rss' : null), true, 302); $this->lvTabs[] = array( 'file' => 'commentpreview', diff --git a/static/js/global.js b/static/js/global.js index 774af1c1..d6bb85be 100644 --- a/static/js/global.js +++ b/static/js/global.js @@ -628,7 +628,7 @@ var PageTemplate = new function() var menuItem = [ locale.id, locale.description, - g_host + '?locale=' + locale.id, // sarjuuk: edited for unsupported subdomains # linkBefore + locale.domain + linkAfter + g_host + '/?locale=' + locale.id, // sarjuuk: edited for unsupported subdomains # linkBefore + locale.domain + linkAfter null, // more custom {rel: location.href + " domain=" + locale.domain} // also custom ];