inc/recentchanges.php

<P>
This page is a list of all unique (i.e. not by the same person to the same page twice in a row) changes to the Wiki 
<?php
  $timespan 
= (int)$_REQUEST["timespan"];
  if (
$timespan 900)
    unset(
$timespan);
  if (!isset(
$timespan) && !isset($lastcomment))
    
$timespan 86400;
  if (isset(
$timespan))
    echo(
"in the last ".time_name($timespan).".");
  else
    echo(
"since your last update.");
  echo (
"<BR>Recent changes are at the ".($changeorder=="desc"?"top":"bottom").
    
" of the list.  <FONT SIZE=\"-1\">(<A HREF=\"?setchangeorder=" 
    (
$changeorder=="desc"?"asc":"desc")."\" CLASS=INT>Change this</A>)</FONT>");
?>
</P><P>
View all changes from the last:
<A HREF="?timespan=3600" CLASS=INT>hour</A>,
<A HREF="?timespan=21600" CLASS=INT>6 hours</A>,
<A HREF="?timespan=86400" CLASS=INT>day</A>,
<A HREF="?timespan=259200" CLASS=INT>3 days</A>,
<A HREF="?timespan=604800" CLASS=INT>week</A>, or
<?php
  $randspan 
rand(1,1000000);
  echo (
"<A HREF=\"?timespan=$randspan\" CLASS=INT>".time_name($randspan)."</A>.\n");
?>
</P>
<UL>
<?php

function printchange($cpage,$maxrev,$minrev,$time,$name,$type,$revoked) {
  echo(
"<LI>");
  if (
$revoked)
    echo(
"<STRIKE>");
  if (
$type == 'm')
    echo(
"Minor edit of ");
  elseif (
$type == 'd')
    echo(
"Deletion of ");
  elseif (
$type == 'c')
    echo(
"<B>Creation</B> of ");
  elseif (
$type == 'e')
    echo(
"<B>Change</B> to ");
  elseif (
$type == 't')
    echo(
"Title change of ");
  
$toplen = -1;
  while (
strpos($cpage,"/",$toplen+1) !== false) {
    
$toplen strpos($cpage,"/",$toplen+1);
    echo(
title_encode(get_title(substr($cpage,0,$toplen))).": ");
  }
  if (
$type == 'c' || $type == 'e')
    echo(
"<B>");
  echo(
"<A HREF=\"/$cpage\" CLASS=".(check_page($cpage)?"int":"broken").">");
  echo(
title_encode(get_revision_title($cpage,$maxrev)));
  echo(
"</A>");
  if (
$type == 'c' || $type == 'e')
    echo(
"</B>");
  echo(
"\n<!-- old title: ^".get_revision_title($cpage,$minrev-1)."$-->");
  echo(
"\n<!-- new title: ^".get_revision_title($cpage,$maxrev)."$-->");
  if (
get_revision_title($cpage,$minrev-1) != get_revision_title($cpage,$maxrev))
    echo(
" (was: ".title_encode(get_revision_title($cpage,$minrev-1)).")");
  echo(
" on " date("M d, Y, H:i T",$time) . " by $name");
  if (
$revoked)
    echo(
"</STRIKE> <I>(revoked)</I>");
  echo(
"\n");
}

  if (isset(
$timespan))
    
$whereclause "where date_sub(now(), interval $timespan second) <= time";
  else
    
$whereclause "where id > $lastcomment";
  
$result mysql_query("select page,revision,unix_timestamp(time),wikiname,changetype,revoked from changes $whereclause order by id $changeorder");
  if (
$result === false)
    echo(
"<LI>Unexpected database error.\n");
  elseif (
mysql_num_rows($result) == 0)
    echo(
"<LI>No changes to list.\n");
  else {
    
$type false;
    while ((
$row mysql_fetch_row($result)) !== false) {
      if (!
$type) {
        
$cpage $row[0];
    
$maxrev $row[1];
    
$minrev $row[1];
    
$time $row[2];
    
$name $row[3];
        
$type $row[4];
    
$revoked $row[5];
      } elseif (
$row[0] == $cpage && $row[3] == $name && $type != 'd' && $row[4] != 'd') {
        if (
$changeorder == "desc")
          
$minrev $row[1];
        else {
          
$maxrev $row[1];
          
$time $row[2];
        }
        
$type min($type$row[4]);
        
$revoked $revoked && $row[5];
      } else {
        
printchange($cpage,$maxrev,$minrev,$time,$name,$type,$revoked);
        
$cpage $row[0];
    
$maxrev $row[1];
    
$minrev $row[1];
    
$time $row[2];
    
$name $row[3];
        
$type $row[4];
    
$revoked $row[5];
      }
    }
    
printchange($cpage,$maxrev,$minrev,$time,$name,$type,$revoked);
  }
?>
</UL>
<HR>


Notes:


Edit this page!
View the most recent revision to this page.
If you haven't yet, read the Wiki Introduction.
Up one level to inc/.
Return to user's home page: Flouri
Return to the Wiki Home.
Hosted by Shyou.org Webservices.