/** * Imports PATH_INFO string as parameters. * * @param boolean $importPathInfo * @since Method available since Release 0.4.0 */ function importPathInfo() { $pathInfo = Piece_Unity_Request::getPathInfo(); if (is_null($pathInfo)) { return; } $pathInfoParameters = explode('/', trim($pathInfo, '/')); for ($i = 0, $count = count($pathInfoParameters); $i < $count; $i += 2) { $this->_parameters[$pathInfoParameters[$i]] = @$pathInfoParameters[$i + 1]; } }
/** * Gets the script name from the REQUEST_URI variable. * * @return string * @since Method available since Release 1.7.1 */ function _getScriptName() { $requestURI = str_replace('//', '/', @$_SERVER['REQUEST_URI']); $positionOfQuestion = strpos($requestURI, '?'); if ($positionOfQuestion) { $scriptName = substr($requestURI, 0, $positionOfQuestion); } else { $scriptName = $requestURI; } $pathInfo = Piece_Unity_Request::getPathInfo(); if (is_null($pathInfo)) { return $scriptName; } $positionOfPathInfo = strrpos($scriptName, $pathInfo); if ($positionOfPathInfo) { return substr($scriptName, 0, $positionOfPathInfo); } return $scriptName; }
/** * Stores the requested URI with the given realm. * * @param string $realm */ function _storeRequestedURI($realm) { if (!array_key_exists('QUERY_STRING', $_SERVER) || !strlen($_SERVER['QUERY_STRING'])) { $query = ''; } else { $query = "?{$_SERVER['QUERY_STRING']}"; } $pathInfo = Piece_Unity_Request::getPathInfo(); if (!is_null($pathInfo)) { $pathInfo = str_replace('%2F', '/', rawurlencode($pathInfo)); } if ($this->_context->isSecure()) { $protocol = 'https'; } else { $protocol = 'http'; } if ($this->_context->isRunningOnStandardPort()) { $port = ''; } else { $port = ":{$_SERVER['SERVER_PORT']}"; } $this->_authenticationState->setCallbackURI($realm, "{$protocol}://{$_SERVER['SERVER_NAME']}{$port}" . $this->_context->getOriginalScriptName() . "{$pathInfo}{$query}"); }