* @param $request Data posted.
*/
function __construct( $request = null ) {
- parent::__construct( 'Upload' );
+ parent::__construct( 'Upload', 'upload' );
$this->mRequest = $request;
}
$this->mAction = $request->getVal( 'action' );
$this->mUpload = UploadBase::createFromRequest( $request );
}
-
+
+ public function userCanExecute( $user ) {
+ return UploadBase::isEnabled() && parent::userCanExecute( $user );
+ }
+
/**
* Start doing stuff
* @access public
}
- if( $this->mReUpload ) {
+ if( $this->mReUpload && $this->mUpload) {
// User choose to cancel upload
if( !$this->mUpload->unsaveUploadedFile() ) {
return;
# Get the maximum file size from php.ini as $wgMaxUploadSize works for uploads from URL via CURL only
# See http://www.php.net/manual/en/ini.core.php#ini.upload-max-filesize for possible values of upload_max_filesize
- $val = trim( ini_get( 'upload_max_filesize' ) );
- $last = strtoupper( ( substr( $val, -1 ) ) );
- switch( $last ) {
- case 'G':
- $val2 = substr( $val, 0, -1 ) * 1024 * 1024 * 1024;
- break;
- case 'M':
- $val2 = substr( $val, 0, -1 ) * 1024 * 1024;
- break;
- case 'K':
- $val2 = substr( $val, 0, -1 ) * 1024;
- break;
- default:
- $val2 = $val;
- }
+ $val = wfShorthandToInteger( ini_get( 'upload_max_filesize' ) );
$maxUploadSize = '<div id="mw-upload-maxfilesize">' .
wfMsgExt( 'upload-maxfilesize', array( 'parseinline', 'escapenoentities' ),
$wgLang->formatSize( $val2 ) ) .
"toggle_element_check(\"wpSourceTypeFile\",\"wpSourceTypeURL\")' " .
"onchange='fillDestFilename(\"wpUploadFile\")' size='60' />" .
wfMsgHTML( 'upload_source_file' ) . "<br/>" .
- "<input type='radio' id='wpSourceTypeURL' name='wpSourceType' value='web' " .
+ "<input type='radio' id='wpSourceTypeURL' name='wpSourceType' value='Url' " .
"onchange='toggle_element_activation(\"wpUploadFile\",\"wpUploadFileURL\")' />" .
"<input tabindex='1' type='text' name='wpUploadFileURL' id='wpUploadFileURL' " .
"onfocus='" .
static function getInitialPageText( $comment='', $license='', $copyStatus='', $source='' ) {
global $wgUseCopyrightUpload;
if ( $wgUseCopyrightUpload ) {
+ $licensetxt = '';
if ( $license != '' ) {
$licensetxt = '== ' . wfMsgForContent( 'license' ) . " ==\n" . '{{' . $license . '}}' . "\n";
}