X-Git-Url: https://git.heureux-cyclage.org/?p=lhc%2Fweb%2Fwiklou.git;a=blobdiff_plain;f=includes%2Fspecials%2FSpecialUpload.php;h=f7cb654527ba593ba8f2169ac75c6d50722b6d2b;hp=024034a6284f2b2e6c9668c7739e4a96ba36cbcc;hb=a2c8c2969420a0f150c03f76e3a0bf9028fcda43;hpb=52ba4e60846b7c47d7b460beee82654346c41093 diff --git a/includes/specials/SpecialUpload.php b/includes/specials/SpecialUpload.php index 024034a628..f7cb654527 100644 --- a/includes/specials/SpecialUpload.php +++ b/includes/specials/SpecialUpload.php @@ -612,25 +612,29 @@ class SpecialUpload extends SpecialPage { } } + $licenseText = ''; + if ( $license !== '' ) { + $licenseText = '== ' . $msg['license-header'] . " ==\n{{" . $license . "}}\n"; + } + + $pageText = $comment . "\n"; + $headerText = '== ' . $msg['filedesc'] . ' =='; + if ( $comment !== '' && strpos( $comment, $headerText ) === false ) { + // prepend header to page text unless it's already there (or there is no content) + $pageText = $headerText . "\n" . $pageText; + } + if ( $config->get( 'UseCopyrightUpload' ) ) { - $licensetxt = ''; - if ( $license != '' ) { - $licensetxt = '== ' . $msg['license-header'] . " ==\n" . '{{' . $license . '}}' . "\n"; - } - $pageText = '== ' . $msg['filedesc'] . " ==\n" . $comment . "\n" . - '== ' . $msg['filestatus'] . " ==\n" . $copyStatus . "\n" . - "$licensetxt" . - '== ' . $msg['filesource'] . " ==\n" . $source; + $pageText .= '== ' . $msg['filestatus'] . " ==\n" . $copyStatus . "\n"; + $pageText .= $licenseText; + $pageText .= '== ' . $msg['filesource'] . " ==\n" . $source; } else { - if ( $license != '' ) { - $filedesc = $comment == '' ? '' : '== ' . $msg['filedesc'] . " ==\n" . $comment . "\n"; - $pageText = $filedesc . - '== ' . $msg['license-header'] . " ==\n" . '{{' . $license . '}}' . "\n"; - } else { - $pageText = $comment; - } + $pageText .= $licenseText; } + // allow extensions to modify the content + Hooks::run( 'UploadForm:getInitialPageText', [ &$pageText, $msg, $config ] ); + return $pageText; }