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