Kill a bunch of unused $wgUser
[lhc/web/wiklou.git] / includes / specials / SpecialUpload.php
index 6268e4f..232064d 100644 (file)
@@ -155,7 +155,7 @@ class UploadForm {
         * Returns true if there was an error, false otherwise
         */
        private function curlCopy( $url, $dest ) {
-               global $wgUser, $wgOut;
+               global $wgUser, $wgOut, $wgHTTPProxy, $wgCopyUploadTimeout;
 
                if( !$wgUser->isAllowed( 'upload_by_url' ) ) {
                        $wgOut->permissionRequired( 'upload_by_url' );
@@ -180,9 +180,12 @@ class UploadForm {
 
                $ch = curl_init();
                curl_setopt( $ch, CURLOPT_HTTP_VERSION, 1.0); # Probably not needed, but apparently can work around some bug
-               curl_setopt( $ch, CURLOPT_TIMEOUT, 10); # 10 seconds timeout
+               curl_setopt( $ch, CURLOPT_TIMEOUT, $wgCopyUploadTimeout); # Default 30 seconds timeout
                curl_setopt( $ch, CURLOPT_LOW_SPEED_LIMIT, 512); # 0.5KB per second minimum transfer speed
                curl_setopt( $ch, CURLOPT_URL, $url);
+               if( $wgHTTPProxy ) {
+                       curl_setopt( $ch, CURLOPT_PROXY, $wgHTTPProxy );
+               }
                curl_setopt( $ch, CURLOPT_WRITEFUNCTION, array( $this, 'uploadCurlCallback' ) );
                curl_exec( $ch );
                $error = curl_errno( $ch ) ? true : false;
@@ -285,7 +288,7 @@ class UploadForm {
         * @access private
         */
        function processUpload(){
-               global $wgUser, $wgOut, $wgFileExtensions, $wgLang;
+               global $wgOut, $wgFileExtensions, $wgLang;
                $details = null;
                $value = null;
                $value = $this->internalProcessUpload( $details );
@@ -993,7 +996,7 @@ wgUploadAutoFill = {$autofill};
                        }
 
                        // Show the relevant lines from deletion log (for still deleted files only)
-                       if( $title instanceof Title && $title->isDeleted() > 0 && !$title->exists() ) {
+                       if( $title instanceof Title && $title->isDeletedQuick() && !$title->exists() ) {
                                $this->showDeletionLog( $wgOut, $title->getPrefixedText() );
                        }
                }
@@ -1121,10 +1124,8 @@ wgUploadAutoFill = {$autofill};
                        $warningRow = '';
                        $destOnkeyup = '';
                }
-               # Uploading a new version? If so, the name is fixed.
-               $on = $this->mForReUpload ? "readonly='readonly'" : "";
-
                $encComment = htmlspecialchars( $this->mComment );
+               
 
                $wgOut->addHTML(
                         Xml::openElement( 'form', array( 'method' => 'post', 'action' => $titleObj->getLocalURL(),
@@ -1152,10 +1153,26 @@ wgUploadAutoFill = {$autofill};
                                <td class='mw-label'>
                                        <label for='wpDestFile'>{$destfilename}</label>
                                </td>
-                               <td class='mw-input'>
-                                       <input tabindex='2' type='text' name='wpDestFile' id='wpDestFile' size='60'
-                                               value=\"{$encDestName}\" onchange='toggleFilenameFiller()' $on $destOnkeyup />
-                               </td>
+                               <td class='mw-input'>"
+               );
+               if( $this->mForReUpload ) {
+                       $wgOut->addHTML(
+                               Xml::hidden( 'wpDestFile', $this->mDesiredDestName, array('id'=>'wpDestFile','tabindex'=>2) ) .
+                               "<tt>" .
+                               $encDestName .
+                               "</tt>"
+                       );
+               }
+               else {
+                       $wgOut->addHTML(
+                               "<input tabindex='2' type='text' name='wpDestFile' id='wpDestFile' size='60'
+                                               value=\"{$encDestName}\" onchange='toggleFilenameFiller()' $destOnkeyup />"
+                       );
+               }
+               
+
+               $wgOut->addHTML(
+                               "</td>
                        </tr>
                        <tr>
                                <td class='mw-label'>
@@ -1236,20 +1253,23 @@ wgUploadAutoFill = {$autofill};
                        <tr>
                                <td></td>
                                        <td class='mw-input'>
-                                               <input tabindex='9' type='submit' name='wpUpload' value=\"{$ulb}\"" . $wgUser->getSkin()->tooltipAndAccesskey( 'upload' ) . " />
+                                               <input tabindex='9' type='submit' name='wpUpload' value=\"{$ulb}\"" .
+                                                       $wgUser->getSkin()->tooltipAndAccesskey( 'upload' ) . " />
                                        </td>
                        </tr>
                        <tr>
                                <td></td>
                                <td class='mw-input'>"
                );
-               $wgOut->addWikiText( wfMsgForContent( 'edittools' ) );
+               $wgOut->addHTML( '<div class="mw-editTools">' );
+               $wgOut->addWikiMsgArray( 'edittools', array(), array( 'content' ) );
+               $wgOut->addHTML( '</div>' );
                $wgOut->addHTML( "
                                </td>
                        </tr>" .
                        Xml::closeElement( 'table' ) .
                        Xml::hidden( 'wpDestFileWarningAck', '', array( 'id' => 'wpDestFileWarningAck' ) ) .
-                       Xml::hidden( 'wpForReUpload', $this->mForReUpload ) .
+                       Xml::hidden( 'wpForReUpload', $this->mForReUpload, array( 'id' => 'wpForReUpload' ) ) .
                        Xml::closeElement( 'fieldset' ) .
                        Xml::closeElement( 'form' )
                );