public function shutdown(Sabel_Bus $bus) { $response = $bus->get("response"); $redirector = $response->getRedirector(); if ($redirector->isRedirected()) { if (($url = $redirector->getUrl()) !== "") { $response->setLocation($url); } else { $token = $bus->get("request")->getValueWithMethod("token"); $hasToken = !empty($token); $hasParams = $redirector->hasParameters(); $location = $redirector->getUri(); if ($hasToken) { $glue = $hasParams ? "&" : "?"; $location .= $glue . "token={$token}"; } $session = $bus->get("session"); if ($session->isStarted() && !$session->isCookieEnabled()) { $glue = $hasToken || $hasParams ? "&" : "?"; $location .= $glue . $session->getName() . "=" . $session->getId(); } if (function_exists("get_uri_prefix")) { $location = get_uri_prefix() . "/" . ltrim($location, "/"); } $response->setLocation($location); } } $response->outputHeader(); }
public function shutdown(Sabel_Bus $bus) { $response = $bus->get("response"); $redirector = $response->getRedirector(); if ($redirector->isRedirected()) { if (($url = $redirector->getUrl()) !== "") { $response->setLocation($url); } else { $location = $redirector->getUri(true, false); if (($session = $bus->get("session")) !== null) { if ($session->isStarted() && !$session->isCookieEnabled()) { $glue = $redirector->hasParameters() ? "&" : "?"; $location .= $glue . $session->getName() . "=" . $session->getId(); } } if (($flagment = $redirector->getFlagment()) !== "") { $location .= "#{$flagment}"; } if (function_exists("get_uri_prefix")) { $location = get_uri_prefix() . $location; } $response->setLocation($location); } } $response->outputHeader(); }
/** * create uri */ function uri($param, $secure = false, $absolute = false) { $context = Sabel_Context::getContext(); $prefix = get_uri_prefix($secure, $absolute); return $prefix . "/" . $context->getCandidate()->uri($param); }
/** * create uri */ function uri($uri, $secure = false, $absolute = false) { $context = Sabel_Context::getContext(); return get_uri_prefix($secure, $absolute) . "/" . $context->getCandidate()->uri($uri); }
public function build($limit, array $getValues = array()) { $page = 1; $pageKey = $this->attributes["pageKey"]; if (isset($getValues[$pageKey])) { $page = $getValues[$pageKey]; if (!is_numeric($page) || $page < 1) { $page = 1; } } $model = $this->model; $attributes =& $this->attributes; $uriQuery = array(); foreach ($getValues as $key => $val) { if ($key === $pageKey) { unset($getValues[$key]); } elseif (is_array($val)) { foreach ($val as $k => $v) { $uriQuery[] = urlencode("{$key}[{$k}]") . "=" . urlencode($v); } } else { $uriQuery[] = urlencode($key) . "=" . urlencode($val); } } $attributes["uriQuery"] = implode("&", $uriQuery); $count = $this->isJoin ? $model->getCount(null, false) : $model->getCount(); $attributes["count"] = $count; $attributes["limit"] = $limit; $attributes["page"] = $page; $pager = new Sabel_View_Pager($count, $limit); $pager->setPageNumber($page); $attributes["viewer"] = new Sabel_View_PageViewer($pager); if ($count === 0) { $attributes["offset"] = 0; $attributes["results"] = array(); } else { $offset = $pager->getSqlOffset(); $this->_setOrderBy($getValues); $model->setLimit($limit); $model->setOffset($offset); $attributes["offset"] = $offset; $attributes["results"] = $model->{$this->method}(); if ($this->uri === null && ($request = Sabel_Context::getRequest())) { $attributes["uri"] = get_uri_prefix() . "/" . $request->getUri(); } } return $this; }
/** * @check_client_id */ public function destroy() { $result = $this->getLogic("user")->destroy($this->aclUser->id); if ($result->isSuccess()) { $this->aclUser->logout(); $this->redirect->uri(get_uri_prefix()); } }
function thumbnail_uri($name, $size = null) { $uri = get_uri_prefix() . "/" . Imanage_Addon::THUMBNAIL_URI; return $uri . "?name={$name}&size={$size}"; }