Example #1
0
 /**
  * Constructor
  **/
 function CustomLocaleHandler($parentPluginName)
 {
     parent::Handler();
     $this->addCheck(new HandlerValidatorJournal($this));
     $this->addCheck(new HandlerValidatorRoles($this, true, null, null, array(ROLE_ID_SITE_ADMIN, ROLE_ID_MANAGER)));
     $this->plugin = PluginRegistry::getPlugin('generic', $parentPluginName);
 }
 /**
  * Constructor
  */
 function CustomLocaleHandler()
 {
     parent::Handler();
     $this->addCheck(new HandlerValidatorConference($this));
     $this->addCheck(new HandlerValidatorRoles($this, true, null, null, array(ROLE_ID_SITE_ADMIN, ROLE_ID_CONFERENCE_MANAGER)));
     $plugin =& PluginRegistry::getPlugin('generic', 'CustomLocalePlugin');
     $this->plugin =& $plugin;
 }
Example #3
0
 /**
  * @see PKPTestCase::setUp()
  */
 protected function setUp()
 {
     parent::setUp();
     // Instantiate the plug-in for testing.
     $this->mockRequest();
     PluginRegistry::loadCategory('generic', true, 0);
     $this->lucenePlugin = PluginRegistry::getPlugin('generic', 'luceneplugin');
 }
Example #4
0
 function isTinyMCEInstalled()
 {
     $tinyMCEPlugin =& PluginRegistry::getPlugin('generic', 'TinyMCEPlugin');
     if ($tinyMCEPlugin) {
         return $tinyMCEPlugin->getEnabled();
     }
     return false;
 }
Example #5
0
 /**
  * Display status of deposit(s)
  * @param array $args
  * @param Request $request
  */
 function status($args = array(), &$request)
 {
     $journal =& $request->getJournal();
     $plnPlugin =& PluginRegistry::getPlugin('generic', PLN_PLUGIN_NAME);
     $templateMgr =& TemplateManager::getManager();
     $templateMgr->assign('pageHierarchy', array(array($router->url($request, null, 'about'), 'about.aboutTheJournal')));
     $templateMgr->display($plnPlugin->getTemplatePath() . DIRECTORY_SEPARATOR . 'status.tpl');
 }
 /**
  * @see ScheduledTask::executeActions()
  */
 function executeActions()
 {
     $ofrPlugin =& PluginRegistry::getPlugin('generic', 'objectsforreviewplugin');
     if ($ofrPlugin) {
         $ofrPluginName = $ofrPlugin->getName();
         // Get all journals
         $journalDao =& DAORegistry::getDAO('JournalDAO');
         $journals =& $journalDao->getJournals(true);
         // Register the plugin DAOs and get the others
         $ofrPlugin->registerDAOs();
         $pluginSettingsDao =& DAORegistry::getDAO('PluginSettingsDAO');
         $ofrAssignmentDao =& DAORegistry::getDAO('ObjectForReviewAssignmentDAO');
         // For all journals
         while ($journal =& $journals->next()) {
             $journalId = $journal->getId();
             // If the plugin is enabled
             $pluginEnabled = $pluginSettingsDao->getSetting($journalId, $ofrPluginName, 'enabled');
             if ($pluginEnabled) {
                 // Get plugin reminder settings
                 $enableDueReminderBefore = $pluginSettingsDao->getSetting($journalId, $ofrPluginName, 'enableDueReminderBefore');
                 $enableDueReminderAfter = $pluginSettingsDao->getSetting($journalId, $ofrPluginName, 'enableDueReminderAfter');
                 $beforeDays = $pluginSettingsDao->getSetting($journalId, $ofrPluginName, 'numDaysBeforeDueReminder');
                 $afterDays = $pluginSettingsDao->getSetting($journalId, $ofrPluginName, 'numDaysAfterDueReminder');
                 // If a reminder is set
                 if ($enableDueReminderBefore && $beforeDays > 0 || $enableDueReminderAfter && $afterDays > 0) {
                     // Retrieve all incomplete object for review assignments
                     $incompleteAssignments =& $ofrAssignmentDao->getIncompleteAssignmentsByContextId($journalId);
                     foreach ($incompleteAssignments as $incompleteAssignment) {
                         if ($incompleteAssignment->getDateDue() != null) {
                             $dueDate = strtotime($incompleteAssignment->getDateDue());
                             // Remind before:
                             // If there hasn't been any such reminder, this option is set and due date is in the future
                             if ($incompleteAssignment->getDateRemindedBefore() == null && $enableDueReminderBefore == 1 && time() < $dueDate) {
                                 $nowToDueDate = $dueDate - time();
                                 if ($nowToDueDate < 60 * 60 * 24 * $beforeDays) {
                                     $this->sendReminder($incompleteAssignment, $journal, 'OFR_REVIEW_REMINDER');
                                 }
                             }
                             // Remind after:
                             // If there hasn't been any such reminder, this option is set and due date is in the past
                             if ($incompleteAssignment->getDateRemindedAfter() == null && $enableDueReminderAfter == 1 && time() > $dueDate) {
                                 $dueDateToNow = time() - $dueDate;
                                 if ($dueDateToNow > 60 * 60 * 24 * $afterDays) {
                                     $this->sendReminder($incompleteAssignment, $journal, 'OFR_REVIEW_REMINDER_LATE');
                                 }
                             }
                         }
                     }
                 }
             }
             unset($journal);
         }
         return true;
     } else {
         return false;
     }
 }
Example #7
0
 /**
  * Constructor.
  * @param $argv array command-line arguments
  */
 function CopyAccessLogFileTool($argv = array())
 {
     parent::CommandLineTool($argv);
     if (sizeof($this->argv) !== 1) {
         $this->usage();
         exit(1);
     }
     $plugin =& PluginRegistry::getPlugin('generic', 'usagestatsplugin');
     /* @var $plugin UsageStatsPlugin */
     $this->_usageStatsDir = $plugin->getFilesPath();
     $this->_tmpDir = $this->_usageStatsDir . DIRECTORY_SEPARATOR . 'tmp';
     AppLocale::requireComponents(LOCALE_COMPONENT_PKP_ADMIN);
     // This tool needs egrep and gunzip path configured.
     $this->_egrepPath = escapeshellarg(Config::getVar('cli', 'egrep'));
     if ($this->_egrepPath == "''") {
         printf(__('admin.copyAccessLogFileTool.error.noEgrep') . "\n");
         exit(1);
     }
     $this->_gunzipPath = escapeshellarg(Config::getVar('cli', 'gunzip'));
     if ($this->_gunzipPath == "''") {
         printf(__('admin.copyAccessLogFileTool.error.noGunzip') . "\n");
         exit(1);
     }
     // Get a list of files currently inside the usage stats dir.
     $fileLoaderDirs = array(FILE_LOADER_PATH_STAGING, FILE_LOADER_PATH_PROCESSING, FILE_LOADER_PATH_ARCHIVE, FILE_LOADER_PATH_REJECT);
     $usageStatsFiles = array();
     foreach ($fileLoaderDirs as $dir) {
         $dirFiles = glob($this->_usageStatsDir . DIRECTORY_SEPARATOR . $dir . DIRECTORY_SEPARATOR . '*');
         if (is_array($dirFiles) && count($dirFiles) > 0) {
             foreach ($dirFiles as $file) {
                 if (!is_file($file)) {
                     continue;
                 }
                 $fileBasename = pathinfo($file, PATHINFO_BASENAME);
                 if (pathinfo($file, PATHINFO_EXTENSION) == 'gz') {
                     // Always save the filename without compression extension.
                     $fileBasename = substr($fileBasename, 0, -3);
                 }
                 $usageStatsFiles[] = $fileBasename;
             }
         }
     }
     $this->_usageStatsFiles = $usageStatsFiles;
     // Get a list of context paths.
     $contextDao =& Application::getContextDAO();
     /* @var $contextDao ContextDAO */
     $contextFactory = $contextDao->getAll();
     $contextPaths = array();
     while ($context =& $contextFactory->next()) {
         /* @var $context Context */
         $contextPaths[] = escapeshellarg($context->getPath());
     }
     $contextPaths = implode('/|/', $contextPaths);
     $this->_contextPaths = $contextPaths;
 }
 /**
  * Constructor.
  * @param $argv array task arguments
  */
 function DataciteInfoSender($args)
 {
     PluginRegistry::loadCategory('importexport');
     $plugin =& PluginRegistry::getPlugin('importexport', 'DataciteExportPlugin');
     /* @var $plugin CrossRefExportPlugin */
     $this->_plugin =& $plugin;
     if (is_a($plugin, 'DataciteExportPlugin')) {
         $plugin->addLocaleData();
     }
     parent::ScheduledTask($args);
 }
Example #9
0
 /**
  * Constructor.
  * @param $argv array task arguments
  */
 function MedraInfoSender($args)
 {
     PluginRegistry::loadCategory('importexport');
     $plugin = PluginRegistry::getPlugin('importexport', 'MedraExportPlugin');
     /* @var $plugin MedraExportPlugin */
     $this->_plugin = $plugin;
     if (is_a($plugin, 'MedraExportPlugin')) {
         $plugin->addLocaleData();
     }
     parent::ScheduledTask($args);
 }
Example #10
0
 function &_returnStaticPageFromRow(&$row)
 {
     $staticPagesPlugin =& PluginRegistry::getPlugin('generic', 'StaticPagesPlugin');
     $staticPagesPlugin->import('StaticPage');
     $staticPage = new StaticPage();
     $staticPage->setId($row['static_page_id']);
     $staticPage->setPath($row['path']);
     $staticPage->setConferenceId($row['conference_id']);
     $this->getDataObjectSettings('static_page_settings', 'static_page_id', $row['static_page_id'], $staticPage);
     return $staticPage;
 }
 function &_returnBlogPageFromRow(&$row)
 {
     $blogPagesPlugin =& PluginRegistry::getPlugin('generic', $this->parentPluginName);
     $blogPagesPlugin->import('BlogPage');
     $blogPage = new BlogPage();
     $blogPage->setId($row['blog_page_id']);
     $blogPage->setPath($row['path']);
     $blogPage->setJournalId($row['journal_id']);
     $this->getDataObjectSettings('blog_page_settings', 'blog_page_id', $row['blog_page_id'], $blogPage);
     return $blogPage;
 }
Example #12
0
 /**
  * Constructor.
  * @param $argv array task arguments
  */
 function __construct($args)
 {
     PluginRegistry::loadCategory('importexport');
     $plugin = PluginRegistry::getPlugin('importexport', 'MedraExportPlugin');
     /* @var $plugin MedraExportPlugin */
     $this->_plugin = $plugin;
     if (is_a($plugin, 'MedraExportPlugin')) {
         $plugin->addLocaleData();
     }
     parent::__construct($args);
 }
 /**
  * Constructor.
  * @param $argv array task arguments
  */
 function ArticleInfoSender($args)
 {
     PluginRegistry::loadCategory('generic');
     $plugin =& PluginRegistry::getPlugin('generic', 'almplugin');
     /* @var $plugin AlmPlugin */
     $this->_plugin =& $plugin;
     if (is_a($plugin, 'AlmPlugin')) {
         $plugin->addLocaleData();
         $this->_depositUrl = $plugin->getSetting(CONTEXT_ID_NONE, 'depositUrl');
     }
     parent::ScheduledTask($args);
 }
Example #14
0
 /**
  * @see PKPTestCase::setUp()
  */
 protected function setUp()
 {
     $this->markTestSkipped('Needs fixing.');
     parent::setUp();
     // Instantiate the plug-in for testing.
     $this->mockRequest();
     PluginRegistry::loadCategory('generic', true, 0);
     $this->lucenePlugin = PluginRegistry::getPlugin('generic', 'luceneplugin');
     if (!$this->lucenePlugin) {
         $this->markTestSkipped('Could not fetch Lucene plugin!');
     }
 }
 /**
  * @see Form::execute()
  */
 function execute()
 {
     $ofrPlugin =& PluginRegistry::getPlugin('generic', $this->parentPluginName);
     $ofrPlugin->import('classes.ObjectForReviewAssignment');
     $journal =& Request::getJournal();
     $journalId = $journal->getId();
     $ofrAssignemntDao =& DAORegistry::getDAO('ObjectForReviewAssignmentDAO');
     $ofrAssignment =& $ofrAssignemntDao->getById($this->assignmentId, $this->objectId);
     if (isset($ofrAssignment)) {
         $ofrAssignment->setAgreedToTerms(1);
         $ofrAssignemntDao->updateObject($ofrAssignment);
     }
 }
Example #16
0
 function view($args)
 {
     if (count($args) > 0) {
         $journal =& Request::getJournal();
         $journalId = $journal->getJournalId();
         $cmsPlugin =& PluginRegistry::getPlugin('generic', 'CmsPlugin');
         $templateMgr =& TemplateManager::getManager();
         $allContent = $cmsPlugin->getSetting($journalId, 'content');
         $cmsPlugin->import('ContentManager');
         $contentManager =& new ContentManager();
         $content = array();
         $headings = array();
         $current = $contentManager->cleanurl($args[0]);
         // get the content
         $contentManager->parseContents($headings, $content, $current);
         // silly way to do this, but we have to find all the proper titles
         // and they are not stored anywhere conveniently
         $title = $current;
         $cur_array = explode(":", $current);
         if (count($cur_array) > 1) {
             $cur_array[1] = $cur_array[0] . ':' . $cur_array[1];
         }
         if (count($cur_array) > 2) {
             $cur_array[2] = $cur_array[0] . ':' . $cur_array[1] . ':' . $cur_array[2];
         }
         array_pop($cur_array);
         $breadcrumbs = array();
         foreach ($headings as $heading) {
             if (count($cur_array) > 0 && $cur_array[0] == $heading[1]) {
                 $breadcrumbs[] = array('./' . $heading[1], $heading[2], $heading[2]);
             } elseif (count($cur_array) > 1 && $cur_array[1] == $heading[1]) {
                 $breadcrumbs[] = array('./' . $heading[1], $heading[2], $heading[2]);
             } elseif (count($cur_array) > 2 && $cur_array[2] == $heading[1]) {
                 $breadcrumbs[] = array('./' . $heading[1], $heading[2], $heading[2]);
             }
             if ($heading[1] == $current) {
                 $title = $heading[2];
                 break;
             }
         }
         $theContent = isset($content[$current]) ? $content[$current] : null;
         HookRegistry::call("Plugins::CmsHandler", array($current, &$theContent));
         // and assign the template vars needed
         $templateMgr->assign('title', $title);
         $templateMgr->assign('content', $theContent);
         $templateMgr->assign('headings', $headings);
         $templateMgr->assign('cmsPluginToc', $headings);
         $templateMgr->assign('pageHierarchy', $breadcrumbs);
         $templateMgr->display($cmsPlugin->getTemplatePath() . 'content.tpl');
     }
 }
 /**
  * Internal function to return a BookForReviewAuthor object from a row.
  * @param $row array
  * @return BookForReviewAuthor
  */
 function &_returnAuthorFromRow(&$row)
 {
     $bfrPlugin =& PluginRegistry::getPlugin('generic', $this->parentPluginName);
     $bfrPlugin->import('classes.BookForReviewAuthor');
     $author = new BookForReviewAuthor();
     $author->setId($row['author_id']);
     $author->setBookId($row['book_id']);
     $author->setFirstName($row['first_name']);
     $author->setMiddleName($row['middle_name']);
     $author->setLastName($row['last_name']);
     $author->setSequence($row['seq']);
     HookRegistry::call('BookForReviewAuthorDAO::_returnAuthorFromRow', array(&$author, &$row));
     return $author;
 }
 /**
  * Constructor
  * @param $parentPluginName string Name of parent plugin
  * @param $searchFormElementId int leave as default for new sort order
  */
 function SearchFormElementForm($parentPluginName, $searchFormElementId = null)
 {
     $this->searchFormElementId = isset($searchFormElementId) ? (int) $searchFormElementId : null;
     $plugin =& PluginRegistry::getPlugin('generic', $parentPluginName);
     parent::Form($plugin->getTemplatePath() . 'searchFormElementForm.tpl');
     // Title is required
     $this->addCheck(new FormValidatorLocale($this, 'title', 'required', 'plugins.generic.zendSearch.formElement.title.required'));
     // Symbolic name is required and unique
     $this->addCheck(new FormValidatorCustom($this, 'symbolic', 'required', 'plugins.generic.zendSearch.formElement.symbolic.required', create_function('$symbolic,$form,$searchFormElementDao', 'return !$searchFormElementDao->searchFormElementExistsBySymbolic($symbolic) || ($form->getData(\'oldSymbolic\') != null && $form->getData(\'oldSymbolic\') == $symbolic);'), array(&$this, DAORegistry::getDAO('SearchFormElementDAO'))));
     // Sort order type is valid
     $this->addCheck(new FormValidatorInSet($this, 'type', 'required', 'plugins.generic.zendSearch.formElement.type.required', array_keys(SearchFormElement::getTypeMap())));
     $this->addCheck(new FormValidatorPost($this));
     $this->searchFormElementDao =& DAORegistry::getDAO('SearchFormElementDAO');
     $this->fieldDao =& DAORegistry::getDAO('FieldDAO');
 }
Example #19
0
 /**
  * Import or export data.
  * @param $args array
  * @param $request PKPRequest
  */
 function importexport($args, $request)
 {
     $this->setupTemplate($request, true);
     PluginRegistry::loadCategory(IMPORTEXPORT_PLUGIN_CATEGORY);
     $templateMgr = TemplateManager::getManager($request);
     if (array_shift($args) === 'plugin') {
         $pluginName = array_shift($args);
         $plugin = PluginRegistry::getPlugin(IMPORTEXPORT_PLUGIN_CATEGORY, $pluginName);
         if ($plugin) {
             return $plugin->display($args, $request);
         }
     }
     $templateMgr->assign('plugins', PluginRegistry::getPlugins(IMPORTEXPORT_PLUGIN_CATEGORY));
     $templateMgr->display('manager/importexport/plugins.tpl');
 }
 /**
  * Display terms of use for Dataverse configured for journal.
  * @param array $args
  * @param Request $request
  */
 function termsOfUse($args, &$request)
 {
     $router =& $request->getRouter();
     $journal =& $router->getContext($request);
     $dataversePlugin =& PluginRegistry::getPlugin('generic', DATAVERSE_PLUGIN_NAME);
     $templateMgr =& TemplateManager::getManager();
     if ($dataversePlugin->getSetting($journal->getId(), 'fetchTermsOfUse')) {
         // Try fetching terms of use from DV. If not available, use DV terms cached on last fetch
         $termsOfUse = $dataversePlugin->getTermsOfUse();
         $templateMgr->assign('termsOfUse', $termsOfUse ? $termsOfUse : $this->getSetting($journal->getId(), 'dvTermsOfUse'));
     } else {
         // Get terms of use configured by JM
         $templateMgr->assign('termsOfUse', $dataversePlugin->getSetting($journal->getId(), 'termsOfUse'));
     }
     $templateMgr->display($dataversePlugin->getTemplatePath() . '/termsOfUse.tpl');
 }
Example #21
0
 /**
  * Internal function to return ExternalFeed object from a row.
  * @param $row array
  * @return ExternalFeed
  */
 function &_returnExternalFeedFromRow($row)
 {
     $externalFeedPlugin =& PluginRegistry::getPlugin('generic', $this->parentPluginName);
     $externalFeedPlugin->import('ExternalFeed');
     $externalFeed = new ExternalFeed();
     $externalFeed->setId($row['feed_id']);
     $externalFeed->setJournalId($row['journal_id']);
     $externalFeed->setUrl($row['url']);
     $externalFeed->setSequence($row['seq']);
     $externalFeed->setDisplayHomepage($row['display_homepage']);
     $externalFeed->setDisplayBlock($row['display_block']);
     $externalFeed->setLimitItems($row['limit_items']);
     $externalFeed->setRecentItems($row['recent_items']);
     $this->getDataObjectSettings('external_feed_settings', 'feed_id', $row['feed_id'], $externalFeed);
     return $externalFeed;
 }
 /**
  * Constructor.
  * @param $parentPluginName string Name of parent plugin
  * @param $crosswalkId omit for a new crosswalk
  */
 function CrosswalkForm($parentPluginName, $crosswalkId = null)
 {
     $plugin =& PluginRegistry::getPlugin('generic', $parentPluginName);
     parent::Form($plugin->getTemplatePath() . 'crosswalkForm.tpl');
     $this->crosswalkId = isset($crosswalkId) ? (int) $crosswalkId : null;
     // Validation checks for this form
     $this->addCheck(new FormValidator($this, 'name', 'required', 'admin.crosswalks.form.nameRequired'));
     $this->addCheck(new FormValidator($this, 'description', 'required', 'admin.crosswalks.form.descriptionRequired'));
     $this->addCheck(new FormValidatorPost($this));
     $this->harvesterPlugin = Request::getUserVar('harvesterPlugin');
     if ($crosswalkId) {
         $crosswalkDao =& DAORegistry::getDAO('CrosswalkDAO');
         $this->crosswalk =& $crosswalkDao->getCrosswalkById($this->crosswalkId);
     }
     HookRegistry::call('CrosswalkForm::CrosswalkForm', array(&$this));
 }
 function importexport($args)
 {
     $this->setupTemplate(true);
     PluginRegistry::loadCategory(IMPORTEXPORT_PLUGIN_CATEGORY);
     $templateMgr =& TemplateManager::getManager();
     if (array_shift($args) === 'plugin') {
         $pluginName = array_shift($args);
         $plugin =& PluginRegistry::getPlugin(IMPORTEXPORT_PLUGIN_CATEGORY, $pluginName);
         if ($plugin) {
             return $plugin->display($args);
         }
     }
     $templateMgr->assign_by_ref('plugins', PluginRegistry::getPlugins(IMPORTEXPORT_PLUGIN_CATEGORY));
     $templateMgr->assign('helpTopicId', 'press.managementPages.importExport');
     $templateMgr->display('manager/importexport/plugins.tpl');
 }
 /**
  * Constructor.
  * @param $argv array task arguments
  */
 function PKPUsageStatsLoader($args)
 {
     $plugin = PluginRegistry::getPlugin('generic', 'usagestatsplugin');
     /* @var $plugin UsageStatsPlugin */
     $this->_plugin = $plugin;
     if ($plugin->getSetting(CONTEXT_ID_NONE, 'compressArchives')) {
         $this->setCompressArchives(true);
     }
     $arg = current($args);
     switch ($arg) {
         case 'autoStage':
             if ($plugin->getSetting(0, 'createLogFiles')) {
                 $this->_autoStage = true;
             }
             break;
         case 'externalLogFiles':
             $this->_externalLogFiles = true;
             break;
     }
     // Define the base filesystem path.
     $args[0] = $plugin->getFilesPath();
     parent::FileLoader($args);
     if ($plugin->getEnabled()) {
         // Load the metric type constant.
         PluginRegistry::loadCategory('reports');
         import('classes.statistics.StatisticsHelper');
         $statsHelper = new StatisticsHelper();
         $geoLocationTool = $statsHelper->getGeoLocationTool();
         $this->_geoLocationTool = $geoLocationTool;
         $plugin->import('UsageStatsTemporaryRecordDAO');
         $statsDao = new UsageStatsTemporaryRecordDAO();
         DAORegistry::registerDAO('UsageStatsTemporaryRecordDAO', $statsDao);
         $this->_counterRobotsListFile = $this->_getCounterRobotListFile();
         $contextDao = Application::getContextDAO();
         /* @var $contextDao ContextDAO */
         $contextFactory = $contextDao->getAll();
         /* @var $contextFactory DAOResultFactory */
         $contextsByPath = array();
         while ($context = $contextFactory->next()) {
             /* @var $context Context */
             $contextsByPath[$context->getPath()] = $context;
         }
         $this->_contextsByPath = $contextsByPath;
         $this->checkFolderStructure(true);
     }
 }
 /**
  * Constructor.
  * @param $argv array command-line arguments
  */
 function CopyAccessLogFileTool($argv = array())
 {
     parent::CommandLineTool($argv);
     AppLocale::requireComponents(LOCALE_COMPONENT_OJS_ADMIN);
     if (count($this->argv) < 1 || count($this->argv) > 2) {
         $this->usage();
         exit(1);
     }
     $plugin =& PluginRegistry::getPlugin('generic', 'usagestatsplugin');
     /* @var $plugin UsageStatsPlugin */
     $this->_usageStatsDir = $plugin->getFilesPath();
     $this->_tmpDir = $this->_usageStatsDir . DIRECTORY_SEPARATOR . 'tmp';
     // Get a list of files currently inside the usage stats dir.
     $fileLoaderDirs = array(FILE_LOADER_PATH_STAGING, FILE_LOADER_PATH_PROCESSING, FILE_LOADER_PATH_ARCHIVE, FILE_LOADER_PATH_REJECT);
     $usageStatsFiles = array();
     foreach ($fileLoaderDirs as $dir) {
         $dirFiles = glob($this->_usageStatsDir . DIRECTORY_SEPARATOR . $dir . DIRECTORY_SEPARATOR . '*');
         if (is_array($dirFiles) && count($dirFiles) > 0) {
             foreach ($dirFiles as $file) {
                 if (!is_file($file)) {
                     continue;
                 }
                 $fileBasename = pathinfo($file, PATHINFO_BASENAME);
                 if (pathinfo($file, PATHINFO_EXTENSION) == 'gz') {
                     // Always save the filename without compression extension.
                     $fileBasename = substr($fileBasename, 0, -3);
                 }
                 $usageStatsFiles[] = $fileBasename;
             }
         }
     }
     $this->_usageStatsFiles = $usageStatsFiles;
     // Get a list of journal paths.
     $journalDao =& DAORegistry::getDAO('JournalDAO');
     /* @var $journalDao JournalDAO */
     $journalFactory = $journalDao->getJournals();
     $journalPaths = array();
     while ($journal =& $journalFactory->next()) {
         /* @var $journal Journal */
         $journalPaths[] = escapeshellarg($journal->getPath());
     }
     $journalPaths = implode('/|/', $journalPaths);
     $this->_journalPaths = $journalPaths;
 }
 function index()
 {
     AppLocale::requireComponents(array(LOCALE_COMPONENT_PKP_COMMON, LOCALE_COMPONENT_APPLICATION_COMMON));
     $templateMgr =& TemplateManager::getManager();
     $conference =& Request::getConference();
     $schedConf =& Request::getSchedConf();
     $schedConfId = $schedConf ? $schedConf->getId() : $conference->getId();
     $templateMgr->addStyleSheet(Request::getBaseUrl() . '/plugins/generic/listOfAttendees/listOfAttendees.css');
     $templateMgr->assign('pageHierarchy', array(array(Request::url(null, 'index', 'index'), $conference->getConferenceTitle(), true), array(Request::url(null, null, 'index'), $schedConf->getSchedConfTitle(), true)));
     $templateMgr->assign('title', __('plugins.generic.listOfAttendees.pageTitle'));
     $listOfAttendeesDAO =& DAORegistry::getDAO('ListOfAttendeesDAO');
     $attendees =& $listOfAttendeesDAO->getListOfAttendees($schedConfId);
     $attendees =& $attendees->toArray();
     $templateMgr->assign_by_ref('attendees', $attendees);
     $countryDao =& DAORegistry::getDAO('CountryDAO');
     $countries =& $countryDao->getCountries();
     $templateMgr->assign_by_ref('countries', $countries);
     $listOfAttendeesPlugin =& PluginRegistry::getPlugin('generic', 'ListOfAttendeesPlugin');
     $templateMgr->display($listOfAttendeesPlugin->getTemplatePath() . 'index.tpl');
 }
Example #27
0
 /**
  * Parse and execute the import/export task.
  */
 function execute()
 {
     $plugins = PluginRegistry::loadCategory('importexport');
     if ($this->command === 'list') {
         echo "Available plugins:\n";
         if (empty($plugins)) {
             echo "\t(None)\n";
         } else {
             foreach ($plugins as $plugin) {
                 echo "\t" . $plugin->getName() . "\n";
             }
         }
         return;
     }
     if ($this->command == 'usage' || $this->command == 'help' || $this->command == '' || ($plugin = PluginRegistry::getPlugin('importexport', $this->command)) === null) {
         $this->usage();
         return;
     }
     return $plugin->executeCLI($this->scriptName, $this->parameters);
 }
Example #28
0
 function view($args)
 {
     if (count($args) > 0) {
         Locale::requireComponents(array(LOCALE_COMPONENT_PKP_COMMON, LOCALE_COMPONENT_APPLICATION_COMMON, LOCALE_COMPONENT_PKP_USER));
         $journal =& Request::getJournal();
         $journalId = $journal->getId();
         $path = $args[0];
         $staticPagesPlugin =& PluginRegistry::getPlugin('generic', STATIC_PAGES_PLUGIN_NAME);
         $templateMgr =& TemplateManager::getManager();
         $staticPagesDAO =& DAORegistry::getDAO('StaticPagesDAO');
         $staticPage = $staticPagesDAO->getStaticPageByPath($journalId, $path);
         if (!$staticPage) {
             Request::redirect(null, 'index');
         }
         // and assign the template vars needed
         $templateMgr->assign('title', $staticPage->getStaticPageTitle());
         $templateMgr->assign('content', $staticPage->getStaticPageContent());
         $templateMgr->display($staticPagesPlugin->getTemplatePath() . 'content.tpl');
     }
 }
 /**
  * Constructor.
  * @param $argv array task arguments
  */
 function UsageStatsLoader($args)
 {
     $plugin =& PluginRegistry::getPlugin('generic', 'usagestatsplugin');
     /* @var $plugin UsageStatsPlugin */
     $this->_plugin =& $plugin;
     $arg = current($args);
     switch ($arg) {
         case 'autoStage':
             if ($plugin->getSetting(0, 'createLogFiles')) {
                 $this->_autoStage = true;
             }
             break;
         case 'externalLogFiles':
             $this->_externalLogFiles = true;
             break;
     }
     // Define the base filesystem path.
     $args[0] = $plugin->getFilesPath();
     parent::FileLoader($args);
     if ($plugin->getEnabled()) {
         // Load the metric type constant.
         PluginRegistry::loadCategory('reports');
         $geoLocationTool =& StatisticsHelper::getGeoLocationTool();
         $this->_geoLocationTool =& $geoLocationTool;
         $plugin->import('UsageStatsTemporaryRecordDAO');
         $statsDao = new UsageStatsTemporaryRecordDAO();
         DAORegistry::registerDAO('UsageStatsTemporaryRecordDAO', $statsDao);
         $this->_counterRobotsListFile = $this->_getCounterRobotListFile();
         $journalDao =& DAORegistry::getDAO('JournalDAO');
         /* @var $journalDao JournalDAO */
         $journalFactory =& $journalDao->getJournals();
         /* @var $journalFactory DAOResultFactory */
         $journalsByPath = array();
         while ($journal =& $journalFactory->next()) {
             /* @var $journal Journal */
             $journalsByPath[$journal->getPath()] =& $journal;
         }
         $this->_journalsByPath = $journalsByPath;
         $this->checkFolderStructure(true);
     }
 }
Example #30
0
 /**
  * Sanitize a variable.
  * Removes leading and trailing whitespace, normalizes all characters to UTF-8.
  * @param $var string
  * @return string
  */
 function cleanVar($var)
 {
     // only process strings that are not UTF-8 already
     if (!String::isUTF8($var) && Config::getVar('i18n', 'charset_normalization') == 'On') {
         import('core.Transcoder');
         $tinyMCE = PluginRegistry::getPlugin('generic', 'TinyMCEPlugin');
         if (empty($tinyMCE) || !$tinyMCE->getEnabled()) {
             $var = strtr($var, array("&amp;" => "&", "&quot" => '"', "&lt;" => "<", "&gt;" => ">"));
             // convert string to HTML entities (numeric and named)
             $trans =& new Transcoder('CP1252', 'HTML-ENTITIES');
             $var = $trans->trans($var);
             // convert UTF-8 entities back to UTF-8 characters
             $trans =& new Transcoder('HTML-ENTITIES', 'UTF-8');
             $var = $trans->trans($var);
         } else {
             // convert characters to UTF-8
             $trans =& new Transcoder('CP1252', 'UTF-8');
             $var = $trans->trans($var);
         }
     }
     return trim($var);
 }