php cli server uses its own request thing

This commit is contained in:
Shish 2015-08-01 15:24:58 +01:00
parent 53f19120d2
commit ab4c558126
5 changed files with 18 additions and 8 deletions

View File

@ -437,7 +437,7 @@ function modify_url($url, $changes) {
unset($changes['q']); unset($changes['q']);
} }
else { else {
$base = $_GET['q']; $base = _get_query();
} }
if(isset($params['q'])) { if(isset($params['q'])) {
@ -1723,6 +1723,16 @@ function _get_user() {
return $user; return $user;
} }
function _get_query() {
if(php_sapi_name() == 'cli-server') {
return $_SERVER["REQUEST_URI"];
}
else {
return @$_POST["q"]?:@$_GET["q"];
}
}
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *\ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *\
* Code coverage * * Code coverage *

View File

@ -83,7 +83,7 @@ try {
$user = _get_user(); $user = _get_user();
send_event(new InitExtEvent()); send_event(new InitExtEvent());
if(!is_cli()) { // web request if(!is_cli()) { // web request
send_event(new PageRequestEvent(@$_POST["q"]?:@$_GET["q"])); send_event(new PageRequestEvent(_get_query()));
$page->display(); $page->display();
} }
else { // command line request else { // command line request

View File

@ -124,7 +124,7 @@ class Layout {
// hack // hack
$username = url_escape($user->name); $username = url_escape($user->name);
// hack // hack
$qp = explode("/", ltrim(@$_GET["q"], "/")); $qp = explode("/", ltrim(_get_query(), "/"));
// php sucks // php sucks
switch($qp[0]) { switch($qp[0]) {
default: default:
@ -245,7 +245,7 @@ EOD;
* Woo! We can actually SEE THE CURRENT PAGE!! (well... see it highlighted in the menu.) * Woo! We can actually SEE THE CURRENT PAGE!! (well... see it highlighted in the menu.)
*/ */
$html = null; $html = null;
$url = ltrim($_GET['q'], "/"); $url = ltrim(_get_query(), "/");
$re1='.*?'; $re1='.*?';
$re2='((?:[a-z][a-z_]+))'; $re2='((?:[a-z][a-z_]+))';

View File

@ -126,7 +126,7 @@ class Layout {
// hack // hack
$username = url_escape($user->name); $username = url_escape($user->name);
// hack // hack
$qp = explode("/", ltrim(@$_GET["q"], "/")); $qp = explode("/", ltrim(_get_query(), "/"));
// php sucks // php sucks
switch($qp[0]) { switch($qp[0]) {
default: default:
@ -271,7 +271,7 @@ EOD;
* Woo! We can actually SEE THE CURRENT PAGE!! (well... see it highlighted in the menu.) * Woo! We can actually SEE THE CURRENT PAGE!! (well... see it highlighted in the menu.)
*/ */
$html = null; $html = null;
$url = $_GET['q']; $url = _get_query();
$re1='.*?'; $re1='.*?';
$re2='((?:[a-z][a-z_]+))'; $re2='((?:[a-z][a-z_]+))';

View File

@ -82,7 +82,7 @@ class Layout {
// hack // hack
$username = url_escape($user->name); $username = url_escape($user->name);
// hack // hack
$qp = explode("/", ltrim(@$_GET["q"], "/")); $qp = explode("/", ltrim(_get_query(), "/"));
$cs = ""; $cs = "";
// php sucks // php sucks
@ -256,7 +256,7 @@ EOD;
* Woo! We can actually SEE THE CURRENT PAGE!! (well... see it highlighted in the menu.) * Woo! We can actually SEE THE CURRENT PAGE!! (well... see it highlighted in the menu.)
*/ */
$html = null; $html = null;
$url = ltrim($_GET['q'], "/"); $url = ltrim(_get_query(), "/");
$re1='.*?'; $re1='.*?';
$re2='((?:[a-z][a-z_]+))'; $re2='((?:[a-z][a-z_]+))';