/**
  * @see Plugin::getName()
  */
 function getName()
 {
     // Lazy load enabled plug-ins always use the plugin's class name
     // as plug-in name. Legacy plug-ins will override this method so
     // this implementation is backwards compatible.
     // NB: strtolower was required for PHP4 compatibility.
     return strtolower_codesafe(get_class($this));
 }
Exemplo n.º 2
0
 function _handleOcsUrl($matchArray)
 {
     $url = $matchArray[2];
     $anchor = null;
     if (($i = strpos($url, '#')) !== false) {
         $anchor = substr($url, $i + 1);
         $url = substr($url, 0, $i);
     }
     $urlParts = explode('/', $url);
     if (isset($urlParts[0])) {
         switch (strtolower_codesafe($urlParts[0])) {
             case 'conference':
                 $url = Request::url(isset($urlParts[1]) ? $urlParts[1] : Request::getRequestedConferencePath(), null, null, null, null, null, $anchor);
                 break;
             case 'paper':
                 if (isset($urlParts[1])) {
                     $url = Request::url(null, null, 'paper', 'view', $urlParts[1], null, $anchor);
                 }
                 break;
             case 'schedConf':
                 if (isset($urlParts[1])) {
                     $schedConfDao = DAORegistry::getDAO('SchedConfDAO');
                     $conferenceDao = DAORegistry::getDAO('ConferenceDAO');
                     $thisSchedConf =& $schedConfDao->getByPath($urlParts[1]);
                     if (!$thisSchedConf) {
                         break;
                     }
                     $thisConference =& $conferenceDao->getById($thisSchedConf->getConferenceId());
                     $url = Request::url($thisConference->getPath(), $thisSchedConf->getPath(), null, null, null, null, $anchor);
                 } else {
                     $url = Request::url(null, null, 'schedConfs', 'current', null, null, $anchor);
                 }
                 break;
             case 'suppfile':
                 if (isset($urlParts[1]) && isset($urlParts[2])) {
                     $url = Request::url(null, null, 'paper', 'downloadSuppFile', array($urlParts[1], $urlParts[2]), null, $anchor);
                 }
                 break;
             case 'sitepublic':
                 array_shift($urlParts);
                 import('classes.file.PublicFileManager');
                 $publicFileManager = new PublicFileManager();
                 $url = Request::getBaseUrl() . '/' . $publicFileManager->getSiteFilesPath() . '/' . implode('/', $urlParts) . ($anchor ? '#' . $anchor : '');
                 break;
             case 'public':
                 array_shift($urlParts);
                 $schedConf =& Request::getSchedConf();
                 import('classes.file.PublicFileManager');
                 $publicFileManager = new PublicFileManager();
                 $url = Request::getBaseUrl() . '/' . $publicFileManager->getSchedConfFilesPath($schedConf->getId()) . '/' . implode('/', $urlParts) . ($anchor ? '#' . $anchor : '');
                 break;
         }
     }
     return $matchArray[1] . $url . $matchArray[3];
 }
Exemplo n.º 3
0
 /**
  * @copydoc Plugin::register()
  */
 function register($category, $path)
 {
     if (!parent::register($category, $path)) {
         return false;
     }
     // Enable storage of additional fields.
     foreach ($this->_getDAOs() as $daoName) {
         HookRegistry::register(strtolower_codesafe($daoName) . '::getAdditionalFieldNames', array($this, 'getAdditionalFieldNames'));
     }
     return true;
 }
Exemplo n.º 4
0
 /**
  * @see Plugin::register()
  */
 function register($category, $path)
 {
     $success = parent::register($category, $path);
     if ($success) {
         // Enable storage of additional fields.
         foreach ($this->_getDAOs() as $daoName) {
             HookRegistry::register(strtolower_codesafe($daoName) . '::getAdditionalFieldNames', array($this, 'getAdditionalFieldNames'));
         }
     }
     return $success;
 }
Exemplo n.º 5
0
 /**
  * @see PKPPlugin::register()
  */
 function register($category, $path)
 {
     $success = parent::register($category, $path);
     if ($success) {
         // Enable storage of additional fields.
         foreach ($this->_getDAOs() as $daoName) {
             HookRegistry::register(strtolower_codesafe($daoName) . '::getAdditionalFieldNames', array($this, 'getAdditionalFieldNames'));
         }
         // Exclude issue articles
         HookRegistry::register('Editor::IssueManagementHandler::editIssue', array($this, 'editIssue'));
     }
     return $success;
 }
Exemplo n.º 6
0
 function _handleOjsUrl($matchArray)
 {
     $url = $matchArray[2];
     $anchor = null;
     if (($i = strpos($url, '#')) !== false) {
         $anchor = substr($url, $i + 1);
         $url = substr($url, 0, $i);
     }
     $urlParts = explode('/', $url);
     if (isset($urlParts[0])) {
         switch (strtolower_codesafe($urlParts[0])) {
             case 'journal':
                 $url = Request::url(isset($urlParts[1]) ? $urlParts[1] : Request::getRequestedJournalPath(), null, null, null, null, $anchor);
                 break;
             case 'article':
                 if (isset($urlParts[1])) {
                     $url = Request::url(null, 'article', 'view', $urlParts[1], null, $anchor);
                 }
                 break;
             case 'issue':
                 if (isset($urlParts[1])) {
                     $url = Request::url(null, 'issue', 'view', $urlParts[1], null, $anchor);
                 } else {
                     $url = Request::url(null, 'issue', 'current', null, null, $anchor);
                 }
                 break;
             case 'suppfile':
                 if (isset($urlParts[1]) && isset($urlParts[2])) {
                     $url = Request::url(null, 'article', 'downloadSuppFile', array($urlParts[1], $urlParts[2]), null, $anchor);
                 }
                 break;
             case 'sitepublic':
                 array_shift($urlParts);
                 import('classes.file.PublicFileManager');
                 $publicFileManager = new PublicFileManager();
                 $url = Request::getBaseUrl() . '/' . $publicFileManager->getSiteFilesPath() . '/' . implode('/', $urlParts) . ($anchor ? '#' . $anchor : '');
                 break;
             case 'public':
                 array_shift($urlParts);
                 $journal =& Request::getJournal();
                 import('classes.file.PublicFileManager');
                 $publicFileManager = new PublicFileManager();
                 $url = Request::getBaseUrl() . '/' . $publicFileManager->getJournalFilesPath($journal->getId()) . '/' . implode('/', $urlParts) . ($anchor ? '#' . $anchor : '');
                 break;
         }
     }
     return $matchArray[1] . $url . $matchArray[3];
 }
Exemplo n.º 7
0
 /**
  * Fix broken submission filenames (bug #8461)
  * @param $upgrade Upgrade
  * @param $params array
  * @param $dryrun boolean True iff only a dry run (displaying rather than executing changes) should be done.
  * @return boolean
  */
 function fixFilenames($upgrade, $params, $dryrun = false)
 {
     $pressDao = DAORegistry::getDAO('PressDAO');
     $submissionDao = DAORegistry::getDAO('MonographDAO');
     $submissionFileDao = DAORegistry::getDAO('SubmissionFileDAO');
     DAORegistry::getDAO('GenreDAO');
     // Load constants
     $siteDao = DAORegistry::getDAO('SiteDAO');
     /* @var $siteDao SiteDAO */
     $site = $siteDao->getSite();
     $adminEmail = $site->getLocalizedContactEmail();
     import('lib.pkp.classes.file.SubmissionFileManager');
     $contexts = $pressDao->getAll();
     while ($context = $contexts->next()) {
         $submissions = $submissionDao->getByPressId($context->getId());
         while ($submission = $submissions->next()) {
             $submissionFileManager = new SubmissionFileManager($context->getId(), $submission->getId());
             $submissionFiles = $submissionFileDao->getBySubmissionId($submission->getId());
             foreach ($submissionFiles as $submissionFile) {
                 $generatedFilename = $submissionFile->getServerFileName();
                 $basePath = $submissionFileManager->getBasePath() . $submissionFile->_fileStageToPath($submissionFile->getFileStage()) . '/';
                 $globPattern = $submissionFile->getSubmissionId() . '-' . '*' . '-' . $submissionFile->getFileId() . '-' . $submissionFile->getRevision() . '-' . $submissionFile->getFileStage() . '-' . date('Ymd', strtotime($submissionFile->getDateUploaded())) . '.' . strtolower_codesafe($submissionFile->getExtension());
                 $matchedResults = glob($basePath . $globPattern);
                 if (count($matchedResults) > 1) {
                     error_log("Duplicate potential files for \"{$globPattern}\"!", 1, $adminEmail);
                     continue;
                 }
                 if (count($matchedResults) == 1) {
                     // 1 result matched.
                     $discoveredFilename = array_shift($matchedResults);
                     if ($dryrun) {
                         echo "Need to rename \"{$discoveredFilename}\" to \"{$generatedFilename}\".\n";
                     } else {
                         rename($discoveredFilename, $basePath . $generatedFilename);
                     }
                 } else {
                     // 0 results matched.
                     error_log("Unable to find a match for \"{$globPattern}\".\n", 1, $adminEmail);
                     continue;
                 }
             }
         }
     }
     return true;
 }
Exemplo n.º 8
0
 /**
  * Perform initialization required for the string wrapper library.
  * @return null
  */
 static function init()
 {
     $clientCharset = strtolower_codesafe(Config::getVar('i18n', 'client_charset'));
     // Check if mbstring is installed (requires PHP >= 4.3.0)
     if (String::hasMBString()) {
         // mbstring routines are available
         define('ENABLE_MBSTRING', true);
         // Set up required ini settings for mbstring
         // FIXME Do any other mbstring settings need to be set?
         mb_internal_encoding($clientCharset);
         mb_substitute_character('63');
         // question mark
     }
     // Define modifier to be used in regexp_* routines
     // FIXME Should non-UTF-8 encodings be supported with mbstring?
     if ($clientCharset == 'utf-8' && String::hasPCREUTF8()) {
         define('PCRE_UTF8', 'u');
     } else {
         define('PCRE_UTF8', '');
     }
 }
 /**
  * @copydoc Plugin::register()
  */
 function register($category, $path)
 {
     if (!parent::register($category, $path)) {
         return false;
     }
     if ($this->getEnabled()) {
         // Enable storage of additional fields.
         foreach ($this->getDAOs() as $publicObjectType => $dao) {
             HookRegistry::register(strtolower_codesafe(get_class($dao)) . '::getAdditionalFieldNames', array($this, 'getAdditionalFieldNames'));
             if (strtolower_codesafe(get_class($dao)) == 'submissionfiledao') {
                 // if it is a file, consider all file delegates
                 $fileDAOdelegates = $this->getFileDAODelegates();
                 foreach ($fileDAOdelegates as $fileDAOdelegate) {
                     HookRegistry::register(strtolower_codesafe($fileDAOdelegate) . '::getAdditionalFieldNames', array($this, 'getAdditionalFieldNames'));
                 }
             }
         }
     }
     $this->addLocaleData();
     return true;
 }
Exemplo n.º 10
0
 /**
  * Get locale field names. Like getAdditionalFieldNames, but for
  * localized (multilingual) fields.
  * @see getAdditionalFieldNames
  * @return array Array of string field names.
  */
 function getLocaleFieldNames()
 {
     $returner = array();
     // Call hooks based on the calling entity, assuming
     // this method is only called by a subclass. Results
     // in hook calls named e.g. "sessiondao::getLocaleFieldNames"
     // (class names lowercase)
     HookRegistry::call(strtolower_codesafe(get_class($this)) . '::getLocaleFieldNames', array($this, &$returner));
     return $returner;
 }
 /**
  * Make sure that the genre of the file and its file
  * implementation are compatible.
  *
  * NB: In the case of a downcast this means that not all data in the
  * object will be saved to the database. It is the UI's responsibility
  * to inform users about potential loss of data if they change to
  * a genre that permits less meta-data than the prior genre!
  *
  * @param $submissionFile SubmissionFile
  * @return SubmissionFile The same file in a compatible implementation.
  */
 private function _castToGenre($submissionFile)
 {
     // Find the required target implementation.
     $targetImplementation = strtolower_codesafe($this->_getFileImplementationForGenreId($submissionFile->getGenreId()));
     // If the current implementation of the updated object
     // is the same as the target implementation, skip cast.
     if (is_a($submissionFile, $targetImplementation)) {
         return $submissionFile;
     }
     // The updated file has to be upcast by manually
     // instantiating the target object and copying data
     // to the target.
     $targetDaoDelegate = $this->_getDaoDelegate($targetImplementation);
     $targetFile = $targetDaoDelegate->newDataObject();
     $targetFile = $submissionFile->upcastTo($targetFile);
     return $targetFile;
 }
Exemplo n.º 12
0
 function glue_url($parsed)
 {
     // Thanks to php dot net at NOSPAM dot juamei dot com
     // See http://www.php.net/manual/en/function.parse-url.php
     if (!is_array($parsed)) {
         return false;
     }
     $uri = isset($parsed['scheme']) ? $parsed['scheme'] . ':' . (strtolower_codesafe($parsed['scheme']) == 'mailto' ? '' : '//') : '';
     $uri .= isset($parsed['user']) ? $parsed['user'] . ($parsed['pass'] ? ':' . $parsed['pass'] : '') . '@' : '';
     $uri .= isset($parsed['host']) ? $parsed['host'] : '';
     $uri .= isset($parsed['port']) ? ':' . $parsed['port'] : '';
     $uri .= isset($parsed['path']) ? $parsed['path'] : '';
     $uri .= isset($parsed['query']) ? '?' . $parsed['query'] : '';
     $uri .= isset($parsed['fragment']) ? '#' . $parsed['fragment'] : '';
     return $uri;
 }
Exemplo n.º 13
0
 /**
  * Adds specified user date variables to input data.
  * @param $vars array the names of the date variables to read
  */
 function readUserDateVars($vars)
 {
     // Call hooks based on the calling entity, assuming
     // this method is only called by a subclass. Results
     // in hook calls named e.g. "papergalleyform::readUserDateVars"
     // Note that class and function names are always lower
     // case.
     HookRegistry::call(strtolower_codesafe(get_class($this) . '::readUserDateVars'), array($this, &$vars));
     foreach ($vars as $k) {
         $this->setData($k, Request::getUserDateVar($k));
     }
 }
 /**
  * Check DOI input and display on a single metadata page.
  * @param $objectType string
  * @param $editable boolean whether the DOI Suffix field should be editable.
  * @param $expectedDoi string
  */
 private function checkMetadataPage($objectType, $editable = false, $expectedDoi = null, $objectId = 1, $isPreview = false)
 {
     try {
         $objectType = strtolower_codesafe($objectType);
         $metadataPage = "metadata-{$objectType}";
         $url = $this->getUrl($metadataPage, $objectId);
         $this->verifyAndOpen($url);
         $doiText = $this->getText($this->pages[$metadataPage]['doi']);
         if ($editable) {
             if (!is_null($expectedDoi)) {
                 $this->assertValue($this->pages[$metadataPage]['doiInput'], $expectedDoi);
             }
         } else {
             $this->assertElementNotPresent($this->pages[$metadataPage]['doiInput']);
             if (!is_null($expectedDoi)) {
                 $this->assertContains("DOI {$expectedDoi}", $doiText);
             }
         }
         if ($isPreview) {
             $this->assertContains('What you see is a preview', $doiText);
         }
     } catch (Exception $e) {
         throw $this->improveException($e, $objectType);
     }
 }
Exemplo n.º 15
0
    /**
     * For 3.0.0 upgrade.  Migrates submission files to new paths.
     */
    function migrateSubmissionFilePaths()
    {
        $submissionFileDao = DAORegistry::getDAO('SubmissionFileDAO');
        import('lib.pkp.classes.submission.SubmissionFile');
        $genreDao = DAORegistry::getDAO('GenreDAO');
        $journalDao = DAORegistry::getDAO('JournalDAO');
        $submissionFile = new SubmissionFile();
        import('lib.pkp.classes.file.FileManager');
        $fileManager = new FileManager();
        $articleFilesResult = $submissionFileDao->retrieve('SELECT af.*, s.submission_id, s.context_id FROM article_files_migration af, submissions s WHERE af.article_id = s.submission_id');
        $filesDir = Config::getVar('files', 'files_dir') . '/journals/';
        while (!$articleFilesResult->EOF) {
            $row = $articleFilesResult->GetRowAssoc(false);
            // Assemble the old file path.
            $oldFilePath = $filesDir . $row['context_id'] . '/articles/' . $row['submission_id'] . '/';
            if (isset($row['type'])) {
                // pre 2.4 upgrade.
                $oldFilePath .= $row['type'];
            } else {
                // post 2.4, we have file_stage instead.
                switch ($row['file_stage']) {
                    case 1:
                        $oldFilePath .= 'submission/original';
                        break;
                    case 2:
                        $oldFilePath .= 'submission/review';
                        break;
                    case 3:
                        $oldFilePath .= 'submission/editor';
                        break;
                    case 4:
                        $oldFilePath .= 'submission/copyedit';
                        break;
                    case 5:
                        $oldFilePath .= 'submission/layout';
                        break;
                    case 6:
                        $oldFilePath .= 'supp';
                        break;
                    case 7:
                        $oldFilePath .= 'public';
                        break;
                    case 8:
                        $oldFilePath .= 'note';
                        break;
                    case 9:
                        $oldFilePath .= 'attachment';
                        break;
                }
            }
            $oldFilePath .= '/' . $row['file_name'];
            if (file_exists($oldFilePath)) {
                // sanity check.
                $newFilePath = $filesDir . $row['context_id'] . '/articles/' . $row['submission_id'] . '/';
                // Since we cannot be sure that we had a file_stage column before, query the new submission_files table.
                $submissionFileResult = $submissionFileDao->retrieve('SELECT genre_id, file_stage, date_uploaded, original_file_name
							FROM submission_files WHERE file_id = ? and revision = ?', array($row['file_id'], $row['revision']));
                $submissionFileRow = $submissionFileResult->GetRowAssoc(false);
                $newFilePath .= $submissionFile->_fileStageToPath($submissionFileRow['file_stage']);
                $genre = $genreDao->getById($submissionFileRow['genre_id']);
                // pull in the primary locale for this journal without loading the whole object.
                $localeResult = $journalDao->retrieve('SELECT primary_locale FROM journals WHERE journal_id = ?', array($row['context_id']));
                $localeRow = $localeResult->GetRowAssoc(false);
                $newFilePath .= '/' . $row['submission_id'] . '-' . $genre->getDesignation() . '_' . $genre->getName($localeRow['primary_locale']) . '-' . $row['file_id'] . '-' . $row['revision'] . '-' . $submissionFileRow['file_stage'] . '-' . date('Ymd', strtotime($submissionFileRow['date_uploaded'])) . '.' . strtolower_codesafe($fileManager->parseFileExtension($submissionFileRow['original_file_name']));
                $fileManager->copyFile($oldFilePath, $newFilePath);
                if (file_exists($newFilePath)) {
                    $fileManager->deleteFile($oldFilePath);
                }
            }
            $articleFilesResult->MoveNext();
            unset($localeResult);
            unset($submissionFileResult);
            unset($localeRow);
            unset($submissionFileRow);
        }
        return true;
    }
Exemplo n.º 16
0
 /**
  * Get the protocol used for the request (HTTP or HTTPS).
  * @return string
  */
 function getProtocol()
 {
     $_this =& PKPRequest::_checkThis();
     if (!isset($_this->_protocol)) {
         $_this->_protocol = !isset($_SERVER['HTTPS']) || strtolower_codesafe($_SERVER['HTTPS']) != 'on' ? 'http' : 'https';
         HookRegistry::call('Request::getProtocol', array(&$_this->_protocol));
     }
     return $_this->_protocol;
 }
 /**
  * Base form element.
  * @param $params array
  * @param $smarty object-
  */
 function smartyFBVElement($params, &$smarty, $content = null)
 {
     if (!isset($params['type'])) {
         $smarty->trigger_error('FBV: Element type not set');
     }
     if (!isset($params['id'])) {
         $smarty->trigger_error('FBV: Element ID not set');
     }
     // Set up the element template
     $smarty->assign('FBV_id', $params['id']);
     $smarty->assign('FBV_class', isset($params['class']) ? $params['class'] : null);
     $smarty->assign('FBV_required', isset($params['required']) ? $params['required'] : false);
     $smarty->assign('FBV_layoutInfo', $this->_getLayoutInfo($params));
     $smarty->assign('FBV_label', isset($params['label']) ? $params['label'] : null);
     $smarty->assign('FBV_for', isset($params['for']) ? $params['for'] : null);
     $smarty->assign('FBV_tabIndex', isset($params['tabIndex']) ? $params['tabIndex'] : null);
     $smarty->assign('FBV_translate', isset($params['translate']) ? $params['translate'] : true);
     $smarty->assign('FBV_keepLabelHtml', isset($params['keepLabelHtml']) ? $params['keepLabelHtml'] : false);
     // Unset these parameters so they don't get assigned twice
     unset($params['class']);
     // Find fields that the form class has marked as required and add the 'required' class to them
     $params = $this->_addClientSideValidation($params);
     $smarty->assign('FBV_validation', isset($params['validation']) ? $params['validation'] : null);
     // Set up the specific field's template
     switch (strtolower_codesafe($params['type'])) {
         case 'autocomplete':
             $content = $this->_smartyFBVAutocompleteInput($params, $smarty);
             break;
         case 'button':
         case 'submit':
             $content = $this->_smartyFBVButton($params, $smarty);
             break;
         case 'checkbox':
             $content = $this->_smartyFBVCheckbox($params, $smarty);
             unset($params['label']);
             break;
         case 'checkboxgroup':
             $content = $this->_smartyFBVCheckboxGroup($params, $smarty);
             unset($params['label']);
             break;
         case 'file':
             $content = $this->_smartyFBVFileInput($params, $smarty);
             break;
         case 'hidden':
             $content = $this->_smartyFBVHiddenInput($params, $smarty);
             break;
         case 'keyword':
             $content = $this->_smartyFBVKeywordInput($params, $smarty);
             break;
         case 'interests':
             $content = $this->_smartyFBVInterestsInput($params, $smarty);
             break;
         case 'link':
             $content = $this->_smartyFBVLink($params, $smarty);
             break;
         case 'radio':
             $content = $this->_smartyFBVRadioButton($params, $smarty);
             unset($params['label']);
             break;
         case 'rangeslider':
             $content = $this->_smartyFBVRangeSlider($params, $smarty);
             break;
         case 'select':
             $content = $this->_smartyFBVSelect($params, $smarty);
             break;
         case 'text':
             $content = $this->_smartyFBVTextInput($params, $smarty);
             break;
         case 'textarea':
             $content = $this->_smartyFBVTextArea($params, $smarty);
             break;
         default:
             assert(false);
     }
     unset($params['type']);
     $parent = $smarty->_tag_stack[count($smarty->_tag_stack) - 1];
     $group = false;
     if ($parent) {
         $form = $this->getForm();
         if (isset($form) && isset($form->errorFields[$params['id']])) {
             array_push($form->formSectionErrors, $form->errorsArray[$params['id']]);
         }
         if (isset($parent[1]['group']) && $parent[1]['group']) {
             $group = true;
         }
     }
     return $content;
 }
Exemplo n.º 18
0
 /**
  * Generate the unique filename for this submission file.
  * @return string
  */
 function _generateFileName()
 {
     // Generate a human readable time stamp.
     $timestamp = date('Ymd', strtotime($this->getDateUploaded()));
     // Make the file name unique across all files and file revisions.
     // Also make sure that files can be ordered sensibly by file name.
     return $this->getSubmissionId() . '-' . $this->getGenreId() . '-' . $this->getFileId() . '-' . $this->getRevision() . '-' . $this->getFileStage() . '-' . $timestamp . '.' . strtolower_codesafe($this->getExtension());
 }
Exemplo n.º 19
0
 /**
  * @see PKPRouter::route()
  */
 function route(&$request)
 {
     // Determine the requested page and operation
     $page = $this->getRequestedPage($request);
     $op = $this->getRequestedOp($request);
     // If the application has not yet been installed we only
     // allow installer pages to be displayed.
     if (!Config::getVar('general', 'installed')) {
         define('SESSION_DISABLE_INIT', 1);
         if (!in_array($page, $this->getInstallationPages())) {
             // A non-installation page was called although
             // the system is not yet installed. Redirect to
             // the installation page.
             $redirectMethod = array($request, 'redirect');
             // The correct redirection for the installer page
             // depends on the context depth of this application.
             $application =& $this->getApplication();
             $contextDepth = $application->getContextDepth();
             // The context will be filled with all nulls
             $redirectArguments = array_pad(array('install'), -$contextDepth - 1, null);
             // Call request's redirect method
             call_user_func_array($redirectMethod, $redirectArguments);
         }
     }
     // Determine the page index file. This file contains the
     // logic to resolve a page to a specific handler class.
     $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;
         } elseif (file_exists('lib/pkp/' . $sourceFile)) {
             require './lib/pkp/' . $sourceFile;
         } elseif (empty($page)) {
             require ROUTER_DEFAULT_PAGE;
         } else {
             $dispatcher =& $this->getDispatcher();
             $dispatcher->handle404();
         }
     }
     if (!defined('SESSION_DISABLE_INIT')) {
         // Initialize session
         $sessionManager =& SessionManager::getManager();
     }
     // Call the selected handler's index operation if
     // no operation was defined in the request.
     if (empty($op)) {
         $op = ROUTER_DEFAULT_OP;
     }
     // Redirect to 404 if the operation doesn't exist
     // for the handler.
     $methods = array();
     if (defined('HANDLER_CLASS')) {
         $methods = array_map('strtolower_codesafe', get_class_methods(HANDLER_CLASS));
     }
     if (!in_array(strtolower_codesafe($op), $methods)) {
         $dispatcher =& $this->getDispatcher();
         $dispatcher->handle404();
     }
     // Instantiate the handler class
     $HandlerClass = HANDLER_CLASS;
     $handler = new $HandlerClass($request);
     // Authorize and initialize the request but don't call the
     // validate() method on page handlers.
     // FIXME: We should call the validate() method for page
     // requests also (last param = true in the below method
     // call) once we've made sure that all validate() calls can
     // be removed from handler operations without damage (i.e.
     // they don't depend on actions being performed before the
     // call to validate().
     $args = $this->getRequestedArgs($request);
     $serviceEndpoint = array($handler, $op);
     $this->_authorizeInitializeAndCallRequest($serviceEndpoint, $request, $args, false);
 }
 /**
  * Form button.
  * parameters: label (or value), disabled (optional), type (optional)
  * @param $params array
  * @param $smarty object
  */
 function _smartyFBVButton($params, &$smarty)
 {
     // accept 'value' param, but the 'label' param is preferred
     if (isset($params['value'])) {
         $value = $params['value'];
         $params['label'] = isset($params['label']) ? $params['label'] : $value;
         unset($params['value']);
     }
     // the type of this button. the default value is 'button' (but could be 'submit')
     $params['type'] = isset($params['type']) ? strtolower_codesafe($params['type']) : 'button';
     $params['disabled'] = isset($params['disabled']) ? $params['disabled'] : false;
     $buttonParams = '';
     $smarty->clear_assign(array('FBV_label', 'FBV_type', 'FBV_disabled'));
     foreach ($params as $key => $value) {
         switch ($key) {
             case 'label':
                 $smarty->assign('FBV_label', $value);
                 break;
             case 'type':
                 $smarty->assign('FBV_type', $value);
                 break;
             case 'disabled':
                 $smarty->assign('FBV_disabled', $params['disabled']);
                 break;
             default:
                 $buttonParams .= htmlspecialchars($key, ENT_QUOTES, LOCALE_ENCODING) . '="' . htmlspecialchars($value, ENT_QUOTES, LOCALE_ENCODING) . '" ';
         }
     }
     $smarty->assign('FBV_buttonParams', $buttonParams);
     return $smarty->fetch('form/button.tpl');
 }
Exemplo n.º 21
0
 /**
  * Check if the server platform is Windows.
  * @return boolean
  */
 function isWindows()
 {
     return strtolower_codesafe(substr(Core::serverPHPOS(), 0, 3)) == 'win';
 }
Exemplo n.º 22
0
 /**
  * Check if the server platform is Windows.
  * @return boolean
  */
 static function isWindows()
 {
     return strtolower_codesafe(substr(PHP_OS, 0, 3)) == 'win';
 }
Exemplo n.º 23
0
 /**
  * @see PubIdPlugin::getPubId()
  */
 function getPubId(&$pubObject, $preview = false)
 {
     $doi = null;
     if (!$this->isExcluded($pubObject)) {
         // Determine the type of the publishing object.
         $pubObjectType = $this->getPubObjectType($pubObject);
         // Initialize variables for publication objects.
         $issue = $pubObjectType == 'Issue' ? $pubObject : null;
         $article = $pubObjectType == 'Article' ? $pubObject : null;
         $galley = $pubObjectType == 'Galley' ? $pubObject : null;
         $suppFile = $pubObjectType == 'SuppFile' ? $pubObject : null;
         // Get the journal id of the object.
         if (in_array($pubObjectType, array('Issue', 'Article'))) {
             $journalId = $pubObject->getJournalId();
         } else {
             // Retrieve the published article.
             assert(is_a($pubObject, 'ArticleFile'));
             $articleDao =& DAORegistry::getDAO('PublishedArticleDAO');
             /* @var $articleDao PublishedArticleDAO */
             $article =& $articleDao->getPublishedArticleByArticleId($pubObject->getArticleId(), null, true);
             if (!$article) {
                 return null;
             }
             // Now we can identify the journal.
             $journalId = $article->getJournalId();
         }
         $journal =& $this->getJournal($journalId);
         if (!$journal) {
             return null;
         }
         $journalId = $journal->getId();
         // Check whether DOIs are enabled for the given object type.
         $doiEnabled = $this->getSetting($journalId, "enable{$pubObjectType}Doi") == '1';
         if (!$doiEnabled) {
             return null;
         }
         // If we already have an assigned DOI, use it.
         $storedDOI = $pubObject->getStoredPubId('doi');
         if ($storedDOI) {
             return $storedDOI;
         }
         // Retrieve the issue.
         if (!is_a($pubObject, 'Issue')) {
             assert(!is_null($article));
             $issueDao =& DAORegistry::getDAO('IssueDAO');
             /* @var $issueDao IssueDAO */
             $issue =& $issueDao->getIssueByArticleId($article->getId(), $journal->getId(), true);
         }
         if ($issue && $journalId != $issue->getJournalId()) {
             return null;
         }
         // Retrieve the DOI prefix.
         $doiPrefix = $this->getSetting($journalId, 'doiPrefix');
         if (empty($doiPrefix)) {
             return null;
         }
         // Generate the DOI suffix.
         $doiSuffixGenerationStrategy = $this->getSetting($journalId, 'doiSuffix');
         switch ($doiSuffixGenerationStrategy) {
             case 'publisherId':
                 switch ($pubObjectType) {
                     case 'Issue':
                         $doiSuffix = (string) $pubObject->getBestIssueId($journal);
                         break;
                     case 'Article':
                         $doiSuffix = (string) $pubObject->getBestArticleId($journal);
                         break;
                     case 'Galley':
                         $doiSuffix = (string) $pubObject->getBestGalleyId($journal);
                         break;
                     case 'SuppFile':
                         $doiSuffix = (string) $pubObject->getBestSuppFileId($journal);
                         break;
                     default:
                         assert(false);
                 }
                 // When the suffix equals the object's ID then
                 // require an object-specific prefix to be sure that
                 // the suffix is unique.
                 if ($pubObjectType != 'Article' && $doiSuffix === (string) $pubObject->getId()) {
                     $doiSuffix = strtolower_codesafe($pubObjectType[0]) . $doiSuffix;
                 }
                 break;
             case 'customId':
                 $doiSuffix = $pubObject->getData('doiSuffix');
                 break;
             case 'pattern':
                 $doiSuffix = $this->getSetting($journalId, "doi{$pubObjectType}SuffixPattern");
                 // %j - journal initials
                 $doiSuffix = String::regexp_replace('/%j/', String::strtolower($journal->getLocalizedSetting('initials', $journal->getPrimaryLocale())), $doiSuffix);
                 // %x - custom identifier
                 if ($pubObject->getStoredPubId('publisher-id')) {
                     $doiSuffix = String::regexp_replace('/%x/', $pubObject->getStoredPubId('publisher-id'), $doiSuffix);
                 }
                 if ($issue) {
                     // %v - volume number
                     $doiSuffix = String::regexp_replace('/%v/', $issue->getVolume(), $doiSuffix);
                     // %i - issue number
                     $doiSuffix = String::regexp_replace('/%i/', $issue->getNumber(), $doiSuffix);
                     // %Y - year
                     $doiSuffix = String::regexp_replace('/%Y/', $issue->getYear(), $doiSuffix);
                 }
                 if ($article) {
                     // %a - article id
                     $doiSuffix = String::regexp_replace('/%a/', $article->getId(), $doiSuffix);
                     // %p - page number
                     if ($article->getPages()) {
                         $doiSuffix = String::regexp_replace('/%p/', $article->getPages(), $doiSuffix);
                     }
                 }
                 if ($galley) {
                     // %g - galley id
                     $doiSuffix = String::regexp_replace('/%g/', $galley->getId(), $doiSuffix);
                 }
                 if ($suppFile) {
                     // %s - supp file id
                     $doiSuffix = String::regexp_replace('/%s/', $suppFile->getId(), $doiSuffix);
                 }
                 break;
             default:
                 $doiSuffix = String::strtolower($journal->getLocalizedSetting('initials', $journal->getPrimaryLocale()));
                 if ($issue) {
                     $doiSuffix .= '.v' . $issue->getVolume() . 'i' . $issue->getNumber();
                 } else {
                     $doiSuffix .= '.v%vi%i';
                 }
                 if ($article) {
                     $doiSuffix .= '.' . $article->getId();
                 }
                 if ($galley) {
                     $doiSuffix .= '.g' . $galley->getId();
                 }
                 if ($suppFile) {
                     $doiSuffix .= '.s' . $suppFile->getId();
                 }
         }
         if (empty($doiSuffix)) {
             return null;
         }
         // Join prefix and suffix.
         $doi = $doiPrefix . '/' . $doiSuffix;
         if (!$preview) {
             // Save the generated DOI.
             $this->setStoredPubId($pubObject, $pubObjectType, $doi);
         }
     }
     return $doi;
 }
 /**
  * Delete all settings for a plugin.
  * @param $contextId int
  * @param $pluginName string
  */
 function deleteSettingsByPlugin($contextId, $pluginName)
 {
     // Normalize the plug-in name to lower case.
     $pluginName = strtolower_codesafe($pluginName);
     $cache = $this->_getCache($contextId, $pluginName);
     $cache->flush();
     return $this->update('DELETE FROM plugin_settings WHERE context_id = ? AND plugin_name = ?', array((int) $contextId, $pluginName));
 }
Exemplo n.º 25
0
 /**
  * Get the last, check number.
  * Algorithm (s. http://www.persistent-identifier.de/?link=316):
  *  every URN character is replaced with a number according to the conversion table,
  *  every number is multiplied by it's position/index (beginning with 1),
  *  the numbers' sum is calculated,
  *  the sum is devided by the last number,
  *  the last number of the quotient before the decimal point is the check number.
  */
 function _calculateCheckNo($urn)
 {
     $urnLower = strtolower_codesafe($urn);
     $conversionTable = array('9' => '41', '8' => '9', '7' => '8', '6' => '7', '5' => '6', '4' => '5', '3' => '4', '2' => '3', '1' => '2', '0' => '1', 'a' => '18', 'b' => '14', 'c' => '19', 'd' => '15', 'e' => '16', 'f' => '21', 'g' => '22', 'h' => '23', 'i' => '24', 'j' => '25', 'k' => '42', 'l' => '26', 'm' => '27', 'n' => '13', 'o' => '28', 'p' => '29', 'q' => '31', 'r' => '12', 's' => '32', 't' => '33', 'u' => '11', 'v' => '34', 'w' => '35', 'x' => '36', 'y' => '37', 'z' => '38', '-' => '39', ':' => '17', '_' => '43', '/' => '45', '.' => '47', '+' => '49');
     $newURN = '';
     for ($i = 0; $i < strlen($urnLower); $i++) {
         $char = $urnLower[$i];
         $newURN .= $conversionTable[$char];
     }
     $sum = 0;
     for ($j = 1; $j <= strlen($newURN); $j++) {
         $sum = $sum + $newURN[$j - 1] * $j;
     }
     $lastNumber = $newURN[strlen($newURN) - 1];
     $quot = $sum / $lastNumber;
     $quotRound = floor($quot);
     $quotString = (string) $quotRound;
     return $quotString[strlen($quotString) - 1];
 }
Exemplo n.º 26
0
 /**
  * Paper view
  * @param $args array
  * @param $request Request
  */
 function viewPaper($args, &$request)
 {
     $router =& $request->getRouter();
     $paperId = isset($args[0]) ? $args[0] : 0;
     $galleyId = isset($args[1]) ? (int) $args[1] : 0;
     $this->validate($request, $paperId, $galleyId);
     $conference =& $router->getContext($request, CONTEXT_CONFERENCE);
     $schedConf =& $router->getContext($request, CONTEXT_SCHED_CONF);
     $paper =& $this->paper;
     $this->setupTemplate($request);
     $rtDao = DAORegistry::getDAO('RTDAO');
     $conferenceRt = $rtDao->getConferenceRTByConference($conference);
     $trackDao = DAORegistry::getDAO('TrackDAO');
     $track =& $trackDao->getTrack($paper->getTrackId());
     if ($conferenceRt->getVersion() != null && $conferenceRt->getDefineTerms()) {
         // Determine the "Define Terms" context ID.
         $version = $rtDao->getVersion($conferenceRt->getVersion(), $conferenceRt->getConferenceId());
         if ($version) {
             foreach ($version->getContexts() as $context) {
                 if ($context->getDefineTerms()) {
                     $defineTermsContextId = $context->getContextId();
                     break;
                 }
             }
         }
     }
     $commentDao = DAORegistry::getDAO('CommentDAO');
     $enableComments = $conference->getSetting('enableComments');
     $commentsRequireRegistration = $conference->getSetting('commentsRequireRegistration');
     $commentsAllowAnonymous = $conference->getSetting('commentsAllowAnonymous');
     if ($enableComments && $paper->getEnableComments()) {
         $comments =& $commentDao->getRootCommentsBySubmissionId($paper->getId());
     }
     $paperGalleyDao = DAORegistry::getDAO('PaperGalleyDAO');
     $galley =& $paperGalleyDao->getGalley($galleyId, $paper->getId());
     $templateMgr =& TemplateManager::getManager($request);
     if (!$galley) {
         // Get the registration status if displaying the abstract;
         // if access is open, we can display links to the full text.
         import('classes.schedConf.SchedConfAction');
         $templateMgr->assign('mayViewPaper', SchedConfAction::mayViewPapers($schedConf, $conference));
         $templateMgr->assign('registeredUser', SchedConfAction::registeredUser($schedConf));
         $templateMgr->assign('registeredDomain', SchedConfAction::registeredDomain($schedConf));
         // Increment the published paper's abstract views count
         $publishedPaperDao = DAORegistry::getDAO('PublishedPaperDAO');
         $publishedPaperDao->incrementViewsByPaperId($paper->getId());
     } else {
         // Increment the galley's views count
         $paperGalleyDao->incrementViews($galleyId);
         // Use the paper's CSS file, if set.
         if ($galley->isHTMLGalley() && ($styleFile =& $galley->getStyleFile())) {
             $templateMgr->addStyleSheet($router->url($request, null, null, 'paper', 'viewFile', array($paper->getId(), $galley->getId(), $styleFile->getFileId())));
         }
     }
     // Add font sizer js and css if not already in header
     $additionalHeadData = $templateMgr->get_template_vars('additionalHeadData');
     if (strpos(strtolower_codesafe($additionalHeadData), 'sizer.js') === false) {
         $additionalHeadData .= $templateMgr->fetch('common/sizer.tpl');
         $templateMgr->assign('additionalHeadData', $additionalHeadData);
     }
     $templateMgr->assign_by_ref('schedConf', $schedConf);
     $templateMgr->assign_by_ref('conference', $conference);
     $templateMgr->assign_by_ref('paper', $paper);
     $templateMgr->assign_by_ref('galley', $galley);
     $templateMgr->assign_by_ref('track', $track);
     $templateMgr->assign('paperId', $paperId);
     $closeCommentsDate = $schedConf->getSetting('closeCommentsDate');
     $commentsClosed = $schedConf->getSetting('closeComments') ? true : false && strtotime($closeCommentsDate < time());
     $templateMgr->assign('closeCommentsDate', $closeCommentsDate);
     $templateMgr->assign('commentsClosed', $commentsClosed);
     $templateMgr->assign('postingAllowed', $enableComments && !$commentsClosed && $paper->getEnableComments() && (!$commentsRequireRegistration || Validation::isLoggedIn()));
     $templateMgr->assign('galleyId', $galleyId);
     $templateMgr->assign('defineTermsContextId', isset($defineTermsContextId) ? $defineTermsContextId : null);
     $templateMgr->assign('comments', isset($comments) ? $comments : null);
     if ($paper->getRoomId()) {
         $roomDao = DAORegistry::getDAO('RoomDAO');
         $buildingDao = DAORegistry::getDAO('BuildingDAO');
         $room =& $roomDao->getRoom($paper->getRoomId());
         if (!$room) {
             break;
         }
         $building =& $buildingDao->getBuilding($room->getBuildingId());
         $templateMgr->assign_by_ref('room', $room);
         $templateMgr->assign_by_ref('building', $building);
     }
     $templateMgr->display('paper/paper.tpl');
 }
 /**
  * This method pre-validates the service endpoint parts before
  * we try to convert them to a file/method name. This also
  * converts all parts to lower case.
  * @param $rpcServiceEndpointParts array
  * @return array the validated service endpoint parts or null if validation
  *  does not succeed.
  */
 function _validateServiceEndpointParts($rpcServiceEndpointParts)
 {
     // Do we have data at all?
     if (is_null($rpcServiceEndpointParts) || empty($rpcServiceEndpointParts) || !is_array($rpcServiceEndpointParts)) {
         return null;
     }
     // We require at least three parts: component directory, handler
     // and method name.
     if (count($rpcServiceEndpointParts) < 3) {
         return null;
     }
     // Check that the array dimensions remain within sane limits.
     if (count($rpcServiceEndpointParts) > COMPONENT_ROUTER_PARTS_MAXDEPTH) {
         return null;
     }
     // Validate the individual endpoint parts.
     foreach ($rpcServiceEndpointParts as $key => $rpcServiceEndpointPart) {
         // Make sure that none of the elements exceeds the length limit.
         $partLen = strlen($rpcServiceEndpointPart);
         if ($partLen > COMPONENT_ROUTER_PARTS_MAXLENGTH || $partLen < COMPONENT_ROUTER_PARTS_MINLENGTH) {
             return null;
         }
         // Service endpoint URLs are case insensitive.
         $rpcServiceEndpointParts[$key] = strtolower_codesafe($rpcServiceEndpointPart);
         // We only allow letters, numbers and the hyphen.
         if (!String::regexp_match('/^[a-z0-9-]*$/', $rpcServiceEndpointPart)) {
             return null;
         }
     }
     return $rpcServiceEndpointParts;
 }
Exemplo n.º 28
0
 /**
  * Register the hook that adds an
  * additional field name to objects.
  * @param $daoName string
  */
 function registerDaoHook($daoName)
 {
     HookRegistry::register(strtolower_codesafe($daoName) . '::getAdditionalFieldNames', array($this, 'getAdditionalFieldNames'));
 }
Exemplo n.º 29
0
 /**
  * Parse an XML users file into a set of users to import.
  * @param $file string path to the XML file to parse
  * @return array ImportedUsers the collection of users read from the file
  */
 function &parseData($file)
 {
     $roleDao =& DAORegistry::getDAO('RoleDAO');
     $success = true;
     $this->usersToImport = array();
     $tree = $this->parser->parse($file);
     $journalDao =& DAORegistry::getDAO('JournalDAO');
     $journal =& $journalDao->getById($this->journalId);
     $journalPrimaryLocale = AppLocale::getPrimaryLocale();
     $site =& Request::getSite();
     $siteSupportedLocales = $site->getSupportedLocales();
     if ($tree !== false) {
         foreach ($tree->getChildren() as $user) {
             if ($user->getName() == 'user') {
                 // Match user element
                 $newUser = new ImportedUser();
                 foreach ($user->getChildren() as $attrib) {
                     switch ($attrib->getName()) {
                         case 'username':
                             // Usernames must be lowercase
                             $newUser->setUsername(strtolower_codesafe($attrib->getValue()));
                             break;
                         case 'password':
                             $newUser->setMustChangePassword($attrib->getAttribute('change') == 'true' ? 1 : 0);
                             $encrypted = $attrib->getAttribute('encrypted');
                             if (isset($encrypted) && $encrypted !== 'plaintext') {
                                 $ojsEncryptionScheme = Config::getVar('security', 'encryption');
                                 if ($encrypted != $ojsEncryptionScheme) {
                                     $this->errors[] = __('plugins.importexport.users.import.encryptionMismatch', array('importHash' => $encrypted, 'ojsHash' => $ojsEncryptionScheme));
                                 }
                                 $newUser->setPassword($attrib->getValue());
                             } else {
                                 $newUser->setUnencryptedPassword($attrib->getValue());
                             }
                             break;
                         case 'salutation':
                             $newUser->setSalutation($attrib->getValue());
                             break;
                         case 'first_name':
                             $newUser->setFirstName($attrib->getValue());
                             break;
                         case 'middle_name':
                             $newUser->setMiddleName($attrib->getValue());
                             break;
                         case 'last_name':
                             $newUser->setLastName($attrib->getValue());
                             break;
                         case 'initials':
                             $newUser->setInitials($attrib->getValue());
                             break;
                         case 'gender':
                             $newUser->setGender($attrib->getValue());
                             break;
                         case 'affiliation':
                             $locale = $attrib->getAttribute('locale');
                             if (empty($locale)) {
                                 $locale = $journalPrimaryLocale;
                             }
                             $newUser->setAffiliation($attrib->getValue(), $locale);
                             break;
                         case 'email':
                             $newUser->setEmail($attrib->getValue());
                             break;
                         case 'url':
                             $newUser->setUrl($attrib->getValue());
                             break;
                         case 'phone':
                             $newUser->setPhone($attrib->getValue());
                             break;
                         case 'fax':
                             $newUser->setFax($attrib->getValue());
                             break;
                         case 'mailing_address':
                             $newUser->setMailingAddress($attrib->getValue());
                             break;
                         case 'country':
                             $newUser->setCountry($attrib->getValue());
                             break;
                         case 'signature':
                             $locale = $attrib->getAttribute('locale');
                             if (empty($locale)) {
                                 $locale = $journalPrimaryLocale;
                             }
                             $newUser->setSignature($attrib->getValue(), $locale);
                             break;
                         case 'interests':
                             $newUser->setTemporaryInterests($attrib->getValue());
                             break;
                         case 'gossip':
                             $locale = $attrib->getAttribute('locale');
                             if (empty($locale)) {
                                 $locale = $journalPrimaryLocale;
                             }
                             $newUser->setGossip($attrib->getValue(), $locale);
                             break;
                         case 'biography':
                             $locale = $attrib->getAttribute('locale');
                             if (empty($locale)) {
                                 $locale = $journalPrimaryLocale;
                             }
                             $newUser->setBiography($attrib->getValue(), $locale);
                             break;
                         case 'locales':
                             $locales = array();
                             foreach (explode(':', $attrib->getValue()) as $locale) {
                                 if (AppLocale::isLocaleValid($locale) && in_array($locale, $siteSupportedLocales)) {
                                     array_push($locales, $locale);
                                 }
                             }
                             $newUser->setLocales($locales);
                             break;
                         case 'role':
                             $roleType = $attrib->getAttribute('type');
                             if ($this->validRole($roleType)) {
                                 $role = new Role();
                                 $role->setRoleId($roleDao->getRoleIdFromPath($roleType));
                                 $newUser->addRole($role);
                             }
                             break;
                     }
                 }
                 array_push($this->usersToImport, $newUser);
             }
         }
     }
     return $this->usersToImport;
 }
Exemplo n.º 30
0
 /**
  * Remove registered DOIs for all out test objects.
  * @param $pluginName string
  */
 protected function removeRegisteredDois($pluginName)
 {
     // Mark all our test objects as "unregistered".
     $configurations = array('Issue' => array('IssueDAO', 'updateObject', 'getById', 1), 'Article' => array('ArticleDAO', 'updateObject', 'getArticle', 1), 'ArticleGalley' => array('ArticleGalleyDAO', 'updateGalley', 'getGalley', array(1, 2, 3)), 'SuppFile' => array('SuppFileDAO', 'updateSuppFile', 'getSuppFile', 1));
     $pluginInstance = $this->instantiatePlugin($pluginName);
     foreach ($configurations as $objectType => $configuration) {
         list($daoName, $updateMethod, $getMethod, $testIds) = $configuration;
         $dao = DAORegistry::getDAO($daoName);
         if (is_scalar($testIds)) {
             $testIds = array($testIds);
         }
         $hookName = strtolower_codesafe($daoName) . '::getAdditionalFieldNames';
         HookRegistry::register($hookName, array($pluginInstance, 'getAdditionalFieldNames'));
         foreach ($testIds as $testId) {
             // Retrieve the test object.
             $testObject = $dao->{$getMethod}($testId);
             // Remove the registered DOI.
             $testObject->setData($this->pluginId . '::' . DOI_EXPORT_REGDOI, '');
             $dao->{$updateMethod}($testObject);
         }
         $hooks = HookRegistry::getHooks();
         foreach ($hooks[$hookName] as $index => $hook) {
             if (is_a($hook[0], $pluginName)) {
                 unset($hooks[$hookName][$index]);
                 break;
             }
         }
     }
 }