本文整理匯總了PHP中PKPRequest::redirectUrl方法的典型用法代碼示例。如果您正苦於以下問題:PHP PKPRequest::redirectUrl方法的具體用法?PHP PKPRequest::redirectUrl怎麽用?PHP PKPRequest::redirectUrl使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類PKPRequest
的用法示例。
在下文中一共展示了PKPRequest::redirectUrl方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: signOut
/**
* Log a user out.
*/
function signOut()
{
$this->validate();
$this->setupTemplate();
if (Validation::isLoggedIn()) {
Validation::logout();
}
$source = Request::getUserVar('source');
if (isset($source) && !empty($source)) {
PKPRequest::redirectUrl(Request::getProtocol() . '://' . Request::getServerHost() . $source, false);
} else {
PKPRequest::redirect(null, Request::getRequestedPage());
}
}
示例2: download
/**
* Download an article file
* @param array $args
* @param PKPRequest $request
*/
function download($args, $request)
{
$articleId = isset($args[0]) ? $args[0] : 0;
$galleyId = isset($args[1]) ? $args[1] : 0;
$fileId = isset($args[2]) ? (int) $args[2] : 0;
if ($this->galley->getRemoteURL()) {
$request->redirectUrl($this->galley->getRemoteURL());
}
if ($this->userCanViewGalley($request, $articleId, $galleyId)) {
if (!$fileId) {
$submissionFile = $this->galley->getFile();
if ($submissionFile) {
$fileId = $submissionFile->getFileId();
// The file manager expects the real article id. Extract it from the submission file.
$articleId = $submissionFile->getSubmissionId();
} else {
// no proof files assigned to this galley!
return null;
}
}
if (!HookRegistry::call('ArticleHandler::download', array($this->article, &$this->galley, &$fileId))) {
import('lib.pkp.classes.file.SubmissionFileManager');
$submissionFileManager = new SubmissionFileManager($this->article->getContextId(), $this->article->getId());
$submissionFileManager->downloadFile($fileId, null, $request->getUserVar('inline') ? true : false);
}
}
}