本文整理汇总了PHP中wfSetupSession函数的典型用法代码示例。如果您正苦于以下问题:PHP wfSetupSession函数的具体用法?PHP wfSetupSession怎么用?PHP wfSetupSession使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了wfSetupSession函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: __construct
protected function __construct()
{
// Make sure the session is started
if (session_id() === '') {
wfSetupSession();
}
}
开发者ID:Grprashanthkumar,项目名称:ColfusionWeb,代码行数:7,代码来源:CaptchaStore.php
示例2: startExperiment
/**
* Initialize the experiment and set all required tracking things
*
* @param string $experimentName
* @param array $experimentConfig
*/
private static function startExperiment($experimentName, array $experimentConfig)
{
wfDebug(sprintf("%s[%s] using %s class with %s params\n", __METHOD__, $experimentName, $experimentConfig['handler'], json_encode($experimentConfig['params'])));
new $experimentConfig['handler']($experimentConfig['params'] ?: []);
// mark a transaction with an experiment name
\Transaction::getInstance()->set(\Transaction::PARAM_AB_PERFORMANCE_TEST, $experimentName);
// set a global JS variable with an experiment name
global $wgHooks;
$wgHooks['WikiaSkinTopScripts'][] = function (array &$vars, &$scripts) use($experimentName) {
$vars['wgABPerformanceTest'] = $experimentName;
return true;
};
/*
* Start the session to bypass CDN cache
*
* We don't want to polute the CDN cache with the A/B performance testing tracking data.
* As the test are run for only a small subset of the traffic, start the session for client
* that are in the test groups to bypass the CDN cache.
*/
if (session_id() == '') {
wfSetupSession();
wfDebug(__METHOD__ . " - session started\n");
// log started sessions
global $wgUser;
WikiaLogger::instance()->info(__METHOD__, ['experiment' => $experimentName, 'session_id' => session_id(), 'is_anon' => $wgUser->isAnon()]);
}
}
开发者ID:Tjorriemorrie,项目名称:app,代码行数:33,代码来源:Hooks.class.php
示例3: execute
function execute($par)
{
global $wgOut, $wgRequest, $wgUser, $wgFBAppId, $wgFBAppSecret, $wgLanguageCode, $wgContLang, $IP;
require_once "{$IP}/extensions/wikihow/common/facebook-platform/facebook-php-sdk-771862b/src/facebook.php";
wfLoadExtensionMessages('FBLogin');
if (session_id() == '') {
wfSetupSession();
}
$this->returnto = $wgLanguageCode == 'en' ? wfMsg('fbc_returnto') : "/" . $wgContLang->getNSText(NS_PROJECT) . ":" . wfMsg('communityportal');
//$this->returnto = $_COOKIE['wiki_returnto'] ? $_COOKIE['wiki_returnto'] : "/Special:CommunityDashboard";
$this->userid = $_COOKIE['wiki_fbuser'];
$userid = $this->userid;
if (!$userid) {
$wgOut->addHTML("An error occurred.<!--" . print_r($_COOKIE, true) . "-->");
return;
}
$this->setWgUser();
$this->facebook = new Facebook(array('appId' => $wgFBAppId, 'secret' => $wgFBAppSecret));
$accessToken = $_COOKIE['wiki_fbtoken'];
$this->facebook->setAccessToken($accessToken);
$result = $this->facebook->api('/me');
if (!$wgRequest->wasPosted()) {
// If they still have the FB_* name, show them the registration form with a proposed name
if (strpos($wgUser->getName(), "FB_") !== false) {
$this->printRegForm($result);
} else {
$this->updateAvatar($result);
// All logged in. Return them to wherever they're supposed to go
$this->setCookies();
$wgOut->redirect($this->returnto);
}
} else {
$this->processRegForm($result);
}
}
开发者ID:biribogos,项目名称:wikihow-src,代码行数:35,代码来源:FBLogin.body.php
示例4: startSession
static function startSession()
{
if (session_id() == '') {
wfSetupSession();
}
self::clearCollection();
}
开发者ID:realsoc,项目名称:mediawiki-extensions,代码行数:7,代码来源:Collection.session.php
示例5: execute
function execute($par)
{
global $wgRequest, $wgUser, $wgLanguageCode, $wgContLang, $wgOut;
wfLoadExtensionMessages('GPlusLogin');
if (session_id() == '') {
wfSetupSession();
}
//disconnecting?
if ($wgRequest->getVal('disconnect')) {
self::userDisco();
return;
}
//returning to the community dashboard
$this->returnto = $wgLanguageCode == 'en' ? wfMsg('gpl_returnto') : "/" . $wgContLang->getNSText(NS_PROJECT) . ":" . wfMsg('communityportal');
//set that user (if we can)
$this->userid = $wgRequest->getVal('gplus_id') ? $wgRequest->getVal('gplus_id') : $wgRequest->getVal('user_id');
if ($this->userid) {
$this->setWgUser();
}
if ($wgRequest->wasPosted() && $wgRequest->getVal('gplus_id')) {
self::processForm();
return;
}
//get user's G+ info
$gp_id = $wgRequest->getVal('user_id');
$gp_name = $wgRequest->getVal('user_name');
$gp_email = $wgRequest->getVal('user_email');
$gp_avatar = $wgRequest->getVal('user_avatar');
self::showForm($gp_id, $gp_name, $gp_email, $gp_avatar);
}
开发者ID:biribogos,项目名称:wikihow-src,代码行数:30,代码来源:GPlusLogin.body.php
示例6: attemptAddUser
/**
* @param $user User
* @param $mungedUsername String
* @return bool
*/
public static function attemptAddUser($user, $mungedUsername)
{
/**
* @var $wgAuth LdapAuthenticationPlugin
*/
global $wgAuth;
if (!$wgAuth->autoCreate()) {
$wgAuth->printDebug("Cannot automatically create accounts.", NONSENSITIVE);
return false;
}
$wgAuth->printDebug("User does not exist in local database; creating.", NONSENSITIVE);
// Checks passed, create the user
$user->loadDefaults($mungedUsername);
$status = $user->addToDatabase();
if ($status !== null && !$status->isOK()) {
$wgAuth->printDebug("Creation failed: " . $status->getWikiText(), NONSENSITIVE);
return false;
}
$wgAuth->initUser($user, true);
$user->setCookies();
wfSetupSession();
# Update user count
$ssUpdate = new SiteStatsUpdate(0, 0, 0, 0, 1);
$ssUpdate->doUpdate();
# Notify hooks (e.g. Newuserlog)
wfRunHooks('AuthPluginAutoCreate', array($user));
return true;
}
开发者ID:nahoj,项目名称:mediawiki_ynh,代码行数:33,代码来源:LdapAutoAuthentication.php
示例7: setUp
/**
* Fixture -- run before every test
*/
protected function setUp()
{
parent::setUp();
$this->setMwGlobals(array('wgEnableUploads' => true, 'wgEnableAPI' => true));
wfSetupSession();
$this->clearFakeUploads();
}
开发者ID:Habatchii,项目名称:wikibase-for-mediawiki,代码行数:10,代码来源:ApiTestCaseUpload.php
示例8: newFromToken
/**
* Creates a MediaWiki User object based on the token given in the HTTP request.
*
* @param \WebRequest $request the HTTP request data as an object
*
* @return \User on successful authentication
*/
public static function newFromToken(\WebRequest $request)
{
// Extract access token from HTTP request data.
$token = self::getAccessToken($request);
// Authenticate with the token, if present.
if ($token) {
global $wgHeliosBaseUri, $wgHeliosClientId, $wgHeliosClientSecret;
$heliosClient = new Client($wgHeliosBaseUri, $wgHeliosClientId, $wgHeliosClientSecret);
// start the session if there's none so far
// the code is borrowed from SpecialUserlogin
// @see PLATFORM-1261
if (session_id() == '') {
wfSetupSession();
WikiaLogger::instance()->debug(__METHOD__ . '::startSession');
}
try {
$tokenInfo = $heliosClient->info($token);
if (!empty($tokenInfo->user_id)) {
$user = \User::newFromId($tokenInfo->user_id);
// dont return the user object if it's disabled
// @see SERVICES-459
if ((bool) $user->getGlobalFlag('disabled')) {
self::clearAccessTokenCookie();
return null;
}
// return a MediaWiki's User object
return $user;
}
} catch (ClientException $e) {
WikiaLogger::instance()->error(__METHOD__, ['exception' => $e]);
}
}
return null;
}
开发者ID:yusufchang,项目名称:app,代码行数:41,代码来源:User.class.php
示例9: execute
/**
* Executes the log-in attempt using the parameters passed. If
* the log-in succeeeds, it attaches a cookie to the session
* and outputs the user id, username, and session token. If a
* log-in fails, as the result of a bad password, a nonexistant
* user, or any other reason, the host is cached with an expiry
* and no log-in attempts will be accepted until that expiry
* is reached. The expiry is $this->mLoginThrottle.
*
* @access public
*/
public function execute()
{
$name = $password = $domain = null;
extract($this->extractRequestParams());
$result = array();
// Make sure noone is trying to guess the password brut-force
$nextLoginIn = $this->getNextLoginTimeout();
if ($nextLoginIn > 0) {
$result['result'] = 'NeedToWait';
$result['details'] = "Please wait {$nextLoginIn} seconds before next log-in attempt";
$result['wait'] = $nextLoginIn;
$this->getResult()->addValue(null, 'login', $result);
return;
}
$params = new FauxRequest(array('wpName' => $name, 'wpPassword' => $password, 'wpDomain' => $domain, 'wpRemember' => ''));
// Init session if necessary
if (session_id() == '') {
wfSetupSession();
}
$loginForm = new LoginForm($params);
switch ($loginForm->authenticateUserData()) {
case LoginForm::SUCCESS:
global $wgUser, $wgCookiePrefix;
$wgUser->setOption('rememberpassword', 1);
$wgUser->setCookies();
$result['result'] = 'Success';
$result['lguserid'] = $_SESSION['wsUserID'];
$result['lgusername'] = $_SESSION['wsUserName'];
$result['lgtoken'] = $_SESSION['wsToken'];
$result['cookieprefix'] = $wgCookiePrefix;
$result['sessionid'] = session_id();
break;
case LoginForm::NO_NAME:
$result['result'] = 'NoName';
break;
case LoginForm::ILLEGAL:
$result['result'] = 'Illegal';
break;
case LoginForm::WRONG_PLUGIN_PASS:
$result['result'] = 'WrongPluginPass';
break;
case LoginForm::NOT_EXISTS:
$result['result'] = 'NotExists';
break;
case LoginForm::WRONG_PASS:
$result['result'] = 'WrongPass';
break;
case LoginForm::EMPTY_PASS:
$result['result'] = 'EmptyPass';
break;
default:
ApiBase::dieDebug(__METHOD__, 'Unhandled case value');
}
if ($result['result'] != 'Success') {
$result['wait'] = $this->cacheBadLogin();
$result['details'] = "Please wait " . self::THROTTLE_TIME . " seconds before next log-in attempt";
}
// if we were allowed to try to login, memcache is fine
$this->getResult()->addValue(null, 'login', $result);
}
开发者ID:ErdemA,项目名称:wikihow,代码行数:71,代码来源:ApiLogin.php
示例10: __construct
function __construct()
{
SpecialPage::__construct('PromoterAds');
// Make sure we have a session
wfSetupSession();
// Load things that may have been serialized into the session
$this->adFilterString = $this->getPRSessionVar('adFilterString', '');
}
开发者ID:kolzchut,项目名称:mediawiki-extensions-Promoter,代码行数:8,代码来源:SpecialPromoterAds.php
示例11: show
public function show()
{
if (session_id() === '') {
// Send a cookie so anons get talk message notifications
wfSetupSession();
}
parent::show();
}
开发者ID:MediaWiki-stable,项目名称:1.26.1,代码行数:8,代码来源:SubmitAction.php
示例12: execute
/**
* Executes the log-in attempt using the parameters passed. If
* the log-in succeeeds, it attaches a cookie to the session
* and outputs the user id, username, and session token. If a
* log-in fails, as the result of a bad password, a nonexistent
* user, or any other reason, the host is cached with an expiry
* and no log-in attempts will be accepted until that expiry
* is reached. The expiry is $this->mLoginThrottle.
*
* @access public
*/
public function execute()
{
$params = $this->extractRequestParams();
$result = array();
$req = new FauxRequest(array('wpName' => $params['name'], 'wpPassword' => $params['password'], 'wpDomain' => $params['domain'], 'wpRemember' => ''));
// Init session if necessary
if (session_id() == '') {
wfSetupSession();
}
$loginForm = new LoginForm($req);
switch ($authRes = $loginForm->authenticateUserData()) {
case LoginForm::SUCCESS:
global $wgUser, $wgCookiePrefix;
$wgUser->setOption('rememberpassword', 1);
$wgUser->setCookies();
// Run hooks. FIXME: split back and frontend from this hook.
// FIXME: This hook should be placed in the backend
$injected_html = '';
wfRunHooks('UserLoginComplete', array(&$wgUser, &$injected_html));
$result['result'] = 'Success';
$result['lguserid'] = intval($wgUser->getId());
$result['lgusername'] = $wgUser->getName();
$result['lgtoken'] = $wgUser->getToken();
$result['cookieprefix'] = $wgCookiePrefix;
$result['sessionid'] = session_id();
break;
case LoginForm::NO_NAME:
$result['result'] = 'NoName';
break;
case LoginForm::ILLEGAL:
$result['result'] = 'Illegal';
break;
case LoginForm::WRONG_PLUGIN_PASS:
$result['result'] = 'WrongPluginPass';
break;
case LoginForm::NOT_EXISTS:
$result['result'] = 'NotExists';
break;
case LoginForm::WRONG_PASS:
$result['result'] = 'WrongPass';
break;
case LoginForm::EMPTY_PASS:
$result['result'] = 'EmptyPass';
break;
case LoginForm::CREATE_BLOCKED:
$result['result'] = 'CreateBlocked';
$result['details'] = 'Your IP address is blocked from account creation';
break;
case LoginForm::THROTTLED:
global $wgPasswordAttemptThrottle;
$result['result'] = 'Throttled';
$result['wait'] = intval($wgPasswordAttemptThrottle['seconds']);
break;
default:
ApiBase::dieDebug(__METHOD__, "Unhandled case value: {$authRes}");
}
$this->getResult()->addValue(null, 'login', $result);
}
开发者ID:josephdye,项目名称:wikireader,代码行数:69,代码来源:ApiLogin.php
示例13: wfSpecialUserlogin
/**
* constructor
*/
function wfSpecialUserlogin($par = '')
{
global $wgRequest;
if (session_id() == '') {
wfSetupSession();
}
$form = new LoginForm($wgRequest, $par);
$form->execute();
}
开发者ID:josephdye,项目名称:wikireader,代码行数:12,代码来源:SpecialUserlogin.php
示例14: setUp
/**
* Fixture -- run before every test
*/
public function setUp()
{
global $wgEnableUploads, $wgEnableAPI;
parent::setUp();
$wgEnableUploads = true;
$wgEnableAPI = true;
wfSetupSession();
$this->clearFakeUploads();
}
开发者ID:Tjorriemorrie,项目名称:app,代码行数:12,代码来源:ApiTestCaseUpload.php
示例15: wfSpecialUserlogin
/**
* constructor
*/
function wfSpecialUserlogin($par = '')
{
global $wgRequest, $wgHooks;
if (session_id() == '') {
wfSetupSession();
}
$form = new LoginForm($wgRequest, $par);
$form->execute();
$wgHooks['BeforeTabsLine'][] = array('LoginForm::topContent', $form);
}
开发者ID:ErdemA,项目名称:wikihow,代码行数:13,代码来源:SpecialUserlogin.php
示例16: doApiRequest
protected function doApiRequest($params, $unused = null, $appendModule = false, $user = null)
{
$sessionId = session_id();
session_write_close();
$req = new FauxRequest($params, true, $_SESSION);
$module = new ApiMain($req, true);
$module->execute();
wfSetupSession($sessionId);
return array($module->getResultData(), $req);
}
开发者ID:laiello,项目名称:media-wiki-law,代码行数:10,代码来源:UploadFromUrlTest.php
示例17: execute
function execute()
{
global $wgRequest, $wgHooks, $wgOut;
$this->setHeaders();
if (session_id() == '') {
wfSetupSession();
}
$form = new AjaxLoginForm($wgRequest);
$form->executeAsPage();
}
开发者ID:schwarer2006,项目名称:wikia,代码行数:10,代码来源:SpecialSignup.class.php
示例18: wfSpecialUserlogin
/**
* constructor
*/
function wfSpecialUserlogin()
{
global $wgCommandLineMode;
global $wgRequest;
if (!$wgCommandLineMode && !isset($_COOKIE[session_name()])) {
wfSetupSession();
}
$form = new LoginForm($wgRequest);
$form->execute();
}
开发者ID:negabaro,项目名称:alfresco,代码行数:13,代码来源:SpecialUserlogin.php
示例19: onMediaWikiPerformAction
public static function onMediaWikiPerformAction($output, $article, $title, $user, $request, $wiki)
{
$action = $request->getVal('action');
if ($action != 'submit2') {
return true;
}
if (session_id() == '') {
// Send a cookie so anons get talk message notifications
wfSetupSession();
}
return self::handleEditHooks($request, $title, $article, $action, $user);
}
开发者ID:biribogos,项目名称:wikihow-src,代码行数:12,代码来源:EditPageWrapper.class.php
示例20: mediaWikiPerformAction
/**
* Main entry point, hooks into MediaWikiPerformAction.
* Checks whether or not to spawn the editor, and does so if necessary.
*/
public static function mediaWikiPerformAction($output, $article, $title, $user, $request, $wiki)
{
global $wgHooks, $wgInlineEditorEnableGlobal;
if (!$user->getOption('inline-editor-enabled') && !$wgInlineEditorEnableGlobal) {
return true;
}
// return if the action is not 'edit' or if it's disabled
if ($wiki->getAction($request) != 'edit') {
return true;
}
// check if the 'fulleditor' parameter is set either in GET or POST
if ($request->getCheck('fulleditor')) {
// hook into the edit page to inject the hidden 'fulleditor' input field again
$wgHooks['EditPage::showEditForm:fields'][] = 'InlineEditor::showEditFormFields';
return true;
}
// terminate if the browser is not supported
if (!self::isValidBrowser()) {
self::$fallbackReason = self::REASON_BROWSER;
return true;
}
// start the session if needed
if (session_id() == '') {
wfSetupSession();
}
// try to spawn the editor and render the page
$editor = new InlineEditor($article);
// set the section to scroll to
if (isset($_GET['section'])) {
$editor->setSection($_GET['section']);
} elseif (isset($_POST['section'])) {
$editor->setSection($_POST['section']);
}
// unset the section variables so the entire page will be edited
unset($_GET['section']);
unset($_POST['section']);
$request->setVal('section', null);
// set a warning when leaving the page if necessary
$editor->setEditWarning($user->getOption('useeditwarning') == 1);
if ($editor->render($output)) {
return false;
} else {
// if rendering fails for some reason, terminate and show the advanced page notice
self::$fallbackReason = self::REASON_ADVANCED;
// don't leave traces of HTML behind
$output->clearHTML();
return true;
}
}
开发者ID:realsoc,项目名称:mediawiki-extensions,代码行数:53,代码来源:InlineEditor.class.php
注:本文中的wfSetupSession函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论