Example #1
0
 /**
  * Set the ID of the approval notice.
  * @param $approvalNoticeId int
  */
 function setApprovalNoticeId($approvalNoticeId)
 {
     if (Config::getVar('debug', 'deprecation_warnings')) {
         trigger_error('Deprecated function.');
     }
     return $this->setId($approvalNoticeId);
 }
Example #2
0
 /**
  * SCENARIO OUTLINE: Export article in DC format over OAI
  *   GIVEN a DOI and a URN have been assigned for a given {publishing object}
  *    WHEN I export the corresponding article in DC format over OAI
  *    THEN DOI and URN specific {DC fields} will be present in the OAI-message.
  *
  * EXAMPLES:
  *   publishing object | DC fields
  *   ==================|================================================
  *   issue             | <dc:source>10.4321/t.v1i1</dc:source>
  *   issue             | <dc:source>urn:nbn:de:0000-t.v1i19</dc:source>
  *   article           | <dc:identifier>10.4321/t.v1i1.1</dc:identifier>
  *   article           | <dc:identifier>urn:nbn:de:0000-t.v1i1.18</dc:identifier>
  *   galley            | <dc:relation>10.4321/t.v1i1.g1</dc:relation>
  *   galley            | <dc:relation>urn:nbn:de:0000-t.v1i1.1.g17</dc:relation>
  *   supp-file         | <dc:relation>10.4321/t.v1i1.s1</dc:relation>
  *   supp-file         | <dc:relation>urn:nbn:de:0000-t.v1i1.1.s19</dc:relation>
  */
 public function testDOIAndURN()
 {
     // Configure the web service request
     $params = array('verb' => 'GetRecord', 'metadataPrefix' => 'oai_dc', 'identifier' => 'oai:' . Config::getVar('oai', 'repository_id') . ':article/1');
     $this->webServiceRequest->setParams($params);
     // Check DOI node with XPath.
     $namespaces = array('oai_dc' => 'http://www.openarchives.org/OAI/2.0/oai_dc/', 'dc' => 'http://purl.org/dc/elements/1.1/');
     $domXPath = $this->getXPath($namespaces);
     $testCases = array('/oai:OAI-PMH/oai:GetRecord/oai:record/oai:metadata/oai_dc:dc/dc:source' => array('urn:nbn:de:0000-t.v1i19', '10.1234/t.v1i1'), '/oai:OAI-PMH/oai:GetRecord/oai:record/oai:metadata/oai_dc:dc/dc:identifier' => array('urn:nbn:de:0000-t.v1i1.18', '10.1234/t.v1i1.1'), '/oai:OAI-PMH/oai:GetRecord/oai:record/oai:metadata/oai_dc:dc/dc:relation' => array('urn:nbn:de:0000-t.v1i1.1.g17', 'urn:nbn:de:0000-t.v1i1.1.s19', '10.1234/t.v1i1.1.g1', '10.1234/t.v1i1.1.s1'));
     foreach ($testCases as $xPath => $expectedDoiList) {
         $nodeList = $domXPath->query($xPath);
         self::assertGreaterThan(1, $nodeList->length, "Error while checking {$xPath}: No nodes found.");
         foreach ($expectedDoiList as $expectedDoi) {
             for ($index = 1; $index <= $nodeList->length; $index++) {
                 $node = $nodeList->item($index - 1);
                 // self::assertType() has been removed from PHPUnit 3.6
                 // but self::assertInstanceOf() is not present in PHPUnit 3.4
                 // which is our current test server version.
                 // FIXME: change this to assertInstanceOf() after upgrading the
                 // test server.
                 self::assertTrue(is_a($node, 'DOMNode'));
                 if ($node->textContent == $expectedDoi) {
                     break;
                 }
             }
             if ($index > $nodeList->length) {
                 self::fail("Error while checking {$xPath}: Node with {$expectedDoi} not found.");
             }
         }
     }
 }
Example #3
0
 /**
  * Set ID of supplementary file.
  * @param $suppFileId int
  */
 function setSuppFileId($suppFileId)
 {
     if (Config::getVar('debug', 'deprecation_warnings')) {
         trigger_error('Deprecated function.');
     }
     return $this->setId($suppFileId);
 }
 /**
  * Determine whether the plugin is enabled. Overrides parent so that
  * the plugin will be displayed during install.
  */
 function getEnabled()
 {
     if (!Config::getVar('general', 'installed')) {
         return true;
     }
     return parent::getEnabled();
 }
Example #5
0
 /**
  * Set the ID of the access key.
  * @param $accessKeyId int
  */
 function setAccessKeyId($accessKeyId)
 {
     if (Config::getVar('debug', 'deprecation_warnings')) {
         trigger_error('Deprecated function.');
     }
     return $this->setId($accessKeyId);
 }
 /**
  * Export the locale files to the browser as a tarball.
  * Requires tar for operation (configured in config.inc.php).
  */
 function export($locale)
 {
     // Construct the tar command
     $tarBinary = Config::getVar('cli', 'tar');
     if (empty($tarBinary) || !file_exists($tarBinary)) {
         // We can use fatalError() here as we already have a user
         // friendly way of dealing with the missing tar on the
         // index page.
         fatalError('The tar binary must be configured in config.inc.php\'s cli section to use the export function of this plugin!');
     }
     $command = $tarBinary . ' cz';
     $localeFilesList = TranslatorAction::getLocaleFiles($locale);
     $localeFilesList = array_merge($localeFilesList, TranslatorAction::getMiscLocaleFiles($locale));
     $emailTemplateDao =& DAORegistry::getDAO('EmailTemplateDAO');
     $localeFilesList[] = $emailTemplateDao->getMainEmailTemplateDataFilename($locale);
     foreach (array_values(TranslatorAction::getEmailFileMap($locale)) as $emailFile) {
     }
     // Include locale files (main file and plugin files)
     foreach ($localeFilesList as $file) {
         if (file_exists($file)) {
             $command .= ' ' . escapeshellarg($file);
         }
     }
     header('Content-Type: application/x-gtar');
     header("Content-Disposition: attachment; filename=\"{$locale}.tar.gz\"");
     header('Cache-Control: private');
     // Workarounds for IE weirdness
     passthru($command);
 }
Example #7
0
 /**
  * Internal function to assign information for the Counter part of a report
  */
 function _assignTemplateCounterXML($templateManager, $begin, $end = '')
 {
     $journal =& Request::getJournal();
     $counterReportDao =& DAORegistry::getDAO('CounterReportDAO');
     $journalDao =& DAORegistry::getDAO('JournalDAO');
     $journalIds = $counterReportDao->getJournalIds();
     if ($end == '') {
         $end = $begin;
     }
     $i = 0;
     foreach ($journalIds as $journalId) {
         $journal =& $journalDao->getById($journalId);
         if (!$journal) {
             continue;
         }
         $entries = $counterReportDao->getMonthlyLogRange($journalId, $begin, $end);
         $journalsArray[$i]['entries'] = $this->_arrangeEntries($entries, $begin, $end);
         $journalsArray[$i]['journalTitle'] = $journal->getLocalizedTitle();
         $journalsArray[$i]['publisherInstitution'] = $journal->getSetting('publisherInstitution');
         $journalsArray[$i]['printIssn'] = $journal->getSetting('printIssn');
         $journalsArray[$i]['onlineIssn'] = $journal->getSetting('onlineIssn');
         $i++;
     }
     $siteSettingsDao =& DAORegistry::getDAO('SiteSettingsDAO');
     $siteTitle = $siteSettingsDao->getSetting('title', AppLocale::getLocale());
     $base_url =& Config::getVar('general', 'base_url');
     $reqUser =& Request::getUser();
     $templateManager->assign_by_ref('reqUser', $reqUser);
     $templateManager->assign_by_ref('journalsArray', $journalsArray);
     $templateManager->assign('siteTitle', $siteTitle);
     $templateManager->assign('base_url', $base_url);
 }
Example #8
0
 /**
  * Call a web service
  * @param $webServiceRequest WebServiceRequest
  * @return string the result of the web service or null in case of an error.
  */
 function &call(&$webServiceRequest)
 {
     assert(is_a($webServiceRequest, 'WebServiceRequest'));
     switch ($webServiceRequest->getMethod()) {
         case 'POST':
             $result = $this->_callPostWebService($webServiceRequest);
             break;
         case 'GET':
             $result = $this->_callGetWebService($webServiceRequest);
             break;
         default:
             // We currently only support GET and POST requests
             assert(false);
     }
     // Catch web service errors
     $nullVar = null;
     if (!$result) {
         return $nullVar;
     }
     // Clean the result
     $result = stripslashes($result);
     if (Config::getVar('i18n', 'charset_normalization') == 'On' && !String::utf8_compliant($result)) {
         $result = String::utf8_normalize($result);
     }
     return $result;
 }
Example #9
0
 /**
  * Set the ID of the registration.
  * @param $registrationId int
  */
 function setRegistrationId($registrationId)
 {
     if (Config::getVar('debug', 'deprecation_warnings')) {
         trigger_error('Deprecated function.');
     }
     return $this->setId($registrationId);
 }
Example #10
0
 /**
  * Display conference management index page.
  */
 function index($args, &$request)
 {
     // Manager requests should come to the Conference context, not Sched Conf
     if ($request->getRequestedSchedConfPath() != 'index') {
         $request->redirect(null, 'index', 'manager');
     }
     $this->validate();
     $this->setupTemplate($request);
     $conference =& $request->getConference();
     $templateMgr =& TemplateManager::getManager($request);
     // Display a warning message if there is a new version of OJS available
     $newVersionAvailable = false;
     if (Config::getVar('general', 'show_upgrade_warning')) {
         import('lib.pkp.classes.site.VersionCheck');
         if ($latestVersion = VersionCheck::checkIfNewVersionExists()) {
             $newVersionAvailable = true;
             $templateMgr->assign('latestVersion', $latestVersion);
             $currentVersion =& VersionCheck::getCurrentDBVersion();
             $templateMgr->assign('currentVersion', $currentVersion->getVersionString());
             // Get contact information for site administrator
             $roleDao = DAORegistry::getDAO('RoleDAO');
             $siteAdmins =& $roleDao->getUsersByRoleId(ROLE_ID_SITE_ADMIN);
             $templateMgr->assign_by_ref('siteAdmin', $siteAdmins->next());
         }
     }
     $templateMgr->assign('newVersionAvailable', $newVersionAvailable);
     $schedConfDao = DAORegistry::getDAO('SchedConfDAO');
     $schedConfs = $schedConfDao->getAll(false, $conference->getId());
     $templateMgr->assign_by_ref('schedConfs', $schedConfs);
     $templateMgr->assign('announcementsEnabled', $conference->getSetting('enableAnnouncements'));
     $templateMgr->assign('helpTopicId', 'conference.index');
     $templateMgr->display(ROLE_PATH_MANAGER . '/index.tpl');
 }
Example #11
0
 /**
  * Constructor
  * @param $typeId int Registration type to use
  */
 function UserRegistrationForm($typeId)
 {
     $schedConf =& Request::getSchedConf();
     $this->typeId = (int) $typeId;
     parent::Form('registration/userRegistrationForm.tpl');
     $this->addCheck(new FormValidatorCustom($this, 'registrationTypeId', 'required', 'manager.registration.form.typeIdValid', create_function('$registrationTypeId, $schedConfId, $typeId', '$registrationTypeDao =& DAORegistry::getDAO(\'RegistrationTypeDAO\'); return $registrationTypeDao->openRegistrationTypeExistsByTypeId($typeId, $schedConfId);'), array($schedConf->getId(), $typeId)));
     import('captcha.CaptchaManager');
     $captchaManager = new CaptchaManager();
     $this->captchaEnabled = $captchaManager->isEnabled() && Config::getVar('captcha', 'captcha_on_register') ? true : false;
     $user =& Request::getUser();
     if (!$user) {
         $site =& Request::getSite();
         $this->addCheck(new FormValidator($this, 'username', 'required', 'user.profile.form.usernameRequired'));
         $this->addCheck(new FormValidator($this, 'password', 'required', 'user.profile.form.passwordRequired'));
         $this->addCheck(new FormValidatorCustom($this, 'username', 'required', 'user.account.form.usernameExists', array(DAORegistry::getDAO('UserDAO'), 'userExistsByUsername'), array(), true));
         $this->addCheck(new FormValidatorAlphaNum($this, 'username', 'required', 'user.account.form.usernameAlphaNumeric'));
         $this->addCheck(new FormValidatorLength($this, 'password', 'required', 'user.account.form.passwordLengthTooShort', '>=', $site->getMinPasswordLength()));
         $this->addCheck(new FormValidatorCustom($this, 'password', 'required', 'user.account.form.passwordsDoNotMatch', create_function('$password,$form', 'return $password == $form->getData(\'password2\');'), array(&$this)));
         $this->addCheck(new FormValidator($this, 'firstName', 'required', 'user.profile.form.firstNameRequired'));
         $this->addCheck(new FormValidator($this, 'lastName', 'required', 'user.profile.form.lastNameRequired'));
         $this->addCheck(new FormValidatorEmail($this, 'email', 'required', 'user.profile.form.emailRequired'));
         $this->addCheck(new FormValidatorCustom($this, 'email', 'required', 'user.account.form.emailExists', array(DAORegistry::getDAO('UserDAO'), 'userExistsByEmail'), array(), true));
         if ($this->captchaEnabled) {
             $this->addCheck(new FormValidatorCaptcha($this, 'captcha', 'captchaId', 'common.captchaField.badCaptcha'));
         }
         $authDao =& DAORegistry::getDAO('AuthSourceDAO');
         $this->defaultAuth =& $authDao->getDefaultPlugin();
         if (isset($this->defaultAuth)) {
             $this->addCheck(new FormValidatorCustom($this, 'username', 'required', 'user.account.form.usernameExists', create_function('$username,$form,$auth', 'return (!$auth->userExists($username) || $auth->authenticate($username, $form->getData(\'password\')));'), array(&$this, $this->defaultAuth)));
         }
     }
     $this->addCheck(new FormValidatorPost($this));
 }
 /**
  * Initialize form data from the associated author.
  * @param $args array
  * @param $request PKPRequest
  */
 function initData($args, $request)
 {
     $userDao = DAORegistry::getDAO('UserDAO');
     $user = $request->getUser();
     $context = $request->getContext();
     $signoff = $this->getSignoff();
     $auditorId = $signoff->getUserId();
     $auditor = $userDao->getById($auditorId);
     $submissionDao = Application::getSubmissionDAO();
     $submission = $submissionDao->getById($this->getSubmissionId());
     $email = $this->_getMailTemplate($submission);
     // Format the review due date
     $signoffDueDate = strtotime($signoff->getDateUnderway());
     $dateFormatShort = Config::getVar('general', 'date_format_short');
     if ($signoffDueDate == -1) {
         $signoffDueDate = $dateFormatShort;
     } else {
         $signoffDueDate = strftime($dateFormatShort, $signoffDueDate);
     }
     import('lib.pkp.controllers.grid.submissions.SubmissionsListGridCellProvider');
     list($page, $operation) = SubmissionsListGridCellProvider::getPageAndOperationByUserRoles($request, $submission, $auditor->getId());
     $dispatcher = $request->getDispatcher();
     $auditUrl = $dispatcher->url($request, ROUTE_PAGE, null, $page, $operation, array('submissionId' => $submission->getId()));
     $paramArray = array('reviewerName' => $auditor->getFullName(), 'reviewDueDate' => $signoffDueDate, 'editorialContactSignature' => $user->getContactSignature(), 'auditorUserName' => $auditor->getUsername(), 'passwordResetUrl' => $dispatcher->url($request, ROUTE_PAGE, null, 'login', 'resetPassword', $auditor->getUsername(), array('confirm' => Validation::generatePasswordResetHash($auditor->getId()))), 'submissionReviewUrl' => $auditUrl, 'contextName' => $context->getLocalizedName(), 'submissionTitle' => $submission->getLocalizedTitle());
     $email->assignParams($paramArray);
     $this->setData('submissionId', $submission->getId());
     $this->setData('stageId', $this->getStageId());
     $this->setData('signoffId', $signoff->getId());
     $this->setData('signoff', $signoff);
     $this->setData('auditorName', $auditor->getFullName());
     $this->setData('message', $email->getBody() . "\n" . $context->getSetting('emailSignature'));
 }
Example #13
0
 /**
  * Display the form.
  */
 function display(&$args)
 {
     $meetingId = isset($args[0]) ? $args[0] : 0;
     $journal =& Request::getJournal();
     $journalId = $journal->getId();
     $user =& Request::getUser();
     $sectionDecisionDao =& DAORegistry::getDAO('SectionDecisionDAO');
     $sort = Request::getUserVar('sort');
     $sort = isset($sort) ? $sort : 'id';
     $sortDirection = Request::getUserVar('sortDirection');
     $availableSectionDecisions =& $sectionDecisionDao->getSectionDecisionsAvailableForMeeting($user->getSecretaryCommitteeId(), $journalId, $sort, $sortDirection);
     /*Get the selected submissions to be reviewed*/
     $meetingDao =& DAORegistry::getDAO('MeetingDAO');
     $meeting =& $meetingDao->getMeetingById($meetingId);
     /*Get the selected submissions to be reviewed*/
     $meetingSectionDecisionDao =& DAORegistry::getDAO('MeetingSectionDecisionDAO');
     $mSectionDecisions = $meetingSectionDecisionDao->getMeetingSectionDecisionsByMeetingId($meetingId);
     $sectionDecisionsId = array();
     foreach ($mSectionDecisions as $mSectionDecision) {
         array_push($sectionDecisionsId, $mSectionDecision->getSectionDecisionId());
     }
     $templateMgr =& TemplateManager::getManager();
     $templateMgr->assign('sort', $sort);
     $templateMgr->assign('sortDirection', $sortDirection);
     $templateMgr->assign('meetingId', $meetingId);
     $templateMgr->assign('meetingDate', $meeting->getDate());
     $templateMgr->assign('meetingLength', $meeting->getLength());
     $templateMgr->assign('location', $meeting->getLocation());
     $templateMgr->assign('investigator', $meeting->getInvestigator());
     $templateMgr->assign_by_ref('availableSectionDecisions', $availableSectionDecisions);
     $templateMgr->assign_by_ref('sectionDecisionsId', $sectionDecisionsId);
     $templateMgr->assign('baseUrl', Config::getVar('general', "base_url"));
     parent::display();
 }
Example #14
0
/**
 * Handle a new request.
 */
function handleRequest()
{
    if (!Config::getVar('general', 'installed') && pageRequiresInstall()) {
        // Redirect to installer if application has not been installed
        Request::redirect(null, 'install');
    }
    // Determine the handler for this request
    $page = Request::getRequestedPage();
    $op = Request::getRequestedOp();
    $sourceFile = sprintf('pages/%s/index.php', $page);
    // If a hook has been registered to handle this page, give it the
    // opportunity to load required resources and set HANDLER_CLASS.
    if (!HookRegistry::call('LoadHandler', array(&$page, &$op, &$sourceFile))) {
        if (file_exists($sourceFile)) {
            require $sourceFile;
        } else {
            require 'pages/index/index.php';
        }
    }
    if (!defined('SESSION_DISABLE_INIT')) {
        // Initialize session
        $sessionManager =& SessionManager::getManager();
        $session =& $sessionManager->getUserSession();
    }
    $methods = array_map('strtolower', get_class_methods(HANDLER_CLASS));
    if (in_array(strtolower($op), $methods)) {
        // Call a specific operation
        call_user_func(array(HANDLER_CLASS, $op), Request::getRequestedArgs());
    } else {
        // Call the selected handler's index operation
        call_user_func(array(HANDLER_CLASS, 'index'), Request::getRequestedArgs());
    }
}
Example #15
0
 /**
  * Get a cache.
  * @param $context string
  * @param $cacheId string
  * @param $fallback callback
  * @param $type string Type of cache: CACHE_TYPE_...
  * @return object Cache
  */
 function getCache($context, $cacheId, $fallback, $type = CACHE_TYPE_FILE)
 {
     switch ($this->getCacheImplementation($type)) {
         case 'xcache':
             import('lib.pkp.classes.cache.XCacheCache');
             $cache = new XCacheCache($context, $cacheId, $fallback);
             break;
         case 'apc':
             import('lib.pkp.classes.cache.APCCache');
             $cache = new APCCache($context, $cacheId, $fallback);
             break;
         case 'memcache':
             import('lib.pkp.classes.cache.MemcacheCache');
             $cache = new MemcacheCache($context, $cacheId, $fallback, Config::getVar('cache', 'memcache_hostname'), Config::getVar('cache', 'memcache_port'));
             break;
         case '':
             // Provide a default if not specified
         // Provide a default if not specified
         case 'file':
             $cache = $this->getFileCache($context, $cacheId, $fallback);
             break;
         case 'none':
             import('lib.pkp.classes.cache.GenericCache');
             $cache = new GenericCache($context, $cacheId, $fallback);
             break;
         default:
             die("Unknown cache type \"{$type}\"!\n");
             break;
     }
     return $cache;
 }
Example #16
0
 /**
  * Set stage. DEPRECATED.
  * @param $stage int
  */
 function setStage($stage)
 {
     if (Config::getVar('debug', 'deprecation_warnings')) {
         trigger_error('Deprecated function.');
     }
     return $this->setRound($stage);
 }
Example #17
0
 /**
  * Set ID of paper.
  * @param $paperId int
  */
 function setPaperId($paperId)
 {
     if (Config::getVar('debug', 'deprecation_warnings')) {
         trigger_error('Deprecated function.');
     }
     return $this->setSubmissionId($paperId);
 }
 function sendReminder($reviewAssignment, $article, $journal)
 {
     $reviewAssignmentDao =& DAORegistry::getDAO('ReviewAssignmentDAO');
     $userDao =& DAORegistry::getDAO('UserDAO');
     $reviewId = $reviewAssignment->getReviewId();
     $reviewer =& $userDao->getUser($reviewAssignment->getReviewerId());
     if (!isset($reviewer)) {
         return false;
     }
     import('mail.ArticleMailTemplate');
     $reviewerAccessKeysEnabled = $journal->getSetting('reviewerAccessKeysEnabled');
     $email =& new ArticleMailTemplate($article, $reviewerAccessKeysEnabled ? 'REVIEW_REMIND_AUTO_ONECLICK' : 'REVIEW_REMIND_AUTO', null, false, $journal);
     $email->setJournal($journal);
     $email->setFrom($journal->getSetting('contactEmail'), $journal->getSetting('contactName'));
     $email->addRecipient($reviewer->getEmail(), $reviewer->getFullName());
     $email->setAssoc(ARTICLE_EMAIL_REVIEW_REMIND, ARTICLE_EMAIL_TYPE_REVIEW, $reviewId);
     $email->setSubject($email->getSubject($journal->getPrimaryLocale()));
     $email->setBody($email->getBody($journal->getPrimaryLocale()));
     $urlParams = array();
     if ($reviewerAccessKeysEnabled) {
         import('security.AccessKeyManager');
         $accessKeyManager =& new AccessKeyManager();
         // Key lifetime is the typical review period plus four weeks
         $keyLifetime = ($journal->getSetting('numWeeksPerReview') + 4) * 7;
         $urlParams['key'] = $accessKeyManager->createKey('ReviewerContext', $reviewer->getUserId(), $reviewId, $keyLifetime);
     }
     $submissionReviewUrl = Request::url($journal->getPath(), 'reviewer', 'submission', $reviewId, $urlParams);
     $paramArray = array('reviewerName' => $reviewer->getFullName(), 'reviewerUsername' => $reviewer->getUsername(), 'journalUrl' => $journal->getUrl(), 'reviewerPassword' => $reviewer->getPassword(), 'reviewDueDate' => strftime(Config::getVar('general', 'date_format_short'), strtotime($reviewAssignment->getDateDue())), 'editorialContactSignature' => $journal->getSetting('contactName') . "\n" . $journal->getJournalTitle(), 'passwordResetUrl' => Request::url($journal->getPath(), 'login', 'resetPassword', $reviewer->getUsername(), array('confirm' => Validation::generatePasswordResetHash($reviewer->getUserId()))), 'submissionReviewUrl' => $submissionReviewUrl);
     $email->assignParams($paramArray);
     $email->send();
     $reviewAssignment->setDateReminded(Core::getCurrentDate());
     $reviewAssignment->setReminderWasAutomatic(1);
     $reviewAssignmentDao->updateReviewAssignment($reviewAssignment);
 }
Example #19
0
 /**
  * Constructor.
  * Initialize transformer and set parser options.
  * @return boolean returns false if no XSLT processor could be created
  */
 function XSLTransformer()
 {
     $this->externalCommand = Config::getVar('cli', 'xslt_command');
     // Determine the appropriate XSLT processor for the system
     if ($this->externalCommand) {
         // check the external command to check for %xsl and %xml parameter substitution
         if (strpos($this->externalCommand, '%xsl') === false) {
             return false;
         }
         if (strpos($this->externalCommand, '%xml') === false) {
             return false;
         }
         $this->processor = 'External';
     } elseif (checkPhpVersion('5.0.0') && extension_loaded('xsl') && extension_loaded('dom')) {
         // PHP5.x with XSL/DOM modules present
         $this->processor = 'PHP5';
     } elseif (checkPhpVersion('4.1.0') && extension_loaded('xslt')) {
         // PHP4.x with XSLT module present
         $this->processor = 'PHP4';
     } else {
         // no XSLT support
         return false;
     }
     $this->errors = array();
 }
Example #20
0
 /**
  * Return absolute path to the file on the host filesystem.
  * @return string
  */
 function getFilePath()
 {
     $articleDao =& DAORegistry::getDAO('ArticleDAO');
     $article =& $articleDao->getArticle($this->getArticleId());
     $journalId = $article->getJournalId();
     return Config::getVar('files', 'files_dir') . '/journals/' . $journalId . '/articles/' . $this->getArticleId() . '/' . $this->getFileStage() . '/' . $this->getFileName();
 }
 function getAnnouncementTypeName()
 {
     if (Config::getVar('debug', 'deprecation_warnings')) {
         trigger_error('Deprecated function.');
     }
     return $this->getLocalizedTypeName();
 }
 /**
  * Constructor.
  */
 function ArticleNote()
 {
     if (Config::getVar('debug', 'deprecation_warnings')) {
         trigger_error('Deprecated class ArticleNote. Use Note instead');
     }
     parent::Note();
 }
 function updateSite(&$site)
 {
     if (Config::getVar('debug', 'deprecation_warnings')) {
         trigger_error('Deprecated function.');
     }
     return $this->updateObject($site);
 }
 /**
  * @copydoc GridHandler::loadData()
  */
 protected function loadData($request, $filter)
 {
     $dbconn = DBConnection::getConn();
     $dbServerInfo = $dbconn->ServerInfo();
     $serverInfo = array('admin.server.platform' => Core::serverPHPOS(), 'admin.server.phpVersion' => Core::serverPHPVersion(), 'admin.server.apacheVersion' => function_exists('apache_get_version') ? apache_get_version() : __('common.notAvailable'), 'admin.server.dbDriver' => Config::getVar('database', 'driver'), 'admin.server.dbVersion' => empty($dbServerInfo['description']) ? $dbServerInfo['version'] : $dbServerInfo['description']);
     return $serverInfo;
 }
Example #25
0
 /**
  * Split a string into a clean array of keywords
  * @param $text string
  * @param $allowWildcards boolean
  * @return array of keywords
  */
 function &filterKeywords($text, $allowWildcards = false)
 {
     $minLength = Config::getVar('search', 'min_word_length');
     $maxLength = Config::getVar('search', 'max_word_length');
     $stopwords =& SearchIndex::loadStopwords();
     // Remove punctuation
     if (is_array($text)) {
         $text = join("\n", $text);
     }
     $cleanText = String::regexp_replace('/[!"\\#\\$%\'\\(\\)\\.\\?@\\[\\]\\^`\\{\\}~]/', '', $text);
     $cleanText = String::regexp_replace('/[\\+,:;&\\/<=>\\|\\\\]/', ' ', $cleanText);
     $cleanText = String::regexp_replace('/[\\*]/', $allowWildcards ? '%' : ' ', $cleanText);
     $cleanText = String::strtolower($cleanText);
     // Split into words
     $words = String::regexp_split('/\\s+/', $cleanText);
     // FIXME Do not perform further filtering for some fields, e.g., author names?
     // Remove stopwords
     $keywords = array();
     foreach ($words as $k) {
         if (!isset($stopwords[$k]) && String::strlen($k) >= $minLength && !is_numeric($k)) {
             $keywords[] = String::substr($k, 0, $maxLength);
         }
     }
     return $keywords;
 }
 /**
  * Constructor.
  * @param $request PKPRequest
  * @param $userId int optional
  * @param $author Author optional
  */
 function __construct($request, $userId = null, $author = null)
 {
     parent::__construct('controllers/grid/settings/user/form/userDetailsForm.tpl', $userId);
     if (isset($author)) {
         $this->author =& $author;
     } else {
         $this->author = null;
     }
     $site = $request->getSite();
     // Validation checks for this form
     if ($userId == null) {
         $this->addCheck(new FormValidator($this, 'username', 'required', 'user.profile.form.usernameRequired'));
         $this->addCheck(new FormValidatorCustom($this, 'username', 'required', 'user.register.form.usernameExists', array(DAORegistry::getDAO('UserDAO'), 'userExistsByUsername'), array($this->userId, true), true));
         $this->addCheck(new FormValidatorUsername($this, 'username', 'required', 'user.register.form.usernameAlphaNumeric'));
         if (!Config::getVar('security', 'implicit_auth')) {
             $this->addCheck(new FormValidator($this, 'password', 'required', 'user.profile.form.passwordRequired'));
             $this->addCheck(new FormValidatorLength($this, 'password', 'required', 'user.register.form.passwordLengthRestriction', '>=', $site->getMinPasswordLength()));
             $this->addCheck(new FormValidatorCustom($this, 'password', 'required', 'user.register.form.passwordsDoNotMatch', create_function('$password,$form', 'return $password == $form->getData(\'password2\');'), array($this)));
         }
     } else {
         $this->addCheck(new FormValidatorLength($this, 'password', 'optional', 'user.register.form.passwordLengthRestriction', '>=', $site->getMinPasswordLength()));
         $this->addCheck(new FormValidatorCustom($this, 'password', 'optional', 'user.register.form.passwordsDoNotMatch', create_function('$password,$form', 'return $password == $form->getData(\'password2\');'), array($this)));
     }
     $this->addCheck(new FormValidator($this, 'firstName', 'required', 'user.profile.form.firstNameRequired'));
     $this->addCheck(new FormValidator($this, 'lastName', 'required', 'user.profile.form.lastNameRequired'));
     $this->addCheck(new FormValidatorUrl($this, 'userUrl', 'optional', 'user.profile.form.urlInvalid'));
     $this->addCheck(new FormValidatorEmail($this, 'email', 'required', 'user.profile.form.emailRequired'));
     $this->addCheck(new FormValidatorCustom($this, 'email', 'required', 'user.register.form.emailExists', array(DAORegistry::getDAO('UserDAO'), 'userExistsByEmail'), array($this->userId, true), true));
     $this->addCheck(new FormValidatorORCID($this, 'orcid', 'optional', 'user.orcid.orcidInvalid'));
     $this->addCheck(new FormValidatorPost($this));
     $this->addCheck(new FormValidatorCSRF($this));
 }
 /**
  * Determine the plugin sequence. Overrides parent so that
  * the plugin will be displayed during install.
  */
 function getSeq()
 {
     if (!Config::getVar('general', 'installed')) {
         return 2;
     }
     return parent::getSeq();
 }
Example #28
0
 /**
  * Initialize form data from the associated author.
  * @param $args array
  * @param $request PKPRequest
  */
 function initData($args, $request)
 {
     $userDao = DAORegistry::getDAO('UserDAO');
     $user = $request->getUser();
     $context = $request->getContext();
     $reviewAssignment = $this->getReviewAssignment();
     $reviewerId = $reviewAssignment->getReviewerId();
     $reviewer = $userDao->getById($reviewerId);
     $submissionDao = Application::getSubmissionDAO();
     $submission = $submissionDao->getById($reviewAssignment->getSubmissionId());
     import('lib.pkp.classes.mail.SubmissionMailTemplate');
     $email = new SubmissionMailTemplate($submission, 'REVIEW_REMIND');
     // Format the review due date
     $reviewDueDate = strtotime($reviewAssignment->getDateDue());
     $dateFormatShort = Config::getVar('general', 'date_format_short');
     if ($reviewDueDate == -1) {
         $reviewDueDate = $dateFormatShort;
     } else {
         $reviewDueDate = strftime($dateFormatShort, $reviewDueDate);
     }
     $dispatcher = $request->getDispatcher();
     $paramArray = array('reviewerName' => $reviewer->getFullName(), 'reviewDueDate' => $reviewDueDate, 'editorialContactSignature' => $user->getContactSignature(), 'reviewerUserName' => $reviewer->getUsername(), 'passwordResetUrl' => $dispatcher->url($request, ROUTE_PAGE, null, 'login', 'resetPassword', $reviewer->getUsername(), array('confirm' => Validation::generatePasswordResetHash($reviewer->getId()))), 'submissionReviewUrl' => $dispatcher->url($request, ROUTE_PAGE, null, 'reviewer', 'submission', null, array('submissionId' => $reviewAssignment->getSubmissionId())));
     $email->assignParams($paramArray);
     $this->setData('stageId', $reviewAssignment->getStageId());
     $this->setData('reviewAssignmentId', $reviewAssignment->getId());
     $this->setData('submissionId', $submission->getId());
     $this->setData('reviewAssignment', $reviewAssignment);
     $this->setData('reviewerName', $reviewer->getFullName() . ' <' . $reviewer->getEmail() . '>');
     $this->setData('message', $email->getBody() . "\n" . $context->getSetting('emailSignature'));
 }
 /**
  * Called as a plugin is registered to the registry
  * @param $category String Name of category plugin was registered to
  * @return boolean True iff plugin initialized successfully; if false,
  * 	the plugin will not be registered.
  */
 function register($category, $path)
 {
     $success = parent::register($category, $path);
     if (!Config::getVar('general', 'installed') || defined('RUNNING_UPGRADE')) {
         return true;
     }
     if ($success && $this->getEnabled()) {
         // Insert field into author submission page and metadata form
         HookRegistry::register('Templates::Author::Submit::Authors', array($this, 'metadataField'));
         HookRegistry::register('Templates::Submission::MetadataEdit::Authors', array($this, 'metadataField'));
         // Hook for initData in two forms
         HookRegistry::register('metadataform::initdata', array($this, 'metadataInitData'));
         HookRegistry::register('authorsubmitstep3form::initdata', array($this, 'metadataInitData'));
         // Hook for execute in two forms
         HookRegistry::register('authorsubmitstep3form::execute', array($this, 'metadataExecute'));
         HookRegistry::register('metadataform::execute', array($this, 'metadataExecute'));
         // Add element for AuthorDAO for storage
         HookRegistry::register('pkpauthordao::getAdditionalFieldNames', array($this, 'authorSubmitGetFieldNames'));
         // Insert Google Analytics page tag to common footer
         HookRegistry::register('Templates::Common::Footer::PageFooter', array($this, 'insertFooter'));
         // Insert Google Analytics page tag to article footer
         HookRegistry::register('Templates::Article::Footer::PageFooter', array($this, 'insertFooter'));
         // Insert Google Analytics page tag to article interstitial footer
         HookRegistry::register('Templates::Article::Interstitial::PageFooter', array($this, 'insertFooter'));
         // Insert Google Analytics page tag to article pdf interstitial footer
         HookRegistry::register('Templates::Article::PdfInterstitial::PageFooter', array($this, 'insertFooter'));
         // Insert Google Analytics page tag to reading tools footer
         HookRegistry::register('Templates::Rt::Footer::PageFooter', array($this, 'insertFooter'));
         // Insert Google Analytics page tag to help footer
         HookRegistry::register('Templates::Help::Footer::PageFooter', array($this, 'insertFooter'));
     }
     return $success;
 }
 /**
  * Get the queued payment ID
  * @return int
  */
 function getQueuedPaymentId()
 {
     if (Config::getVar('debug', 'deprecation_warnings')) {
         trigger_error('Deprecated function.');
     }
     return parent::getPaymentId();
 }