本文整理汇总了PHP中Handler::validate方法的典型用法代码示例。如果您正苦于以下问题:PHP Handler::validate方法的具体用法?PHP Handler::validate怎么用?PHP Handler::validate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Handler
的用法示例。
在下文中一共展示了Handler::validate方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: validate
/**
* Validate that user has admin privileges and is not trying to access the admin module with a journal selected.
* Redirects to the user index page if not properly authenticated.
*/
function validate()
{
parent::validate();
if (!Validation::isSiteAdmin() || Request::getRequestedJournalPath() != 'index') {
Validation::redirectLogin();
}
}
示例2: validate
/**
* Ensure that this page is available to the user.
*/
function validate()
{
parent::validate(true);
if (!Validation::isJournalManager()) {
Validation::redirectLogin();
}
}
示例3: validate
/**
* Validate that user is a copyeditor in the selected journal.
* Redirects to user index page if not properly authenticated.
*/
function validate()
{
parent::validate();
$journal =& Request::getJournal();
if (!isset($journal) || !Validation::isCopyeditor($journal->getJournalId())) {
Validation::redirectLogin();
}
}
示例4: validate
/**
* Validate that user has permissions to manage the selected journal.
* Redirects to user index page if not properly authenticated.
*/
function validate()
{
parent::validate();
$journal =& Request::getJournal();
if (!$journal || !Validation::isJournalManager() && !Validation::isSiteAdmin()) {
Validation::redirectLogin();
}
}
示例5: validate
/**
* Validate that user has author permissions in the selected journal.
* Redirects to user index page if not properly authenticated.
*/
function validate($reason = null)
{
parent::validate();
$journal =& Request::getJournal();
if (!isset($journal) || !Validation::isAuthor($journal->getJournalId())) {
Validation::redirectLogin($reason);
}
return array(&$journal);
}
示例6: setupTemplate
/**
* Setup common template variables.
* @param $subclass boolean set to true if caller is below this handler in the hierarchy
*/
function setupTemplate($subclass = false)
{
parent::validate();
$templateMgr =& TemplateManager::getManager();
$journal =& Request::getJournal();
if (!$journal || !$journal->getSetting('restrictSiteAccess')) {
$templateMgr->setCacheability(CACHEABILITY_PUBLIC);
}
$templateMgr->assign('pageHierachy', array(array(Request::url(null, 'announcements'), 'announcement.announcements')));
}
示例7: index
/**
* If no journal is selected, display list of journals.
* Otherwise, display the index page for the selected journal.
*/
function index($args)
{
parent::validate();
$templateMgr =& TemplateManager::getManager();
$journalDao =& DAORegistry::getDAO('JournalDAO');
$journalPath = Request::getRequestedJournalPath();
$templateMgr->assign('helpTopicId', 'user.home');
if ($journalPath != 'index' && $journalDao->journalExistsByPath($journalPath)) {
$journal =& Request::getJournal();
// Assign header and content for home page
$templateMgr->assign('displayPageHeaderTitle', $journal->getJournalPageHeaderTitle(true));
$templateMgr->assign('displayPageHeaderLogo', $journal->getJournalPageHeaderLogo(true));
$templateMgr->assign('additionalHomeContent', $journal->getLocalizedSetting('additionalHomeContent'));
$templateMgr->assign('homepageImage', $journal->getLocalizedSetting('homepageImage'));
$templateMgr->assign('journalDescription', $journal->getLocalizedSetting('description'));
$displayCurrentIssue = $journal->getSetting('displayCurrentIssue');
$issueDao =& DAORegistry::getDAO('IssueDAO');
$issue =& $issueDao->getCurrentIssue($journal->getJournalId());
if ($displayCurrentIssue && isset($issue)) {
import('pages.issue.IssueHandler');
// The current issue TOC/cover page should be displayed below the custom home page.
IssueHandler::setupIssueTemplate($issue);
}
// Display creative commons logo/licence if enabled
$templateMgr->assign('displayCreativeCommons', $journal->getSetting('includeCreativeCommons'));
$enableAnnouncements = $journal->getSetting('enableAnnouncements');
if ($enableAnnouncements) {
$enableAnnouncementsHomepage = $journal->getSetting('enableAnnouncementsHomepage');
if ($enableAnnouncementsHomepage) {
$numAnnouncementsHomepage = $journal->getSetting('numAnnouncementsHomepage');
$announcementDao =& DAORegistry::getDAO('AnnouncementDAO');
$announcements =& $announcementDao->getNumAnnouncementsNotExpiredByJournalId($journal->getJournalId(), $numAnnouncementsHomepage);
$templateMgr->assign('announcements', $announcements);
$templateMgr->assign('enableAnnouncementsHomepage', $enableAnnouncementsHomepage);
}
}
$templateMgr->display('index/journal.tpl');
} else {
$siteDao =& DAORegistry::getDAO('SiteDAO');
$site =& $siteDao->getSite();
if ($site->getRedirect() && ($journal = $journalDao->getJournal($site->getJournalRedirect())) != null) {
Request::redirect($journal->getPath());
}
$templateMgr->assign('intro', $site->getSiteIntro());
$templateMgr->assign('journalFilesPath', Request::getBaseUrl() . '/' . Config::getVar('files', 'public_files_dir') . '/journals/');
$journals =& $journalDao->getEnabledJournals();
$templateMgr->assign_by_ref('journals', $journals);
$templateMgr->setCacheability(CACHEABILITY_PUBLIC);
$templateMgr->display('index/site.tpl');
}
}
示例8: plugin
/**
* Handle requests for gateway plugins.
*/
function plugin($args)
{
parent::validate();
$pluginName = array_shift($args);
$plugins =& PluginRegistry::loadCategory('gateways');
if (isset($pluginName) && isset($plugins[$pluginName])) {
$plugin =& $plugins[$pluginName];
if (!$plugin->fetch($args)) {
Request::redirect(null, 'index');
}
} else {
Request::redirect(null, 'index');
}
}
示例9: index
/**
* Display the information page for the journal..
*/
function index($args)
{
parent::validate();
InformationHandler::setupTemplate();
$journal = Request::getJournal();
if ($journal == null) {
Request::redirect('index');
return;
}
switch (isset($args[0]) ? $args[0] : null) {
case 'readers':
$content = $journal->getLocalizedSetting('readerInformation');
$pageTitle = 'navigation.infoForReaders.long';
$pageCrumbTitle = 'navigation.infoForReaders';
break;
case 'authors':
$content = $journal->getLocalizedSetting('authorInformation');
$pageTitle = 'navigation.infoForAuthors.long';
$pageCrumbTitle = 'navigation.infoForAuthors';
break;
case 'librarians':
$content = $journal->getLocalizedSetting('librarianInformation');
$pageTitle = 'navigation.infoForLibrarians.long';
$pageCrumbTitle = 'navigation.infoForLibrarians';
break;
case 'competingInterestGuidelines':
$content = $journal->getLocalizedSetting('competingInterestGuidelines');
$pageTitle = $pageCrumbTitle = 'navigation.competingInterestGuidelines';
break;
case 'sampleCopyrightWording':
$content = Locale::translate('manager.setup.authorCopyrightNotice.sample');
$pageTitle = $pageCrumbTitle = 'manager.setup.copyrightNotice';
break;
default:
Request::redirect($journal->getPath());
return;
}
$templateMgr =& TemplateManager::getManager();
$templateMgr->assign('pageCrumbTitle', $pageCrumbTitle);
$templateMgr->assign('pageTitle', $pageTitle);
$templateMgr->assign('content', $content);
$templateMgr->display('information/information.tpl');
}
示例10: validate
/**
* Validate that user is a section editor in the selected journal.
* Redirects to user index page if not properly authenticated.
*/
function validate()
{
parent::validate();
$journal =& Request::getJournal();
// FIXME This is kind of evil
$page = Request::getRequestedPage();
if (!isset($journal) || $page == 'sectionEditor' && !Validation::isSectionEditor($journal->getJournalId()) || $page == 'editor' && !Validation::isEditor($journal->getJournalId())) {
Validation::redirectLogin();
}
}
示例11: validate
/**
* Validation
*/
function validate($paperId)
{
parent::validate();
$conference =& Request::getConference();
$schedConf =& Request::getSchedConf();
$publishedPaperDao =& DAORegistry::getDAO('PublishedPaperDAO');
$paper =& $publishedPaperDao->getPublishedPaperByPaperId($paperId, $schedConf->getId(), $schedConf->getSetting('previewAbstracts'));
$this->paper =& $paper;
if ($paper == null) {
Request::redirect(null, null, 'index');
}
// Bring in comment and view constants
$commentDao =& DAORegistry::getDAO('CommentDAO');
$enableComments = $conference->getSetting('enableComments');
if (!$enableComments || !$paper->getEnableComments()) {
Request::redirect(null, null, 'index');
}
$restrictPaperAccess = $conference->getSetting('restrictPaperAccess');
if ($restrictPaperAccess && !Validation::isLoggedIn()) {
Validation::redirectLogin();
}
return true;
}
示例12: validate
/**
* Validation
* @param $request PKPRequest
* @param $articleId int
*/
function validate(&$request, $articleId)
{
parent::validate();
$journal =& $request->getJournal();
$journalId = $journal->getId();
$journalSettingsDao =& DAORegistry::getDAO('JournalSettingsDAO');
$publishedArticleDao =& DAORegistry::getDAO('PublishedArticleDAO');
$article =& $publishedArticleDao->getPublishedArticleByArticleId($articleId);
// Bring in comment constants
$commentDao =& DAORegistry::getDAO('CommentDAO');
$enableComments = $journal->getSetting('enableComments');
if (!Validation::isLoggedIn() && $journalSettingsDao->getSetting($journalId, 'restrictArticleAccess') || $article && !$article->getEnableComments() || $enableComments != COMMENTS_ANONYMOUS && $enableComments != COMMENTS_AUTHENTICATED && $enableComments != COMMENTS_UNAUTHENTICATED) {
Validation::redirectLogin();
}
// Subscription Access
$issueDao =& DAORegistry::getDAO('IssueDAO');
$issue =& $issueDao->getIssueByArticleId($articleId);
if (isset($issue) && isset($article)) {
import('classes.issue.IssueAction');
$subscriptionRequired = IssueAction::subscriptionRequired($issue);
$subscribedUser = IssueAction::subscribedUser($journal, $issue->getId(), $articleId);
if (!(!$subscriptionRequired || $article->getAccessStatus() == ARTICLE_ACCESS_OPEN || $subscribedUser)) {
$request->redirect(null, 'index');
}
} else {
$request->redirect(null, 'index');
}
$this->issue =& $issue;
$this->article =& $article;
return true;
}
示例13: validate
/**
* Validate that user has site admin privileges or journal manager priveleges.
* Redirects to the user index page if not properly authenticated.
* @param $canRedirect boolean Whether or not to redirect if the user cannot be validated; if not, the script simply terminates.
*/
function validate($canRedirect = true)
{
parent::validate();
$journal =& Request::getJournal();
if (!Validation::isSiteAdmin()) {
if ($canRedirect) {
Validation::redirectLogin();
} else {
exit;
}
}
$plugin =& Registry::get('plugin');
$this->plugin =& $plugin;
return true;
}
示例14: generateCustomizedCSV
function generateCustomizedCSV($args)
{
parent::validate();
$this->setupTemplate();
$query = Request::getUserVar('query');
$region = Request::getUserVar('region');
$statusFilter = Request::getUserVar('statusFilter');
$fromDate = Request::getUserVar('dateFrom');
//if ($fromDate != null) $fromDate = date('Y-m-d H:i:s', $fromDate);
$toDate = Request::getUserVar('dateTo');
//if ($toDate != null) $toDate = date('Y-m-d H:i:s', $toDate);
$columns = array();
$proposalId = false;
if (Request::getUserVar('proposalId')) {
$columns = $columns + array('proposalId' => Locale::translate('article.submissionId'));
$proposalId = true;
}
$scientificTitle = false;
if (Request::getUserVar('scientificTitle')) {
$columns = $columns + array('scientificTitle' => Locale::translate('article.scientificTitle'));
$scientificTitle = true;
}
$publicTitle = false;
if (Request::getUserVar('publicTitle')) {
$columns = $columns + array('publicTitle' => Locale::translate('article.publicTitle'));
$publicTitle = true;
}
$recruitmentStatus = false;
if (Request::getUserVar('recruitmentStatus')) {
$columns = $columns + array('recruitmentStatus' => Locale::translate('proposal.recruitment') . ' ' . Locale::translate('proposal.recruitment.status'));
$recruitmentStatus = true;
}
$therapeuticArea = false;
if (Request::getUserVar('therapeuticArea')) {
$columns = $columns + array('therapeuticArea' => Locale::translate('proposal.therapeuticArea'));
$therapeuticArea = true;
}
$minAge = false;
if (Request::getUserVar('minAge')) {
$columns = $columns + array('minAge' => Locale::translate('proposal.age.minimum'));
$minAge = true;
}
$maxAge = false;
if (Request::getUserVar('maxAge')) {
$columns = $columns + array('maxAge' => Locale::translate('proposal.age.maximum'));
$maxAge = true;
}
$sex = false;
if (Request::getUserVar('sex')) {
$columns = $columns + array('sex' => Locale::translate('proposal.sex'));
$sex = true;
}
$healthy = false;
if (Request::getUserVar('healthy')) {
$columns = $columns + array('healthy' => Locale::translate('proposal.healthy'));
$healthy = true;
}
$pSponsor = false;
if (Request::getUserVar('pSponsor')) {
$columns = $columns + array('pSponsor' => Locale::translate('proposal.primarySponsor'));
$pSponsor = true;
}
$enrolment = false;
if (Request::getUserVar('enrolment')) {
$columns = $columns + array('enrolment' => Locale::translate('proposal.expectedDate'));
$enrolment = true;
}
header('content-type: text/comma-separated-values');
header('content-disposition: attachment; filename=searchResults-' . date('Ymd') . '.csv');
$fp = fopen('php://output', 'wt');
String::fputcsv($fp, array_values($columns));
$articleDao =& DAORegistry::getDAO('ArticleDAO');
$results = $articleDao->searchCustomizedProposalsPublic($query, $region, $fromDate, $toDate, $statusFilter, $proposalId, $scientificTitle, $publicTitle, $recruitmentStatus, $therapeuticArea, $minAge, $maxAge, $sex, $healthy, $pSponsor, $enrolment);
foreach ($results as $result) {
foreach ($columns as $index => $junk) {
if ($index == 'status') {
if ($result->getStatus() == '11') {
$columns[$index] = 'Complete';
} else {
$columns[$index] = 'Ongoing';
}
} elseif ($index == 'date_submitted') {
$columns[$index] = $result->getDateSubmitted();
}
}
String::fputcsv($fp, $columns);
}
fclose($fp);
unset($columns);
}
示例15: validate
/**
* Validate that user is logged in.
* Redirects to login form if not logged in.
* @param $loginCheck boolean check if user is logged in
*/
function validate($loginCheck = true)
{
parent::validate();
if ($loginCheck && !Validation::isLoggedIn()) {
Validation::redirectLogin();
}
return true;
}