Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit bd64022

Browse files
author
iustin
committed
npas ok
1 parent 5eb3820 commit bd64022

File tree

1 file changed

+33
-9
lines changed

1 file changed

+33
-9
lines changed

‎src/router.class.php‎

Lines changed: 33 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -478,6 +478,22 @@ private function URIhasPHP()
478478

479479
}
480480

481+
public function is_root_script()
482+
{
483+
484+
if (
485+
$this->format_unix($_SERVER['SCRIPT_FILENAME']) === $this->format_unix($_SERVER['DOCUMENT_ROOT'] . '/' . $this->indexPath)
486+
&& $this->getExt($this->indexPath) == 'php'
487+
) {
488+
489+
return TRUE;
490+
491+
}
492+
493+
return FALSE;
494+
495+
}
496+
481497
/**
482498
* Adjust some $_SERVER variables
483499
*/
@@ -508,24 +524,32 @@ function fix_path_info()
508524
unset($_SERVER['HTTP_L']);
509525
}
510526

511-
if (!isset($_SERVER['PHP_INFO']) && substr($_SERVER['REQUEST_URI'], -1, 1) !== '/' && $this->getExt($_SERVER['REQUEST_URI']) == "") {
512527

513-
$_SERVER['REQUEST_URI'] = $_SERVER['REQUEST_URI'] . '/';
514-
$_SERVER['PHP_SELF'] = $_SERVER['PHP_SELF'] . '/';
528+
if (!$this->is_root_script()) {
529+
530+
if (!isset($_SERVER['PHP_INFO']) && substr($_SERVER['REQUEST_URI'], -1, 1) !== '/' && $this->getExt($_SERVER['REQUEST_URI']) == "") {
531+
532+
$_SERVER['REQUEST_URI'] = $_SERVER['REQUEST_URI'] . '/';
533+
$_SERVER['PHP_SELF'] = $_SERVER['PHP_SELF'] . '/';
534+
535+
}
536+
537+
return FALSE;
515538

516539
}
540+
/**/
517541

518-
if( !isset($_SERVER['ORIG_PHP_SELF'])){
542+
if (!isset($_SERVER['ORIG_PHP_SELF'])){
519543
$_SERVER['ORIG_PHP_SELF'] = $_SERVER['PHP_SELF'];
520544
}
521-
if( !isset($_SERVER['ORIG_PHP_SELF'])){
545+
if (!isset($_SERVER['ORIG_PHP_SELF'])){
522546
$_SERVER['ORIG_PATH_INFO'] = "";
523547
}
524548
$_SERVER['ORIG_PATH_INFO'] = isset($_SERVER['PATH_INFO']) ? $_SERVER['PATH_INFO'] : "";
525549

526-
$_SERVER['PATH_INFO'] = $path_info;
550+
//$_SERVER['PATH_INFO'] = $path_info;
527551

528-
$_SERVER['PHP_SELF'] = $_SERVER['SCRIPT_NAME'] . $_SERVER['PATH_INFO'];
552+
$_SERVER['PHP_SELF'] = $_SERVER['SCRIPT_NAME'] . (isset($_SERVER['PATH_INFO']) ? $_SERVER['PATH_INFO'] : "");
529553

530554
if (substr($_SERVER['PHP_SELF'], -1, 1) == '/') {
531555
$_SERVER['PHP_SELF'] = substr($_SERVER['PHP_SELF'], 0, -1);
@@ -562,8 +586,8 @@ function listen()
562586
*/
563587

564588
if ($this->getExt($this->URI_no_query()) == "") {
565-
566-
header("Content-Length: ".$this->file_length);
589+
590+
//header("Content-Length: ".$this->file_length);
567591

568592
return FALSE;
569593

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /