From 4ea249b577014497d1e34caeecf88d9cca35e16b Mon Sep 17 00:00:00 2001 From: Andrey Kutejko Date: Wed, 7 Jan 2015 20:35:28 +0200 Subject: [PATCH] move cli-server routing to index.php --- index.php | 6 +++++- ipf.php | 12 ------------ ipf/project.php | 2 -- 3 files changed, 5 insertions(+), 15 deletions(-) diff --git a/index.php b/index.php index a7cab52..489748a 100644 --- a/index.php +++ b/index.php @@ -2,9 +2,13 @@ // This is a index stub for a IPF Projects +if (php_sapi_name() === 'cli-server' && is_file($_SERVER['DOCUMENT_ROOT'] . urldecode(parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH)))) + return false; + $here = dirname(__FILE__); $project_path = $here . '/../project'; $vendor_path = $here . '/../vendor'; require_once $vendor_path.'/autoload.php'; -return IPF::setUp($project_path, $here) && IPF_Project::getInstance()->run(); +IPF::setUp($project_path, $here); +IPF_Project::getInstance()->run(); diff --git a/ipf.php b/ipf.php index 5c2d315..4f7153b 100644 --- a/ipf.php +++ b/ipf.php @@ -31,18 +31,8 @@ final class IPF die('Specify site url routes'); } - private static function requestedFileExists() - { - $parts = explode('?', $_SERVER['REQUEST_URI'], 2); - $path = $_SERVER['DOCUMENT_ROOT'] . urldecode($parts[0]); - return is_file($path); - } - public static function setUp($project_path, $document_root) { - if (php_sapi_name() === 'cli-server' && IPF::requestedFileExists()) - return false; - $project_root = dirname($project_path); self::$settings = IPF_Settings::create() @@ -69,8 +59,6 @@ final class IPF self::checkSettings(self::$settings); date_default_timezone_set(self::$settings->get('time_zone')); - - return true; } private function __construct() {} diff --git a/ipf/project.php b/ipf/project.php index ab3a4df..b3ac3a9 100644 --- a/ipf/project.php +++ b/ipf/project.php @@ -73,8 +73,6 @@ final class IPF_Project $this->request = null; } - - return true; } } -- 2.49.0