Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: priority always rejected + cleanup form validation #11

Merged
merged 17 commits into from
Apr 23, 2024
Merged
8 changes: 4 additions & 4 deletions src/SpecialPage/SpecialResourceLoaderArticles.php
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ public function addPageCB( $formData ) {
. '</div>'
);
$store = false;
} elseif ( !is_int( $formData[ 'Priority' ] ) ) {
} elseif ( !ctype_digit( $formData[ 'Priority' ] ) ) {
iMarbot marked this conversation as resolved.
Show resolved Hide resolved
$output->addWikiTextAsContent(
'<div class="error">'
. $this->msg( 'resourceloaderarticles-error-priority-invalid' )->text()
Expand All @@ -205,7 +205,7 @@ public function addPageCB( $formData ) {
'rla_page' => $formData[ 'Page' ],
'rla_wiki' => $formData[ 'Wiki' ],
'rla_type' => $formData[ 'Type' ],
'rla_priority' => $formData[ 'Priority' ]
'rla_priority' => intval( $formData[ 'Priority' ] )
]
);
$output->addWikiTextAsContent(
Expand Down Expand Up @@ -309,7 +309,7 @@ public function editPageCB( $formData ) {
. '</div>'
);
$store = false;
} elseif ( !is_int( $formData[ 'Priority' ] ) ) {
} elseif ( !ctype_digit( $formData[ 'Priority' ] ) ) {
$output->addWikiTextAsContent(
'<div class="error">'
. $this->msg( 'resourceloaderarticles-error-priority-invalid' )->text()
Expand All @@ -325,7 +325,7 @@ public function editPageCB( $formData ) {
'rla_page' => $formData[ 'Page' ],
'rla_wiki' => $formData[ 'Wiki' ],
'rla_type' => $formData[ 'Type' ],
'rla_priority' => $formData[ 'Priority' ]
'rla_priority' => intval( $formData[ 'Priority' ] )
],
[
'rla_id' => $formData[ 'Id' ]
Expand Down