Commit a29d1df86871c163b019669e72d360e04e71c31a

Authored by Neil Blakey-Milner
1 parent 1a4752e6

Retrieve the query string from the 'qs' request variable when it is

given, simplifying query string handling and controller actions.


git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@3848 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing 1 changed file with 15 additions and 11 deletions
control.php
... ... @@ -49,17 +49,21 @@ if (checkSessionAndRedirect(false)) {
49 49 }
50 50 }
51 51  
52   -// need to strip query string params from action before attempting to retrieve from sitemap
53   -$queryString = "";
54   -// check for the presence of additional params
55   -if (strstr($_SERVER["QUERY_STRING"], "&")) {
56   - // strip and save the querystring
57   - $queryString = substr($_SERVER["QUERY_STRING"], strpos($_SERVER["QUERY_STRING"], "&")+1, strlen($_SERVER["QUERY_STRING"]));
58   -} else if (strstr($_SERVER["QUERY_STRING"], "?")) {
59   - // strip and save the querystring
60   - $queryString = substr($_SERVER["QUERY_STRING"], strpos($_SERVER["QUERY_STRING"], "?")+1, strlen($_SERVER["QUERY_STRING"]));
61   - // update
62   - $action = substr($_SERVER["QUERY_STRING"], 0, strpos($_SERVER["QUERY_STRING"], "?"));
  52 +$queryString = KTUtil::arrayGet($_REQUEST, 'qs', '');
  53 +
  54 +if (empty($queryString)) {
  55 + // need to strip query string params from action before attempting to retrieve from sitemap
  56 + $queryString = "";
  57 + // check for the presence of additional params
  58 + if (strstr($_SERVER["QUERY_STRING"], "&")) {
  59 + // strip and save the querystring
  60 + $queryString = substr($_SERVER["QUERY_STRING"], strpos($_SERVER["QUERY_STRING"], "&")+1, strlen($_SERVER["QUERY_STRING"]));
  61 + } else if (strstr($_SERVER["QUERY_STRING"], "?")) {
  62 + // strip and save the querystring
  63 + $queryString = substr($_SERVER["QUERY_STRING"], strpos($_SERVER["QUERY_STRING"], "?")+1, strlen($_SERVER["QUERY_STRING"]));
  64 + // update
  65 + $action = substr($_SERVER["QUERY_STRING"], 0, strpos($_SERVER["QUERY_STRING"], "?"));
  66 + }
63 67 }
64 68  
65 69 // retrieve the page from the sitemap (checks whether this user has access to the requested page)
... ...