/** * Retrieves part of request URI selecting current application and script. * * The fetched request URI is provided as array of pathname elements, that is * pathname might be derived by joining returned elements with '/'. * * @note Fetched request URI might include further selectors to be processed * by requested script, e.g. * * myapp/myscript/par1-of-script/par2-of-script * * @param string $detectedProxy name of detected proxy script * @return array sequence of filenames contained in requested URI for selecting script */ public function getRequestedScriptUri(&$detectedProxy) { switch (txf::getContextMode()) { case txf::CTXMODE_REWRITTEN: assert('$_SERVER[REDIRECT_URL] || $_SERVER[PATH_INFO] || $_SERVER[REQUEST_URI]'); // get originally requested script (e.g. prior to rewrite) if (trim($_SERVER['REQUEST_URI']) !== '') { // use of lighttpd's rewriting detected $query = strtok($_SERVER['REQUEST_URI'], '?'); // mark rewrite mode by not selecting any valid used proxy $detectedProxy = true; } else { if (trim($_SERVER['REDIRECT_URL']) !== '') { // use of mod_rewrite detected $query = $_SERVER['REDIRECT_URL']; // mark rewrite mode by not selecting any valid used proxy $detectedProxy = true; } else { // request for proxy script (run.php) detected $query = $_SERVER['PATH_INFO']; // remember proxy script used this time, if any $detectedProxy = $this->scriptPathname; } } // derive list of application and script selectors return path::stripCommonPrefix(explode('/', $query), $this->prefixPathname); // txf::CTXMODE_NORMAL // txf::CTXMODE_NORMAL default: // expect application and script selectors being part of requested // script pathname return preg_split('#/+#', $this->applicationScriptPathname); } }