userCan(Edit|Create|Move) are deprecated : do not use them
authorAntoine Musso <hashar@users.mediawiki.org>
Sat, 20 Jan 2007 17:58:38 +0000 (17:58 +0000)
committerAntoine Musso <hashar@users.mediawiki.org>
Sat, 20 Jan 2007 17:58:38 +0000 (17:58 +0000)
includes/EditPage.php
includes/ImagePage.php
includes/Skin.php
includes/SkinTemplate.php
includes/SpecialUpload.php
includes/Title.php
skins/Standard.php
skins/disabled/MonoBookCBT.php

index cffe15d..0415ea7 100644 (file)
@@ -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 );
index cfa0384..5936541 100644 (file)
@@ -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=' .
index 2776cfa..fb4007d 100644 (file)
@@ -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 {
index 99a6946..c7a2bfe 100644 (file)
@@ -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(
index 8261746..1e6b0a2 100644 (file)
@@ -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' ) );
                }
 
index 9361ed4..9951808 100644 (file)
@@ -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';
                }
 
index f05dd2c..f79571a 100644 (file)
@@ -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 ) {
index 3d145b2..73562eb 100644 (file)
@@ -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' ); }