function insertArticleTombstone(&$article, &$journal) { $sectionDao =& DAORegistry::getDAO('SectionDAO'); $section =& $sectionDao->getSection($article->getSectionId()); $tombstoneDao =& DAORegistry::getDAO('DataObjectTombstoneDAO'); /* @var $tombstoneDao DataObjectTombstoneDAO */ // delete article tombstone -- to ensure that there aren't more than one tombstone for this article $tombstoneDao->deleteByDataObjectId($article->getId()); // insert article tombstone $section =& $sectionDao->getSection($article->getSectionId()); $setSpec = urlencode($journal->getPath()) . ':' . urlencode($section->getLocalizedAbbrev()); $oaiIdentifier = 'oai:' . Config::getVar('oai', 'repository_id') . ':' . 'article/' . $article->getId(); $OAISetObjectsIds = array(ASSOC_TYPE_JOURNAL => $journal->getId(), ASSOC_TYPE_SECTION => $section->getId()); $articleTombstone = $tombstoneDao->newDataObject(); $articleTombstone->setDataObjectId($article->getId()); $articleTombstone->stampDateDeleted(); $articleTombstone->setSetSpec($setSpec); $articleTombstone->setSetName($section->getLocalizedTitle()); $articleTombstone->setOAIIdentifier($oaiIdentifier); $articleTombstone->setOAISetObjectsIds($OAISetObjectsIds); $tombstoneId = $tombstoneDao->insertObject($articleTombstone); if (HookRegistry::call('ArticleTombstoneManager::insertArticleTombstone', array(&$articleTombstone, &$article, &$journal))) { return; } }
/** * 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()); } }
/** * Construct the contents for the notification based on its type and associated object * @param $request PKPRequest * @param $notification Notification * @return string */ function getNotificationContents(&$request, &$notification) { $type = $notification->getType(); assert(isset($type)); $message = null; HookRegistry::call('NotificationManager::getNotificationContents', array(&$notification, &$message)); if ($message) { return $message; } switch ($type) { case NOTIFICATION_TYPE_PAPER_SUBMITTED: return __('notification.type.paperSubmitted', array('title' => $this->_getPaperTitle($notification))); case NOTIFICATION_TYPE_SUPP_FILE_MODIFIED: return __('notification.type.suppFileModified', array('title' => $this->_getPaperTitle($notification))); case NOTIFICATION_TYPE_METADATA_MODIFIED: return __('notification.type.metadataModified', array('title' => $this->_getPaperTitle($notification))); case NOTIFICATION_TYPE_GALLEY_MODIFIED: return __('notification.type.galleyModified', array('title' => $this->_getPaperTitle($notification))); case NOTIFICATION_TYPE_SUBMISSION_COMMENT: return __('notification.type.submissionComment', array('title' => $this->_getPaperTitle($notification))); case NOTIFICATION_TYPE_REVIEWER_COMMENT: return __('notification.type.reviewerComment', array('title' => $this->_getPaperTitle($notification))); case NOTIFICATION_TYPE_REVIEWER_FORM_COMMENT: return __('notification.type.reviewerFormComment', array('title' => $this->_getPaperTitle($notification))); case NOTIFICATION_TYPE_DIRECTOR_DECISION_COMMENT: return __('notification.type.directorDecisionComment', array('title' => $this->_getPaperTitle($notification))); case NOTIFICATION_TYPE_USER_COMMENT: return __('notification.type.userComment', array('title' => $this->_getPaperTitle($notification))); default: return parent::getNotificationContents($request, $notification); } }
/** * Given a $page and $op, return a list of field names for which * the plugin should be used. * @param $templateMgr object * @param $page string The requested page * @param $op string The requested operation * @return array */ function getEnableFields(&$templateMgr, $page, $op) { $formLocale = $templateMgr->get_template_vars('formLocale'); $fields = array(); switch ("{$page}/{$op}") { case 'admin/settings': case 'admin/saveSettings': $fields[] = 'intro'; $fields[] = 'aboutField'; break; case 'admin/createArchive': case 'admin/editArchive': case 'admin/updateArchive': $fields[] = 'description'; break; case 'user/profile': case 'user/saveProfile': case 'user/register': case 'admin/createUser': case 'admin/updateUser': $fields[] = 'mailingAddress'; $fields[] = 'biography'; break; } HookRegistry::call('TinyMCEPlugin::getEnableFields', array(&$this, &$fields)); return $fields; }
/** * Insert a tombstone for the passed publication format. * @param $publicationFormat PublicationFormat * @param $press Press */ function insertTombstoneByPublicationFormat($publicationFormat, $press) { $monographDao = DAORegistry::getDAO('MonographDAO'); $monograph = $monographDao->getById($publicationFormat->getMonographId()); $seriesDao = DAORegistry::getDAO('SeriesDAO'); $series = $seriesDao->getById($monograph->getSeriesId()); $dataObjectTombstoneDao = DAORegistry::getDAO('DataObjectTombstoneDAO'); // delete publication format tombstone to ensure that there aren't // more than one tombstone for this publication format $dataObjectTombstoneDao->deleteByDataObjectId($publicationFormat->getId()); // insert publication format tombstone if (is_a($series, 'Series')) { $setSpec = urlencode($press->getPath()) . ':' . urlencode($series->getPath()); $setName = $series->getLocalizedTitle(); } else { $setSpec = urlencode($press->getPath()); $setName = $press->getLocalizedName(); } $oaiIdentifier = 'oai:' . Config::getVar('oai', 'repository_id') . ':' . 'publicationFormat/' . $publicationFormat->getId(); $OAISetObjectsIds = array(ASSOC_TYPE_PRESS => $monograph->getPressId(), ASSOC_TYPE_SERIES => $monograph->getSeriesId()); $publicationFormatTombstone = $dataObjectTombstoneDao->newDataObject(); /* @var $publicationFormatTombstone DataObjectTombstone */ $publicationFormatTombstone->setDataObjectId($publicationFormat->getId()); $publicationFormatTombstone->stampDateDeleted(); $publicationFormatTombstone->setSetSpec($setSpec); $publicationFormatTombstone->setSetName($setName); $publicationFormatTombstone->setOAIIdentifier($oaiIdentifier); $publicationFormatTombstone->setOAISetObjectsIds($OAISetObjectsIds); $dataObjectTombstoneDao->insertObject($publicationFormatTombstone); if (HookRegistry::call('PublicationFormatTombstoneManager::insertPublicationFormatTombstone', array(&$publicationFormatTombstone, &$publicationFormat, &$press))) { return; } }
/** * Internal function to return a Role object from a row. * @param $row array * @return Role */ function &_returnRoleFromRow(&$row) { $role = new Role(); $role->setUserId($row['user_id']); $role->setRoleId($row['role_id']); HookRegistry::call('RoleDAO::_returnRoleFromRow', array(&$role, &$row)); return $role; }
/** * Internal function to return a Conference object from a row. * @param $row array * @return Conference */ function _fromRow($row) { $conference = parent::_fromRow($row); $conference->setPrimaryLocale($row['primary_locale']); $conference->setEnabled($row['enabled']); HookRegistry::call('ConferenceDAO::_returnConferenceFromRow', array(&$conference, &$row)); return $conference; }
/** * Internal function to return a Journal object from a row. * @param $row array * @return Journal */ function _fromRow($row) { $journal = parent::_fromRow($row); $journal->setPrimaryLocale($row['primary_locale']); $journal->setEnabled($row['enabled']); HookRegistry::call('JournalDAO::_returnJournalFromRow', array(&$journal, &$row)); return $journal; }
/** * Return the section decision * Internal function to return an meeting object from a row. Simplified * not to include object settings. * @param $row array * @return section_decision_id */ function &_returnMeetingSectionDecisionFromRow(&$row) { $meetingSectionDecision = new MeetingSectionDecision(); $meetingSectionDecision->setMeetingId($row['meeting_id']); $meetingSectionDecision->setSectionDecisionId($row['section_decision_id']); HookRegistry::call('MeetingSectionDecsisionDAO::_returnMeetingSectionDecisionFromRow', array(&$meetingSectionDecision, &$row)); return $meetingSectionDecision; }
/** * Internal function to return a Press object from a row. * @param $row array * @return Press */ function _fromRow($row) { $press = parent::_fromRow($row); $press->setPrimaryLocale($row['primary_locale']); $press->setEnabled($row['enabled']); HookRegistry::call('PressDAO::_fromRow', array(&$press, &$row)); return $press; }
/** * Authenticate user credentials and mark the user as logged in in the current session. * @param $username string * @param $password string unencrypted password * @param $reason string reference to string to receive the reason an account was disabled; null otherwise * @param $remember boolean remember a user's session past the current browser session * @return User the User associated with the login credentials, or false if the credentials are invalid */ static function login($username, $password, &$reason, $remember = false) { $implicitAuth = Config::getVar('security', 'implicit_auth'); $reason = null; if ($implicitAuth) { // Implicit auth if (!Validation::isLoggedIn()) { PluginRegistry::loadCategory('implicitAuth'); // Call the implicitAuth hook. It will set $user. HookRegistry::call('ImplicitAuthPlugin::implicitAuth', array(&$user)); $valid = true; } else { $valid = false; } } else { // Regular Auth $userDao = DAORegistry::getDAO('UserDAO'); $user = $userDao->getByUsername($username, true); if (!isset($user)) { // User does not exist return false; } if ($user->getAuthId()) { $authDao = DAORegistry::getDAO('AuthSourceDAO'); $auth = $authDao->getPlugin($user->getAuthId()); } else { $auth = null; } if ($auth) { // Validate against remote authentication source $valid = $auth->authenticate($username, $password); if ($valid) { $oldEmail = $user->getEmail(); $auth->doGetUserInfo($user); if ($user->getEmail() != $oldEmail) { // FIXME requires email addresses to be unique; if changed email already exists, ignore if ($userDao->userExistsByEmail($user->getEmail())) { $user->setEmail($oldEmail); } } } } else { // Validate against user database $rehash = null; $valid = Validation::verifyPassword($username, $password, $user->getPassword(), $rehash); if ($valid && !empty($rehash)) { // update to new hashing algorithm $user->setPassword($rehash); } } } if (!$valid) { // Login credentials are invalid return false; } else { return self::registerUserSession($user, $reason, $remember); } }
/** * Internal function to return a scheduled conference object from a row. * @param $row array * @return SchedConf */ function _fromRow($row) { $schedConf = parent::_fromRow($row); $schedConf->setConferenceId($row['conference_id']); $schedConf->setStartDate($this->datetimeFromDB($row['start_date'])); $schedConf->setEndDate($this->datetimeFromDB($row['end_date'])); HookRegistry::call('SchedConfDAO::_returnSchedConfFromRow', array(&$schedConf, &$row)); return $schedConf; }
/** * Internal function to return an ObjectForReviewEditorAssignment object from a row. * @param $row array * @return ObjectForReviewEditorAssignment */ function &_fromRow($row) { $assignment = $this->newDataObject(); $assignment->setId($row['enroll_id']); $assignment->setPublisherId($row['publisher_id']); $assignment->setUserId($row['user_id']); HookRegistry::call('ObjectForReviewEditorAssignmentDAO::_fromRow', array(&$assignment, &$row)); return $assignment; }
/** * Internal function to return an EditorSubmission object from a row. * @param $row array * @return EditorSubmission */ function &_returnEditorSubmissionFromRow(&$row) { $editorSubmission = new EditorSubmission(); // Article attributes $this->articleDao->_articleFromRow($editorSubmission, $row); $editorSubmission->setDecisions($this->sectionDecisionDao->getSectionDecisionsByArticleId($row['article_id'])); HookRegistry::call('EditorSubmissionDAO::_returnEditorSubmissionFromRow', array(&$editorSubmission, &$row)); return $editorSubmission; }
/** * Internal function to return an Division object from a row. * @param $row array * @return Division */ function _fromRow(&$row) { $division = $this->newDataObject(); $division->setId($row['division_id']); $division->setPressId($row['press_id']); $this->getDataObjectSettings('divisions_settings', 'division_id', $row['division_id'], $division); HookRegistry::call('DivisionDAO::_fromRow', array(&$division, &$row)); return $division; }
/** * Creates and returns a captcha object from a row * @param $row array * @return Captcha object */ function &_returnCaptchaFromRow($row) { $captcha = new Captcha(); $captcha->setId($row['captcha_id']); $captcha->setSessionId($row['session_id']); $captcha->setValue($row['value']); $captcha->setDateCreated($this->datetimeFromDB($row['date_created'])); HookRegistry::call('CaptchaDAO::_returnCaptchaFromRow', array(&$captcha, &$row)); return $captcha; }
/** * Deprecated * @see PKPPageRouter::getRequestedContextPath() */ function getRequestedSchedConfPath() { static $schedConf; $_this =& PKPRequest::_checkThis(); if (!isset($schedConf)) { $schedConf = $_this->_delegateToRouter('getRequestedContextPath', 2); HookRegistry::call('Request::getRequestedSchedConfPath', array(&$schedConf)); } return $schedConf; }
/** * Internal function to return an Monograph object from a row. * @param $row array * @return Monograph */ function _fromRow($row) { $monograph = parent::_fromRow($row); $monograph->setSeriesId($row['series_id']); $monograph->setSeriesPosition($row['series_position']); $monograph->setSeriesAbbrev(isset($row['series_abbrev']) ? $row['series_abbrev'] : null); $monograph->setWorkType($row['edited_volume']); HookRegistry::call('MonographDAO::_fromRow', array(&$monograph, &$row)); return $monograph; }
/** * Internal function to return an FooterLink object from a row. * @param $row array * @return FooterLink */ function _fromRow($row) { $footerLink = $this->newDataObject(); $footerLink->setId($row['footerlink_id']); $footerLink->setContextId($row['context_id']); $footerLink->setCategoryId($row['footer_category_id']); $this->getDataObjectSettings('footerlink_settings', 'footerlink_id', $row['footerlink_id'], $footerLink); HookRegistry::call('FooterLinkDAO::_fromRow', array(&$footerLink, &$row)); return $footerLink; }
/** * Deprecated * @see PKPPageRouter::getRequestedContextPath() */ function getRequestedJournalPath() { static $journal; $_this =& PKPRequest::_checkThis(); if (!isset($journal)) { $journal = $_this->_delegateToRouter('getRequestedContextPath', 1); HookRegistry::call('Request::getRequestedJournalPath', array(&$journal)); } return $journal; }
/** * Deprecated * @see PKPPageRouter::getRequestedContextPath() */ function getRequestedPressPath() { static $press; $_this =& PKPRequest::_checkThis(); if (!isset($press)) { $press = $_this->_delegateToRouter('getRequestedContextPath', 1); HookRegistry::call('Request::getRequestedPressPath', array(&$press)); } return $press; }
function &getContextMap() { static $contextMap = array(BLOCK_CONTEXT_MYACCOUNT => 'Templates::User::Index::MyAccount', BLOCK_CONTEXT_LEFT_SIDEBAR => 'Templates::Common::LeftSidebar', BLOCK_CONTEXT_RIGHT_SIDEBAR => 'Templates::Common::RightSidebar'); $homepageHook = $this->_getContextSpecificHomepageHook(); if ($homepageHook) { $contextMap[BLOCK_CONTEXT_HOMEPAGE] = $homepageHook; } HookRegistry::call('BlockPlugin::getContextMap', array(&$this, &$contextMap)); return $contextMap; }
/** * Internal function to return an Series object from a row. * @param $row array * @return Series */ function _fromRow(&$row) { $series = $this->newDataObject(); $series->setId($row['series_id']); $series->setPressId($row['press_id']); $series->setDivisionId($row['division_id']); $this->getDataObjectSettings('series_settings', 'series_id', $row['series_id'], $series); HookRegistry::call('SeriesDAO::_fromRow', array(&$series, &$row)); return $series; }
/** * Internal function to return a Role object from a row. * @param $row array * @return Role */ function _returnRoleFromRow($row) { $role = new Role($row['role_id']); $role->setConferenceId($row['conference_id']); $role->setSchedConfId($row['sched_conf_id']); $role->setUserId($row['user_id']); $role->setRoleId($row['role_id']); HookRegistry::call('RoleDAO::_returnRoleFromRow', array(&$role, &$row)); return $role; }
/** * Internal function to return a ProofreaderSubmission object from a row. * @param $row array * @return ProofreaderSubmission */ function &_returnSubmissionFromRow(&$row) { $submission = new ProofreaderSubmission(); $this->articleDao->_articleFromRow($submission, $row); $submission->setMostRecentProofreadComment($this->articleCommentDao->getMostRecentArticleComment($row['article_id'], COMMENT_TYPE_PROOFREAD, $row['article_id'])); $submission->setGalleys($this->galleyDao->getGalleysByArticle($row['article_id'])); $submission->setSuppFiles($this->suppFileDao->getSuppFilesByArticle($row['article_id'])); $submission->setMostRecentLayoutComment($this->articleCommentDao->getMostRecentArticleComment($row['article_id'], COMMENT_TYPE_LAYOUT, $row['article_id'])); HookRegistry::call('ProofreaderSubmissionDAO::_returnProofreaderSubmissionFromRow', array(&$submission, &$row)); return $submission; }
/** * Internal function to return a Journal object from a row. * @param $row array * @return Journal */ function &_returnJournalFromRow(&$row) { $journal =& new Journal(); $journal->setJournalId($row['journal_id']); $journal->setPath($row['path']); $journal->setSequence($row['seq']); $journal->setEnabled($row['enabled']); $journal->setPrimaryLocale($row['primary_locale']); HookRegistry::call('JournalDAO::_returnJournalFromRow', array(&$journal, &$row)); return $journal; }
/** * Internal function to return a Conference object from a row. * @param $row array * @return Conference */ function &_returnConferenceFromRow(&$row) { $conference = new Conference(); $conference->setConferenceId($row['conference_id']); $conference->setPath($row['path']); $conference->setSequence($row['seq']); $conference->setEnabled($row['enabled']); $conference->setPrimaryLocale($row['primary_locale']); HookRegistry::call('ConferenceDAO::_returnConferenceFromRow', array(&$conference, &$row)); return $conference; }
/** * Internal function to return a ReviewFormResponse object from a row. * @param $row array * @return ReviewFormResponse */ function &_returnReviewFormResponseFromRow(&$row) { $responseValue = $this->convertFromDB($row['response_value'], $row['response_type']); $reviewFormResponse = $this->newDataObject(); $reviewFormResponse->setReviewId($row['review_id']); $reviewFormResponse->setReviewFormElementId($row['review_form_element_id']); $reviewFormResponse->setValue($responseValue); $reviewFormResponse->setResponseType($row['response_type']); HookRegistry::call('ReviewFormResponseDAO::_returnReviewFormResponseFromRow', array(&$reviewFormResponse, &$row)); return $reviewFormResponse; }
/** * @see OAIMetadataFormat#toXML */ function toXml(&$record, $format = null) { $response = null; if (!HookRegistry::call('OAIMetadataFormat_DC::toXml', array(&$this, $record, &$response))) { $article =& $record->getData('article'); $journal =& $record->getData('journal'); $section =& $record->getData('section'); $issue =& $record->getData('issue'); $galleys =& $record->getData('galleys'); Locale::requireComponents(array(LOCALE_COMPONENT_APPLICATION_COMMON)); // Sources contains journal title, issue ID, and pages $sources = $this->stripAssocArray((array) $journal->getTitle(null)); $pages = $article->getPages(); if (!empty($pages)) { $pages = '; ' . $pages; } foreach ($sources as $key => $source) { $sources[$key] .= '; ' . $issue->getIssueIdentification() . $pages; } // Format creators $creators = array(); $authors = $article->getAuthors(); for ($i = 0, $num = count($authors); $i < $num; $i++) { $authorName = $authors[$i]->getFullName(true); $affiliation = $authors[$i]->getLocalizedAffiliation(); if (!empty($affiliation)) { $authorName .= '; ' . $affiliation; } $creators[] = $authorName; } // Publisher $publishers = $this->stripAssocArray((array) $journal->getTitle(null)); // Default $publisherInstitution = $journal->getSetting('publisherInstitution'); if (!empty($publisherInstitution)) { $publishers = array($journal->getPrimaryLocale() => $publisherInstitution); } // Types $types = $this->stripAssocArray((array) $section->getIdentifyType(null)); $types = array_merge_recursive(empty($types) ? array(Locale::getLocale() => Locale::translate('rt.metadata.pkp.peerReviewed')) : $types, $this->stripAssocArray((array) $article->getType(null))); // Formats $formats = array(); foreach ($galleys as $galley) { $formats[] = $galley->getFileType(); } // Relation $relation = array(); foreach ($article->getSuppFiles() as $suppFile) { $relation[] = Request::url($journal->getPath(), 'article', 'downloadSuppFile', array($article->getId(), $suppFile->getFileId())); } $response = "<oai_dc:dc\n" . "\txmlns:oai_dc=\"http://www.openarchives.org/OAI/2.0/oai_dc/\"\n" . "\txmlns:dc=\"http://purl.org/dc/elements/1.1/\"\n" . "\txmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n" . "\txsi:schemaLocation=\"http://www.openarchives.org/OAI/2.0/oai_dc/\n" . "\thttp://www.openarchives.org/OAI/2.0/oai_dc.xsd\">\n" . $this->formatElement('title', $this->stripAssocArray((array) $article->getTitle(null)), true) . $this->formatElement('creator', $creators) . $this->formatElement('subject', array_merge_recursive($this->stripAssocArray((array) $article->getDiscipline(null)), $this->stripAssocArray((array) $article->getSubject(null)), $this->stripAssocArray((array) $article->getSubjectClass(null))), true) . $this->formatElement('description', $this->stripAssocArray((array) $article->getAbstract(null)), true) . $this->formatElement('publisher', $publishers, true) . $this->formatElement('contributor', $this->stripAssocArray((array) $article->getSponsor(null)), true) . $this->formatElement('date', date('Y-m-d', strtotime($issue->getDatePublished()))) . $this->formatElement('type', $types, true) . $this->formatElement('format', $formats) . $this->formatElement('identifier', Request::url($journal->getPath(), 'article', 'view', array($article->getBestArticleId()))) . (($doi = $article->getDOI()) ? $this->formatElement('identifier', $doi, false, array('xsi:type' => 'dcterms:DOI')) : '') . $this->formatElement('source', $sources, true) . $this->formatElement('language', strip_tags($article->getLanguage())) . $this->formatElement('relation', $relation) . $this->formatElement('coverage', array_merge_recursive($this->stripAssocArray((array) $article->getCoverageGeo(null)), $this->stripAssocArray((array) $article->getCoverageChron(null)), $this->stripAssocArray((array) $article->getCoverageSample(null))), true) . $this->formatElement('rights', $this->stripAssocArray((array) $journal->getSetting('copyrightNotice'))) . "</oai_dc:dc>\n"; } return $response; }
/** * Internal function to return a SocialMedia object from a row. * @param $row array * @return SocialMedia */ function _fromRow($row) { $socialMedia = $this->newDataObject(); $socialMedia->setId($row['social_media_id']); $socialMedia->setContextId($row['context_id']); $socialMedia->setCode($row['code']); $socialMedia->setIncludeInCatalog($row['include_in_catalog']); $this->getDataObjectSettings('social_media_settings', 'social_media_id', $row['social_media_id'], $socialMedia); HookRegistry::call('SocialMediaDAO::_fromRow', array(&$socialMedia, &$row)); return $socialMedia; }