Index: trunk/phase3/includes/EditPage.php |
— | — | @@ -380,9 +380,9 @@ |
381 | 381 | } |
382 | 382 | |
383 | 383 | if ( wfReadOnly() && $this->save ) { |
384 | | - // Force preview |
385 | | - $this->save = false; |
386 | | - $this->preview = true; |
| 384 | + // Force preview |
| 385 | + $this->save = false; |
| 386 | + $this->preview = true; |
387 | 387 | } |
388 | 388 | |
389 | 389 | $wgOut->addScriptFile( 'edit.js' ); |
— | — | @@ -404,7 +404,7 @@ |
405 | 405 | if ( $this->previewOnOpen() ) { |
406 | 406 | $this->formtype = 'preview'; |
407 | 407 | } else { |
408 | | - $this->extractMetaDataFromArticle () ; |
| 408 | + $this->extractMetaDataFromArticle() ; |
409 | 409 | $this->formtype = 'initial'; |
410 | 410 | } |
411 | 411 | } |
— | — | @@ -448,7 +448,6 @@ |
449 | 449 | # and redundantly check for locked database, blocked IPs, etc. |
450 | 450 | # that edit() already checked just in case someone tries to sneak |
451 | 451 | # in the back door with a hand-edited submission URL. |
452 | | - |
453 | 452 | if ( 'save' == $this->formtype ) { |
454 | 453 | if ( !$this->attemptSave() ) { |
455 | 454 | wfProfileOut( __METHOD__."-business-end" ); |
— | — | @@ -1108,8 +1107,7 @@ |
1109 | 1108 | # Some hook probably called this function without checking |
1110 | 1109 | # for is_null($wgTitle) first. Bail out right here so we don't |
1111 | 1110 | # do lots of work just to discard it right after. |
1112 | | - if (is_null($wgTitle)) |
1113 | | - return; |
| 1111 | + if (is_null($wgTitle)) return; |
1114 | 1112 | |
1115 | 1113 | $fname = 'EditPage::showEditForm'; |
1116 | 1114 | wfProfileIn( $fname ); |
— | — | @@ -1129,6 +1127,7 @@ |
1130 | 1128 | |
1131 | 1129 | $this->setHeaders(); |
1132 | 1130 | |
| 1131 | + $uComp = $this->checkUnicodeCompliantBrowser(); |
1133 | 1132 | # Enabled article-related sidebar, toplinks, etc. |
1134 | 1133 | $wgOut->setArticleRelated( true ); |
1135 | 1134 | |
— | — | @@ -1170,18 +1169,18 @@ |
1171 | 1170 | $wgOut->addWikiText( $this->hookError ); |
1172 | 1171 | } |
1173 | 1172 | |
1174 | | - if ( !$this->checkUnicodeCompliantBrowser() ) { |
| 1173 | + if ( !$uComp ) { |
1175 | 1174 | $wgOut->addWikiMsg( 'nonunicodebrowser' ); |
1176 | 1175 | } |
1177 | | - if ( isset( $this->mArticle ) && isset( $this->mArticle->mRevision ) ) { |
1178 | | - // Let sysop know that this will make private content public if saved |
1179 | 1176 | |
| 1177 | + if ( isset( $this->mArticle->mRevision ) ) { |
| 1178 | + // Let sysop know that this will make private content public if saved |
1180 | 1179 | if ( !$this->mArticle->mRevision->userCan( Revision::DELETED_TEXT ) ) { |
1181 | 1180 | $wgOut->addWikiMsg( 'rev-deleted-text-permission' ); |
1182 | 1181 | } else if ( $this->mArticle->mRevision->isDeleted( Revision::DELETED_TEXT ) ) { |
1183 | 1182 | $wgOut->addWikiMsg( 'rev-deleted-text-view' ); |
1184 | 1183 | } |
1185 | | - |
| 1184 | + // Give archived revision header |
1186 | 1185 | if ( !$this->mArticle->mRevision->isCurrent() ) { |
1187 | 1186 | $this->mArticle->setOldSubtitle( $this->mArticle->mRevision->getId() ); |
1188 | 1187 | $wgOut->addWikiMsg( 'editingold' ); |
— | — | @@ -1193,16 +1192,14 @@ |
1194 | 1193 | $wgOut->wrapWikiMsg( "<div id=\"mw-read-only-warning\">\n$1\n</div>", array( 'readonlywarning', wfReadOnlyReason() ) ); |
1195 | 1194 | } elseif ( $wgUser->isAnon() && $this->formtype != 'preview' ) { |
1196 | 1195 | $wgOut->wrapWikiMsg( '<div id="mw-anon-edit-warning">$1</div>', 'anoneditwarning' ); |
1197 | | - } else { |
1198 | | - if ( $this->isCssJsSubpage ) { |
1199 | | - # Check the skin exists |
1200 | | - if ( $this->isValidCssJsSubpage ) { |
1201 | | - if ( $this->formtype !== 'preview' ) { |
1202 | | - $wgOut->addWikiMsg( 'usercssjsyoucanpreview' ); |
1203 | | - } |
1204 | | - } else { |
1205 | | - $wgOut->addWikiMsg( 'userinvalidcssjstitle', $wgTitle->getSkinFromCssJsSubpage() ); |
| 1196 | + } else if ( $this->isCssJsSubpage ) { |
| 1197 | + # Check the skin exists |
| 1198 | + if ( $this->isValidCssJsSubpage ) { |
| 1199 | + if ( $this->formtype !== 'preview' ) { |
| 1200 | + $wgOut->addWikiMsg( 'usercssjsyoucanpreview' ); |
1206 | 1201 | } |
| 1202 | + } else { |
| 1203 | + $wgOut->addWikiMsg( 'userinvalidcssjstitle', $wgTitle->getSkinFromCssJsSubpage() ); |
1207 | 1204 | } |
1208 | 1205 | } |
1209 | 1206 | |
— | — | @@ -1229,11 +1226,9 @@ |
1230 | 1227 | # Is this page under cascading protection from some source pages? |
1231 | 1228 | list($cascadeSources, /* $restrictions */) = $this->mTitle->getCascadeProtectionSources(); |
1232 | 1229 | $notice = "$1\n"; |
1233 | | - if ( count($cascadeSources) > 0 ) { |
1234 | | - # Explain, and list the titles responsible |
1235 | | - foreach( $cascadeSources as $page ) { |
1236 | | - $notice .= '* [[:' . $page->getPrefixedText() . "]]\n"; |
1237 | | - } |
| 1230 | + # Explain, and list the titles responsible |
| 1231 | + foreach( $cascadeSources as $page ) { |
| 1232 | + $notice .= '* [[:' . $page->getPrefixedText() . "]]\n"; |
1238 | 1233 | } |
1239 | 1234 | $wgOut->wrapWikiMsg( $notice, array( 'cascadeprotectedwarning', count($cascadeSources) ) ); |
1240 | 1235 | } |
— | — | @@ -1246,7 +1241,8 @@ |
1247 | 1242 | } |
1248 | 1243 | if ( $this->tooBig || $this->kblength > $wgMaxArticleSize ) { |
1249 | 1244 | $wgOut->addHTML( "<div class='error' id='mw-edit-longpageerror'>\n" ); |
1250 | | - $wgOut->addWikiMsg( 'longpageerror', $wgLang->formatNum( $this->kblength ), $wgLang->formatNum( $wgMaxArticleSize ) ); |
| 1245 | + $wgOut->addWikiMsg( 'longpageerror', $wgLang->formatNum( $this->kblength ), |
| 1246 | + $wgLang->formatNum( $wgMaxArticleSize ) ); |
1251 | 1247 | $wgOut->addHTML( "</div>\n" ); |
1252 | 1248 | } elseif ( $this->kblength > 29 ) { |
1253 | 1249 | $wgOut->addHTML( "<div id='mw-edit-longpagewarning'>\n" ); |
— | — | @@ -1255,15 +1251,13 @@ |
1256 | 1252 | } |
1257 | 1253 | |
1258 | 1254 | $q = 'action='.$this->action; |
1259 | | - #if ( "no" == $redirect ) { $q .= "&redirect=no"; } |
1260 | 1255 | $action = $wgTitle->escapeLocalURL( $q ); |
1261 | 1256 | |
1262 | 1257 | $colonSep = wfMsg( 'colon-separator' ); |
1263 | 1258 | $summary = wfMsg( 'summary' ) . $colonSep; |
1264 | 1259 | $subject = wfMsg( 'subject' ) . $colonSep; |
1265 | 1260 | |
1266 | | - $cancel = $sk->makeKnownLink( $wgTitle->getPrefixedText(), |
1267 | | - wfMsgExt('cancel', array('parseinline')) ); |
| 1261 | + $cancel = $sk->makeKnownLink( $wgTitle->getPrefixedText(), wfMsgExt('cancel', array('parseinline')) ); |
1268 | 1262 | $edithelpurl = Skin::makeInternalOrExternalUrl( wfMsgForContent( 'edithelppage' )); |
1269 | 1263 | $edithelp = '<a target="helpwindow" href="'.$edithelpurl.'">'. |
1270 | 1264 | htmlspecialchars( wfMsg( 'edithelp' ) ).'</a> '. |
— | — | @@ -1279,17 +1273,19 @@ |
1280 | 1274 | '[[' . wfMsgForContent( 'copyrightpage' ) . ']]' ); |
1281 | 1275 | } |
1282 | 1276 | |
1283 | | - if ( $wgUser->getOption('showtoolbar') and !$this->isCssJsSubpage ) { |
| 1277 | + if ( $wgUser->getOption('showtoolbar') && !$this->isCssJsSubpage ) { |
1284 | 1278 | # prepare toolbar for edit buttons |
1285 | 1279 | $toolbar = EditPage::getEditToolbar(); |
1286 | 1280 | } else { |
1287 | 1281 | $toolbar = ''; |
1288 | 1282 | } |
1289 | 1283 | |
1290 | | - // activate checkboxes if user wants them to be always active |
| 1284 | + // Activate checkboxes if user wants them to be always active |
1291 | 1285 | if ( !$this->preview && !$this->diff ) { |
1292 | 1286 | # Sort out the "watch" checkbox |
1293 | | - if ( $wgUser->getOption( 'watchdefault' ) ) { |
| 1287 | + if( $wgRequest->getBool( 'watchthis' ) ) { |
| 1288 | + $this->watchthis = true; // May be overriden by request parameters |
| 1289 | + } else if ( $wgUser->getOption( 'watchdefault' ) ) { |
1294 | 1290 | # Watch all edits |
1295 | 1291 | $this->watchthis = true; |
1296 | 1292 | } elseif ( $wgUser->getOption( 'watchcreations' ) && !$this->mTitle->exists() ) { |
— | — | @@ -1299,13 +1295,8 @@ |
1300 | 1296 | # Already watched |
1301 | 1297 | $this->watchthis = true; |
1302 | 1298 | } |
1303 | | - |
1304 | | - # May be overriden by request parameters |
1305 | | - if( $wgRequest->getBool( 'watchthis' ) ) { |
1306 | | - $this->watchthis = true; |
1307 | | - } |
1308 | | - |
1309 | | - if ( $wgUser->getOption( 'minordefault' ) ) $this->minoredit = true; |
| 1299 | + if ( $wgUser->getOption( 'minordefault' ) ) |
| 1300 | + $this->minoredit = true; |
1310 | 1301 | } |
1311 | 1302 | |
1312 | 1303 | $wgOut->addHTML( $this->editFormPageTop ); |
— | — | @@ -1314,7 +1305,6 @@ |
1315 | 1306 | $this->displayPreviewArea( $previewOutput, true ); |
1316 | 1307 | } |
1317 | 1308 | |
1318 | | - |
1319 | 1309 | $wgOut->addHTML( $this->editFormTextTop ); |
1320 | 1310 | |
1321 | 1311 | # if this is a comment, show a subject line at the top, which is also the edit summary. |
— | — | @@ -1333,9 +1323,9 @@ |
1334 | 1324 | $autosumm = $this->autoSumm ? $this->autoSumm : md5( $this->summary ); |
1335 | 1325 | $summaryhiddens .= Xml::hidden( 'wpAutoSummary', $autosumm ); |
1336 | 1326 | if ( $this->section == 'new' ) { |
| 1327 | + global $wgParser; |
1337 | 1328 | $commentsubject="<span id='wpSummaryLabel'><label for='wpSummary'>{$subject}</label></span>\n<input tabindex='1' type='text' value=\"$summarytext\" name='wpSummary' id='wpSummary' maxlength='200' size='60' />{$summaryhiddens}<br />"; |
1338 | 1329 | $editsummary = "<div class='editOptions'>\n"; |
1339 | | - global $wgParser; |
1340 | 1330 | $formattedSummary = wfMsgForContent( 'newsectionsummary', $wgParser->stripSectionName( $this->summary ) ); |
1341 | 1331 | $subjectpreview = $summarytext && $this->preview ? "<div class=\"mw-summary-preview\">".wfMsg('subject-preview').$colonSep.$sk->commentBlock( $formattedSummary, $this->mTitle, true )."</div>\n" : ''; |
1342 | 1332 | $summarypreview = ''; |
— | — | @@ -1356,7 +1346,8 @@ |
1357 | 1347 | $hiddencats = $this->mArticle->getHiddenCategories(); |
1358 | 1348 | $formattedhiddencats = $sk->formatHiddenCategories( $hiddencats ); |
1359 | 1349 | |
1360 | | - global $wgUseMetadataEdit ; |
| 1350 | + $metadata = ''; |
| 1351 | + global $wgUseMetadataEdit; |
1361 | 1352 | if ( $wgUseMetadataEdit ) { |
1362 | 1353 | $metadata = $this->mMetaData ; |
1363 | 1354 | $metadata = htmlspecialchars( $wgContLang->recodeForEdit( $metadata ) ) ; |
— | — | @@ -1369,7 +1360,6 @@ |
1370 | 1361 | /* /ToDo */ |
1371 | 1362 | $metadata = $top . "<textarea name='metadata' rows='3' cols='{$cols}'{$ew}>{$metadata}</textarea>" ; |
1372 | 1363 | } |
1373 | | - else $metadata = "" ; |
1374 | 1364 | |
1375 | 1365 | $recreate = ''; |
1376 | 1366 | if ( $this->wasDeletedSinceLastEdit() ) { |
— | — | @@ -1396,8 +1386,7 @@ |
1397 | 1387 | $buttons = $this->getEditButtons( $tabindex ); |
1398 | 1388 | $buttonshtml = implode( $buttons, "\n" ); |
1399 | 1389 | |
1400 | | - $safemodehtml = $this->checkUnicodeCompliantBrowser() |
1401 | | - ? '' : Xml::hidden( 'safemode', '1' ); |
| 1390 | + $safemodehtml = $uComp ? '' : Xml::hidden( 'safemode', '1' ); |
1402 | 1391 | |
1403 | 1392 | $wgOut->addHTML( <<<END |
1404 | 1393 | {$toolbar} |
— | — | @@ -1405,7 +1394,7 @@ |
1406 | 1395 | END |
1407 | 1396 | ); |
1408 | 1397 | |
1409 | | - if ( is_callable( $formCallback ) ) { |
| 1398 | + if ( $formCallback && is_callable( $formCallback ) ) { |
1410 | 1399 | call_user_func_array( $formCallback, array( &$wgOut ) ); |
1411 | 1400 | } |
1412 | 1401 | |