aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorben <ben@36083f99-b078-4883-b0ff-0f9b5a30f544>2008-04-16 08:48:52 +0000
committerben <ben@36083f99-b078-4883-b0ff-0f9b5a30f544>2008-04-16 08:48:52 +0000
commit3c243370e251e9b48d12e4d129834305e1acffdc (patch)
tree4a3ec9300d33c49a896323b55ee95a47cac90332
parenteb3656c011ebcbf733f21893865fd91a2ec8b6f1 (diff)
downloadelgg-3c243370e251e9b48d12e4d129834305e1acffdc.tar.gz
elgg-3c243370e251e9b48d12e4d129834305e1acffdc.tar.bz2
Added better GET query variable handling into the page handler mix
git-svn-id: https://code.elgg.org/elgg/trunk@471 36083f99-b078-4883-b0ff-0f9b5a30f544
-rw-r--r--engine/lib/input.php26
-rw-r--r--engine/lib/pagehandler.php17
2 files changed, 40 insertions, 3 deletions
diff --git a/engine/lib/input.php b/engine/lib/input.php
index c1b575e64..8cbea6986 100644
--- a/engine/lib/input.php
+++ b/engine/lib/input.php
@@ -23,9 +23,31 @@
if (isset($_REQUEST[$variable])) {
$value = $_REQUEST[$variable];
return trim($_REQUEST[$variable]);
- }
+ }
+
+ global $CONFIG;
+
+ if (isset($CONFIG->input[$variable]))
+ return $CONFIG->input[$variable];
return $default;
- }
+ }
+
+ /**
+ * Sets an input value that may later be retrieved by get_input
+ *
+ * @param string $variable The name of the variable
+ * @param string $value The value of the variable
+ */
+ function set_input($variable, $value) {
+
+ global $CONFIG;
+ if (!isset($CONFIG->input))
+ $CONFIG->input = array();
+ $CONFIG->input[trim($variable)] = trim($value);
+
+ }
+
+
?> \ No newline at end of file
diff --git a/engine/lib/pagehandler.php b/engine/lib/pagehandler.php
index b5bb831db..267d34bd2 100644
--- a/engine/lib/pagehandler.php
+++ b/engine/lib/pagehandler.php
@@ -22,6 +22,21 @@
global $CONFIG;
+ $query = parse_url($_SERVER['REQUEST_URI']);
+ if (isset($query['query'])) {
+ $query = $query['query'];
+ $query = rawurldecode($query);
+ $query = explode('&',$query);
+ if (sizeof($query) > 0) {
+ foreach($query as $queryelement) {
+ $vals = explode('=',$queryelement);
+ if (sizeof($vals) > 1) {
+ set_input(trim($vals[0]),trim($vals[1]));
+ }
+ }
+ }
+ }
+
$page = explode('/',$page);
if (!isset($CONFIG->pagehandler) || empty($handler)) {
$result = false;
@@ -38,7 +53,7 @@
if (!$result) {
$result = default_page_handler($page, $handler);
}
- if ($result !== false) $result = true;
+ if ($result !== false) $result = true;
return $result;