if ( isset( $wgNamespaceRobotPolicies[$ns] ) ) {
$policy = $wgNamespaceRobotPolicies[$ns];
} else {
+ # The default policy. Dev note: make sure you change the documentation
+ # in DefaultSettings.php before changing it.
$policy = 'index,follow';
}
$wgOut->setRobotpolicy( $policy );
}
$link = $sk->makeLinkObj( $rt, $rt->getFullText() );
- $wgOut->addHTML( '<img src="'.$imageUrl.'" alt="#REDIRECT" />' .
+ $wgOut->addHTML( '<img src="'.$imageUrl.'" alt="#REDIRECT " />' .
'<span class="redirectText">'.$link.'</span>' );
$parseout = $wgParser->parse($text, $this->mTitle, ParserOptions::newFromUser($wgUser));
$oldtext = $this->getContent();
$oldsize = strlen( $oldtext );
- $newsize = strlen( $text );
# Provide autosummaries if one is not provided.
if ($flags & EDIT_AUTOSUMMARY && $summary == '')
$summary = $this->getAutosummary( $oldtext, $text, $flags );
$text = $this->preSaveTransform( $text );
+ $newsize = strlen( $text );
$dbw =& wfGetDB( DB_MASTER );
$now = wfTimestampNow();
$revisionId );
# Mark as patrolled if the user can do so
- if( $wgUser->isAllowed( 'patrol' ) ) {
+ if( $wgUser->isAllowed( 'autopatrol' ) ) {
RecentChange::markPatrolled( $rcid );
}
}
$rcid = RecentChange::notifyNew( $now, $this->mTitle, $isminor, $wgUser, $summary, $bot,
'', strlen( $text ), $revisionId );
# Mark as patrolled if the user can
- if( $wgUser->isAllowed( 'patrol' ) ) {
+ if( $wgUser->isAllowed( 'autopatrol' ) ) {
RecentChange::markPatrolled( $rcid );
}
}
*/
function markpatrolled() {
global $wgOut, $wgRequest, $wgUseRCPatrol, $wgUser;
- $wgOut->setRobotpolicy( 'noindex,nofollow' );
+ $wgOut->setRobotPolicy( 'noindex,nofollow' );
# Check RC patrol config. option
if( !$wgUseRCPatrol ) {
return;
}
+ # If we haven't been given an rc_id value, we can't do anything
$rcid = $wgRequest->getVal( 'rcid' );
- if ( !is_null ( $rcid ) ) {
- if( wfRunHooks( 'MarkPatrolled', array( &$rcid, &$wgUser, false ) ) ) {
- RecentChange::markPatrolled( $rcid );
- wfRunHooks( 'MarkPatrolledComplete', array( &$rcid, &$wgUser, false ) );
- $wgOut->setPagetitle( wfMsg( 'markedaspatrolled' ) );
- $wgOut->addWikiText( wfMsg( 'markedaspatrolledtext' ) );
- }
- $rcTitle = SpecialPage::getTitleFor( 'Recentchanges' );
- $wgOut->returnToMain( false, $rcTitle->getPrefixedText() );
+ if( !$rcid ) {
+ $wgOut->errorPage( 'markedaspatrollederror', 'markedaspatrollederrortext' );
+ return;
}
- else {
- $wgOut->showErrorPage( 'markedaspatrollederror', 'markedaspatrollederrortext' );
+
+ # Handle the 'MarkPatrolled' hook
+ if( !wfRunHooks( 'MarkPatrolled', array( $rcid, &$wgUser, false ) ) ) {
+ return;
}
+
+ $return = SpecialPage::getTitleFor( 'Recentchanges' );
+ # If it's left up to us, check that the user is allowed to patrol this edit
+ # If the user has the "autopatrol" right, then we'll assume there are no
+ # other conditions stopping them doing so
+ if( !$wgUser->isAllowed( 'autopatrol' ) ) {
+ $rc = RecentChange::newFromId( $rcid );
+ # Graceful error handling, as we've done before here...
+ # (If the recent change doesn't exist, then it doesn't matter whether
+ # the user is allowed to patrol it or not; nothing is going to happen
+ if( is_object( $rc ) && $wgUser->getName() == $rc->getAttribute( 'rc_user_text' ) ) {
+ # The user made this edit, and can't patrol it
+ # Tell them so, and then back off
+ $wgOut->setPageTitle( wfMsg( 'markedaspatrollederror' ) );
+ $wgOut->addWikiText( wfMsgNoTrans( 'markedaspatrollederror-noautopatrol' ) );
+ $wgOut->returnToMain( false, $return );
+ return;
+ }
+ }
+
+ # Mark the edit as patrolled
+ RecentChange::markPatrolled( $rcid );
+ wfRunHooks( 'MarkPatrolledComplete', array( &$rcid, &$wgUser, false ) );
+
+ # Inform the user
+ $wgOut->setPageTitle( wfMsg( 'markedaspatrolled' ) );
+ $wgOut->addWikiText( wfMsgNoTrans( 'markedaspatrolledtext' ) );
+ $wgOut->returnToMain( false, $return );
}
/**
$confirm = htmlspecialchars( wfMsg( 'deletepage' ) );
$delcom = htmlspecialchars( wfMsg( 'deletecomment' ) );
$token = htmlspecialchars( $wgUser->editToken() );
- $watch = Xml::checkLabel( wfMsg( 'watchthis' ), 'wpWatch', 'wpWatch', $wgUser->getBoolOption( 'watchdeletion' ) || $this->mTitle->userIsWatching() );
+ $watch = Xml::checkLabel( wfMsg( 'watchthis' ), 'wpWatch', 'wpWatch', $wgUser->getBoolOption( 'watchdeletion' ) || $this->mTitle->userIsWatching(), array( 'tabindex' => '2' ) );
$wgOut->addHTML( "
<form id='deleteconfirm' method='post' action=\"{$formaction}\">
<label for='wpReason'>{$delcom}:</label>
</td>
<td align='left'>
- <input type='text' size='60' name='wpReason' id='wpReason' value=\"" . htmlspecialchars( $reason ) . "\" />
+ <input type='text' size='60' name='wpReason' id='wpReason' value=\"" . htmlspecialchars( $reason ) . "\" tabindex=\"1\" />
</td>
</tr>
<tr>
<tr>
<td> </td>
<td>
- <input type='submit' name='wpConfirmB' id='wpConfirmB' value=\"{$confirm}\" />
+ <input type='submit' name='wpConfirmB' id='wpConfirmB' value=\"{$confirm}\" tabindex=\"3\" />
</td>
</tr>
</table>
'ar_minor_edit' => 'rev_minor_edit',
'ar_rev_id' => 'rev_id',
'ar_text_id' => 'rev_text_id',
+ 'ar_text' => '\'\'', // Be explicit to appease
+ 'ar_flags' => '\'\'', // MySQL's "strict mode"...
), array(
'page_id' => $id,
'page_id = rev_page'
if ($wgDBtype == 'mysql')
$dbw->query("LOCK TABLES $hitcounterTable WRITE");
$tabletype = $wgDBtype == 'mysql' ? "ENGINE=HEAP " : '';
- $dbw->query("CREATE TEMPORARY TABLE $acchitsTable $tabletype AS".
+ $dbw->query("CREATE TEMPORARY TABLE $acchitsTable $tabletype AS ".
"SELECT hc_id,COUNT(*) AS hc_n FROM $hitcounterTable ".
'GROUP BY hc_id');
$dbw->query("DELETE FROM $hitcounterTable");
if ($flags & EDIT_NEW && strlen($newtext)) {
#If they're making a new article, give its text, truncated, in the summary.
global $wgContLang;
- $truncatedtext = $wgContLang->truncate( $newtext, max( 0, 200 -
- strlen( wfMsgForContent( 'autosumm-new') ) ), '...' );
+ $truncatedtext = $wgContLang->truncate(
+ str_replace("\n", ' ', $newtext),
+ max( 0, 200 - strlen( wfMsgForContent( 'autosumm-new') ) ),
+ '...' );
$summary = wfMsgForContent( 'autosumm-new', $truncatedtext );
}