OSDN Git Service

BugTrack/2525 Convert QueryString by PageURIHandler
authorumorigu <umorigu@gmail.com>
Sun, 28 Nov 2021 13:34:30 +0000 (22:34 +0900)
committerumorigu <umorigu@gmail.com>
Sun, 28 Nov 2021 13:34:30 +0000 (22:34 +0900)
lib/func.php
lib/init.php

index 8c01c9b..d41589c 100644 (file)
@@ -1178,6 +1178,10 @@ function get_preg_u() {
 }
 
 class PukiWikiStandardPageURIHandler {
+       function filter_raw_query_string($query_string) {
+               return $query_string;
+       }
+
        function get_page_uri_fragment($page) {
                return '?' . pagename_urlencode($page);
        }
index 859b36b..2dedd73 100644 (file)
@@ -295,6 +295,21 @@ if (PKWK_QUERY_STRING_MAX && strlen($arg) > PKWK_QUERY_STRING_MAX) {
 }
 $arg = input_filter($arg); // \0 除去
 
+// Convert QueryString by PageURIHandler
+$arg_replaced = $pkwk_page_uri_handler->filter_raw_query_string($arg);
+if ($arg_replaced !== $arg) {
+       $_GET = array();
+       $m = array();
+       foreach (explode('&', $arg_replaced) as $kv) {
+               if (preg_match('/^([^=]+)(=(.+))?/', $kv, $matches)) {
+                       $_GET[$m[1]] = is_null($m[3]) ? '' : $m[3];
+               }
+       }
+       unset($m);
+       $arg = $arg_replaced;
+}
+unset($arg_replaced);
+
 // unset QUERY_STRINGs
 foreach (array('QUERY_STRING', 'argv', 'argc') as $key) {
        unset(${$key}, $_SERVER[$key], $HTTP_SERVER_VARS[$key]);