示例#1
0
if ($wgMetaNamespace === false) {
    $wgMetaNamespace = str_replace(' ', '_', $wgSitename);
}
// Default value is 2000 or the suhosin limit if it is between 1 and 2000
if ($wgResourceLoaderMaxQueryLength === false) {
    $suhosinMaxValueLength = (int) ini_get('suhosin.get.max_value_length');
    if ($suhosinMaxValueLength > 0 && $suhosinMaxValueLength < 2000) {
        $wgResourceLoaderMaxQueryLength = $suhosinMaxValueLength;
    } else {
        $wgResourceLoaderMaxQueryLength = 2000;
    }
    unset($suhosinMaxValueLength);
}
// Ensure the minimum chunk size is less than PHP upload limits or the maximum
// upload size.
$wgMinUploadChunkSize = min($wgMinUploadChunkSize, UploadBase::getMaxUploadSize('file'), UploadBase::getMaxPhpUploadSize(), (wfShorthandToInteger(ini_get('post_max_size') ?: ini_get('hhvm.server.max_post_size'), PHP_INT_MAX) ?: PHP_INT_MAX) - 1024);
/**
 * Definitions of the NS_ constants are in Defines.php
 * @private
 */
$wgCanonicalNamespaceNames = [NS_MEDIA => 'Media', NS_SPECIAL => 'Special', NS_TALK => 'Talk', NS_USER => 'User', NS_USER_TALK => 'User_talk', NS_PROJECT => 'Project', NS_PROJECT_TALK => 'Project_talk', NS_FILE => 'File', NS_FILE_TALK => 'File_talk', NS_MEDIAWIKI => 'MediaWiki', NS_MEDIAWIKI_TALK => 'MediaWiki_talk', NS_TEMPLATE => 'Template', NS_TEMPLATE_TALK => 'Template_talk', NS_HELP => 'Help', NS_HELP_TALK => 'Help_talk', NS_CATEGORY => 'Category', NS_CATEGORY_TALK => 'Category_talk'];
/// @todo UGLY UGLY
if (is_array($wgExtraNamespaces)) {
    $wgCanonicalNamespaceNames = $wgCanonicalNamespaceNames + $wgExtraNamespaces;
}
// These are now the same, always
// To determine the user language, use $wgLang->getCode()
$wgContLanguageCode = $wgLanguageCode;
// Easy to forget to falsify $wgDebugToolbar for static caches.
// If file cache or CDN cache is on, just disable this (DWIMD).
if ($wgUseFileCache || $wgUseSquid) {
示例#2
0
 /**
  * Get the descriptor of the fieldset that contains the file source
  * selection. The section is 'source'
  *
  * @return array Descriptor array
  */
 protected function getSourceSection()
 {
     if ($this->mSessionKey) {
         return array('SessionKey' => array('type' => 'hidden', 'default' => $this->mSessionKey), 'SourceType' => array('type' => 'hidden', 'default' => 'Stash'));
     }
     $canUploadByUrl = UploadFromUrl::isEnabled() && UploadFromUrl::isAllowed($this->getUser()) === true && $this->getConfig()->get('CopyUploadsFromSpecialUpload');
     $radio = $canUploadByUrl;
     $selectedSourceType = strtolower($this->getRequest()->getText('wpSourceType', 'File'));
     $descriptor = array();
     if ($this->mTextTop) {
         $descriptor['UploadFormTextTop'] = array('type' => 'info', 'section' => 'source', 'default' => $this->mTextTop, 'raw' => true);
     }
     $this->mMaxUploadSize['file'] = min(UploadBase::getMaxUploadSize('file'), UploadBase::getMaxPhpUploadSize());
     $help = $this->msg('upload-maxfilesize', $this->getContext()->getLanguage()->formatSize($this->mMaxUploadSize['file']))->parse();
     // If the user can also upload by URL, there are 2 different file size limits.
     // This extra message helps stress which limit corresponds to what.
     if ($canUploadByUrl) {
         $help .= $this->msg('word-separator')->escaped();
         $help .= $this->msg('upload_source_file')->parse();
     }
     $descriptor['UploadFile'] = array('class' => 'UploadSourceField', 'section' => 'source', 'type' => 'file', 'id' => 'wpUploadFile', 'radio-id' => 'wpSourceTypeFile', 'label-message' => 'sourcefilename', 'upload-type' => 'File', 'radio' => &$radio, 'help' => $help, 'checked' => $selectedSourceType == 'file');
     if ($canUploadByUrl) {
         $this->mMaxUploadSize['url'] = UploadBase::getMaxUploadSize('url');
         $descriptor['UploadFileURL'] = array('class' => 'UploadSourceField', 'section' => 'source', 'id' => 'wpUploadFileURL', 'radio-id' => 'wpSourceTypeurl', 'label-message' => 'sourceurl', 'upload-type' => 'url', 'radio' => &$radio, 'help' => $this->msg('upload-maxfilesize', $this->getContext()->getLanguage()->formatSize($this->mMaxUploadSize['url']))->parse() . $this->msg('word-separator')->escaped() . $this->msg('upload_source_url')->parse(), 'checked' => $selectedSourceType == 'url');
     }
     Hooks::run('UploadFormSourceDescriptors', array(&$descriptor, &$radio, $selectedSourceType));
     $descriptor['Extensions'] = array('type' => 'info', 'section' => 'source', 'default' => $this->getExtensionsMessage(), 'raw' => true);
     return $descriptor;
 }