php cli server uses its own request thing
This commit is contained in:
parent
53f19120d2
commit
ab4c558126
5 changed files with 18 additions and 8 deletions
|
@ -437,7 +437,7 @@ function modify_url($url, $changes) {
|
|||
unset($changes['q']);
|
||||
}
|
||||
else {
|
||||
$base = $_GET['q'];
|
||||
$base = _get_query();
|
||||
}
|
||||
|
||||
if(isset($params['q'])) {
|
||||
|
@ -1723,6 +1723,16 @@ function _get_user() {
|
|||
return $user;
|
||||
}
|
||||
|
||||
function _get_query() {
|
||||
if(php_sapi_name() == 'cli-server') {
|
||||
return $_SERVER["REQUEST_URI"];
|
||||
}
|
||||
else {
|
||||
return @$_POST["q"]?:@$_GET["q"];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *\
|
||||
* Code coverage *
|
||||
|
|
|
@ -83,7 +83,7 @@ try {
|
|||
$user = _get_user();
|
||||
send_event(new InitExtEvent());
|
||||
if(!is_cli()) { // web request
|
||||
send_event(new PageRequestEvent(@$_POST["q"]?:@$_GET["q"]));
|
||||
send_event(new PageRequestEvent(_get_query()));
|
||||
$page->display();
|
||||
}
|
||||
else { // command line request
|
||||
|
|
|
@ -124,7 +124,7 @@ class Layout {
|
|||
// hack
|
||||
$username = url_escape($user->name);
|
||||
// hack
|
||||
$qp = explode("/", ltrim(@$_GET["q"], "/"));
|
||||
$qp = explode("/", ltrim(_get_query(), "/"));
|
||||
// php sucks
|
||||
switch($qp[0]) {
|
||||
default:
|
||||
|
@ -245,7 +245,7 @@ EOD;
|
|||
* Woo! We can actually SEE THE CURRENT PAGE!! (well... see it highlighted in the menu.)
|
||||
*/
|
||||
$html = null;
|
||||
$url = ltrim($_GET['q'], "/");
|
||||
$url = ltrim(_get_query(), "/");
|
||||
|
||||
$re1='.*?';
|
||||
$re2='((?:[a-z][a-z_]+))';
|
||||
|
|
|
@ -126,7 +126,7 @@ class Layout {
|
|||
// hack
|
||||
$username = url_escape($user->name);
|
||||
// hack
|
||||
$qp = explode("/", ltrim(@$_GET["q"], "/"));
|
||||
$qp = explode("/", ltrim(_get_query(), "/"));
|
||||
// php sucks
|
||||
switch($qp[0]) {
|
||||
default:
|
||||
|
@ -271,7 +271,7 @@ EOD;
|
|||
* Woo! We can actually SEE THE CURRENT PAGE!! (well... see it highlighted in the menu.)
|
||||
*/
|
||||
$html = null;
|
||||
$url = $_GET['q'];
|
||||
$url = _get_query();
|
||||
|
||||
$re1='.*?';
|
||||
$re2='((?:[a-z][a-z_]+))';
|
||||
|
|
|
@ -82,7 +82,7 @@ class Layout {
|
|||
// hack
|
||||
$username = url_escape($user->name);
|
||||
// hack
|
||||
$qp = explode("/", ltrim(@$_GET["q"], "/"));
|
||||
$qp = explode("/", ltrim(_get_query(), "/"));
|
||||
$cs = "";
|
||||
|
||||
// php sucks
|
||||
|
@ -256,7 +256,7 @@ EOD;
|
|||
* Woo! We can actually SEE THE CURRENT PAGE!! (well... see it highlighted in the menu.)
|
||||
*/
|
||||
$html = null;
|
||||
$url = ltrim($_GET['q'], "/");
|
||||
$url = ltrim(_get_query(), "/");
|
||||
|
||||
$re1='.*?';
|
||||
$re2='((?:[a-z][a-z_]+))';
|
||||
|
|
Reference in a new issue