当前位置: 首页>>代码示例>>PHP>>正文


PHP Validation::isLoggedIn方法代码示例

本文整理汇总了PHP中Validation::isLoggedIn方法的典型用法代码示例。如果您正苦于以下问题:PHP Validation::isLoggedIn方法的具体用法?PHP Validation::isLoggedIn怎么用?PHP Validation::isLoggedIn使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Validation的用法示例。


在下文中一共展示了Validation::isLoggedIn方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: isCacheable

 /**
  * Determine whether or not the request is cacheable.
  * @return boolean
  */
 function isCacheable()
 {
     if (defined('SESSION_DISABLE_INIT')) {
         return false;
     }
     if (!Config::getVar('general', 'installed')) {
         return false;
     }
     if (!empty($_POST) || Validation::isLoggedIn()) {
         return false;
     }
     if (!PKPRequest::isPathInfoEnabled()) {
         $ok = array('journal', 'page', 'op', 'path');
         if (!empty($_GET) && count(array_diff(array_keys($_GET), $ok)) != 0) {
             return false;
         }
     } else {
         if (!empty($_GET)) {
             return false;
         }
     }
     if (in_array(PKPRequest::getRequestedPage(), array('about', 'announcement', 'help', 'index', 'information', 'rt', 'issue', ''))) {
         return true;
     }
     return false;
 }
开发者ID:Jouper,项目名称:jouper,代码行数:30,代码来源:OJSApplication.inc.php

示例2: define

 /**
  * Used by subclasses to validate access keys when they are allowed.
  * @param $userId int The user this key refers to
  * @param $reviewId int The ID of the review this key refers to
  * @param $newKey string The new key name, if one was supplied; otherwise, the existing one (if it exists) is used
  * @return object Valid user object if the key was valid; otherwise NULL.
  */
 function &validateAccessKey($userId, $reviewId, $newKey = null)
 {
     $press =& Request::getPress();
     if (!$press || !$press->getSetting('reviewerAccessKeysEnabled')) {
         $accessKey = false;
         return $accessKey;
     }
     define('REVIEWER_ACCESS_KEY_SESSION_VAR', 'ReviewerAccessKey');
     import('lib.pkp.classes.security.AccessKeyManager');
     $accessKeyManager = new AccessKeyManager();
     $session =& Request::getSession();
     // Check to see if a new access key is being used.
     if (!empty($newKey)) {
         if (Validation::isLoggedIn()) {
             Validation::logout();
         }
         $keyHash = $accessKeyManager->generateKeyHash($newKey);
         $session->setSessionVar(REVIEWER_ACCESS_KEY_SESSION_VAR, $keyHash);
     } else {
         $keyHash = $session->getSessionVar(REVIEWER_ACCESS_KEY_SESSION_VAR);
     }
     // Now that we've gotten the key hash (if one exists), validate it.
     $accessKey =& $accessKeyManager->validateKey('ReviewerContext', $userId, $keyHash, $reviewId);
     if ($accessKey) {
         $userDao =& DAORegistry::getDAO('UserDAO');
         $user =& $userDao->getUser($accessKey->getUserId(), false);
         return $user;
     }
     // No valid access key -- return NULL.
     return $accessKey;
 }
开发者ID:ramonsodoma,项目名称:omp,代码行数:38,代码来源:ReviewerHandler.inc.php

示例3: isCacheable

 /**
  * Determine whether or not the request is cacheable.
  * @param $request PKPRequest
  * @param $testOnly boolean required for unit test to
  *  bypass session check.
  * @return boolean
  */
 function isCacheable($request, $testOnly = false)
 {
     if (defined('SESSION_DISABLE_INIT') && !$testOnly) {
         return false;
     }
     if (!Config::getVar('general', 'installed')) {
         return false;
     }
     if (!empty($_POST) || Validation::isLoggedIn()) {
         return false;
     }
     if ($request->isPathInfoEnabled()) {
         if (!empty($_GET)) {
             return false;
         }
     } else {
         $application = $this->getApplication();
         $ok = array_merge($application->getContextList(), array('page', 'op', 'path'));
         if (!empty($_GET) && count(array_diff(array_keys($_GET), $ok)) != 0) {
             return false;
         }
     }
     if (in_array($this->getRequestedPage($request), $this->getCacheablePages())) {
         return true;
     }
     return false;
 }
开发者ID:doana,项目名称:pkp-lib,代码行数:34,代码来源:PKPPageRouter.inc.php

示例4: validate

 /**
  * Validate that user is logged in.
  * Redirects to login form if not logged in.
  * @param $loginCheck boolean check if user is logged in
  */
 function validate($loginCheck = true)
 {
     parent::validate();
     if ($loginCheck && !Validation::isLoggedIn()) {
         Validation::redirectLogin();
     }
 }
开发者ID:Rygbee,项目名称:harvester,代码行数:12,代码来源:UserHandler.inc.php

示例5: __construct

 public function __construct()
 {
     // Get paths to system base directories
     $this->baseDir = dirname(dirname(dirname(dirname(dirname(dirname(dirname(dirname(dirname(dirname($_SERVER['SCRIPT_FILENAME']))))))))));
     // Load and execute initialization code
     chdir($this->baseDir);
     define('INDEX_FILE_LOCATION', $this->baseDir . '/index.php');
     require $this->baseDir . '/lib/pkp/includes/bootstrap.inc.php';
     $publicDir = Config::getVar('files', 'public_files_dir');
     $this->baseUrl = Config::getVar('general', 'base_url');
     // Load user variables
     $sessionManager =& SessionManager::getManager();
     $userSession =& $sessionManager->getUserSession();
     $user =& $userSession->getUser();
     if (isset($user)) {
         // User is logged in
         $siteDir = $this->baseDir . '/' . $publicDir . '/site/';
         if (!file_exists($siteDir . '/images/')) {
             import('classes.file.FileManager');
             // Check that the public/site/ directory exists and is writeable
             if (!file_exists($siteDir) || !is_writeable($siteDir)) {
                 die(__('installer.installFilesDirError'));
             }
             // Create the images directory
             if (!FileManager::mkdir($siteDir . '/images/')) {
                 die(__('installer.installFilesDirError'));
             }
         }
         //Check if user's image directory exists, else create it
         if (Validation::isLoggedIn() && !file_exists($siteDir . '/images/' . $user->getUsername())) {
             import('classes.file.FileManager');
             // Check that the public/site/images/ directory exists and is writeable
             if (!file_exists($siteDir . '/images/') || !is_writeable($siteDir . '/images/')) {
                 die(__('installer.installFilesDirError'));
             }
             // Create the directory to store the user's images
             if (!FileManager::mkdir($siteDir . '/images/' . $user->getUsername())) {
                 die(__('installer.installFilesDirError'));
             }
             $this->imageDir = $publicDir . '/site/images/' . $user->getUsername();
         } else {
             if (Validation::isLoggedIn()) {
                 // User's image directory already exists
                 $this->imageDir = $publicDir . '/site/images/' . $user->getUsername();
             }
         }
     } else {
         // Not logged in; Do not allow images to be uploaded
         $this->imageDir = null;
     }
     // Set the base directory back to its original location
     chdir(dirname($_SERVER['SCRIPT_FILENAME']));
 }
开发者ID:yuricampos,项目名称:ojs,代码行数:53,代码来源:integratePKP.php

示例6: registerUser

 /**
  * Validate user registration information and register new user.
  * @param $args array
  * @param $request PKPRequest
  */
 function registerUser($args, &$request)
 {
     $this->validate($request);
     $this->setupTemplate($request, true);
     import('classes.user.form.RegistrationForm');
     if (checkPhpVersion('5.0.0')) {
         // WARNING: This form needs $this in constructor
         $regForm = new RegistrationForm();
     } else {
         $regForm =& new RegistrationForm();
     }
     $regForm->readInputData();
     if ($regForm->validate()) {
         $regForm->execute();
         $reason = null;
         if (Config::getVar('security', 'implicit_auth')) {
             Validation::login('', '', $reason);
         } else {
             Validation::login($regForm->getData('username'), $regForm->getData('password'), $reason);
         }
         if (!Validation::isLoggedIn()) {
             if (Config::getVar('email', 'require_validation')) {
                 // Inform the user that they need to deal with the
                 // registration email.
                 $this->setupTemplate($request, true);
                 $templateMgr =& TemplateManager::getManager();
                 $templateMgr->assign('pageTitle', 'user.register.emailValidation');
                 $templateMgr->assign('errorMsg', 'user.register.emailValidationDescription');
                 $templateMgr->assign('backLink', $request->url(null, 'login'));
                 $templateMgr->assign('backLinkLabel', 'user.login');
                 return $templateMgr->display('common/error.tpl');
             }
         }
         if ($reason !== null) {
             $this->setupTemplate($request, true);
             $templateMgr =& TemplateManager::getManager();
             $templateMgr->assign('pageTitle', 'user.login');
             $templateMgr->assign('errorMsg', $reason == '' ? 'user.login.accountDisabled' : 'user.login.accountDisabledWithReason');
             $templateMgr->assign('errorParams', array('reason' => $reason));
             $templateMgr->assign('backLink', $request->url(null, 'login'));
             $templateMgr->assign('backLinkLabel', 'user.login');
             return $templateMgr->display('common/error.tpl');
         }
         if ($source = $request->getUserVar('source')) {
             $request->redirectUrl($source);
         } else {
             $request->redirect(null, 'login');
         }
     } else {
         $regForm->display();
     }
 }
开发者ID:farhanabbas1983,项目名称:ojs-1,代码行数:57,代码来源:RegistrationHandler.inc.php

示例7: effect

 /**
  * @see AuthorizationPolicy::effect()
  */
 function effect()
 {
     if (is_a($this->_router, 'PKPPageRouter')) {
         $page = $this->_router->getRequestedPage($this->_request);
     } else {
         $page = null;
     }
     if (Validation::isLoggedIn() || in_array($page, $this->_getLoginExemptions())) {
         return AUTHORIZATION_PERMIT;
     } else {
         return AUTHORIZATION_DENY;
     }
 }
开发者ID:EreminDm,项目名称:water-cao,代码行数:16,代码来源:RestrictedSiteAccessPolicy.inc.php

示例8: index

 function index($args)
 {
     import('classes.payment.ojs.OJSPaymentManager');
     $paymentManager =& OJSPaymentManager::getManager();
     $journal =& Request::getJournal();
     if (!Validation::isLoggedIn()) {
         Validation::redirectLogin("payment.loginRequired.forDonation");
     }
     $user =& Request::getUser();
     $queuedPayment =& $paymentManager->createQueuedPayment($journal->getId(), PAYMENT_TYPE_DONATION, $user->getId(), 0, 0);
     $queuedPaymentId = $paymentManager->queuePayment($queuedPayment);
     $paymentManager->displayPaymentForm($queuedPaymentId, $queuedPayment);
 }
开发者ID:JovanyJeff,项目名称:hrp,代码行数:13,代码来源:DonationsHandler.inc.php

示例9: validate

 /**
  * Perform request access validation based on security settings.
  * @param $requiresJournal boolean
  */
 function validate($requiresJournal = false)
 {
     if (Config::getVar('security', 'force_ssl') && Request::getProtocol() != 'https') {
         // Force SSL connections site-wide
         Request::redirectSSL();
     }
     $journal = Request::getJournal();
     if ($requiresJournal && $journal == null) {
         // Requested page is only allowed for journals
         Request::redirect(null, 'about');
     }
     $page = Request::getRequestedPage();
     if ($journal != null && !Validation::isLoggedIn() && !in_array($page, Handler::getLoginExemptions()) && $journal->getSetting('restrictSiteAccess')) {
         Request::redirect(null, 'login');
     }
 }
开发者ID:alenoosh,项目名称:ojs,代码行数:20,代码来源:Handler.inc.php

示例10: initialize


//.........这里部分代码省略.........
         if ($dispatcher = $this->_request->getDispatcher()) {
             $this->addStyleSheet('pkpLib', $dispatcher->url($this->_request, ROUTE_COMPONENT, null, 'page.PageHandler', 'css'), array('priority' => STYLE_SEQUENCE_CORE, 'contexts' => 'backend'));
         }
         // Add reading language flag based on locale
         $this->assign('currentLocaleLangDir', AppLocale::getLocaleDirection($locale));
         // If there's a locale-specific stylesheet, add it.
         if (($localeStyleSheet = AppLocale::getLocaleStyleSheet($locale)) != null) {
             $this->addStyleSheet('pkpLibLocale', $this->_request->getBaseUrl() . '/' . $localeStyleSheet, array('contexts' => array('frontend', 'backend')));
         }
         // Register colour picker assets on the appearance page
         $this->addJavaScript('spectrum', $this->_request->getBaseUrl() . '/lib/pkp/js/lib/jquery/plugins/spectrum/spectrum.js', array('contexts' => array('backend-management-settings', 'backend-admin-settings', 'backend-admin-contexts')));
         $this->addStyleSheet('spectrum', $this->_request->getBaseUrl() . '/lib/pkp/js/lib/jquery/plugins/spectrum/spectrum.css', array('contexts' => array('backend-management-settings', 'backend-admin-settings', 'backend-admin-contexts')));
         // Register recaptcha on relevant pages
         if (Config::getVar('captcha', 'recaptcha') && Config::getVar('captcha', 'captcha_on_register')) {
             $this->addJavaScript('recaptcha', 'https://www.google.com/recaptcha/api.js', array('contexts' => array('frontend-user-register', 'frontend-user-registerUser')));
         }
         // Register meta tags
         if (Config::getVar('general', 'installed')) {
             if (($this->_request->getRequestedPage() == '' || $this->_request->getRequestedPage() == 'index') && $currentContext && $currentContext->getLocalizedSetting('searchDescription')) {
                 $this->addHeader('searchDescription', '<meta name="description" content="' . $currentContext->getLocalizedSetting('searchDescription') . '">');
             }
             $this->addHeader('generator', '<meta name="generator" content="' . __($application->getNameKey()) . ' ' . $application->getCurrentVersion()->getVersionString(false) . '">', array('contexts' => array('frontend', 'backend')));
             if ($currentContext) {
                 $customHeaders = $currentContext->getLocalizedSetting('customHeaders');
                 if (!empty($customHeaders)) {
                     $this->addHeader('customHeaders', $customHeaders);
                 }
             }
         }
         if ($currentContext && !$currentContext->getEnabled()) {
             $this->addHeader('noindex', '<meta name="robots" content="noindex,nofollow">', array('contexts' => array('frontend', 'backend')));
         }
     }
     // Register custom functions
     $this->register_modifier('translate', array('AppLocale', 'translate'));
     $this->register_modifier('strip_unsafe_html', array('PKPString', 'stripUnsafeHtml'));
     $this->register_modifier('String_substr', array('PKPString', 'substr'));
     $this->register_modifier('dateformatPHP2JQueryDatepicker', array('PKPString', 'dateformatPHP2JQueryDatepicker'));
     $this->register_modifier('to_array', array($this, 'smartyToArray'));
     $this->register_modifier('compare', array($this, 'smartyCompare'));
     $this->register_modifier('concat', array($this, 'smartyConcat'));
     $this->register_modifier('strtotime', array($this, 'smartyStrtotime'));
     $this->register_modifier('explode', array($this, 'smartyExplode'));
     $this->register_modifier('assign', array($this, 'smartyAssign'));
     $this->register_function('csrf', array($this, 'smartyCSRF'));
     $this->register_function('translate', array($this, 'smartyTranslate'));
     $this->register_function('null_link_action', array($this, 'smartyNullLinkAction'));
     $this->register_function('help', array($this, 'smartyHelp'));
     $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('page_links', array($this, 'smartyPageLinks'));
     $this->register_function('page_info', array($this, 'smartyPageInfo'));
     $this->register_function('pluck_files', array($this, 'smartyPluckFiles'));
     // Modified vocabulary for creating forms
     $fbv = $this->getFBV();
     $this->register_block('fbvFormSection', array($fbv, 'smartyFBVFormSection'));
     $this->register_block('fbvFormArea', array($fbv, 'smartyFBVFormArea'));
     $this->register_function('fbvFormButtons', array($fbv, 'smartyFBVFormButtons'));
     $this->register_function('fbvElement', array($fbv, 'smartyFBVElement'));
     $this->assign('fbvStyles', $fbv->getStyles());
     $this->register_function('fieldLabel', array($fbv, 'smartyFieldLabel'));
     // register the resource name "core"
     $coreResource = new PKPTemplateResource($this->core_template_dir);
     $this->register_resource('core', array(array($coreResource, 'fetch'), array($coreResource, 'fetchTimestamp'), array($coreResource, 'getSecure'), array($coreResource, 'getTrusted')));
     $appResource = new PKPTemplateResource($this->app_template_dir);
     $this->register_resource('app', array(array($appResource, 'fetch'), array($appResource, 'fetchTimestamp'), array($appResource, 'getSecure'), array($appResource, 'getTrusted')));
     $this->register_function('url', array($this, 'smartyUrl'));
     // ajax load into a div or any element
     $this->register_function('load_url_in_el', array($this, 'smartyLoadUrlInEl'));
     $this->register_function('load_url_in_div', array($this, 'smartyLoadUrlInDiv'));
     // load stylesheets/scripts/headers from a given context
     $this->register_function('load_stylesheet', array($this, 'smartyLoadStylesheet'));
     $this->register_function('load_script', array($this, 'smartyLoadScript'));
     $this->register_function('load_header', array($this, 'smartyLoadHeader'));
     /**
      * Kludge to make sure no code that tries to connect to the
      * database is executed (e.g., when loading installer pages).
      */
     if (!defined('SESSION_DISABLE_INIT')) {
         $application = PKPApplication::getApplication();
         $this->assign(array('isUserLoggedIn' => Validation::isLoggedIn(), 'isUserLoggedInAs' => Validation::isLoggedInAs(), 'itemsPerPage' => Config::getVar('interface', 'items_per_page'), 'numPageLinks' => Config::getVar('interface', 'page_links')));
         $user = $this->_request->getUser();
         $hasSystemNotifications = false;
         if ($user) {
             $notificationDao = DAORegistry::getDAO('NotificationDAO');
             $notifications = $notificationDao->getByUserId($user->getId(), NOTIFICATION_LEVEL_TRIVIAL);
             if ($notifications->getCount() > 0) {
                 $this->assign('hasSystemNotifications', true);
             }
             // Assign the user name to be used in the sitenav
             $this->assign(array('loggedInUsername' => $user->getUserName(), 'initialHelpState' => (int) $user->getInlineHelp()));
         }
     }
     // Load enabled block plugins and setup active sidebar variables
     PluginRegistry::loadCategory('blocks', true);
     $sidebarHooks = HookRegistry::getHooks('Templates::Common::Sidebar');
     $this->assign(array('hasSidebar' => !empty($sidebarHooks)));
 }
开发者ID:jalperin,项目名称:pkp-lib,代码行数:101,代码来源:PKPTemplateManager.inc.php

示例11: signOut

 /**
  * Log a user out.
  */
 function signOut()
 {
     $this->validate();
     $this->setupTemplate();
     if (Validation::isLoggedIn()) {
         Validation::logout();
     }
     $source = Request::getUserVar('source');
     if (isset($source) && !empty($source)) {
         PKPRequest::redirectUrl(Request::getProtocol() . '://' . Request::getServerHost() . $source, false);
     } else {
         PKPRequest::redirect(null, Request::getRequestedPage());
     }
 }
开发者ID:ramonsodoma,项目名称:pkp-lib,代码行数:17,代码来源:PKPLoginHandler.inc.php

示例12: isAuthorized

 /**
  * Check if a user is authorized to access the specified role in the specified press.
  * @param $roleId int
  * @param $pressId optional (e.g., for global site admin role), the ID of the press
  * @return boolean
  */
 function isAuthorized($roleId, $pressId = 0)
 {
     if (!Validation::isLoggedIn()) {
         return false;
     }
     if ($pressId === -1) {
         // Get press ID from request
         $press =& Request::getPress();
         $pressId = $press == null ? 0 : $press->getId();
     }
     $sessionManager =& SessionManager::getManager();
     $session =& $sessionManager->getUserSession();
     $user =& $session->getUser();
     $roleDAO =& DAORegistry::getDAO('RoleDAO');
     return $roleDAO->userHasRole($pressId, $user->getId(), $roleId);
 }
开发者ID:jerico-dev,项目名称:omp,代码行数:22,代码来源:Validation.inc.php

示例13: initialize

 /**
  * Initialize the template manager.
  */
 function initialize()
 {
     // Retrieve the router
     $router = $this->_request->getRouter();
     assert(is_a($router, 'PKPRouter'));
     $this->assign('defaultCharset', Config::getVar('i18n', 'client_charset'));
     $this->assign('basePath', $this->_request->getBasePath());
     $this->assign('baseUrl', $this->_request->getBaseUrl());
     $this->assign('requiresFormRequest', $this->_request->isPost());
     if (is_a($router, 'PKPPageRouter')) {
         $this->assign('requestedPage', $router->getRequestedPage($this->_request));
     }
     $this->assign('currentUrl', $this->_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'));
     $this->assign('timeFormat', Config::getVar('general', 'time_format'));
     $this->assign('allowCDN', Config::getVar('general', 'enable_cdn'));
     $this->assign('useMinifiedJavaScript', Config::getVar('general', 'enable_minified'));
     $this->assign('toggleHelpOnText', __('help.toggleInlineHelpOn'));
     $this->assign('toggleHelpOffText', __('help.toggleInlineHelpOff'));
     $this->assign('currentContext', $this->_request->getContext());
     $locale = AppLocale::getLocale();
     $this->assign('currentLocale', $locale);
     // Add uncompilable styles
     $this->addStyleSheet($this->_request->getBaseUrl() . '/styles/lib.css', STYLE_SEQUENCE_CORE);
     $dispatcher = $this->_request->getDispatcher();
     if ($dispatcher) {
         $this->addStyleSheet($dispatcher->url($this->_request, ROUTE_COMPONENT, null, 'page.PageHandler', 'css'), STYLE_SEQUENCE_CORE);
     }
     // If there's a locale-specific stylesheet, add it.
     if (($localeStyleSheet = AppLocale::getLocaleStyleSheet($locale)) != null) {
         $this->addStyleSheet($this->_request->getBaseUrl() . '/' . $localeStyleSheet);
     }
     $application = PKPApplication::getApplication();
     $this->assign('pageTitle', $application->getNameKey());
     $this->assign('applicationName', __($application->getNameKey()));
     $this->assign('exposedConstants', $application->getExposedConstants());
     $this->assign('jsLocaleKeys', $application->getJSLocaleKeys());
     // Register custom functions
     $this->register_modifier('translate', array('AppLocale', '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('compare', array($this, 'smartyCompare'));
     $this->register_modifier('concat', array($this, 'smartyConcat'));
     $this->register_modifier('escape', array($this, 'smartyEscape'));
     $this->register_modifier('strtotime', array($this, 'smartyStrtotime'));
     $this->register_modifier('explode', array($this, 'smartyExplode'));
     $this->register_modifier('assign', array($this, 'smartyAssign'));
     $this->register_function('translate', array($this, 'smartyTranslate'));
     $this->register_function('null_link_action', array($this, 'smartyNullLinkAction'));
     $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('page_links', array($this, 'smartyPageLinks'));
     $this->register_function('page_info', array($this, 'smartyPageInfo'));
     $this->register_function('icon', array($this, 'smartyIcon'));
     $this->register_modifier('truncate', array($this, 'smartyTruncate'));
     // Modified vocabulary for creating forms
     $fbv = $this->getFBV();
     $this->register_block('fbvFormSection', array($fbv, 'smartyFBVFormSection'));
     $this->register_block('fbvFormArea', array($fbv, 'smartyFBVFormArea'));
     $this->register_function('fbvFormButtons', array($fbv, 'smartyFBVFormButtons'));
     $this->register_function('fbvElement', array($fbv, 'smartyFBVElement'));
     $this->assign('fbvStyles', $fbv->getStyles());
     $this->register_function('fieldLabel', array($fbv, 'smartyFieldLabel'));
     // register the resource name "core"
     $this->register_resource('core', array(array($this, 'smartyResourceCoreGetTemplate'), array($this, 'smartyResourceCoreGetTimestamp'), array($this, 'smartyResourceCoreGetSecure'), array($this, 'smartyResourceCoreGetTrusted')));
     $this->register_function('url', array($this, 'smartyUrl'));
     // ajax load into a div
     $this->register_function('load_url_in_div', array($this, 'smartyLoadUrlInDiv'));
     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());
         $this->assign('isUserLoggedInAs', Validation::isLoggedInAs());
         $application = PKPApplication::getApplication();
         $currentVersion = $application->getCurrentVersion();
         $this->assign('currentVersionString', $currentVersion->getVersionString(false));
         $this->assign('itemsPerPage', Config::getVar('interface', 'items_per_page'));
         $this->assign('numPageLinks', Config::getVar('interface', 'page_links'));
     }
     // Load enabled block plugins.
     PluginRegistry::loadCategory('blocks', true);
     if (!defined('SESSION_DISABLE_INIT')) {
         $user = $this->_request->getUser();
         $hasSystemNotifications = false;
         if ($user) {
             // Assign the user name to be used in the sitenav
             $this->assign('loggedInUsername', $user->getUserName());
//.........这里部分代码省略.........
开发者ID:doana,项目名称:pkp-lib,代码行数:101,代码来源:PKPTemplateManager.inc.php

示例14: validate

 /**
  * Validation
  * @param $request PKPRequest
  * @param $articleId int
  */
 function validate(&$request, $articleId)
 {
     parent::validate();
     $journal =& $request->getJournal();
     $journalId = $journal->getId();
     $journalSettingsDao =& DAORegistry::getDAO('JournalSettingsDAO');
     $publishedArticleDao =& DAORegistry::getDAO('PublishedArticleDAO');
     $article =& $publishedArticleDao->getPublishedArticleByArticleId($articleId);
     // Bring in comment constants
     $commentDao =& DAORegistry::getDAO('CommentDAO');
     $enableComments = $journal->getSetting('enableComments');
     if (!Validation::isLoggedIn() && $journalSettingsDao->getSetting($journalId, 'restrictArticleAccess') || $article && !$article->getEnableComments() || $enableComments != COMMENTS_ANONYMOUS && $enableComments != COMMENTS_AUTHENTICATED && $enableComments != COMMENTS_UNAUTHENTICATED) {
         Validation::redirectLogin();
     }
     // Subscription Access
     $issueDao =& DAORegistry::getDAO('IssueDAO');
     $issue =& $issueDao->getIssueByArticleId($articleId);
     if (isset($issue) && isset($article)) {
         import('classes.issue.IssueAction');
         $subscriptionRequired = IssueAction::subscriptionRequired($issue);
         $subscribedUser = IssueAction::subscribedUser($journal, $issue->getId(), $articleId);
         if (!(!$subscriptionRequired || $article->getAccessStatus() == ARTICLE_ACCESS_OPEN || $subscribedUser)) {
             $request->redirect(null, 'index');
         }
     } else {
         $request->redirect(null, 'index');
     }
     $this->issue =& $issue;
     $this->article =& $article;
     return true;
 }
开发者ID:yuricampos,项目名称:ojs,代码行数:36,代码来源:CommentHandler.inc.php

示例15: validate

 /**
  * Validation
  * @see lib/pkp/classes/handler/PKPHandler#validate()
  * @param $request Request
  * @param $issueId int
  * @param $galleyId int
  */
 function validate($request, $issueId = null, $galleyId = null)
 {
     $returner = parent::validate(null, $request);
     // Validate requests that don't specify an issue or galley
     if (!$issueId && !$galleyId) {
         return $returner;
     }
     // Require an issue id to continue
     if (!$issueId) {
         $request->redirect(null, 'index');
     }
     import('classes.issue.IssueAction');
     $journal =& $request->getJournal();
     $journalId = $journal->getId();
     $user =& $request->getUser();
     $userId = $user ? $user->getId() : 0;
     $issue = null;
     $galley = null;
     // Get the issue
     $issueDao =& DAORegistry::getDAO('IssueDAO');
     if ($journal->getSetting('enablePublicIssueId')) {
         $issue =& $issueDao->getIssueByBestIssueId($issueId, $journalId);
     } else {
         $issue =& $issueDao->getIssueById((int) $issueId, null, true);
     }
     // Invalid issue id, redirect to current issue
     if (!$issue || !$this->_isVisibleIssue($issue, $journalId)) {
         $request->redirect(null, null, 'current');
     }
     $this->setIssue($issue);
     // If no issue galley id provided, then we're done
     if (!$galleyId) {
         return true;
     }
     // Get the issue galley
     $galleyDao =& DAORegistry::getDAO('IssueGalleyDAO');
     if ($journal->getSetting('enablePublicGalleyId')) {
         $galley =& $galleyDao->getGalleyByBestGalleyId($galleyId, $issue->getId());
     } else {
         $galley =& $galleyDao->getGalley($galleyId, $issue->getId());
     }
     // Invalid galley id, redirect to issue page
     if (!$galley) {
         $request->redirect(null, null, 'view', $issueId);
     }
     $this->setGalley($galley);
     // If this is an editorial user who can view unpublished issue galleys,
     // bypass further validation
     if (IssueAction::allowedIssuePrePublicationAccess($journal)) {
         return true;
     }
     // Ensure reader has rights to view the issue galley
     if ($issue->getPublished()) {
         $subscriptionRequired = IssueAction::subscriptionRequired($issue);
         $isSubscribedDomain = IssueAction::subscribedDomain($journal, $issueId);
         // Check if login is required for viewing.
         if (!$isSubscribedDomain && !Validation::isLoggedIn() && $journal->getSetting('restrictArticleAccess')) {
             Validation::redirectLogin();
         }
         // If no domain/ip subscription, check if user has a valid subscription
         // or if the user has previously purchased the issue
         if (!$isSubscribedDomain && $subscriptionRequired) {
             // Check if user has a valid subscription
             $subscribedUser = IssueAction::subscribedUser($journal, $issueId);
             if (!$subscribedUser) {
                 // Check if payments are enabled,
                 import('classes.payment.ojs.OJSPaymentManager');
                 $paymentManager = new OJSPaymentManager($request);
                 if ($paymentManager->purchaseIssueEnabled() || $paymentManager->membershipEnabled()) {
                     // If only pdf files are being restricted, then approve all non-pdf galleys
                     // and continue checking if it is a pdf galley
                     if ($paymentManager->onlyPdfEnabled() && !$galley->isPdfGalley()) {
                         return true;
                     }
                     if (!Validation::isLoggedIn()) {
                         Validation::redirectLogin("payment.loginRequired.forIssue");
                     }
                     // If the issue galley has been purchased, then allow reader access
                     $completedPaymentDao =& DAORegistry::getDAO('OJSCompletedPaymentDAO');
                     $dateEndMembership = $user->getSetting('dateEndMembership', 0);
                     if ($completedPaymentDao->hasPaidPurchaseIssue($userId, $issueId) || !is_null($dateEndMembership) && $dateEndMembership > time()) {
                         return true;
                     } else {
                         // Otherwise queue an issue purchase payment and display payment form
                         $queuedPayment =& $paymentManager->createQueuedPayment($journalId, PAYMENT_TYPE_PURCHASE_ISSUE, $userId, $issueId, $journal->getSetting('purchaseIssueFee'));
                         $queuedPaymentId = $paymentManager->queuePayment($queuedPayment);
                         $templateMgr =& TemplateManager::getManager();
                         $paymentManager->displayPaymentForm($queuedPaymentId, $queuedPayment);
                         exit;
                     }
                 }
                 if (!Validation::isLoggedIn()) {
                     Validation::redirectLogin("reader.subscriptionRequiredLoginText");
//.........这里部分代码省略.........
开发者ID:farhanabbas1983,项目名称:ojs-1,代码行数:101,代码来源:IssueHandler.inc.php


注:本文中的Validation::isLoggedIn方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。