function rollback()
{
- global $wgUser, $wgTitle, $wgLang, $wgOut;
+ global $wgUser, $wgTitle, $wgLang, $wgOut, $from;
if ( ! $wgUser->isSysop() ) {
$wgOut->sysopRequired();
return;
}
-
+
# Replace all this user's current edits with the next one down
$tt = wfStrencode( $wgTitle->getDBKey() );
$n = $wgTitle->getNamespace();
# Get the last editor
- $sql = "SELECT cur_id,cur_user,cur_user_text FROM cur WHERE cur_title='{$tt}' AND cur_namespace={$n}";
+ $sql = "SELECT cur_id,cur_user,cur_user_text,cur_comment FROM cur WHERE cur_title='{$tt}' AND cur_namespace={$n}";
$res = wfQuery( $sql );
if( ($x = wfNumRows( $res )) != 1 ) {
# Something wrong
$uid = $s->cur_user;
$pid = $s->cur_id;
+ $from = str_replace( '_', ' ', wfCleanQueryVar( $from ) );
+ if( $from != $s->cur_user_text ) {
+ $wgOut->addHTML( wfMsg( "alreadyrolled",
+ htmlspecialchars( $from ),
+ htmlspecialchars( $s->cur_user_text ),
+ htmlspecialchars( $s->cur_comment ) ) );
+ return;
+ }
+
# Get the last edit not by this guy
$sql = "SELECT old_text,old_user,old_user_text
FROM old USE INDEX (name_title_timestamp)
function ucListEdit( $sk, $ns, $t, $ts, $topmark, $comment )
{
- global $wgLang, $wgOut, $wgUser;
+ global $wgLang, $wgOut, $wgUser, $target;
$page = Title::makeName( $ns, $t );
$link = $sk->makeKnownLink( $page, "" );
$topmarktext = $topmark ? wfMsg ( "uctop" ) : "";
$sysop = $wgUser->isSysop();
if($sysop && $topmark ) {
$topmarktext .= " [". $sk->makeKnownLink( $page,
- wfMsg( "rollbacklink" ), "action=rollback" ) ."]";
+ wfMsg( "rollbacklink" ), "action=rollback&from=" . urlencode( $target ) ) ."]";
}
if($comment) {
"rollback" => "Roll back edits",
"rollbacklink" => "rollback",
"cantrollback" => "Can't revert edit; last contributor is only author of this article.",
+"alreadyrolled" => "<b>Can't roll back last edit by $1; someone else has edited or
+rolled back the article already.</b>
+
+<p>Last edit was by $2, marked \"<i>$3</i>\".",
"revertpage" => "Reverted to last edit by $1",
# Undelete