本文整理汇总了PHP中wfReadOnly函数的典型用法代码示例。如果您正苦于以下问题:PHP wfReadOnly函数的具体用法?PHP wfReadOnly怎么用?PHP wfReadOnly使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了wfReadOnly函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: execute
/**
* Execute
*/
function execute($par)
{
global $wgRequest, $wgUser, $wgOut;
$this->setHeaders();
$this->outputHeader();
if (wfReadOnly()) {
$wgOut->readOnlyPage();
return;
}
if (!$wgUser->isAllowed('import') && !$wgUser->isAllowed('importupload')) {
return $wgOut->permissionRequired('import');
}
# TODO: allow Title::getUserPermissionsErrors() to take an array
# FIXME: Title::checkSpecialsAndNSPermissions() has a very wierd expectation of what
# getUserPermissionsErrors() might actually be used for, hence the 'ns-specialprotected'
$errors = wfMergeErrorArrays($this->getTitle()->getUserPermissionsErrors('import', $wgUser, true, array('ns-specialprotected', 'badaccess-group0', 'badaccess-groups')), $this->getTitle()->getUserPermissionsErrors('importupload', $wgUser, true, array('ns-specialprotected', 'badaccess-group0', 'badaccess-groups')));
if ($errors) {
$wgOut->showPermissionsErrorPage($errors);
return;
}
if ($wgRequest->wasPosted() && $wgRequest->getVal('action') == 'submit') {
$this->doImport();
}
$this->showForm();
}
示例2: execute
function execute($par)
{
global $wgOut, $wgUser, $wgRequest;
$this->setHeaders();
$this->outputHeader();
$wgOut->disallowUserJs();
# Prevent hijacked user scripts from sniffing passwords etc.
if ($wgUser->isAnon()) {
$wgOut->showErrorPage('prefsnologin', 'prefsnologintext', array($this->getTitle()->getPrefixedDBkey()));
return;
}
if (wfReadOnly()) {
$wgOut->readOnlyPage();
return;
}
if ($par == 'reset') {
$this->showResetForm();
return;
}
$wgOut->addModules('mediawiki.legacy.prefs');
$wgOut->addModules('mediawiki.special.preferences');
if ($wgRequest->getCheck('success')) {
$wgOut->wrapWikiMsg("<div class=\"successbox\"><strong>\n\$1\n</strong></div><div id=\"mw-pref-clear\"></div>", 'savedprefs');
}
if ($wgRequest->getCheck('eauth')) {
$wgOut->wrapWikiMsg("<div class='error' style='clear: both;'>\n\$1\n</div>", 'eauthentsent', $wgUser->getName());
}
$htmlForm = Preferences::getFormObject($wgUser);
$htmlForm->setSubmitCallback(array('Preferences', 'tryUISubmit'));
$htmlForm->show();
}
示例3: ProtectionForm
function ProtectionForm(&$article)
{
global $wgRequest, $wgUser;
global $wgRestrictionTypes, $wgRestrictionLevels;
$this->mArticle =& $article;
$this->mTitle =& $article->mTitle;
if ($this->mTitle) {
foreach ($wgRestrictionTypes as $action) {
// Fixme: this form currently requires individual selections,
// but the db allows multiples separated by commas.
$this->mRestrictions[$action] = implode('', $this->mTitle->getRestrictions($action));
}
}
// The form will be available in read-only to show levels.
$this->disabled = !$wgUser->isAllowed('protect') || wfReadOnly() || $wgUser->isBlocked();
$this->disabledAttrib = $this->disabled ? array('disabled' => 'disabled') : array();
if ($wgRequest->wasPosted()) {
$this->mReason = $wgRequest->getText('mwProtect-reason');
foreach ($wgRestrictionTypes as $action) {
$val = $wgRequest->getVal("mwProtect-level-{$action}");
if (isset($val) && in_array($val, $wgRestrictionLevels)) {
$this->mRestrictions[$action] = $val;
}
}
}
}
示例4: wfMsUploadRender
function wfMsUploadRender()
{
#global $wgOut,$wgUser,$wgUserName,$wgScriptPath;
global $output, $wgUser;
global $wgMSU_ShowAutoKat, $wgMSU_AutoIndex, $wgMSU_CheckedAutoKat;
if (!$wgUser->isAllowed('upload')) {
if (!$wgUser->isLoggedIn()) {
$output .= "<a id='ImageUploadLoginMsg'>einloggen</a>";
return 0;
} else {
$output .= "keine Berechtigung";
return 1;
}
} else {
if (wfReadOnly()) {
$output .= "Nur lesen";
return 2;
} else {
$output .= "<form action='' method='post' id='upload-form'>";
$output .= "<ul id='upload_list'></ul>";
$output .= "<hr noshade>";
$output .= "</form><a href='#' id='upload_all'></a>";
}
}
#return $output."|".$wgUser->getName();
return $output . "|" . $wgUser->getName() . "|" . $wgMSU_ShowAutoKat . "|" . $wgMSU_AutoIndex . "|" . $wgMSU_CheckedAutoKat;
}
示例5: wfSpecialMovepage
/**
* Constructor
*/
function wfSpecialMovepage($par = null)
{
global $wgUser, $wgOut, $wgRequest, $action;
# Check rights
if (!$wgUser->isAllowed('move')) {
$wgOut->showPermissionsErrorPage(array($wgUser->isAnon() ? 'movenologintext' : 'movenotallowed'));
return;
}
# Don't allow blocked users to move pages
if ($wgUser->isBlocked()) {
$wgOut->blockedPage();
return;
}
# Check for database lock
if (wfReadOnly()) {
$wgOut->readOnlyPage();
return;
}
$f = new MovePageForm($par);
if ('success' == $action) {
$f->showSuccess();
} else {
if ('submit' == $action && $wgRequest->wasPosted() && $wgUser->matchEditToken($wgRequest->getVal('wpEditToken'))) {
$f->doSubmit();
} else {
$f->showForm('');
}
}
}
示例6: execute
/**
* Show the special page
*
* @param $par Mixed: parameter passed to the page or null
*/
public function execute( $par ) {
global $wgRequest, $wgOut, $wgUser;
// If the user doesn't have the required 'awardsmanage' permission, display an error
if ( !$wgUser->isAllowed( 'awardsmanage' ) ) {
$wgOut->permissionRequired( 'awardsmanage' );
return;
}
// Show a message if the database is in read-only mode
if ( wfReadOnly() ) {
$wgOut->readOnlyPage();
return;
}
// If user is blocked, s/he doesn't need to access this page
if ( $wgUser->isBlocked() ) {
$wgOut->blockedPage();
return;
}
$this->gift_id = $wgRequest->getInt( 'gift_id' );
$this->initLogo( $wgRequest );
$this->executeLogo();
}
示例7: execute
public function execute($subpage)
{
global $wgOut, $wgUser, $wgExtensionsPath, $wgResourceBasePath;
// Boilerplate special page permissions
if ($wgUser->isBlocked()) {
throw new UserBlockedError($this->getUser()->mBlock);
}
if (!$wgUser->isAllowed('wikiaquiz')) {
$this->displayRestrictionError();
return;
}
if (wfReadOnly() && !wfAutomaticReadOnly()) {
$wgOut->readOnlyPage();
return;
}
$wgOut->addScript('<script src="' . $wgResourceBasePath . '/resources/wikia/libraries/jquery-ui/jquery-ui-1.8.14.custom.js"></script>');
$wgOut->addScript('<script src="' . $wgExtensionsPath . '/wikia/WikiaQuiz/js/CreateWikiaQuizArticle.js"></script>');
$wgOut->addStyle(AssetsManager::getInstance()->getSassCommonURL('/extensions/wikia/WikiaQuiz/css/WikiaQuizBuilder.scss'));
if ($subpage != '') {
// We came here from the edit link, go into edit mode
$wgOut->addHtml(F::app()->renderView('WikiaQuiz', 'EditQuizArticle', array('title' => $subpage)));
} else {
$wgOut->addHtml(F::app()->renderView('WikiaQuiz', 'CreateQuizArticle'));
}
}
示例8: execute
public function execute()
{
global $wgOut, $wgUser, $wgRequest, $wgTitle;
wfRunHooks('beforeBlogListingForm', array(&$this, $wgRequest->getVal('article')));
if (!$wgUser->isLoggedIn()) {
$wgOut->showErrorPage('create-blog-no-login', 'create-blog-login-required', array(wfGetReturntoParam()));
return;
}
if ($wgUser->isBlocked()) {
throw new UserBlockedError($this->getUser()->mBlock);
}
if (wfReadOnly()) {
$wgOut->readOnlyPage();
return;
}
$this->mTitle = Title::makeTitle(NS_SPECIAL, 'CreateBlogListingPage');
$wgOut->setPageTitle(wfMsg('create-blog-listing-title'));
if ($wgRequest->wasPosted()) {
$this->parseFormData();
if (count($this->mFormErrors) > 0 || !empty($this->mRenderedPreview)) {
$this->renderForm();
} else {
$this->save();
}
} else {
if ($wgRequest->getVal('article') != null) {
$this->parseTag(urldecode($wgRequest->getVal('article')));
}
$this->renderForm();
}
}
示例9: wfSpecialMovepage
/**
* Constructor
*/
function wfSpecialMovepage($par = null)
{
global $wgUser, $wgOut, $wgRequest, $action;
# Check for database lock
if (wfReadOnly()) {
$wgOut->readOnlyPage();
return;
}
$target = isset($par) ? $par : $wgRequest->getVal('target');
// Yes, the use of getVal() and getText() is wanted, see bug 20365
$oldTitleText = $wgRequest->getVal('wpOldTitle', $target);
$newTitleText = $wgRequest->getText('wpNewTitle');
$oldTitle = Title::newFromText($oldTitleText);
$newTitle = Title::newFromText($newTitleText);
if (is_null($oldTitle)) {
$wgOut->showErrorPage('notargettitle', 'notargettext');
return;
}
if (!$oldTitle->exists()) {
$wgOut->showErrorPage('nopagetitle', 'nopagetext');
return;
}
# Check rights
$permErrors = $oldTitle->getUserPermissionsErrors('move', $wgUser);
if (!empty($permErrors)) {
$wgOut->showPermissionsErrorPage($permErrors);
return;
}
$form = new MovePageForm($oldTitle, $newTitle);
if ('submit' == $action && $wgRequest->wasPosted() && $wgUser->matchEditToken($wgRequest->getVal('wpEditToken'))) {
$form->doSubmit();
} else {
$form->showForm('');
}
}
示例10: execute
public function execute($par)
{
global $wgUser, $wgOut, $wgRequest;
# Can't block when the database is locked
if (wfReadOnly()) {
$wgOut->readOnlyPage();
return;
}
# Permission check
if (!$this->userCanExecute($wgUser)) {
$wgOut->permissionRequired('block');
return;
}
$this->setup($par);
# bug 15810: blocked admins should have limited access here
if ($wgUser->isBlocked()) {
$status = IPBlockForm::checkUnblockSelf($this->BlockAddress);
if ($status !== true) {
throw new ErrorPageError('badaccess', $status);
}
}
$action = $wgRequest->getVal('action');
if ('success' == $action) {
$this->showSuccess();
} elseif ($wgRequest->wasPosted() && 'submit' == $action && $wgUser->matchEditToken($wgRequest->getVal('wpEditToken'))) {
$this->doSubmit();
} else {
$this->showForm('');
}
}
示例11: efAddToListEdit
function efAddToListEdit($action, $article)
{
global $wgOut, $wgRequest, $wgTitle;
if ($action !== 'addtolist') {
return true;
}
if ($article->mTitle->getText() != $wgTitle->getText()) {
return true;
}
// @todo should return some error
if (wfReadOnly()) {
return true;
}
$content = $article->getContent();
$item = trim($wgRequest->getText('item')) . $wgRequest->getText('postfix');
if (empty($item)) {
return true;
}
$parts = explode('* <addmore', $content);
$first = array_shift($parts);
array_unshift($parts, "* {$item}\n* <addmore");
array_unshift($parts, $first);
$newContent = implode('', $parts);
$article->doEdit($newContent, 'added list item');
$wgOut->redirect($article->mTitle->getFullUrl());
return false;
}
示例12: execute
/**
* Show the special page
*
* @param $par Mixed: parameter passed to the page or null
*/
public function execute($par)
{
$out = $this->getOutput();
$request = $this->getRequest();
$user = $this->getUser();
// Set the robot policies, etc.
$out->setArticleRelated(false);
$out->setRobotPolicy('noindex,nofollow');
// If the user doesn't have the required 'awardsmanage' permission, display an error
if (!$user->isAllowed('awardsmanage')) {
$out->permissionRequired('awardsmanage');
return;
}
// Show a message if the database is in read-only mode
if (wfReadOnly()) {
$out->readOnlyPage();
return;
}
// If user is blocked, s/he doesn't need to access this page
if ($user->isBlocked()) {
$out->blockedPage();
return;
}
$this->gift_id = $this->getRequest()->getInt('gift_id');
$this->initLogo();
$this->executeLogo();
}
示例13: onUnknownAction
public static function onUnknownAction($action, $article)
{
global $wgUser, $wgOut;
if ($action !== 'unfavorite' && $action !== 'favorite') {
return true;
}
if ($wgUser->isAnon()) {
$wgOut->showErrorPage('favoritenologin', 'favoritenologintext');
return;
}
if (wfReadOnly()) {
$wgOut->readOnlyPage();
return;
}
$wgOut->setRobotPolicy('noindex,nofollow');
if ($action === 'favorite') {
if (self::doFavorite($article)) {
$wgOut->setPagetitle(wfMsg('addedfavorite'));
$wgOut->addWikiMsg('addedfavoritetext', $article->getTitle()->getPrefixedText());
}
} else {
if (self::doUnfavorite($article)) {
$wgOut->setPagetitle(wfMsg('removedfavorite'));
$wgOut->addWikiMsg('removedfavoritetext', $article->getTitle()->getPrefixedText());
}
}
$wgOut->returnToMain(true, $article->getTitle()->getPrefixedText());
return false;
}
示例14: execute
function execute()
{
wfProfileIn(__METHOD__);
global $wgOut, $wgRequest;
if (wfReadOnly()) {
$wgOut->readOnlyPage();
wfProfileOut(__METHOD__);
return;
}
$articleID = $wgRequest->getInt('articleid');
$title = Title::newFromID($articleID);
if (!is_null($title) && $title->exists()) {
if (strpos($_SERVER['HTTP_USER_AGENT'], 'facebook') === false && strpos($_SERVER['HTTP_USER_AGENT'], 'bitlybot') === false) {
$sharerID = $wgRequest->getInt('userid');
$viewerIP = $wgRequest->getIP();
$awardingService = new AchAwardingService();
$awardingService->processSharing($articleID, $sharerID, $viewerIP);
}
} else {
$title = Title::newMainPage();
}
// this works only for Wikia and only in current varnish configuration
if (!headers_sent()) {
header('X-Pass-Cache-Control: no-store, private, no-cache, must-revalidate');
}
$wgOut->redirect($title->getLocalURL());
wfProfileOut(__METHOD__);
}
示例15: execute
function execute($subpage)
{
global $wgUser, $wgOut, $wgRequest;
if ($wgUser->isBlocked()) {
$wgOut->blockedPage();
return;
}
if (wfReadOnly()) {
$wgOut->readOnlyPage();
return;
}
if (!$wgUser->isAllowed('makesysop')) {
$this->displayRestrictionError();
return;
}
$this->setHeaders();
if ($wgUser->isAllowed('userrights')) {
$f = new MakesysopStewardForm($wgRequest);
$f->execute();
} else {
$f = new MakesysopForm($wgRequest);
if ($f->mSubmit) {
$f->doSubmit();
} else {
$f->showForm('');
}
}
}