r80471 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r80470‎ | r80471 | r80472 >
Date:22:47, 17 January 2011
Author:jeroendedauw
Status:deferred
Tags:
Comment:
Some small fixes
Modified paths:
  • /trunk/extensions/SemanticForms/includes/SF_Utils.php (modified) (history)
  • /trunk/extensions/SemanticForms/specials/SF_FormStart.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticForms/specials/SF_FormStart.php
@@ -72,7 +72,7 @@
7373 // find out whether this page already exists,
7474 // and send user to the appropriate form
7575 $page_title = Title::newFromText( $page_name );
76 - if ( ! $page_title ) {
 76+ if ( !$page_title ) {
7777 //If there was no page title, it's probably an invalid page name,
7878 // containing forbidden characters.
7979 $wgOut->addHTML( htmlspecialchars( wfMsg( 'sf_formstart_badtitle', $page_name ) ) );
Index: trunk/extensions/SemanticForms/includes/SF_Utils.php
@@ -121,25 +121,18 @@
122122 * etc.
123123 */
124124 static function printRedirectForm( $title, $page_contents, $edit_summary, $is_save, $is_preview, $is_diff, $is_minor_edit, $watch_this, $start_time, $edit_time ) {
125 - if ( $title instanceof Title )
126 - $new_url = $title->getLocalURL( 'action=submit' );
127 - else
128 - $new_url = $title;
129 - global $wgUser;
130 - if ( $wgUser->isLoggedIn() )
131 - $token = htmlspecialchars( $wgUser->editToken() );
132 - else
133 - $token = EDIT_TOKEN_SUFFIX;
134 -
135 - $edit_summary = htmlspecialchars( $edit_summary );
136 - if ( $is_save )
 125+ global $wgUser, $sfgScriptPath;
 126+
 127+ if ( $is_save ) {
137128 $action = "wpSave";
138 - elseif ( $is_preview )
 129+ }
 130+ elseif ( $is_preview ) {
139131 $action = "wpPreview";
140 - else // $is_diff
 132+ }
 133+ else { // $is_diff
141134 $action = "wpDiff";
 135+ }
142136
143 - global $sfgScriptPath;
144137 $text = <<<END
145138 <p style="position: absolute; left: 45%; top: 45%;"><img src="$sfgScriptPath/skins/loading.gif" /></p>
146139
@@ -148,14 +141,23 @@
149142 $form_body .= "\t" . Xml::hidden( 'wpSummary', $edit_summary ) . "\n";
150143 $form_body .= "\t" . Xml::hidden( 'wpStarttime', $start_time ) . "\n";
151144 $form_body .= "\t" . Xml::hidden( 'wpEdittime', $edit_time ) . "\n";
152 - $form_body .= "\t" . Xml::hidden( 'wpEditToken', $token ) . "\n";
 145+ $form_body .= "\t" . Xml::hidden( 'wpEditToken', $wgUser->isLoggedIn() ? $wgUser->editToken() : EDIT_TOKEN_SUFFIX ) . "\n";
153146 $form_body .= "\t" . Xml::hidden( $action, null ) . "\n";
154147
155148 if ( $is_minor_edit )
156149 $form_body .= "\t" . Xml::hidden( 'wpMinoredit' , null ) . "\n";
157150 if ( $watch_this )
158151 $form_body .= "\t" . Xml::hidden( 'wpWatchthis', null ) . "\n";
159 - $text .= Xml::tags( 'form', array( 'id' => 'editform', 'name' => 'editform', 'method' => 'post', 'action' => $new_url ), $form_body );
 152+ $text .= Xml::tags(
 153+ 'form',
 154+ array(
 155+ 'id' => 'editform',
 156+ 'name' => 'editform',
 157+ 'method' => 'post',
 158+ 'action' => $title instanceof Title ? $title->getLocalURL( 'action=submit' ) : $title
 159+ ),
 160+ $form_body
 161+ );
160162
161163 $text .= <<<END
162164 <script type="text/javascript">