diff -r 35d94240a197 -r 7ecbe721217c index.php --- a/index.php Sun Feb 10 19:35:06 2008 -0500 +++ b/index.php Mon Feb 11 10:05:33 2008 -0500 @@ -153,12 +153,49 @@ if(isset($_POST['_preview'])) { $text = $_POST['page_text']; + $edsumm = $_POST['edit_summary']; echo PageUtils::genPreview($_POST['page_text']); $text = htmlspecialchars($text); + $revid = 0; } else { - $text = RenderMan::getPage($paths->cpage['urlname_nons'], $paths->namespace, 0, false, false, false, false); + $revid = ( isset($_GET['revid']) ) ? intval($_GET['revid']) : 0; + $page = new PageProcessor($paths->page_id, $paths->namespace, $revid); + $text = $page->fetch_source(); + $edsumm = ''; + // $text = RenderMan::getPage($paths->cpage['urlname_nons'], $paths->namespace, 0, false, false, false, false); + } + if ( $revid > 0 ) + { + echo '
' . $lang->get('editor_msg_editing_old_revision') . '
'; + // Retrieve information about this revision and the current one + $q = $db->sql_query('SELECT l1.author AS currentrev_author, l2.author AS oldrev_author FROM ' . table_prefix . 'logs AS l1 + LEFT JOIN ' . table_prefix . 'logs AS l2 + ON ( l2.time_id = ' . $revid . ' + AND l2.log_type = \'page\' + AND l2.action = \'edit\' + AND l2.page_id = \'ACL_Tests\' + AND l2.namespace = \'Article\' + ) + WHERE l1.log_type = \'page\' + AND l1.action = \'edit\' + AND l1.page_id = \'ACL_Tests\' + AND l1.namespace = \'Article\' + AND l1.time_id >= ' . $revid . ' + ORDER BY l1.time_id DESC;'); + if ( !$q ) + $db->die_json(); + + $rev_count = $db->numrows() - 1; + $row = $db->fetchrow(); + $undo_info = array( + 'old_author' => $row['oldrev_author'], + 'current_author' => $row['currentrev_author'], + 'undo_count' => $rev_count, + 'last_rev_id' => $revid + ); + $db->free_result(); } echo '
@@ -166,7 +203,8 @@

'; - echo $lang->get('editor_lbl_edit_summary') . '

'; + $edsumm = ( $revid > 0 ) ? $lang->get('editor_reversion_edit_summary', $undo_info) : $edsumm; + echo $lang->get('editor_lbl_edit_summary') . '

'; if ( !$session->user_logged_in && getConfig('guest_edit_require_captcha') == '1' ) { echo '
';