/**
  * Save the new image file.
  * @param $request Request.
  */
 function execute($request)
 {
     $temporaryFile = $this->fetchTemporaryFile($request);
     import('classes.file.PublicFileManager');
     $publicFileManager = new PublicFileManager();
     if (is_a($temporaryFile, 'TemporaryFile')) {
         $type = $temporaryFile->getFileType();
         $extension = $publicFileManager->getImageExtension($type);
         if (!$extension) {
             return false;
         }
         $locale = AppLocale::getLocale();
         $uploadName = $this->getFileSettingName() . '_' . $locale . $extension;
         if ($publicFileManager->copyFile($temporaryFile->getFilePath(), $publicFileManager->getSiteFilesPath() . '/' . $uploadName)) {
             // Get image dimensions
             $filePath = $publicFileManager->getSiteFilesPath();
             list($width, $height) = getimagesize($filePath . '/' . $uploadName);
             $site = $request->getSite();
             $siteDao = DAORegistry::getDAO('SiteDAO');
             $value = $site->getSetting($this->getFileSettingName());
             $imageAltText = $this->getData('imageAltText');
             $value[$locale] = array('originalFilename' => $temporaryFile->getOriginalFileName(), 'uploadName' => $uploadName, 'width' => $width, 'height' => $height, 'dateUploaded' => Core::getCurrentDate(), 'altText' => $imageAltText[$locale]);
             $site->updateSetting($this->getFileSettingName(), $value, 'object', true);
             // Clean up the temporary file
             $this->removeTemporaryFile($request);
             return true;
         }
     }
     return false;
 }
 /**
  * Constructor.
  * Initialize template engine and assign basic template variables.
  * @param $request PKPRequest
  */
 function TemplateManager($request)
 {
     parent::PKPTemplateManager($request);
     if (!defined('SESSION_DISABLE_INIT')) {
         /**
          * Kludge to make sure no code that tries to connect to
          * the database is executed (e.g., when loading
          * installer pages).
          */
         $context = $request->getContext();
         $site = $request->getSite();
         $publicFileManager = new PublicFileManager();
         $siteFilesDir = $request->getBaseUrl() . '/' . $publicFileManager->getSiteFilesPath();
         $this->assign('sitePublicFilesDir', $siteFilesDir);
         $this->assign('publicFilesDir', $siteFilesDir);
         // May be overridden by press
         $siteStyleFilename = $publicFileManager->getSiteFilesPath() . '/' . $site->getSiteStyleFilename();
         if (file_exists($siteStyleFilename)) {
             $this->addStyleSheet($request->getBaseUrl() . '/' . $siteStyleFilename, STYLE_SEQUENCE_LAST);
         }
         if (isset($context)) {
             $this->assign('currentPress', $context);
             $this->assign('siteTitle', $context->getLocalizedName());
             $this->assign('publicFilesDir', $request->getBaseUrl() . '/' . $publicFileManager->getContextFilesPath($context->getAssocType(), $context->getId()));
             $this->assign('primaryLocale', $context->getPrimaryLocale());
             $this->assign('alternateLocales', $context->getSetting('alternateLocales'));
             // Assign page header
             $this->assign('displayPageHeaderTitle', $context->getPageHeaderTitle());
             $this->assign('displayPageHeaderLogo', $context->getPageHeaderLogo());
             $this->assign('alternatePageHeader', $context->getLocalizedSetting('pageHeader'));
             $this->assign('metaSearchDescription', $context->getLocalizedSetting('searchDescription'));
             $this->assign('metaSearchKeywords', $context->getLocalizedSetting('searchKeywords'));
             $this->assign('metaCustomHeaders', $context->getLocalizedSetting('customHeaders'));
             $this->assign('numPageLinks', $context->getSetting('numPageLinks'));
             $this->assign('itemsPerPage', $context->getSetting('itemsPerPage'));
             $this->assign('enableAnnouncements', $context->getSetting('enableAnnouncements'));
             // Assign stylesheets and footer
             $contextStyleSheet = $context->getSetting('styleSheet');
             if ($contextStyleSheet) {
                 $this->addStyleSheet($request->getBaseUrl() . '/' . $publicFileManager->getContextFilesPath(ASSOC_TYPE_PRESS, $context->getId()) . '/' . $contextStyleSheet['uploadName'], STYLE_SEQUENCE_LAST);
             }
             // Include footer links if they have been defined.
             $footerCategoryDao = DAORegistry::getDAO('FooterCategoryDAO');
             $footerCategories = $footerCategoryDao->getNotEmptyByContextId($context->getId());
             $this->assign('footerCategories', $footerCategories->toArray());
             $footerLinkDao = DAORegistry::getDAO('FooterLinkDAO');
             $this->assign('maxLinks', $footerLinkDao->getLargestCategoryTotalbyContextId($context->getId()));
             $this->assign('pageFooter', $context->getLocalizedSetting('pageFooter'));
         } else {
             // Add the site-wide logo, if set for this locale or the primary locale
             $displayPageHeaderTitle = $site->getLocalizedPageHeaderTitle();
             $this->assign('displayPageHeaderTitle', $displayPageHeaderTitle);
             if (isset($displayPageHeaderTitle['altText'])) {
                 $this->assign('displayPageHeaderTitleAltText', $displayPageHeaderTitle['altText']);
             }
             $this->assign('siteTitle', $site->getLocalizedTitle());
         }
     }
 }
 function uploadProfileImage()
 {
     import('classes.file.PublicFileManager');
     $fileManager = new PublicFileManager();
     $user =& $this->user;
     $type = $fileManager->getUploadedFileType('profileImage');
     $extension = $fileManager->getImageExtension($type);
     if (!$extension) {
         return false;
     }
     $uploadName = 'profileImage-' . (int) $user->getId() . $extension;
     if (!$fileManager->uploadSiteFile('profileImage', $uploadName)) {
         return false;
     }
     $filePath = $fileManager->getSiteFilesPath();
     list($width, $height) = getimagesize($filePath . '/' . $uploadName);
     if ($width > 150 || $height > 150 || $width <= 0 || $height <= 0) {
         $userSetting = null;
         $user->updateSetting('profileImage', $userSetting);
         $fileManager->removeSiteFile($filePath);
         return false;
     }
     $userSetting = array('name' => $fileManager->getUploadedFileName('profileImage'), 'uploadName' => $uploadName, 'width' => $width, 'height' => $height, 'dateUploaded' => Core::getCurrentDate());
     $user->updateSetting('profileImage', $userSetting);
     return true;
 }
 /**
  * Constructor.
  * Initialize template engine and assign basic template variables.
  * @param $request PKPRequest FIXME: is optional for backwards compatibility only - make mandatory
  */
 function TemplateManager($request = null)
 {
     // FIXME: for backwards compatibility only - remove
     if (!isset($request)) {
         // FIXME: Trigger a deprecation warning when enough instances of this
         // call have been fixed to not clutter the error log.
         $request =& Registry::get('request');
     }
     assert(is_a($request, 'PKPRequest'));
     parent::PKPTemplateManager($request);
     if (!defined('SESSION_DISABLE_INIT')) {
         /**
          * Kludge to make sure no code that tries to connect to
          * the database is executed (e.g., when loading
          * installer pages).
          */
         $site =& $request->getSite();
         $publicFileManager = new PublicFileManager();
         $siteFilesDir = $request->getBaseUrl() . '/' . $publicFileManager->getSiteFilesPath();
         $this->assign('sitePublicFilesDir', $siteFilesDir);
         $this->assign('publicFilesDir', $siteFilesDir);
         $this->assign('isAdmin', Validation::isSiteAdmin());
         // assign an empty home context
         $this->assign('homeContext', array());
         $siteStyleFilename = $publicFileManager->getSiteFilesPath() . '/' . $site->getSiteStyleFilename();
         if (file_exists($siteStyleFilename)) {
             $this->addStyleSheet($request->getBaseUrl() . '/' . $siteStyleFilename);
         }
         // Load and apply theme plugin, if chosen
         $themePluginPath = $site->getSetting('theme');
         if (!empty($themePluginPath)) {
             // Load and activate the theme
             $themePlugin =& PluginRegistry::loadPlugin('themes', $themePluginPath);
             if ($themePlugin) {
                 $themePlugin->activate($this);
             }
         }
         // Add the site-wide logo, if set for this locale or the primary locale
         $this->assign('displayPageHeaderTitle', $site->getLocalizedPageHeaderTitle());
         $customLogo = $site->getSetting('customLogo');
         if ($customLogo) {
             $this->assign('displayPageHeaderLogo', $customLogo);
         }
         $this->assign('siteTitle', $site->getLocalizedTitle());
         $this->assign('enableSubmit', $site->getSetting('enableSubmit'));
     }
 }
 /**
  * Constructor.
  * Initialize template engine and assign basic template variables.
  */
 function TemplateManager()
 {
     parent::PKPTemplateManager();
     if (!defined('SESSION_DISABLE_INIT')) {
         /**
          * Kludge to make sure no code that tries to connect to
          * the database is executed (e.g., when loading
          * installer pages).
          */
         $site =& Request::getSite();
         $siteFilesDir = Request::getBaseUrl() . '/' . PublicFileManager::getSiteFilesPath();
         $this->assign('sitePublicFilesDir', $siteFilesDir);
         $this->assign('publicFilesDir', $siteFilesDir);
         $this->assign('isAdmin', Validation::isSiteAdmin());
         // assign an empty home context
         $this->assign('homeContext', array());
         $siteStyleFilename = PublicFileManager::getSiteFilesPath() . '/' . $site->getSiteStyleFilename();
         if (file_exists($siteStyleFilename)) {
             $this->addStyleSheet(Request::getBaseUrl() . '/' . $siteStyleFilename);
         }
         // Load and apply theme plugin, if chosen
         $themePluginPath = $site->getSetting('theme');
         if (!empty($themePluginPath)) {
             // Load and activate the theme
             $themePlugin =& PluginRegistry::loadPlugin('themes', $themePluginPath);
             if ($themePlugin) {
                 $themePlugin->activate($this);
             }
         }
         // Add the site-wide logo, if set for this locale or the primary locale
         $this->assign('displayPageHeaderTitle', $site->getLocalizedPageHeaderTitle());
         $customLogo = $site->getSetting('customLogo');
         if ($customLogo) {
             $this->assign('useCustomLogo', $customLogo);
         }
         $this->assign('siteTitle', $site->getLocalizedTitle());
         $this->assign('enableSubmit', $site->getSetting('enableSubmit'));
     }
 }
 /**
  * Uploads an image.
  * @param $settingName string setting key associated with the file
  */
 function uploadImage($settingName)
 {
     $site =& Request::getSite();
     $settingsDao = DAORegistry::getDAO('SiteSettingsDAO');
     import('classes.file.PublicFileManager');
     $fileManager = new PublicFileManager();
     if ($fileManager->uploadedFileExists($settingName)) {
         $type = $fileManager->getUploadedFileType($settingName);
         $extension = $fileManager->getImageExtension($type);
         if (!$extension) {
             return false;
         }
         $uploadName = $settingName . $extension;
         if ($fileManager->uploadSiteFile($settingName, $uploadName)) {
             // Get image dimensions
             $filePath = $fileManager->getSiteFilesPath();
             list($width, $height) = getimagesize($filePath . '/' . $settingName . $extension);
             $value = array('name' => $fileManager->getUploadedFileName($settingName), 'uploadName' => $uploadName, 'width' => $width, 'height' => $height, 'dateUploaded' => Core::getCurrentDate());
             return $settingsDao->updateSetting($settingName, $value, 'object');
         }
     }
     return false;
 }
 /**
  * Save the new image file.
  * @param $request Request.
  */
 function execute($request)
 {
     $temporaryFile = $this->fetchTemporaryFile($request);
     import('classes.file.PublicFileManager');
     $publicFileManager = new PublicFileManager();
     if (is_a($temporaryFile, 'TemporaryFile')) {
         $type = $temporaryFile->getFileType();
         if ($type != 'text/plain' && $type != 'text/css') {
             return false;
         }
         $settingName = $this->getFileSettingName();
         $site = $request->getSite();
         $uploadName = $site->getSiteStyleFilename();
         if ($publicFileManager->copyFile($temporaryFile->getFilePath(), $publicFileManager->getSiteFilesPath() . '/' . $uploadName)) {
             $siteDao = DAORegistry::getDAO('SiteDAO');
             $site->setOriginalStyleFilename($temporaryFile->getOriginalFileName());
             $siteDao->updateObject($site);
             // Clean up the temporary file
             $this->removeTemporaryFile($request);
             return true;
         }
     }
     return false;
 }
 /**
  * Constructor.
  * Initialize template engine and assign basic template variables.
  * @param $request PKPRequest FIXME: is optional for backwards compatibility only - make mandatory
  */
 function TemplateManager($request = null)
 {
     parent::PKPTemplateManager($request);
     // Retrieve the router
     $router =& $this->request->getRouter();
     assert(is_a($router, 'PKPRouter'));
     // Are we using implicit authentication?
     $this->assign('implicitAuth', Config::getVar('security', 'implicit_auth'));
     if (!defined('SESSION_DISABLE_INIT')) {
         /**
          * Kludge to make sure no code that tries to connect to
          * the database is executed (e.g., when loading
          * installer pages).
          */
         $journal =& $router->getContext($this->request);
         $site =& $this->request->getSite();
         $publicFileManager = new PublicFileManager();
         $siteFilesDir = $this->request->getBaseUrl() . '/' . $publicFileManager->getSiteFilesPath();
         $this->assign('sitePublicFilesDir', $siteFilesDir);
         $this->assign('publicFilesDir', $siteFilesDir);
         // May be overridden by journal
         $siteStyleFilename = $publicFileManager->getSiteFilesPath() . '/' . $site->getSiteStyleFilename();
         if (file_exists($siteStyleFilename)) {
             $this->addStyleSheet($this->request->getBaseUrl() . '/' . $siteStyleFilename);
         }
         $this->assign('homeContext', array());
         $this->assign('siteCategoriesEnabled', $site->getSetting('categoriesEnabled'));
         if (isset($journal)) {
             $this->assign_by_ref('currentJournal', $journal);
             $journalTitle = $journal->getLocalizedTitle();
             $this->assign('siteTitle', $journalTitle);
             $this->assign('publicFilesDir', $this->request->getBaseUrl() . '/' . $publicFileManager->getJournalFilesPath($journal->getId()));
             $this->assign('primaryLocale', $journal->getPrimaryLocale());
             $this->assign('alternateLocales', $journal->getSetting('alternateLocales'));
             // Assign additional navigation bar items
             $navMenuItems =& $journal->getLocalizedSetting('navItems');
             $this->assign_by_ref('navMenuItems', $navMenuItems);
             // Assign journal page header
             $this->assign('displayPageHeaderTitle', $journal->getLocalizedPageHeaderTitle());
             $this->assign('displayPageHeaderLogo', $journal->getLocalizedPageHeaderLogo());
             $this->assign('displayPageHeaderTitleAltText', $journal->getLocalizedSetting('pageHeaderTitleImageAltText'));
             $this->assign('displayPageHeaderLogoAltText', $journal->getLocalizedSetting('pageHeaderLogoImageAltText'));
             $this->assign('displayFavicon', $journal->getLocalizedFavicon());
             $this->assign('faviconDir', $this->request->getBaseUrl() . '/' . $publicFileManager->getJournalFilesPath($journal->getId()));
             $this->assign('alternatePageHeader', $journal->getLocalizedSetting('journalPageHeader'));
             $this->assign('metaSearchDescription', $journal->getLocalizedSetting('searchDescription'));
             $this->assign('metaSearchKeywords', $journal->getLocalizedSetting('searchKeywords'));
             $this->assign('metaCustomHeaders', $journal->getLocalizedSetting('customHeaders'));
             $this->assign('numPageLinks', $journal->getSetting('numPageLinks'));
             $this->assign('itemsPerPage', $journal->getSetting('itemsPerPage'));
             $this->assign('enableAnnouncements', $journal->getSetting('enableAnnouncements'));
             $this->assign('hideRegisterLink', !$journal->getSetting('allowRegReviewer') && !$journal->getSetting('allowRegReader') && !$journal->getSetting('allowRegAuthor'));
             // Load and apply theme plugin, if chosen
             $themePluginPath = $journal->getSetting('journalTheme');
             if (!empty($themePluginPath)) {
                 // Load and activate the theme
                 $themePlugin =& PluginRegistry::loadPlugin('themes', $themePluginPath);
                 if ($themePlugin) {
                     $themePlugin->activate($this);
                 }
             }
             // Assign stylesheets and footer
             $journalStyleSheet = $journal->getSetting('journalStyleSheet');
             if ($journalStyleSheet) {
                 $this->addStyleSheet($this->request->getBaseUrl() . '/' . $publicFileManager->getJournalFilesPath($journal->getId()) . '/' . $journalStyleSheet['uploadName']);
             }
             import('classes.payment.ojs.OJSPaymentManager');
             $paymentManager = new OJSPaymentManager($this->request);
             $this->assign('journalPaymentsEnabled', $paymentManager->isConfigured());
             $this->assign('pageFooter', $journal->getLocalizedSetting('journalPageFooter'));
         } else {
             // Add the site-wide logo, if set for this locale or the primary locale
             $displayPageHeaderTitle = $site->getLocalizedPageHeaderTitle();
             $this->assign('displayPageHeaderTitle', $displayPageHeaderTitle);
             if (isset($displayPageHeaderTitle['altText'])) {
                 $this->assign('displayPageHeaderTitleAltText', $displayPageHeaderTitle['altText']);
             }
             $this->assign('siteTitle', $site->getLocalizedTitle());
             // Load and apply theme plugin, if chosen
             $themePluginPath = $site->getSetting('siteTheme');
             if (!empty($themePluginPath)) {
                 // Load and activate the theme
                 $themePlugin =& PluginRegistry::loadPlugin('themes', $themePluginPath);
                 if ($themePlugin) {
                     $themePlugin->activate($this);
                 }
             }
         }
         if (!$site->getRedirect()) {
             $this->assign('hasOtherJournals', true);
         }
         // Add java script for notifications
         $user =& $this->request->getUser();
         if ($user) {
             $this->addJavaScript('lib/pkp/js/lib/jquery/plugins/jquery.pnotify.js');
         }
     }
 }
 function _handleOjsUrl($matchArray)
 {
     $request = Application::getRequest();
     $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 '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];
 }
 /**
  * Decompress uploaded plugin and install in the correct plugin directory.
  * @param $function string type of operation to perform after upload ('upgrade' or 'install')
  * @param $category string the category of the uploaded plugin (upgrade only)
  * @param $plugin string the name of the uploaded plugin (upgrade only)
  */
 function uploadPlugin($function, $category = null, $plugin = null)
 {
     $this->validate();
     $templateMgr =& TemplateManager::getManager();
     $this->setupTemplate(true);
     $templateMgr->assign('error', false);
     $templateMgr->assign('uploaded', false);
     $templateMgr->assign('path', $function);
     $errorMsg = '';
     if (Request::getUserVar('uploadPlugin')) {
         import('classes.file.PublicFileManager');
         $publicFileManager = new PublicFileManager();
         $pluginFile = Core::getBaseDir() . DIRECTORY_SEPARATOR . $publicFileManager->getSiteFilesPath() . DIRECTORY_SEPARATOR . $_FILES['newPlugin']['name'];
         // tar archive basename (less potential version number) must equal plugin directory name
         // and plugin files must be in a directory named after the plug-in.
         $matches = array();
         String::regexp_match_get('/^[a-zA-Z0-9]+/', basename($pluginFile, '.tar.gz'), $matches);
         $pluginName = array_pop($matches);
     } else {
         $errorMsg = 'manager.plugins.fileSelectError';
     }
     if (empty($errorMsg)) {
         if ($publicFileManager->uploadSiteFile('newPlugin', basename($pluginFile))) {
             // Create random dirname to avoid symlink attacks.
             $pluginDir = Core::getBaseDir() . DIRECTORY_SEPARATOR . $publicFileManager->getSiteFilesPath() . DIRECTORY_SEPARATOR . $pluginName . substr(md5(mt_rand()), 0, 10);
             mkdir($pluginDir);
         } else {
             $errorMsg = 'manager.plugins.uploadError';
         }
     }
     if (empty($errorMsg)) {
         // Test whether the tar binary is available for the export to work
         $tarBinary = Config::getVar('cli', 'tar');
         if (!empty($tarBinary) && file_exists($tarBinary)) {
             exec($tarBinary . ' -xzf ' . escapeshellarg($pluginFile) . ' -C ' . escapeshellarg($pluginDir));
         } else {
             $errorMsg = 'manager.plugins.tarCommandNotFound';
         }
     }
     if (empty($errorMsg)) {
         // We should now find a directory named after the
         // plug-in within the extracted archive.
         $pluginDir .= DIRECTORY_SEPARATOR . $pluginName;
         if (is_dir($pluginDir)) {
             if ($function == 'install') {
                 $this->installPlugin($pluginDir, $templateMgr);
             } else {
                 if ($function == 'upgrade') {
                     $this->upgradePlugin($pluginDir, $templateMgr, $category, $plugin);
                 }
             }
             $publicFileManager->removeSiteFile(basename($pluginFile));
         } else {
             $errorMsg = 'manager.plugins.invalidPluginArchive';
         }
     }
     if (!empty($errorMsg)) {
         $templateMgr->assign('error', true);
         $templateMgr->assign('message', $errorMsg);
     }
     $templateMgr->display('admin/managePlugins.tpl');
 }
Exemple #11
0
 /**
  * Constructor.
  * Initialize template engine and assign basic template variables.
  */
 function TemplateManager()
 {
     parent::PKPTemplateManager();
     // Are we using implicit authentication?
     $this->assign('implicitAuth', Config::getVar('security', 'implicit_auth'));
     if (!defined('SESSION_DISABLE_INIT')) {
         /**
          * Kludge to make sure no code that tries to connect to
          * the database is executed (e.g., when loading
          * installer pages).
          */
         $journal =& Request::getJournal();
         $site =& Request::getSite();
         $siteFilesDir = Request::getBaseUrl() . '/' . PublicFileManager::getSiteFilesPath();
         $this->assign('sitePublicFilesDir', $siteFilesDir);
         $this->assign('publicFilesDir', $siteFilesDir);
         // May be overridden by journal
         $siteStyleFilename = PublicFileManager::getSiteFilesPath() . '/' . $site->getSiteStyleFilename();
         if (file_exists($siteStyleFilename)) {
             $this->addStyleSheet(Request::getBaseUrl() . '/' . $siteStyleFilename);
         }
         if (isset($journal)) {
             $this->assign_by_ref('currentJournal', $journal);
             $journalTitle = $journal->getJournalTitle();
             $this->assign('siteTitle', $journalTitle);
             $this->assign('publicFilesDir', Request::getBaseUrl() . '/' . PublicFileManager::getJournalFilesPath($journal->getJournalId()));
             $this->assign('primaryLocale', $journal->getPrimaryLocale());
             $this->assign('alternateLocales', $journal->getSetting('alternateLocales'));
             // Assign additional navigation bar items
             $navMenuItems =& $journal->getLocalizedSetting('navItems');
             $this->assign_by_ref('navMenuItems', $navMenuItems);
             // Assign journal page header
             $this->assign('displayPageHeaderTitle', $journal->getJournalPageHeaderTitle());
             $this->assign('displayPageHeaderLogo', $journal->getJournalPageHeaderLogo());
             $this->assign('alternatePageHeader', $journal->getLocalizedSetting('journalPageHeader'));
             $this->assign('metaSearchDescription', $journal->getLocalizedSetting('searchDescription'));
             $this->assign('metaSearchKeywords', $journal->getLocalizedSetting('searchKeywords'));
             $this->assign('metaCustomHeaders', $journal->getLocalizedSetting('customHeaders'));
             $this->assign('numPageLinks', $journal->getSetting('numPageLinks'));
             $this->assign('itemsPerPage', $journal->getSetting('itemsPerPage'));
             $this->assign('enableAnnouncements', $journal->getSetting('enableAnnouncements'));
             // Load and apply theme plugin, if chosen
             $themePluginPath = $journal->getSetting('journalTheme');
             if (!empty($themePluginPath)) {
                 // Load and activate the theme
                 $themePlugin =& PluginRegistry::loadPlugin('themes', $themePluginPath);
                 if ($themePlugin) {
                     $themePlugin->activate($this);
                 }
             }
             // Assign stylesheets and footer
             $journalStyleSheet = $journal->getSetting('journalStyleSheet');
             if ($journalStyleSheet) {
                 $this->addStyleSheet(Request::getBaseUrl() . '/' . PublicFileManager::getJournalFilesPath($journal->getJournalId()) . '/' . $journalStyleSheet['uploadName']);
             }
             import('payment.ojs.OJSPaymentManager');
             $paymentManager =& OJSPaymentManager::getManager();
             $this->assign('journalPaymentsEnabled', $paymentManager->isConfigured());
             $this->assign('pageFooter', $journal->getLocalizedSetting('journalPageFooter'));
         } else {
             // Add the site-wide logo, if set for this locale or the primary locale
             $this->assign('displayPageHeaderTitle', $site->getSitePageHeaderTitle());
             $this->assign('siteTitle', $site->getSiteTitle());
         }
         if (!$site->getRedirect()) {
             $this->assign('hasOtherJournals', true);
         }
     }
 }
 /**
  * Constructor.
  * Initialize template engine and assign basic template variables.
  * @param $request PKPRequest FIXME: is optional for backwards compatibility only - make mandatory
  */
 function TemplateManager($request = null)
 {
     // FIXME: for backwards compatibility only - remove
     if (!isset($request)) {
         // FIXME: Trigger a deprecation warning when enough instances of this
         // call have been fixed to not clutter the error log.
         $request =& Registry::get('request');
     }
     assert(is_a($request, 'PKPRequest'));
     parent::PKPTemplateManager($request);
     // Retrieve the router
     $router =& $request->getRouter();
     assert(is_a($router, 'PKPRouter'));
     // Are we using implicit authentication?
     $this->assign('implicitAuth', Config::getVar('security', 'implicit_auth'));
     if (!defined('SESSION_DISABLE_INIT')) {
         /**
          * Kludge to make sure no code that tries to connect to
          * the database is executed (e.g., when loading
          * installer pages).
          */
         $press =& $router->getContext($request);
         $site =& $request->getSite();
         $siteFilesDir = $request->getBaseUrl() . '/' . PublicFileManager::getSiteFilesPath();
         $this->assign('sitePublicFilesDir', $siteFilesDir);
         $this->assign('publicFilesDir', $siteFilesDir);
         // May be overridden by press
         $siteStyleFilename = PublicFileManager::getSiteFilesPath() . '/' . $site->getSiteStyleFilename();
         if (file_exists($siteStyleFilename)) {
             $this->addStyleSheet($request->getBaseUrl() . '/' . $siteStyleFilename);
         }
         $this->assign('homeContext', array());
         if (isset($press)) {
             $this->assign_by_ref('currentPress', $press);
             $pressTitle = $press->getLocalizedName();
             $this->assign('siteTitle', $pressTitle);
             $this->assign('publicFilesDir', $request->getBaseUrl() . '/' . PublicFileManager::getPressFilesPath($press->getId()));
             $this->assign('primaryLocale', $press->getPrimaryLocale());
             $this->assign('alternateLocales', $press->getSetting('alternateLocales'));
             // Assign additional navigation bar items
             $navMenuItems =& $press->getLocalizedSetting('navItems');
             $this->assign_by_ref('navMenuItems', $navMenuItems);
             // Assign press page header
             $this->assign('displayPageHeaderTitle', $press->getPressPageHeaderTitle());
             $this->assign('displayPageHeaderLogo', $press->getPressPageHeaderLogo());
             $this->assign('alternatePageHeader', $press->getLocalizedSetting('pressPageHeader'));
             $this->assign('metaSearchDescription', $press->getLocalizedSetting('searchDescription'));
             $this->assign('metaSearchKeywords', $press->getLocalizedSetting('searchKeywords'));
             $this->assign('metaCustomHeaders', $press->getLocalizedSetting('customHeaders'));
             $this->assign('numPageLinks', $press->getSetting('numPageLinks'));
             $this->assign('itemsPerPage', $press->getSetting('itemsPerPage'));
             $this->assign('enableAnnouncements', $press->getSetting('enableAnnouncements'));
             // Load and apply theme plugin, if chosen
             $themePluginPath = $press->getSetting('pressTheme');
             if (!empty($themePluginPath)) {
                 // Load and activate the theme
                 $themePlugin =& PluginRegistry::loadPlugin('themes', $themePluginPath);
                 if ($themePlugin) {
                     $themePlugin->activate($this);
                 }
             }
             // Assign stylesheets and footer
             $pressStyleSheet = $press->getSetting('pressStyleSheet');
             if ($pressStyleSheet) {
                 $this->addStyleSheet($request->getBaseUrl() . '/' . PublicFileManager::getPressFilesPath($press->getId()) . '/' . $pressStyleSheet['uploadName']);
             }
             $this->assign('pageFooter', $press->getLocalizedSetting('pressPageFooter'));
         } else {
             // Add the site-wide logo, if set for this locale or the primary locale
             $displayPageHeaderTitle = $site->getLocalizedPageHeaderTitle();
             $this->assign('displayPageHeaderTitle', $displayPageHeaderTitle);
             if (isset($displayPageHeaderTitle['altText'])) {
                 $this->assign('displayPageHeaderTitleAltText', $displayPageHeaderTitle['altText']);
             }
             $this->assign('siteTitle', $site->getLocalizedTitle());
         }
         if (!$site->getRedirect()) {
             $this->assign('hasOtherPresses', true);
         }
     }
 }
Exemple #13
0
 /**
  * Constructor.
  * Initialize template engine and assign basic template variables.
  * @param $request PKPRequest
  */
 function TemplateManager($request)
 {
     parent::PKPTemplateManager($request);
     if (!defined('SESSION_DISABLE_INIT')) {
         /**
          * Kludge to make sure no code that tries to connect to
          * the database is executed (e.g., when loading
          * installer pages).
          */
         $context = $request->getContext();
         $site = $request->getSite();
         $publicFileManager = new PublicFileManager();
         $siteFilesDir = $request->getBaseUrl() . '/' . $publicFileManager->getSiteFilesPath();
         $this->assign('sitePublicFilesDir', $siteFilesDir);
         $this->assign('publicFilesDir', $siteFilesDir);
         // May be overridden by journal
         $siteStyleFilename = $publicFileManager->getSiteFilesPath() . '/' . $site->getSiteStyleFilename();
         if (file_exists($siteStyleFilename)) {
             $this->addStyleSheet($request->getBaseUrl() . '/' . $siteStyleFilename, STYLE_SEQUENCE_LAST);
         }
         $this->assign('siteCategoriesEnabled', $site->getSetting('categoriesEnabled'));
         if (isset($context)) {
             $this->assign('currentJournal', $context);
             $this->assign('siteTitle', $context->getLocalizedName());
             $this->assign('publicFilesDir', $request->getBaseUrl() . '/' . $publicFileManager->getJournalFilesPath($context->getId()));
             $this->assign('primaryLocale', $context->getPrimaryLocale());
             $this->assign('alternateLocales', $context->getSetting('alternateLocales'));
             // Assign page header
             $this->assign('displayPageHeaderTitle', $context->getLocalizedPageHeaderTitle());
             $this->assign('displayPageHeaderLogo', $context->getLocalizedPageHeaderLogo());
             $this->assign('displayPageHeaderLogoAltText', $context->getLocalizedSetting('pageHeaderLogoImageAltText'));
             $this->assign('displayFavicon', $context->getLocalizedFavicon());
             $this->assign('faviconDir', $request->getBaseUrl() . '/' . $publicFileManager->getJournalFilesPath($context->getId()));
             $this->assign('metaSearchDescription', $context->getLocalizedSetting('searchDescription'));
             $this->assign('metaSearchKeywords', $context->getLocalizedSetting('searchKeywords'));
             $this->assign('metaCustomHeaders', $context->getLocalizedSetting('customHeaders'));
             $this->assign('numPageLinks', $context->getSetting('numPageLinks'));
             $this->assign('itemsPerPage', $context->getSetting('itemsPerPage'));
             $this->assign('enableAnnouncements', $context->getSetting('enableAnnouncements'));
             $this->assign('contextSettings', $context->getSettingsDAO()->getSettings($context->getId()));
             // Assign stylesheets and footer
             $contextStyleSheet = $context->getSetting('journalStyleSheet');
             if ($contextStyleSheet) {
                 $this->addStyleSheet($request->getBaseUrl() . '/' . $publicFileManager->getJournalFilesPath($context->getId()) . '/' . $contextStyleSheet['uploadName'], STYLE_SEQUENCE_LAST);
             }
             // Get a link to the settings page for the current context.
             // This allows us to reduce template duplication by using this
             // variable in templates/common/header.tpl, instead of
             // reproducing a lot of OMP/OJS-specific logic there.
             $router = $request->getRouter();
             $dispatcher = $request->getDispatcher();
             $this->assign('contextSettingsUrl', $dispatcher->url($request, ROUTE_PAGE, null, 'management', 'settings', 'journal'));
             import('classes.payment.ojs.OJSPaymentManager');
             $paymentManager = new OJSPaymentManager($request);
             $this->assign('journalPaymentsEnabled', $paymentManager->isConfigured());
             $this->assign('pageFooter', $context->getLocalizedSetting('journalPageFooter'));
         } else {
             // Add the site-wide logo, if set for this locale or the primary locale
             $displayPageHeaderTitle = $site->getLocalizedPageHeaderTitle();
             $this->assign('displayPageHeaderTitle', $displayPageHeaderTitle);
             if (isset($displayPageHeaderTitle['altText'])) {
                 $this->assign('displayPageHeaderTitleAltText', $displayPageHeaderTitle['altText']);
             }
             $this->assign('siteTitle', $site->getLocalizedTitle());
             $this->assign('primaryLocale', $site->getPrimaryLocale());
         }
     }
 }
 /**
  * Fetch the form.
  * @param $request PKPRequest
  * @return string JSON-encoded form contents.
  */
 function fetch($request)
 {
     $templateMgr = TemplateManager::getManager($request);
     $publicFileManager = new PublicFileManager();
     $templateMgr->assign(array('profileImage' => $request->getUser()->getSetting('profileImage'), 'profileImageMaxWidth' => PROFILE_IMAGE_MAX_WIDTH, 'profileImageMaxHeight' => PROFILE_IMAGE_MAX_HEIGHT, 'publicSiteFilesPath' => $publicFileManager->getSiteFilesPath()));
     return parent::fetch($request);
 }
 function _handleOmpUrl($matchArray)
 {
     $request = Application::getRequest();
     $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 'press':
                 $url = $request->url(isset($urlParts[1]) ? $urlParts[1] : $request->getRequestedPressPath(), null, null, null, null, $anchor);
                 break;
             case 'monograph':
                 if (isset($urlParts[1])) {
                     $url = $request->url(null, 'catalog', 'book', $urlParts[1], 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);
                 $press = $request->getPress();
                 import('classes.file.PublicFileManager');
                 $publicFileManager = new PublicFileManager();
                 $url = $request->getBaseUrl() . '/' . $publicFileManager->getPressFilesPath($press->getId()) . '/' . implode('/', $urlParts) . ($anchor ? '#' . $anchor : '');
                 break;
         }
     }
     return $matchArray[1] . $url . $matchArray[3];
 }
 /**
  * Constructor.
  * Initialize template engine and assign basic template variables.
  */
 function TemplateManager()
 {
     parent::Smarty();
     import('file.PublicFileManager');
     import('cache.CacheManager');
     // Set up Smarty configuration
     $baseDir = Core::getBaseDir();
     $cachePath = CacheManager::getFileCachePath();
     $this->template_dir = $baseDir . DIRECTORY_SEPARATOR . 'templates';
     $this->compile_dir = $cachePath . DIRECTORY_SEPARATOR . 't_compile';
     $this->config_dir = $cachePath . DIRECTORY_SEPARATOR . 't_config';
     $this->cache_dir = $cachePath . DIRECTORY_SEPARATOR . 't_cache';
     // Assign common variables
     $this->styleSheets = array();
     $this->assign_by_ref('stylesheets', $this->styleSheets);
     $this->cacheability = CACHEABILITY_NO_STORE;
     // Safe default
     $this->assign('defaultCharset', Config::getVar('i18n', 'client_charset'));
     $this->assign('baseUrl', Request::getBaseUrl());
     $this->assign('pageTitle', 'common.openJournalSystems');
     $this->assign('requestedPage', Request::getRequestedPage());
     $this->assign('currentUrl', Request::getCompleteUrl());
     $this->assign('dateFormatTrunc', Config::getVar('general', 'date_format_trunc'));
     $this->assign('dateFormatShort', Config::getVar('general', 'date_format_short'));
     $this->assign('dateFormatLong', Config::getVar('general', 'date_format_long'));
     $this->assign('datetimeFormatShort', Config::getVar('general', 'datetime_format_short'));
     $this->assign('datetimeFormatLong', Config::getVar('general', 'datetime_format_long'));
     // Are we using implicit authentication?
     $this->assign('implicitAuth', Config::getVar('security', 'implicit_auth'));
     $locale = Locale::getLocale();
     $this->assign('currentLocale', $locale);
     if (!defined('SESSION_DISABLE_INIT')) {
         /* Kludge to make sure no code that tries to connect to the database is executed
          * (e.g., when loading installer pages). */
         $this->assign('isUserLoggedIn', Validation::isLoggedIn());
         $journal =& Request::getJournal();
         $site =& Request::getSite();
         $versionDAO =& DAORegistry::getDAO('VersionDAO');
         $currentVersion = $versionDAO->getCurrentVersion();
         $this->assign('currentVersionString', $currentVersion->getVersionString());
         $siteFilesDir = Request::getBaseUrl() . '/' . PublicFileManager::getSiteFilesPath();
         $this->assign('sitePublicFilesDir', $siteFilesDir);
         $this->assign('publicFilesDir', $siteFilesDir);
         // May be overridden by journal
         $siteStyleFilename = PublicFileManager::getSiteFilesPath() . '/' . $site->getSiteStyleFilename();
         if (file_exists($siteStyleFilename)) {
             $this->addStyleSheet(Request::getBaseUrl() . '/' . $siteStyleFilename);
         }
         if (isset($journal)) {
             $this->assign_by_ref('currentJournal', $journal);
             $journalTitle = $journal->getJournalTitle();
             $this->assign('siteTitle', $journalTitle);
             $this->assign('publicFilesDir', Request::getBaseUrl() . '/' . PublicFileManager::getJournalFilesPath($journal->getJournalId()));
             $this->assign('primaryLocale', $journal->getPrimaryLocale());
             $this->assign('alternateLocales', $journal->getSetting('alternateLocales'));
             // Assign additional navigation bar items
             $navMenuItems =& $journal->getLocalizedSetting('navItems');
             $this->assign_by_ref('navMenuItems', $navMenuItems);
             // Assign journal page header
             $this->assign('displayPageHeaderTitle', $journal->getJournalPageHeaderTitle());
             $this->assign('displayPageHeaderLogo', $journal->getJournalPageHeaderLogo());
             $this->assign('alternatePageHeader', $journal->getLocalizedSetting('journalPageHeader'));
             $this->assign('metaSearchDescription', $journal->getLocalizedSetting('searchDescription'));
             $this->assign('metaSearchKeywords', $journal->getLocalizedSetting('searchKeywords'));
             $this->assign('metaCustomHeaders', $journal->getLocalizedSetting('customHeaders'));
             $this->assign('numPageLinks', $journal->getSetting('numPageLinks'));
             $this->assign('itemsPerPage', $journal->getSetting('itemsPerPage'));
             $this->assign('enableAnnouncements', $journal->getSetting('enableAnnouncements'));
             // Load and apply theme plugin, if chosen
             $themePluginPath = $journal->getSetting('journalTheme');
             if (!empty($themePluginPath)) {
                 // Load and activate the theme
                 $themePlugin =& PluginRegistry::loadPlugin('themes', $themePluginPath);
                 if ($themePlugin) {
                     $themePlugin->activate($this);
                 }
             }
             // Assign stylesheets and footer
             $journalStyleSheet = $journal->getSetting('journalStyleSheet');
             if ($journalStyleSheet) {
                 $this->addStyleSheet(Request::getBaseUrl() . '/' . PublicFileManager::getJournalFilesPath($journal->getJournalId()) . '/' . $journalStyleSheet['uploadName']);
             }
             import('payment.ojs.OJSPaymentManager');
             $paymentManager =& OJSPaymentManager::getManager();
             $this->assign('journalPaymentsEnabled', $paymentManager->isConfigured());
             $this->assign('pageFooter', $journal->getLocalizedSetting('journalPageFooter'));
         } else {
             // Add the site-wide logo, if set for this locale or the primary locale
             $this->assign('displayPageHeaderTitle', $site->getSitePageHeaderTitle());
             $this->assign('siteTitle', $site->getSiteTitle());
             $this->assign('itemsPerPage', Config::getVar('interface', 'items_per_page'));
             $this->assign('numPageLinks', Config::getVar('interface', 'page_links'));
         }
         if (!$site->getJournalRedirect()) {
             $this->assign('hasOtherJournals', true);
         }
     }
     // If there's a locale-specific stylesheet, add it.
     if (($localeStyleSheet = Locale::getLocaleStyleSheet($locale)) != null) {
         $this->addStyleSheet(Request::getBaseUrl() . '/' . $localeStyleSheet);
     }
     // Register custom functions
     $this->register_modifier('translate', array('Locale', 'translate'));
     $this->register_modifier('strip_unsafe_html', array('String', 'stripUnsafeHtml'));
     $this->register_modifier('String_substr', array('String', 'substr'));
     $this->register_modifier('to_array', array(&$this, 'smartyToArray'));
     $this->register_modifier('escape', array(&$this, 'smartyEscape'));
     $this->register_modifier('explode', array(&$this, 'smartyExplode'));
     $this->register_modifier('assign', array(&$this, 'smartyAssign'));
     $this->register_function('translate', array(&$this, 'smartyTranslate'));
     $this->register_function('flush', array(&$this, 'smartyFlush'));
     $this->register_function('call_hook', array(&$this, 'smartyCallHook'));
     $this->register_function('html_options_translate', array(&$this, 'smartyHtmlOptionsTranslate'));
     $this->register_block('iterate', array(&$this, 'smartyIterate'));
     $this->register_function('call_progress_function', array(&$this, 'smartyCallProgressFunction'));
     $this->register_function('page_links', array(&$this, 'smartyPageLinks'));
     $this->register_function('page_info', array(&$this, 'smartyPageInfo'));
     $this->register_function('get_help_id', array(&$this, 'smartyGetHelpId'));
     $this->register_function('icon', array(&$this, 'smartyIcon'));
     $this->register_function('help_topic', array(&$this, 'smartyHelpTopic'));
     $this->register_function('get_debug_info', array(&$this, 'smartyGetDebugInfo'));
     $this->register_function('assign_mailto', array(&$this, 'smartyAssignMailto'));
     $this->register_function('display_template', array(&$this, 'smartyDisplayTemplate'));
     $this->register_function('url', array(&$this, 'smartyUrl'));
     $this->initialized = false;
 }
 /**
  * Decompress uploaded plugin and install in the correct plugin directory.
  * $param function string type of operation to perform after upload ('upgrade' or 'install')
  */
 function uploadPlugin($function)
 {
     $templateMgr =& TemplateManager::getManager();
     $this->setupTemplate(true);
     $templateMgr->assign('error', false);
     $templateMgr->assign('uploaded', false);
     $templateMgr->assign('path', $function);
     $templateMgr->assign('pageHierarchy', PluginManagementHandler::setBreadcrumbs(true));
     if (Request::getUserVar('uploadPlugin')) {
         import('file.PublicFileManager');
         $publicFileManager = new PublicFileManager();
         $pluginFile = $_FILES['newPlugin']['name'];
         $pluginName = basename($pluginFile, '.tar.gz');
         if ($publicFileManager->uploadSiteFile('newPlugin', $pluginFile)) {
             // tar archive basename must equal plugin directory name, and plugin files must be in root directory
             $pluginDir = Core::getBaseDir() . DIRECTORY_SEPARATOR . $publicFileManager->getSiteFilesPath();
             exec('tar -xzf ' . escapeshellarg($pluginDir . DIRECTORY_SEPARATOR . $pluginFile) . ' -C ' . escapeshellarg($pluginDir));
             if ($function == 'install') {
                 PluginManagementHandler::installPlugin($pluginDir . DIRECTORY_SEPARATOR . $pluginName, $templateMgr);
             } else {
                 if ($function == 'upgrade') {
                     PluginManagementHandler::upgradePlugin($pluginDir . DIRECTORY_SEPARATOR . $pluginName, $templateMgr);
                 }
             }
             $publicFileManager->removeSiteFile($pluginFile);
         } else {
             $templateMgr->assign('error', true);
             $templateMgr->assign('message', 'manager.plugins.uploadError');
         }
     } else {
         if (Request::getUserVar('installPlugin')) {
             if (Request::getUserVar('pluginUploadLocation') == '') {
                 $templateMgr->assign('error', true);
                 $templateMgr->assign('message', 'manager.plugins.fileSelectError');
             }
         }
     }
     $templateMgr->display('admin/managePlugins.tpl');
 }
Exemple #18
0
 /**
  * Constructor.
  * Initialize template engine and assign basic template variables.
  * @param $request PKPRequest
  */
 function __construct($request)
 {
     parent::__construct($request);
     AppLocale::requireComponents(LOCALE_COMPONENT_APP_COMMON);
     if (!defined('SESSION_DISABLE_INIT')) {
         /**
          * Kludge to make sure no code that tries to connect to
          * the database is executed (e.g., when loading
          * installer pages).
          */
         $context = $request->getContext();
         $site = $request->getSite();
         $publicFileManager = new PublicFileManager();
         $siteFilesDir = $request->getBaseUrl() . '/' . $publicFileManager->getSiteFilesPath();
         $this->assign('sitePublicFilesDir', $siteFilesDir);
         $this->assign('publicFilesDir', $siteFilesDir);
         // May be overridden by press
         $siteStyleFilename = $publicFileManager->getSiteFilesPath() . '/' . $site->getSiteStyleFilename();
         if (file_exists($siteStyleFilename)) {
             $this->addStyleSheet('siteStylesheet', $request->getBaseUrl() . '/' . $siteStyleFilename, array('priority' => STYLE_SEQUENCE_LAST));
         }
         // Pass app-specific details to template
         $this->assign(array('brandImage' => 'templates/images/omp_brand.png', 'packageKey' => 'common.openMonographPress', 'pkpLink' => 'http://pkp.sfu.ca/omp'));
         // Get a count of unread tasks.
         if ($user = $request->getUser()) {
             $notificationDao = DAORegistry::getDAO('NotificationDAO');
             // Exclude certain tasks, defined in the notifications grid handler
             import('lib.pkp.controllers.grid.notifications.TaskNotificationsGridHandler');
             $this->assign('unreadNotificationCount', $notificationDao->getNotificationCount(false, $user->getId(), null, NOTIFICATION_LEVEL_TASK));
         }
         if (isset($context)) {
             $this->assign('currentPress', $context);
             $this->assign('siteTitle', $context->getLocalizedName());
             $this->assign('publicFilesDir', $request->getBaseUrl() . '/' . $publicFileManager->getContextFilesPath($context->getAssocType(), $context->getId()));
             $this->assign('primaryLocale', $context->getPrimaryLocale());
             $this->assign('supportedLocales', $context->getSupportedLocaleNames());
             // Assign page header
             $this->assign('displayPageHeaderTitle', $context->getPageHeaderTitle());
             $this->assign('displayPageHeaderLogo', $context->getPageHeaderLogo());
             $this->assign('numPageLinks', $context->getSetting('numPageLinks'));
             $this->assign('itemsPerPage', $context->getSetting('itemsPerPage'));
             $this->assign('enableAnnouncements', $context->getSetting('enableAnnouncements'));
             $this->assign('disableUserReg', $context->getSetting('disableUserReg'));
             // Assign stylesheets and footer
             $contextStyleSheet = $context->getSetting('styleSheet');
             if ($contextStyleSheet) {
                 $this->addStyleSheet('contextStylesheet', $request->getBaseUrl() . '/' . $publicFileManager->getContextFilesPath(ASSOC_TYPE_PRESS, $context->getId()) . '/' . $contextStyleSheet['uploadName'], array('priority' => STYLE_SEQUENCE_LAST));
             }
             // Get a link to the settings page for the current context.
             // This allows us to reduce template duplication by using this
             // variable in templates/common/header.tpl, instead of
             // reproducing a lot of OMP/OJS-specific logic there.
             $dispatcher = $request->getDispatcher();
             $this->assign('contextSettingsUrl', $dispatcher->url($request, ROUTE_PAGE, null, 'management', 'settings', 'press'));
             $this->assign('pageFooter', $context->getLocalizedSetting('pageFooter'));
         } else {
             // Add the site-wide logo, if set for this locale or the primary locale
             $this->assign('displayPageHeaderTitle', $site->getLocalizedPageHeaderTitle());
             $this->assign('displayPageHeaderLogo', $site->getLocalizedSetting('pageHeaderTitleImage'));
             $this->assign('siteTitle', $site->getLocalizedTitle());
             $this->assign('primaryLocale', $site->getPrimaryLocale());
             $this->assign('supportedLocales', $site->getSupportedLocaleNames());
             // Check if registration is open for any contexts
             $contextDao = Application::getContextDAO();
             $contexts = $contextDao->getAll(true)->toArray();
             $contextsForRegistration = array();
             foreach ($contexts as $context) {
                 if (!$context->getSetting('disableUserReg')) {
                     $contextsForRegistration[] = $context;
                 }
             }
             $this->assign('contexts', $contextsForRegistration);
             $this->assign('disableUserReg', empty($contextsForRegistration));
         }
     }
 }
Exemple #19
0
 /**
  * Constructor.
  * Initialize template engine and assign basic template variables.
  * @param $request PKPRequest
  */
 function TemplateManager($request = null)
 {
     parent::PKPTemplateManager($request);
     // Retrieve the router
     $router = $this->request->getRouter();
     assert(is_a($router, 'PKPRouter'));
     // Are we using implicit authentication?
     $this->assign('implicitAuth', Config::getVar('security', 'implicit_auth'));
     if (!defined('SESSION_DISABLE_INIT')) {
         /**
          * Kludge to make sure no code that tries to connect to
          * the database is executed (e.g., when loading
          * installer pages).
          */
         $context = $router->getContext($this->request);
         $site = $this->request->getSite();
         $publicFileManager = new PublicFileManager();
         $siteFilesDir = $this->request->getBaseUrl() . '/' . $publicFileManager->getSiteFilesPath();
         $this->assign('sitePublicFilesDir', $siteFilesDir);
         $this->assign('publicFilesDir', $siteFilesDir);
         // May be overridden by journal
         $siteStyleFilename = $publicFileManager->getSiteFilesPath() . '/' . $site->getSiteStyleFilename();
         if (file_exists($siteStyleFilename)) {
             $this->addStyleSheet($this->request->getBaseUrl() . '/' . $siteStyleFilename, STYLE_SEQUENCE_LAST);
         }
         $this->assign('siteCategoriesEnabled', $site->getSetting('categoriesEnabled'));
         if (isset($context)) {
             $this->assign('currentJournal', $context);
             $this->assign('siteTitle', $context->getLocalizedName());
             $this->assign('publicFilesDir', $this->request->getBaseUrl() . '/' . $publicFileManager->getJournalFilesPath($context->getId()));
             $this->assign('primaryLocale', $context->getPrimaryLocale());
             $this->assign('alternateLocales', $context->getSetting('alternateLocales'));
             // Assign page header
             $this->assign('displayPageHeaderTitle', $context->getLocalizedPageHeaderTitle());
             $this->assign('displayPageHeaderLogo', $context->getLocalizedPageHeaderLogo());
             $this->assign('displayPageHeaderTitleAltText', $context->getLocalizedSetting('pageHeaderTitleImageAltText'));
             $this->assign('displayPageHeaderLogoAltText', $context->getLocalizedSetting('pageHeaderLogoImageAltText'));
             $this->assign('displayFavicon', $context->getLocalizedFavicon());
             $this->assign('faviconDir', $this->request->getBaseUrl() . '/' . $publicFileManager->getJournalFilesPath($context->getId()));
             $this->assign('alternatePageHeader', $context->getLocalizedSetting('journalPageHeader'));
             $this->assign('metaSearchDescription', $context->getLocalizedSetting('searchDescription'));
             $this->assign('metaSearchKeywords', $context->getLocalizedSetting('searchKeywords'));
             $this->assign('metaCustomHeaders', $context->getLocalizedSetting('customHeaders'));
             $this->assign('numPageLinks', $context->getSetting('numPageLinks'));
             $this->assign('itemsPerPage', $context->getSetting('itemsPerPage'));
             $this->assign('enableAnnouncements', $context->getSetting('enableAnnouncements'));
             $this->assign('hideRegisterLink', !$context->getSetting('allowRegReviewer') && !$context->getSetting('allowRegReader') && !$context->getSetting('allowRegAuthor'));
             // Assign stylesheets and footer
             $contextStyleSheet = $context->getSetting('journalStyleSheet');
             if ($contextStyleSheet) {
                 $this->addStyleSheet($this->request->getBaseUrl() . '/' . $publicFileManager->getJournalFilesPath($context->getId()) . '/' . $contextStyleSheet['uploadName'], STYLE_SEQUENCE_LAST);
             }
             import('classes.payment.ojs.OJSPaymentManager');
             $paymentManager = new OJSPaymentManager($this->request);
             $this->assign('journalPaymentsEnabled', $paymentManager->isConfigured());
             // Include footer links if they have been defined.
             $footerCategoryDao = DAORegistry::getDAO('FooterCategoryDAO');
             $footerCategories = $footerCategoryDao->getNotEmptyByContextId($context->getId());
             $this->assign('footerCategories', $footerCategories->toArray());
             $footerLinkDao = DAORegistry::getDAO('FooterLinkDAO');
             $this->assign('maxLinks', $footerLinkDao->getLargestCategoryTotalbyContextId($context->getId()));
             $this->assign('pageFooter', $context->getLocalizedSetting('journalPageFooter'));
         } else {
             // Add the site-wide logo, if set for this locale or the primary locale
             $displayPageHeaderTitle = $site->getLocalizedPageHeaderTitle();
             $this->assign('displayPageHeaderTitle', $displayPageHeaderTitle);
             if (isset($displayPageHeaderTitle['altText'])) {
                 $this->assign('displayPageHeaderTitleAltText', $displayPageHeaderTitle['altText']);
             }
             $this->assign('siteTitle', $site->getLocalizedTitle());
         }
         if (!$site->getRedirect()) {
             $this->assign('hasOtherJournals', true);
         }
     }
 }
 /**
  * Fetch the form.
  * @param $request PKPRequest
  * @return string JSON-encoded form contents.
  */
 function fetch($request)
 {
     $templateMgr = TemplateManager::getManager($request);
     $publicFileManager = new PublicFileManager();
     $templateMgr->assign(array('profileImage' => $request->getUser()->getSetting('profileImage'), 'publicSiteFilesPath' => $publicFileManager->getSiteFilesPath()));
     return parent::fetch($request);
 }
 /**
  * Constructor.
  * Initialize template engine and assign basic template variables.
  * @param $request PKPRequest
  */
 function TemplateManager($request)
 {
     parent::PKPTemplateManager($request);
     AppLocale::requireComponents(LOCALE_COMPONENT_APP_COMMON);
     if (!defined('SESSION_DISABLE_INIT')) {
         /**
          * Kludge to make sure no code that tries to connect to
          * the database is executed (e.g., when loading
          * installer pages).
          */
         $context = $request->getContext();
         $site = $request->getSite();
         $publicFileManager = new PublicFileManager();
         $siteFilesDir = $request->getBaseUrl() . '/' . $publicFileManager->getSiteFilesPath();
         $this->assign('sitePublicFilesDir', $siteFilesDir);
         $this->assign('publicFilesDir', $siteFilesDir);
         // May be overridden by press
         $siteStyleFilename = $publicFileManager->getSiteFilesPath() . '/' . $site->getSiteStyleFilename();
         if (file_exists($siteStyleFilename)) {
             $this->addStyleSheet($request->getBaseUrl() . '/' . $siteStyleFilename, STYLE_SEQUENCE_LAST);
         }
         if (isset($context)) {
             $this->assign('currentPress', $context);
             $this->assign('siteTitle', $context->getLocalizedName());
             $this->assign('publicFilesDir', $request->getBaseUrl() . '/' . $publicFileManager->getContextFilesPath($context->getAssocType(), $context->getId()));
             $this->assign('primaryLocale', $context->getPrimaryLocale());
             $this->assign('alternateLocales', $context->getSetting('alternateLocales'));
             // Assign page header
             $this->assign('displayPageHeaderTitle', $context->getPageHeaderTitle());
             $this->assign('displayPageHeaderLogo', $context->getPageHeaderLogo());
             $this->assign('alternatePageHeader', $context->getLocalizedSetting('pageHeader'));
             $this->assign('metaSearchDescription', $context->getLocalizedSetting('searchDescription'));
             $this->assign('metaSearchKeywords', $context->getLocalizedSetting('searchKeywords'));
             $this->assign('metaCustomHeaders', $context->getLocalizedSetting('customHeaders'));
             $this->assign('numPageLinks', $context->getSetting('numPageLinks'));
             $this->assign('itemsPerPage', $context->getSetting('itemsPerPage'));
             $this->assign('enableAnnouncements', $context->getSetting('enableAnnouncements'));
             // Assign stylesheets and footer
             $contextStyleSheet = $context->getSetting('styleSheet');
             if ($contextStyleSheet) {
                 $this->addStyleSheet($request->getBaseUrl() . '/' . $publicFileManager->getContextFilesPath(ASSOC_TYPE_PRESS, $context->getId()) . '/' . $contextStyleSheet['uploadName'], STYLE_SEQUENCE_LAST);
             }
             // Get context info for use in primary navigation items
             import('pages.about.AboutContextHandler');
             if (in_array('IAboutContextInfoProvider', class_implements('AboutContextHandler'))) {
                 $this->assign('contextInfo', AboutContextHandler::getAboutInfo($context));
             }
             // Get a link to the settings page for the current context.
             // This allows us to reduce template duplication by using this
             // variable in templates/common/header.tpl, instead of
             // reproducing a lot of OMP/OJS-specific logic there.
             $router = $request->getRouter();
             $dispatcher = $request->getDispatcher();
             $this->assign('contextSettingsUrl', $dispatcher->url($request, ROUTE_PAGE, null, 'management', 'settings', 'press'));
             // Include footer links if they have been defined.
             $footerCategoryDao = DAORegistry::getDAO('FooterCategoryDAO');
             $footerCategories = $footerCategoryDao->getNotEmptyByContextId($context->getId());
             $this->assign('footerCategories', $footerCategories->toArray());
             $footerLinkDao = DAORegistry::getDAO('FooterLinkDAO');
             $this->assign('maxLinks', $footerLinkDao->getLargestCategoryTotalbyContextId($context->getId()));
             $this->assign('pageFooter', $context->getLocalizedSetting('pageFooter'));
         } else {
             // Add the site-wide logo, if set for this locale or the primary locale
             $displayPageHeaderTitle = $site->getLocalizedPageHeaderTitle();
             $this->assign('displayPageHeaderTitle', $displayPageHeaderTitle);
             if (isset($displayPageHeaderTitle['altText'])) {
                 $this->assign('displayPageHeaderTitleAltText', $displayPageHeaderTitle['altText']);
             }
             $this->assign('siteTitle', $site->getLocalizedTitle());
         }
     }
 }
 /**
  * Render a template to show details about an uploaded file in the form
  * and a link action to delete it.
  * @param $fileSettingName string The uploaded file setting name.
  * @param $request Request
  * @return string
  */
 function renderFileView($fileSettingName, $request)
 {
     $file = $this->getData($fileSettingName);
     $locale = AppLocale::getLocale();
     // Check if the file is localized.
     if (!is_null($file) && key_exists($locale, $file)) {
         // We use the current localized file value.
         $file = $file[$locale];
     }
     // Only render the file view if we have a file.
     if (is_array($file)) {
         $templateMgr = TemplateManager::getManager($request);
         $deleteLinkAction = $this->_getDeleteFileLinkAction($fileSettingName, $request);
         // Get the right template to render the view.
         if ($fileSettingName == 'pageHeaderTitleImage') {
             $template = 'controllers/tab/settings/formImageView.tpl';
             // Get the common alternate text for the image.
             $localeKey = 'admin.settings.homeHeaderImage.altText';
             $commonAltText = __($localeKey);
             $templateMgr->assign('commonAltText', $commonAltText);
         } else {
             $template = 'controllers/tab/settings/formFileView.tpl';
         }
         $publicFileManager = $publicFileManager = new PublicFileManager();
         $templateMgr->assign('publicFilesDir', $request->getBasePath() . '/' . $publicFileManager->getSiteFilesPath());
         $templateMgr->assign('file', $file);
         $templateMgr->assign('deleteLinkAction', $deleteLinkAction);
         $templateMgr->assign('fileSettingName', $fileSettingName);
         return $templateMgr->fetch($template);
     } else {
         return null;
     }
 }
 /**
  * Constructor.
  * Initialize template engine and assign basic template variables.
  * @param $request PKPRequest FIXME: is optional for backwards compatibility only - make mandatory
  */
 function TemplateManager($request = null)
 {
     // FIXME: for backwards compatibility only - remove
     if (!isset($request)) {
         // FIXME: Trigger a deprecation warning when enough instances of this
         // call have been fixed to not clutter the error log.
         $request =& Registry::get('request');
     }
     assert(is_a($request, 'PKPRequest'));
     parent::PKPTemplateManager($request);
     // Retrieve the router
     $router =& $request->getRouter();
     assert(is_a($router, 'PKPRouter'));
     if (!defined('SESSION_DISABLE_INIT')) {
         /**
          * Kludge to make sure no code that tries to connect to
          * the database is executed (e.g., when loading
          * installer pages).
          */
         $conference =& $router->getContext($request, 1);
         $schedConf =& $router->getContext($request, 2);
         $site =& $request->getSite();
         $this->assign('siteTitle', $site->getLocalizedTitle());
         $siteFilesDir = $request->getBaseUrl() . '/' . PublicFileManager::getSiteFilesPath();
         $this->assign('sitePublicFilesDir', $siteFilesDir);
         $this->assign('homeContext', array('conference' => 'index', 'schedConf' => 'index'));
         $siteStyleFilename = PublicFileManager::getSiteFilesPath() . '/' . $site->getSiteStyleFilename();
         if (file_exists($siteStyleFilename)) {
             $this->addStyleSheet($request->getBaseUrl() . '/' . $siteStyleFilename);
         }
         if (isset($conference)) {
             $schedConfDao =& DAORegistry::getDAO('SchedConfDAO');
             $archivedSchedConfsExist = $schedConfDao->archivedSchedConfsExist($conference->getId());
             $currentSchedConfsExist = $schedConfDao->currentSchedConfsExist($conference->getId());
             $this->assign('archivedSchedConfsExist', $archivedSchedConfsExist);
             $this->assign('currentSchedConfsExist', $currentSchedConfsExist);
             $this->assign_by_ref('currentConference', $conference);
             $conferenceTitle = $conference->getConferenceTitle();
             $this->assign('numPageLinks', $conference->getSetting('numPageLinks'));
             $this->assign('itemsPerPage', $conference->getSetting('itemsPerPage'));
             // Load and apply theme plugin, if chosen
             $themePluginPath = $conference->getSetting('conferenceTheme');
             if (!empty($themePluginPath)) {
                 // Load and activate the theme
                 $themePlugin =& PluginRegistry::loadPlugin('themes', $themePluginPath);
                 if ($themePlugin) {
                     $themePlugin->activate($this);
                 }
             }
             // Assign additional navigation bar items
             $navMenuItems =& $conference->getLocalizedSetting('navItems');
             $this->assign_by_ref('navMenuItems', $navMenuItems);
             $this->assign('publicFilesDir', $request->getBaseUrl() . '/' . PublicFileManager::getConferenceFilesPath($conference->getId()));
             $this->assign('displayPageHeaderTitle', $conference->getPageHeaderTitle());
             $this->assign('displayPageHeaderLogo', $conference->getPageHeaderLogo());
             $this->assign('displayPageHeaderTitleAltText', $conference->getLocalizedSetting('pageHeaderTitleImageAltText'));
             $this->assign('displayPageHeaderLogoAltText', $conference->getLocalizedSetting('pageHeaderLogoImageAltText'));
             $this->assign('displayFavicon', $conference->getLocalizedFavicon());
             $this->assign('faviconDir', $request->getBaseUrl() . '/' . PublicFileManager::getConferenceFilesPath($conference->getId()));
             $this->assign('alternatePageHeader', $conference->getLocalizedSetting('conferencePageHeader'));
             $this->assign('metaSearchDescription', $conference->getLocalizedSetting('searchDescription'));
             $this->assign('metaSearchKeywords', $conference->getLocalizedSetting('searchKeywords'));
             $this->assign('metaCustomHeaders', $conference->getLocalizedSetting('customHeaders'));
             $this->assign('enableAnnouncements', $conference->getSetting('enableAnnouncements'));
             $this->assign('pageFooter', $conference->getLocalizedSetting('conferencePageFooter'));
             $this->assign('displayCreativeCommons', $conference->getSetting('postCreativeCommons'));
             if (isset($schedConf)) {
                 // This will be needed if inheriting public conference files from the scheduled conference.
                 $this->assign('publicSchedConfFilesDir', $request->getBaseUrl() . '/' . PublicFileManager::getSchedConfFilesPath($schedConf->getId()));
                 $this->assign('primaryLocale', $conference->getSetting('primaryLocale'));
                 $this->assign('alternateLocales', $conference->getPrimaryLocale());
                 $this->assign_by_ref('currentSchedConf', $schedConf);
                 // Assign common sched conf vars:
                 $currentTime = time();
                 $submissionsCloseDate = $schedConf->getSetting('submissionsCloseDate');
                 $this->assign('submissionsCloseDate', $submissionsCloseDate);
                 $this->assign('schedConfPostTimeline', $schedConf->getSetting('postTimeline'));
                 $this->assign('schedConfPostOverview', $schedConf->getSetting('postOverview'));
                 $this->assign('schedConfPostTrackPolicies', $schedConf->getSetting('postTrackPolicies'));
                 $this->assign('schedConfPostPresentations', $schedConf->getSetting('postPresentations'));
                 $this->assign('schedConfPostAccommodation', $schedConf->getSetting('postAccommodation'));
                 $this->assign('schedConfPostSupporters', $schedConf->getSetting('postSupporters'));
                 $this->assign('schedConfPostPayment', $schedConf->getSetting('postPayment'));
                 // CFP displayed
                 $showCFPDate = $schedConf->getSetting('showCFPDate');
                 $postCFP = $schedConf->getSetting('postCFP');
                 if ($postCFP && $showCFPDate && $submissionsCloseDate && $currentTime > $showCFPDate && $currentTime < $submissionsCloseDate) {
                     $this->assign('schedConfShowCFP', true);
                 }
                 // Schedule displayed
                 $postScheduleDate = $schedConf->getSetting('postScheduleDate');
                 if ($postScheduleDate && $currentTime > $postScheduleDate && $schedConf->getSetting('postSchedule')) {
                     $this->assign('schedConfPostSchedule', true);
                 }
                 // Program
                 if ($schedConf->getSetting('postProgram') && ($schedConf->getSetting('program') || $schedConf->getSetting('programFile'))) {
                     $this->assign('schedConfShowProgram', true);
                 }
                 // Submissions open
                 $submissionsOpenDate = $schedConf->getSetting('submissionsOpenDate');
                 $postSubmission = $schedConf->getSetting('postProposalSubmission');
                 $this->assign('submissionsOpenDate', $submissionsOpenDate);
                 import('classes.payment.ocs.OCSPaymentManager');
                 $paymentManager =& OCSPaymentManager::getManager();
                 $this->assign('schedConfPaymentsEnabled', $paymentManager->isConfigured());
             }
             // Assign conference stylesheet and footer
             $conferenceStyleSheet = $conference->getSetting('conferenceStyleSheet');
             if ($conferenceStyleSheet) {
                 $this->addStyleSheet($request->getBaseUrl() . '/' . PublicFileManager::getConferenceFilesPath($conference->getId()) . '/' . $conferenceStyleSheet['uploadName']);
             }
             // Assign scheduled conference stylesheet and footer (after conference stylesheet!)
             if ($schedConf) {
                 $schedConfStyleSheet = $schedConf->getSetting('schedConfStyleSheet');
                 if ($schedConfStyleSheet) {
                     $this->addStyleSheet($request->getBaseUrl() . '/' . PublicFileManager::getSchedConfFilesPath($schedConf->getId()) . '/' . $schedConfStyleSheet['uploadName']);
                 }
             }
         } else {
             // Not within conference context
             // Add the site-wide logo, if set for this locale or the primary locale
             $displayPageHeaderTitle = $site->getLocalizedPageHeaderTitle();
             $this->assign('displayPageHeaderTitle', $displayPageHeaderTitle);
             if (isset($displayPageHeaderTitle['altText'])) {
                 $this->assign('displayPageHeaderTitleAltText', $displayPageHeaderTitle['altText']);
             }
             $this->assign('publicFilesDir', $request->getBaseUrl() . '/' . PublicFileManager::getSiteFilesPath());
         }
         // Add java script for notifications
         $user =& $request->getUser();
         if ($user) {
             $this->addJavaScript('lib/pkp/js/lib/jquery/plugins/jquery.pnotify.js');
         }
     }
 }
Exemple #24
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 (String::strtolower($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->getSchedConfByPath($urlParts[1]);
                     if (!$thisSchedConf) {
                         break;
                     }
                     $thisConference =& $conferenceDao->getConference($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('file.PublicFileManager');
                 $publicFileManager = new PublicFileManager();
                 $url = Request::getBaseUrl() . '/' . $publicFileManager->getSiteFilesPath() . '/' . implode('/', $urlParts) . ($anchor ? '#' . $anchor : '');
                 break;
             case 'public':
                 array_shift($urlParts);
                 $schedConf =& Request::getSchedConf();
                 import('file.PublicFileManager');
                 $publicFileManager = new PublicFileManager();
                 $url = Request::getBaseUrl() . '/' . $publicFileManager->getSchedConfFilesPath($schedConf->getId()) . '/' . implode('/', $urlParts) . ($anchor ? '#' . $anchor : '');
                 break;
         }
     }
     return $matchArray[1] . $url . $matchArray[3];
 }
Exemple #25
0
 /**
  * Constructor.
  * Initialize template engine and assign basic template variables.
  * @param $request PKPRequest
  */
 function __construct($request)
 {
     parent::__construct($request);
     if (!defined('SESSION_DISABLE_INIT')) {
         /**
          * Kludge to make sure no code that tries to connect to
          * the database is executed (e.g., when loading
          * installer pages).
          */
         $context = $request->getContext();
         $site = $request->getSite();
         $publicFileManager = new PublicFileManager();
         $siteFilesDir = $request->getBaseUrl() . '/' . $publicFileManager->getSiteFilesPath();
         $this->assign('sitePublicFilesDir', $siteFilesDir);
         $this->assign('publicFilesDir', $siteFilesDir);
         // May be overridden by journal
         $siteStyleFilename = $publicFileManager->getSiteFilesPath() . '/' . $site->getSiteStyleFilename();
         if (file_exists($siteStyleFilename)) {
             $this->addStyleSheet('siteStylesheet', $request->getBaseUrl() . '/' . $siteStyleFilename, array('priority' => STYLE_SEQUENCE_LATE));
         }
         // Pass app-specific details to template
         $this->assign(array('brandImage' => 'templates/images/ojs_brand.png', 'packageKey' => 'common.openJournalSystems', 'pkpLink' => 'http://pkp.sfu.ca/ojs'));
         // Get a count of unread tasks.
         if ($user = $request->getUser()) {
             $notificationDao = DAORegistry::getDAO('NotificationDAO');
             // Exclude certain tasks, defined in the notifications grid handler
             import('lib.pkp.controllers.grid.notifications.TaskNotificationsGridHandler');
             $this->assign('unreadNotificationCount', $notificationDao->getNotificationCount(false, $user->getId(), null, NOTIFICATION_LEVEL_TASK));
         }
         if (isset($context)) {
             $this->assign(array('currentJournal' => $context, 'siteTitle' => $context->getLocalizedName(), 'publicFilesDir' => $request->getBaseUrl() . '/' . $publicFileManager->getJournalFilesPath($context->getId()), 'primaryLocale' => $context->getPrimaryLocale(), 'supportedLocales' => $context->getSupportedLocaleNames(), 'displayPageHeaderTitle' => $context->getLocalizedPageHeaderTitle(), 'displayPageHeaderLogo' => $context->getLocalizedPageHeaderLogo(), 'displayPageHeaderLogoAltText' => $context->getLocalizedSetting('pageHeaderLogoImageAltText'), 'numPageLinks' => $context->getSetting('numPageLinks'), 'itemsPerPage' => $context->getSetting('itemsPerPage'), 'enableAnnouncements' => $context->getSetting('enableAnnouncements'), 'contextSettings' => $context->getSettingsDAO()->getSettings($context->getId()), 'disableUserReg' => $context->getSetting('disableUserReg')));
             // Assign meta tags
             $favicon = $context->getLocalizedFavicon();
             if (!empty($favicon)) {
                 $faviconDir = $request->getBaseUrl() . '/' . $publicFileManager->getJournalFilesPath($context->getId());
                 $this->addHeader('favicon', '<link rel="icon" href="' . $faviconDir . '/' . $favicon['uploadName'] . '">');
             }
             // Assign stylesheets and footer
             $contextStyleSheet = $context->getSetting('styleSheet');
             if ($contextStyleSheet) {
                 $this->addStyleSheet('contextStylesheet', $request->getBaseUrl() . '/' . $publicFileManager->getJournalFilesPath($context->getId()) . '/' . $contextStyleSheet['uploadName'], array('priority' => STYLE_SEQUENCE_LATE));
             }
             // Get a link to the settings page for the current context.
             // This allows us to reduce template duplication by using this
             // variable in templates/common/header.tpl, instead of
             // reproducing a lot of OMP/OJS-specific logic there.
             $dispatcher = $request->getDispatcher();
             $this->assign('contextSettingsUrl', $dispatcher->url($request, ROUTE_PAGE, null, 'management', 'settings', 'journal'));
             import('classes.payment.ojs.OJSPaymentManager');
             $paymentManager = new OJSPaymentManager($request);
             $this->assign('journalPaymentsEnabled', $paymentManager->isConfigured());
             $this->assign('pageFooter', $context->getLocalizedSetting('pageFooter'));
         } else {
             // Check if registration is open for any contexts
             $contextDao = Application::getContextDAO();
             $contexts = $contextDao->getAll(true)->toArray();
             $contextsForRegistration = array();
             foreach ($contexts as $context) {
                 if (!$context->getSetting('disableUserReg')) {
                     $contextsForRegistration[] = $context;
                 }
             }
             $this->assign(array('contexts' => $contextsForRegistration, 'disableUserReg' => empty($contextsForRegistration), 'displayPageHeaderTitle' => $site->getLocalizedPageHeaderTitle(), 'displayPageHeaderLogo' => $site->getLocalizedSetting('pageHeaderTitleImage'), 'siteTitle' => $site->getLocalizedTitle(), 'primaryLocale' => $site->getPrimaryLocale(), 'supportedLocales' => $site->getSupportedLocaleNames(), 'pageFooter' => $site->getLocalizedSetting('pageFooter')));
         }
     }
 }
 function handleExport(&$journal, &$errors, $outputFile = null)
 {
     $this->import('XMLAssembler');
     import('classes.file.PublicFileManager');
     import('classes.file.JournalFileManager');
     $isTarOk = $this->_checkForTar();
     if (is_array($isTarOk)) {
         $errors = $isTarOk;
         return false;
     }
     $tmpPath = $this->_getTmpPath();
     if (is_array($tmpPath)) {
         $errors = $tmpPath;
         return false;
     }
     $xmlAbsolutePath = $this->_generateXml($journal, $tmpPath);
     if ($xmlAbsolutePath === false) {
         return false;
     }
     $publicFileManager = new PublicFileManager();
     $journalFileManager = new JournalFileManager($journal);
     $journalPublicPath = $publicFileManager->getJournalFilesPath($journal->getId());
     $sitePublicPath = $publicFileManager->getSiteFilesPath();
     $journalFilesPath = $journalFileManager->filesDir;
     $exportFiles = array();
     $exportFiles[$xmlAbsolutePath] = "journal.xml";
     $exportFiles[$journalPublicPath] = "public";
     $exportFiles[$journalFilesPath] = "files";
     $exportFiles[$sitePublicPath] = "sitePublic";
     // Package the files up as a single tar before going on.
     $finalExportFileName = $tmpPath . $journal->getPath() . ".tar.gz";
     $this->tarFiles($tmpPath, $finalExportFileName, $exportFiles);
     if (is_null($outputFile)) {
         header('Content-Type: application/x-gtar');
         header('Cache-Control: private');
         header('Content-Disposition: attachment; filename="' . $journal->getPath() . '.tar.gz"');
         readfile($finalExportFileName);
     } else {
         $outputFileExtension = '.tar.gz';
         if (substr($outputFile, -strlen($outputFileExtension)) != $outputFileExtension) {
             $outputFile .= $outputFileExtension;
         }
         $outputDir = dirname($outputFile);
         if (empty($outputDir)) {
             $outputDir = getcwd();
         }
         if (!is_writable($outputDir)) {
             $this->_removeTemporaryFiles(array_keys($xmlAbsolutePath));
             $errors[] = array('plugins.importexport.common.export.error.outputFileNotWritable', $outputFile);
             return $errors;
         }
         $fileManager = new FileManager();
         $fileManager->copyFile($finalExportFileName, $outputFile);
     }
     $this->_removeTemporaryFiles(array($xmlAbsolutePath, $finalExportFileName));
     return true;
 }
 /**
  * Uploads custom site logo.
  */
 function uploadPageHeaderTitleImage($locale)
 {
     import('classes.file.PublicFileManager');
     $publicFileManager = new PublicFileManager();
     $site = Request::getSite();
     if ($publicFileManager->uploadedFileExists('pageHeaderTitleImage')) {
         $type = $publicFileManager->getUploadedFileType('pageHeaderTitleImage');
         $extension = $publicFileManager->getImageExtension($type);
         if (!$extension) {
             return false;
         }
         $uploadName = 'pageHeaderTitleImage_' . $locale . $extension;
         if ($publicFileManager->uploadSiteFile('pageHeaderTitleImage', $uploadName)) {
             $siteDao = DAORegistry::getDAO('SiteDAO');
             $setting = $site->getSetting('pageHeaderTitleImage');
             list($width, $height) = getimagesize($publicFileManager->getSiteFilesPath() . '/' . $uploadName);
             $setting[$locale] = array('originalFilename' => $publicFileManager->getUploadedFileName('pageHeaderTitleImage'), 'width' => $width, 'height' => $height, 'uploadName' => $uploadName, 'dateUploaded' => Core::getCurrentDate());
             $site->updateSetting('pageHeaderTitleImage', $setting, 'object', true);
         }
     }
     return true;
 }
 function uploadArchiveImage()
 {
     import('file.PublicFileManager');
     $fileManager = new PublicFileManager();
     $archive =& $this->archive;
     $type = $fileManager->getUploadedFileType('archiveImage');
     $extension = $fileManager->getImageExtension($type);
     if (!$extension) {
         return false;
     }
     $uploadName = 'archiveImage-' . (int) $archive->getArchiveId() . $extension;
     if (!$fileManager->uploadSiteFile('archiveImage', $uploadName)) {
         return false;
     }
     $filePath = $fileManager->getSiteFilesPath();
     list($width, $height) = getimagesize($filePath . '/' . $uploadName);
     if (!Validation::isSiteAdmin() && ($width > 150 || $height > 150 || $width <= 0 || $height <= 0)) {
         $archiveSetting = null;
         $archive->updateSetting('archiveImage', $archiveSetting);
         $fileManager->removeSiteFile($filePath);
         return false;
     }
     $archiveSetting = array('name' => $fileManager->getUploadedFileName('archiveImage'), 'uploadName' => $uploadName, 'width' => $width, 'height' => $height, 'dateUploaded' => Core::getCurrentDate());
     $archive->updateSetting('archiveImage', $archiveSetting);
     return true;
 }
 /**
  * Constructor.
  * Initialize template engine and assign basic template variables.
  */
 function TemplateManager()
 {
     parent::PKPTemplateManager();
     if (!defined('SESSION_DISABLE_INIT')) {
         /**
          * Kludge to make sure no code that tries to connect to
          * the database is executed (e.g., when loading
          * installer pages).
          */
         $conference =& Request::getConference();
         $schedConf =& Request::getSchedConf();
         $site =& Request::getSite();
         if (isset($schedConf)) {
             $this->assign('schedConfAcronym', $schedConf->getLocalizedSetting('acronym'));
         }
         $this->assign('siteTitle', $site->getLocalizedTitle());
         $siteFilesDir = Request::getBaseUrl() . '/' . PublicFileManager::getSiteFilesPath();
         $this->assign('sitePublicFilesDir', $siteFilesDir);
         $this->assign('homeContext', array('conference' => 'index', 'schedConf' => 'index'));
         $siteStyleFilename = PublicFileManager::getSiteFilesPath() . '/' . $site->getSiteStyleFilename();
         if (file_exists($siteStyleFilename)) {
             $this->addStyleSheet(Request::getBaseUrl() . '/' . $siteStyleFilename);
         }
         if (isset($conference)) {
             $schedConfDao =& DAORegistry::getDAO('SchedConfDAO');
             $archivedSchedConfsExist = $schedConfDao->archivedSchedConfsExist($conference->getId());
             $currentSchedConfsExist = $schedConfDao->currentSchedConfsExist($conference->getId());
             $this->assign('archivedSchedConfsExist', $archivedSchedConfsExist);
             $this->assign('currentSchedConfsExist', $currentSchedConfsExist);
             $this->assign_by_ref('currentConference', $conference);
             $conferenceTitle = $conference->getConferenceTitle();
             $this->assign('numPageLinks', $conference->getSetting('numPageLinks'));
             $this->assign('itemsPerPage', $conference->getSetting('itemsPerPage'));
             // Load and apply theme plugin, if chosen
             $themePluginPath = $conference->getSetting('conferenceTheme');
             if (!empty($themePluginPath)) {
                 // Load and activate the theme
                 $themePlugin =& PluginRegistry::loadPlugin('themes', $themePluginPath);
                 if ($themePlugin) {
                     $themePlugin->activate($this);
                 }
             }
             // Assign additional navigation bar items
             $navMenuItems =& $conference->getLocalizedSetting('navItems');
             $this->assign_by_ref('navMenuItems', $navMenuItems);
             $this->assign('publicFilesDir', Request::getBaseUrl() . '/' . PublicFileManager::getConferenceFilesPath($conference->getId()));
             $this->assign('displayPageHeaderTitle', $conference->getPageHeaderTitle());
             $this->assign('displayPageHeaderSubTitle', $conference->getLocalizedSetting('homeHeaderSubTitle'));
             $this->assign('displayPageHeaderLogo', $conference->getPageHeaderLogo());
             $this->assign('displayPageHeaderTitleAltText', $conference->getLocalizedSetting('pageHeaderTitleImageAltText'));
             $this->assign('displayPageHeaderLogoAltText', $conference->getLocalizedSetting('pageHeaderLogoImageAltText'));
             $this->assign('displayFavicon', $conference->getLocalizedFavicon());
             $this->assign('faviconDir', Request::getBaseUrl() . '/' . PublicFileManager::getConferenceFilesPath($conference->getId()));
             $this->assign('alternatePageHeader', $conference->getLocalizedSetting('conferencePageHeader'));
             $this->assign('metaSearchDescription', $conference->getLocalizedSetting('searchDescription'));
             $this->assign('metaSearchKeywords', $conference->getLocalizedSetting('searchKeywords'));
             $this->assign('metaCustomHeaders', $conference->getLocalizedSetting('customHeaders'));
             $this->assign('enableAnnouncements', $conference->getSetting('enableAnnouncements'));
             $this->assign('pageFooter', $conference->getLocalizedSetting('conferencePageFooter'));
             $this->assign('displayCreativeCommons', $conference->getSetting('postCreativeCommons'));
             $this->assign('analyticsTrackingID', $conference->getSetting('analyticsTrackingID'));
             $this->assign('currentConferenceHome', Request::url(null, $conference->getSetting("path"), 'index'));
             if (isset($schedConf)) {
                 // This will be needed if inheriting public conference files from the scheduled conference.
                 $this->assign('publicSchedConfFilesDir', Request::getBaseUrl() . '/' . PublicFileManager::getSchedConfFilesPath($schedConf->getId()));
                 $this->assign('primaryLocale', $conference->getSetting('primaryLocale'));
                 $this->assign('alternateLocales', $conference->getPrimaryLocale());
                 $this->assign_by_ref('currentSchedConf', $schedConf);
                 // Assign common sched conf vars:
                 $currentTime = time();
                 $submissionsCloseDate = $schedConf->getSetting('submissionsCloseDate');
                 $this->assign('submissionsCloseDate', $submissionsCloseDate);
                 // ------------------------------------
                 $navMenuItemOrder = array();
                 $navMenuItemNavOrder = array();
                 $this->assign('schedConfPostOverview', $schedConf->getSetting('postOverview'));
                 $this->assign('schedConfPostOverviewOrder', $schedConf->getSetting('postOverviewOrder'));
                 $this->_addNavMenuItemOrder($schedConf, $navMenuItemOrder, 'Overview');
                 $this->_addNavMenuItemNavOrder($schedConf, $navMenuItemNavOrder, 'Overview');
                 $this->assign('schedConfPostAnnouncement', $schedConf->getSetting('postAnnouncement'));
                 $this->assign('schedConfPostAnnouncementOrder', $schedConf->getSetting('postAnnouncementOrder'));
                 $this->_addNavMenuItemOrder($schedConf, $navMenuItemOrder, 'Announcement');
                 $this->_addNavMenuItemNavOrder($schedConf, $navMenuItemNavOrder, 'Announcement');
                 $this->assign('schedConfPostTimeline', $schedConf->getSetting('postTimeline'));
                 $this->assign('schedConfPostTimelineOrder', $schedConf->getSetting('postTimelineOrder'));
                 $this->_addNavMenuItemOrder($schedConf, $navMenuItemOrder, 'Timeline');
                 $this->_addNavMenuItemNavOrder($schedConf, $navMenuItemNavOrder, 'Timeline');
                 // CFP displayed
                 $showCFPDate = $schedConf->getSetting('showCFPDate');
                 $postCFP = $schedConf->getSetting('postCFP');
                 if ($postCFP && $showCFPDate && $submissionsCloseDate && $currentTime > $showCFPDate && $currentTime < $submissionsCloseDate) {
                     $this->assign('schedConfShowCFP', true);
                     $this->assign('schedConfShowCFPOrder', $schedConf->getSetting('postCFPOrder'));
                     $this->_addNavMenuItemOrder($schedConf, $navMenuItemOrder, 'CFP');
                     $this->_addNavMenuItemNavOrder($schedConf, $navMenuItemNavOrder, 'CFP');
                 }
                 $this->assign('schedConfPostPayment', $schedConf->getSetting('postPayment'));
                 $this->assign('schedConfPostPaymentOrder', $schedConf->getSetting('postPaymentOrder'));
                 $this->_addNavMenuItemOrder($schedConf, $navMenuItemOrder, 'Payment');
                 $this->_addNavMenuItemNavOrder($schedConf, $navMenuItemNavOrder, 'Payment');
                 $this->assign('schedConfPostTrackPolicies', $schedConf->getSetting('postTrackPolicies'));
                 $this->assign('schedConfPostTrackPoliciesOrder', $schedConf->getSetting('postTrackPoliciesOrder'));
                 $this->_addNavMenuItemOrder($schedConf, $navMenuItemOrder, 'TrackPolicies');
                 $this->_addNavMenuItemNavOrder($schedConf, $navMenuItemNavOrder, 'TrackPolicies');
                 $this->assign('schedConfPostPresentations', $schedConf->getSetting('postPresentations'));
                 $this->assign('schedConfPostPresentationsOrder', $schedConf->getSetting('postPresentationsOrder'));
                 $this->_addNavMenuItemOrder($schedConf, $navMenuItemOrder, 'Presentations');
                 $this->_addNavMenuItemOrder($schedConf, $navMenuItemOrder, 'Presentations');
                 $this->assign('schedConfPostLocation', $schedConf->getSetting('postLocation'));
                 $this->assign('schedConfPostLocationOrder', $schedConf->getSetting('postLocationOrder'));
                 $this->_addNavMenuItemOrder($schedConf, $navMenuItemOrder, 'Location');
                 $this->_addNavMenuItemNavOrder($schedConf, $navMenuItemNavOrder, 'Location');
                 $this->assign('schedConfPostAccommodation', $schedConf->getSetting('postAccommodation'));
                 $this->assign('schedConfPostAccommodationOrder', $schedConf->getSetting('postAccommodationOrder'));
                 $this->_addNavMenuItemOrder($schedConf, $navMenuItemOrder, 'Accommodation');
                 $this->_addNavMenuItemNavOrder($schedConf, $navMenuItemNavOrder, 'Accommodation');
                 $this->assign('schedConfPostSupporters', $schedConf->getSetting('postSupporters'));
                 $this->assign('schedConfPostSupportersOrder', $schedConf->getSetting('postSupportersOrder'));
                 $this->_addNavMenuItemOrder($schedConf, $navMenuItemOrder, 'Supporters');
                 $this->_addNavMenuItemNavOrder($schedConf, $navMenuItemNavOrder, 'Supporters');
                 // Schedule displayed
                 $postScheduleDate = $schedConf->getSetting('postScheduleDate');
                 if ($postScheduleDate && $currentTime > $postScheduleDate && $schedConf->getSetting('postSchedule')) {
                     $this->assign('schedConfPostSchedule', true);
                 }
                 // Program
                 //if ($schedConf->getSetting('postProgram') && ($schedConf->getSetting('program') || $schedConf->getSetting('programFile'))) {
                 $this->assign('schedConfShowProgram', true);
                 $this->assign('schedConfShowProgramOrder', $schedConf->getSetting('postProgramOrder'));
                 $this->_addNavMenuItemOrder($schedConf, $navMenuItemOrder, 'Program');
                 $this->_addNavMenuItemNavOrder($schedConf, $navMenuItemNavOrder, 'Program');
                 //}
                 // Contact & Contact Email
                 if ($schedConf->getSetting('postContact') && ($schedConf->getSetting('postContact') || $schedConf->getSetting('postContact'))) {
                     $this->assign('schedConfShowContact', true);
                     $this->assign('schedConfShowContactOrder', $schedConf->getSetting('postContactOrder'));
                     $this->_addNavMenuItemOrder($schedConf, $navMenuItemOrder, 'Contact');
                     $this->_addNavMenuItemNavOrder($schedConf, $navMenuItemNavOrder, 'Contact');
                 }
                 if ($schedConf->getSetting('contactEmail') && ($schedConf->getSetting('contactEmail') || $schedConf->getSetting('contactEmail'))) {
                     $this->assign('schedConfContactEmail', $schedConf->getSetting('contactEmail'));
                 }
                 // Submissions open
                 $submissionsOpenDate = $schedConf->getSetting('submissionsOpenDate');
                 $postSubmission = $schedConf->getSetting('postProposalSubmission');
                 $this->assign('submissionsOpenDate', $submissionsOpenDate);
                 $this->assign('schedConfShowProposalSubmissionOrder', $schedConf->getSetting('postProposalSubmissionOrder'));
                 $this->_addNavMenuItemOrder($schedConf, $navMenuItemOrder, 'ProposalSubmission');
                 $this->_addNavMenuItemNavOrder($schedConf, $navMenuItemNavOrder, 'ProposalSubmission');
                 import('payment.ocs.OCSPaymentManager');
                 $paymentManager =& OCSPaymentManager::getManager();
                 $this->assign('schedConfPaymentsEnabled', $paymentManager->isConfigured());
                 // 再加入 $navMenuItems
                 foreach ($navMenuItems as $navItemId => $navItem) {
                     $navItemOrder = 90;
                     if (isset($navItem["order"]) && trim($navItem["order"]) !== "") {
                         $navItemOrder = trim($navItem["order"]);
                     }
                     if (isset($navMenuItemOrder[$navItemOrder]) === FALSE || is_array($navMenuItemOrder[$navItemOrder]) === FALSE) {
                         $navMenuItemOrder[$navItemOrder] = array();
                     }
                     $navMenuItemOrder[$navItemOrder][] = 'schedConfNavItem' . $navItemId;
                     if (isset($navItem["navOrder"]) && trim($navItem["navOrder"]) !== "" && trim($navItem["navOrder"]) !== "0") {
                         $navItemOrder = trim($navItem["order"]);
                         if (isset($navMenuItemNavOrder[$navItemOrder]) === FALSE || is_array($navMenuItemNavOrder[$navItemOrder]) === FALSE) {
                             $navMenuItemNavOrder[$navItemOrder] = array();
                         }
                         $navMenuItemNavOrder[$navItemOrder][] = 'schedConfNavItem' . $navItemId;
                     }
                 }
                 ksort($navMenuItemOrder);
                 $this->assign('schedConfNavMenuItemOrder', $navMenuItemOrder);
                 ksort($navMenuItemNavOrder);
                 $this->assign('schedConfNavMenuItemNavOrder', $navMenuItemNavOrder);
                 //print_r($navMenuItemOrder);
             }
             //if (isset($schedConf)) {
             // Assign conference stylesheet and footer
             $conferenceStyleSheet = $conference->getSetting('conferenceStyleSheet');
             if ($conferenceStyleSheet) {
                 $this->addStyleSheet(Request::getBaseUrl() . '/' . PublicFileManager::getConferenceFilesPath($conference->getId()) . '/' . $conferenceStyleSheet['uploadName']);
             }
             // Assign scheduled conference stylesheet and footer (after conference stylesheet!)
             if ($schedConf) {
                 $schedConfStyleSheet = $schedConf->getSetting('schedConfStyleSheet');
                 if ($schedConfStyleSheet) {
                     $this->addStyleSheet(Request::getBaseUrl() . '/' . PublicFileManager::getSchedConfFilesPath($schedConf->getId()) . '/' . $schedConfStyleSheet['uploadName']);
                 }
             }
         } else {
             // Not within conference context
             // Add the site-wide logo, if set for this locale or the primary locale
             $displayPageHeaderTitle = $site->getLocalizedPageHeaderTitle();
             $this->assign('displayPageHeaderTitle', $displayPageHeaderTitle);
             if (isset($displayPageHeaderTitle['altText'])) {
                 $this->assign('displayPageHeaderTitleAltText', $displayPageHeaderTitle['altText']);
             }
             $this->assign('publicFilesDir', Request::getBaseUrl() . '/' . PublicFileManager::getSiteFilesPath());
         }
     }
 }