X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fspecials%2FSpecialChangeContentModel.php;h=b37c47556f7fd561a4e3307b9cf32851ea386629;hb=fc7d715b4b5adedd0ae3e9e6f969c89e19d460eb;hp=ee9f665bbd36d51a60fcc83042f5e0df986cfe7b;hpb=327f0a9f6f1d6a80ae5b3c741340efb172b75432;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/specials/SpecialChangeContentModel.php b/includes/specials/SpecialChangeContentModel.php index ee9f665bbd..b37c47556f 100644 --- a/includes/specials/SpecialChangeContentModel.php +++ b/includes/specials/SpecialChangeContentModel.php @@ -84,12 +84,20 @@ class SpecialChangeContentModel extends FormSpecialPage { ], ]; if ( $this->title ) { + $options = $this->getOptionsForTitle( $this->title ); + if ( empty( $options ) ) { + throw new ErrorPageError( + 'changecontentmodel-emptymodels-title', + 'changecontentmodel-emptymodels-text', + $this->title->getPrefixedText() + ); + } $fields['pagetitle']['readonly'] = true; $fields += [ 'model' => [ 'type' => 'select', 'name' => 'model', - 'options' => $this->getOptionsForTitle( $this->title ), + 'options' => $options, 'label-message' => 'changecontentmodel-model-label' ], 'reason' => [ @@ -183,7 +191,14 @@ class SpecialChangeContentModel extends FormSpecialPage { // Page doesn't exist, create an empty content object $newContent = ContentHandler::getForModelID( $data['model'] )->makeEmptyContent(); } + + // All other checks have passed, let's check rate limits + if ( $user->pingLimiter( 'editcontentmodel' ) ) { + throw new ThrottledError(); + } + $flags = $this->oldRevision ? EDIT_UPDATE : EDIT_NEW; + $flags |= EDIT_INTERNAL; if ( $user->isAllowed( 'bot' ) ) { $flags |= EDIT_FORCE_BOT; }