Index: trunk/extensions/SemanticForms/specials/SF_FormStart.php |
— | — | @@ -72,7 +72,7 @@ |
73 | 73 | // find out whether this page already exists, |
74 | 74 | // and send user to the appropriate form |
75 | 75 | $page_title = Title::newFromText( $page_name ); |
76 | | - if ( ! $page_title ) { |
| 76 | + if ( !$page_title ) { |
77 | 77 | //If there was no page title, it's probably an invalid page name, |
78 | 78 | // containing forbidden characters. |
79 | 79 | $wgOut->addHTML( htmlspecialchars( wfMsg( 'sf_formstart_badtitle', $page_name ) ) ); |
Index: trunk/extensions/SemanticForms/includes/SF_Utils.php |
— | — | @@ -121,25 +121,18 @@ |
122 | 122 | * etc. |
123 | 123 | */ |
124 | 124 | 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 ) { |
137 | 128 | $action = "wpSave"; |
138 | | - elseif ( $is_preview ) |
| 129 | + } |
| 130 | + elseif ( $is_preview ) { |
139 | 131 | $action = "wpPreview"; |
140 | | - else // $is_diff |
| 132 | + } |
| 133 | + else { // $is_diff |
141 | 134 | $action = "wpDiff"; |
| 135 | + } |
142 | 136 | |
143 | | - global $sfgScriptPath; |
144 | 137 | $text = <<<END |
145 | 138 | <p style="position: absolute; left: 45%; top: 45%;"><img src="$sfgScriptPath/skins/loading.gif" /></p> |
146 | 139 | |
— | — | @@ -148,14 +141,23 @@ |
149 | 142 | $form_body .= "\t" . Xml::hidden( 'wpSummary', $edit_summary ) . "\n"; |
150 | 143 | $form_body .= "\t" . Xml::hidden( 'wpStarttime', $start_time ) . "\n"; |
151 | 144 | $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"; |
153 | 146 | $form_body .= "\t" . Xml::hidden( $action, null ) . "\n"; |
154 | 147 | |
155 | 148 | if ( $is_minor_edit ) |
156 | 149 | $form_body .= "\t" . Xml::hidden( 'wpMinoredit' , null ) . "\n"; |
157 | 150 | if ( $watch_this ) |
158 | 151 | $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 | + ); |
160 | 162 | |
161 | 163 | $text .= <<<END |
162 | 164 | <script type="text/javascript"> |