From: Aryeh Gregor Date: Thu, 3 Jan 2008 23:43:24 +0000 (+0000) Subject: Various Userrights-related fixes: X-Git-Tag: 1.31.0-rc.0~50146 X-Git-Url: http://git.cyclocoop.org/%24action?a=commitdiff_plain;h=c7c46174844f697800a9d4f2dfb543b73b14f3b6;p=lhc%2Fweb%2Fwiklou.git Various Userrights-related fixes: * Adjust UserrightsForm so that it inherits from SpecialPage; nuke HTMLForm. Since this breaks backward compatibility, renamed to UserrightsPage. * Created SpecialPage::isRestricted() and enforced use of SpecialPage::userCanExecute() instead of hardcoded checks. These can now be overridden so that more complicated restriction systems work sanely. Used them for UserrightsPage (fixes bug 12489). * A few random comment/documentation tweaks. Also, update Special:Version date. --- diff --git a/includes/AutoLoader.php b/includes/AutoLoader.php index 312ea4f16e..0d1c751429 100644 --- a/includes/AutoLoader.php +++ b/includes/AutoLoader.php @@ -93,7 +93,6 @@ function __autoload($className) { 'FileStore' => 'includes/FileStore.php', 'FSException' => 'includes/FileStore.php', 'FSTransaction' => 'includes/FileStore.php', - 'HTMLForm' => 'includes/HTMLForm.php', 'HistoryBlob' => 'includes/HistoryBlob.php', 'ConcatenatedGzipHistoryBlob' => 'includes/HistoryBlob.php', 'HistoryBlobStub' => 'includes/HistoryBlob.php', @@ -232,7 +231,7 @@ function __autoload($className) { 'UploadForm' => 'includes/SpecialUpload.php', 'UploadFormMogile' => 'includes/SpecialUploadMogile.php', 'LoginForm' => 'includes/SpecialUserlogin.php', - 'UserrightsForm' => 'includes/SpecialUserrights.php', + 'UserrightsPage' => 'includes/SpecialUserrights.php', 'SpecialVersion' => 'includes/SpecialVersion.php', 'WantedCategoriesPage' => 'includes/SpecialWantedcategories.php', 'WantedPagesPage' => 'includes/SpecialWantedpages.php', diff --git a/includes/HTMLForm.php b/includes/HTMLForm.php deleted file mode 100644 index 69ec1007c2..0000000000 --- a/includes/HTMLForm.php +++ /dev/null @@ -1,107 +0,0 @@ -mRequest = $request; - } - - /** - * @private - * @param $name String: name of the fieldset. - * @param $content String: HTML content to put in. - * @return string HTML fieldset - */ - function fieldset( $name, $content ) { - return "
".wfMsg($this->mName.'-'.$name)."\n" . - $content . "\n
\n"; - } - - /** - * @private - * @param $varname String: name of the checkbox. - * @param $checked Boolean: set true to check the box (default False). - */ - function checkbox( $varname, $checked=false ) { - if ( $this->mRequest->wasPosted() && !is_null( $this->mRequest->getVal( $varname ) ) ) { - $checked = $this->mRequest->getCheck( $varname ); - } - return "
\n"; - } - - /** - * @private - * @param $varname String: name of the textbox. - * @param $value String: optional value (default empty) - * @param $size Integer: optional size of the textbox (default 20) - */ - function textbox( $varname, $value='', $size=20 ) { - if ( $this->mRequest->wasPosted() ) { - $value = $this->mRequest->getText( $varname, $value ); - } - $value = htmlspecialchars( $value ); - return "
\n"; - } - - /** - * @private - * @param $varname String: name of the radiobox. - * @param $fields Array: Various fields. - */ - function radiobox( $varname, $fields ) { - foreach ( $fields as $value => $checked ) { - $s .= "
\n"; - } - return $this->fieldset( $varname, $s ); - } - - /** - * @private - * @param $varname String: name of the textareabox. - * @param $value String: optional value (default empty) - * @param $size Integer: optional size of the textarea (default 20) - */ - function textareabox ( $varname, $value='', $size=20 ) { - if ( $this->mRequest->wasPosted() ) { - $value = $this->mRequest->getText( $varname, $value ); - } - $value = htmlspecialchars( $value ); - return '
\n"; - } - - /** - * @private - * @param $varname String: name of the arraybox. - * @param $size Integer: Optional size of the textarea (default 20) - */ - function arraybox( $varname , $size=20 ) { - $s = ''; - if ( $this->mRequest->wasPosted() ) { - $arr = $this->mRequest->getArray( $varname ); - if ( is_array( $arr ) ) { - foreach ( $_POST[$varname] as $element ) { - $s .= htmlspecialchars( $element )."\n"; - } - } - } - return "