• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP WikiError类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: showRequestForm

 /**
  * Show a nice form for the user to request a confirmation mail
  */
 function showRequestForm()
 {
     global $wgOut, $wgUser, $wgLang, $wgRequest;
     if ($wgRequest->wasPosted() && $wgUser->matchEditToken($wgRequest->getText('token'))) {
         $ok = $wgUser->sendConfirmationMail();
         if (WikiError::isError($ok)) {
             $wgOut->addWikiMsg('confirmemail_sendfailed', $ok->toString());
         } else {
             $wgOut->addWikiMsg('confirmemail_sent');
         }
     } else {
         if ($wgUser->isEmailConfirmed()) {
             // date and time are separate parameters to facilitate localisation.
             // $time is kept for backward compat reasons.
             // 'emailauthenticated' is also used in SpecialPreferences.php
             $time = $wgLang->timeAndDate($wgUser->mEmailAuthenticated, true);
             $d = $wgLang->date($wgUser->mEmailAuthenticated, true);
             $t = $wgLang->time($wgUser->mEmailAuthenticated, true);
             $wgOut->addWikiMsg('emailauthenticated', $time, $d, $t);
         }
         if ($wgUser->isEmailConfirmationPending()) {
             $wgOut->wrapWikiMsg("<div class=\"error mw-confirmemail-pending\">\n\$1</div>", 'confirmemail_pending');
         }
         $wgOut->addWikiMsg('confirmemail_text');
         $form = Xml::openElement('form', array('method' => 'post', 'action' => $this->getTitle()->getLocalUrl()));
         $form .= Xml::hidden('token', $wgUser->editToken());
         $form .= Xml::submitButton(wfMsg('confirmemail_send'));
         $form .= Xml::closeElement('form');
         $wgOut->addHTML($form);
     }
 }
开发者ID:rocLv,项目名称:conference,代码行数:34,代码来源:SpecialConfirmemail.php


示例2: showRequestForm

 /**
  * Show a nice form for the user to request a confirmation mail
  */
 function showRequestForm()
 {
     global $wgOut, $wgUser, $wgLang, $wgRequest;
     if ($wgRequest->wasPosted() && $wgUser->matchEditToken($wgRequest->getText('token'))) {
         $ok = $wgUser->sendConfirmationMail();
         if (WikiError::isError($ok)) {
             $wgOut->addWikiMsg('confirmemail_sendfailed', $ok->toString());
         } else {
             $wgOut->addWikiMsg('confirmemail_sent');
         }
     } else {
         if ($wgUser->isEmailConfirmed()) {
             $time = $wgLang->timeAndDate($wgUser->mEmailAuthenticated, true);
             $wgOut->addWikiMsg('emailauthenticated', $time);
         }
         if ($wgUser->isEmailConfirmationPending()) {
             $wgOut->addWikiMsg('confirmemail_pending');
         }
         $wgOut->addWikiMsg('confirmemail_text');
         $self = SpecialPage::getTitleFor('Confirmemail');
         $form = wfOpenElement('form', array('method' => 'post', 'action' => $self->getLocalUrl()));
         $form .= wfHidden('token', $wgUser->editToken());
         $form .= wfSubmitButton(wfMsgHtml('confirmemail_send'));
         $form .= wfCloseElement('form');
         $wgOut->addHtml($form);
     }
 }
开发者ID:BackupTheBerlios,项目名称:shoutwiki-svn,代码行数:30,代码来源:SpecialConfirmemail.php


示例3: processUpload

 function processUpload()
 {
     global $wgUser, $wgOut, $wgFileExtensions;
     $details = null;
     $value = null;
     $value = $this->internalProcessUpload($details);
     switch ($value) {
         case self::SUCCESS:
             // don't... do... REDIRECT
             return;
         case self::BEFORE_PROCESSING:
             return false;
         case self::LARGE_FILE_SERVER:
             return wfMsg('largefileserver');
         case self::EMPTY_FILE:
             return wfMsg('emptyfile');
         case self::MIN_LENGTH_PARTNAME:
             return wfMsg('minlength1');
             return;
         case self::ILLEGAL_FILENAME:
             $filtered = $details['filtered'];
             return wfMsg('illegalfilename', $filtered);
         case self::PROTECTED_PAGE:
             return wfMsg('protectedpage');
         case self::OVERWRITE_EXISTING_FILE:
             $errorText = $details['overwrite'];
             $overwrite = new WikiError($wgOut->parse($errorText));
             return $overwrite->toString();
         case self::FILETYPE_MISSING:
             return wfMsg('filetype-missing');
         case self::FILETYPE_BADTYPE:
             $finalExt = $details['finalExt'];
             return wfMsg('filetype-badtype');
         case self::VERIFICATION_ERROR:
             $veri = $details['veri'];
             return $veri->toString();
         case self::UPLOAD_VERIFICATION_ERROR:
             $error = $details['error'];
             return $error;
         case self::UPLOAD_WARNING:
             $warning = $details['warning'];
             return $warning;
     }
     throw new MWException(__METHOD__ . ": Unknown value `{$value}`");
 }
开发者ID:realsoc,项目名称:mediawiki-extensions,代码行数:45,代码来源:CreatePageImageUploadForm.php


示例4: wfSpecialImport

/**
 * Constructor
 */
function wfSpecialImport($page = '')
{
    global $wgUser, $wgOut, $wgLang, $wgRequest, $wgTitle;
    global $wgImportSources;
    ###
    #	$wgOut->addWikiText( "Special:Import is not ready for this beta release, sorry." );
    #	return;
    ###
    if ($wgRequest->wasPosted() && $wgRequest->getVal('action') == 'submit') {
        switch ($wgRequest->getVal("source")) {
            case "upload":
                if ($wgUser->isAllowed('importupload')) {
                    $source = ImportStreamSource::newFromUpload("xmlimport");
                } else {
                    return $wgOut->permissionRequired('importupload');
                }
                break;
            case "interwiki":
                $source = ImportStreamSource::newFromInterwiki($wgRequest->getVal("interwiki"), $wgRequest->getText("frompage"));
                break;
            default:
                $source = new WikiError("Unknown import source type");
        }
        if (WikiError::isError($source)) {
            $wgOut->addWikiText(wfEscapeWikiText($source->getMessage()));
        } else {
            $importer = new WikiImporter($source);
            $result = $importer->doImport();
            if (WikiError::isError($result)) {
                $wgOut->addWikiText(wfMsg("importfailed", wfEscapeWikiText($result->getMessage())));
            } else {
                # Success!
                $wgOut->addWikiText(wfMsg("importsuccess"));
            }
        }
    }
    $action = $wgTitle->escapeLocalUrl('action=submit');
    if ($wgUser->isAllowed('importupload')) {
        $wgOut->addWikiText(wfMsg("importtext"));
        $wgOut->addHTML("\n<fieldset>\n\t<legend>" . wfMsgHtml('upload') . "</legend>\n\t<form enctype='multipart/form-data' method='post' action=\"{$action}\">\n\t\t<input type='hidden' name='action' value='submit' />\n\t\t<input type='hidden' name='source' value='upload' />\n\t\t<input type='hidden' name='MAX_FILE_SIZE' value='2000000' />\n\t\t<input type='file' name='xmlimport' value='' size='30' />\n\t\t<input type='submit' value='" . wfMsgHtml("uploadbtn") . "'/>\n\t</form>\n</fieldset>\n");
    } else {
        if (empty($wgImportSources)) {
            $wgOut->addWikiText(wfMsg('importnosources'));
        }
    }
    if (!empty($wgImportSources)) {
        $wgOut->addHTML("\n<fieldset>\n\t<legend>" . wfMsgHtml('importinterwiki') . "</legend>\n\t<form method='post' action=\"{$action}\">\n\t\t<input type='hidden' name='action' value='submit' />\n\t\t<input type='hidden' name='source' value='interwiki' />\n\t\t<select name='interwiki'>\n");
        foreach ($wgImportSources as $interwiki) {
            $iw = htmlspecialchars($interwiki);
            $wgOut->addHTML("<option value=\"{$iw}\">{$iw}</option>\n");
        }
        $wgOut->addHTML("\n\t\t</select>\n\t\t<input name='frompage' />\n\t\t<input type='submit' />\n\t</form>\n</fieldset>\n");
    }
}
开发者ID:BackupTheBerlios,项目名称:openzaurus-svn,代码行数:57,代码来源:SpecialImport.php


示例5: execute

 public function execute()
 {
     global $wgUser;
     if (!$wgUser->isAllowed('import')) {
         $this->dieUsageMsg(array('cantimport'));
     }
     $params = $this->extractRequestParams();
     if (!isset($params['token'])) {
         $this->dieUsageMsg(array('missingparam', 'token'));
     }
     if (!$wgUser->matchEditToken($params['token'])) {
         $this->dieUsageMsg(array('sessionfailure'));
     }
     $source = null;
     $isUpload = false;
     if (isset($params['interwikisource'])) {
         if (!isset($params['interwikipage'])) {
             $this->dieUsageMsg(array('missingparam', 'interwikipage'));
         }
         $source = ImportStreamSource::newFromInterwiki($params['interwikisource'], $params['interwikipage'], $params['fullhistory'], $params['templates']);
     } else {
         $isUpload = true;
         if (!$wgUser->isAllowed('importupload')) {
             $this->dieUsageMsg(array('cantimport-upload'));
         }
         $source = ImportStreamSource::newFromUpload('xml');
     }
     if ($source instanceof WikiErrorMsg) {
         $this->dieUsageMsg(array_merge(array($source->getMessageKey()), $source->getMessageArgs()));
     } else {
         if (WikiError::isError($source)) {
             // This shouldn't happen
             $this->dieUsageMsg(array('import-unknownerror', $source->getMessage()));
         }
     }
     $importer = new WikiImporter($source);
     if (isset($params['namespace'])) {
         $importer->setTargetNamespace($params['namespace']);
     }
     $reporter = new ApiImportReporter($importer, $isUpload, $params['interwikisource'], $params['summary']);
     $result = $importer->doImport();
     if ($result instanceof WikiXmlError) {
         $this->dieUsageMsg(array('import-xml-error', $result->mLine, $result->mColumn, $result->mByte . $result->mContext, xml_error_string($result->mXmlError)));
     } else {
         if (WikiError::isError($result)) {
             // This shouldn't happen
             $this->dieUsageMsg(array('import-unknownerror', $result->getMessage()));
         }
     }
     $resultData = $reporter->getData();
     $this->getResult()->setIndexedTagName($resultData, 'page');
     $this->getResult()->addValue(null, $this->getModuleName(), $resultData);
 }
开发者ID:ui-libraries,项目名称:TIRWeb,代码行数:53,代码来源:ApiImport.php


示例6: checkAndSend

 /** */
 function checkAndSend()
 {
     global $wgUser, $wgRequest;
     if ($wgRequest->wasPosted() && $wgUser->isLoggedIn() && $wgUser->matchEditToken($wgRequest->getVal('wpEditToken'))) {
         $result = $wgUser->sendConfirmationMail();
         if (WikiError::isError($result)) {
             return 'confirmemail_sendfailed';
         } else {
             return 'confirmemail_sent';
         }
     } else {
         # boo
         return '';
     }
 }
开发者ID:BackupTheBerlios,项目名称:openzaurus-svn,代码行数:16,代码来源:SpecialConfirmemail.php


示例7: dump

 function dump()
 {
     # This shouldn't happen if on console... ;)
     header('Content-type: text/html; charset=UTF-8');
     # Notice messages will foul up your XML output even if they're
     # relatively harmless.
     //		ini_set( 'display_errors', false );
     $this->initProgress($this->history);
     $this->db =& $this->backupDb();
     $this->egress = new ExportProgressFilter($this->sink, $this);
     $input = fopen($this->input, "rt");
     $result = $this->readDump($input);
     if (WikiError::isError($result)) {
         wfDie($result->getMessage());
     }
     $this->report(true);
 }
开发者ID:BackupTheBerlios,项目名称:blahtex,代码行数:17,代码来源:dumpTextPass.php


示例8: UW_GenericEditPage_emailSuggestion

function UW_GenericEditPage_emailSuggestion ( $category ) {
	global $wgSuggestCategoryRecipient, $wgEmergencyContact, $wgSitename, $wgUser;

	

	$from = new MailAddress ( $wgEmergencyContact );
	$to   = new MailAddress ( $wgSuggestCategoryRecipient );
	$subj = wfMsg ( "gep-emailsubject", $wgSitename, $category );
	$body = wfMsg ( "gep-emailbody", $wgUser->getName(), $category, $wgSitename );

	// attempt to send the notification
	$result = UserMailer::send( $to, $from, $subj, $body );

	/* send a message back to the client, to let them
	 * know if the suggestion was successfully sent (or not) */
	return WikiError::isError ( $result )
	     ? wfMsg ( 'gep-emailfailure' )
	     : wfMsg ( 'gep-emailsuccess', $category );
}
开发者ID:realsoc,项目名称:mediawiki-extensions,代码行数:19,代码来源:GenericEditPage.php


示例9: showRequestForm

 /**
  * Show a nice form for the user to request a confirmation mail
  */
 function showRequestForm()
 {
     global $wgOut, $wgUser, $wgLang, $wgRequest;
     if ($wgRequest->wasPosted() && $wgUser->matchEditToken($wgRequest->getText('token'))) {
         $ok = $wgUser->sendConfirmationMail();
         $message = WikiError::isError($ok) ? 'confirmemail_sendfailed' : 'confirmemail_sent';
         $wgOut->addWikiText(wfMsg($message));
     } else {
         if ($wgUser->isEmailConfirmed()) {
             $time = $wgLang->timeAndDate($wgUser->mEmailAuthenticated, true);
             $wgOut->addWikiText(wfMsg('emailauthenticated', $time));
         }
         $wgOut->addWikiText(wfMsg('confirmemail_text'));
         $self = Title::makeTitle(NS_SPECIAL, 'Confirmemail');
         $form = wfOpenElement('form', array('method' => 'post', 'action' => $self->getLocalUrl()));
         $form .= wfHidden('token', $wgUser->editToken());
         $form .= wfSubmitButton(wfMsgHtml('confirmemail_send'));
         $form .= wfCloseElement('form');
         $wgOut->addHtml($form);
     }
 }
开发者ID:k-hasan-19,项目名称:wiki,代码行数:24,代码来源:SpecialConfirmemail.php


示例10: run

 function run($par)
 {
     global $wgRequest, $wgEmailMeAddress, $wgOut;
     if ($wgRequest->wasPosted()) {
         $from = $wgRequest->getText('from');
         $subject = $wgRequest->getText('subject');
         $message = $wgRequest->getText('message');
         if (!($from && $subject && $message)) {
             return $this->print_form($this->getTitle(), $subject, $from, $message, wfMsg('emailme-incomplete'));
         }
         if (!User::isValidEmailAddr($from)) {
             return $this->print_form($this->getTitle(), $subject, $from, $message, wfMsg('emailme-invalid-email'));
         }
         $mailResult = UserMailer::send(new MailAddress($wgEmailMeAddress), new MailAddress($from), $subject, $message);
         if (WikiError::isError($mailResult)) {
             return $this->print_form($this->getTitle(), $subject, $from, $message, 'Sorry: ' . $mailResult->toString());
             dvLog("ERROR: EmailMe::run(" . $mailResult->toString() . ") {$from}|{$subject}");
         } else {
             dvLog("EMAIL: {$from} -> {$wgEmailMeAddress} ( {$subject} ) ");
             return $this->print_success();
         }
     }
     return $this->print_form($this->getTitle(), str_replace('_', ' ', $par));
 }
开发者ID:ConradIrwin,项目名称:EmailMe,代码行数:24,代码来源:EmailMe_body.php


示例11: doSubmit

 function doSubmit()
 {
     global $wgOut, $wgUser;
     $to = new MailAddress($this->target);
     $from = new MailAddress($wgUser);
     $subject = $this->subject;
     if (wfRunHooks('EmailUser', array(&$to, &$from, &$subject, &$this->text))) {
         $mailResult = userMailer($to, $from, $subject, $this->text);
         if (WikiError::isError($mailResult)) {
             $wgOut->addHTML(wfMsg("usermailererror") . $mailResult);
         } else {
             $titleObj = Title::makeTitle(NS_SPECIAL, "Emailuser");
             $encTarget = wfUrlencode($this->target->getName());
             $wgOut->redirect($titleObj->getFullURL("target={$encTarget}&action=success"));
             wfRunHooks('EmailUserComplete', array($to, $from, $subject, $this->text));
         }
     }
 }
开发者ID:k-hasan-19,项目名称:wiki,代码行数:18,代码来源:SpecialEmailuser.php


示例12: saveSettings_basic

 function saveSettings_basic()
 {
     global $wgUser, $wgRequest, $wgEmailAuthentication;
     $wgUser->setRealName($wgRequest->getVal('real_name'));
     $wgUser->setEmail($wgRequest->getVal('email'));
     if ($wgUser->getEmail() != $wgRequest->getVal('email')) {
         $wgUser->mEmailAuthenticated = null;
         # but flag as "dirty" = unauthenticated
     }
     if ($wgEmailAuthentication && !$wgUser->isEmailConfirmed()) {
         # Mail a temporary password to the dirty address.
         # User can come back through the confirmation URL to re-enable email.
         $result = $wgUser->sendConfirmationMail();
         if (WikiError::isError($result)) {
             $error = wfMsg('mailerror', htmlspecialchars($result->getMessage()));
         } else {
             $error = wfMsg('eauthentsent', $wgUser->getName());
         }
     }
     $wgUser->saveSettings();
 }
开发者ID:kghbln,项目名称:semantic-social-profile,代码行数:21,代码来源:SpecialUpdateProfile.php


示例13: savePreferences

 /**
  * @access private
  */
 function savePreferences()
 {
     global $wgUser, $wgOut, $wgParser;
     global $wgEnableUserEmail, $wgEnableEmail;
     global $wgEmailAuthentication, $wgRCMaxAge;
     global $wgAuth, $wgEmailConfirmToEdit;
     $wgUser->setRealName($this->mRealName);
     $oldOptions = $wgUser->mOptions;
     if ($wgUser->getOption('language') !== $this->mUserLanguage) {
         $needRedirect = true;
     } else {
         $needRedirect = false;
     }
     # Validate the signature and clean it up as needed
     global $wgMaxSigChars;
     if (mb_strlen($this->mNick) > $wgMaxSigChars) {
         global $wgLang;
         $this->mainPrefsForm('error', wfMsgExt('badsiglength', 'parsemag', $wgLang->formatNum($wgMaxSigChars)));
         return;
     } elseif ($this->mToggles['fancysig']) {
         if ($wgParser->validateSig($this->mNick) !== false) {
             $this->mNick = $wgParser->cleanSig($this->mNick);
         } else {
             $this->mainPrefsForm('error', wfMsg('badsig'));
             return;
         }
     } else {
         // When no fancy sig used, make sure ~{3,5} get removed.
         $this->mNick = $wgParser->cleanSigInSig($this->mNick);
     }
     $wgUser->setOption('language', $this->mUserLanguage);
     $wgUser->setOption('variant', $this->mUserVariant);
     $wgUser->setOption('nickname', $this->mNick);
     $wgUser->setOption('quickbar', $this->mQuickbar);
     global $wgAllowUserSkin;
     if ($wgAllowUserSkin) {
         $wgUser->setOption('skin', $this->mSkin);
     }
     global $wgUseTeX;
     if ($wgUseTeX) {
         $wgUser->setOption('math', $this->mMath);
     }
     $wgUser->setOption('date', $this->validateDate($this->mDate));
     $wgUser->setOption('searchlimit', $this->validateIntOrNull($this->mSearch));
     $wgUser->setOption('contextlines', $this->validateIntOrNull($this->mSearchLines));
     $wgUser->setOption('contextchars', $this->validateIntOrNull($this->mSearchChars));
     $wgUser->setOption('rclimit', $this->validateIntOrNull($this->mRecent));
     $wgUser->setOption('rcdays', $this->validateInt($this->mRecentDays, 1, ceil($wgRCMaxAge / (3600 * 24))));
     $wgUser->setOption('wllimit', $this->validateIntOrNull($this->mWatchlistEdits, 0, 1000));
     $wgUser->setOption('rows', $this->validateInt($this->mRows, 4, 1000));
     $wgUser->setOption('cols', $this->validateInt($this->mCols, 4, 1000));
     $wgUser->setOption('stubthreshold', $this->validateIntOrNull($this->mStubs));
     $wgUser->setOption('timecorrection', $this->validateTimeZone($this->mTimeZone, $this->mHourDiff));
     $wgUser->setOption('imagesize', $this->mImageSize);
     $wgUser->setOption('thumbsize', $this->mThumbSize);
     $wgUser->setOption('underline', $this->validateInt($this->mUnderline, 0, 2));
     $wgUser->setOption('watchlistdays', $this->validateFloat($this->mWatchlistDays, 0, 7));
     $wgUser->setOption('disablesuggest', $this->mDisableMWSuggest);
     # Set search namespace options
     foreach ($this->mSearchNs as $i => $value) {
         $wgUser->setOption("searchNs{$i}", $value);
     }
     if ($wgEnableEmail && $wgEnableUserEmail) {
         $wgUser->setOption('disablemail', $this->mEmailFlag);
     }
     # Set user toggles
     foreach ($this->mToggles as $tname => $tvalue) {
         $wgUser->setOption($tname, $tvalue);
     }
     $error = false;
     if ($wgEnableEmail) {
         $newadr = $this->mUserEmail;
         $oldadr = $wgUser->getEmail();
         if ($newadr != '' && $newadr != $oldadr) {
             # the user has supplied a new email address on the login page
             if ($wgUser->isValidEmailAddr($newadr)) {
                 # new behaviour: set this new emailaddr from login-page into user database record
                 $wgUser->setEmail($newadr);
                 # but flag as "dirty" = unauthenticated
                 $wgUser->invalidateEmail();
                 if ($wgEmailAuthentication) {
                     # Mail a temporary password to the dirty address.
                     # User can come back through the confirmation URL to re-enable email.
                     $result = $wgUser->sendConfirmationMail();
                     if (WikiError::isError($result)) {
                         $error = wfMsg('mailerror', htmlspecialchars($result->getMessage()));
                     } else {
                         $error = wfMsg('eauthentsent', $wgUser->getName());
                     }
                 }
             } else {
                 $error = wfMsg('invalidemailaddress');
             }
         } else {
             if ($wgEmailConfirmToEdit && empty($newadr)) {
                 $this->mainPrefsForm('error', wfMsg('noemailtitle'));
                 return;
//.........这里部分代码省略.........
开发者ID:amjadtbssm,项目名称:website,代码行数:101,代码来源:SpecialPreferences.php


示例14: mailPassword

 /**
  * @private
  */
 function mailPassword()
 {
     global $wgUser, $wgOut, $wgAuth;
     if (wfReadOnly()) {
         $wgOut->readOnlyPage();
         return false;
     }
     if (!$wgAuth->allowPasswordChange()) {
         $this->mainLoginForm(wfMsg('resetpass_forbidden'));
         return;
     }
     # Check against blocked IPs so blocked users can't flood admins
     # with password resets
     if ($wgUser->isBlocked()) {
         $this->mainLoginForm(wfMsg('blocked-mailpassword'));
         return;
     }
     # Check for hooks
     $error = null;
     if (!wfRunHooks('UserLoginMailPassword', array($this->mName, &$error))) {
         $this->mainLoginForm($error);
         return;
     }
     # If the user doesn't have a login token yet, set one.
     if (!self::getLoginToken()) {
         self::setLoginToken();
         $this->mainLoginForm(wfMsg('sessionfailure'));
         return;
     }
     # If the user didn't pass a login token, tell them we need one
     if (!$this->mToken) {
         $this->mainLoginForm(wfMsg('sessionfailure'));
         return;
     }
     # Check against the rate limiter
     if ($wgUser->pingLimiter('mailpassword')) {
         $wgOut->rateLimited();
         return;
     }
     if ($this->mName == '') {
         $this->mainLoginForm(wfMsg('noname'));
         return;
     }
     $u = User::newFromName($this->mName);
     if (!$u instanceof User) {
         $this->mainLoginForm(wfMsg('noname'));
         return;
     }
     if (0 == $u->getID()) {
         $this->mainLoginForm(wfMsgWikiHtml('nosuchuser', htmlspecialchars($u->getName())));
         return;
     }
     # Validate the login token
     if ($this->mToken !== self::getLoginToken()) {
         $this->mainLoginForm(wfMsg('sessionfailure'));
         return;
     }
     # Check against password throttle
     if ($u->isPasswordReminderThrottled()) {
         global $wgPasswordReminderResendTime;
         # Round the time in hours to 3 d.p., in case someone is specifying
         # minutes or seconds.
         $this->mainLoginForm(wfMsgExt('throttled-mailpassword', array('parsemag'), round($wgPasswordReminderResendTime, 3)));
         return;
     }
     $result = $this->mailPasswordInternal($u, true, 'passwordremindertitle', 'passwordremindertext');
     if (WikiError::isError($result)) {
         $this->mainLoginForm(wfMsg('mailerror', $result->getMessage()));
     } else {
         $this->mainLoginForm(wfMsg('passwordsent', $u->getName()), 'success');
         self::clearLoginToken();
     }
 }
开发者ID:rocLv,项目名称:conference,代码行数:76,代码来源:SpecialUserlogin.php


示例15: mailPassword

 /**
  * @private
  */
 function mailPassword()
 {
     global $wgUser, $wgOut;
     # Check against the rate limiter
     if ($wgUser->pingLimiter('mailpassword')) {
         $wgOut->rateLimited();
         return;
     }
     if ('' == $this->mName) {
         $this->mainLoginForm(wfMsg('noname'));
         return;
     }
     $u = User::newFromName($this->mName);
     if (is_null($u)) {
         $this->mainLoginForm(wfMsg('noname'));
         return;
     }
     if (0 == $u->getID()) {
         $this->mainLoginForm(wfMsg('nosuchuser', $u->getName()));
         return;
     }
     $u->loadFromDatabase();
     $result = $this->mailPasswordInternal($u);
     if (WikiError::isError($result)) {
         $this->mainLoginForm(wfMsg('mailerror', $result->getMessage()));
     } else {
         $this->mainLoginForm(wfMsg('passwordsent', $u->getName()), 'success');
     }
 }
开发者ID:k-hasan-19,项目名称:wiki,代码行数:32,代码来源:SpecialUserlogin.php


示例16: updateUser

	/**
	 * Update some user's settings with value get from OpenID
	 *
	 * @param $user User object
	 * @param $sreg Array of options get from OpenID
	 * @param $force forces update regardless of user preferences
	 */
	function updateUser( $user, $sreg, $ax, $force = false ) {
		global $wgAllowRealName, $wgEmailAuthentication, $wgOpenIDTrustEmailAddress;

		// Nick name
		if ( $this->updateOption( 'nickname', $user, $force ) ) {
			if ( array_key_exists( 'nickname', $sreg ) && $sreg['nickname'] != $user->getOption( 'nickname' ) ) {
				$user->setOption( 'nickname', $sreg['nickname'] );
			}
		}

		// E-mail
		if ( $this->updateOption( 'email', $user, $force ) ) {
			// first check SREG, then AX; if both, AX takes higher priority
			if ( array_key_exists( 'email', $sreg ) ) {
				$email = $sreg['email'];
			}
			if ( array_key_exists ( 'http://axschema.org/contact/email', $ax ) ) {
				$email = $ax['http://axschema.org/contact/email'][0];
			}
			if ( $email ) {
				// If email changed, then email a confirmation mail
				if ( $email != $user->getEmail() ) {
					$user->setEmail( $email );
					if ( $wgOpenIDTrustEmailAddress ) {
						$user->confirmEmail();
					} else {
						$user->invalidateEmail();
						if ( $wgEmailAuthentication && $email != '' ) {
							$result = $user->sendConfirmationMail();
							if ( WikiError::isError( $result ) ) {
								$wgOut->addWikiMsg( 'mailerror', $result->getMessage() );
							}
						}
					}
				}
			}
		}

		// Full name
		if ( $wgAllowRealName && ( $this->updateOption( 'fullname', $user, $force ) ) ) {
			if ( array_key_exists( 'fullname', $sreg ) ) {
				$user->setRealName( $sreg['fullname'] );
			}

			if ( array_key_exists( 'http://axschema.org/namePerson/first', $ax ) || array_key_exists( 'http://axschema.org/namePerson/last', $ax ) ) {
				$user->setRealName( $ax['http://axschema.org/namePerson/first'][0] . " " . $ax['http://axschema.org/namePerson/last'][0] );
			}
		}

		// Language
		if ( $this->updateOption( 'language', $user, $force ) ) {
			if ( array_key_exists( 'language', $sreg ) ) {
				# FIXME: check and make sure the language exists
				$user->setOption( 'language', $sreg['language'] );
			}
		}

		if ( $this->updateOption( 'timezone', $user, $force ) ) {
			if ( array_key_exists( 'timezone', $sreg ) ) {
				# FIXME: do something with it.
				# $offset = OpenIDTimezoneToTzoffset($sreg['timezone']);
				# $user->setOption('timecorrection', $offset);
			}
		}

		$user->saveSettings();
	}
开发者ID:realsoc,项目名称:mediawiki-extensions,代码行数:74,代码来源:SpecialOpenIDLogin.body.php


示例17: editUserGroupsForm

 /**
  * Edit user groups membership
  * @param string $username Name of the user.
  */
 function editUserGroupsForm($username)
 {
     global $wgOut, $wgUser;
     $split = $this->splitUsername($username);
     if (WikiError::isError($split)) {
         $wgOut->addWikiText(wfMsg('makesysop-nodatabase', $split->getMessage()));
         return;
     }
     list($database, $name) = $split;
     $this->db =& $this->getDB($database);
     $userid = $this->getUserId($database, $name);
     if ($userid == 0) {
         $wgOut->addWikiText(wfMsg('nosuchusershort', wfEscapeWikiText($username)));
         return;
     }
     $groups = $this->getUserGroups($database, $userid);
     $this->showEditUserGroupsForm($username, $groups);
 }
开发者ID:clrh,项目名称:mediawiki,代码行数:22,代码来源:SpecialMakesysop_body.php


示例18: wfSpecialImport

/**
 * Constructor
 */
function wfSpecialImport($page = '')
{
    global $wgUser, $wgOut, $wgRequest, $wgTitle, $wgImportSources;
    global $wgImportTargetNamespace;
    $interwiki = false;
    $namespace = $wgImportTargetNamespace;
    $frompage = '';
    $history = true;
    if ($wgRequest->wasPosted() && $wgRequest->getVal('action') == 'submit') {
        $isUpload = false;
        $namespace = $wgRequest->getIntOrNull('namespace');
        switch ($wgRequest->getVal("source")) {
            case "upload":
                $isUpload = true;
                if ($wgUser->isAllowed('importupload')) {
                    $source = ImportStreamSource::newFromUpload("xmlimport");
                } else {
                    return $wgOut->permissionRequired('importupload');
                }
                break;
            case "interwiki":
                $interwiki = $wgRequest->getVal('interwiki');
                $history = $wgRequest->getCheck('interwikiHistory');
                $frompage = $wgRequest->getText("frompage");
                $source = ImportStreamSource::newFromInterwiki($interwiki, $frompage, $history);
                break;
            default:
                $source = new WikiErrorMsg("importunknownsource");
        }
        if (WikiError::isError($source)) {
            $wgOut->addWikiText(wfEscapeWikiText($source->getMessage()));
        } else {
            $wgOut->addWikiText(wfMsg("importstart"));
            $importer = new WikiImporter($source);
            if (!is_null($namespace)) {
                $importer->setTargetNamespace($namespace);
            }
            $reporter = new ImportReporter($importer, $isUpload, $interwiki);
            $reporter->open();
            $result = $importer->doImport();
            $reporter->close();
            if (WikiError::isError($result)) {
                $wgOut->addWikiText(wfMsg("importfailed", wfEscapeWikiText($result->getMessage())));
            } else {
                # Success!
                $wgOut->addWikiText(wfMsg("importsuccess"));
            }
        }
    }
    $action = $wgTitle->escapeLocalUrl('action=submit');
    if ($wgUser->isAllowed('importupload')) {
        $wgOut->addWikiText(wfMsg("importtext"));
        $wgOut->addHTML("\n<fieldset>\n\t<legend>" . wfMsgHtml('upload') . "</legend>\n\t<form enctype='multipart/form-data' method='post' action=\"{$action}\">\n\t\t<input type='hidden' name='action' value='submit' />\n\t\t<input type='hidden' name='source' value='upload' />\n\t\t<input type='hidden' name='MAX_FILE_SIZE' value='2000000' />\n\t\t<input type='file' name='xmlimport' value='' size='30' />\n\t\t<input type='submit' value=\"" . wfMsgHtml("uploadbtn") . "\" />\n\t</form>\n</fieldset>\n");
    } else {
        if (empty($wgImportSources)) {
            $wgOut->addWikiText(wfMsg('importnosources'));
        }
    }
    if (!empty($wgImportSources)) {
        $wgOut->addHTML("\n<fieldset>\n\t<legend>" . wfMsgHtml('importinterwiki') . "</legend>\n\t<form method='post' action=\"{$action}\">" . $wgOut->parse(wfMsg('import-interwiki-text')) . "\n\t\t<input type='hidden' name='action' value='submit' />\n\t\t<input type='hidden' name='source' value='interwiki' />\n\t\t<table>\n\t\t\t<tr>\n\t\t\t\t<td>\n\t\t\t\t\t<select name='interwiki'>");
        foreach ($wgImportSources as $prefix) {
            $iw = htmlspecialchars($prefix);
            $selected = $interwiki === $prefix ? ' selected="selected"' : '';
            $wgOut->addHTML("<option value=\"{$iw}\"{$selected}>{$iw}</option>\n");
        }
        $wgOut->addHTML("\n\t\t\t\t\t</select>\n\t\t\t\t</td>\n\t\t\t\t<td>" . wfInput('frompage', 50, $frompage) . "</td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td></td>\n\t\t\t\t<td>" . wfCheckLabel(wfMsg('import-interwiki-history'), 'interwikiHistory', 'interwikiHistory', $history) . "</td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td></td>\n\t\t\t\t<td>\n\t\t\t\t\t" . wfMsgHtml('import-interwiki-namespace') . " " . HTMLnamespaceselector($namespace, '') . "\n\t\t\t\t</td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td></td>\n\t\t\t\t<td>" . wfSubmitButton(wfMsg('import-interwiki-submit')) . "</td>\n\t\t\t</tr>\n\t\t</table>\n\t</form>\n</fieldset>\n");
    }
}
开发者ID:k-hasan-19,项目名称:wiki,代码行数:71,代码来源:SpecialImport.php


示例19: tryFormSubmit

 static function tryFormSubmit($formData, $entryPoint = 'internal')
 {
     global $wgUser, $wgEmailAuthentication, $wgEnableEmail;
     $result = true;
     // Filter input
     foreach (array_keys($formData) as $name) {
         if (isset(self::$saveFilters[$name])) {
             $formData[$name] = call_user_func(self::$saveFilters[$name], $formData[$name], $formData);
         }
     }
     // Stuff that shouldn't be saved as a preference.
     $saveBlacklist = array('realname', 'emailaddress');
     if ($wgEnableEmail) {
         $newadr = $formData['emailaddress'];
         $oldadr = $wgUser->getEmail();
         if ($newadr != '' && $newadr != $oldadr) {
             # the user has supplied a new email address on the login page
             # new behaviour: set this new emailaddr from login-page into user database record
             $wgUser->setEmail($newadr);
             # but flag as "dirty" = unauthenticated
             $wgUser->invalidateEmail();
             if ($wgEmailAuthentication) {
                 # Mail a temporary password to the dirty address.
                 # User can come back through the confirmation URL to re-enable email.
                 $result = $wgUser->sendConfirmationMail();
                 if (WikiError::isError($result)) {
                     return wfMsg('mailerror', htmlspecialchars($result->getMessage()));
                 } elseif ($entryPoint == 'ui') {
                     $result = 'eauth';
                 }
             }
         } else {
             $wgUser->setEmail($newadr);
         }
         if ($oldadr != $newadr) {
             wfRunHooks('PrefsEmailAudit', array($wgUser, $oldadr, $newadr));
         }
     }
     // Fortunately, the realname field is MUCH simpler
     global $wgHiddenPrefs;
     if (!in_array('realname', $wgHiddenPrefs)) {
         $realName = $formData['realname'];
         $wgUser->setRealName($realName);
     }
     foreach ($saveBlacklist as $b) {
         unset($formData[$b]);
     }
     //  Keeps old preferences from interfering due to back-compat
     //  code, etc.
     $wgUser->resetOptions();
     foreach ($formData as $key => $value) {
         $wgUser->setOption($key, $value);
     }
     $wgUser->saveSettings();
     return $result;
 }
开发者ID:rocLv,项目名称:conference,代码行数:56,代码来源:Preferences.php


示例20: processUpload


//.........这里部分代码省略.........
                         $duration = $granulepos / $page['rate'];
                     }
                 }
                 fclose($f);
             }
             $dbr =& wfGetDB(DB_WRITE);
             $text = '' . $wgScriptPath . '/images/' . $this->mLocalFile->getUrlRel();
             if ($duration === null) {
                 $duration = 0;
             }
             if ($dbr->insert($mvMediaFilesTable, array('path' => $text, 'duration' => $duration, 'file_desc_msg' => $file_desc_msg), __METHOD__)) {
                 $result = $dbr->query("SELECT LAST_INSERT_ID() AS id");
                 $row = $dbr->fetchObject($result);
                 $id = $row->id;
                 if ($dbr->insert($mvStreamFilesTable, array('file_id' => $id, 'str 

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP WikiFactory类代码示例发布时间:2022-05-23
下一篇:
PHP Wiki类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap