From f5e16ebe09659a777f01a552b59c091390ee7f2e Mon Sep 17 00:00:00 2001 From: Antoine Musso Date: Sat, 20 Jan 2007 17:58:38 +0000 Subject: [PATCH] userCan(Edit|Create|Move) are deprecated : do not use them --- includes/EditPage.php | 6 +++--- includes/ImagePage.php | 4 ++-- includes/Skin.php | 6 +++--- includes/SkinTemplate.php | 2 +- includes/SpecialUpload.php | 2 +- includes/Title.php | 4 ++-- skins/Standard.php | 2 +- skins/disabled/MonoBookCBT.php | 4 ++-- 8 files changed, 15 insertions(+), 15 deletions(-) diff --git a/includes/EditPage.php b/includes/EditPage.php index cffe15d36b..0415ea7064 100644 --- a/includes/EditPage.php +++ b/includes/EditPage.php @@ -302,7 +302,7 @@ class EditPage { return; } - if ( ! $this->mTitle->userCanEdit() ) { + if ( ! $this->mTitle->userCan( 'edit' ) ) { wfDebug( "$fname: user can't edit\n" ); $wgOut->readOnlyPage( $this->getContent(), true ); wfProfileOut( $fname ); @@ -336,7 +336,7 @@ class EditPage { wfProfileOut($fname); return; } - if ( !$this->mTitle->userCanCreate() && !$this->mTitle->exists() ) { + if ( !$this->mTitle->userCan( 'create' ) && !$this->mTitle->exists() ) { wfDebug( "$fname: no create permission\n" ); $this->noCreatePermission(); wfProfileOut( $fname ); @@ -697,7 +697,7 @@ class EditPage { if ( 0 == $aid ) { // Late check for create permission, just in case *PARANOIA* - if ( !$this->mTitle->userCanCreate() ) { + if ( !$this->mTitle->userCan( 'create' ) ) { wfDebug( "$fname: no create permission\n" ); $this->noCreatePermission(); wfProfileOut( $fname ); diff --git a/includes/ImagePage.php b/includes/ImagePage.php index cfa038429a..5936541f37 100644 --- a/includes/ImagePage.php +++ b/includes/ImagePage.php @@ -620,7 +620,7 @@ END $wgOut->showErrorPage( 'uploadnologin', 'uploadnologintext' ); return; } - if ( ! $this->mTitle->userCanEdit() ) { + if ( ! $this->mTitle->userCan( 'edit' ) ) { $wgOut->readOnlyPage( $this->getContent(), true ); return; } @@ -732,7 +732,7 @@ class ImageHistoryList { } } else { $url = htmlspecialchars( wfImageArchiveUrl( $img ) ); - if( $wgUser->getID() != 0 && $wgTitle->userCanEdit() ) { + if( $wgUser->getID() != 0 && $wgTitle->userCan( 'edit' ) ) { $token = urlencode( $wgUser->editToken( $img ) ); $rlink = $this->skin->makeKnownLinkObj( $wgTitle, wfMsgHtml( 'revertimg' ), 'action=revert&oldimage=' . diff --git a/includes/Skin.php b/includes/Skin.php index 2776cfa1f4..fb4007d524 100644 --- a/includes/Skin.php +++ b/includes/Skin.php @@ -502,7 +502,7 @@ END; } else $a = array( 'bgcolor' => '#FFFFFF' ); if($wgOut->isArticle() && $wgUser->getOption('editondblclick') && - $wgTitle->userCanEdit() ) { + $wgTitle->userCan( 'edit' ) ) { $s = $wgTitle->getFullURL( $this->editUrlOptions() ); $s = 'document.location = "' .wfEscapeJSString( $s ) .'";'; $a += array ('ondblclick' => $s); @@ -1213,7 +1213,7 @@ END; if ( ! $wgOut->isArticleRelated() ) { $s = wfMsg( 'protectedpage' ); } else { - if ( $wgTitle->userCanEdit() ) { + if ( $wgTitle->userCan( 'edit' ) ) { $t = wfMsg( 'editthispage' ); } else { $t = wfMsg( 'viewsource' ); @@ -1298,7 +1298,7 @@ END; function moveThisPage() { global $wgTitle; - if ( $wgTitle->userCanMove() ) { + if ( $wgTitle->userCan( 'move' ) ) { return $this->makeKnownLinkObj( SpecialPage::getTitleFor( 'Movepage' ), wfMsg( 'movethispage' ), 'target=' . $wgTitle->getPrefixedURL() ); } else { diff --git a/includes/SkinTemplate.php b/includes/SkinTemplate.php index 99a69466bf..c7a2bfefc1 100644 --- a/includes/SkinTemplate.php +++ b/includes/SkinTemplate.php @@ -661,7 +661,7 @@ class SkinTemplate extends Skin { true); wfProfileIn( "$fname-edit" ); - if ( $this->mTitle->quickUserCan( 'edit' ) && ( $this->mTitle->exists() || $this->mTitle->userCanCreate( false ) ) ) { + if ( $this->mTitle->quickUserCan( 'edit' ) && ( $this->mTitle->exists() || $this->mTitle->quickUserCan( 'create' ) ) ) { $istalk = $this->mTitle->isTalkPage(); $istalkclass = $istalk?' istalk':''; $content_actions['edit'] = array( diff --git a/includes/SpecialUpload.php b/includes/SpecialUpload.php index 8261746808..1e6b0a2a4c 100644 --- a/includes/SpecialUpload.php +++ b/includes/SpecialUpload.php @@ -332,7 +332,7 @@ class UploadForm { * If the image is protected, non-sysop users won't be able * to modify it by uploading a new revision. */ - if( !$nt->userCanEdit() ) { + if( !$nt->userCan( 'edit' ) ) { return $this->uploadError( wfMsgWikiHtml( 'protectedpage' ) ); } diff --git a/includes/Title.php b/includes/Title.php index 9361ed4f9a..9951808cde 100644 --- a/includes/Title.php +++ b/includes/Title.php @@ -2035,8 +2035,8 @@ class Title { } if ( $auth && ( - !$this->userCanEdit() || !$nt->userCanEdit() || - !$this->userCanMove() || !$nt->userCanMove() ) ) { + !$this->userCan( 'edit' ) || !$nt->userCan( 'edit' ) || + !$this->userCan( 'move' ) || !$nt->userCan( 'move' ) ) ) { return 'protectedpage'; } diff --git a/skins/Standard.php b/skins/Standard.php index f05dd2c0fb..f79571a5af 100644 --- a/skins/Standard.php +++ b/skins/Standard.php @@ -246,7 +246,7 @@ class SkinStandard extends Skin { { $s .= $sep . $this->watchThisPage(); } - if ( $wgTitle->userCanEdit() ) + if ( $wgTitle->userCan( 'edit' ) ) $s .= $sep . $this->moveThisPage(); } if ( $wgUser->isAllowed('delete') and $articleExists ) { diff --git a/skins/disabled/MonoBookCBT.php b/skins/disabled/MonoBookCBT.php index 3d145b24ad..73562eb0f1 100644 --- a/skins/disabled/MonoBookCBT.php +++ b/skins/disabled/MonoBookCBT.php @@ -499,8 +499,8 @@ class SkinMonoBookCBT extends SkinTemplate { } function is_special() { return cbt_value( $this->mTitle->getNamespace() == NS_SPECIAL, 'title' ); } - function can_edit() { return cbt_value( (string)($this->mTitle->userCanEdit()), 'dynamic' ); } - function can_move() { return cbt_value( (string)($this->mTitle->userCanMove()), 'dynamic' ); } + function can_edit() { return cbt_value( (string)($this->mTitle->userCan( 'edit' )), 'dynamic' ); } + function can_move() { return cbt_value( (string)($this->mTitle->userCan( 'move' )), 'dynamic' ); } function is_talk() { return cbt_value( (string)($this->mTitle->isTalkPage()), 'title' ); } function is_protected() { return cbt_value( (string)$this->mTitle->isProtected(), 'dynamic' ); } function nskey() { return cbt_value( $this->mTitle->getNamespaceKey(), 'title' ); } -- 2.20.1