Beispiel #1
0
 /**
  * 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();
     }
 }
 /**
  * Ensure that this page is available to the user.
  */
 function validate()
 {
     parent::validate(true);
     if (!Validation::isJournalManager()) {
         Validation::redirectLogin();
     }
 }
 /**
  * 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();
     }
 }
Beispiel #4
0
 /**
  * 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();
     }
 }
 /**
  * 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);
 }
 /**
  * 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')));
 }
Beispiel #7
0
 /**
  * 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');
     }
 }
Beispiel #8
0
 /**
  * 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');
     }
 }
 /**
  * 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');
 }
 /**
  * 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();
     }
 }
Beispiel #11
0
 /**
  * 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;
 }
Beispiel #12
0
 /**
  * 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;
 }
Beispiel #13
0
 /**
  * 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;
 }
Beispiel #14
0
 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);
 }
Beispiel #15
0
 /**
  * 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;
 }
 /**
  * Validation
  * @see lib/pkp/classes/handler/PKPHandler#validate()
  * @param $request Request
  * @param $issueId int
  * @param $galleyId int
  */
 function validate($request, $issueId = null, $galleyId = null)
 {
     $returner = parent::validate(null, $request);
     // Validate requests that don't specify an issue or galley
     if (!$issueId && !$galleyId) {
         return $returner;
     }
     // Require an issue id to continue
     if (!$issueId) {
         $request->redirect(null, 'index');
     }
     import('classes.issue.IssueAction');
     $journal =& $request->getJournal();
     $journalId = $journal->getId();
     $user =& $request->getUser();
     $userId = $user ? $user->getId() : 0;
     $issue = null;
     $galley = null;
     // Get the issue
     $issueDao =& DAORegistry::getDAO('IssueDAO');
     if ($journal->getSetting('enablePublicIssueId')) {
         $issue =& $issueDao->getIssueByBestIssueId($issueId, $journalId);
     } else {
         $issue =& $issueDao->getIssueById((int) $issueId, null, true);
     }
     // Invalid issue id, redirect to current issue
     if (!$issue || !$this->_isVisibleIssue($issue, $journalId)) {
         $request->redirect(null, null, 'current');
     }
     $this->setIssue($issue);
     // If no issue galley id provided, then we're done
     if (!$galleyId) {
         return true;
     }
     // Get the issue galley
     $galleyDao =& DAORegistry::getDAO('IssueGalleyDAO');
     if ($journal->getSetting('enablePublicGalleyId')) {
         $galley =& $galleyDao->getGalleyByBestGalleyId($galleyId, $issue->getId());
     } else {
         $galley =& $galleyDao->getGalley($galleyId, $issue->getId());
     }
     // Invalid galley id, redirect to issue page
     if (!$galley) {
         $request->redirect(null, null, 'view', $issueId);
     }
     $this->setGalley($galley);
     // If this is an editorial user who can view unpublished issue galleys,
     // bypass further validation
     if (IssueAction::allowedIssuePrePublicationAccess($journal)) {
         return true;
     }
     // Ensure reader has rights to view the issue galley
     if ($issue->getPublished()) {
         $subscriptionRequired = IssueAction::subscriptionRequired($issue);
         $isSubscribedDomain = IssueAction::subscribedDomain($journal, $issueId);
         // Check if login is required for viewing.
         if (!$isSubscribedDomain && !Validation::isLoggedIn() && $journal->getSetting('restrictArticleAccess')) {
             Validation::redirectLogin();
         }
         // If no domain/ip subscription, check if user has a valid subscription
         // or if the user has previously purchased the issue
         if (!$isSubscribedDomain && $subscriptionRequired) {
             // Check if user has a valid subscription
             $subscribedUser = IssueAction::subscribedUser($journal, $issueId);
             if (!$subscribedUser) {
                 // Check if payments are enabled,
                 import('classes.payment.ojs.OJSPaymentManager');
                 $paymentManager = new OJSPaymentManager($request);
                 if ($paymentManager->purchaseIssueEnabled() || $paymentManager->membershipEnabled()) {
                     // If only pdf files are being restricted, then approve all non-pdf galleys
                     // and continue checking if it is a pdf galley
                     if ($paymentManager->onlyPdfEnabled() && !$galley->isPdfGalley()) {
                         return true;
                     }
                     if (!Validation::isLoggedIn()) {
                         Validation::redirectLogin("payment.loginRequired.forIssue");
                     }
                     // If the issue galley has been purchased, then allow reader access
                     $completedPaymentDao =& DAORegistry::getDAO('OJSCompletedPaymentDAO');
                     $dateEndMembership = $user->getSetting('dateEndMembership', 0);
                     if ($completedPaymentDao->hasPaidPurchaseIssue($userId, $issueId) || !is_null($dateEndMembership) && $dateEndMembership > time()) {
                         return true;
                     } else {
                         // Otherwise queue an issue purchase payment and display payment form
                         $queuedPayment =& $paymentManager->createQueuedPayment($journalId, PAYMENT_TYPE_PURCHASE_ISSUE, $userId, $issueId, $journal->getSetting('purchaseIssueFee'));
                         $queuedPaymentId = $paymentManager->queuePayment($queuedPayment);
                         $templateMgr =& TemplateManager::getManager();
                         $paymentManager->displayPaymentForm($queuedPaymentId, $queuedPayment);
                         exit;
                     }
                 }
                 if (!Validation::isLoggedIn()) {
                     Validation::redirectLogin("reader.subscriptionRequiredLoginText");
                 }
                 $request->redirect(null, 'about', 'subscriptions');
             }
         }
     } else {
         $request->redirect(null, 'index');
     }
     return true;
 }
 /**
  * Validate that the user is the assigned copyeditor for
  * the article, if specified. Validate user role.
  * @param $request PKPRequest
  * @param $articleId int optional
  */
 function validate($request, $articleId = null)
 {
     parent::validate();
     if ($articleId !== null) {
         $copyeditorSubmissionDao =& DAORegistry::getDAO('CopyeditorSubmissionDAO');
         $journal =& $request->getJournal();
         $user =& $request->getUser();
         $isValid = true;
         $copyeditorSubmission =& $copyeditorSubmissionDao->getCopyeditorSubmission($articleId, $user->getId());
         if ($copyeditorSubmission == null) {
             $isValid = false;
         } else {
             if ($copyeditorSubmission->getJournalId() != $journal->getId()) {
                 $isValid = false;
             } else {
                 if ($copyeditorSubmission->getUserIdBySignoffType('SIGNOFF_COPYEDITING_INITIAL') != $user->getId()) {
                     $isValid = false;
                 }
             }
         }
         if (!$isValid) {
             $request->redirect(null, $request->getRequestedPage());
         }
         $this->submission =& $copyeditorSubmission;
     }
 }
Beispiel #18
0
 /**
  * Validation
  */
 function validate($articleId, $galleyId = null)
 {
     parent::validate(true);
     import('issue.IssueAction');
     $journal =& Request::getJournal();
     $journalId = $journal->getJournalId();
     $article = $publishedArticle = $issue = null;
     $publishedArticleDao =& DAORegistry::getDAO('PublishedArticleDAO');
     if ($journal->getSetting('enablePublicArticleId')) {
         $publishedArticle =& $publishedArticleDao->getPublishedArticleByBestArticleId($journalId, $articleId);
     } else {
         $publishedArticle =& $publishedArticleDao->getPublishedArticleByArticleId((int) $articleId, $journalId);
     }
     $issueDao =& DAORegistry::getDAO('IssueDAO');
     if (isset($publishedArticle)) {
         $issue =& $issueDao->getIssueByArticleId($publishedArticle->getArticleId(), $journalId);
     } else {
         $articleDao =& DAORegistry::getDAO('ArticleDAO');
         $article =& $articleDao->getArticle((int) $articleId, $journalId);
     }
     // If this is an editorial user who can view unpublished/unscheduled
     // articles, bypass further validation.
     if (($article || $publishedArticle) && IssueAction::allowedPrePublicationAccess($journal)) {
         return array($journal, $issue, $publishedArticle ? $publishedArticle : $article);
     }
     // Make sure the reader has rights to view the article/issue.
     if ($issue && $issue->getPublished()) {
         $subscriptionRequired = IssueAction::subscriptionRequired($issue);
         $isSubscribedDomain = IssueAction::subscribedDomain($journal, $issue->getIssueId(), $articleId);
         // Check if login is required for viewing.
         if (!$isSubscribedDomain && !Validation::isLoggedIn() && $journal->getSetting('restrictArticleAccess') && isset($galleyId) && $galleyId != 0) {
             Validation::redirectLogin();
         }
         // bypass all validation if subscription based on domain or ip is valid
         // or if the user is just requesting the abstract
         if (!$isSubscribedDomain && $subscriptionRequired && (isset($galleyId) && $galleyId != 0)) {
             // Subscription Access
             $subscribedUser = IssueAction::subscribedUser($journal, $issue->getIssueId(), $articleId);
             if (!(!$subscriptionRequired || $publishedArticle->getAccessStatus() || $subscribedUser)) {
                 // if payment information is enabled,
                 import('payment.ojs.OJSPaymentManager');
                 $paymentManager =& OJSPaymentManager::getManager();
                 if ($paymentManager->purchaseArticleEnabled() || $paymentManager->membershipEnabled()) {
                     /* if only pdf files are being restricted, then approve all non-pdf galleys
                      * and continue checking if it is a pdf galley */
                     if ($paymentManager->onlyPdfEnabled()) {
                         $galleyDAO =& DAORegistry::getDAO('ArticleGalleyDAO');
                         $galley =& $galleyDAO->getGalley($galleyId, $articleId);
                         if ($galley && !$galley->isPdfGalley()) {
                             return array($journal, $issue, $publishedArticle);
                         }
                     }
                     if (!Validation::isLoggedIn()) {
                         Validation::redirectLogin("payment.loginRequired.forArticle");
                     }
                     $user =& Request::getUser();
                     $userId = $user->getUserId();
                     /* if the article has been paid for then forget about everything else
                      * and just let them access the article */
                     $completedPaymentDAO =& DAORegistry::getDAO('OJSCompletedPaymentDAO');
                     if ($completedPaymentDAO->hasPaidPerViewArticle($userId, $articleId) || !is_null($user->getDateEndMembership()) && strtotime($user->getDateEndMembership()) > time()) {
                         return array($journal, $issue, $publishedArticle);
                     } else {
                         $queuedPayment =& $paymentManager->createQueuedPayment($journalId, PAYMENT_TYPE_PURCHASE_ARTICLE, $user->getUserId(), $articleId, $journal->getSetting('purchaseArticleFee'));
                         $queuedPaymentId = $paymentManager->queuePayment($queuedPayment);
                         $templateMgr =& TemplateManager::getManager();
                         $paymentManager->displayPaymentForm($queuedPaymentId, $queuedPayment);
                         exit;
                     }
                 }
                 if (!isset($galleyId) || $galleyId) {
                     if (!Validation::isLoggedIn()) {
                         Validation::redirectLogin("reader.subscriptionRequiredLoginText");
                     }
                     Request::redirect(null, 'about', 'subscriptions');
                 }
             }
         }
     } else {
         Request::redirect(null, 'index');
     }
     return array($journal, $issue, $publishedArticle);
 }
Beispiel #19
0
 /**
  * Validation
  * @see lib/pkp/classes/handler/PKPHandler#validate()
  * @param $request Request
  * @param $paperId integer
  * @param $galleyId integer
  */
 function validate(&$request, $paperId, $galleyId = null)
 {
     $router =& $request->getRouter();
     parent::validate(null, $request);
     $conference =& $router->getContext($request, CONTEXT_CONFERENCE);
     $schedConf =& $router->getContext($request, CONTEXT_SCHED_CONF);
     $conferenceId = $conference->getId();
     $publishedPaperDao = DAORegistry::getDAO('PublishedPaperDAO');
     if ($schedConf->getSetting('enablePublicPaperId')) {
         $paper =& $publishedPaperDao->getPublishedPaperByBestPaperId($schedConf->getId(), $paperId, $schedConf->getSetting('previewAbstracts') ? true : false);
     } else {
         $paper =& $publishedPaperDao->getPublishedPaperByPaperId((int) $paperId, $schedConf->getId(), $schedConf->getSetting('previewAbstracts') ? true : false);
     }
     // if paper does not exist, is not published, or is not part of
     // the right conference & sched conf, redirect to index.
     if (isset($schedConf) && isset($paper) && isset($conference) && $paper->getSchedConfId() == $schedConf->getId() && $schedConf->getConferenceId() == $conference->getId()) {
         // Check if login is required for viewing.
         if (!Validation::isLoggedIn() && $schedConf->getSetting('restrictPaperAccess')) {
             Validation::redirectLogin();
         }
         import('classes.schedConf.SchedConfAction');
         $mayViewPaper = SchedConfAction::mayViewPapers($schedConf, $conference);
         if (isset($galleyId) && $galleyId != 0 && !$mayViewPaper || (!isset($galleyId) || $galleyId == 0) && !SchedConfAction::mayViewProceedings($schedConf)) {
             $this->setupTemplate($request);
             $templateMgr =& TemplateManager::getManager($request);
             $templateMgr->assign_by_ref('paper', $paper);
             $templateMgr->assign_by_ref('schedConf', $schedConf);
             $templateMgr->assign_by_ref('conference', $conference);
             $templateMgr->display('paper/accessDenied.tpl');
             exit;
         }
     } else {
         $request->redirect(null, null, 'index');
     }
     $this->paper =& $paper;
     return true;
 }
Beispiel #20
0
 /**
  * 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();
     $templateMgr->assign('helpTopicId', 'user.searchAndBrowse');
     $templateMgr->assign('pageHierarchy', $subclass ? array(array(Request::url(null, 'search'), 'navigation.search')) : array());
     $journal =& Request::getJournal();
     if (!$journal || !$journal->getSetting('restrictSiteAccess')) {
         $templateMgr->setCacheability(CACHEABILITY_PUBLIC);
     }
 }
Beispiel #21
0
 /**
  * Display submissions page.
  */
 function submissions()
 {
     parent::validate(true);
     $this->setupTemplate();
     $conference =& Request::getConference();
     $schedConf =& Request::getSchedConf();
     $settings = $schedConf ? $schedConf->getSettings() : $conference->getSettings();
     $templateMgr =& TemplateManager::getManager();
     $submissionChecklist = $schedConf ? $schedConf->getLocalizedSetting('submissionChecklist') : null;
     if (!empty($submissionChecklist)) {
         ksort($submissionChecklist);
         reset($submissionChecklist);
     }
     $templateMgr->assign('submissionChecklist', $submissionChecklist);
     if ($schedConf) {
         $templateMgr->assign('authorGuidelines', $schedConf->getLocalizedSetting('authorGuidelines'));
     }
     $templateMgr->assign('copyrightNotice', $conference->getLocalizedSetting('copyrightNotice'));
     $templateMgr->assign('privacyStatement', $conference->getLocalizedSetting('privacyStatement'));
     $templateMgr->assign('helpTopicId', 'submission.authorGuidelines');
     $templateMgr->display('about/submissions.tpl');
 }
 /**
  * Validate that the user is the assigned section editor for
  * the article, or is a managing editor.
  * Redirects to sectionEditor index page if validation fails.
  * @param $articleId int Optional article ID to validate, or null for none
  * @param $access int Optional name of access level required -- see SECTION_EDITOR_ACCESS_... constants
  */
 function validate($articleId = null, $access = null)
 {
     parent::validate();
     $isValid = true;
     $sectionEditorSubmissionDao =& DAORegistry::getDAO('SectionEditorSubmissionDAO');
     $journal =& Request::getJournal();
     $user =& Request::getUser();
     if ($articleId !== null) {
         $sectionEditorSubmission =& $sectionEditorSubmissionDao->getSectionEditorSubmission($articleId);
         if ($sectionEditorSubmission == null) {
             $isValid = false;
         } else {
             if ($sectionEditorSubmission->getJournalId() != $journal->getId()) {
                 $isValid = false;
             } else {
                 if ($sectionEditorSubmission->getDateSubmitted() == null) {
                     $isValid = false;
                 } else {
                     $templateMgr =& TemplateManager::getManager();
                     if (Validation::isEditor()) {
                         // Make canReview and canEdit available to templates.
                         // Since this user is an editor, both are available.
                         $templateMgr->assign('canReview', true);
                         $templateMgr->assign('canEdit', true);
                     } else {
                         // If this user isn't the submission's editor, they don't have access.
                         $editAssignments =& $sectionEditorSubmission->getEditAssignments();
                         $wasFound = false;
                         foreach ($editAssignments as $editAssignment) {
                             if ($editAssignment->getEditorId() == $user->getId()) {
                                 $templateMgr->assign('canReview', $editAssignment->getCanReview());
                                 $templateMgr->assign('canEdit', $editAssignment->getCanEdit());
                                 switch ($access) {
                                     case SECTION_EDITOR_ACCESS_EDIT:
                                         if ($editAssignment->getCanEdit()) {
                                             $wasFound = true;
                                         }
                                         break;
                                     case SECTION_EDITOR_ACCESS_REVIEW:
                                         if ($editAssignment->getCanReview()) {
                                             $wasFound = true;
                                         }
                                         break;
                                     default:
                                         $wasFound = true;
                                 }
                                 break;
                             }
                         }
                         if (!$wasFound) {
                             $isValid = false;
                         }
                     }
                 }
             }
         }
         if (!$isValid) {
             return Request::redirect(null, Request::getRequestedPage());
         }
         // If necessary, note the current date and time as the "underway" date/time
         $editAssignmentDao =& DAORegistry::getDAO('EditAssignmentDAO');
         $editAssignments =& $sectionEditorSubmission->getEditAssignments();
         foreach ($editAssignments as $editAssignment) {
             if ($editAssignment->getEditorId() == $user->getId() && $editAssignment->getDateUnderway() === null) {
                 $editAssignment->setDateUnderway(Core::getCurrentDate());
                 $editAssignmentDao->updateEditAssignment($editAssignment);
             }
         }
         $this->submission =& $sectionEditorSubmission;
         return true;
     }
 }
Beispiel #23
0
 /**
  * Validate that user has author permissions in the selected journal.
  * Redirects to user index page if not properly authenticated.
  */
 function validate($reason = null)
 {
     $this->addCheck(new HandlerValidatorRoles($this, true, $reason, null, array(ROLE_ID_AUTHOR)));
     return parent::validate();
 }
Beispiel #24
0
 /**
  * Display search results for a topic search by keyword.
  */
 function search()
 {
     parent::validate();
     HelpHandler::setupTemplate();
     $searchResults = array();
     $keyword = trim(String::regexp_replace('/[^\\w\\s\\.\\-]/', '', strip_tags(Request::getUserVar('keyword'))));
     if (!empty($keyword)) {
         $topicDao =& DAORegistry::getDAO('HelpTopicDAO');
         $topics = $topicDao->getTopicsByKeyword($keyword);
         $tocDao =& DAORegistry::getDAO('HelpTocDAO');
         foreach ($topics as $topic) {
             $searchResults[] = array('topic' => $topic, 'toc' => $tocDao->getToc($topic->getTocId()));
         }
     }
     $templateMgr =& TemplateManager::getManager();
     $templateMgr->assign('showSearch', true);
     $templateMgr->assign('pageTitle', Locale::translate('help.searchResults'));
     $templateMgr->assign('helpSearchKeyword', $keyword);
     $templateMgr->assign('searchResults', $searchResults);
     $templateMgr->display('help/searchResults.tpl');
 }
 function validate($referralId = null)
 {
     parent::validate();
     if ($referralId) {
         $referralDao =& DAORegistry::getDAO('ReferralDAO');
         $publishedArticleDao =& DAORegistry::getDAO('PublishedArticleDAO');
         $referral =& $referralDao->getReferral($referralId);
         if (!$referral) {
             Request::redirect(null, 'index');
         }
         $user =& Request::getUser();
         $journal =& Request::getJournal();
         $article =& $publishedArticleDao->getPublishedArticleByArticleId($referral->getArticleId());
         if (!$article || !$journal) {
             Request::redirect(null, 'index');
         }
         if ($article->getJournalId() != $journal->getId()) {
             Request::redirect(null, 'index');
         }
         // The article's submitter, journal SE, and journal Editors are allowed.
         if ($article->getUserId() != $user->getId() && !Validation::isSectionEditor($journal->getId()) && !Validation::isEditor($journal->getId())) {
             Request::redirect(null, 'index');
         }
     } else {
         $referral = $article = null;
     }
     $plugin =& Registry::get('plugin');
     return array(&$plugin, &$referral, &$article);
 }
Beispiel #26
0
 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();
     $investigatorName = false;
     if (Request::getUserVar('investigatorName')) {
         $columns = $columns + array('investigator' => Locale::translate('search.investigator'));
         $investigatorName = true;
     }
     $investigatorAffiliation = false;
     if (Request::getUserVar('investigatorAffiliation')) {
         $columns = $columns + array('investigator_affiliation' => Locale::translate('search.investigatorAffiliation'));
         $investigatorAffiliation = true;
     }
     $investigatorEmail = false;
     if (Request::getUserVar('investigatorEmail')) {
         $columns = $columns + array('investigator_email' => Locale::translate('search.investigatorEmail'));
         $investigatorEmail = true;
     }
     if (Request::getUserVar('scientificTitle')) {
         $columns = $columns + array('title' => Locale::translate('article.scientificTitle'));
     }
     $researchDomain = false;
     if (Request::getUserVar('researchDomain')) {
         $columns = $columns + array('research_domain' => Locale::translate('proposal.researchDomains'));
         $researchDomain = true;
     }
     $researchField = false;
     if (Request::getUserVar('researchField')) {
         $columns = $columns + array('research_field' => Locale::translate('search.researchField'));
         $researchField = true;
     }
     $proposalType = false;
     if (Request::getUserVar('proposalType')) {
         $columns = $columns + array('proposal_type' => Locale::translate('article.proposalType'));
         $proposalType = true;
     }
     $duration = false;
     if (Request::getUserVar('duration')) {
         $columns = $columns + array('duration' => Locale::translate('search.duration'));
         $duration = true;
     }
     $area = false;
     if (Request::getUserVar('area')) {
         $columns = $columns + array('area' => Locale::translate('common.area'));
         $area = true;
     }
     $dataCollection = false;
     if (Request::getUserVar('dataCollection')) {
         $columns = $columns + array('data_collection' => Locale::translate('search.dataCollection'));
         $dataCollection = true;
     }
     $status = false;
     if (Request::getUserVar('status')) {
         $columns = $columns + array('status' => Locale::translate('search.status'));
         $status = true;
     }
     $studentResearch = false;
     if (Request::getUserVar('studentResearch')) {
         $columns = $columns + array('student_institution' => Locale::translate('article.studentInstitution'));
         $columns = $columns + array('academic_degree' => Locale::translate('article.academicDegree'));
         $studentResearch = true;
     }
     $kii = false;
     if (Request::getUserVar('kii')) {
         $columns = $columns + array('kii' => Locale::translate('proposal.keyImplInstitution'));
         $kii = true;
     }
     $dateSubmitted = false;
     if (Request::getUserVar('dateSubmitted')) {
         $columns = $columns + array('date_submitted' => Locale::translate('search.dateSubmitted'));
         $dateSubmitted = 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, $statusFilter, $fromDate, $toDate, $investigatorName, $investigatorAffiliation, $investigatorEmail, $researchDomain, $researchField, $proposalType, $duration, $area, $dataCollection, $status, $studentResearch, $kii, $dateSubmitted);
     foreach ($results as $result) {
         $abstract = $result->getLocalizedAbstract();
         $proposalDetails = $result->getProposalDetails();
         $studentInfo = $proposalDetails->getStudentResearchInfo();
         foreach ($columns as $index => $junk) {
             if ($index == 'investigator') {
                 $columns[$index] = $result->getPrimaryAuthor();
             } elseif ($index == 'investigator_affiliation') {
                 $columns[$index] = $result->getInvestigatorAffiliation();
             } elseif ($index == 'investigator_email') {
                 $columns[$index] = $result->getAuthorEmail();
             } elseif ($index == 'title') {
                 $columns[$index] = $abstract->getScientificTitle();
             } elseif ($index == 'research_domain') {
                 $columns[$index] = $proposalDetails->getLocalizedResearchDomainsText();
             } elseif ($index == 'research_field') {
                 $columns[$index] = $proposalDetails->getLocalizedResearchFieldText();
             } elseif ($index == 'proposal_type') {
                 $columns[$index] = $proposalDetails->getLocalizedProposalTypeText();
             } elseif ($index == "duration") {
                 $columns[$index] = $proposalDetails->getStartDate() . " to " . $proposalDetails->getEndDate();
             } elseif ($index == 'area') {
                 if ($proposalDetails->getMultiCountryResearch() == PROPOSAL_DETAIL_YES) {
                     $columns[$index] = "Multi-country Research";
                 } elseif ($proposalDetails->getNationwide() == PROPOSAL_DETAIL_YES) {
                     $columns[$index] = "Nationwide Research";
                 } else {
                     $columns[$index] = $proposalDetails->getLocalizedGeoAreasText();
                 }
             } elseif ($index == 'data_collection') {
                 $columns[$index] = Locale::translate($proposalDetails->getDataCollectionKey());
             } elseif ($index == 'status') {
                 if ($result->getStatus() == '11') {
                     $columns[$index] = 'Complete';
                 } else {
                     $columns[$index] = 'Ongoing';
                 }
             } elseif ($index == 'student_institution') {
                 if ($proposalDetails->getStudentResearch() == PROPOSAL_DETAIL_YES) {
                     $columns[$index] = $studentInfo->getInstitution();
                 } else {
                     $columns[$index] = "Non Student Research";
                 }
             } elseif ($index == 'academic_degree') {
                 if ($proposalDetails->getStudentResearch() == PROPOSAL_DETAIL_YES) {
                     $columns[$index] = Locale::translate($studentInfo->getDegreeKey());
                 } else {
                     $columns[$index] = "Non Student Research";
                 }
             } elseif ($index == 'kii') {
                 $columns[$index] = $proposalDetails->getKeyImplInstitutionName();
             } elseif ($index == 'date_submitted') {
                 $columns[$index] = $result->getDateSubmitted();
             }
         }
         String::fputcsv($fp, $columns);
     }
     fclose($fp);
     unset($columns);
 }
Beispiel #27
0
 /**
  * Generate csv file for the submission report
  * @param $args (type)
  */
 function generateSubmissionsReport($args)
 {
     parent::validate();
     $this->setupTemplate();
     $journal =& Request::getJournal();
     $journalId = $journal->getId();
     //Get user filter decision
     $submissionsAndCriterias = $this->_getFilteredSubmissions($journalId);
     $submissions = $submissionsAndCriterias[0];
     $criterias = $submissionsAndCriterias[1];
     $reportType = Request::getUserVar('reportType');
     switch ($reportType) {
         case 0:
             $this->_CSVReport($submissions, $criterias);
             break;
         case 1:
             $this->_simpleChart($submissions, $criterias, $reportType);
             break;
         case 2:
             $this->_simpleChart($submissions, $criterias, $reportType);
             break;
         default:
             break;
     }
 }
 /**
  * Validate that the user is the assigned proofreader for the submission,
  * if a submission ID is specified.
  * Redirects to proofreader index page if validation fails.
  * @param $articleId int optional
  */
 function validate(&$request, $articleId = null)
 {
     parent::validate();
     if ($articleId !== null) {
         $isValid = false;
         $journal =& $request->getJournal();
         $user =& $request->getUser();
         $proofreaderDao =& DAORegistry::getDAO('ProofreaderSubmissionDAO');
         $signoffDao =& DAORegistry::getDAO('SignoffDAO');
         $submission =& $proofreaderDao->getSubmission($articleId, $journal->getId());
         if (isset($submission)) {
             $proofSignoff = $signoffDao->build('SIGNOFF_PROOFREADING_PROOFREADER', ASSOC_TYPE_ARTICLE, $articleId);
             if ($proofSignoff->getUserId() == $user->getId()) {
                 $isValid = true;
             }
         }
         if (!$isValid) {
             $request->redirect(null, $request->getRequestedPage());
         }
         $this->submission =& $submission;
     }
     return true;
 }
 function validate()
 {
     parent::validate();
     $schedConf =& Request::getSchedConf();
     if (!SchedConfAction::mayViewSchedConf($schedConf)) {
         Request::redirect(null, 'index');
     }
     return true;
 }
Beispiel #30
0
 /**
  * Show advanced search results.
  * @param $args array
  * @param $request PKPRequest
  */
 function advancedResults($args, &$request)
 {
     parent::validate();
     $this->setupTemplate($request, true);
     $rangeInfo = $this->getRangeInfo($request, 'search');
     $publishedPaperDao = DAORegistry::getDAO('PublishedPaperDAO');
     $searchConferenceId = $request->getUserVar('searchConference');
     if (!empty($searchConferenceId)) {
         $conferenceDao = DAORegistry::getDAO('ConferenceDAO');
         $conference =& $conferenceDao->getById($searchConferenceId);
         $yearRange = $publishedPaperDao->getPaperYearRange($conference->getId());
     } else {
         $conference =& $request->getConference();
         $yearRange = $publishedPaperDao->getPaperYearRange(null);
     }
     // Load the keywords array with submitted values
     $keywords = array(null => PaperSearch::parseQuery($request->getUserVar('query')));
     $keywords[PAPER_SEARCH_AUTHOR] = PaperSearch::parseQuery($request->getUserVar('author'));
     $keywords[PAPER_SEARCH_TITLE] = PaperSearch::parseQuery($request->getUserVar('title'));
     $keywords[PAPER_SEARCH_DISCIPLINE] = PaperSearch::parseQuery($request->getUserVar('discipline'));
     $keywords[PAPER_SEARCH_SUBJECT] = PaperSearch::parseQuery($request->getUserVar('subject'));
     $keywords[PAPER_SEARCH_TYPE] = PaperSearch::parseQuery($request->getUserVar('type'));
     $keywords[PAPER_SEARCH_COVERAGE] = PaperSearch::parseQuery($request->getUserVar('coverage'));
     $keywords[PAPER_SEARCH_GALLEY_FILE] = PaperSearch::parseQuery($request->getUserVar('fullText'));
     $keywords[PAPER_SEARCH_SUPPLEMENTARY_FILE] = PaperSearch::parseQuery($request->getUserVar('supplementaryFiles'));
     $fromDate = $request->getUserDateVar('dateFrom', 1, 1);
     if ($fromDate !== null) {
         $fromDate = date('Y-m-d H:i:s', $fromDate);
     }
     $toDate = $request->getUserDateVar('dateTo', 32, 12, null, 23, 59, 59);
     if ($toDate !== null) {
         $toDate = date('Y-m-d H:i:s', $toDate);
     }
     $results =& PaperSearch::retrieveResults($conference, $keywords, $fromDate, $toDate, $rangeInfo);
     $templateMgr =& TemplateManager::getManager($request);
     $templateMgr->setCacheability(CACHEABILITY_NO_STORE);
     $templateMgr->assign_by_ref('results', $results);
     $this->_assignAdvancedSearchParameters($request, $templateMgr, $yearRange);
     $templateMgr->display('search/searchResults.tpl');
 }