-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
142 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
<?php | ||
$baseDir = __DIR__ . "/../../../public"; | ||
$baseDir = realpath($baseDir); | ||
$path = $baseDir . $_SERVER["REQUEST_URI"]; | ||
|
||
if (!is_dir($path) && file_exists($path)) { | ||
$fileinfo = new SplFileObject($path); | ||
|
||
$mimetype = mime_content_type($path); | ||
|
||
if ($mimetype == "text/plain") { | ||
switch ($fileinfo->getExtension()) { | ||
case "js": | ||
case "json": | ||
$mimetype = "application/javascript"; | ||
break; | ||
case "css": | ||
$mimetype = "text/css"; | ||
break; | ||
} | ||
} | ||
header("Content-type: {$mimetype}"); | ||
echo trim(file_get_contents($path)); | ||
include($path); | ||
return; | ||
} | ||
|
||
ini_set("date.timezone", "Europe/Amsterdam"); | ||
|
||
// We set this value so we can detect this further on | ||
$_SERVER["PHP_SERVER"] = true; | ||
|
||
// The built-in webserver does not set these in a way Parable expects it (htaccess redirect) so we do it ourselves | ||
$_SERVER["SCRIPT_FILENAME"] = str_replace("php-server.php", "public/index.php", $_SERVER["SCRIPT_FILENAME"]); | ||
$_SERVER["SCRIPT_NAME"] = str_replace(__DIR__, "", $_SERVER["SCRIPT_FILENAME"]); | ||
|
||
// Normally the redirect is to index.php?url=REQUEST_URI, but obviously that's not the case here | ||
$_GET["url"] = $_SERVER["REQUEST_URI"]; | ||
|
||
include($_SERVER["SCRIPT_NAME"]); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -202,5 +202,4 @@ public function getBody() | |
} | ||
return $this->body; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,4 +4,4 @@ | |
|
||
class Test extends \Parable\Console\Command | ||
{ | ||
} | ||
} |