home *** CD-ROM | disk | FTP | other *** search
/ Chip 2004 April / CMCD0404.ISO / Software / Freeware / Programare / groupoffice-com-2.01 / modules / wiki / action / history.php < prev    next >
PHP Script  |  2004-03-08  |  2KB  |  65 lines

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