From 4f98bda5ba2624f2543f77d499d5a9b5841b746e Mon Sep 17 00:00:00 2001 From: Andrew Garrett Date: Fri, 16 Feb 2007 07:39:33 +0000 Subject: [PATCH] Fix for ProtectionForm - consider expiry times invalid if theyre in the past. Also a *very* minor typo fix from my previous work on alignment in the expiry box. --- includes/ProtectionForm.php | 8 +++++++- languages/messages/MessagesEn.php | 1 + 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/includes/ProtectionForm.php b/includes/ProtectionForm.php index 0b96521628..d1bbae0af1 100644 --- a/includes/ProtectionForm.php +++ b/includes/ProtectionForm.php @@ -158,6 +158,12 @@ class ProtectionForm { } $expiry = wfTimestamp( TS_MW, $expiry ); + + if ( $expiry < wfTimestampNow() ) { + $this->show( wfMsg( 'protect_expiry_old' ) ); + return false; + } + } $ok = $this->mArticle->updateRestrictions( $this->mRestrictions, $this->mReason, $this->mCascade, $expiry ); @@ -292,7 +298,7 @@ class ProtectionForm { 'id' => "$id-label", 'for' => $id ), wfMsg( 'protectexpiry' ) ); - $ci .= " "; + $ci .= " "; $ci .= wfElement( 'input', array( 'size' => 60, 'name' => $id, diff --git a/languages/messages/MessagesEn.php b/languages/messages/MessagesEn.php index e03cc60108..683f1e5b32 100644 --- a/languages/messages/MessagesEn.php +++ b/languages/messages/MessagesEn.php @@ -1760,6 +1760,7 @@ Please hit "back" and reload the page you came from, then try again.', 'protectcomment' => 'Reason for protecting', 'protectexpiry' => 'Expiry', 'protect_expiry_invalid' => 'Expiry time is invalid.', +'protect_expiry_old' => 'Expiry time is in the past.', 'unprotectsub' =>"(Unprotecting \"$1\")", 'confirmunprotecttext' => 'Do you really want to unprotect this page?', 'confirmunprotect' => 'Confirm unprotection', -- 2.20.1