Revert for now r28986, 28987, 28992 - image redirects.
[lhc/web/wiklou.git] / includes / Article.php
index 56070b2..9a7e85b 100644 (file)
@@ -870,7 +870,7 @@ class Article {
 
                # If we have been passed an &rcid= parameter, we want to give the user a
                # chance to mark this new article as patrolled.
-               if (!is_null( $rcid ) && $rcid != 0 && $wgUser->isAllowed( 'patrol' ) ) {
+               if( !is_null( $rcid ) && $rcid != 0 && $wgUser->isAllowed( 'patrol' ) && $this->mTitle->exists() ) {
                        $wgOut->addHTML(
                                "<div class='patrollink'>" .
                                        wfMsgHtml( 'markaspatrolledlink',
@@ -1709,7 +1709,7 @@ class Article {
                global $wgUser, $wgRestrictionTypes, $wgContLang;
 
                $id = $this->mTitle->getArticleID();
-               if( !$wgUser->isAllowed( 'protect' ) || wfReadOnly() || $id == 0 ) {
+               if( array() != $this->mTitle->getUserPermissionsErrors( 'protect', $wgUser ) || wfReadOnly() || $id == 0 ) {
                        return false;
                }
 
@@ -1923,11 +1923,15 @@ class Article {
         */
        function delete() {
                global $wgUser, $wgOut, $wgRequest;
+
                $confirm = $wgRequest->wasPosted() &&
-                       $wgUser->matchEditToken( $wgRequest->getVal( 'wpEditToken' ) );
-               $this->DeleteReasonList = $wgRequest->getText( 'wpDeleteReasonList' );
+                               $wgUser->matchEditToken( $wgRequest->getVal( 'wpEditToken' ) );
+               
+               $this->DeleteReasonList = $wgRequest->getText( 'wpDeleteReasonList', 'other' );
                $this->DeleteReason = $wgRequest->getText( 'wpReason' );
+               
                $reason = $this->DeleteReasonList;
+               
                if ( $reason != 'other' && $this->DeleteReason != '') {
                        // Entry from drop down menu + additional comment
                        $reason .= ': ' . $this->DeleteReason;
@@ -2084,22 +2088,22 @@ class Article {
                $wgOut->addHTML( "
 <form id='deleteconfirm' method='post' action=\"{$formaction}\">
        <table border='0'>
-               <tr>
+               <tr id=\"wpDeleteReasonListRow\" name=\"wpDeleteReasonListRow\">
                        <td align='right'>
                                $delcom:
                        </td>
                        <td align='left'>
-                               <select tabindex='2' id='wpDeleteReasonList' name=\"wpDeleteReasonList\">
+                               <select tabindex='1' id='wpDeleteReasonList' name=\"wpDeleteReasonList\">
                                        $deleteReasonList
                                </select>
                        </td>
                </tr>
-               <tr>
+               <tr id=\"wpDeleteReasonRow\" name=\"wpDeleteReasonRow\">
                        <td>
                                $mDeletereasonother
                        </td>
-                       <td align='right'>
-                               <input type='text' maxlength='255' size='60' name='wpReason' id='wpReason' value=\"" . htmlspecialchars( $reason ) . "\" tabindex=\"1\" />
+                       <td align='left'>
+                               <input type='text' maxlength='255' size='60' name='wpReason' id='wpReason' value=\"" . htmlspecialchars( $reason ) . "\" tabindex=\"2\" />
                        </td>
                </tr>
                <tr>
@@ -2360,7 +2364,11 @@ class Article {
                        $summary = wfMsgForContent( 'revertpage', $target->getUserText(), $from );
 
                # Save
-               $flags = EDIT_UPDATE | EDIT_MINOR;
+               $flags = EDIT_UPDATE;
+
+               if ($wgUser->isAllowed('minoredit'))
+                       $flags |= EDIT_MINOR;
+
                if( $bot )
                        $flags |= EDIT_FORCE_BOT;
                $this->doEdit( $target->getText(), $summary, $flags );
@@ -2496,6 +2504,7 @@ class Article {
                $edit->pst = $this->preSaveTransform( $text );
                $options = new ParserOptions;
                $options->setTidy( true );
+               $options->enableLimitReport();
                $edit->output = $wgParser->parse( $edit->pst, $this->mTitle, $options, true, true, $revid );
                $edit->oldText = $this->getContent();
                $this->mPreparedEdit = $edit;
@@ -2889,6 +2898,7 @@ class Article {
 
                $title->touchLinks();
                $title->purgeSquid();
+               $title->deleteTitleProtection();
        }
 
        static function onArticleDelete( $title ) {
@@ -3146,9 +3156,11 @@ class Article {
 
                $popts = $wgOut->parserOptions();
                $popts->setTidy(true);
+               $popts->enableLimitReport();
                $parserOutput = $wgParser->parse( $text, $this->mTitle,
                        $popts, true, true, $this->getRevIdFetched() );
                $popts->setTidy(false);
+               $popts->enableLimitReport( false );
                if ( $cache && $this && $parserOutput->getCacheTime() != -1 ) {
                        $parserCache =& ParserCache::singleton();
                        $parserCache->save( $parserOutput, $this, $wgUser );