private static function getParametersFromUrl($url) { $returnValue = array(); // get parameters parse_str(parse_url($url, PHP_URL_QUERY), $returnValue); // encoded in url $parts = explode('/', tao_helpers_Request::getRelativeUrl($url), 4); if (count($parts) == 4) { list($extension, $module, $action, $codedUri) = $parts; $base64String = base64_decode($codedUri); if ($base64String !== false) { // old serialised url if (substr($base64String, 0, strlen('a:')) == 'a:') { $additionalParams = unserialize($base64String); } else { $additionalParams = json_decode($base64String, true); } if ($additionalParams !== false && is_array($additionalParams)) { foreach ($additionalParams as $key => $value) { $returnValue[$key] = $value; } } } } return $returnValue; }
public function render() { $relPath = tao_helpers_Request::getRelativeUrl(); list($extension, $module, $action, $codedUri, $path) = explode('/', $relPath, 5); $uri = base64_decode($codedUri); $item = new core_kernel_classes_Resource($uri); if ($path == 'index') { $this->renderItem($item); } else { $this->renderResource($item, urldecode($path)); } }
public function resolve($relativeUrl) { $config = $this->getConfig(); try { $relNs = \tao_helpers_Request::getRelativeUrl($config['namespace']); if (substr($relativeUrl, 0, strlen($relNs)) == $relNs) { return 'oat\\ontoBrowser\\actions\\Browse@standAlone'; } } catch (\ResolverException $r) { // namespace does not match URL, aborting } return null; }
public function render() { $relPath = tao_helpers_Request::getRelativeUrl(); list($extension, $module, $action, $codedUri, $path) = explode('/', $relPath, 5); $path = rawurldecode($path); $uri = base64_decode($codedUri); if (!common_Utils::isUri($uri)) { throw new common_exception_BadRequest('"' . $codedUri . '" does not decode to a valid item URI'); } $item = new core_kernel_classes_Resource($uri); if ($path === 'index') { $this->renderItem($item); } else { $this->renderResource($item, $path); } }
public function accessFile() { list($extension, $module, $action, $code, $filePath) = explode('/', tao_helpers_Request::getRelativeUrl(), 5); list($key, $subPath) = explode(' ', base64_decode($code), 2); $source = WebsourceManager::singleton()->getWebsource($key); if ($source instanceof ActionWebSource) { $path = $source->getFileSystem()->getPath() . $subPath . (empty($filePath) ? '' : DIRECTORY_SEPARATOR . $filePath); tao_helpers_Http::returnFile($path); } }