* Now sorting interwiki links by iw_prefix and avoiding duplicates
[lhc/web/wiklou.git] / includes / User.php
index edf98ef..42a6a89 100644 (file)
@@ -225,6 +225,23 @@ class User {
                        (false !== strpos( $addr, '@' ) );
        }
 
+       /**
+        * Count the number of edits of a user 
+        *
+        * @param int $uid The user ID to check
+        * @return int
+        */
+       function edits( $uid ) {
+               $fname = 'User::editCount';
+               
+               $dbr =& wfGetDB( DB_SLAVE );
+               return $dbr->selectField(
+                       'revision', 'count(*)',
+                       array( 'rev_user' => $uid ),
+                       $fname
+               );
+       }
+
        /**
         * probably return a random password
         * @return string probably a random password
@@ -512,6 +529,20 @@ class User {
                $this->getBlockedStatus( $bFromSlave );
                return $this->mBlockedby !== 0;
        }
+
+       /**
+        * Check if user is blocked from editing a particular article
+        */
+       function isBlockedFrom( $title, $bFromSlave = false ) {
+               global $wgBlockAllowsUTEdit;
+               if ( $wgBlockAllowsUTEdit && $title->getText() === $this->getName() && 
+                 $title->getNamespace() == NS_USER_TALK )
+               {
+                       return false;
+               } else {
+                       return $this->isBlocked( $bFromSlave );
+               }
+       }
        
        /**
         * Get name of blocker
@@ -1435,7 +1466,6 @@ class User {
 
                $confstr =        $this->getOption( 'math' );
                $confstr .= '!' . $this->getOption( 'stubthreshold' );
-               $confstr .= '!' . $this->getOption( 'editsection' );
                $confstr .= '!' . $this->getOption( 'date' );
                $confstr .= '!' . $this->getOption( 'numberheadings' );
                $confstr .= '!' . $this->getOption( 'language' );