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


PHP XenForo_Application::getSession方法代码示例

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


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

示例1: get

 public static function get($key)
 {
     if (self::$_options === null) {
         self::$_options = XenForo_Application::get('options');
     }
     switch ($key) {
         case 'applicationVersionId':
             return XenForo_Application::$versionId;
         case 'cacheCutoffDays':
             return 7;
         case 'indexTabId':
             return 'WidgetFramework_home';
         case 'layoutEditorEnabled':
             if (self::$_layoutEditorEnabled === null) {
                 if (!XenForo_Application::isRegistered('session')) {
                     // no session yet...
                     return false;
                 }
                 $session = XenForo_Application::getSession();
                 self::$_layoutEditorEnabled = $session->get('_WidgetFramework_layoutEditor') === true;
                 if (!self::$_layoutEditorEnabled and !empty($_REQUEST['_layoutEditor'])) {
                     $visitor = XenForo_Visitor::getInstance();
                     if ($visitor->hasAdminPermission('style')) {
                         self::$_layoutEditorEnabled = true;
                     }
                 }
             }
             // use the cached value
             return self::$_layoutEditorEnabled;
     }
     return self::$_options->get('wf_' . $key);
 }
开发者ID:maitandat1507,项目名称:bdWidgetFramework,代码行数:32,代码来源:Option.php

示例2: actionIndex

 /**
  * List of currently online users.
  *
  * @return XenForo_ControllerResponse_Abstract
  */
 public function actionIndex()
 {
     if (!$this->_getUserModel()->canViewMemberList()) {
         return $this->responseNoPermission();
     }
     $sessionModel = $this->_getSessionModel();
     $page = $this->_input->filterSingle('page', XenForo_Input::UINT);
     $userPerPage = XenForo_Application::get('options')->membersPerPage;
     $bypassUserPrivacy = $this->_getUserModel()->canBypassUserPrivacy();
     $userLimit = $this->_input->filterSingle('type', XenForo_Input::STRING);
     $conditions = array('userLimit' => $userLimit, 'cutOff' => array('>', $sessionModel->getOnlineStatusTimeout()), 'getInvisible' => $bypassUserPrivacy, 'getUnconfirmed' => $bypassUserPrivacy, 'forceInclude' => $bypassUserPrivacy ? false : XenForo_Visitor::getUserId());
     $onlineUsers = $sessionModel->getSessionActivityRecords($conditions, array('perPage' => $userPerPage, 'page' => $page, 'join' => XenForo_Model_Session::FETCH_USER_FULL, 'order' => 'view_date'));
     $session = XenForo_Application::getSession();
     foreach ($onlineUsers as &$online) {
         if ($online['robot_key']) {
             $online['robotInfo'] = $session->getRobotInfo($online['robot_key']);
         }
         $online['ipHex'] = bin2hex($online['ip']);
         $online['canViewCurrentActivity'] = $this->_getUserModel()->canViewUserCurrentActivity($online);
     }
     $visitor = XenForo_Visitor::getInstance();
     //TODO: this is taken directly from the forum list, could be faster if just counts
     $onlineTotals = $sessionModel->getSessionActivityQuickList($visitor->toArray(), array('cutOff' => array('>', $sessionModel->getOnlineStatusTimeout())), $visitor['user_id'] ? $visitor->toArray() : null);
     $viewParams = array('onlineUsers' => $sessionModel->addSessionActivityDetailsToList($onlineUsers), 'totalOnlineUsers' => $sessionModel->countSessionActivityRecords($conditions), 'userLimit' => $userLimit, 'page' => $page, 'usersPerPage' => $userPerPage, 'canViewIps' => $this->_getUserModel()->canViewIps(), 'onlineTotals' => $onlineTotals);
     return $this->responseView('XenForo_ViewPublic_Online_List', 'online_list', $viewParams);
 }
开发者ID:VoDongMy,项目名称:xenforo-laravel5.1,代码行数:31,代码来源:Online.php

示例3: prepareDiscoveryParams

 public static function prepareDiscoveryParams(array &$params, Zend_Controller_Response_Http $response, $topicType, $topicId, $selfLink, $subscriptionOption)
 {
     if (!bdApi_Option::getSubscription($topicType)) {
         // subscription for this topic type has been disabled
         return false;
     }
     // subscription discovery
     $hubLink = bdApi_Data_Helper_Core::safeBuildApiLink('subscriptions', null, array('hub.topic' => bdApi_Model_Subscription::getTopic($topicType, $topicId), 'oauth_token' => ''));
     $response->setHeader('Link', sprintf('<%s>; rel=hub', $hubLink));
     $response->setHeader('Link', sprintf('<%s>; rel=self', $selfLink));
     // subscription info
     if (!empty($subscriptionOption)) {
         $subscriptionOption = @unserialize($subscriptionOption);
         if (!empty($subscriptionOption['subscriptions'])) {
             /* @var $session bdApi_Session */
             $session = XenForo_Application::getSession();
             $clientId = $session->getOAuthClientId();
             foreach ($subscriptionOption['subscriptions'] as $subscription) {
                 if ($subscription['client_id'] == $clientId) {
                     $params['subscription_callback'] = $subscription['callback'];
                 }
             }
         }
     }
     return true;
 }
开发者ID:billyprice1,项目名称:bdApi,代码行数:26,代码来源:Subscription.php

示例4: getAttachmentTempHash

 public function getAttachmentTempHash(array $contentData = array())
 {
     $prefix = '';
     $inputHash = $this->_controller->getInput()->filterSingle('attachment_hash', XenForo_Input::STRING);
     if (!empty($inputHash)) {
         $prefix = sprintf('hash%s', $inputHash);
     } elseif (!empty($contentData['post_id'])) {
         $prefix = sprintf('post%d', $contentData['post_id']);
     } elseif (!empty($contentData['thread_id'])) {
         $prefix = sprintf('thread%d', $contentData['thread_id']);
     } elseif (!empty($contentData['forum_id'])) {
         $prefix = sprintf('node%d', $contentData['forum_id']);
     } elseif (!empty($contentData['node_id'])) {
         $prefix = sprintf('node%d', $contentData['node_id']);
     } elseif (!empty($contentData['message_id'])) {
         $prefix = sprintf('message%d', $contentData['message_id']);
     } elseif (!empty($contentData['conversation_id'])) {
         $prefix = sprintf('conversation%d', $contentData['conversation_id']);
     }
     /* @var $session bdApi_Session */
     $session = XenForo_Application::getSession();
     $clientId = $session->getOAuthClientId();
     $visitorUserId = XenForo_Visitor::getUserId();
     return md5(sprintf('prefix%s_client%s_visitor%d_salt%s', $prefix, $clientId, $visitorUserId, XenForo_Application::getConfig()->get('globalSalt')));
 }
开发者ID:burtay,项目名称:bdApi,代码行数:25,代码来源:Attachment.php

示例5: actionExternal

 public function actionExternal()
 {
     $this->_assertPostOnly();
     $providerCode = $this->_input->filterSingle('provider', XenForo_Input::STRING);
     $provider = bdApiConsumer_Option::getProviderByCode($providerCode);
     if (empty($provider)) {
         return $this->responseNoPermission();
     }
     $externalUserId = $this->_input->filterSingle('external_user_id', XenForo_Input::UINT);
     if (empty($externalUserId)) {
         return $this->responseNoPermission();
     }
     if (!bdApiConsumer_Helper_Api::verifyJsSdkSignature($provider, $_REQUEST)) {
         return $this->responseNoPermission();
     }
     $userModel = $this->_getUserModel();
     /** @var bdApiConsumer_XenForo_Model_UserExternal $userExternalModel */
     $userExternalModel = $this->getModelFromCache('XenForo_Model_UserExternal');
     $existingAssoc = $userExternalModel->getExternalAuthAssociation($userExternalModel->bdApiConsumer_getProviderCode($provider), $externalUserId);
     if (!empty($existingAssoc)) {
         $accessToken = $userExternalModel->bdApiConsumer_getAccessTokenFromAuth($provider, $existingAssoc);
         if (empty($accessToken)) {
             // no access token in the auth, consider no auth at all
             $existingAssoc = null;
         }
     }
     if (empty($existingAssoc)) {
         $autoRegister = bdApiConsumer_Option::get('autoRegister');
         if ($autoRegister === 'on' or $autoRegister === 'id_sync') {
             // we have to do a refresh here
             return $this->responseRedirect(XenForo_ControllerResponse_Redirect::SUCCESS, XenForo_Link::buildPublicLink('canonical:register/external', null, array('provider' => $providerCode, 'reg' => 1, 'redirect' => $this->getDynamicRedirect())), new XenForo_Phrase('bdapi_consumer_being_auto_login_auto_register_x', array('provider' => $provider['name'])));
         }
     }
     if (!$existingAssoc) {
         return $this->responseError(new XenForo_Phrase('bdapi_consumer_auto_login_with_x_failed', array('provider' => $provider['name'])));
     }
     $user = $userModel->getFullUserById($existingAssoc['user_id']);
     if (empty($user)) {
         return $this->responseError(new XenForo_Phrase('requested_user_not_found'));
     }
     if (XenForo_Application::$versionId > 1050000) {
         /** @var XenForo_ControllerHelper_Login $loginHelper */
         $loginHelper = $this->getHelper('Login');
         if ($loginHelper->userTfaConfirmationRequired($user)) {
             $loginHelper->setTfaSessionCheck($user['user_id']);
             return $this->responseMessage(new XenForo_Phrase('bdapi_consumer_auto_login_user_x_requires_tfa', array('username' => $user['username'], 'twoStepLink' => XenForo_Link::buildPublicLink('login/two-step', null, array('redirect' => $this->getDynamicRedirect(), 'remember' => 1)))));
         }
     }
     $userModel->setUserRememberCookie($user['user_id']);
     XenForo_Model_Ip::log($user['user_id'], 'user', $user['user_id'], 'login_api_consumer');
     $userModel->deleteSessionActivity(0, $this->_request->getClientIp(false));
     if (XenForo_Application::$versionId < 1050000) {
         XenForo_Application::getSession()->changeUserId($user['user_id']);
         XenForo_Visitor::setup($user['user_id']);
     } else {
         $visitor = XenForo_Visitor::setup($user['user_id']);
         XenForo_Application::getSession()->userLogin($user['user_id'], $visitor['password_date']);
     }
     return $this->responseRedirect(XenForo_ControllerResponse_Redirect::SUCCESS, $this->getDynamicRedirect(), new XenForo_Phrase('bdapi_consumer_auto_login_with_x_succeeded_y', array('provider' => $provider['name'], 'username' => $user['username'])));
 }
开发者ID:billyprice1,项目名称:bdApi,代码行数:60,代码来源:Login.php

示例6: actionGetIndex

 public function actionGetIndex()
 {
     /* @var $session bdApi_Session */
     $session = XenForo_Application::getSession();
     $visitor = XenForo_Visitor::getInstance();
     $systemInfo = array();
     if ($session->getOAuthClientId() === '') {
         $systemInfo += array('oauth/authorize' => bdApi_Data_Helper_Core::safeBuildApiLink('oauth/authorize', array(), array('oauth_token' => '')), 'oauth/token' => bdApi_Data_Helper_Core::safeBuildApiLink('oauth/token', array(), array('oauth_token' => '')));
     }
     if ($session->checkScope(bdApi_Model_OAuth2::SCOPE_POST)) {
         $systemInfo = array('api_revision' => 2015121801, 'api_modules' => $this->_getModules());
     }
     $data = array();
     $data['links'] = array('search' => bdApi_Data_Helper_Core::safeBuildApiLink('search'), 'navigation' => bdApi_Data_Helper_Core::safeBuildApiLink('navigation', array(), array('parent' => 0)), 'threads/recent' => bdApi_Data_Helper_Core::safeBuildApiLink('threads/recent'), 'users' => bdApi_Data_Helper_Core::safeBuildApiLink('users'));
     if ($visitor['user_id'] > 0) {
         $data['links']['conversations'] = bdApi_Data_Helper_Core::safeBuildApiLink('conversations');
         $data['links']['forums/followed'] = bdApi_Data_Helper_Core::safeBuildApiLink('forums/followed');
         $data['links']['notifications'] = bdApi_Data_Helper_Core::safeBuildApiLink('notifications');
         $data['links']['threads/followed'] = bdApi_Data_Helper_Core::safeBuildApiLink('threads/followed');
         $data['links']['threads/new'] = bdApi_Data_Helper_Core::safeBuildApiLink('threads/new');
         $data['links']['users/ignored'] = bdApi_Data_Helper_Core::safeBuildApiLink('users/ignored');
         $data['links']['users/me'] = bdApi_Data_Helper_Core::safeBuildApiLink('users', array('user_id' => XenForo_Visitor::getInstance()->toArray()), array('oauth_token' => ''));
         if ($visitor->canUpdateStatus()) {
             $data['post']['status'] = bdApi_Data_Helper_Core::safeBuildApiLink('users/me/timeline');
         }
     }
     $data['system_info'] = $systemInfo;
     return $this->responseData('bdApi_ViewApi_Index', $data);
 }
开发者ID:billyprice1,项目名称:bdApi,代码行数:29,代码来源:Index.php

示例7: logRequest

 public function logRequest($requestMethod, $requestUri, array $requestData, $responseCode, array $responseOutput, array $bulkSet = array())
 {
     $days = bdApi_Option::get('logRetentionDays');
     if ($days == 0) {
         return false;
     }
     $dw = XenForo_DataWriter::create('bdApi_DataWriter_Log');
     $dw->bulkSet($bulkSet);
     if (!isset($bulkSet['client_id'])) {
         /* @var $session bdApi_Session */
         $session = XenForo_Application::getSession();
         $dw->set('client_id', $session->getOAuthClientId());
     }
     if (!isset($bulkSet['user_id'])) {
         $visitor = XenForo_Visitor::getInstance();
         $dw->set('user_id', $visitor->get('user_id'));
     }
     if (!isset($bulkSet['ip_address'])) {
         $dw->set('ip_address', isset($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : '');
     }
     $dw->set('request_date', XenForo_Application::$time);
     $dw->set('request_method', $requestMethod);
     $dw->set('request_uri', $requestUri);
     $dw->set('request_data', $this->_filterData($requestData));
     $dw->set('response_code', $responseCode);
     $dw->set('response_output', $this->_filterData($responseOutput));
     return $dw->save();
 }
开发者ID:billyprice1,项目名称:bdApi,代码行数:28,代码来源:Log.php

示例8: _getSocialNoticesContainerParams

 /**
  * Fetches all notices applicable to the visiting user
  *
  * @param array $params
  * @param array $containerData
  *
  * @return array
  */
 protected function _getSocialNoticesContainerParams(XenForo_ControllerResponse_View $controllerResponse, array $notices = array())
 {
     $socialForum = ThemeHouse_SocialGroups_SocialForum::getInstance();
     /* @var $noticeModel XenForo_Model_Notice */
     $noticeModel = XenForo_Model::create('XenForo_Model_Notice');
     if (XenForo_Application::get('options')->enableNotices) {
         $user = XenForo_Visitor::getInstance()->toArray();
         if (XenForo_Application::isRegistered('session')) {
             $dismissedNotices = XenForo_Application::getSession()->get('dismissedNotices');
         }
         if (!isset($dismissedNotices) || !is_array($dismissedNotices)) {
             $dismissedNotices = array();
         }
         // handle style overrides
         $user['style_id'] = XenForo_Application::get('options')->defaultStyleId;
         $noticeTokens = array('{name}' => $user['username'] !== '' ? $user['username'] : new XenForo_Phrase('guest'), '{user_id}' => $user['user_id']);
         $allNotices = $noticeModel->getNoticesForSocialForum($socialForum['social_forum_id']);
         foreach ($allNotices as $noticeId => $notice) {
             if (!in_array($noticeId, $dismissedNotices) && XenForo_Helper_Criteria::userMatchesCriteria($notice['user_criteria'], true, $user) && XenForo_Helper_Criteria::pageMatchesCriteria($notice['page_criteria'], true, $controllerResponse->params, $controllerResponse->containerParams)) {
                 $notices[$noticeId] = array('title' => $notice['title'], 'message' => str_replace(array_keys($noticeTokens), $noticeTokens, $notice['message']), 'wrap' => $notice['wrap'], 'dismissible' => $notice['dismissible'] && XenForo_Visitor::getUserId());
             }
         }
     }
     return $notices;
 }
开发者ID:ThemeHouse-XF,项目名称:SocialNoticesa,代码行数:33,代码来源:SocialForum.php

示例9: actionIndex

 public function actionIndex()
 {
     $defaultOrder = 'media_date';
     $order = $this->_input->filterSingle('order', XenForo_Input::STRING, array('default' => $defaultOrder));
     $type = $this->_input->filterSingle('type', XenForo_Input::STRING);
     $categoryId = $this->_input->filterSingle('category_id', XenForo_Input::UINT);
     if (!$categoryId) {
         return $this->responseRedirect(XenForo_ControllerResponse_Redirect::RESOURCE_CANONICAL_PERMANENT, XenForo_Link::buildPublicLink('xengallery'));
     }
     $mediaHelper = $this->_getMediaHelper();
     $categoryModel = $this->_getCategoryModel();
     $category = $mediaHelper->assertCategoryValidAndViewable($categoryId);
     $categoryBreadcrumbs = $categoryModel->getCategoryBreadcrumb($category, false);
     $containerCategory = false;
     $uploadUserGroups = unserialize($category['upload_user_groups']);
     if (!$uploadUserGroups) {
         $canAddMedia = false;
         $containerCategory = true;
     } else {
         $canAddMedia = $this->_getMediaModel()->canAddMediaToCategory($uploadUserGroups);
     }
     $page = $this->_input->filterSingle('page', XenForo_Input::UINT);
     $perPage = XenForo_Application::getOptions()->xengalleryMediaMaxPerPage;
     $childIds = array();
     $showCategory = false;
     if ($containerCategory) {
         $childCategories = $categoryModel->getCategoryStructure(null, $categoryId);
         foreach ($childCategories as $child) {
             $childIds[] = $child['category_id'];
         }
         if (!$childCategories) {
             $containerCategory = false;
         }
         $showCategory = true;
     }
     $conditions = array('category_id' => $containerCategory ? $childIds : $categoryId, 'deleted' => XenForo_Permission::hasPermission(XenForo_Visitor::getInstance()->permissions, 'xengallery', 'viewDeleted'), 'type' => $type);
     $fetchOptions = $this->_getMediaFetchOptions() + array('order' => $order ? $order : $defaultOrder, 'page' => $page, 'perPage' => $perPage);
     $mediaModel = $this->_getMediaModel();
     $media = $mediaModel->getMedia($conditions, $fetchOptions);
     $media = $mediaModel->prepareMediaItems($media);
     $inlineModOptions = $mediaModel->prepareInlineModOptions($media, false);
     $ignoredNames = array();
     foreach ($media as $item) {
         if (!empty($item['isIgnored'])) {
             $ignoredNames[] = $item['username'];
         }
     }
     $mediaCount = $mediaModel->countMedia($conditions);
     $this->canonicalizePageNumber($page, $perPage, $mediaCount, 'xengallery/categories', $category);
     $this->canonicalizeRequestUrl(XenForo_Link::buildPublicLink('xengallery/categories', $category, array('page' => $page)));
     $pageNavParams = array('order' => $order != $defaultOrder ? $order : false, 'type' => $type ? $type : false);
     $session = XenForo_Application::getSession();
     $requiresTranscode = $session->get('xfmgVideoRequiresTranscode');
     if ($requiresTranscode) {
         $session->remove('xfmgVideoRequiresTranscode');
     }
     $viewParams = array('category' => $category, 'canWatchCategory' => $categoryModel->canWatchCategory(), 'containerCategory' => $containerCategory, 'showCategory' => $showCategory, 'media' => $media, 'order' => $order, 'defaultOrder' => $defaultOrder, 'type' => $type, 'typeFilter' => $type, 'ignoredNames' => array_unique($ignoredNames), 'mediaCount' => $mediaCount, 'page' => $page <= 1 ? '' : $page, 'perPage' => $perPage, 'canAddMedia' => $canAddMedia, 'canViewRatings' => $mediaModel->canViewRatings(), 'canViewComments' => $this->_getCommentModel()->canViewComments(), 'categoryBreadcrumbs' => $categoryBreadcrumbs, 'inlineModOptions' => $inlineModOptions, 'pageNavParams' => $pageNavParams, 'requiresTranscode' => $requiresTranscode);
     return $this->_getSiteMediaWrapper($categoryId, $this->responseView('XenGallery_ViewPublic_Category_View', 'xengallery_category_view', $viewParams));
 }
开发者ID:VoDongMy,项目名称:xenforo-laravel5.1,代码行数:59,代码来源:Category.php

示例10: isBot

 public static function isBot()
 {
     if (!XenForo_Application::isRegistered('session')) {
         return false;
     }
     $session = XenForo_Application::getSession();
     return $session->get('robotId');
 }
开发者ID:sikhlana,项目名称:XenForo-BotThreadView,代码行数:8,代码来源:Application.php

示例11: getAccountsRequestUrl

 public function getAccountsRequestUrl($redirectUri, $state = null)
 {
     if (is_null($state)) {
         $state = md5(uniqid('xf', true));
     }
     $session = XenForo_Application::getSession();
     $session->set('accountsCsrfState', $state);
     return $this->schema . '://' . $this->api . '/oauth/?client_id=' . $this->clientId . '&redirect_uri=' . urlencode($redirectUri) . '&state=' . $state . '&roles=profile,email' . '&access_type=offline' . '&response_type=code';
 }
开发者ID:anyTV,项目名称:Xenforo_Accounts_Oauth2,代码行数:9,代码来源:Accounts.php

示例12: actionLogin

 public function actionLogin()
 {
     if (!$this->_request->isPost()) {
         return $this->responseRedirect(XenForo_ControllerResponse_Redirect::RESOURCE_CANONICAL, XenForo_Link::buildAdminLink('index'));
     }
     $data = $this->_input->filter(array('login' => XenForo_Input::STRING, 'password' => XenForo_Input::STRING, 'redirect' => XenForo_Input::STRING, 'cookie_check' => XenForo_Input::UINT));
     $redirect = $data['redirect'] ? $data['redirect'] : XenForo_Link::buildAdminLink('index');
     $loginModel = $this->_getLoginModel();
     if ($data['cookie_check'] && count($_COOKIE) == 0) {
         // login came from a page, so we should at least have a session cookie.
         // if we don't, assume that cookies are disabled
         return $this->responseError(new XenForo_Phrase('cookies_required_to_log_in_to_site'));
     }
     $needCaptcha = $loginModel->requireLoginCaptcha($data['login']);
     if ($needCaptcha) {
         // just block logins here instead of using the captcha
         return $this->responseError(new XenForo_Phrase('your_account_has_temporarily_been_locked_due_to_failed_login_attempts'));
     }
     $userModel = $this->_getUserModel();
     $userId = $userModel->validateAuthentication($data['login'], $data['password'], $error);
     if (!$userId) {
         $loginModel->logLoginAttempt($data['login']);
         if ($loginModel->requireLoginCaptcha($data['login'])) {
             return $this->responseError(new XenForo_Phrase('your_account_has_temporarily_been_locked_due_to_failed_login_attempts'));
         }
         if ($this->_input->filterSingle('upgrade', XenForo_Input::UINT)) {
             return $this->responseRedirect(XenForo_ControllerResponse_Redirect::SUCCESS, $redirect);
         } else {
             // note - JSON view will return responseError($text)
             return $this->responseView('XenForo_ViewAdmin_Login_Error', 'login_form', array('text' => $error, 'defaultLogin' => $data['login'], 'redirect' => $redirect), array('containerTemplate' => 'LOGIN_PAGE'));
         }
     }
     $loginModel->clearLoginAttempts($data['login']);
     XenForo_Model_Ip::log($userId, 'user', $userId, 'login_admin');
     $visitor = XenForo_Visitor::setup($userId);
     XenForo_Application::getSession()->userLogin($userId, $visitor['password_date']);
     // if guest on front-end, login there too
     $class = XenForo_Application::resolveDynamicClass('XenForo_Session');
     $publicSession = new $class();
     $publicSession->start();
     if (!$publicSession->get('user_id')) {
         $publicSession->userLogin($userId, $visitor['password_date']);
         $publicSession->save();
     }
     // now check that the user will be able to get into the ACP (is_admin)
     if (!$visitor->is_admin) {
         return $this->responseError(new XenForo_Phrase('your_account_does_not_have_admin_privileges'));
     }
     if ($this->_input->filterSingle('repost', XenForo_Input::UINT)) {
         $postVars = $this->_input->filterSingle('postVars', XenForo_Input::JSON_ARRAY);
         $postVars['_xfToken'] = $visitor['csrf_token_page'];
         return $this->responseRedirect(XenForo_ControllerResponse_Redirect::SUCCESS, $redirect, '', array('repost' => 1, 'postVars' => $postVars));
     } else {
         return $this->responseRedirect(XenForo_ControllerResponse_Redirect::SUCCESS, $redirect);
     }
 }
开发者ID:Sywooch,项目名称:forums,代码行数:56,代码来源:Login.php

示例13: _getKey

 protected static function _getKey()
 {
     /* @var $session bdApi_Session */
     $session = XenForo_Application::getSession();
     $clientSecret = $session->getOAuthClientSecret();
     if (empty($clientSecret)) {
         throw new XenForo_Exception(new XenForo_Phrase('bdapi_request_must_authorize_to_encrypt'), true);
     }
     return $clientSecret;
 }
开发者ID:billyprice1,项目名称:bdApi,代码行数:10,代码来源:Crypt.php

示例14: _getRegisterFormResponse

 protected function _getRegisterFormResponse(array $fields, array $errors = array())
 {
     XenForo_Application::getSession()->set('ct_submit_register_time', time());
     $field_name = CleanTalk_Base_CleanTalk::getCheckjsName();
     $ct_check_def = CleanTalk_Base_CleanTalk::getCheckjsDefaultValue();
     //if (!isset($_COOKIE[$field_name])) {
     setcookie($field_name, $ct_check_def, 0, '/');
     //}
     return parent::_getRegisterFormResponse($fields, $errors);
 }
开发者ID:VladCleantalk,项目名称:xenforo-antispam,代码行数:10,代码来源:CleanTalk.php

示例15: actionGetIndex

 public function actionGetIndex()
 {
     /* @var $session bdApi_Session */
     $session = XenForo_Application::getSession();
     $systemInfo = array();
     if ($session->checkScope(bdApi_Model_OAuth2::SCOPE_POST)) {
         $systemInfo = array('api_revision' => 2014030701, 'api_modules' => $this->_getModules());
     }
     $data = array('links' => array('conversations' => XenForo_Link::buildApiLink('conversations'), 'conversation-messages' => XenForo_Link::buildApiLink('conversation-messages'), 'notifications' => XenForo_Link::buildApiLink('notifications'), 'search' => XenForo_Link::buildApiLink('search'), 'navigation' => XenForo_Link::buildApiLink('navigation', array(), array('parent' => 0)), 'threads' => XenForo_Link::buildApiLink('threads'), 'threads/recent' => XenForo_Link::buildApiLink('threads/recent'), 'threads/new' => XenForo_Link::buildApiLink('threads/new'), 'posts' => XenForo_Link::buildApiLink('posts'), 'users' => XenForo_Link::buildApiLink('users'), 'batch' => XenForo_Link::buildApiLink('batch'), 'subscriptions' => XenForo_Link::buildApiLink('subscriptions'), 'oauth_authorize' => XenForo_Link::buildApiLink('oauth/authorize', array(), array('oauth_token' => '')), 'oauth_token' => XenForo_Link::buildApiLink('oauth/token', array(), array('oauth_token' => ''))), 'system_info' => $systemInfo);
     return $this->responseData('bdApi_ViewApi_Index', $data);
 }
开发者ID:burtay,项目名称:bdApi,代码行数:11,代码来源:Index.php


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