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 5c9d863

Browse files
cleanup
1 parent b9781c5 commit 5c9d863

File tree

1 file changed

+29
-10
lines changed

1 file changed

+29
-10
lines changed

‎src/router.class.php‎

Lines changed: 29 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
<?php
2-
error_reporting(E_ALL);
32
$headers = array('Accept', 'Accept-CH', 'Accept-Charset', 'Accept-Datetime', 'Accept-Encoding', 'Accept-Ext', 'Accept-Features', 'Accept-Language', 'Accept-Params', 'Accept-Ranges',
43
'Access-Control-Allow-Credentials', 'Access-Control-Allow-Headers', 'Access-Control-Allow-Methods', 'Access-Control-Allow-Origin', 'Access-Control-Expose-Headers',
54
'Access-Control-Max-Age', 'Access-Control-Request-Headers', 'Access-Control-Request-Method', 'Age', 'Allow', 'Alternates', 'Authentication-Info', 'Authorization', 'C-Ext',
@@ -396,7 +395,7 @@ function console_output()
396395
} else {
397396

398397
if (file_exists($uri_filepath) && !is_dir($uri_filepath)) {
399-
//if (is_file($uri_filepath)) {
398+
//if (is_file($uri_filepath)) {
400399

401400
$this->process_request();
402401

@@ -528,7 +527,7 @@ function fix_path_info()
528527
echo 'php self:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;' . $php_self . '<br />';
529528
echo 'script name&nbsp;&nbsp;&nbsp;' . $script_name;*/
530529

531-
if( isset($_SERVER['HTTP_L'])){
530+
if (isset($_SERVER['HTTP_L'])){
532531
$_SERVER['HTTP_CACHE_CONTROL'] = $_SERVER['HTTP_L'];
533532
unset($_SERVER['HTTP_L']);
534533
}
@@ -538,7 +537,7 @@ function fix_path_info()
538537
if (!isset($_SERVER['PHP_INFO']) && substr($_SERVER['REQUEST_URI'], -1, 1) !== '/' && $this->getExt($_SERVER['REQUEST_URI']) == "") {
539538

540539
$_SERVER['REQUEST_URI'] = $_SERVER['REQUEST_URI'] . '/';
541-
$_SERVER['PHP_SELF'] = $_SERVER['PHP_SELF'] .'/';
540+
$_SERVER['PHP_SELF'] = $_SERVER['PHP_SELF'] .'/';
542541

543542
}
544543

@@ -552,10 +551,10 @@ function fix_path_info()
552551
$_SERVER['PATH_INFO'] = $path_info;
553552
//echo $_SERVER['SCRIPT_NAME'].'<br />';
554553

555-
$_SERVER['PHP_SELF'] = $_SERVER['SCRIPT_NAME'];
554+
$_SERVER['PHP_SELF'] = $_SERVER['SCRIPT_NAME'] . $_SERVER['PATH_INFO'];
556555

557-
if( substr($_SERVER['PHP_SELF'], -1, 1) == '/'){
558-
$_SERVER['PHP_SELF'] = substr($_SERVER['PHP_SELF'],0,-1);
556+
if (substr($_SERVER['PHP_SELF'], -1, 1) == '/'){
557+
$_SERVER['PHP_SELF'] = substr($_SERVER['PHP_SELF'],0, -1);
559558
}
560559

561560
}
@@ -570,8 +569,9 @@ function listen()
570569
$this->fix_path_info();
571570
$this->init();
572571

572+
$falsy_ext = $this->getExt($this->URI_no_query());
573573

574-
if (in_array($this->getExt($this->URI_no_query()), array("", "php"))) {
574+
if (in_array($falsy_ext, array("", "php"))) {
575575

576576
/**
577577
* Drupal file uploads
@@ -581,13 +581,13 @@ function listen()
581581

582582
return FALSE;
583583

584-
}else{
584+
}else{
585585

586586
/**
587587
* Wordpress wp-admin
588588
*/
589589

590-
if( $this->getExt($this->URI_no_query()) == "" ){
590+
if ($this->getExt($this->URI_no_query()) == "") {
591591

592592
/**
593593
* Output hack fix
@@ -600,6 +600,25 @@ function listen()
600600

601601
}
602602

603+
} else {
604+
605+
if (strlen(trim($falsy_ext))) {
606+
607+
/**
608+
* Check for PHP
609+
*/
610+
if (($e = strstr($falsy_ext, '/', TRUE)) !== FALSE) {
611+
$falsy_ext = $e;
612+
}
613+
614+
if ($falsy_ext == 'php') {
615+
616+
return FALSE;
617+
618+
}
619+
620+
}
621+
603622
}
604623

605624
return $this->bootstrap();

0 commit comments

Comments
(0)

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