1<?php 2// $Id: history.php 11892 2003-03-04 20:55:15Z ralfbecker $ 3 4require('parse/main.php'); 5require('parse/macros.php'); 6require('parse/html.php'); 7require('lib/diff.php'); 8require(TemplateDir . '/history.php'); 9require('lib/headers.php'); 10 11// Display the known history of a page's edits. 12function action_history() 13{ 14 global $pagestore, $page, $full, $HistMax; 15 16 $history = $pagestore->history($page); 17 18 gen_headers($history[0][0]); 19 20 21 $text = ''; 22 $latest_auth = ''; 23 $previous_ver = 0; 24 $is_latest = 1; 25 26 for($i = 0; $i < count($history); $i++) 27 { 28 if($latest_auth == '') 29 { 30 $latest_auth = ($history[$i][3] == '' ? $history[$i][1] 31 : $history[$i][3]); 32 $latest_ver = $history[$i][2]; 33 } 34 35 if($previous_ver == 0 36 && $latest_auth != ($history[$i][3] == '' ? $history[$i][1] 37 : $history[$i][3])) 38 { $previous_ver = $history[$i][2]; } 39 40 if($i < $HistMax || $full) 41 { 42 $text = $text . html_history_entry($page, $history[$i][2], 43 $history[$i][0], $history[$i][1], 44 $history[$i][3], 45 $previous_ver == $history[$i][2] || !$full && $i == count($history)-1, 46 $is_latest, $history[$i][4]); 47 } 48 49 $is_latest = 0; 50 } 51 52 if($i >= $HistMax && !$full) 53 { $text = $text . html_fullhistory($page, count($history)); } 54 55 $p1 = $pagestore->page($page); 56 $p1->version = $previous_ver; 57 $p2 = $pagestore->page($page); 58 $p2->version = $latest_ver; 59 60 $diff = diff_compute($p1->read(), $p2->read()); 61 template_history(array('page' => $page, 62 'history' => $text, 63 'diff' => diff_parse($diff))); 64} 65?> 66