[phpcvsview-cvs-updates] phpcvsview func_DirListing.php,NONE,1.1 func_FileAnnotation.php,NONE,1.1 fu
Status: Pre-Alpha
Brought to you by:
bcheesem
From: Brian C. <bch...@us...> - 2004-10-02 01:46:33
|
Update of /cvsroot/phpcvsview/phpcvsview In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22319 Modified Files: cvsview.php Added Files: func_DirListing.php func_FileAnnotation.php func_FileHistory.php utils.php Log Message: Moved functions out to own files to facilitate development. --- NEW FILE: utils.php --- <?php /** * This source code is distributed under the terms as layed out in the * GNU General Public License. * * Purpose: To provide utility functions for the phpCVSViewer. * * @author Brian A Cheeseman <bch...@us...> * @version $Id: utils.php,v 1.1 2004/10/02 01:46:19 bcheesem Exp $ * @copyright 2003-2004 Brian A Cheeseman **/ function microtime_diff($a, $b) { list($a_dec, $a_sec) = explode(" ", $a); list($b_dec, $b_sec) = explode(" ", $b); return $b_sec - $a_sec + $b_dec - $a_dec; } // End of function microtime_diff($a, $b) function CalculateDateDiff($DateEarlier, $DateLater) { $DateDiff = $DateLater - $DateEarlier; $Seconds = $DateDiff; $Minutes = floor($Seconds/60); $Hours = floor($Minutes/60); $Days = floor($Hours/24); $Weeks = floor($Days/7); $Years = floor($Days/365); if ($Seconds > 0) { $Result = "$Seconds Second"; if ($DateDiff > 1) { $Result .= "s"; } } if ($Minutes > 0) { $Result = "$Minutes Minute"; if ($Minutes > 1) { $Result .= "s"; } } if ($Hours > 0) { $Result = "$Hours Hour"; if ($Hours > 1) { $Result .= "s"; } $Minutes = $Minutes % 60; if ($Minutes > 0) { $Result .= ", $Minutes Minute"; if ($Minutes > 1) { $Result .= "s"; } } } if ($Days > 0) { $Result = $Days . " Day"; if ($Days > 1) { $Result .= "s"; } $Hours = $Hours % 24; if ($Hours > 0) { $Result .= ", $Hours Hour"; if ($Hours > 1) { $Result .= "s"; } } } if ($Weeks > 0) { $Result = $Weeks . " Week"; if ($Days > 1) { $Result .= "s"; } $Days = $Days % 7; if ($Days > 0) { $Result .= ", $Days Day"; if ($Days > 1) { $Result .= "s"; } } } if ($Years > 0) { $Result = $Years . " Year"; if ($Years > 1) { $Result .= "s"; } $Weeks = $Weeks % 52; if ($Weeks > 0) { $Result .= ", $Weeks Week"; if ($Weeks > 1) { $Result .= "s"; } } } return $Result; } ?> --- NEW FILE: func_DirListing.php --- <?php /** * This source code is distributed under the terms as layed out in the * GNU General Public License. * * Purpose: To provide Directory Listing Page. * * @author Brian A Cheeseman <bch...@us...> * @version $Id: func_DirListing.php,v 1.1 2004/10/02 01:46:19 bcheesem Exp $ * @copyright 2003-2004 Brian A Cheeseman **/ function DisplayDirListing() { global $ModPath, $CVSROOT, $PServer, $UserName, $Password, $ScriptName, $HTMLTitle, $HTMLHeading, $HTMLTblHdBg, $HTMLTblCell1, $HTMLTblCell2; // Calculate the path from the $ScriptName variable. $ScriptPath = substr($ScriptName, 0, strrpos($ScriptName, "/")); if ($ScriptPath == "") { $ScriptPath = "/"; } // Create our CVS connection object and set the required properties. $CVSServer = new CVS_PServer($CVSROOT, $PServer, $UserName, $Password); // Start the output process. echo GetPageHeader($HTMLTitle, $HTMLHeading); // Connect to the CVS server. if ($CVSServer->Connect() === true) { // Authenticate against the server. $Response = $CVSServer->Authenticate(); if ($Response !== true) { return; } // Get a RLOG of the module path specified in $ModPath. $CVSServer->RLog($ModPath); // Start the output for the table. echo "<hr>\n"; echo "<table border=\"0\" cellpadding=\"2\" cellspacing=\"1\" width=\"100%\">\n"; echo " <tr bgcolor=\"$HTMLTblHdBg\">\n <th width=\"30\"> </th>\n <th>File</th>\n <th>Rev.</th>\n <th>Age</th>\n <th>Author</th>\n <th>Last Log Entry</th>\n </tr>\n"; $BGColor = $HTMLTblCell1; // Do we need the "Back" operation. if (strlen($ModPath) > 1) { $HREF = str_replace("//", "/", "$ScriptName?mp=".substr($ModPath, 0, strrpos(substr($ModPath, 0, -1), "/"))."/"); echo " <tr bgcolor=\"$BGColor\">\n"; echo " <td align=\"center\" valign=\"center\"><a href=\"$HREF\"><img border=\"0\" src=\"$ScriptPath/images/parent.png\"></a></td>\n"; echo " <td><a href=\"$HREF\">Previous Level</a></td>\n"; echo " <td> </td>\n"; echo " <td> </td>\n"; echo " <td> </td>\n"; echo " <td> </td>\n"; echo " </tr>\n"; $BGColor = $HTMLTblCell2; } // Process each folder and display a single row in a table. foreach ($CVSServer->FOLDERS as $Folder) { $HREF = str_replace("//", "/", "$ScriptName?mp=$ModPath/".$Folder["Name"]."/"); echo " <tr bgcolor=\"$BGColor\">\n"; echo " <td align=\"center\" valign=\"center\"><a href=\"$HREF\"><img border=\"0\" src=\"$ScriptPath/images/folder.png\"></a></td>\n"; echo " <td><a href=\"$HREF\">".$Folder["Name"]."</a></td>\n"; echo " <td> </td>\n"; echo " <td> </td>\n"; echo " <td> </td>\n"; echo " <td> </td>\n"; echo " </tr>\n"; if ($BGColor == $HTMLTblCell1) { $BGColor = $HTMLTblCell2; } else { $BGColor = $HTMLTblCell1; } } foreach ($CVSServer->FILES as $File) { $HREF = str_replace("//", "/", "$ScriptName?mp=$ModPath/".$File["Name"]); $DateTime = strtotime($File["Revisions"][$File["Head"]]["date"]); $AGE = CalculateDateDiff($DateTime, time()); echo " <tr bgcolor=\"$BGColor\" valign=\"top\">\n"; echo " <td align=\"center\" valign=\"center\"><a href=\"$HREF&fh\"><img border=\"0\" src=\"$ScriptPath/images/file.png\"></a></td>\n"; echo " <td><a href=\"$HREF&fh\">".$File["Name"]."</a></td>\n"; echo " <td align=\"center\"><a href=\"$HREF&fv&dt=$DateTime\">".$File["Head"]."</td>\n"; echo " <td align=\"center\">".$AGE." ago</td>\n"; echo " <td align=\"center\">".$File["Revisions"][$File["Head"]]["author"]."</td>\n"; echo " <td>".str_replace("\n", "<br>", $File["Revisions"][$File["Head"]]["LogMessage"])."</td>\n"; echo " </tr>\n"; if ($BGColor == $HTMLTblCell1) { $BGColor = $HTMLTblCell2; } else { $BGColor = $HTMLTblCell1; } } $CVSServer->Disconnect(); // Close off our HTML table. echo " </table>\n"; echo "<hr>"; } else { // Else of if ($Response !== true) echo "Connection Failed."; } // End of if ($Response !== true) echo GetPageFooter(); } // End of function DisplayDirListing() ?> Index: cvsview.php =================================================================== RCS file: /cvsroot/phpcvsview/phpcvsview/cvsview.php,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** cvsview.php 2 Oct 2004 01:24:29 -0000 1.10 --- cvsview.php 2 Oct 2004 01:46:18 -0000 1.11 *************** *** 7,13 **** * Purpose: To provide the main entry point in accessing a CVS repository * ! * @author Brian A Cheeseman <br...@bc...> * @version $Id$ ! * @copyright 2003 Brian A Cheeseman **/ --- 7,13 ---- * Purpose: To provide the main entry point in accessing a CVS repository * ! * @author Brian A Cheeseman <bch...@us...> * @version $Id$ ! * @copyright 2003-2004 Brian A Cheeseman **/ *************** *** 17,21 **** * **/ ! include_once 'config.php'; global $CVSROOT, $PServer, $UserName, $Password, $HTMLTitle, $HTMLHeading, $HTMLTblHdBg, $HTMLTblCell1, $HTMLTblCell2; --- 17,21 ---- * **/ ! require_once 'config.php'; global $CVSROOT, $PServer, $UserName, $Password, $HTMLTitle, $HTMLHeading, $HTMLTblHdBg, $HTMLTblCell1, $HTMLTblCell2; *************** *** 33,351 **** require_once 'header.php'; require_once 'footer.php'; - function microtime_diff($a, $b) { - list($a_dec, $a_sec) = explode(" ", $a); - list($b_dec, $b_sec) = explode(" ", $b); - return $b_sec - $a_sec + $b_dec - $a_dec; - } // End of function microtime_diff($a, $b) - - function CalculateDateDiff($DateEarlier, $DateLater) - { - $DateDiff = $DateLater - $DateEarlier; - $Seconds = $DateDiff; - $Minutes = floor($Seconds/60); - $Hours = floor($Minutes/60); - $Days = floor($Hours/24); - $Weeks = floor($Days/7); - $Years = floor($Days/365); - - if ($Seconds > 0) { - $Result = "$Seconds Second"; - if ($DateDiff > 1) { - $Result .= "s"; - } - } - if ($Minutes > 0) { - $Result = "$Minutes Minute"; - if ($Minutes > 1) { - $Result .= "s"; - } - } - if ($Hours > 0) { - $Result = "$Hours Hour"; - if ($Hours > 1) { - $Result .= "s"; - } - $Minutes = $Minutes % 60; - if ($Minutes > 0) { - $Result .= ", $Minutes Minute"; - if ($Minutes > 1) { - $Result .= "s"; - } - } - } - if ($Days > 0) { - $Result = $Days . " Day"; - if ($Days > 1) { - $Result .= "s"; - } - $Hours = $Hours % 24; - if ($Hours > 0) { - $Result .= ", $Hours Hour"; - if ($Hours > 1) { - $Result .= "s"; - } - } - } - if ($Weeks > 0) { - $Result = $Weeks . " Week"; - if ($Days > 1) { - $Result .= "s"; - } - $Days = $Days % 7; - if ($Days > 0) { - $Result .= ", $Days Day"; - if ($Days > 1) { - $Result .= "s"; - } - } - } - if ($Years > 0) { - $Result = $Years . " Year"; - if ($Years > 1) { - $Result .= "s"; - } - $Weeks = $Weeks % 52; - if ($Weeks > 0) { - $Result .= ", $Weeks Week"; - if ($Weeks > 1) { - $Result .= "s"; - } - } - } - return $Result; - } - - function DisplayDirListing() { - global $ModPath, $CVSROOT, $PServer, $UserName, $Password, $ScriptName, - $HTMLTitle, $HTMLHeading, $HTMLTblHdBg, $HTMLTblCell1, $HTMLTblCell2; - - // Calculate the path from the $ScriptName variable. - $ScriptPath = substr($ScriptName, 0, strrpos($ScriptName, "/")); - if ($ScriptPath == "") { - $ScriptPath = "/"; - } - - // Create our CVS connection object and set the required properties. - $CVSServer = new CVS_PServer($CVSROOT, $PServer, $UserName, $Password); - - // Start the output process. - echo GetPageHeader($HTMLTitle, $HTMLHeading); - - // Connect to the CVS server. - if ($CVSServer->Connect() === true) { - - // Authenticate against the server. - $Response = $CVSServer->Authenticate(); - if ($Response !== true) { - return; - } - - // Get a RLOG of the module path specified in $ModPath. - $CVSServer->RLog($ModPath); - - // Start the output for the table. - echo "<hr>\n"; - echo "<table border=\"0\" cellpadding=\"2\" cellspacing=\"1\" width=\"100%\">\n"; - echo " <tr bgcolor=\"$HTMLTblHdBg\">\n <th width=\"30\"> </th>\n <th>File</th>\n <th>Rev.</th>\n <th>Age</th>\n <th>Author</th>\n <th>Last Log Entry</th>\n </tr>\n"; - $BGColor = $HTMLTblCell1; - - // Do we need the "Back" operation. - if (strlen($ModPath) > 1) { - $HREF = str_replace("//", "/", "$ScriptName?mp=".substr($ModPath, 0, strrpos(substr($ModPath, 0, -1), "/"))."/"); - echo " <tr bgcolor=\"$BGColor\">\n"; - echo " <td align=\"center\" valign=\"center\"><a href=\"$HREF\"><img border=\"0\" src=\"$ScriptPath/images/parent.png\"></a></td>\n"; - echo " <td><a href=\"$HREF\">Previous Level</a></td>\n"; - echo " <td> </td>\n"; - echo " <td> </td>\n"; - echo " <td> </td>\n"; - echo " <td> </td>\n"; - echo " </tr>\n"; - $BGColor = $HTMLTblCell2; - } - - // Process each folder and display a single row in a table. - foreach ($CVSServer->FOLDERS as $Folder) - { - $HREF = str_replace("//", "/", "$ScriptName?mp=$ModPath/".$Folder["Name"]."/"); - echo " <tr bgcolor=\"$BGColor\">\n"; - echo " <td align=\"center\" valign=\"center\"><a href=\"$HREF\"><img border=\"0\" src=\"$ScriptPath/images/folder.png\"></a></td>\n"; - echo " <td><a href=\"$HREF\">".$Folder["Name"]."</a></td>\n"; - echo " <td> </td>\n"; - echo " <td> </td>\n"; - echo " <td> </td>\n"; - echo " <td> </td>\n"; - echo " </tr>\n"; - if ($BGColor == $HTMLTblCell1) { - $BGColor = $HTMLTblCell2; - } - else - { - $BGColor = $HTMLTblCell1; - } - } - - foreach ($CVSServer->FILES as $File) - { - $HREF = str_replace("//", "/", "$ScriptName?mp=$ModPath/".$File["Name"]); - $DateTime = strtotime($File["Revisions"][$File["Head"]]["date"]); - $AGE = CalculateDateDiff($DateTime, time()); - echo " <tr bgcolor=\"$BGColor\" valign=\"top\">\n"; - echo " <td align=\"center\" valign=\"center\"><a href=\"$HREF&fh\"><img border=\"0\" src=\"$ScriptPath/images/file.png\"></a></td>\n"; - echo " <td><a href=\"$HREF&fh\">".$File["Name"]."</a></td>\n"; - echo " <td align=\"center\"><a href=\"$HREF&fv&dt=$DateTime\">".$File["Head"]."</td>\n"; - echo " <td align=\"center\">".$AGE." ago</td>\n"; - echo " <td align=\"center\">".$File["Revisions"][$File["Head"]]["author"]."</td>\n"; - echo " <td>".str_replace("\n", "<br>", $File["Revisions"][$File["Head"]]["LogMessage"])."</td>\n"; - echo " </tr>\n"; - if ($BGColor == $HTMLTblCell1) { - $BGColor = $HTMLTblCell2; - } - else - { - $BGColor = $HTMLTblCell1; - } - } - - $CVSServer->Disconnect(); - - // Close off our HTML table. - echo " </table>\n"; - echo "<hr>"; - - } else { // Else of if ($Response !== true) - echo "Connection Failed."; - } // End of if ($Response !== true) - echo GetPageFooter(); - } // End of function DisplayDirListing() - - function DisplayFileHistory() - { - global $ModPath, $CVSROOT, $PServer, $UserName, $Password, $ScriptName, - $HTMLTitle, $HTMLHeading, $HTMLTblHdBg, $HTMLTblCell1, $HTMLTblCell2; - - // Calculate the path from the $ScriptName variable. - $ScriptPath = substr($ScriptName, 0, strrpos($ScriptName, "/")); - if ($ScriptPath == "") { - $ScriptPath = "/"; - } - - // Create our CVS connection object and set the required properties. - $CVSServer = new CVS_PServer($CVSROOT, $PServer, $UserName, $Password); - - // Start the output process. - echo GetPageHeader($HTMLTitle, $HTMLHeading); - - // Connect to the CVS server. - if ($CVSServer->Connect() === true) { - - // Authenticate against the server. - $Response = $CVSServer->Authenticate(); - if ($Response !== true) { - return; - } - - // Get a RLOG of the module path specified in $ModPath. - $CVSServer->RLog($ModPath); - - $Files = $CVSServer->FILES; - - echo "<h1>History for ".$ModPath."</h1>\n"; - foreach ($CVSServer->FILES[0]["Revisions"] as $Revision) - { - print_r($Revision); - $HREF = str_replace("//", "/", "$ScriptName?mp=$ModPath"); - $DateTime = strtotime($Revision["date"]); - echo "<hr>\n"; - echo "<b>Revision</b> ".$Revision["Revision"]." -"; - echo " (<a href=\"$HREF&fv&dt=$DateTime\">view</a>)"; - echo " (<a href=\"$HREF&fd&dt=$DateTime\">download</a>)"; - echo " (<a href=\"$HREF&df&r1=".strtotime($Revision["date"])."&r2="; - echo strtotime($CVSServer->FILES[0]["Revisions"][$Revision["PrevRevision"]]["date"])."\">diff to previous</a>)"; - echo " (<a href=\"$HREF&fa=".$Revision["Revision"]."\">annotate</a>)<br>\n"; - echo "<b>Last Checkin:</b> ".strftime("%A %d %b %Y %T %Z", strtotime($Revision["date"]))." (".CalculateDateDiff(strtotime($Revision["date"]), time())." ago)<br>\n"; - echo "<b>Branch:</b> ".$Revision["Branches"]."<br>\n"; - echo "<b>Date:</b> ".strftime("%B %d, %Y", $DateTime)."<br>\n"; - echo "<b>Time:</b> ".strftime("%H:%M:%S", $DateTime)."<br>\n"; - echo "<b>Author:</b> ".$Revision["author"]."<br>\n"; - echo "<b>State:</b> ".$Revision["state"]."<br>\n"; - if ($Revision["PrevRevision"] != "") { - echo "<b>Changes since ".$Revision["PrevRevision"].":</b> ".$Revision["lines"]."<br>"; - } - echo "<b>Log Message:</b><pre>".$Revision["LogMessage"]."</pre>\n"; - } - - echo "<hr>\n"; - - $CVSServer->Disconnect(); - } else { // Else of if ($CVSServer->Connect() === true) - echo "Connection Failed."; - } // End of if ($CVSServer->Connect() === true) - echo GetPageFooter(); - } - - function DisplayFileAnnotation($File, $Revision = "") { - global $ModPath, $CVSROOT, $PServer, $UserName, $Password, $ScriptName, - $HTMLTitle, $HTMLHeading, $HTMLTblHdBg, $HTMLTblCell1, $HTMLTblCell2; - - // Calculate the path from the $ScriptName variable. - $ScriptPath = substr($ScriptName, 0, strrpos($ScriptName, "/")); - if ($ScriptPath == "") { - $ScriptPath = "/"; - } - - // Create our CVS connection object and set the required properties. - $CVSServer = new CVS_PServer($CVSROOT, $PServer, $UserName, $Password); - - // Start the output process. - echo GetPageHeader($HTMLTitle, $HTMLHeading); - - // Connect to the CVS server. - if ($CVSServer->Connect() === true) { - - // Authenticate against the server. - $Response = $CVSServer->Authenticate(); - if ($Response !== true) { - return; - } - - // Annotate the file. - $Response = $CVSServer->Annotate($File, $Revision); - if ($Response !== true) { - return; - } - - //print_r($CVSServer->ANNOTATION); - - // Start the output for the table. - echo "<hr>\n"; - echo "<table border=\"0\" cellpadding=\"2\" cellspacing=\"0\" width=\"100%\">\n"; - $BGColor = $HTMLTblCell1; - - $search = array('<', '>', '\n'); - $replace = array("<", ">", ""); - foreach ($CVSServer->ANNOTATION as $Annotation) - { - $result = str_replace($search, $replace, $email); - echo "<tr bgcolor=\"$BGColor\"><td nowrap><pre>".$Annotation["Revision"]."</pre></td><td nowrap><pre>".$Annotation["Author"]; - echo "</pre></td><td nowrap><pre>".$Annotation["Date"]."</pre></td><td nowrap><pre>".str_replace($search, $replace, $Annotation["Line"])."</pre></td></tr>\n"; - if ($BGColor == $HTMLTblCell1) { - $BGColor = $HTMLTblCell2; - } - else - { - $BGColor = $HTMLTblCell1; - } - } - echo "</table>\n"; - - // Close the connection. - $CVSServer->Disconnect(); - } - else - { - echo "ERROR: Could not connect to the PServer.<br>\n"; - } - } // Check for a module path --- 33,41 ---- require_once 'header.php'; require_once 'footer.php'; + require_once 'utils.php'; + require_once 'func_DirListing.php'; + require_once 'func_FileHistory.php'; + require_once 'func_FileAnnotation.php'; // Check for a module path --- NEW FILE: func_FileAnnotation.php --- <?php /** * This source code is distributed under the terms as layed out in the * GNU General Public License. * * Purpose: To provide File Annotation Page. * * @author Brian A Cheeseman <bch...@us...> * @version $Id: func_FileAnnotation.php,v 1.1 2004/10/02 01:46:19 bcheesem Exp $ * @copyright 2003-2004 Brian A Cheeseman **/ function DisplayFileAnnotation($File, $Revision = "") { global $ModPath, $CVSROOT, $PServer, $UserName, $Password, $ScriptName, $HTMLTitle, $HTMLHeading, $HTMLTblHdBg, $HTMLTblCell1, $HTMLTblCell2; // Calculate the path from the $ScriptName variable. $ScriptPath = substr($ScriptName, 0, strrpos($ScriptName, "/")); if ($ScriptPath == "") { $ScriptPath = "/"; } // Create our CVS connection object and set the required properties. $CVSServer = new CVS_PServer($CVSROOT, $PServer, $UserName, $Password); // Start the output process. echo GetPageHeader($HTMLTitle, $HTMLHeading); // Connect to the CVS server. if ($CVSServer->Connect() === true) { // Authenticate against the server. $Response = $CVSServer->Authenticate(); if ($Response !== true) { return; } // Annotate the file. $Response = $CVSServer->Annotate($File, $Revision); if ($Response !== true) { return; } //print_r($CVSServer->ANNOTATION); // Start the output for the table. echo "<hr>\n"; echo "<table border=\"0\" cellpadding=\"2\" cellspacing=\"0\" width=\"100%\">\n"; $BGColor = $HTMLTblCell1; $search = array('<', '>', '\n'); $replace = array("<", ">", ""); foreach ($CVSServer->ANNOTATION as $Annotation) { $result = str_replace($search, $replace, $email); echo "<tr bgcolor=\"$BGColor\"><td nowrap><pre>".$Annotation["Revision"]."</pre></td><td nowrap><pre>".$Annotation["Author"]; echo "</pre></td><td nowrap><pre>".$Annotation["Date"]."</pre></td><td nowrap><pre>".str_replace($search, $replace, $Annotation["Line"])."</pre></td></tr>\n"; if ($BGColor == $HTMLTblCell1) { $BGColor = $HTMLTblCell2; } else { $BGColor = $HTMLTblCell1; } } echo "</table>\n"; // Close the connection. $CVSServer->Disconnect(); } else { echo "ERROR: Could not connect to the PServer.<br>\n"; } } ?> --- NEW FILE: func_FileHistory.php --- <?php /** * This source code is distributed under the terms as layed out in the * GNU General Public License. * * Purpose: To provide File Listing Page. * * @author Brian A Cheeseman <bch...@us...> * @version $Id: func_FileHistory.php,v 1.1 2004/10/02 01:46:19 bcheesem Exp $ * @copyright 2003-2004 Brian A Cheeseman **/ function DisplayFileHistory() { global $ModPath, $CVSROOT, $PServer, $UserName, $Password, $ScriptName, $HTMLTitle, $HTMLHeading, $HTMLTblHdBg, $HTMLTblCell1, $HTMLTblCell2; // Calculate the path from the $ScriptName variable. $ScriptPath = substr($ScriptName, 0, strrpos($ScriptName, "/")); if ($ScriptPath == "") { $ScriptPath = "/"; } // Create our CVS connection object and set the required properties. $CVSServer = new CVS_PServer($CVSROOT, $PServer, $UserName, $Password); // Start the output process. echo GetPageHeader($HTMLTitle, $HTMLHeading); // Connect to the CVS server. if ($CVSServer->Connect() === true) { // Authenticate against the server. $Response = $CVSServer->Authenticate(); if ($Response !== true) { return; } // Get a RLOG of the module path specified in $ModPath. $CVSServer->RLog($ModPath); $Files = $CVSServer->FILES; echo "<h1>History for ".$ModPath."</h1>\n"; foreach ($CVSServer->FILES[0]["Revisions"] as $Revision) { $HREF = str_replace("//", "/", "$ScriptName?mp=$ModPath"); $DateTime = strtotime($Revision["date"]); echo "<hr>\n"; echo "<b>Revision</b> ".$Revision["Revision"]." -"; echo " (<a href=\"$HREF&fv&dt=$DateTime\">view</a>)"; echo " (<a href=\"$HREF&fd&dt=$DateTime\">download</a>)"; echo " (<a href=\"$HREF&df&r1=".strtotime($Revision["date"])."&r2="; echo strtotime($CVSServer->FILES[0]["Revisions"][$Revision["PrevRevision"]]["date"])."\">diff to previous</a>)"; echo " (<a href=\"$HREF&fa=".$Revision["Revision"]."\">annotate</a>)<br>\n"; echo "<b>Last Checkin:</b> ".strftime("%A %d %b %Y %T -0000", strtotime($Revision["date"]))." (".CalculateDateDiff(strtotime($Revision["date"]), time())." ago)<br>\n"; echo "<b>Branch:</b> ".$Revision["Branches"]."<br>\n"; echo "<b>Date:</b> ".strftime("%B %d, %Y", $DateTime)."<br>\n"; echo "<b>Time:</b> ".strftime("%H:%M:%S", $DateTime)."<br>\n"; echo "<b>Author:</b> ".$Revision["author"]."<br>\n"; echo "<b>State:</b> ".$Revision["state"]."<br>\n"; if ($Revision["PrevRevision"] != "") { echo "<b>Changes since ".$Revision["PrevRevision"].":</b> ".$Revision["lines"]."<br>"; } echo "<b>Log Message:</b><pre>".$Revision["LogMessage"]."</pre>\n"; } echo "<hr>\n"; $CVSServer->Disconnect(); } else { // Else of if ($CVSServer->Connect() === true) echo "Connection Failed."; } // End of if ($CVSServer->Connect() === true) echo GetPageFooter(); } ?> |