phpcvsview-cvs-updates Mailing List for PHP CVS Repository Viewer (Page 10)
Status: Pre-Alpha
Brought to you by:
bcheesem
You can subscribe to this list here.
2003 |
Jan
|
Feb
|
Mar
(1) |
Apr
(5) |
May
|
Jun
|
Jul
|
Aug
(1) |
Sep
|
Oct
|
Nov
|
Dec
|
---|---|---|---|---|---|---|---|---|---|---|---|---|
2004 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(7) |
Oct
(43) |
Nov
|
Dec
(19) |
2005 |
Jan
(28) |
Feb
(85) |
Mar
|
Apr
(16) |
May
(2) |
Jun
|
Jul
|
Aug
(3) |
Sep
(14) |
Oct
|
Nov
(16) |
Dec
|
2006 |
Jan
(9) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Brian C. <bch...@us...> - 2004-10-02 01:50:27
|
Update of /cvsroot/phpcvsview/phpcvsview In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22785 Removed Files: test.php Log Message: Removed test.php from the project source. --- test.php DELETED --- |
From: Brian C. <bch...@us...> - 2004-10-02 01:47:43
|
Update of /cvsroot/phpcvsview/phpcvsview In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22475 Modified Files: config.php footer.php header.php phpcvs.php phpcvsmime.php Log Message: Updated copyright Updated my Email Address to point to sourceforge. Index: phpcvsmime.php =================================================================== RCS file: /cvsroot/phpcvsview/phpcvsview/phpcvsmime.php,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** phpcvsmime.php 1 Oct 2004 08:25:27 -0000 1.4 --- phpcvsmime.php 2 Oct 2004 01:47:17 -0000 1.5 *************** *** 7,13 **** * Purpose: To provide the mime translations required for downloading * ! * @author Brian A Cheeseman <br...@bc...> * @version $Id$ ! * @copyright 2003 Brian A Cheeseman **/ --- 7,13 ---- * Purpose: To provide the mime translations required for downloading * ! * @author Brian A Cheeseman <bch...@us...> * @version $Id$ ! * @copyright 2003-2004 Brian A Cheeseman **/ Index: header.php =================================================================== RCS file: /cvsroot/phpcvsview/phpcvsview/header.php,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** header.php 7 Apr 2003 08:23:58 -0000 1.2 --- header.php 2 Oct 2004 01:47:17 -0000 1.3 *************** *** 7,13 **** * Purpose: To provide the HTML page header code * ! * @author Brian A Cheeseman <br...@bc...> * @version $Id$ ! * @copyright 2003 Brian A Cheeseman **/ --- 7,13 ---- * Purpose: To provide the HTML page header code * ! * @author Brian A Cheeseman <bch...@us...> * @version $Id$ ! * @copyright 2003-2004 Brian A Cheeseman **/ Index: config.php =================================================================== RCS file: /cvsroot/phpcvsview/phpcvsview/config.php,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** config.php 2 Oct 2004 01:24:29 -0000 1.3 --- config.php 2 Oct 2004 01:47:17 -0000 1.4 *************** *** 7,13 **** * Purpose: To store the configuration for this instance of phpCVSView * ! * @author Brian A Cheeseman <br...@bc...> * @version $Id$ ! * @copyright 2003 Brian A Cheeseman **/ --- 7,13 ---- * Purpose: To store the configuration for this instance of phpCVSView * ! * @author Brian A Cheeseman <bch...@us...> * @version $Id$ ! * @copyright 2003-2004 Brian A Cheeseman **/ Index: footer.php =================================================================== RCS file: /cvsroot/phpcvsview/phpcvsview/footer.php,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** footer.php 7 Apr 2003 08:23:56 -0000 1.2 --- footer.php 2 Oct 2004 01:47:17 -0000 1.3 *************** *** 7,13 **** * Purpose: To provide the HTML page footer code * ! * @author Brian A Cheeseman <br...@bc...> * @version $Id$ ! * @copyright 2003 Brian A Cheeseman **/ --- 7,13 ---- * Purpose: To provide the HTML page footer code * ! * @author Brian A Cheeseman <bch...@us...> * @version $Id$ ! * @copyright 2003-2004 Brian A Cheeseman **/ Index: phpcvs.php =================================================================== RCS file: /cvsroot/phpcvsview/phpcvsview/phpcvs.php,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** phpcvs.php 2 Oct 2004 01:24:29 -0000 1.10 --- phpcvs.php 2 Oct 2004 01:47:17 -0000 1.11 *************** *** 7,13 **** * Purpose: To provide the main class required to access a CVS repository * ! * @author Brian A Cheeseman <br...@bc...> * @version $Id$ ! * @copyright 2003 Brian A Cheeseman **/ --- 7,13 ---- * Purpose: To provide the main class required to access a CVS repository * ! * @author Brian A Cheeseman <bch...@us...> * @version $Id$ ! * @copyright 2003-2004 Brian A Cheeseman **/ |
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(); } ?> |
From: Brian C. <bch...@us...> - 2004-10-02 01:24:40
|
Update of /cvsroot/phpcvsview/phpcvsview In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19136 Modified Files: config.php cvsview.php phpcvs.php Log Message: Corrected changes for configuration file. Fixed retrieval of revision date/time in file history view. Index: config.php =================================================================== RCS file: /cvsroot/phpcvsview/phpcvsview/config.php,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** config.php 2 Oct 2004 00:52:00 -0000 1.2 --- config.php 2 Oct 2004 01:24:29 -0000 1.3 *************** *** 12,20 **** **/ - global $CVSROOT, $PServer, $UserName, $Password, $HTMLTitle, $HTMLHeading, $HTMLTblHdBg, $HTMLTblCell1, $HTMLTblCell2; - // The CVSROOT path to access. For sourceforge you need the usual expansion // of the path based on the project name. ! $CVSROOT = "/cvsroot/p/ph/phpcvsview"; // The hostname (or IP Address) of the server providing the PServer services. --- 12,18 ---- **/ // The CVSROOT path to access. For sourceforge you need the usual expansion // of the path based on the project name. ! $CVSROOT = "/cvsroot/phpcvsview"; // The hostname (or IP Address) of the server providing the PServer services. Index: cvsview.php =================================================================== RCS file: /cvsroot/phpcvsview/phpcvsview/cvsview.php,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** cvsview.php 2 Oct 2004 00:49:25 -0000 1.9 --- cvsview.php 2 Oct 2004 01:24:29 -0000 1.10 *************** *** 18,25 **** **/ include_once 'config.php'; ! /** ! * ! * End of phpCVSView Configuration Parameters. * **/ --- 18,26 ---- **/ include_once 'config.php'; ! ! global $CVSROOT, $PServer, $UserName, $Password, $HTMLTitle, $HTMLHeading, $HTMLTblHdBg, $HTMLTblCell1, $HTMLTblCell2; ! /** ! * * End of phpCVSView Configuration Parameters. * **/ *************** *** 207,214 **** } - $Output = print_r($CVSServer->FILES, true); - $Output2 = str_replace("\n", "<br>", $Output); - echo "<hr><h1>Files Present</h1><pre>$Output2</pre><br><hr>"; - $CVSServer->Disconnect(); --- 208,211 ---- *************** *** 257,260 **** --- 254,258 ---- foreach ($CVSServer->FILES[0]["Revisions"] as $Revision) { + print_r($Revision); $HREF = str_replace("//", "/", "$ScriptName?mp=$ModPath"); $DateTime = strtotime($Revision["date"]); *************** *** 263,267 **** 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["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"; --- 261,265 ---- 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"; Index: phpcvs.php =================================================================== RCS file: /cvsroot/phpcvsview/phpcvsview/phpcvs.php,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** phpcvs.php 2 Oct 2004 00:32:08 -0000 1.9 --- phpcvs.php 2 Oct 2004 01:24:29 -0000 1.10 *************** *** 157,161 **** $this->CVS_PORT = 2401; $this->CVS_USERNAME = $UserName; ! $this->CVS_PASSWORD = Password; $this->SOCKET = new Net_Socket(); } --- 157,161 ---- $this->CVS_PORT = 2401; $this->CVS_USERNAME = $UserName; ! $this->CVS_PASSWORD = $Password; $this->SOCKET = new Net_Socket(); } |
From: Brian C. <bch...@us...> - 2004-10-02 00:52:10
|
Update of /cvsroot/phpcvsview/phpcvsview In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13170 Modified Files: config.php Log Message: Fixed the CVSROOT path in configuration. Index: config.php =================================================================== RCS file: /cvsroot/phpcvsview/phpcvsview/config.php,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** config.php 2 Oct 2004 00:49:24 -0000 1.1 --- config.php 2 Oct 2004 00:52:00 -0000 1.2 *************** *** 8,12 **** * * @author Brian A Cheeseman <br...@bc...> ! * @version $Id: * @copyright 2003 Brian A Cheeseman **/ --- 8,12 ---- * * @author Brian A Cheeseman <br...@bc...> ! * @version $Id$ * @copyright 2003 Brian A Cheeseman **/ *************** *** 16,20 **** // The CVSROOT path to access. For sourceforge you need the usual expansion // of the path based on the project name. ! $CVSROOT = "/cvsroot/phpcvsview"; // The hostname (or IP Address) of the server providing the PServer services. --- 16,20 ---- // The CVSROOT path to access. For sourceforge you need the usual expansion // of the path based on the project name. ! $CVSROOT = "/cvsroot/p/ph/phpcvsview"; // The hostname (or IP Address) of the server providing the PServer services. |
From: Brian C. <bch...@us...> - 2004-10-02 00:49:46
|
Update of /cvsroot/phpcvsview/phpcvsview In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12712 Modified Files: cvsview.php Added Files: config.php Log Message: Added config.php to project to store the configuration data. --- NEW FILE: config.php --- <?php /** * This source code is distributed under the terms as layed out in the * GNU General Public License. * * Purpose: To store the configuration for this instance of phpCVSView * * @author Brian A Cheeseman <br...@bc...> * @version $Id: * @copyright 2003 Brian A Cheeseman **/ global $CVSROOT, $PServer, $UserName, $Password, $HTMLTitle, $HTMLHeading, $HTMLTblHdBg, $HTMLTblCell1, $HTMLTblCell2; // The CVSROOT path to access. For sourceforge you need the usual expansion // of the path based on the project name. $CVSROOT = "/cvsroot/phpcvsview"; // The hostname (or IP Address) of the server providing the PServer services. $PServer = "cvs.sourceforge.net"; // The username to pass to the PServer for authentication purposes. $UserName = "anonymous"; // The password associated with the username above for authentication process. $Password = ""; // The HTMLTitle and HTMLHeading are used purely for the generation of the // resultant web pages. $HTMLTitle = "phpCVSView Source Code Library"; $HTMLHeading = "phpCVSView Source Code Library"; $HTMLTblHdBg = "#CCCCCC"; $HTMLTblCell1 = "#FFFFFF"; $HTMLTblCell2 = "#CCCCEE"; ?> Index: cvsview.php =================================================================== RCS file: /cvsroot/phpcvsview/phpcvsview/cvsview.php,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** cvsview.php 2 Oct 2004 00:31:04 -0000 1.8 --- cvsview.php 2 Oct 2004 00:49:25 -0000 1.9 *************** *** 17,45 **** * **/ - // The CVSROOT path to access. For sourceforge you need the usual expansion - // of the path based on the project name. - $CVSROOT = "/cvsroot/phpcvsview"; - //$CVSROOT = "/cvsroot/CHASE"; - - // The hostname (or IP Address) of the server providing the PServer services. - $PServer = "cvs.sourceforge.net"; - //$PServer = "192.168.0.1"; - - // The username to pass to the PServer for authentication purposes. - $UserName = "anonymous"; - - // The password associated with the username above for authentication process. - $Password = ""; - - // The HTMLTitle and HTMLHeading are used purely for the generation of the - // resultant web pages. - $HTMLTitle = "phpCVSView Source Code Library"; - $HTMLHeading = "phpCVSView Source Code Library"; - - $HTMLTblHdBg = "#CCCCCC"; - $HTMLTblCell1 = "#FFFFFF"; - $HTMLTblCell2 = "#CCCCEE"; - /** * --- 17,22 ---- * **/ + include_once 'config.php'; /** * *************** *** 230,236 **** } ! // $Output = print_r($CVSServer->FILES, true); ! // $Output2 = str_replace("\n", "<br>", $Output); ! // echo "<hr><h1>Files Present</h1><pre>$Output2</pre><br><hr>"; $CVSServer->Disconnect(); --- 207,213 ---- } ! $Output = print_r($CVSServer->FILES, true); ! $Output2 = str_replace("\n", "<br>", $Output); ! echo "<hr><h1>Files Present</h1><pre>$Output2</pre><br><hr>"; $CVSServer->Disconnect(); *************** *** 395,397 **** --- 372,375 ---- } } + ?> |
From: Brian C. <bch...@us...> - 2004-10-02 00:32:19
|
Update of /cvsroot/phpcvsview/phpcvsview In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9802 Modified Files: phpcvs.php Log Message: Added basic annotation capabilities to the CVS_PServer class. Index: phpcvs.php =================================================================== RCS file: /cvsroot/phpcvsview/phpcvsview/phpcvs.php,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** phpcvs.php 29 Sep 2004 10:57:59 -0000 1.8 --- phpcvs.php 2 Oct 2004 00:32:08 -0000 1.9 *************** *** 16,27 **** class CVS_PServer { ! var $CVS_REPOSITORY; // Storage of the CVS Repository file system path. ! var $CVS_USERNAME; // Username to use when authenticating with the PServer. ! var $CVS_PASSWORD; // Password for the account above. ! var $CVS_PSERVER; // Hostname of the server running the PServer. ! var $CVS_PORT; // Port number the PServer listener is running on. ! var $CVS_TIMEOUT; // Timeout in seconds for all socket operations. ! var $CVS_VALID_REQUESTS; // List of valid requests the PServer accepts. ! var $SOCKET; // The socket handle for communicating with the PServer. var $ALLOWED_RESPONSES = array( // A hashed array of responses that we are capable of // processing and the contents is the name of the function --- 16,27 ---- class CVS_PServer { ! var $CVS_REPOSITORY; // Storage of the CVS Repository file system path. ! var $CVS_USERNAME; // Username to use when authenticating with the PServer. ! var $CVS_PASSWORD; // Password for the account above. ! var $CVS_PSERVER; // Hostname of the server running the PServer. ! var $CVS_PORT; // Port number the PServer listener is running on. ! var $CVS_TIMEOUT; // Timeout in seconds for all socket operations. ! var $CVS_VALID_REQUESTS; // List of valid requests the PServer accepts. ! var $SOCKET; // The socket handle for communicating with the PServer. var $ALLOWED_RESPONSES = array( // A hashed array of responses that we are capable of // processing and the contents is the name of the function *************** *** 61,72 **** var $ALLOWED_REQUESTS = array(); // A hashed array of requests we are allowed to send. ! var $FINAL_RESPONSE; // A state variable for tracking whether the final response ! // in a chain of lines was a success or failure. ! var $STDERR; // Standard Error output. (Does not mean that an error occured). ! var $MESSAGE_CONTENT; // Message contents. (Standard Out) var $FOLDERS = array(); // An array of the folders in the current module. var $FILES = array(); // An array of the files in the current module. ! var $CURRENT_FOLDER; // The current folder we are building up. ! var $CURRENT_FILE; // The current file we are building up. /** --- 61,73 ---- var $ALLOWED_REQUESTS = array(); // A hashed array of requests we are allowed to send. ! var $FINAL_RESPONSE; // A state variable for tracking whether the final response ! // in a chain of lines was a success or failure. ! var $STDERR; // Standard Error output. (Does not mean that an error occured). ! var $MESSAGE_CONTENT; // Message contents. (Standard Out) var $FOLDERS = array(); // An array of the folders in the current module. var $FILES = array(); // An array of the files in the current module. ! var $CURRENT_FOLDER; // The current folder we are building up. ! var $CURRENT_FILE; // The current file we are building up. ! var $ANNOTATION = array(); // An array of the lines in the file which has been annotated. /** *************** *** 477,480 **** --- 478,593 ---- } + // *************************************************************************** + // Function: sendDirectory() + // Author: Brian A Cheeseman. + // Parameters: string - Directory to pass to the directory command. + // Return Value: boolean - Successfully sent. + // *************************************************************************** + function sendDirectory($Directory) + { + if ($this->ALLOWED_REQUESTS["Directory"] == true) { + if (strncmp($Directory, "/", 1) == 0) { + $Directory = substr($Directory, 1); + } + if ($this->SOCKET->write("Directory $Directory\n") == true) { + $Line = $this->CVS_REPOSITORY; + if ($Directory != ".") { + $Line .= "/" . $Directory; + } + if ($this->SOCKET->write("$Line\n") != true) { + return false; + } + } + else + { + return false; + } + } + return true; + } + + // *************************************************************************** + // Function: sendStaticDirectory() + // Author: Brian A Cheeseman. + // Parameters: None. + // Return Value: boolean - Successfully sent. + // *************************************************************************** + function sendStaticDirectory() + { + if ($this->ALLOWED_REQUESTS["Static-directory"] == true) { + if ($this->SOCKET->write("Static-directory\n") != true) { + return false; + } + } + return true; + } + + // *************************************************************************** + // Function: sendEntry() + // Author: Brian A Cheeseman. + // Parameters: string - $Name - Name of the file. + // string - $Version - Version of the file. + // string - $Conflict - + // string - $Options - Options for the entry line. + // string - $TagOrDate - Another method of identifying the version. + // Return Value: boolean - Successfully sent. + // *************************************************************************** + function sendEntry($Name = "", $Version = "", $Conflict = "", $Options = "", $TagOrDate = "") + { + if ($this->ALLOWED_REQUESTS["Entry"] == true) { + if (strrpos($Name, "/") > -1) { + $FName = substr($Name, strrpos($Name, "/")+1); + } + else + { + $FName = $Name; + } + if ($this->SOCKET->write("Entry /$FName/$Version/$Conflict/$Options/$TagOrDate\n") != true) { + return false; + } + } + return true; + } + + // *************************************************************************** + // Function: sendUnchanged() + // Author: Brian A Cheeseman. + // Parameters: string - $Name - Name of the file. + // Return Value: boolean - Successfully sent. + // *************************************************************************** + function sendUnchanged($Name) + { + if ($this->ALLOWED_REQUESTS["Unchanged"] == true) { + $SlashPos = strrpos($Name, "/"); + if ($SlashPos !== false) { + $BaseFileName = substr($Name, $SlashPos+1); + } + else + { + $BaseFileName = $Name; + } + if ($this->SOCKET->write("Unchanged $BaseFileName\n") != true) { + return false; + } + } + return true; + } + + // *************************************************************************** + // Function: sendAnnotate() + // Author: Brian A Cheeseman. + // Parameters: None. + // Return Value: boolean - Successfully sent. + // *************************************************************************** + function sendAnnotate() + { + if ($this->ALLOWED_REQUESTS["annotate"] == true) { + if ($this->SOCKET->write("annotate\n") != true) { + return false; + } + } + return true; + } + /** * Helper Methods. *************** *** 521,524 **** --- 634,638 ---- $FileRevision = -1; $CurrentRevision = ""; + $PreviousRevision = ""; $LineProcessed = false; if ($this->FINAL_RESPONSE) { *************** *** 555,558 **** --- 669,673 ---- $CurrentDecode = 2; $LineProcessed = true; + } } *************** *** 629,632 **** --- 744,751 ---- $this->FILES[$FileCount]["Revisions"]["$CurrentRevision"]["Revision"] = $CurrentRevision; $this->FILES[$FileCount]["Revisions"]["$CurrentRevision"]["LogMessage"] = ""; + if ($PreviousRevision != "") { + $this->FILES[$FileCount]["Revisions"]["$PreviousRevision"]["PrevRevision"] = $CurrentRevision; + } + $PreviousRevision = $CurrentRevision; $LineProcessed = true; } *************** *** 671,674 **** --- 790,876 ---- } } + + // *************************************************************************** + // Function: Annotate() + // Author: Brian A Cheeseman. + // Parameters: string - Directory to get the RLog for. + // Return Value: boolean - Were we successful. + // *************************************************************************** + function Annotate($Name, $Revision = "") + { + $this->sendCVSROOT(); + $this->sendValidResponses(); + $this->sendValidRequests(); + + if (!$this->sendUseUnchanged()) { + return false; + } + + if (!$this->sendArgument("--")) { + return false; + } + + $SlashPos = strrpos($Name, "/"); + if ($SlashPos > -1) { + $Directory = substr($Name, 0, $SlashPos); + } + else + { + $Directory = "/"; + } + + if (!$this->sendDirectory($Directory)) { + return false; + } + + if (!$this->sendStaticDirectory()) { + return false; + } + + if (!$this->sendEntry($Name, $Revision)) { + return false; + } + + if (!$this->sendUnchanged($Name)) { + return false; + } + + if (!$this->sendDirectory(".")) { + return false; + } + + if (strncmp($Name, "/", 1) == 0) { + $Arg = substr($Name, 1); + } + else + { + $Arg = $Name; + } + if (!$this->sendArgument($Arg)) { + return false; + } + + if (!$this->sendAnnotate()) { + return false; + } + + $this->processResponse(); + + if ($this->FINAL_RESPONSE) { + $Counter = 0; + $Responses = explode("\n", $this->MESSAGE_CONTENT); + // Iterate through each line. + foreach ($Responses as $Line) + { + $this->ANNOTATION[$Counter]["Revision"] = strtok($Line, "("); + $this->ANNOTATION[$Counter]["Author"] = strtok(" "); + $this->ANNOTATION[$Counter]["Date"] = strtok(")"); + $this->ANNOTATION[$Counter]["Line"] = substr(strtok("\n"), 2); + $Counter++; + } + } + + return true; + } } |
From: Brian C. <bch...@us...> - 2004-10-02 00:31:17
|
Update of /cvsroot/phpcvsview/phpcvsview In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9628 Modified Files: cvsview.php Log Message: Added basic annotation capabilities to the web frontend. Index: cvsview.php =================================================================== RCS file: /cvsroot/phpcvsview/phpcvsview/cvsview.php,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** cvsview.php 1 Oct 2004 22:38:35 -0000 1.7 --- cvsview.php 2 Oct 2004 00:31:04 -0000 1.8 *************** *** 211,219 **** { $HREF = str_replace("//", "/", "$ScriptName?mp=$ModPath/".$File["Name"]); ! $AGE = CalculateDateDiff(strtotime($File["Revisions"][$File["Head"]]["date"]), 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&fr=".$File["Head"]."\">".$File["Head"]."</td>\n"; echo " <td align=\"center\">".$AGE." ago</td>\n"; echo " <td align=\"center\">".$File["Revisions"][$File["Head"]]["author"]."</td>\n"; --- 211,220 ---- { $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"; *************** *** 280,301 **** { $HREF = str_replace("//", "/", "$ScriptName?mp=$ModPath"); echo "<hr>\n"; echo "<b>Revision</b> ".$Revision["Revision"]." -"; ! echo " (<a href=\"$HREF&fv&fr=".$Revision["Revision"]."\">view</a>)"; ! echo " (<a href=\"$HREF&fd&fr=".$Revision["Revision"]."\">download</a>)<br>\n"; ! echo "<b>Last Checkin:</b> ".strftime("%A %d %b %Y %T %Z", strtotime($Revision["date"]))." (".CalculateDateDiff(strtotime($Revision["date"]), time())." ago) by ".$Revision["author"]."<br>\n"; echo "<b>Branch:</b> ".$Revision["Branches"]."<br>\n"; - $DateTime = strtotime($Revision["date"]); 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"; echo "<b>Log Message:</b><pre>".$Revision["LogMessage"]."</pre>\n"; - - // if (($i + 1) < $Elements[0]["TotalRevisions"]) { - // echo "Changes since ".$Elements[$i+1]["Revision"].": "; - // echo "+".$Elements[$i]["LinesAdd"]." -".$Elements[$i]["LinesSub"]."<br>\n"; - // } // End of if (($i + 1) < $Elements[0]["TotalRevisions"]) - } --- 281,302 ---- { $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["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"; } *************** *** 309,312 **** --- 310,377 ---- } + 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 if (isset($_GET["mp"])) { *************** *** 319,324 **** if (isset($_GET["fh"])) { DisplayFileHistory(); ! } else { ! DisplayDirListing(); } ?> --- 384,397 ---- if (isset($_GET["fh"])) { DisplayFileHistory(); ! } ! else ! { ! if (isset($_GET["fa"])) { ! DisplayFileAnnotation($ModPath, $_GET["fa"]); ! } ! else ! { ! DisplayDirListing(); ! } } ?> |
From: Sijis A. <si...@us...> - 2004-10-01 22:39:55
|
Update of /cvsroot/phpcvsview/phpcvsview In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19323 Modified Files: cvsview.php Log Message: - changed object creation call to include the new arguments supported by the class - minor cosmetic fixes Index: cvsview.php =================================================================== RCS file: /cvsroot/phpcvsview/phpcvsview/cvsview.php,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** cvsview.php 29 Sep 2004 10:59:40 -0000 1.6 --- cvsview.php 1 Oct 2004 22:38:35 -0000 1.7 *************** *** 150,158 **** // Create our CVS connection object and set the required properties. ! $CVSServer = new CVS_PServer(); ! $CVSServer->set_PServer($PServer); ! $CVSServer->set_Repository($CVSROOT); ! $CVSServer->set_UserName($UserName); ! $CVSServer->set_Password($Password); // Start the output process. --- 150,154 ---- // Create our CVS connection object and set the required properties. ! $CVSServer = new CVS_PServer($CVSROOT, $PServer, $UserName, $Password); // Start the output process. *************** *** 243,249 **** echo "<hr>"; ! } else { // Else of if ($CVSServer->ConnectTcpAndLogon()) echo "Connection Failed."; ! } // End of if ($CVSServer->ConnectTcpAndLogon()) echo GetPageFooter(); } // End of function DisplayDirListing() --- 239,245 ---- echo "<hr>"; ! } else { // Else of if ($Response !== true) echo "Connection Failed."; ! } // End of if ($Response !== true) echo GetPageFooter(); } // End of function DisplayDirListing() *************** *** 261,269 **** // Create our CVS connection object and set the required properties. ! $CVSServer = new CVS_PServer(); ! $CVSServer->set_PServer($PServer); ! $CVSServer->set_Repository($CVSROOT); ! $CVSServer->set_UserName($UserName); ! $CVSServer->set_Password($Password); // Start the output process. --- 257,261 ---- // Create our CVS connection object and set the required properties. ! $CVSServer = new CVS_PServer($CVSROOT, $PServer, $UserName, $Password); // Start the output process. *************** *** 311,317 **** $CVSServer->Disconnect(); ! } else { // Else of if ($CVSServer->ConnectTcpAndLogon()) echo "Connection Failed."; ! } // End of if ($CVSServer->ConnectTcpAndLogon()) echo GetPageFooter(); } --- 303,309 ---- $CVSServer->Disconnect(); ! } else { // Else of if ($CVSServer->Connect() === true) echo "Connection Failed."; ! } // End of if ($CVSServer->Connect() === true) echo GetPageFooter(); } *************** *** 327,334 **** if (isset($_GET["fh"])) { DisplayFileHistory(); ! } ! else ! { ! DisplayDirListing(); } ?> --- 319,324 ---- if (isset($_GET["fh"])) { DisplayFileHistory(); ! } else { ! DisplayDirListing(); } ?> |
From: Sijis A. <si...@us...> - 2004-10-01 08:25:36
|
Update of /cvsroot/phpcvsview/phpcvsview In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11266 Modified Files: phpcvsmime.php Log Message: - changed method of creating the array, this also increases performance. Index: phpcvsmime.php =================================================================== RCS file: /cvsroot/phpcvsview/phpcvsview/phpcvsmime.php,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** phpcvsmime.php 7 Apr 2003 08:23:59 -0000 1.3 --- phpcvsmime.php 1 Oct 2004 08:25:27 -0000 1.4 *************** *** 12,166 **** **/ ! $MIME_TYPES["ez"] = "application/andrew-inset"; ! $MIME_TYPES["hqx"] = "application/mac-binhex40"; ! $MIME_TYPES["cpt"] = "application/mac-compactpro"; ! $MIME_TYPES["doc"] = "application/msword"; ! $MIME_TYPES["bin"] = "application/octet-stream"; ! $MIME_TYPES["dms"] = "application/octet-stream"; ! $MIME_TYPES["lha"] = "application/octet-stream"; ! $MIME_TYPES["lzh"] = "application/octet-stream"; ! $MIME_TYPES["exe"] = "application/octet-stream"; ! $MIME_TYPES["class"] = "application/octet-stream"; ! $MIME_TYPES["so"] = "application/octet-stream"; ! $MIME_TYPES["dll"] = "application/octet-stream"; ! $MIME_TYPES["oda"] = "application/oda"; ! $MIME_TYPES["pdf"] = "application/pdf"; ! $MIME_TYPES["ai"] = "application/postscript"; ! $MIME_TYPES["eps"] = "application/postscript"; ! $MIME_TYPES["ps"] = "application/postscript"; ! $MIME_TYPES["smi"] = "application/smil"; ! $MIME_TYPES["smil"] = "application/smil"; ! $MIME_TYPES["mif"] = "application/vnd.mif"; ! $MIME_TYPES["xls"] = "application/vnd.ms-excel"; ! $MIME_TYPES["ppt"] = "application/vnd.ms-powerpoint"; ! $MIME_TYPES["wbxml"] = "application/vnd.wap.wbxml"; ! $MIME_TYPES["wmlc"] = "application/vnd.wap.wmlc"; ! $MIME_TYPES["wmlsc"] = "application/vnd.wap.wmlscriptc"; ! $MIME_TYPES["bcpio"] = "application/x-bcpio"; ! $MIME_TYPES["vcd"] = "application/x-cdlink"; ! $MIME_TYPES["pgn"] = "application/x-chess-pgn"; ! $MIME_TYPES["cpio"] = "application/x-cpio"; ! $MIME_TYPES["csh"] = "application/x-csh"; ! $MIME_TYPES["dcr"] = "application/x-director"; ! $MIME_TYPES["dir"] = "application/x-director"; ! $MIME_TYPES["dxr"] = "application/x-director"; ! $MIME_TYPES["dvi"] = "application/x-dvi"; ! $MIME_TYPES["spl"] = "application/x-futuresplash"; ! $MIME_TYPES["gtar"] = "application/x-gtar"; ! $MIME_TYPES["hdf"] = "application/x-hdf"; ! $MIME_TYPES["php"] = "application/x-httpd-php"; ! $MIME_TYPES["php4"] = "application/x-httpd-php"; ! $MIME_TYPES["php3"] = "application/x-httpd-php"; ! $MIME_TYPES["phtml"] = "application/x-httpd-php"; ! $MIME_TYPES["phps"] = "application/x-httpd-php-source"; ! $MIME_TYPES["js"] = "application/x-javascript"; ! $MIME_TYPES["skp"] = "application/x-koan"; ! $MIME_TYPES["skd"] = "application/x-koan"; ! $MIME_TYPES["skt"] = "application/x-koan"; ! $MIME_TYPES["skm"] = "application/x-koan"; ! $MIME_TYPES["latex"] = "application/x-latex"; ! $MIME_TYPES["nc"] = "application/x-netcdf"; ! $MIME_TYPES["cdf"] = "application/x-netcdf"; ! $MIME_TYPES["crl"] = "application/x-pkcs7-crl"; ! $MIME_TYPES["sh"] = "application/x-sh"; ! $MIME_TYPES["shar"] = "application/x-shar"; ! $MIME_TYPES["swf"] = "application/x-shockwave-flash"; ! $MIME_TYPES["sit"] = "application/x-stuffit"; ! $MIME_TYPES["sv4cpio"] = "application/x-sv4cpio"; ! $MIME_TYPES["sv4crc"] = "application/x-sv4crc"; ! $MIME_TYPES["tar"] = "application/x-tar"; ! $MIME_TYPES["tgz"] = "application/x-tar"; ! $MIME_TYPES["tcl"] = "application/x-tcl"; ! $MIME_TYPES["tex"] = "application/x-tex"; ! $MIME_TYPES["texinfo"] = "application/x-texinfo"; ! $MIME_TYPES["texi"] = "application/x-texinfo"; ! $MIME_TYPES["t"] = "application/x-troff"; ! $MIME_TYPES["tr"] = "application/x-troff"; ! $MIME_TYPES["roff"] = "application/x-troff"; ! $MIME_TYPES["man"] = "application/x-troff-man"; ! $MIME_TYPES["me"] = "application/x-troff-me"; ! $MIME_TYPES["ms"] = "application/x-troff-ms"; ! $MIME_TYPES["ustar"] = "application/x-ustar"; ! $MIME_TYPES["src"] = "application/x-wais-source"; ! $MIME_TYPES["crt"] = "application/x-x509-ca-cert"; ! $MIME_TYPES["xhtml"] = "application/xhtml+xml"; ! $MIME_TYPES["xht"] = "application/xhtml+xml"; ! $MIME_TYPES["zip"] = "application/zip"; ! $MIME_TYPES["au"] = "audio/basic"; ! $MIME_TYPES["snd"] = "audio/basic"; ! $MIME_TYPES["mid"] = "audio/midi"; ! $MIME_TYPES["midi"] = "audio/midi"; ! $MIME_TYPES["kar"] = "audio/midi"; ! $MIME_TYPES["mpga"] = "audio/mpeg"; ! $MIME_TYPES["mp2"] = "audio/mpeg"; ! $MIME_TYPES["mp3"] = "audio/mpeg"; ! $MIME_TYPES["aif"] = "audio/x-aiff"; ! $MIME_TYPES["aiff"] = "audio/x-aiff"; ! $MIME_TYPES["aifc"] = "audio/x-aiff"; ! $MIME_TYPES["m3u"] = "audio/x-mpegurl"; ! $MIME_TYPES["ram"] = "audio/x-pn-realaudio"; ! $MIME_TYPES["rm"] = "audio/x-pn-realaudio"; ! $MIME_TYPES["rpm"] = "audio/x-pn-realaudio-plugin"; ! $MIME_TYPES["ra"] = "audio/x-realaudio"; ! $MIME_TYPES["wav"] = "audio/x-wav"; ! $MIME_TYPES["pdb"] = "chemical/x-pdb"; ! $MIME_TYPES["xyz"] = "chemical/x-xyz"; ! $MIME_TYPES["bmp"] = "image/bmp"; ! $MIME_TYPES["gif"] = "image/gif"; ! $MIME_TYPES["ief"] = "image/ief"; ! $MIME_TYPES["jpeg"] = "image/jpeg"; ! $MIME_TYPES["jpg"] = "image/jpeg"; ! $MIME_TYPES["jpe"] = "image/jpeg"; ! $MIME_TYPES["png"] = "image/png"; ! $MIME_TYPES["tiff"] = "image/tiff"; ! $MIME_TYPES["tif"] = "image/tiff"; ! $MIME_TYPES["djvu"] = "image/vnd.djvu"; ! $MIME_TYPES["djv"] = "image/vnd.djvu"; ! $MIME_TYPES["wbmp"] = "image/vnd.wap.wbmp"; ! $MIME_TYPES["wbmp"] = "image/vnd.wap.wbmp"; ! $MIME_TYPES["ras"] = "image/x-cmu-raster"; ! $MIME_TYPES["pnm"] = "image/x-portable-anymap"; ! $MIME_TYPES["pbm"] = "image/x-portable-bitmap"; ! $MIME_TYPES["pgm"] = "image/x-portable-graymap"; ! $MIME_TYPES["ppm"] = "image/x-portable-pixmap"; ! $MIME_TYPES["rgb"] = "image/x-rgb"; ! $MIME_TYPES["xbm"] = "image/x-xbitmap"; ! $MIME_TYPES["xpm"] = "image/x-xpixmap"; ! $MIME_TYPES["xwd"] = "image/x-xwindowdump"; ! $MIME_TYPES["igs"] = "model/iges"; ! $MIME_TYPES["iges"] = "model/iges"; ! $MIME_TYPES["msh"] = "model/mesh"; ! $MIME_TYPES["mesh"] = "model/mesh"; ! $MIME_TYPES["silo"] = "model/mesh"; ! $MIME_TYPES["wrl"] = "model/vrml"; ! $MIME_TYPES["vrml"] = "model/vrml"; ! $MIME_TYPES["css"] = "text/css"; ! $MIME_TYPES["html"] = "text/html"; ! $MIME_TYPES["htm"] = "text/html"; ! $MIME_TYPES["shtml"] = "text/html"; ! $MIME_TYPES["jsp"] = "text/html"; ! $MIME_TYPES["asc"] = "text/plain"; ! $MIME_TYPES["txt"] = "text/plain"; ! $MIME_TYPES["rtx"] = "text/richtext"; ! $MIME_TYPES["rtf"] = "text/rtf"; ! $MIME_TYPES["sgml"] = "text/sgml"; ! $MIME_TYPES["sgm"] = "text/sgml"; ! $MIME_TYPES["tsv"] = "text/tab-separated-values"; ! $MIME_TYPES["wml"] = "text/vnd.wap.wml"; ! $MIME_TYPES["wml"] = "text/vnd.wap.wml"; ! $MIME_TYPES["wmls"] = "text/vnd.wap.wmlscript"; ! $MIME_TYPES["wmls"] = "text/vnd.wap.wmlscript"; ! $MIME_TYPES["etx"] = "text/x-setext"; ! $MIME_TYPES["xml"] = "text/xml"; ! $MIME_TYPES["xsl"] = "text/xml"; ! $MIME_TYPES["mpeg"] = "video/mpeg"; ! $MIME_TYPES["mpg"] = "video/mpeg"; ! $MIME_TYPES["mpe"] = "video/mpeg"; ! $MIME_TYPES["qt"] = "video/quicktime"; ! $MIME_TYPES["mov"] = "video/quicktime"; ! $MIME_TYPES["mxu"] = "video/vnd.mpegurl"; ! $MIME_TYPES["avi"] = "video/x-msvideo"; ! $MIME_TYPES["movie"] = "video/x-sgi-movie"; ! $MIME_TYPES["ice"] = "x-conference/x-cooltalk"; ! ?> \ No newline at end of file --- 12,168 ---- **/ ! $MIME_TYPES = array( ! 'ez' => 'application/andrew-inset', ! 'hqx' => 'application/mac-binhex40', ! 'cpt' => 'application/mac-compactpro', ! 'doc' => 'application/msword', ! 'bin' => 'application/octet-stream', ! 'dms' => 'application/octet-stream', ! 'lha' => 'application/octet-stream', ! 'lzh' => 'application/octet-stream', ! 'exe' => 'application/octet-stream', ! 'class' => 'application/octet-stream', ! 'so' => 'application/octet-stream', ! 'dll' => 'application/octet-stream', ! 'oda' => 'application/oda', ! 'pdf' => 'application/pdf', ! 'ai' => 'application/postscript', ! 'eps' => 'application/postscript', ! 'ps' => 'application/postscript', ! 'smi' => 'application/smil', ! 'smil' => 'application/smil', ! 'mif' => 'application/vnd.mif', ! 'xls' => 'application/vnd.ms-excel', ! 'ppt' => 'application/vnd.ms-powerpoint', ! 'wbxml' => 'application/vnd.wap.wbxml', ! 'wmlc' => 'application/vnd.wap.wmlc', ! 'wmlsc' => 'application/vnd.wap.wmlscriptc', ! 'bcpio' => 'application/x-bcpio', ! 'vcd' => 'application/x-cdlink', ! 'pgn' => 'application/x-chess-pgn', ! 'cpio' => 'application/x-cpio', ! 'csh' => 'application/x-csh', ! 'dcr' => 'application/x-director', ! 'dir' => 'application/x-director', ! 'dxr' => 'application/x-director', ! 'dvi' => 'application/x-dvi', ! 'spl' => 'application/x-futuresplash', ! 'gtar' => 'application/x-gtar', ! 'hdf' => 'application/x-hdf', ! 'php' => 'application/x-httpd-php', ! 'php4' => 'application/x-httpd-php', ! 'php3' => 'application/x-httpd-php', ! 'phtml' => 'application/x-httpd-php', ! 'phps' => 'application/x-httpd-php-source', ! 'js' => 'application/x-javascript', ! 'skp' => 'application/x-koan', ! 'skd' => 'application/x-koan', ! 'skt' => 'application/x-koan', ! 'skm' => 'application/x-koan', ! 'latex' => 'application/x-latex', ! 'nc' => 'application/x-netcdf', ! 'cdf' => 'application/x-netcdf', ! 'crl' => 'application/x-pkcs7-crl', ! 'sh' => 'application/x-sh', ! 'shar' => 'application/x-shar', ! 'swf' => 'application/x-shockwave-flash', ! 'sit' => 'application/x-stuffit', ! 'sv4cpio' => 'application/x-sv4cpio', ! 'sv4crc' => 'application/x-sv4crc', ! 'tar' => 'application/x-tar', ! 'tgz' => 'application/x-tar', ! 'tcl' => 'application/x-tcl', ! 'tex' => 'application/x-tex', ! 'texinfo' => 'application/x-texinfo', ! 'texi' => 'application/x-texinfo', ! 't' => 'application/x-troff', ! 'tr' => 'application/x-troff', ! 'roff' => 'application/x-troff', ! 'man' => 'application/x-troff-man', ! 'me' => 'application/x-troff-me', ! 'ms' => 'application/x-troff-ms', ! 'ustar' => 'application/x-ustar', ! 'src' => 'application/x-wais-source', ! 'crt' => 'application/x-x509-ca-cert', ! 'xhtml' => 'application/xhtml+xml', ! 'xht' => 'application/xhtml+xml', ! 'zip' => 'application/zip', ! 'au' => 'audio/basic', ! 'snd' => 'audio/basic', ! 'mid' => 'audio/midi', ! 'midi' => 'audio/midi', ! 'kar' => 'audio/midi', ! 'mpga' => 'audio/mpeg', ! 'mp2' => 'audio/mpeg', ! 'mp3' => 'audio/mpeg', ! 'aif' => 'audio/x-aiff', ! 'aiff' => 'audio/x-aiff', ! 'aifc' => 'audio/x-aiff', ! 'm3u' => 'audio/x-mpegurl', ! 'ram' => 'audio/x-pn-realaudio', ! 'rm' => 'audio/x-pn-realaudio', ! 'rpm' => 'audio/x-pn-realaudio-plugin', ! 'ra' => 'audio/x-realaudio', ! 'wav' => 'audio/x-wav', ! 'pdb' => 'chemical/x-pdb', ! 'xyz' => 'chemical/x-xyz', ! 'bmp' => 'image/bmp', ! 'gif' => 'image/gif', ! 'ief' => 'image/ief', ! 'jpeg' => 'image/jpeg', ! 'jpg' => 'image/jpeg', ! 'jpe' => 'image/jpeg', ! 'png' => 'image/png', ! 'tiff' => 'image/tiff', ! 'tif' => 'image/tiff', ! 'djvu' => 'image/vnd.djvu', ! 'djv' => 'image/vnd.djvu', ! 'wbmp' => 'image/vnd.wap.wbmp', ! 'wbmp' => 'image/vnd.wap.wbmp', ! 'ras' => 'image/x-cmu-raster', ! 'pnm' => 'image/x-portable-anymap', ! 'pbm' => 'image/x-portable-bitmap', ! 'pgm' => 'image/x-portable-graymap', ! 'ppm' => 'image/x-portable-pixmap', ! 'rgb' => 'image/x-rgb', ! 'xbm' => 'image/x-xbitmap', ! 'xpm' => 'image/x-xpixmap', ! 'xwd' => 'image/x-xwindowdump', ! 'igs' => 'model/iges', ! 'iges' => 'model/iges', ! 'msh' => 'model/mesh', ! 'mesh' => 'model/mesh', ! 'silo' => 'model/mesh', ! 'wrl' => 'model/vrml', ! 'vrml' => 'model/vrml', ! 'css' => 'text/css', ! 'html' => 'text/html', ! 'htm' => 'text/html', ! 'shtml' => 'text/html', ! 'jsp' => 'text/html', ! 'asc' => 'text/plain', ! 'txt' => 'text/plain', ! 'rtx' => 'text/richtext', ! 'rtf' => 'text/rtf', ! 'sgml' => 'text/sgml', ! 'sgm' => 'text/sgml', ! 'tsv' => 'text/tab-separated-values', ! 'wml' => 'text/vnd.wap.wml', ! 'wml' => 'text/vnd.wap.wml', ! 'wmls' => 'text/vnd.wap.wmlscript', ! 'wmls' => 'text/vnd.wap.wmlscript', ! 'etx' => 'text/x-setext', ! 'xml' => 'text/xml', ! 'xsl' => 'text/xml', ! 'mpeg' => 'video/mpeg', ! 'mpg' => 'video/mpeg', ! 'mpe' => 'video/mpeg', ! 'qt' => 'video/quicktime', ! 'mov' => 'video/quicktime', ! 'mxu' => 'video/vnd.mpegurl', ! 'avi' => 'video/x-msvideo', ! 'movie' => 'video/x-sgi-movie', ! 'ice' => 'x-conference/x-cooltalk' ! ); ! ?> |
From: Brian C. <bch...@us...> - 2004-09-29 10:59:57
|
Update of /cvsroot/phpcvsview/phpcvsview In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2286 Modified Files: cvsview.php Log Message: Completed file revision history view. Index: cvsview.php =================================================================== RCS file: /cvsroot/phpcvsview/phpcvsview/cvsview.php,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** cvsview.php 29 Sep 2004 08:28:34 -0000 1.5 --- cvsview.php 29 Sep 2004 10:59:40 -0000 1.6 *************** *** 73,77 **** if ($Seconds > 0) { ! $Result = $Seconds . " Second"; if ($DateDiff > 1) { $Result .= "s"; --- 73,77 ---- if ($Seconds > 0) { ! $Result = "$Seconds Second"; if ($DateDiff > 1) { $Result .= "s"; *************** *** 79,83 **** } if ($Minutes > 0) { ! $Result = $Minutes . " Minute"; if ($Minutes > 1) { $Result .= "s"; --- 79,83 ---- } if ($Minutes > 0) { ! $Result = "$Minutes Minute"; if ($Minutes > 1) { $Result .= "s"; *************** *** 85,92 **** } if ($Hours > 0) { ! $Result = $Hours . " Hour"; if ($Hours > 1) { $Result .= "s"; } } if ($Days > 0) { --- 85,99 ---- } 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) { *************** *** 95,98 **** --- 102,112 ---- $Result .= "s"; } + $Hours = $Hours % 24; + if ($Hours > 0) { + $Result .= ", $Hours Hour"; + if ($Hours > 1) { + $Result .= "s"; + } + } } if ($Weeks > 0) { *************** *** 101,104 **** --- 115,125 ---- $Result .= "s"; } + $Days = $Days % 7; + if ($Days > 0) { + $Result .= ", $Days Day"; + if ($Days > 1) { + $Result .= "s"; + } + } } if ($Years > 0) { *************** *** 107,110 **** --- 128,138 ---- $Result .= "s"; } + $Weeks = $Weeks % 52; + if ($Weeks > 0) { + $Result .= ", $Weeks Week"; + if ($Weeks > 1) { + $Result .= "s"; + } + } } return $Result; *************** *** 191,195 **** 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=1&fr=".$File["Head"]."\">".$File["Head"]."</td>\n"; echo " <td align=\"center\">".$AGE." ago</td>\n"; echo " <td align=\"center\">".$File["Revisions"][$File["Head"]]["author"]."</td>\n"; --- 219,223 ---- 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&fr=".$File["Head"]."\">".$File["Head"]."</td>\n"; echo " <td align=\"center\">".$AGE." ago</td>\n"; echo " <td align=\"center\">".$File["Revisions"][$File["Head"]]["author"]."</td>\n"; *************** *** 259,265 **** foreach ($CVSServer->FILES[0]["Revisions"] as $Revision) { echo "<hr>\n"; ! echo "Revision <b>".$Revision["Revision"]."</b> - (view) (download)<br>\n"; ! echo "Last Checkin: ".strftime("%A %d %b %Y %T %Z", strtotime($Revision["date"]))." (".CalculateDateDiff(strtotime($Revision["date"]), time())." ago) by ".$Revision["author"]."<br>\n"; } --- 287,309 ---- foreach ($CVSServer->FILES[0]["Revisions"] as $Revision) { + $HREF = str_replace("//", "/", "$ScriptName?mp=$ModPath"); echo "<hr>\n"; ! echo "<b>Revision</b> ".$Revision["Revision"]." -"; ! echo " (<a href=\"$HREF&fv&fr=".$Revision["Revision"]."\">view</a>)"; ! echo " (<a href=\"$HREF&fd&fr=".$Revision["Revision"]."\">download</a>)<br>\n"; ! echo "<b>Last Checkin:</b> ".strftime("%A %d %b %Y %T %Z", strtotime($Revision["date"]))." (".CalculateDateDiff(strtotime($Revision["date"]), time())." ago) by ".$Revision["author"]."<br>\n"; ! echo "<b>Branch:</b> ".$Revision["Branches"]."<br>\n"; ! $DateTime = strtotime($Revision["date"]); ! 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"; ! echo "<b>Log Message:</b><pre>".$Revision["LogMessage"]."</pre>\n"; ! ! // if (($i + 1) < $Elements[0]["TotalRevisions"]) { ! // echo "Changes since ".$Elements[$i+1]["Revision"].": "; ! // echo "+".$Elements[$i]["LinesAdd"]." -".$Elements[$i]["LinesSub"]."<br>\n"; ! // } // End of if (($i + 1) < $Elements[0]["TotalRevisions"]) ! } |
From: Brian C. <bch...@us...> - 2004-09-29 10:58:09
|
Update of /cvsroot/phpcvsview/phpcvsview In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1640 Modified Files: phpcvs.php Log Message: Moved initialisation of $ALLOWED_RESPONSES to declaration. Added constructor parameters previously present. Index: phpcvs.php =================================================================== RCS file: /cvsroot/phpcvsview/phpcvsview/phpcvs.php,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** phpcvs.php 26 Sep 2004 12:59:39 -0000 1.7 --- phpcvs.php 29 Sep 2004 10:57:59 -0000 1.8 *************** *** 24,30 **** var $CVS_VALID_REQUESTS; // List of valid requests the PServer accepts. var $SOCKET; // The socket handle for communicating with the PServer. ! var $ALLOWED_RESPONSES = array(); // A hashed array of responses that we are capable of ! // processing and the contents is the name of the function ! // to process it through. var $ALLOWED_REQUESTS = array(); // A hashed array of requests we are allowed to send. var $FINAL_RESPONSE; // A state variable for tracking whether the final response --- 24,63 ---- var $CVS_VALID_REQUESTS; // List of valid requests the PServer accepts. var $SOCKET; // The socket handle for communicating with the PServer. ! var $ALLOWED_RESPONSES = array( // A hashed array of responses that we are capable of ! // processing and the contents is the name of the function ! // to process it through. ! "ok" => "processOk", ! "error" => "processError", ! "Valid-requests" => "processValidRequests", ! "Checked-in" => "processCheckedIn", ! "New-entry" => "processNewEntry", ! "Checksum" => "processChecksum", ! "Copy-file" => "processCopyFile", ! "Updated" => "processUpdated", ! "Created" => "processCreated", ! "Update-existing" => "processUpdateExisting", ! "Merged" => "processMerged", ! "Patched" => "processPatched", ! "Rcs-diff" => "processRcsDiff", ! "Mode" => "processMode", ! "Mod-time" => "processModTime", ! "Removed" => "processRemoved", ! "Remove-entry" => "processRemoveEntry", ! "Set-static-directory" => "processSetStaticDirectory", ! "Clear-static-directory" => "processClearStaticDirectory", ! "Set-sticky" => "processSetSticky", ! "Clear-sticky" => "processClearSticky", ! "Template" => "processTemplate", ! "Set-checkin-prog" => "processSetCheckinProg", ! "Set-update-prog" => "processSetUpdateProg", ! "Notified" => "processNotified", ! "Module-expansion" => "processModuleExpansion", ! "Wrapper-rcsOption" => "processWrapperRcsOption", ! "M" => "processM", ! "Mbinary" => "processMBinary", ! "E" => "processE", ! "F" => "processF", ! "MT" => "processMT"); ! var $ALLOWED_REQUESTS = array(); // A hashed array of requests we are allowed to send. var $FINAL_RESPONSE; // A state variable for tracking whether the final response *************** *** 114,158 **** * **/ ! function CVS_PServer() { ! $this->CVS_REPOSITORY = ''; ! $this->CVS_PSERVER = ''; $this->CVS_PORT = 2401; ! $this->CVS_USERNAME = ''; ! $this->CVS_PASSWORD = ''; $this->SOCKET = new Net_Socket(); - - $this->ALLOWED_RESPONSES["ok"] = "processOk"; - $this->ALLOWED_RESPONSES["error"] = "processError"; - $this->ALLOWED_RESPONSES["Valid-requests"] = "processValidRequests"; - $this->ALLOWED_RESPONSES["Checked-in"] = "processCheckedIn"; - $this->ALLOWED_RESPONSES["New-entry"] = "processNewEntry"; - $this->ALLOWED_RESPONSES["Checksum"] = "processChecksum"; - $this->ALLOWED_RESPONSES["Copy-file"] = "processCopyFile"; - $this->ALLOWED_RESPONSES["Updated"] = "processUpdated"; - $this->ALLOWED_RESPONSES["Created"] = "processCreated"; - $this->ALLOWED_RESPONSES["Update-existing"] = "processUpdateExisting"; - $this->ALLOWED_RESPONSES["Merged"] = "processMerged"; - $this->ALLOWED_RESPONSES["Patched"] = "processPatched"; - $this->ALLOWED_RESPONSES["Rcs-diff"] = "processRcsDiff"; - $this->ALLOWED_RESPONSES["Mode"] = "processMode"; - $this->ALLOWED_RESPONSES["Mod-time"] = "processModTime"; - $this->ALLOWED_RESPONSES["Removed"] = "processRemoved"; - $this->ALLOWED_RESPONSES["Remove-entry"] = "processRemoveEntry"; - $this->ALLOWED_RESPONSES["Set-static-directory"] = "processSetStaticDirectory"; - $this->ALLOWED_RESPONSES["Clear-static-directory"] = "processClearStaticDirectory"; - $this->ALLOWED_RESPONSES["Set-sticky"] = "processSetSticky"; - $this->ALLOWED_RESPONSES["Clear-sticky"] = "processClearSticky"; - $this->ALLOWED_RESPONSES["Template"] = "processTemplate"; - $this->ALLOWED_RESPONSES["Set-checkin-prog"] = "processSetCheckinProg"; - $this->ALLOWED_RESPONSES["Set-update-prog"] = "processSetUpdateProg"; - $this->ALLOWED_RESPONSES["Notified"] = "processNotified"; - $this->ALLOWED_RESPONSES["Module-expansion"] = "processModuleExpansion"; - $this->ALLOWED_RESPONSES["Wrapper-rcsOption"] = "processWrapperRcsOption"; - $this->ALLOWED_RESPONSES["M"] = "processM"; - $this->ALLOWED_RESPONSES["Mbinary"] = "processMBinary"; - $this->ALLOWED_RESPONSES["E"] = "processE"; - $this->ALLOWED_RESPONSES["F"] = "processF"; - $this->ALLOWED_RESPONSES["MT"] = "processMT"; } --- 147,161 ---- * **/ ! function CVS_PServer( $CVSROOT = "/cvsroot/p/ph/phpcvsview", ! $PServer = "cvs.sourceforge.net", ! $UserName = "anonymous", ! $Password = "") { ! $this->CVS_REPOSITORY = $CVSROOT; ! $this->CVS_PSERVER = $PServer; $this->CVS_PORT = 2401; ! $this->CVS_USERNAME = $UserName; ! $this->CVS_PASSWORD = Password; $this->SOCKET = new Net_Socket(); } *************** *** 654,659 **** } - // Deal with the blank lines. - // Get any lines not already processed and assume they are the log message. if (!$LineProcessed) { --- 657,660 ---- *************** *** 661,665 **** $this->FILES[$FileCount]["Revisions"]["$CurrentRevision"]["LogMessage"] .= "\n"; } ! $this->FILES[$FileCount]["Revisions"]["$CurrentRevision"]["LogMessage"] .= trim($Line); } } --- 662,669 ---- $this->FILES[$FileCount]["Revisions"]["$CurrentRevision"]["LogMessage"] .= "\n"; } ! $Line = trim($Line); ! if ($Line != "") { ! $this->FILES[$FileCount]["Revisions"]["$CurrentRevision"]["LogMessage"] .= trim($Line); ! } } } |
From: Sijis A. <si...@us...> - 2004-09-29 08:28:45
|
Update of /cvsroot/phpcvsview/phpcvsview In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7868 Modified Files: cvsview.php Log Message: - minor changes to CalculateDateDiff() Index: cvsview.php =================================================================== RCS file: /cvsroot/phpcvsview/phpcvsview/cvsview.php,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** cvsview.php 26 Sep 2004 13:00:29 -0000 1.4 --- cvsview.php 29 Sep 2004 08:28:34 -0000 1.5 *************** *** 65,75 **** { $DateDiff = $DateLater - $DateEarlier; ! $Years = floor($DateDiff/365/60/60/24); ! $Weeks = floor($DateDiff/60/60/24/7); ! $Days = floor($DateDiff/60/60/24); ! $Hours = floor($DateDiff/60/60); ! $Minutes = floor($DateDiff/60); ! if ($DateDiff > 0) { ! $Result = $DateDiff . " Second"; if ($DateDiff > 1) { $Result .= "s"; --- 65,77 ---- { $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"; |
From: Brian C. <bch...@us...> - 2004-09-26 13:01:42
|
Update of /cvsroot/phpcvsview/phpcvsview/images In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8228/images Added Files: file.png folder.png parent.png Log Message: Added folder with images for display purposes within the web interface. --- NEW FILE: folder.png --- (This appears to be a binary file; contents omitted.) --- NEW FILE: parent.png --- (This appears to be a binary file; contents omitted.) --- NEW FILE: file.png --- (This appears to be a binary file; contents omitted.) |
From: Brian C. <bch...@us...> - 2004-09-26 13:00:53
|
Update of /cvsroot/phpcvsview/phpcvsview In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7948 Modified Files: cvsview.php Log Message: Modified to work with the new class structure. Index: cvsview.php =================================================================== RCS file: /cvsroot/phpcvsview/phpcvsview/cvsview.php,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** cvsview.php 23 Aug 2003 13:49:40 -0000 1.3 --- cvsview.php 26 Sep 2004 13:00:29 -0000 1.4 *************** *** 20,27 **** // The CVSROOT path to access. For sourceforge you need the usual expansion // of the path based on the project name. ! $CVSROOT = "/cvsroot/p/ph/phpcvsview"; // The hostname (or IP Address) of the server providing the PServer services. $PServer = "cvs.sourceforge.net"; // The username to pass to the PServer for authentication purposes. --- 20,29 ---- // The CVSROOT path to access. For sourceforge you need the usual expansion // of the path based on the project name. ! $CVSROOT = "/cvsroot/phpcvsview"; ! //$CVSROOT = "/cvsroot/CHASE"; // The hostname (or IP Address) of the server providing the PServer services. $PServer = "cvs.sourceforge.net"; + //$PServer = "192.168.0.1"; // The username to pass to the PServer for authentication purposes. *************** *** 33,38 **** // The HTMLTitle and HTMLHeading are used purely for the generation of the // resultant web pages. ! $HTMLTitle = "PHPCVSViewer Source Code Library"; ! $HTMLHeading = ""; $HTMLTblHdBg = "#CCCCCC"; --- 35,40 ---- // The HTMLTitle and HTMLHeading are used purely for the generation of the // resultant web pages. ! $HTMLTitle = "phpCVSView Source Code Library"; ! $HTMLHeading = "phpCVSView Source Code Library"; $HTMLTblHdBg = "#CCCCCC"; *************** *** 49,56 **** $ScriptName = $_SERVER['PHP_SELF']; ! include("phpcvs.php"); ! include("phpcvsmime.php"); ! include("header.php"); ! include("footer.php"); function microtime_diff($a, $b) { --- 51,58 ---- $ScriptName = $_SERVER['PHP_SELF']; ! require_once 'phpcvs.php'; ! require_once 'phpcvsmime.php'; ! require_once 'header.php'; ! require_once 'footer.php'; function microtime_diff($a, $b) { *************** *** 60,121 **** } // End of function microtime_diff($a, $b) function DisplayDirListing() { ! global $REPOS, $CVSROOT, $PServer, $UserName, $Password, $ScriptName, $HTMLTitle, $HTMLHeading, $HTMLTblHdBg, $HTMLTblCell1, $HTMLTblCell2; ! $CVSServer = new phpcvs($CVSROOT, $PServer, $UserName, $Password); echo GetPageHeader($HTMLTitle, $HTMLHeading); ! if ($CVSServer->ConnectTcpAndLogon()) { ! $CVSServer->SendRoot(); ! $CVSServer->SendValidResponses(); ! $CVSServer->SendValidRequests(); ! $Elements = $CVSServer->RLOGDir($REPOS); ! $FileOut = ""; ! echo "<HR>\n"; ! echo "<TABLE BORDER=\"0\" CELLPADDING=\"4\" CELLSPACING=\"0\" WIDTH=\"100%\">\n"; ! echo " <TR BGCOLOR=\"$HTMLTblHdBg\">\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; ! if (strcmp($REPOS, "/") != 0) { ! echo " <TR BGCOLOR=\"$BGColor\" >\n <TD><A HREF=\"$ScriptName?CVSROOT="; ! $UpDirPath = substr($REPOS, 0, strlen($REPOS)-1); ! echo strrev(strchr(strrev($UpDirPath), "/")); ! echo "\"><IMG SRC=\"/icons/back.gif\" border=\"0\"> Parent Directory</A> </TD><TD></TD><TD></TD><TD></TD><TD></TD>\n"; $BGColor = $HTMLTblCell2; ! } // End of if (strcmp($REPOS, "/") != 0) ! while(list($key, $val) = each($Elements)){ ! if ($val == "DIR") { ! if (strpos($key, "CVSROOT") === false) { ! echo " <TR BGCOLOR=\"$BGColor\">\n"; ! echo " <TD><A HREF=\"$ScriptName?CVSROOT=$REPOS".substr($key, 0, strlen($key))."\">"; ! echo "<IMG SRC=\"/icons/dir.gif\" WIDTH=\"20\" HEIGHT=\"22\" border=\"0\"> ".$key."</A></TD>\n"; ! echo " <TD> </TD>\n <TD> </TD>\n <TD> </TD>\n <TD> </TD>\n"; ! echo " </TR>\n"; ! if (strcmp($BGColor, $HTMLTblCell1) == 0) { ! $BGColor = $HTMLTblCell2; ! } else { // Else of if (strcmp($BGColor, "#FFFFFF") == 0) ! $BGColor = $HTMLTblCell1; ! } // End of if (strcmp($BGColor, "#FFFFFF") == 0) ! } ! } // End of if ($val == "DIR") ! } // End of while(list($key, $val) = each($Elements)) ! reset($Elements); ! while(list($key, $val) = each($Elements)){ ! if ($val != "DIR") { ! $FileOut .= " <TR BGCOLOR=\"$BGColor\">\n"; ! $FileOut .= " <TD><A HREF=\"$ScriptName?CVSROOT=$REPOS&ShowHist=".$val["FILENAME"]."\">"; ! $FileOut .= "<IMG SRC=\"/icons/text.gif\" WIDTH=\"20\" HEIGHT=\"22\" border=\"0\"> ".$val["FILENAME"]."</A> </TD>\n"; ! $FileOut .= " <TD> <A HREF=\"$ScriptName?CVSROOT=$REPOS&ShowFile=".$val["FILENAME"]."&Rev=".$val["HEAD"]."\">".$val["HEAD"]."</A> </TD>\n"; ! $FileOut .= " <TD> ".str_replace(" ", " ", strftime("%d %b %Y %H:%M:%S", $val["DATE"]))." </TD>\n"; ! $FileOut .= " <TD> ".$val["AUTHOR"]." </TD>\n"; ! $FileOut .= " <TD>".str_replace("\n", "<BR>", substr($val["LOG"], 0, strlen($val["LOG"])-1))."</TD>\n"; ! $FileOut .= " </TR>\n"; ! if (strcmp($BGColor, $HTMLTblCell1) == 0) { ! $BGColor = $HTMLTblCell2; ! } else { // End of if (strcmp($BGColor, "#FFFFFF") == 0) ! $BGColor = $HTMLTblCell1; ! } // End of if (strcmp($BGColor, "#FFFFFF") == 0) ! } // End of if ($val != "DIR" ! } // End of while(list($key, $val) = each($Elements)) ! echo $FileOut." </TABLE>\n"; ! echo "<HR>"; ! $CVSServer->DisconnectTcp(); } else { // Else of if ($CVSServer->ConnectTcpAndLogon()) echo "Connection Failed."; --- 62,216 ---- } // End of function microtime_diff($a, $b) + function CalculateDateDiff($DateEarlier, $DateLater) + { + $DateDiff = $DateLater - $DateEarlier; + $Years = floor($DateDiff/365/60/60/24); + $Weeks = floor($DateDiff/60/60/24/7); + $Days = floor($DateDiff/60/60/24); + $Hours = floor($DateDiff/60/60); + $Minutes = floor($DateDiff/60); + if ($DateDiff > 0) { + $Result = $DateDiff . " 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"; + } + } + if ($Days > 0) { + $Result = $Days . " Day"; + if ($Days > 1) { + $Result .= "s"; + } + } + if ($Weeks > 0) { + $Result = $Weeks . " Week"; + if ($Days > 1) { + $Result .= "s"; + } + } + if ($Years > 0) { + $Result = $Years . " Year"; + if ($Years > 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(); ! $CVSServer->set_PServer($PServer); ! $CVSServer->set_Repository($CVSROOT); ! $CVSServer->set_UserName($UserName); ! $CVSServer->set_Password($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"]); ! $AGE = CalculateDateDiff(strtotime($File["Revisions"][$File["Head"]]["date"]), 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=1&fr=".$File["Head"]."\">".$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; ! } ! } ! ! // $Output = print_r($CVSServer->FILES, true); ! // $Output2 = str_replace("\n", "<br>", $Output); ! // echo "<hr><h1>Files Present</h1><pre>$Output2</pre><br><hr>"; ! ! $CVSServer->Disconnect(); ! ! // Close off our HTML table. ! echo " </table>\n"; ! echo "<hr>"; ! } else { // Else of if ($CVSServer->ConnectTcpAndLogon()) echo "Connection Failed."; *************** *** 124,240 **** } // End of function DisplayDirListing() ! function DisplayFileHistory($FileName) { ! global $REPOS, $CVSROOT, $PServer, $UserName, $Password, $ScriptName, $HTMLTitle, $HTMLHeading; ! $CVSServer = new phpcvs($CVSROOT, $PServer, $UserName, $Password); echo GetPageHeader($HTMLTitle, $HTMLHeading); ! if ($CVSServer->ConnectTcpAndLogon()) { ! $CVSServer->SendRoot(); ! $CVSServer->SendValidResponses(); ! $CVSServer->SendValidRequests(); ! $Elements = $CVSServer->RLOGFile($FileName, $REPOS); ! echo "<H3>Revision History for '".$REPOS.$_GET["ShowHist"]."'</H3>"; ! for ($i = 1; $i <= $Elements[0]["TotalRevisions"]; $i++) { ! echo "<HR>\n"; ! echo "<B>Revision</b>: ".$Elements[$i]["Revision"]." "; ! echo "[<A HREF=\"$ScriptName?CVSROOT=$REPOS&ShowFile=".$FileName."&Rev=".$Elements[$i]["Revision"]."\">View"; ! echo "</a>] "; ! echo "[<A HREF=\"$ScriptName?CVSROOT=$REPOS&DownloadFile=".$FileName."&Rev=".$Elements[$i]["Revision"]."\">Download"; ! echo "</a>]"; ! echo "<BR>\n"; ! echo "<b>Branch</b>: Yet to identify.<BR>\n"; ! echo "<b>Date</b>: ".$Elements[$i]["Date"]."<BR>\n"; ! echo "<b>Time</b>: ".$Elements[$i]["Time"]."<BR>\n"; ! echo "<b>Author</b>: ".$Elements[$i]["Author"]."<BR>\n"; ! echo "<b>State</b>: ".$Elements[$i]["State"]."<BR>\n"; ! if (($i + 1) < $Elements[0]["TotalRevisions"]) { ! echo "Changes since ".$Elements[$i+1]["Revision"].": "; ! echo "+".$Elements[$i]["LinesAdd"]." -".$Elements[$i]["LinesSub"]."<br>\n"; ! } // End of if (($i + 1) < $Elements[0]["TotalRevisions"]) ! echo "<pre>".str_replace("\n", "<BR>", $Elements[$i]["Log"])."</pre>"; ! } // End of for ($i = 1; $i <= $Elements[0]["TotalRevisions"]; $i++) ! echo "<HR>\n"; ! $CVSServer->DisconnectTcp(); } else { // Else of if ($CVSServer->ConnectTcpAndLogon()) ! echo "ERROR: Unable to connect to the CVS PServer.<BR>"; } // End of if ($CVSServer->ConnectTcpAndLogon()) echo GetPageFooter(); ! } // End of function DisplayFileHistory() ! ! function DisplayFile() { ! global $REPOS, $CVSROOT, $PServer, $UserName, $Password, $FileToView, $FileRev, $HTMLTitle, $HTMLHeading; ! $CVSServer = new phpcvs($CVSROOT, $PServer, $UserName, $Password); ! echo GetPageHeader($HTMLTitle, $HTMLHeading); ! if ($CVSServer->ConnectTcpAndLogon()) { ! $CVSServer->SendRoot(); ! $CVSServer->SendValidResponses(); ! $CVSServer->SendValidRequests(); ! echo "<H3>File Contents for Revision ".$FileRev." of '".$REPOS.$FileToView."'</H3><HR>"; ! $Elements = $CVSServer->ViewFile($FileToView, $FileRev, $REPOS); ! if (strpos($FileToView, ".php")) { ! $OutText = highlight_string($Elements["CONTENT"], true); ! $OutText = str_replace("<code>", "<pre>", $OutText); ! $OutText = str_replace("</code>", "</pre>", $OutText); ! echo $OutText; ! } else { // Else of if (strpos($FileToView, ".php")) ! $Find = array("<", ">", "\r", "\n", " ", "\t"); ! $Repl = array("<", ">", "", "<BR>", " ", " "); ! $Output = "<pre>".str_replace($Find, $Repl, $Elements["CONTENT"])."</pre>"; ! $Find = array("<BR><BR>"); ! $Repl = array("<BR> <BR>"); ! echo str_replace($Find, $Repl, $Output); ! } // End of if (strpos($FileToView, ".php")) ! $CVSServer->DisconnectTcp(); ! } // End of if ($CVSServer->ConnectTcpAndLogon()) ! echo "<HR>".GetPageFooter(); ! } // End of function DisplayFile() ! ! function DownloadFile() { ! global $REPOS, $CVSROOT, $PServer, $UserName, $Password, $FileToDownload, $FileRev, $MIME_TYPE; ! $CVSServer = new phpcvs($CVSROOT, $PServer, $UserName, $Password); ! if ($CVSServer->ConnectTcpAndLogon()) { ! $CVSServer->SendRoot(); ! $CVSServer->SendValidResponses(); ! $CVSServer->SendValidRequests(); ! $Elements = $CVSServer->ViewFile($FileToDownload, $FileRev, $REPOS); ! $PeriodPos = strrchr($FileToDownload, "."); ! $FileExt = substr($FileToDownload, $PeriodPos, strlen($FileToDownload)-$PeriodPos); ! if (isset($MIME_TYPE["$FileExt"])) { ! $ContentType = $MIME_TYPE["$FileExt"]; ! } else { // Else of if (isset($MIME_TYPE["$FileExt"])) ! $ContentType = "text/plain"; ! } // End of if (isset($MIME_TYPE["$FileExt"])) ! header("content-type: ".$ContentType); ! echo $Elements["CONTENT"]; ! $CVSServer->DisconnectTcp(); ! } // End of if ($CVSServer->ConnectTcpAndLogon()) ! } // End of function DownloadFile() ! if (isset($_GET["CVSROOT"])) { ! $REPOS = $_GET["CVSROOT"]; } else { // Else of if (isset($_GET["CVSROOT"])) ! $REPOS = "/"; } // End of if (isset($_GET["CVSROOT"])) ! $REPOS = str_replace("//", "/", $REPOS); ! if (isset($_GET["ShowFile"])) { ! $FileToView = $_GET["ShowFile"]; ! $FileRev = $_GET["Rev"]; ! DisplayFile(); ! } else { // Else of if (isset($_GET["ShowFile"])) ! if (isset($_GET["ShowHist"])) { ! DisplayFileHistory($_GET["ShowHist"]); ! } else { // Else of if (isset($_GET["ShowHist"])) ! if (isset($_GET["DownloadFile"])) { ! $FileToDownload = $_GET["DownloadFile"]; ! $FileRev = $_GET["Rev"]; ! DownloadFile(); ! } else { // Else of if (isset($_GET["DownloadFile"])) ! // Here we will just show the current file listing. ! DisplayDirListing(); ! } // End of if (isset($_GET["DownloadFile"])) ! } // End of if (isset($_GET["ShowHist"])) ! } // End of if (isset($_GET["ShowFile"])) ! ! ! ?> --- 219,288 ---- } // 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(); ! $CVSServer->set_PServer($PServer); ! $CVSServer->set_Repository($CVSROOT); ! $CVSServer->set_UserName($UserName); ! $CVSServer->set_Password($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) ! { ! echo "<hr>\n"; ! echo "Revision <b>".$Revision["Revision"]."</b> - (view) (download)<br>\n"; ! echo "Last Checkin: ".strftime("%A %d %b %Y %T %Z", strtotime($Revision["date"]))." (".CalculateDateDiff(strtotime($Revision["date"]), time())." ago) by ".$Revision["author"]."<br>\n"; ! } ! ! echo "<hr>\n"; ! ! $CVSServer->Disconnect(); } else { // Else of if ($CVSServer->ConnectTcpAndLogon()) ! echo "Connection Failed."; } // End of if ($CVSServer->ConnectTcpAndLogon()) echo GetPageFooter(); ! } ! // Check for a module path ! if (isset($_GET["mp"])) { ! $ModPath = $_GET["mp"]; } else { // Else of if (isset($_GET["CVSROOT"])) ! $ModPath = "/"; } // End of if (isset($_GET["CVSROOT"])) ! $ModPath = str_replace("//", "/", $ModPath); + if (isset($_GET["fh"])) { + DisplayFileHistory(); + } + else + { + DisplayDirListing(); + } ?> |
From: Brian C. <bch...@us...> - 2004-09-26 12:59:50
|
Update of /cvsroot/phpcvsview/phpcvsview In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7851 Modified Files: phpcvs.php Log Message: First stage of complete class rewrite completed. Index: phpcvs.php =================================================================== RCS file: /cvsroot/phpcvsview/phpcvsview/phpcvs.php,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** phpcvs.php 23 Aug 2003 13:49:40 -0000 1.6 --- phpcvs.php 26 Sep 2004 12:59:39 -0000 1.7 *************** *** 11,23 **** * @copyright 2003 Brian A Cheeseman **/ - class phpcvs { var $CVS_REPOSITORY; // Storage of the CVS Repository file system path. var $CVS_USERNAME; // Username to use when authenticating with the PServer. var $CVS_PASSWORD; // Password for the account above. var $CVS_PSERVER; // Hostname of the server running the PServer. var $CVS_VALID_REQUESTS; // List of valid requests the PServer accepts. ! var $SOCKET_HANDLE; // The socket handle for communicating with the PServer. /** --- 11,111 ---- * @copyright 2003 Brian A Cheeseman **/ + + require_once 'Net/Socket.php'; + + class CVS_PServer { var $CVS_REPOSITORY; // Storage of the CVS Repository file system path. var $CVS_USERNAME; // Username to use when authenticating with the PServer. var $CVS_PASSWORD; // Password for the account above. var $CVS_PSERVER; // Hostname of the server running the PServer. + var $CVS_PORT; // Port number the PServer listener is running on. + var $CVS_TIMEOUT; // Timeout in seconds for all socket operations. var $CVS_VALID_REQUESTS; // List of valid requests the PServer accepts. + var $SOCKET; // The socket handle for communicating with the PServer. + var $ALLOWED_RESPONSES = array(); // A hashed array of responses that we are capable of + // processing and the contents is the name of the function + // to process it through. + var $ALLOWED_REQUESTS = array(); // A hashed array of requests we are allowed to send. + var $FINAL_RESPONSE; // A state variable for tracking whether the final response + // in a chain of lines was a success or failure. + var $STDERR; // Standard Error output. (Does not mean that an error occured). + var $MESSAGE_CONTENT; // Message contents. (Standard Out) + var $FOLDERS = array(); // An array of the folders in the current module. + var $FILES = array(); // An array of the files in the current module. + var $CURRENT_FOLDER; // The current folder we are building up. + var $CURRENT_FILE; // The current file we are building up. + + /** + * Allowed Response Decoding functions. + **/ + + // *************************************************************************** + // Function: processOk() + // Author: Brian A Cheeseman. + // Parameters: string - Line of response text. + // Return Value: boolean - Are we expecting more responses to come in? + // *************************************************************************** + function processOk($LineOfText) + { + $this->FINAL_RESPONSE = true; + return false; + } ! // *************************************************************************** ! // Function: processError() ! // Author: Brian A Cheeseman. ! // Parameters: string - Line of response text. ! // Return Value: boolean - Are we expecting more responses to come in? ! // *************************************************************************** ! function processError($LineOfText) ! { ! $this->FINAL_RESPONSE = false; ! return false; ! } ! ! // *************************************************************************** ! // Function: processValidRequests() ! // Author: Brian A Cheeseman. ! // Parameters: string - Line of response text. ! // Return Value: boolean - Are we expecting more responses to come in? ! // *************************************************************************** ! function processValidRequests($LineOfText) ! { ! // Start tokenising the list of Valid Requests. ! $Token = strtok($LineOfText, " "); ! ! // Skip the first token, as it is the response identifier. ! $Token = strtok(" "); ! while($Token !== false){ ! $this->ALLOWED_REQUESTS[$Token] = true; ! $Token = strtok(" "); ! } // while ! return true; ! } ! ! // *************************************************************************** ! // Function: processE() ! // Author: Brian A Cheeseman. ! // Parameters: string - Line of response text. ! // Return Value: boolean - Are we expecting more responses to come in? ! // *************************************************************************** ! function processE($LineOfText) ! { ! $this->STDERR .= substr($LineOfText, 2) . "\n"; ! return true; ! } ! ! // *************************************************************************** ! // Function: processM() ! // Author: Brian A Cheeseman. ! // Parameters: string - Line of response text. ! // Return Value: boolean - Are we expecting more responses to come in? ! // *************************************************************************** ! function processM($LineOfText) ! { ! $this->MESSAGE_CONTENT .= substr($LineOfText, 2) . "\n"; ! return true; ! } /** *************** *** 26,40 **** * **/ ! ! function phpcvs($Repository = '', ! $PServer = '', ! $UserName = '', ! $Password = '') { ! $this->CVS_REPOSITORY = $Repository; ! $this->CVS_PSERVER = $PServer; ! $this->CVS_USERNAME = $UserName; ! $this->CVS_PASSWORD = $Password; ! $this->SOCKET_HANDLE = -1; } --- 114,158 ---- * **/ ! function CVS_PServer() { ! $this->CVS_REPOSITORY = ''; ! $this->CVS_PSERVER = ''; ! $this->CVS_PORT = 2401; ! $this->CVS_USERNAME = ''; ! $this->CVS_PASSWORD = ''; ! $this->SOCKET = new Net_Socket(); ! ! $this->ALLOWED_RESPONSES["ok"] = "processOk"; ! $this->ALLOWED_RESPONSES["error"] = "processError"; ! $this->ALLOWED_RESPONSES["Valid-requests"] = "processValidRequests"; ! $this->ALLOWED_RESPONSES["Checked-in"] = "processCheckedIn"; ! $this->ALLOWED_RESPONSES["New-entry"] = "processNewEntry"; ! $this->ALLOWED_RESPONSES["Checksum"] = "processChecksum"; ! $this->ALLOWED_RESPONSES["Copy-file"] = "processCopyFile"; ! $this->ALLOWED_RESPONSES["Updated"] = "processUpdated"; ! $this->ALLOWED_RESPONSES["Created"] = "processCreated"; ! $this->ALLOWED_RESPONSES["Update-existing"] = "processUpdateExisting"; ! $this->ALLOWED_RESPONSES["Merged"] = "processMerged"; ! $this->ALLOWED_RESPONSES["Patched"] = "processPatched"; ! $this->ALLOWED_RESPONSES["Rcs-diff"] = "processRcsDiff"; ! $this->ALLOWED_RESPONSES["Mode"] = "processMode"; ! $this->ALLOWED_RESPONSES["Mod-time"] = "processModTime"; ! $this->ALLOWED_RESPONSES["Removed"] = "processRemoved"; ! $this->ALLOWED_RESPONSES["Remove-entry"] = "processRemoveEntry"; ! $this->ALLOWED_RESPONSES["Set-static-directory"] = "processSetStaticDirectory"; ! $this->ALLOWED_RESPONSES["Clear-static-directory"] = "processClearStaticDirectory"; ! $this->ALLOWED_RESPONSES["Set-sticky"] = "processSetSticky"; ! $this->ALLOWED_RESPONSES["Clear-sticky"] = "processClearSticky"; ! $this->ALLOWED_RESPONSES["Template"] = "processTemplate"; ! $this->ALLOWED_RESPONSES["Set-checkin-prog"] = "processSetCheckinProg"; ! $this->ALLOWED_RESPONSES["Set-update-prog"] = "processSetUpdateProg"; ! $this->ALLOWED_RESPONSES["Notified"] = "processNotified"; ! $this->ALLOWED_RESPONSES["Module-expansion"] = "processModuleExpansion"; ! $this->ALLOWED_RESPONSES["Wrapper-rcsOption"] = "processWrapperRcsOption"; ! $this->ALLOWED_RESPONSES["M"] = "processM"; ! $this->ALLOWED_RESPONSES["Mbinary"] = "processMBinary"; ! $this->ALLOWED_RESPONSES["E"] = "processE"; ! $this->ALLOWED_RESPONSES["F"] = "processF"; ! $this->ALLOWED_RESPONSES["MT"] = "processMT"; } *************** *** 44,48 **** * **/ - function get_Repository() { return $this->CVS_REPOSITORY; --- 162,165 ---- *************** *** 66,70 **** * **/ - function set_Repository($NewRepository) { $this->CVS_REPOSITORY = $NewRepository; --- 183,186 ---- *************** *** 92,382 **** * **/ ! ! function EncodePW(&$ClearPW) { $NewChars = array( ! '!' => 120, '"' => 53, '%' => 109, '&' => 72, '\'' => 108, ! '(' => 70, ')' => 64, '*' => 76, '+' => 67, ',' => 116, ! '-' => 74, '.' => 68, '/' => 87, '0' => 111, '1' => 52, ! '2' => 75, '3' => 119, '4' => 49, '5' => 34, '6' => 82, ! '7' => 81, '8' => 95, '9' => 65, ':' => 112, ';' => 86, ! '<' => 118, '=' => 110, '>' => 122, '?' => 105, 'A' => 57, ! 'B' => 83, 'C' => 43, 'D' => 46, 'E' => 102, 'F' => 40, ! 'G' => 89, 'H' => 38, 'I' => 103, 'J' => 45, 'K' => 50, ! 'L' => 42, 'M' => 123, 'N' => 91, 'O' => 35, 'P' => 125, ! 'Q' => 55, 'R' => 54, 'S' => 66, 'T' => 124, 'U' => 126, ! 'V' => 59, 'W' => 47, 'X' => 92, 'Y' => 71, 'Z' => 115, ! 'a' => 121, 'b' => 117, 'c' => 104, 'd' => 101, 'e' => 100, ! 'f' => 69, 'g' => 73, 'h' => 99, 'i' => 63, 'j' => 94, ! 'k' => 93, 'l' => 39, 'm' => 37, 'n' => 61, 'o' => 48, ! 'p' => 58, 'q' => 113, 'r' => 32, 's' => 90, 't' => 44, ! 'u' => 98, 'v' => 60, 'w' => 51, 'x' => 33, 'y' => 97, ! 'z' => 62, '_' => 56); $CryptPW = ''; for ($i=0; $i<strlen($ClearPW); $i++) { ! $ch = substr($ClearPW, $i, 1); ! $CryptPW .= chr($NewChars[$ch]); } return $CryptPW; ! } ! function ConnectTcpAndLogon() { ! error_reporting(E_ALL); ! $this->SOCKET_HANDLE = fsockopen($this->CVS_PSERVER, 2401); ! if ($this->SOCKET_HANDLE < 0) { ! return false; ! } // End of if ($this->SOCKET_HANDLE < 0) ! if ($this->SOCKET_HANDLE < 1) { ! return false; ! } // End of if ($this->SOCKET_HANDLE < 1) ! $CPassword = "A".$this->EncodePW($this->CVS_PASSWORD); ! $Request = "BEGIN AUTH REQUEST\n".$this->CVS_REPOSITORY."\n"; ! $Request .= $this->CVS_USERNAME."\n".$CPassword."\n"; ! $Request .= "END AUTH REQUEST\n"; ! fputs($this->SOCKET_HANDLE, $Request); ! fflush($this->SOCKET_HANDLE); ! $Response = fgets($this->SOCKET_HANDLE, 11); ! if (strcmp($Response, "I LOVE YOU") == 0) { ! return true; ! } else { // Else of if (strcmp($Response, "I LOVE YOU") == 0) return false; ! } // End of if (strcmp($Response, "I LOVE YOU") == 0) ! } // End of function ConnectTcpAndLogon() { ! function DisconnectTcp() { ! fclose($this->SOCKET_HANDLE); ! $this->SOCKET_HANDLE = -1; ! } // End of function DisconnectTcp() ! function SendRoot() { ! if ($this->SOCKET_HANDLE > 0) { ! $SendCMD = "Root ".$this->CVS_REPOSITORY."\n"; ! fputs($this->SOCKET_HANDLE, $SendCMD); ! return true; ! } // End of if ($this->SOCKET_HANDLE > 0) ! return false; ! } // End of function SendRoot() ! function SendValidResponses() { ! if ($this->SOCKET_HANDLE > 0) { ! $SendCMD = "Valid-responses ok error Valid-requests Checked-in New-entry"; ! $SendCMD .= " Checksum Copy-file Updated Created Update-existing Merged"; ! $SendCMD .= " Patched Rcs-diff Mode Mod-time Removed Remove-entry"; ! $SendCMD .= " Set-static-directory Clear-static-directory Set-sticky"; ! $SendCMD .= " Clear-sticky Template Set-checkin-prog Set-update-prog"; ! $SendCMD .= " Notified Module-expansion Wrapper-rcsOption M Mbinary E F MT\n"; ! fputs($this->SOCKET_HANDLE, $SendCMD); ! return true; ! } // End of if ($this->SOCKET_HANDLE > 0) ! return false; ! } // End of function SendValidResponses() ! function SendValidRequests() { ! if ($this->SOCKET_HANDLE > 0) { ! $SendCMD = "valid-requests\n"; ! fputs($this->SOCKET_HANDLE, $SendCMD); ! $RecvCMD = fgets($this->SOCKET_HANDLE, 8192); ! $dummy = fgets($this->SOCKET_HANDLE); ! return true; ! } // End of if ($this->SOCKET_HANDLE > 0) ! return false; ! } // End of function SendValidRequests() ! function RLOGDir($Module = "/") { ! $SeenThis = ""; ! $Elements = array(); ! if ($this->SOCKET_HANDLE > -1) { ! $SendCMD = "UseUnchanged\nCase\nArgument $Module\nrlog\n"; ! fputs($this->SOCKET_HANDLE, $SendCMD); ! $RecvLN = ""; ! while(strncmp($RecvLN, "ok", 2) != 0){ ! $RecvLN = fgets($this->SOCKET_HANDLE); ! if (strncmp($RecvLN, "M \n", 3) == 0) { ! $FileName = fgets($this->SOCKET_HANDLE, 13+strlen($this->CVS_REPOSITORY.$Module)); ! if (strncmp($FileName, "M RCS file", 10) == 0) { ! $FileName = fgets($this->SOCKET_HANDLE, 8192); ! if (strpos($FileName, '/') > 0) { ! $DirName = substr($FileName, 0, strpos($FileName, '/')+1); ! if (strpos($SeenThis, $DirName) === false) { ! $Elements[$DirName] = "DIR"; ! $SeenThis .= $DirName; ! } // End of if (strpos($SeenThis, $DirName) === false) ! } else { // Else of if (strpos($FileName, '/') > 0) ! $FileName2 = substr($FileName, 0, strlen($FileName)-3); ! $Elements[$FileName2]["FILENAME"] = $FileName2; ! while(strpos($RecvLN, "M ======") === false){ ! $RecvLN = fgets($this->SOCKET_HANDLE, 8192); ! if (strncmp($RecvLN, "M head:", 7) == 0) { ! $Elements[$FileName2]["HEAD"] = substr($RecvLN, 8, strlen($RecvLN)-9); ! } // End of if (strncmp($RecvLN, "M head:", 7) == 0) ! if (strncmp($RecvLN, "M branch:", 9) == 0) { ! $Elements[$FileName2]["BRANCH"] = substr($RecvLN, 10, strlen($RecvLN)-10); ! } // End of if (strncmp($RecvLN, "M branch:", 9) == 0) ! if (strncmp($RecvLN, "M -----", 7) == 0) { ! while(strncmp($RecvLN, "M revision ", 11) != 0) { ! $RecvLN = fgets($this->SOCKET_HANDLE, 8192); ! } // End of while(strncmp($RecvLN, "M revision ", 11) != 0) ! $Rev = substr($RecvLN, 11, strlen($RecvLN)-11); ! $HeadRev = $Elements[$FileName2]["HEAD"]; ! if (strcmp(trim($Rev), trim($HeadRev)) == 0) { ! $RecvLN = fgets($this->SOCKET_HANDLE, 8192); ! $Elements[$FileName2]["DATE"] = strtotime(substr($RecvLN, 8, 19)); ! $RecvLN = substr($RecvLN, 38, strLen($RecvLN)-38); ! $Elements[$FileName2]["AUTHOR"] = substr($RecvLN, 0, strpos($RecvLN, ";")); ! $Elements[$FileName2]["LOG"] = ""; ! $RecvLN = fgets($this->SOCKET_HANDLE, 8192); ! while((strpos($RecvLN, "M ======") === false) && (strpos($RecvLN, "M ------") === false)){ ! if (strlen(trim($RecvLN)) > 1) { ! if (strncmp($RecvLN, "M branches:", 11) != 0) { ! $Elements[$FileName2]["LOG"] .= substr($RecvLN, 2, strlen($RecvLN)-1); ! } // End of if (strncmp($RecvLN, "M branches:", 11) == 0) ! } // End of if (strlen(trim($RecvLN)) > 1) ! $RecvLN = fgets($this->SOCKET_HANDLE, 8192); ! } // End of while ((strpos($RecvLN, "M ======") === false) && (strpos($RecvLN, "M ------") === false)) ! } // End of if (strcmp(trim($Rev), trim($HeadRev)) == 0) ! } // End of if (strncmp($RecvLN, "M -----", 7) == 0) ! } // End of while(strpos($RecvLN, "M ======") === false) ! } // End of if (strpos($FileName, '/') > 0) ! } // End of if (strncmp($FileName, "M RCS file", 10) == 0) ! } // End of if (strncmp($RecvLN, "M \n", 3) == 0) ! } // End of while(strncmp($RecvLN, "ok", 2) != 0) ! } // End of if ($this->SOCKET_HANDLE > -1) ! return $Elements; ! } // End of function RLOGDir(). ! function RLOGFile($File, $Module = "/") { ! $SeenThis = ""; ! $Elements = array(); ! if ($this->SOCKET_HANDLE > -1) { ! $SendCMD = "UseUnchanged\nCase\nArgument ".$Module.$File."\nrlog\n"; ! fputs($this->SOCKET_HANDLE, $SendCMD); ! $RecvLN = ""; ! $CurrentRevision = ""; ! $RevisionCounter = 0; ! $Elements["CODE"] = ""; ! while(strncmp($RecvLN, "ok", 2) != 0){ ! if (strncmp("M revision", $RecvLN, 10) == 0) { ! $RevisionCounter = $RevisionCounter + 1; ! $CurrentRevision = substr($RecvLN, 11, strlen($RecvLN)-11); ! $Elements[$RevisionCounter]["Revision"] = $CurrentRevision; ! $RecvLN = fgets($this->SOCKET_HANDLE); ! strtok($RecvLN, " :;\n\t"); ! strtok(" :;\t\n"); ! $Elements[$RevisionCounter]["Date"] = strtok(" ;\n\t"); ! $Elements[$RevisionCounter]["Time"] = strtok(" ;\n\t"); ! strtok(" :;\n\t"); ! $Elements[$RevisionCounter]["Author"] = strtok(" :;\n\t"); ! strtok(" :;\n\t"); ! $Elements[$RevisionCounter]["State"] = strtok(" :;\n\t"); ! strtok(" :;\n\t"); ! $Elements[$RevisionCounter]["LinesAdd"] = substr(strtok(" :;\n\t"), 1); ! $Elements[$RevisionCounter]["LinesSub"] = substr(strtok(" :;\n\t"), 1); ! $RecvLN = fgets($this->SOCKET_HANDLE); ! while (strncmp("M branches", $RecvLN, 10) == 0) { ! $Elements[$RevisionCounter]["Branches"] = substr($RecvLN, 11, strlen($RecvLN)-11); ! $RecvLN = fgets($this->SOCKET_HANDLE); ! } // End of while (strncmp("M branches", $RecvLN, 10) == 0) ! $Elements[$RevisionCounter]["Log"] = ""; ! while((strncmp("M ----------------------------", $RecvLN, 30) != 0) && ! (strncmp("M ============================", $RecvLN, 30) != 0)){ ! $Elements[$RevisionCounter]["Log"] .= substr($RecvLN, 2); ! $RecvLN = fgets($this->SOCKET_HANDLE); ! } // End of while looking for end of section (revision) ! } // End of if (strncmp("M revision", $RecvLN, 10) == 0) ! if (strncmp("M RCS file", $RecvLN, 10) == 0) { ! strtok($RecvLN, " :\t\n"); ! strtok(" :\t\n"); ! strtok(" :\t\n"); ! $Elements[0]["RCSFile"] = strtok(" :\t\n"); ! } // End of if (strncmp("M RCS file", $RecvLN, 10) == 0) ! if (strncmp("M head", $RecvLN, 6) == 0) { ! strtok($RecvLN, " :\t\n"); ! strtok(" :\t\n"); ! $Elements[0]["HeadRev"] = strtok(" :\t\n"); ! } // End of if (strncmp("M head", $RecvLN, 6) == 0) ! if (strncmp("M branch", $RecvLN, 8) == 0) { ! strtok($RecvLN, " :\t\n"); ! strtok(" :\t\n"); ! $Elements[0]["HeadBranch"] = strtok(" :\t\n"); ! } // End of if (strncmp("M branch", $RecvLN, 8) == 0) ! if (strncmp("M locks", $RecvLN, 7) == 0) { ! strtok($RecvLN, " :\t\n"); ! strtok(" :\t\n"); ! $Elements[0]["Locks"] = strtok(" :\t\n"); ! } // End of if (strncmp("M locks", $RecvLN, 7) == 0) ! if (strncmp("M access list", $RecvLN, 13) == 0) { ! strtok($RecvLN, " :\t\n"); ! strtok(" :\t\n"); ! strtok(" :\t\n"); ! $Elements[0]["AccessList"] = strtok(" :\t\n"); ! } // End of if (strncmp("M access list", $RecvLN, 13) == 0) ! if (strncmp("M symbolic names", $RecvLN, 16) == 0) { ! strtok($RecvLN, " :\t\n"); ! strtok(" :\t\n"); ! strtok(" :\t\n"); ! $Elements[0]["SymNames"] = strtok(" :\t\n"); ! } // End of if (strncmp("M symbolic names", $RecvLN, 16) == 0) ! if (strncmp("M keywork substitutions", $RecvLN, 23) == 0) { ! strtok($RecvLN, " :\t\n"); ! strtok(" :\t\n"); ! strtok(" :\t\n"); ! $Elements[0]["KeywrdSubst"] = strtok(" :\t\n"); ! } // End of if (strncmp("M keywork substitutions", $RecvLN, 23) == 0) ! $RecvLN = fgets($this->SOCKET_HANDLE); ! } // End of while(strncmp($RecvLN, "ok", 2) != 0) ! $Elements[0]["TotalRevisions"] = $RevisionCounter; ! } // End of if ($this->SOCKET_HANDLE > -1) ! return $Elements; ! } // End of function RLOGFile(); ! function ViewFile($File, $Revision, $Module="/") { ! if (strncmp($Module, "/", 1) == 0) { ! $Module = substr($Module, 1, strlen($Module)-1); ! } // End of if (strncmp($Module, "/", 1) == 0) ! $SendCMD = "UseUnchanged\nCase\nArgument ".$Module.$File."\nDirectory .\n".$this->CVS_REPOSITORY."\nexpand-modules\n"; ! fputs($this->SOCKET_HANDLE, $SendCMD); ! $RecvLN = "ABCD"; ! while(strncmp($RecvLN, "ok", 2) != 0){ ! $RecvLN = fgets($this->SOCKET_HANDLE); ! } // End of while(strncmp($RecvLN, "ok", 2) != 0) ! $SendCMD = "Argument -n\nArgument -l\nArgument -N\nArgument -P\nArgument -r\nArgument ".$Revision."\nArgument ".$Module.$File."\nDirectory .\n".$this->CVS_REPOSITORY."\nco\n"; ! fputs($this->SOCKET_HANDLE, $SendCMD); ! $Elements = ""; ! $RecvLN = ""; ! while(strncmp($RecvLN, "ok", 2) != 0){ ! if (strncmp($RecvLN, "Clear-sticky ", 13) == 0) { ! $RecvLN = fgets($this->SOCKET_HANDLE, 8192); ! } // End of if (strncmp($RecvLN, "Clear-sticky ", 13) == 0) ! if (strncmp($RecvLN, "Set-static-directory ", 21) == 0) { ! $RecvLN = fgets($this->SOCKET_HANDLE, 8192); ! } // End of if (strncmp($RecvLN, "Set-static-directory ", 21) == 0) ! if (strncmp($RecvLN, "Mod-time", 8) == 0) { ! $Elements["DATETIME"] = substr($RecvLN, 9, strlen($RecvLN)-9); ! $RecvLN = fgets($this->SOCKET_HANDLE); ! while(strncmp($RecvLN, "MT", 2) == 0){ ! $RecvLN = fgets($this->SOCKET_HANDLE); ! if (strncmp($RecvLN, "MT -updated", 11) == 0) { ! $RecvLN = ""; ! } // End of if (strncmp($RecvLN, "MT -updated", 11) == 0) ! } // End of while(strncmp($RecvLN, "MT", 2) == 0) ! } // End of if (strncmp($RecvLN, "Mod-time", 8) == 0) ! if (strncmp($RecvLN, "Created", 7) == 0) { ! $RecvLN = fgets($this->SOCKET_HANDLE); ! $RecvLN = fgets($this->SOCKET_HANDLE); ! $RecvLN = fgets($this->SOCKET_HANDLE); ! $RecvLN = fgets($this->SOCKET_HANDLE); ! $TotalBytes = $RecvLN + 0; ! $Elements["CONTENT"] = fread($this->SOCKET_HANDLE, $TotalBytes); ! } // End of if (strncmp($RecvLN, "Created", 7) == 0) ! $RecvLN = fgets($this->SOCKET_HANDLE); ! } // End of while(strncmp($RecvLN, "ok", 2) != 0) ! return $Elements; ! } // End of function ViewFile($File, $Revision, $Module="/") ! function CVSLogon() { ! if ($this->CVS_PSERVER == '') { ! // We are logging into a locally connected filesystem. ! } else { ! // We are logging into a remote PServer repository. } } --- 208,668 ---- * **/ ! ! // *************************************************************************** ! // Function: TransformPW() ! // Author: Brian A Cheeseman. ! // Parameters: $ClearPW - The clear text password to be transformed. ! // Return Value: string - The cipher text of the clear test password. ! // *************************************************************************** ! function TransformPW($ClearPW) { ! ! // Define our constant array to provide a lookup table for the conversion ! // of the clear password to cipher text. $NewChars = array( ! '!' => 'x', '8' => '_', 'N' => '[', 'g' => 'I', ! '"' => '5', '9' => 'A', 'O' => '#', 'h' => 'c', ! '%' => 'm', ':' => 'p', 'P' => '}', 'i' => '?', ! '&' => 'H', ';' => 'V', 'Q' => '7', 'j' => '^', ! '\'' => 'l', '<' => 'v', 'R' => '6', 'k' => ']', ! '(' => 'F', '=' => 'n', 'S' => 'B', 'l' => '\'', ! ')' => '@', '>' => 'z', 'T' => '|', 'm' => '%', ! '*' => 'L', '?' => 'i', 'U' => '~', 'n' => '=', ! '+' => 'C', 'A' => '9', 'V' => ';', 'o' => '0', ! ',' => 't', 'B' => 'S', 'W' => '/', 'p' => ':', ! '-' => 'J', 'C' => '+', 'X' => '\\', 'q' => 'q', ! '.' => 'D', 'D' => '.', 'Y' => 'G', 'r' => ' ', ! '/' => 'W', 'E' => 'f', 'Z' => 's', 's' => 'Z', ! '0' => 'o', 'F' => '(', '_' => '8', 't' => ',', ! '1' => '4', 'G' => 'Y', 'a' => 'y', 'u' => 'b', ! '2' => 'K', 'H' => '&', 'b' => 'u', 'v' => '<', ! '3' => 'w', 'I' => 'g', 'c' => 'h', 'w' => '3', ! '4' => '1', 'J' => '-', 'd' => 'e', 'x' => '!', ! '5' => '"', 'K' => '2', 'e' => 'd', 'y' => 'a', ! '6' => 'R', 'L' => '*', 'f' => 'E', 'z' => '>', ! '7' => 'Q', 'M' => '{'); + // Initialise the cipher text password local storage variable. $CryptPW = ''; + + // Loop through each char in the clear text password and add + // the appropriate character from the lookup table to the + // cipher text password variable. for ($i=0; $i<strlen($ClearPW); $i++) { ! $CryptPW .= $NewChars[substr($ClearPW, $i, 1)]; } + + // Return the cipher text password to the calling code. return $CryptPW; ! } // End of function TransformPW ! ! // *************************************************************************** ! // Function: Connect() ! // Author: Brian A Cheeseman. ! // Parameters: None. ! // Return Value: boolean - Were we successful in connecting? ! // *************************************************************************** ! function Connect() { ! // Do we have the name of the server to connect to? ! if ($this->CVS_PSERVER != "") { ! // Yes, attempt to connect to the server. ! $retval = $this->SOCKET->connect($this->CVS_PSERVER, $this->CVS_PORT, false, $this->CVS_TIMEOUT); ! // Return to the calling code the fact that we are connected. ! return $retval; ! } ! else ! { ! // We need a server name to connect, so return a false. return false; ! } // End of if ($this->CVS_PSERVER != "") ! } // End of function Connect ! // *************************************************************************** ! // Function: Disconnect() ! // Author: Brian A Cheeseman. ! // Parameters: None. ! // Return Value: boolean - Were we successful in connecting? ! // *************************************************************************** ! function Disconnect() { ! $retval = $this->SOCKET->disconnect(); ! return $retval; ! } // End of function Disconnect ! // *************************************************************************** ! // Function: Authenticate() ! // Author: Brian A Cheeseman. ! // Parameters: None. ! // Return Value: boolean - Are we authenticated. ! // *************************************************************************** ! function Authenticate() { ! // Send the start of authentication request. ! if ($this->SOCKET->write("BEGIN AUTH REQUEST\n") != true) { ! return false; ! } ! ! // Send the path to the repository we are attempting to connect to. ! if ($this->SOCKET->write($this->CVS_REPOSITORY."\n") != true) { ! return false; ! } ! ! // Send the user name to authenticate with. ! if ($this->SOCKET->write($this->CVS_USERNAME."\n") != true) { ! return false; ! } ! ! // Transform and send the password matching the username above. ! if ($this->SOCKET->write("A".$this->TransformPW($this->CVS_PASSWORD)."\n") != true) { ! return false; ! } ! ! // Send the terminator for the authentication request. ! if ($this->SOCKET->write("END AUTH REQUEST\n") != true) { ! return false; ! } ! ! // Read the next line to determine if we were successful. ! $response = $this->SOCKET->readLine(); ! if ($response == true && strncmp($response, "I LOVE YOU", 10) == 0) { ! return true; ! } ! else ! { ! // Retrieve the error message from the PServer. ! $errorMsg = ""; ! while(!$this->SOCKET->eof()){ ! $line = $this->SOCKET->readLine(); ! if (strncmp($line, "E ", 2) == 0) { ! $errorMsg .= substr($line, 2); ! } ! if (strncmp($line, "error", 5) == 0) { ! $this->SOCKET->disconnect(); ! } ! } // End of while(!$this->SOCKET->eof()) ! if ($errorMsg == "") { ! return false; ! } ! else ! { ! return $errorMsg; ! } // End of if ($errorMsg == "") ! } // End of if ($response == true && strncmp($response, "I LOVE YOU", 10) == 0) ! } // End of function Authenticate ! ! // *************************************************************************** ! // Function: processResponse() ! // Author: Brian A Cheeseman. ! // Parameters: None. ! // Return Value: boolean - Successfully sent. ! // *************************************************************************** ! function processResponse() ! { ! $this->MESSAGE_CONTENT = ""; ! $this->STDERR = ""; ! $KeepGoing = true; ! while($KeepGoing){ ! $ResponseLine = $this->SOCKET->readLine(); ! $Response = strtok($ResponseLine, " "); ! if ($Response != "") { ! $Func = $this->ALLOWED_RESPONSES[$Response]; ! if (method_exists($this, $Func)) { ! $KeepGoing = $this->$Func($ResponseLine); ! } ! } ! } // while ! } ! ! // *************************************************************************** ! // Function: sendCVSROOT() ! // Author: Brian A Cheeseman. ! // Parameters: None. ! // Return Value: boolean - Successfully sent. ! // *************************************************************************** ! function sendCVSROOT() ! { ! if ($this->SOCKET->write("Root ".$this->CVS_REPOSITORY."\n") != true) { ! return false; ! } ! return true; ! } ! // *************************************************************************** ! // Function: sendValidResponses() ! // Author: Brian A Cheeseman. ! // Parameters: None. ! // Return Value: boolean - Successfully sent. ! // *************************************************************************** ! function sendValidResponses() ! { ! // Build our list of responses we can process into the format required ! // for the cvs pserver. ! $ValidResponses = ""; ! foreach ($this->ALLOWED_RESPONSES as $name => $value) ! { ! $ValidResponses .= " ".$name; ! } ! ! // Send the command to the pserver. ! if ($this->SOCKET->write("Valid-responses".$ValidResponses."\n") != true) { ! return false; ! } ! return true; ! } ! // *************************************************************************** ! // Function: sendValidRequests() ! // Author: Brian A Cheeseman. ! // Parameters: None. ! // Return Value: boolean - Successfully sent and processed. ! // *************************************************************************** ! function sendValidRequests() ! { ! if ($this->SOCKET->write("valid-requests\n") != true) { ! return false; ! } ! $this->processResponse(); ! return true; ! } ! // *************************************************************************** ! // Function: sendUseUnchanged() ! // Author: Brian A Cheeseman. ! // Parameters: None. ! // Return Value: boolean - Successfully sent. ! // *************************************************************************** ! function sendUseUnchanged() ! { ! if ($this->ALLOWED_REQUESTS["UseUnchanged"] == true) { ! if ($this->SOCKET->write("UseUnchanged\n") != true) { ! return false; ! } ! } ! return true; ! } ! // *************************************************************************** ! // Function: sendArgument() ! // Author: Brian A Cheeseman. ! // Parameters: string - Value of argument to send. ! // Return Value: boolean - Successfully sent. ! // *************************************************************************** ! function sendArgument($ArgToSend) ! { ! if ($this->ALLOWED_REQUESTS["Argument"] == true) { ! if ($this->SOCKET->write("Argument $ArgToSend\n") != true) { ! return false; ! } ! } ! return true; ! } ! ! // *************************************************************************** ! // Function: sendRLog() ! // Author: Brian A Cheeseman. ! // Parameters: None. ! // Return Value: boolean - Successfully sent. ! // *************************************************************************** ! function sendRLog() ! { ! if ($this->ALLOWED_REQUESTS["rlog"] == true) { ! if ($this->SOCKET->write("rlog\n") != true) { ! return false; ! } ! } ! return true; ! } ! ! /** ! * Helper Methods. ! **/ ! ! // *************************************************************************** ! // Function: RLogDirectory() ! // Author: Brian A Cheeseman. ! // Parameters: string - Directory to get the RLog for. ! // Return Value: boolean - Were we successful. ! // *************************************************************************** ! function RLog($Folder) ! { ! $this->sendCVSROOT(); ! $this->sendValidResponses(); ! $this->sendValidRequests(); ! ! if (!$this->sendUseUnchanged()) { ! return false; ! } ! ! if (!$this->sendArgument($Folder)) { ! return false; ! } ! ! if (!$this->sendRLog()) { ! return false; ! } ! ! $this->processResponse(); ! ! if (!($this->FINAL_RESPONSE)) { ! return $this->RLog(substr($Folder, 1)); ! } ! ! if ($Folder == "") { ! $Folder = "/"; ! } ! ! $DirCount = -1; ! $FileCount = -1; ! $SeenFolders = ""; ! $CurrentDecode = 0; ! $FileRevision = -1; ! $CurrentRevision = ""; ! $LineProcessed = false; ! if ($this->FINAL_RESPONSE) { ! $Responses = explode("\n", $this->MESSAGE_CONTENT); ! // Iterate through each line. ! foreach ($Responses as $Line) ! { ! $LineProcessed = false; ! // Are we dealing with a file or a folder? ! if (strncmp($Line, "RCS file: ", 10) == 0) { ! // We have the file/dir name, so we can now determine what we are dealing with. ! $TempLine = substr($Line, 10+strlen($this->CVS_REPOSITORY.$Folder)); ! if (strncmp($TempLine, "/", 1) == 0) { ! $TempLine = substr($TempLine, 1); ! } ! if (($SlashPos = strpos($TempLine, "/")) > 0) { ! // We have a folder. ! $FolderName = substr($TempLine, 0, $SlashPos); ! if (strpos($SeenFolders, $FolderName) === false) { ! $DirCount++; ! $this->FOLDERS[$DirCount]["Name"] = $FolderName; ! $SeenFolders .= " " . $FolderName; ! $CurrentDecode = 1; ! $CurrentRevision = ""; ! $LineProcessed = true; ! } ! } ! else ! { ! // We have a file. ! $FileCount++; ! $FileName = substr($TempLine, 0, -2); ! $this->FILES[$FileCount]["Name"] = $FileName; ! $CurrentDecode = 2; ! $LineProcessed = true; ! } ! } ! // Lets continue, but only if we have a CurrentDecode type of 2 (ie a file). ! if ($CurrentDecode == 2) { ! // Process for the remaining file attributes. ! ! // Head version of file. ! if (strncmp($Line, "head:", 5) == 0) { ! $this->FILES[$FileCount]["Head"] = trim(substr($Line, 6)); ! $LineProcessed = true; ! } ! ! // Default branch. ! if (strncmp($Line, "branch:", 7) == 0) { ! $this->FILES[$FileCount]["Branch"] = trim(substr($Line, 8)); ! $LineProcessed = true; ! } ! ! // Locking Mechanism. ! if (strncmp($Line, "locks:", 6) == 0) { ! $this->FILES[$FileCount]["Locks"] = trim(substr($Line, 7)); ! $LineProcessed = true; ! } ! ! // Access list. ! if (strncmp($Line, "access list:", 12) == 0) { ! $this->FILES[$FileCount]["Access"] = trim(substr($Line, 13)); ! $LineProcessed = true; ! } ! ! // Process the symbolic names. ! if (strncmp($Line, "symbolic names:", 15) == 0) { ! $LineProcessed = true; ! } ! ! if (strncmp($Line, "\t", 1) == 0) { ! $TempLine = substr($Line, 1); ! $SymbolName = trim(substr($TempLine, 0, strpos($TempLine, ":"))); ! $SymbolValue = trim(substr($TempLine, strpos($TempLine, ":")+1)); ! $this->FILES[$FileCount]["Symbols"]["$SymbolName"] = $SymbolValue; ! $this->FILES[$FileCount]["Symbols"]["$SymbolValue"] = $SymbolName; ! $LineProcessed = true; ! } ! ! // Process the Keyword Substitution. ! if (strncmp($Line, "keyword substitution:", 21) == 0) { ! $this->FILES[$FileCount]["KeywordSubst"] = trim(substr($Line, 22)); ! $LineProcessed = true; ! } ! ! // Process the Total Revisions. ! if (strncmp($Line, "total revisions:", 16) == 0) { ! $TempLine = substr($Line, 17); ! $this->FILES[$FileCount]["TotalRevs"] = trim(substr($TempLine, 0, strpos($TempLine, ";"))); ! $this->FILES[$FileCount]["SelectedRevs"] = trim(substr($TempLine, strpos($TempLine, ";")+22)); ! $LineProcessed = true; ! } ! ! // Process the description. ! if (strncmp($Line, "description:", 12) == 0) { ! $this->FILES[$FileCount]["Description"] = trim(substr($Line, 13)); ! $LineProcessed = true; ! } ! ! // Process the individual revision information. ! if (strncmp($Line, "-------------", 13) == 0) { ! $LineProcessed = true; ! } ! ! // Get this revision number. ! if (strncmp($Line, "revision", 8) == 0) { ! $CurrentRevision = substr($Line, 9); ! $this->FILES[$FileCount]["Revisions"]["$CurrentRevision"]["Revision"] = $CurrentRevision; ! $this->FILES[$FileCount]["Revisions"]["$CurrentRevision"]["LogMessage"] = ""; ! $LineProcessed = true; ! } ! ! // Get the Date, Author, State and Lines of this revision. ! if (strncmp($Line, "date:", 5) == 0) { ! $Segment = strtok($Line, ";"); ! while(!($Segment === false)){ ! $SepPos = trim(strpos($Segment, ":")); ! $Name = trim(substr($Segment, 0, $SepPos)); ! $Value = trim(substr($Segment, $SepPos+1)); ! $this->FILES[$FileCount]["Revisions"]["$CurrentRevision"]["$Name"] = $Value; ! $Segment = strtok(";"); ! } // while ! $LineProcessed = true; ! } ! ! // Get the current revisions branch. ! if (strncmp($Line, "branches:", 9) == 0) { ! $this->FILES[$FileCount]["Revisions"]["$CurrentRevision"]["Branches"] = trim(substr($Line, 10)); ! $LineProcessed = true; ! } ! ! // Deal with the new file seperator. ! if (strncmp($Line, "=============", 13) == 0) { ! $CurrentDecode = 0; ! $LineProcessed = true; ! } ! ! // Deal with the blank lines. ! ! // Get any lines not already processed and assume they are the log message. ! if (!$LineProcessed) { ! if (strlen($this->FILES[$FileCount]["Revisions"]["$CurrentRevision"]["LogMessage"]) > 0) { ! $this->FILES[$FileCount]["Revisions"]["$CurrentRevision"]["LogMessage"] .= "\n"; ! } ! $this->FILES[$FileCount]["Revisions"]["$CurrentRevision"]["LogMessage"] .= trim($Line); ! } ! } ! } } } |
From: Brian C. <bch...@us...> - 2004-09-26 12:58:39
|
Update of /cvsroot/phpcvsview/phpcvsview/images In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7736/images Log Message: Directory /cvsroot/phpcvsview/phpcvsview/images added to the repository |
From: <bch...@us...> - 2003-08-23 14:51:35
|
Update of /cvsroot/phpcvsview/phpcvsview In directory sc8-pr-cvs1:/tmp/cvs-serv23692 Modified Files: cvsview.php phpcvs.php Log Message: Fixed a couple of bugs with the connection to a CVS repository. Index: cvsview.php =================================================================== RCS file: /cvsroot/phpcvsview/phpcvsview/cvsview.php,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** cvsview.php 7 Apr 2003 08:23:56 -0000 1.2 --- cvsview.php 23 Aug 2003 13:49:40 -0000 1.3 *************** *** 20,24 **** // The CVSROOT path to access. For sourceforge you need the usual expansion // of the path based on the project name. ! $CVSROOT = "/cvsroot/p/ph/phpcvsview/"; // The hostname (or IP Address) of the server providing the PServer services. --- 20,24 ---- // The CVSROOT path to access. For sourceforge you need the usual expansion // of the path based on the project name. ! $CVSROOT = "/cvsroot/p/ph/phpcvsview"; // The hostname (or IP Address) of the server providing the PServer services. *************** *** 31,34 **** --- 31,43 ---- $Password = ""; + // The HTMLTitle and HTMLHeading are used purely for the generation of the + // resultant web pages. + $HTMLTitle = "PHPCVSViewer Source Code Library"; + $HTMLHeading = ""; + + $HTMLTblHdBg = "#CCCCCC"; + $HTMLTblCell1 = "#FFFFFF"; + $HTMLTblCell2 = "#CCCCEE"; + /** * *************** *** 52,58 **** function DisplayDirListing() { ! global $REPOS, $CVSROOT, $PServer, $UserName, $Password, $ScriptName; $CVSServer = new phpcvs($CVSROOT, $PServer, $UserName, $Password); ! echo GetPageHeader("phpCVSView CVS Repository", "phpCVSView CVS Repository"); if ($CVSServer->ConnectTcpAndLogon()) { $CVSServer->SendRoot(); --- 61,67 ---- function DisplayDirListing() { ! global $REPOS, $CVSROOT, $PServer, $UserName, $Password, $ScriptName, $HTMLTitle, $HTMLHeading, $HTMLTblHdBg, $HTMLTblCell1, $HTMLTblCell2; $CVSServer = new phpcvs($CVSROOT, $PServer, $UserName, $Password); ! echo GetPageHeader($HTMLTitle, $HTMLHeading); if ($CVSServer->ConnectTcpAndLogon()) { $CVSServer->SendRoot(); *************** *** 62,87 **** $FileOut = ""; echo "<HR>\n"; ! echo "<TABLE BORDER=\"0\" CELLPADDING=\"2\" CELLSPACING=\"1\" WIDTH=\"100%\">\n"; ! echo " <TR BGCOLOR=\"#CCFFCC\">\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 = "#FFFFFF"; if (strcmp($REPOS, "/") != 0) { ! echo " <TR BGCOLOR=\"$BGColor\" COLSPAN=\"5\">\n <TD><A HREF=\"$ScriptName?CVSROOT="; $UpDirPath = substr($REPOS, 0, strlen($REPOS)-1); echo strrev(strchr(strrev($UpDirPath), "/")); ! echo "\"><IMG SRC=\"/icons/back.gif\" border=\"0\"> Parent Directory</A> </TD>\n"; ! $BGColor="#CCCCFF"; } // End of if (strcmp($REPOS, "/") != 0) while(list($key, $val) = each($Elements)){ if ($val == "DIR") { ! echo " <TR BGCOLOR=\"$BGColor\">\n"; ! echo " <TD><A HREF=\"$ScriptName?CVSROOT=$REPOS".substr($key, 0, strlen($key))."\">"; ! echo "<IMG SRC=\"/icons/dir.gif\" WIDTH=\"20\" HEIGHT=\"22\" border=\"0\"> ".$key."</A></TD>\n"; ! echo " <TD> </TD>\n <TD> </TD>\n <TD> </TD>\n <TD> </TD>\n"; ! echo " </TR>\n"; ! if (strcmp($BGColor, "#FFFFFF") == 0) { ! $BGColor = "#CCCCFF"; ! } else { // Else of if (strcmp($BGColor, "#FFFFFF") == 0) ! $BGColor = "#FFFFFF"; ! } // End of if (strcmp($BGColor, "#FFFFFF") == 0) } // End of if ($val == "DIR") } // End of while(list($key, $val) = each($Elements)) --- 71,98 ---- $FileOut = ""; echo "<HR>\n"; ! echo "<TABLE BORDER=\"0\" CELLPADDING=\"4\" CELLSPACING=\"0\" WIDTH=\"100%\">\n"; ! echo " <TR BGCOLOR=\"$HTMLTblHdBg\">\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; if (strcmp($REPOS, "/") != 0) { ! echo " <TR BGCOLOR=\"$BGColor\" >\n <TD><A HREF=\"$ScriptName?CVSROOT="; $UpDirPath = substr($REPOS, 0, strlen($REPOS)-1); echo strrev(strchr(strrev($UpDirPath), "/")); ! echo "\"><IMG SRC=\"/icons/back.gif\" border=\"0\"> Parent Directory</A> </TD><TD></TD><TD></TD><TD></TD><TD></TD>\n"; ! $BGColor = $HTMLTblCell2; } // End of if (strcmp($REPOS, "/") != 0) while(list($key, $val) = each($Elements)){ if ($val == "DIR") { ! if (strpos($key, "CVSROOT") === false) { ! echo " <TR BGCOLOR=\"$BGColor\">\n"; ! echo " <TD><A HREF=\"$ScriptName?CVSROOT=$REPOS".substr($key, 0, strlen($key))."\">"; ! echo "<IMG SRC=\"/icons/dir.gif\" WIDTH=\"20\" HEIGHT=\"22\" border=\"0\"> ".$key."</A></TD>\n"; ! echo " <TD> </TD>\n <TD> </TD>\n <TD> </TD>\n <TD> </TD>\n"; ! echo " </TR>\n"; ! if (strcmp($BGColor, $HTMLTblCell1) == 0) { ! $BGColor = $HTMLTblCell2; ! } else { // Else of if (strcmp($BGColor, "#FFFFFF") == 0) ! $BGColor = $HTMLTblCell1; ! } // End of if (strcmp($BGColor, "#FFFFFF") == 0) ! } } // End of if ($val == "DIR") } // End of while(list($key, $val) = each($Elements)) *************** *** 97,104 **** $FileOut .= " <TD>".str_replace("\n", "<BR>", substr($val["LOG"], 0, strlen($val["LOG"])-1))."</TD>\n"; $FileOut .= " </TR>\n"; ! if (strcmp($BGColor, "#FFFFFF") == 0) { ! $BGColor = "#CCCCFF"; } else { // End of if (strcmp($BGColor, "#FFFFFF") == 0) ! $BGColor = "#FFFFFF"; } // End of if (strcmp($BGColor, "#FFFFFF") == 0) } // End of if ($val != "DIR" --- 108,115 ---- $FileOut .= " <TD>".str_replace("\n", "<BR>", substr($val["LOG"], 0, strlen($val["LOG"])-1))."</TD>\n"; $FileOut .= " </TR>\n"; ! if (strcmp($BGColor, $HTMLTblCell1) == 0) { ! $BGColor = $HTMLTblCell2; } else { // End of if (strcmp($BGColor, "#FFFFFF") == 0) ! $BGColor = $HTMLTblCell1; } // End of if (strcmp($BGColor, "#FFFFFF") == 0) } // End of if ($val != "DIR" *************** *** 114,120 **** function DisplayFileHistory($FileName) { ! global $REPOS, $CVSROOT, $PServer, $UserName, $Password, $ScriptName; $CVSServer = new phpcvs($CVSROOT, $PServer, $UserName, $Password); ! echo GetPageHeader("phpCVSView CVS Repository", "phpCVSView CVS Repository"); if ($CVSServer->ConnectTcpAndLogon()) { $CVSServer->SendRoot(); --- 125,131 ---- function DisplayFileHistory($FileName) { ! global $REPOS, $CVSROOT, $PServer, $UserName, $Password, $ScriptName, $HTMLTitle, $HTMLHeading; $CVSServer = new phpcvs($CVSROOT, $PServer, $UserName, $Password); ! echo GetPageHeader($HTMLTitle, $HTMLHeading); if ($CVSServer->ConnectTcpAndLogon()) { $CVSServer->SendRoot(); *************** *** 125,129 **** for ($i = 1; $i <= $Elements[0]["TotalRevisions"]; $i++) { echo "<HR>\n"; ! echo "Revision: ".$Elements[$i]["Revision"]." "; echo "[<A HREF=\"$ScriptName?CVSROOT=$REPOS&ShowFile=".$FileName."&Rev=".$Elements[$i]["Revision"]."\">View"; echo "</a>] "; --- 136,140 ---- for ($i = 1; $i <= $Elements[0]["TotalRevisions"]; $i++) { echo "<HR>\n"; ! echo "<B>Revision</b>: ".$Elements[$i]["Revision"]." "; echo "[<A HREF=\"$ScriptName?CVSROOT=$REPOS&ShowFile=".$FileName."&Rev=".$Elements[$i]["Revision"]."\">View"; echo "</a>] "; *************** *** 131,139 **** echo "</a>]"; echo "<BR>\n"; ! echo "Branch: Yet to identify.<BR>\n"; ! echo "Date: ".$Elements[$i]["Date"]."<BR>\n"; ! echo "Time: ".$Elements[$i]["Time"]."<BR>\n"; ! echo "Author: ".$Elements[$i]["Author"]."<BR>\n"; ! echo "State: ".$Elements[$i]["State"]."<BR>\n"; if (($i + 1) < $Elements[0]["TotalRevisions"]) { echo "Changes since ".$Elements[$i+1]["Revision"].": "; --- 142,150 ---- echo "</a>]"; echo "<BR>\n"; ! echo "<b>Branch</b>: Yet to identify.<BR>\n"; ! echo "<b>Date</b>: ".$Elements[$i]["Date"]."<BR>\n"; ! echo "<b>Time</b>: ".$Elements[$i]["Time"]."<BR>\n"; ! echo "<b>Author</b>: ".$Elements[$i]["Author"]."<BR>\n"; ! echo "<b>State</b>: ".$Elements[$i]["State"]."<BR>\n"; if (($i + 1) < $Elements[0]["TotalRevisions"]) { echo "Changes since ".$Elements[$i+1]["Revision"].": "; *************** *** 151,176 **** function DisplayFile() { ! global $REPOS, $CVSROOT, $PServer, $UserName, $Password, $FileToView, $FileRev; $CVSServer = new phpcvs($CVSROOT, $PServer, $UserName, $Password); ! echo GetPageHeader("phpCVSView CVS Repository", "phpCVSView CVS Repository"); if ($CVSServer->ConnectTcpAndLogon()) { $CVSServer->SendRoot(); $CVSServer->SendValidResponses(); $CVSServer->SendValidRequests(); ! echo "<H3>File Contents for Revision ".$FileRev." of '".$REPOS.$FileToView."'</H3>"; $Elements = $CVSServer->ViewFile($FileToView, $FileRev, $REPOS); if (strpos($FileToView, ".php")) { ! $OutText = highlight_string($Elements["CONTENT"], true); ! $OutText = str_replace("<code>", "<pre>", $OutText); $OutText = str_replace("</code>", "</pre>", $OutText); ! echo $OutText; } else { // Else of if (strpos($FileToView, ".php")) ! $Find = array("\r", "\n", " ", "\t"); ! $Repl = array("", "<BR>", " ", " "); ! echo "<pre>".str_replace($Find, $Repl, $Elements["CONTENT"])."</pre>"; } // End of if (strpos($FileToView, ".php")) $CVSServer->DisconnectTcp(); } // End of if ($CVSServer->ConnectTcpAndLogon()) ! echo GetPageFooter(); } // End of function DisplayFile() --- 162,190 ---- function DisplayFile() { ! global $REPOS, $CVSROOT, $PServer, $UserName, $Password, $FileToView, $FileRev, $HTMLTitle, $HTMLHeading; $CVSServer = new phpcvs($CVSROOT, $PServer, $UserName, $Password); ! echo GetPageHeader($HTMLTitle, $HTMLHeading); if ($CVSServer->ConnectTcpAndLogon()) { $CVSServer->SendRoot(); $CVSServer->SendValidResponses(); $CVSServer->SendValidRequests(); ! echo "<H3>File Contents for Revision ".$FileRev." of '".$REPOS.$FileToView."'</H3><HR>"; $Elements = $CVSServer->ViewFile($FileToView, $FileRev, $REPOS); if (strpos($FileToView, ".php")) { ! $OutText = highlight_string($Elements["CONTENT"], true); ! $OutText = str_replace("<code>", "<pre>", $OutText); $OutText = str_replace("</code>", "</pre>", $OutText); ! echo $OutText; } else { // Else of if (strpos($FileToView, ".php")) ! $Find = array("<", ">", "\r", "\n", " ", "\t"); ! $Repl = array("<", ">", "", "<BR>", " ", " "); ! $Output = "<pre>".str_replace($Find, $Repl, $Elements["CONTENT"])."</pre>"; ! $Find = array("<BR><BR>"); ! $Repl = array("<BR> <BR>"); ! echo str_replace($Find, $Repl, $Output); } // End of if (strpos($FileToView, ".php")) $CVSServer->DisconnectTcp(); } // End of if ($CVSServer->ConnectTcpAndLogon()) ! echo "<HR>".GetPageFooter(); } // End of function DisplayFile() *************** *** 224,226 **** ! ?> \ No newline at end of file --- 238,240 ---- ! ?> Index: phpcvs.php =================================================================== RCS file: /cvsroot/phpcvsview/phpcvsview/phpcvs.php,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** phpcvs.php 7 Apr 2003 08:23:59 -0000 1.5 --- phpcvs.php 23 Aug 2003 13:49:40 -0000 1.6 *************** *** 193,197 **** $RecvLN = fgets($this->SOCKET_HANDLE); if (strncmp($RecvLN, "M \n", 3) == 0) { ! $FileName = fgets($this->SOCKET_HANDLE, 12+strlen($this->CVS_REPOSITORY.$Module)); if (strncmp($FileName, "M RCS file", 10) == 0) { $FileName = fgets($this->SOCKET_HANDLE, 8192); --- 193,197 ---- $RecvLN = fgets($this->SOCKET_HANDLE); if (strncmp($RecvLN, "M \n", 3) == 0) { ! $FileName = fgets($this->SOCKET_HANDLE, 13+strlen($this->CVS_REPOSITORY.$Module)); if (strncmp($FileName, "M RCS file", 10) == 0) { $FileName = fgets($this->SOCKET_HANDLE, 8192); |
From: <bch...@us...> - 2003-04-07 08:24:14
|
Update of /cvsroot/phpcvsview/phpcvsview In directory sc8-pr-cvs1:/tmp/cvs-serv2905 Modified Files: cvsview.php footer.php header.php phpcvs.php phpcvsmime.php test.php Log Message: Cleaned up the source code for the project. Index: cvsview.php =================================================================== RCS file: /cvsroot/phpcvsview/phpcvsview/cvsview.php,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** cvsview.php 6 Apr 2003 08:06:18 -0000 1.1 --- cvsview.php 7 Apr 2003 08:23:56 -0000 1.2 *************** *** 2,5 **** --- 2,8 ---- /** + * This source code is distributed under the terms as layed out in the + * GNU General Public License. + * * Purpose: To provide the main entry point in accessing a CVS repository * *************** *** 9,19 **** **/ ! $REPOS = ""; ! $CVSROOT = "/cvsroot/d/de/denet/"; ! //$CVSROOT = "/cvsroot/p/ph/phpcvsview/"; $PServer = "cvs.sourceforge.net"; $UserName = "anonymous"; $Password = ""; $ScriptName = $_SERVER['PHP_SELF']; --- 12,41 ---- **/ ! /** ! * ! * phpCVSView Configuration Parameters. ! * ! **/ ! ! // The CVSROOT path to access. For sourceforge you need the usual expansion ! // of the path based on the project name. ! $CVSROOT = "/cvsroot/p/ph/phpcvsview/"; ! ! // The hostname (or IP Address) of the server providing the PServer services. $PServer = "cvs.sourceforge.net"; + + // The username to pass to the PServer for authentication purposes. $UserName = "anonymous"; + + // The password associated with the username above for authentication process. $Password = ""; + /** + * + * End of phpCVSView Configuration Parameters. + * + **/ + + $REPOS = ""; $ScriptName = $_SERVER['PHP_SELF']; *************** *** 27,37 **** list($b_dec, $b_sec) = explode(" ", $b); return $b_sec - $a_sec + $b_dec - $a_dec; ! } ! function DisplayDirListing () { global $REPOS, $CVSROOT, $PServer, $UserName, $Password, $ScriptName; - $CVSServer = new phpcvs($CVSROOT, $PServer, $UserName, $Password); - echo GetPageHeader("phpCVSView CVS Repository", "phpCVSView CVS Repository"); if ($CVSServer->ConnectTcpAndLogon()) { --- 49,57 ---- list($b_dec, $b_sec) = explode(" ", $b); return $b_sec - $a_sec + $b_dec - $a_dec; ! } // End of function microtime_diff($a, $b) ! function DisplayDirListing() { global $REPOS, $CVSROOT, $PServer, $UserName, $Password, $ScriptName; $CVSServer = new phpcvs($CVSROOT, $PServer, $UserName, $Password); echo GetPageHeader("phpCVSView CVS Repository", "phpCVSView CVS Repository"); if ($CVSServer->ConnectTcpAndLogon()) { *************** *** 61,65 **** if (strcmp($BGColor, "#FFFFFF") == 0) { $BGColor = "#CCCCFF"; ! } else { $BGColor = "#FFFFFF"; } // End of if (strcmp($BGColor, "#FFFFFF") == 0) --- 81,85 ---- if (strcmp($BGColor, "#FFFFFF") == 0) { $BGColor = "#CCCCFF"; ! } else { // Else of if (strcmp($BGColor, "#FFFFFF") == 0) $BGColor = "#FFFFFF"; } // End of if (strcmp($BGColor, "#FFFFFF") == 0) *************** *** 79,83 **** if (strcmp($BGColor, "#FFFFFF") == 0) { $BGColor = "#CCCCFF"; ! } else { $BGColor = "#FFFFFF"; } // End of if (strcmp($BGColor, "#FFFFFF") == 0) --- 99,103 ---- if (strcmp($BGColor, "#FFFFFF") == 0) { $BGColor = "#CCCCFF"; ! } else { // End of if (strcmp($BGColor, "#FFFFFF") == 0) $BGColor = "#FFFFFF"; } // End of if (strcmp($BGColor, "#FFFFFF") == 0) *************** *** 87,91 **** echo "<HR>"; $CVSServer->DisconnectTcp(); ! } else { echo "Connection Failed."; } // End of if ($CVSServer->ConnectTcpAndLogon()) --- 107,111 ---- echo "<HR>"; $CVSServer->DisconnectTcp(); ! } else { // Else of if ($CVSServer->ConnectTcpAndLogon()) echo "Connection Failed."; } // End of if ($CVSServer->ConnectTcpAndLogon()) *************** *** 95,101 **** function DisplayFileHistory($FileName) { global $REPOS, $CVSROOT, $PServer, $UserName, $Password, $ScriptName; - $CVSServer = new phpcvs($CVSROOT, $PServer, $UserName, $Password); - echo GetPageHeader("phpCVSView CVS Repository", "phpCVSView CVS Repository"); if ($CVSServer->ConnectTcpAndLogon()) { --- 115,119 ---- *************** *** 104,111 **** $CVSServer->SendValidRequests(); $Elements = $CVSServer->RLOGFile($FileName, $REPOS); - echo "<H3>Revision History for '".$REPOS.$_GET["ShowHist"]."'</H3>"; - - // List each revision with a HorizRule between them. for ($i = 1; $i <= $Elements[0]["TotalRevisions"]; $i++) { echo "<HR>\n"; --- 122,126 ---- *************** *** 113,122 **** echo "[<A HREF=\"$ScriptName?CVSROOT=$REPOS&ShowFile=".$FileName."&Rev=".$Elements[$i]["Revision"]."\">View"; echo "</a>] "; - echo "[<A HREF=\"$ScriptName?CVSROOT=$REPOS&DownloadFile=".$FileName."&Rev=".$Elements[$i]["Revision"]."\">Download"; echo "</a>]"; - echo "<BR>\n"; - echo "Branch: Yet to identify.<BR>\n"; echo "Date: ".$Elements[$i]["Date"]."<BR>\n"; --- 128,134 ---- *************** *** 124,139 **** echo "Author: ".$Elements[$i]["Author"]."<BR>\n"; echo "State: ".$Elements[$i]["State"]."<BR>\n"; - if (($i + 1) < $Elements[0]["TotalRevisions"]) { echo "Changes since ".$Elements[$i+1]["Revision"].": "; echo "+".$Elements[$i]["LinesAdd"]." -".$Elements[$i]["LinesSub"]."<br>\n"; ! } echo "<pre>".str_replace("\n", "<BR>", $Elements[$i]["Log"])."</pre>"; ! } echo "<HR>\n"; - - $CVSServer->DisconnectTcp(); ! } else { echo "ERROR: Unable to connect to the CVS PServer.<BR>"; } // End of if ($CVSServer->ConnectTcpAndLogon()) --- 136,148 ---- echo "Author: ".$Elements[$i]["Author"]."<BR>\n"; echo "State: ".$Elements[$i]["State"]."<BR>\n"; if (($i + 1) < $Elements[0]["TotalRevisions"]) { echo "Changes since ".$Elements[$i+1]["Revision"].": "; echo "+".$Elements[$i]["LinesAdd"]." -".$Elements[$i]["LinesSub"]."<br>\n"; ! } // End of if (($i + 1) < $Elements[0]["TotalRevisions"]) echo "<pre>".str_replace("\n", "<BR>", $Elements[$i]["Log"])."</pre>"; ! } // End of for ($i = 1; $i <= $Elements[0]["TotalRevisions"]; $i++) echo "<HR>\n"; $CVSServer->DisconnectTcp(); ! } else { // Else of if ($CVSServer->ConnectTcpAndLogon()) echo "ERROR: Unable to connect to the CVS PServer.<BR>"; } // End of if ($CVSServer->ConnectTcpAndLogon()) *************** *** 143,149 **** function DisplayFile() { global $REPOS, $CVSROOT, $PServer, $UserName, $Password, $FileToView, $FileRev; - $CVSServer = new phpcvs($CVSROOT, $PServer, $UserName, $Password); - echo GetPageHeader("phpCVSView CVS Repository", "phpCVSView CVS Repository"); if ($CVSServer->ConnectTcpAndLogon()) { --- 152,156 ---- *************** *** 153,158 **** echo "<H3>File Contents for Revision ".$FileRev." of '".$REPOS.$FileToView."'</H3>"; $Elements = $CVSServer->ViewFile($FileToView, $FileRev, $REPOS); - - // Format and Display the output. if (strpos($FileToView, ".php")) { $OutText = highlight_string($Elements["CONTENT"], true); --- 160,163 ---- *************** *** 160,178 **** $OutText = str_replace("</code>", "</pre>", $OutText); echo $OutText; ! } else { $Find = array("\r", "\n", " ", "\t"); $Repl = array("", "<BR>", " ", " "); echo "<pre>".str_replace($Find, $Repl, $Elements["CONTENT"])."</pre>"; ! } $CVSServer->DisconnectTcp(); ! } echo GetPageFooter(); ! } function DownloadFile() { global $REPOS, $CVSROOT, $PServer, $UserName, $Password, $FileToDownload, $FileRev, $MIME_TYPE; - $CVSServer = new phpcvs($CVSROOT, $PServer, $UserName, $Password); - if ($CVSServer->ConnectTcpAndLogon()) { $CVSServer->SendRoot(); --- 165,181 ---- $OutText = str_replace("</code>", "</pre>", $OutText); echo $OutText; ! } else { // Else of if (strpos($FileToView, ".php")) $Find = array("\r", "\n", " ", "\t"); $Repl = array("", "<BR>", " ", " "); echo "<pre>".str_replace($Find, $Repl, $Elements["CONTENT"])."</pre>"; ! } // End of if (strpos($FileToView, ".php")) $CVSServer->DisconnectTcp(); ! } // End of if ($CVSServer->ConnectTcpAndLogon()) echo GetPageFooter(); ! } // End of function DisplayFile() function DownloadFile() { global $REPOS, $CVSROOT, $PServer, $UserName, $Password, $FileToDownload, $FileRev, $MIME_TYPE; $CVSServer = new phpcvs($CVSROOT, $PServer, $UserName, $Password); if ($CVSServer->ConnectTcpAndLogon()) { $CVSServer->SendRoot(); *************** *** 180,228 **** $CVSServer->SendValidRequests(); $Elements = $CVSServer->ViewFile($FileToDownload, $FileRev, $REPOS); - - // Send the file to the client. - // $Elements["CONTENT"]; $PeriodPos = strrchr($FileToDownload, "."); $FileExt = substr($FileToDownload, $PeriodPos, strlen($FileToDownload)-$PeriodPos); if (isset($MIME_TYPE["$FileExt"])) { $ContentType = $MIME_TYPE["$FileExt"]; ! } else { $ContentType = "text/plain"; ! } header("content-type: ".$ContentType); echo $Elements["CONTENT"]; - $CVSServer->DisconnectTcp(); ! } ! } if (isset($_GET["CVSROOT"])) { $REPOS = $_GET["CVSROOT"]; ! } else { $REPOS = "/"; ! } ! $REPOS = str_replace("//", "/", $REPOS); - if (isset($_GET["ShowFile"])) { - // Here we will show the contents of a file. $FileToView = $_GET["ShowFile"]; $FileRev = $_GET["Rev"]; DisplayFile(); ! } else { if (isset($_GET["ShowHist"])) { - // Here we will show the Revision History of a given file. DisplayFileHistory($_GET["ShowHist"]); ! } else { if (isset($_GET["DownloadFile"])) { $FileToDownload = $_GET["DownloadFile"]; $FileRev = $_GET["Rev"]; DownloadFile(); ! } else { // Here we will just show the current file listing. DisplayDirListing(); ! } ! } ! } --- 183,223 ---- $CVSServer->SendValidRequests(); $Elements = $CVSServer->ViewFile($FileToDownload, $FileRev, $REPOS); $PeriodPos = strrchr($FileToDownload, "."); $FileExt = substr($FileToDownload, $PeriodPos, strlen($FileToDownload)-$PeriodPos); if (isset($MIME_TYPE["$FileExt"])) { $ContentType = $MIME_TYPE["$FileExt"]; ! } else { // Else of if (isset($MIME_TYPE["$FileExt"])) $ContentType = "text/plain"; ! } // End of if (isset($MIME_TYPE["$FileExt"])) header("content-type: ".$ContentType); echo $Elements["CONTENT"]; $CVSServer->DisconnectTcp(); ! } // End of if ($CVSServer->ConnectTcpAndLogon()) ! } // End of function DownloadFile() if (isset($_GET["CVSROOT"])) { $REPOS = $_GET["CVSROOT"]; ! } else { // Else of if (isset($_GET["CVSROOT"])) $REPOS = "/"; ! } // End of if (isset($_GET["CVSROOT"])) $REPOS = str_replace("//", "/", $REPOS); if (isset($_GET["ShowFile"])) { $FileToView = $_GET["ShowFile"]; $FileRev = $_GET["Rev"]; DisplayFile(); ! } else { // Else of if (isset($_GET["ShowFile"])) if (isset($_GET["ShowHist"])) { DisplayFileHistory($_GET["ShowHist"]); ! } else { // Else of if (isset($_GET["ShowHist"])) if (isset($_GET["DownloadFile"])) { $FileToDownload = $_GET["DownloadFile"]; $FileRev = $_GET["Rev"]; DownloadFile(); ! } else { // Else of if (isset($_GET["DownloadFile"])) // Here we will just show the current file listing. DisplayDirListing(); ! } // End of if (isset($_GET["DownloadFile"])) ! } // End of if (isset($_GET["ShowHist"])) ! } // End of if (isset($_GET["ShowFile"])) Index: footer.php =================================================================== RCS file: /cvsroot/phpcvsview/phpcvsview/footer.php,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** footer.php 6 Apr 2003 08:06:14 -0000 1.1 --- footer.php 7 Apr 2003 08:23:56 -0000 1.2 *************** *** 2,5 **** --- 2,8 ---- /** + * This source code is distributed under the terms as layed out in the + * GNU General Public License. + * * Purpose: To provide the HTML page footer code * *************** *** 10,21 **** function GetPageFooter() { - // Here we will generate the HTML page footer. global $StartTime; $EndTime = microtime(); $PageFoot = "This page was created in ".number_format(microtime_diff($StartTime, $EndTime), 3)." seconds."; $PageFoot .= "</BODY></HTML>"; - return $PageFoot; ! } ?> --- 13,22 ---- function GetPageFooter() { global $StartTime; $EndTime = microtime(); $PageFoot = "This page was created in ".number_format(microtime_diff($StartTime, $EndTime), 3)." seconds."; $PageFoot .= "</BODY></HTML>"; return $PageFoot; ! } // End of function GetPageFooter() ?> Index: header.php =================================================================== RCS file: /cvsroot/phpcvsview/phpcvsview/header.php,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** header.php 6 Apr 2003 08:06:16 -0000 1.1 --- header.php 7 Apr 2003 08:23:58 -0000 1.2 *************** *** 2,5 **** --- 2,8 ---- /** + * This source code is distributed under the terms as layed out in the + * GNU General Public License. + * * Purpose: To provide the HTML page header code * *************** *** 12,24 **** global $StartTime; $StartTime = microtime(); - // Here we will generate the HTML page header. $PageHead = "<HTML>"; ! if (isset($Title)) { $PageHead .= "<HEAD><TITLE>$Title</TITLE></HEAD>"; ! } $PageHead .= "<BODY>"; ! if (isset($Heading)) { $PageHead .= "<DIV ALIGN=\"center\"><H1>$Heading</H1></DIV>"; ! } $PageHead .= "Welcome to our CVS Repository viewer. This page has been dynamically"; $PageHead .= " created with '<a href=\"http://phpcvsview.sourceforge.net/\">phpCVS"; --- 15,26 ---- global $StartTime; $StartTime = microtime(); $PageHead = "<HTML>"; ! if ($Title != "") { $PageHead .= "<HEAD><TITLE>$Title</TITLE></HEAD>"; ! } // End of if ($Title != "") $PageHead .= "<BODY>"; ! if ($Heading != "") { $PageHead .= "<DIV ALIGN=\"center\"><H1>$Heading</H1></DIV>"; ! } // End of if ($Header != "") $PageHead .= "Welcome to our CVS Repository viewer. This page has been dynamically"; $PageHead .= " created with '<a href=\"http://phpcvsview.sourceforge.net/\">phpCVS"; *************** *** 26,32 **** $PageHead .= "ers.sourceforge.net\">Brian Cheeseman</a>. <BR><BR>Please feel free"; $PageHead .= " to browse our source code.<BR><BR>"; - return $PageHead; ! } ?> --- 28,33 ---- $PageHead .= "ers.sourceforge.net\">Brian Cheeseman</a>. <BR><BR>Please feel free"; $PageHead .= " to browse our source code.<BR><BR>"; return $PageHead; ! } // End of function GetPageHeader($Title="", $Heading="") ?> Index: phpcvs.php =================================================================== RCS file: /cvsroot/phpcvsview/phpcvsview/phpcvs.php,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** phpcvs.php 6 Apr 2003 06:46:51 -0000 1.4 --- phpcvs.php 7 Apr 2003 08:23:59 -0000 1.5 *************** *** 2,20 **** /** * Purpose: To provide the main class required to access a CVS repository * * @author Brian A Cheeseman <br...@bc...> * @version $Id$ ! * @copyright 2002 ARECOM International **/ class phpcvs { ! var $CVS_REPOSITORY; ! var $CVS_USERNAME; ! var $CVS_PASSWORD; ! var $CVS_PSERVER; ! var $CVS_VALID_REQUESTS; ! var $SOCKET_HANDLE; /** --- 2,23 ---- /** + * This source code is distributed under the terms as layed out in the + * GNU General Public License. + * * Purpose: To provide the main class required to access a CVS repository * * @author Brian A Cheeseman <br...@bc...> * @version $Id$ ! * @copyright 2003 Brian A Cheeseman **/ class phpcvs { ! var $CVS_REPOSITORY; // Storage of the CVS Repository file system path. ! var $CVS_USERNAME; // Username to use when authenticating with the PServer. ! var $CVS_PASSWORD; // Password for the account above. ! var $CVS_PSERVER; // Hostname of the server running the PServer. ! var $CVS_VALID_REQUESTS; // List of valid requests the PServer accepts. ! var $SOCKET_HANDLE; // The socket handle for communicating with the PServer. /** *************** *** 34,38 **** $this->CVS_PASSWORD = $Password; $this->SOCKET_HANDLE = -1; - $this->SHOW_CVSROOT = true; } --- 37,40 ---- *************** *** 42,46 **** * **/ ! function get_Repository() { return $this->CVS_REPOSITORY; --- 44,48 ---- * **/ ! function get_Repository() { return $this->CVS_REPOSITORY; *************** *** 120,173 **** function ConnectTcpAndLogon() { - // Report All Errors back to this script. error_reporting(E_ALL); - - // Get the TCP Port. - $CVSPort = getservbyname('cvs', 'tcp'); - - // Create the Socket to communicate through. $this->SOCKET_HANDLE = fsockopen($this->CVS_PSERVER, 2401); - - // Check and see if we have a socket. if ($this->SOCKET_HANDLE < 0) { return false; ! } ! ! // Could we connect. if ($this->SOCKET_HANDLE < 1) { return false; ! } ! ! // Cool, we have a valid connection to the PServer, so we can now ! // authenticate with the server. ! ! // Encrypt the password. $CPassword = "A".$this->EncodePW($this->CVS_PASSWORD); - - // Build the string to send to the PServer. $Request = "BEGIN AUTH REQUEST\n".$this->CVS_REPOSITORY."\n"; $Request .= $this->CVS_USERNAME."\n".$CPassword."\n"; $Request .= "END AUTH REQUEST\n"; - - // Send this command to the backend PServer. fputs($this->SOCKET_HANDLE, $Request); fflush($this->SOCKET_HANDLE); - - // Read the response to see if our credentials were OK. $Response = fgets($this->SOCKET_HANDLE, 11); - - // Generate the return value. if (strcmp($Response, "I LOVE YOU") == 0) { return true; ! } else { return false; ! } ! } function DisconnectTcp() { - // Close off the socket to the PServer. fclose($this->SOCKET_HANDLE); $this->SOCKET_HANDLE = -1; ! } function SendRoot() { --- 122,151 ---- function ConnectTcpAndLogon() { error_reporting(E_ALL); $this->SOCKET_HANDLE = fsockopen($this->CVS_PSERVER, 2401); if ($this->SOCKET_HANDLE < 0) { return false; ! } // End of if ($this->SOCKET_HANDLE < 0) if ($this->SOCKET_HANDLE < 1) { return false; ! } // End of if ($this->SOCKET_HANDLE < 1) $CPassword = "A".$this->EncodePW($this->CVS_PASSWORD); $Request = "BEGIN AUTH REQUEST\n".$this->CVS_REPOSITORY."\n"; $Request .= $this->CVS_USERNAME."\n".$CPassword."\n"; $Request .= "END AUTH REQUEST\n"; fputs($this->SOCKET_HANDLE, $Request); fflush($this->SOCKET_HANDLE); $Response = fgets($this->SOCKET_HANDLE, 11); if (strcmp($Response, "I LOVE YOU") == 0) { return true; ! } else { // Else of if (strcmp($Response, "I LOVE YOU") == 0) return false; ! } // End of if (strcmp($Response, "I LOVE YOU") == 0) ! } // End of function ConnectTcpAndLogon() { function DisconnectTcp() { fclose($this->SOCKET_HANDLE); $this->SOCKET_HANDLE = -1; ! } // End of function DisconnectTcp() function SendRoot() { *************** *** 176,186 **** fputs($this->SOCKET_HANDLE, $SendCMD); return true; ! } return false; ! } function SendValidResponses() { if ($this->SOCKET_HANDLE > 0) { - // Build the String to send out the socket. $SendCMD = "Valid-responses ok error Valid-requests Checked-in New-entry"; $SendCMD .= " Checksum Copy-file Updated Created Update-existing Merged"; --- 154,163 ---- fputs($this->SOCKET_HANDLE, $SendCMD); return true; ! } // End of if ($this->SOCKET_HANDLE > 0) return false; ! } // End of function SendRoot() function SendValidResponses() { if ($this->SOCKET_HANDLE > 0) { $SendCMD = "Valid-responses ok error Valid-requests Checked-in New-entry"; $SendCMD .= " Checksum Copy-file Updated Created Update-existing Merged"; *************** *** 189,223 **** $SendCMD .= " Clear-sticky Template Set-checkin-prog Set-update-prog"; $SendCMD .= " Notified Module-expansion Wrapper-rcsOption M Mbinary E F MT\n"; - - // Send the command to the backend PServer. fputs($this->SOCKET_HANDLE, $SendCMD); - - // return success. return true; ! } return false; ! } function SendValidRequests() { if ($this->SOCKET_HANDLE > 0) { - // Build the String to send out the socket. $SendCMD = "valid-requests\n"; - - // Send the Command to the backend PServer. fputs($this->SOCKET_HANDLE, $SendCMD); - - // OK, Now wait for the response from the server. $RecvCMD = fgets($this->SOCKET_HANDLE, 8192); - - // Clear off the OK message from the buffer. $dummy = fgets($this->SOCKET_HANDLE); - - // Lets transfer the allowable messages into our message above. - // Although at this stage I will skip this and add it in later. - return true; ! } return false; ! } function RLOGDir($Module = "/") { --- 166,185 ---- $SendCMD .= " Clear-sticky Template Set-checkin-prog Set-update-prog"; $SendCMD .= " Notified Module-expansion Wrapper-rcsOption M Mbinary E F MT\n"; fputs($this->SOCKET_HANDLE, $SendCMD); return true; ! } // End of if ($this->SOCKET_HANDLE > 0) return false; ! } // End of function SendValidResponses() function SendValidRequests() { if ($this->SOCKET_HANDLE > 0) { $SendCMD = "valid-requests\n"; fputs($this->SOCKET_HANDLE, $SendCMD); $RecvCMD = fgets($this->SOCKET_HANDLE, 8192); $dummy = fgets($this->SOCKET_HANDLE); return true; ! } // End of if ($this->SOCKET_HANDLE > 0) return false; ! } // End of function SendValidRequests() function RLOGDir($Module = "/") { *************** *** 226,246 **** if ($this->SOCKET_HANDLE > -1) { $SendCMD = "UseUnchanged\nCase\nArgument $Module\nrlog\n"; - - // Send this command to the PServer. fputs($this->SOCKET_HANDLE, $SendCMD); - - // Lets start receiving the response from the PServer. $RecvLN = ""; while(strncmp($RecvLN, "ok", 2) != 0){ $RecvLN = fgets($this->SOCKET_HANDLE); - - // Determine if it is local dir or a subdir. if (strncmp($RecvLN, "M \n", 3) == 0) { $FileName = fgets($this->SOCKET_HANDLE, 12+strlen($this->CVS_REPOSITORY.$Module)); if (strncmp($FileName, "M RCS file", 10) == 0) { $FileName = fgets($this->SOCKET_HANDLE, 8192); - if (strpos($FileName, '/') > 0) { - // This is a Directory, and not a file. $DirName = substr($FileName, 0, strpos($FileName, '/')+1); if (strpos($SeenThis, $DirName) === false) { --- 188,200 ---- *************** *** 248,253 **** $SeenThis .= $DirName; } // End of if (strpos($SeenThis, $DirName) === false) ! } else { ! // This is a file. $FileName2 = substr($FileName, 0, strlen($FileName)-3); $Elements[$FileName2]["FILENAME"] = $FileName2; --- 202,206 ---- $SeenThis .= $DirName; } // End of if (strpos($SeenThis, $DirName) === false) ! } else { // Else of if (strpos($FileName, '/') > 0) $FileName2 = substr($FileName, 0, strlen($FileName)-3); $Elements[$FileName2]["FILENAME"] = $FileName2; *************** *** 255,267 **** $RecvLN = fgets($this->SOCKET_HANDLE, 8192); if (strncmp($RecvLN, "M head:", 7) == 0) { - // This contains the HEAD revision. $Elements[$FileName2]["HEAD"] = substr($RecvLN, 8, strlen($RecvLN)-9); } // End of if (strncmp($RecvLN, "M head:", 7) == 0) if (strncmp($RecvLN, "M branch:", 9) == 0) { - // This contains the Branch revision. $Elements[$FileName2]["BRANCH"] = substr($RecvLN, 10, strlen($RecvLN)-10); } // End of if (strncmp($RecvLN, "M branch:", 9) == 0) if (strncmp($RecvLN, "M -----", 7) == 0) { - // This subsection contains the description and other revision based information. while(strncmp($RecvLN, "M revision ", 11) != 0) { $RecvLN = fgets($this->SOCKET_HANDLE, 8192); --- 208,217 ---- *************** *** 300,308 **** if ($this->SOCKET_HANDLE > -1) { $SendCMD = "UseUnchanged\nCase\nArgument ".$Module.$File."\nrlog\n"; - - // Send this command to the PServer. fputs($this->SOCKET_HANDLE, $SendCMD); - - // Lets start receiving the response from the PServer. $RecvLN = ""; $CurrentRevision = ""; --- 250,254 ---- *************** *** 310,322 **** $Elements["CODE"] = ""; while(strncmp($RecvLN, "ok", 2) != 0){ - // if we have a line beginning with 'M revision' then this is a new revision. if (strncmp("M revision", $RecvLN, 10) == 0) { - // New Revision details. $RevisionCounter = $RevisionCounter + 1; $CurrentRevision = substr($RecvLN, 11, strlen($RecvLN)-11); $Elements[$RevisionCounter]["Revision"] = $CurrentRevision; $RecvLN = fgets($this->SOCKET_HANDLE); - - // This line contains the Date, Author, State, and Line Counts. strtok($RecvLN, " :;\n\t"); strtok(" :;\t\n"); --- 256,264 ---- *************** *** 330,397 **** $Elements[$RevisionCounter]["LinesAdd"] = substr(strtok(" :;\n\t"), 1); $Elements[$RevisionCounter]["LinesSub"] = substr(strtok(" :;\n\t"), 1); - - // The following lines up until we get minuses or equals is the revision log. $RecvLN = fgets($this->SOCKET_HANDLE); $Elements[$RevisionCounter]["Log"] = ""; while((strncmp("M ----------------------------", $RecvLN, 30) != 0) && (strncmp("M ============================", $RecvLN, 30) != 0)){ - // Add the text to the log. $Elements[$RevisionCounter]["Log"] .= substr($RecvLN, 2); $RecvLN = fgets($this->SOCKET_HANDLE); ! } // while ! } ! ! // if we have a line beginning with 'M RCS file' then we have the full file system path of the file. if (strncmp("M RCS file", $RecvLN, 10) == 0) { - // Pull out the Full RCS filename. strtok($RecvLN, " :\t\n"); strtok(" :\t\n"); strtok(" :\t\n"); $Elements[0]["RCSFile"] = strtok(" :\t\n"); ! } ! ! // if we have a line beginning with 'M head' then we have the head revision number for this file. if (strncmp("M head", $RecvLN, 6) == 0) { - // Pull out the head revision. strtok($RecvLN, " :\t\n"); strtok(" :\t\n"); $Elements[0]["HeadRev"] = strtok(" :\t\n"); ! } ! ! // if we have a line beginning with 'M branch' then we have the name of the head branch. if (strncmp("M branch", $RecvLN, 8) == 0) { - // Pull out the head branch. strtok($RecvLN, " :\t\n"); strtok(" :\t\n"); $Elements[0]["HeadBranch"] = strtok(" :\t\n"); ! } ! ! // if we have a line beginning with 'M locks' then we have the locking scheme in use by this CVS server. if (strncmp("M locks", $RecvLN, 7) == 0) { - // Pull out the locking methodology. strtok($RecvLN, " :\t\n"); strtok(" :\t\n"); $Elements[0]["Locks"] = strtok(" :\t\n"); ! } ! ! // if we have a line beginning with 'M access list' then we have the current accessing list. if (strncmp("M access list", $RecvLN, 13) == 0) { - // Pull out the accessing list. strtok($RecvLN, " :\t\n"); strtok(" :\t\n"); strtok(" :\t\n"); $Elements[0]["AccessList"] = strtok(" :\t\n"); ! } ! ! // if we have a line beginning with 'M symbolic names' then we have the list of symbolic names for this file. if (strncmp("M symbolic names", $RecvLN, 16) == 0) { - // Pull out the symbolic names. strtok($RecvLN, " :\t\n"); strtok(" :\t\n"); strtok(" :\t\n"); $Elements[0]["SymNames"] = strtok(" :\t\n"); ! } ! ! // if we have a line beginning with 'M keyword substitution' then we have the keywork substitutions. if (strncmp("M keywork substitutions", $RecvLN, 23) == 0) { strtok($RecvLN, " :\t\n"); --- 272,320 ---- $Elements[$RevisionCounter]["LinesAdd"] = substr(strtok(" :;\n\t"), 1); $Elements[$RevisionCounter]["LinesSub"] = substr(strtok(" :;\n\t"), 1); $RecvLN = fgets($this->SOCKET_HANDLE); + while (strncmp("M branches", $RecvLN, 10) == 0) { + $Elements[$RevisionCounter]["Branches"] = substr($RecvLN, 11, strlen($RecvLN)-11); + $RecvLN = fgets($this->SOCKET_HANDLE); + } // End of while (strncmp("M branches", $RecvLN, 10) == 0) $Elements[$RevisionCounter]["Log"] = ""; while((strncmp("M ----------------------------", $RecvLN, 30) != 0) && (strncmp("M ============================", $RecvLN, 30) != 0)){ $Elements[$RevisionCounter]["Log"] .= substr($RecvLN, 2); $RecvLN = fgets($this->SOCKET_HANDLE); ! } // End of while looking for end of section (revision) ! } // End of if (strncmp("M revision", $RecvLN, 10) == 0) if (strncmp("M RCS file", $RecvLN, 10) == 0) { strtok($RecvLN, " :\t\n"); strtok(" :\t\n"); strtok(" :\t\n"); $Elements[0]["RCSFile"] = strtok(" :\t\n"); ! } // End of if (strncmp("M RCS file", $RecvLN, 10) == 0) if (strncmp("M head", $RecvLN, 6) == 0) { strtok($RecvLN, " :\t\n"); strtok(" :\t\n"); $Elements[0]["HeadRev"] = strtok(" :\t\n"); ! } // End of if (strncmp("M head", $RecvLN, 6) == 0) if (strncmp("M branch", $RecvLN, 8) == 0) { strtok($RecvLN, " :\t\n"); strtok(" :\t\n"); $Elements[0]["HeadBranch"] = strtok(" :\t\n"); ! } // End of if (strncmp("M branch", $RecvLN, 8) == 0) if (strncmp("M locks", $RecvLN, 7) == 0) { strtok($RecvLN, " :\t\n"); strtok(" :\t\n"); $Elements[0]["Locks"] = strtok(" :\t\n"); ! } // End of if (strncmp("M locks", $RecvLN, 7) == 0) if (strncmp("M access list", $RecvLN, 13) == 0) { strtok($RecvLN, " :\t\n"); strtok(" :\t\n"); strtok(" :\t\n"); $Elements[0]["AccessList"] = strtok(" :\t\n"); ! } // End of if (strncmp("M access list", $RecvLN, 13) == 0) if (strncmp("M symbolic names", $RecvLN, 16) == 0) { strtok($RecvLN, " :\t\n"); strtok(" :\t\n"); strtok(" :\t\n"); $Elements[0]["SymNames"] = strtok(" :\t\n"); ! } // End of if (strncmp("M symbolic names", $RecvLN, 16) == 0) if (strncmp("M keywork substitutions", $RecvLN, 23) == 0) { strtok($RecvLN, " :\t\n"); *************** *** 399,405 **** strtok(" :\t\n"); $Elements[0]["KeywrdSubst"] = strtok(" :\t\n"); ! } ! ! $Elements["CODE"] .= substr($RecvLN, 2, strlen($RecvLN)-2); $RecvLN = fgets($this->SOCKET_HANDLE); } // End of while(strncmp($RecvLN, "ok", 2) != 0) --- 322,326 ---- strtok(" :\t\n"); $Elements[0]["KeywrdSubst"] = strtok(" :\t\n"); ! } // End of if (strncmp("M keywork substitutions", $RecvLN, 23) == 0) $RecvLN = fgets($this->SOCKET_HANDLE); } // End of while(strncmp($RecvLN, "ok", 2) != 0) *************** *** 410,443 **** function ViewFile($File, $Revision, $Module="/") { - // Here we will export a copy of a given file, returning a series of "Strings". if (strncmp($Module, "/", 1) == 0) { $Module = substr($Module, 1, strlen($Module)-1); ! } ! $SendCMD = "UseUnchanged\nCase\nArgument ".$Module.$File."\nDirectory .\n".$this->CVS_REPOSITORY."\nexpand-modules\n"; fputs($this->SOCKET_HANDLE, $SendCMD); - $RecvLN = "ABCD"; while(strncmp($RecvLN, "ok", 2) != 0){ $RecvLN = fgets($this->SOCKET_HANDLE); } // End of while(strncmp($RecvLN, "ok", 2) != 0) - - // Send the checkout command. $SendCMD = "Argument -n\nArgument -l\nArgument -N\nArgument -P\nArgument -r\nArgument ".$Revision."\nArgument ".$Module.$File."\nDirectory .\n".$this->CVS_REPOSITORY."\nco\n"; fputs($this->SOCKET_HANDLE, $SendCMD); - - // Clear out the Return Elements, in preparation for returning the information. $Elements = ""; - $RecvLN = ""; while(strncmp($RecvLN, "ok", 2) != 0){ if (strncmp($RecvLN, "Clear-sticky ", 13) == 0) { $RecvLN = fgets($this->SOCKET_HANDLE, 8192); ! } if (strncmp($RecvLN, "Set-static-directory ", 21) == 0) { $RecvLN = fgets($this->SOCKET_HANDLE, 8192); ! } if (strncmp($RecvLN, "Mod-time", 8) == 0) { - // We had the Date and time this revision was modified. $Elements["DATETIME"] = substr($RecvLN, 9, strlen($RecvLN)-9); $RecvLN = fgets($this->SOCKET_HANDLE); --- 331,355 ---- function ViewFile($File, $Revision, $Module="/") { if (strncmp($Module, "/", 1) == 0) { $Module = substr($Module, 1, strlen($Module)-1); ! } // End of if (strncmp($Module, "/", 1) == 0) $SendCMD = "UseUnchanged\nCase\nArgument ".$Module.$File."\nDirectory .\n".$this->CVS_REPOSITORY."\nexpand-modules\n"; fputs($this->SOCKET_HANDLE, $SendCMD); $RecvLN = "ABCD"; while(strncmp($RecvLN, "ok", 2) != 0){ $RecvLN = fgets($this->SOCKET_HANDLE); } // End of while(strncmp($RecvLN, "ok", 2) != 0) $SendCMD = "Argument -n\nArgument -l\nArgument -N\nArgument -P\nArgument -r\nArgument ".$Revision."\nArgument ".$Module.$File."\nDirectory .\n".$this->CVS_REPOSITORY."\nco\n"; fputs($this->SOCKET_HANDLE, $SendCMD); $Elements = ""; $RecvLN = ""; while(strncmp($RecvLN, "ok", 2) != 0){ if (strncmp($RecvLN, "Clear-sticky ", 13) == 0) { $RecvLN = fgets($this->SOCKET_HANDLE, 8192); ! } // End of if (strncmp($RecvLN, "Clear-sticky ", 13) == 0) if (strncmp($RecvLN, "Set-static-directory ", 21) == 0) { $RecvLN = fgets($this->SOCKET_HANDLE, 8192); ! } // End of if (strncmp($RecvLN, "Set-static-directory ", 21) == 0) if (strncmp($RecvLN, "Mod-time", 8) == 0) { $Elements["DATETIME"] = substr($RecvLN, 9, strlen($RecvLN)-9); $RecvLN = fgets($this->SOCKET_HANDLE); *************** *** 446,473 **** if (strncmp($RecvLN, "MT -updated", 11) == 0) { $RecvLN = ""; ! } ! } // while ! } if (strncmp($RecvLN, "Created", 7) == 0) { - - // We are getting the file from the Server. $RecvLN = fgets($this->SOCKET_HANDLE); $RecvLN = fgets($this->SOCKET_HANDLE); $RecvLN = fgets($this->SOCKET_HANDLE); $RecvLN = fgets($this->SOCKET_HANDLE); - - // RecvLN Holds the length of the file as a string $TotalBytes = $RecvLN + 0; $Elements["CONTENT"] = fread($this->SOCKET_HANDLE, $TotalBytes); ! } $RecvLN = fgets($this->SOCKET_HANDLE); } // End of while(strncmp($RecvLN, "ok", 2) != 0) - return $Elements; ! } function CVSLogon() { - // Here we will login to the CVS PServer (or local filesystem if the - // CVSPSERVER variable is a blank string). if ($this->CVS_PSERVER == '') { // We are logging into a locally connected filesystem. --- 358,378 ---- if (strncmp($RecvLN, "MT -updated", 11) == 0) { $RecvLN = ""; ! } // End of if (strncmp($RecvLN, "MT -updated", 11) == 0) ! } // End of while(strncmp($RecvLN, "MT", 2) == 0) ! } // End of if (strncmp($RecvLN, "Mod-time", 8) == 0) if (strncmp($RecvLN, "Created", 7) == 0) { $RecvLN = fgets($this->SOCKET_HANDLE); $RecvLN = fgets($this->SOCKET_HANDLE); $RecvLN = fgets($this->SOCKET_HANDLE); $RecvLN = fgets($this->SOCKET_HANDLE); $TotalBytes = $RecvLN + 0; $Elements["CONTENT"] = fread($this->SOCKET_HANDLE, $TotalBytes); ! } // End of if (strncmp($RecvLN, "Created", 7) == 0) $RecvLN = fgets($this->SOCKET_HANDLE); } // End of while(strncmp($RecvLN, "ok", 2) != 0) return $Elements; ! } // End of function ViewFile($File, $Revision, $Module="/") function CVSLogon() { if ($this->CVS_PSERVER == '') { // We are logging into a locally connected filesystem. Index: phpcvsmime.php =================================================================== RCS file: /cvsroot/phpcvsview/phpcvsview/phpcvsmime.php,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** phpcvsmime.php 6 Apr 2003 06:50:06 -0000 1.2 --- phpcvsmime.php 7 Apr 2003 08:23:59 -0000 1.3 *************** *** 2,9 **** /** ! * * * @version $Id$ ! * @copyright 2002 ARECOM International **/ --- 2,13 ---- /** ! * This source code is distributed under the terms as layed out in the ! * GNU General Public License. ! * ! * Purpose: To provide the mime translations required for downloading * + * @author Brian A Cheeseman <br...@bc...> * @version $Id$ ! * @copyright 2003 Brian A Cheeseman **/ Index: test.php =================================================================== RCS file: /cvsroot/phpcvsview/phpcvsview/test.php,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** test.php 6 Apr 2003 06:46:51 -0000 1.4 --- test.php 7 Apr 2003 08:23:59 -0000 1.5 *************** *** 9,14 **** $REPOS = ""; ! $CVSROOT = "/cvsroot/d/de/denet/"; ! //$CVSROOT = "/cvsroot/p/ph/phpcvsview/"; $PServer = "cvs.sourceforge.net"; $UserName = "anonymous"; --- 9,14 ---- $REPOS = ""; ! //$CVSROOT = "/cvsroot/d/de/denet/"; ! $CVSROOT = "/cvsroot/p/ph/phpcvsview/"; $PServer = "cvs.sourceforge.net"; $UserName = "anonymous"; |
From: <bch...@us...> - 2003-04-06 08:06:22
|
Update of /cvsroot/phpcvsview/phpcvsview In directory sc8-pr-cvs1:/tmp/cvs-serv19487 Added Files: footer.php header.php cvsview.php Log Message: Added a "REAL" frontend to the CVS viewer class. --- NEW FILE: footer.php --- <?php /** * Purpose: To provide the HTML page footer code * * @author Brian A Cheeseman <br...@bc...> * @version $Id: footer.php,v 1.1 2003/04/06 08:06:14 bcheesem Exp $ * @copyright 2003 Brian A Cheeseman **/ function GetPageFooter() { // Here we will generate the HTML page footer. global $StartTime; $EndTime = microtime(); $PageFoot = "This page was created in ".number_format(microtime_diff($StartTime, $EndTime), 3)." seconds."; $PageFoot .= "</BODY></HTML>"; return $PageFoot; } ?> --- NEW FILE: header.php --- <?php /** * Purpose: To provide the HTML page header code * * @author Brian A Cheeseman <br...@bc...> * @version $Id: header.php,v 1.1 2003/04/06 08:06:16 bcheesem Exp $ * @copyright 2003 Brian A Cheeseman **/ function GetPageHeader($Title="", $Heading="") { global $StartTime; $StartTime = microtime(); // Here we will generate the HTML page header. $PageHead = "<HTML>"; if (isset($Title)) { $PageHead .= "<HEAD><TITLE>$Title</TITLE></HEAD>"; } $PageHead .= "<BODY>"; if (isset($Heading)) { $PageHead .= "<DIV ALIGN=\"center\"><H1>$Heading</H1></DIV>"; } $PageHead .= "Welcome to our CVS Repository viewer. This page has been dynamically"; $PageHead .= " created with '<a href=\"http://phpcvsview.sourceforge.net/\">phpCVS"; $PageHead .= "Viewer</a>' created by <a href=\"mailto:bcheesem@us"; $PageHead .= "ers.sourceforge.net\">Brian Cheeseman</a>. <BR><BR>Please feel free"; $PageHead .= " to browse our source code.<BR><BR>"; return $PageHead; } ?> --- NEW FILE: cvsview.php --- <?php /** * Purpose: To provide the main entry point in accessing a CVS repository * * @author Brian A Cheeseman <br...@bc...> * @version $Id: cvsview.php,v 1.1 2003/04/06 08:06:18 bcheesem Exp $ * @copyright 2003 Brian A Cheeseman **/ $REPOS = ""; $CVSROOT = "/cvsroot/d/de/denet/"; //$CVSROOT = "/cvsroot/p/ph/phpcvsview/"; $PServer = "cvs.sourceforge.net"; $UserName = "anonymous"; $Password = ""; $ScriptName = $_SERVER['PHP_SELF']; include("phpcvs.php"); include("phpcvsmime.php"); include("header.php"); include("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; } function DisplayDirListing () { global $REPOS, $CVSROOT, $PServer, $UserName, $Password, $ScriptName; $CVSServer = new phpcvs($CVSROOT, $PServer, $UserName, $Password); echo GetPageHeader("phpCVSView CVS Repository", "phpCVSView CVS Repository"); if ($CVSServer->ConnectTcpAndLogon()) { $CVSServer->SendRoot(); $CVSServer->SendValidResponses(); $CVSServer->SendValidRequests(); $Elements = $CVSServer->RLOGDir($REPOS); $FileOut = ""; echo "<HR>\n"; echo "<TABLE BORDER=\"0\" CELLPADDING=\"2\" CELLSPACING=\"1\" WIDTH=\"100%\">\n"; echo " <TR BGCOLOR=\"#CCFFCC\">\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 = "#FFFFFF"; if (strcmp($REPOS, "/") != 0) { echo " <TR BGCOLOR=\"$BGColor\" COLSPAN=\"5\">\n <TD><A HREF=\"$ScriptName?CVSROOT="; $UpDirPath = substr($REPOS, 0, strlen($REPOS)-1); echo strrev(strchr(strrev($UpDirPath), "/")); echo "\"><IMG SRC=\"/icons/back.gif\" border=\"0\"> Parent Directory</A> </TD>\n"; $BGColor="#CCCCFF"; } // End of if (strcmp($REPOS, "/") != 0) while(list($key, $val) = each($Elements)){ if ($val == "DIR") { echo " <TR BGCOLOR=\"$BGColor\">\n"; echo " <TD><A HREF=\"$ScriptName?CVSROOT=$REPOS".substr($key, 0, strlen($key))."\">"; echo "<IMG SRC=\"/icons/dir.gif\" WIDTH=\"20\" HEIGHT=\"22\" border=\"0\"> ".$key."</A></TD>\n"; echo " <TD> </TD>\n <TD> </TD>\n <TD> </TD>\n <TD> </TD>\n"; echo " </TR>\n"; if (strcmp($BGColor, "#FFFFFF") == 0) { $BGColor = "#CCCCFF"; } else { $BGColor = "#FFFFFF"; } // End of if (strcmp($BGColor, "#FFFFFF") == 0) } // End of if ($val == "DIR") } // End of while(list($key, $val) = each($Elements)) reset($Elements); while(list($key, $val) = each($Elements)){ if ($val != "DIR") { $FileOut .= " <TR BGCOLOR=\"$BGColor\">\n"; $FileOut .= " <TD><A HREF=\"$ScriptName?CVSROOT=$REPOS&ShowHist=".$val["FILENAME"]."\">"; $FileOut .= "<IMG SRC=\"/icons/text.gif\" WIDTH=\"20\" HEIGHT=\"22\" border=\"0\"> ".$val["FILENAME"]."</A> </TD>\n"; $FileOut .= " <TD> <A HREF=\"$ScriptName?CVSROOT=$REPOS&ShowFile=".$val["FILENAME"]."&Rev=".$val["HEAD"]."\">".$val["HEAD"]."</A> </TD>\n"; $FileOut .= " <TD> ".str_replace(" ", " ", strftime("%d %b %Y %H:%M:%S", $val["DATE"]))." </TD>\n"; $FileOut .= " <TD> ".$val["AUTHOR"]." </TD>\n"; $FileOut .= " <TD>".str_replace("\n", "<BR>", substr($val["LOG"], 0, strlen($val["LOG"])-1))."</TD>\n"; $FileOut .= " </TR>\n"; if (strcmp($BGColor, "#FFFFFF") == 0) { $BGColor = "#CCCCFF"; } else { $BGColor = "#FFFFFF"; } // End of if (strcmp($BGColor, "#FFFFFF") == 0) } // End of if ($val != "DIR" } // End of while(list($key, $val) = each($Elements)) echo $FileOut." </TABLE>\n"; echo "<HR>"; $CVSServer->DisconnectTcp(); } else { echo "Connection Failed."; } // End of if ($CVSServer->ConnectTcpAndLogon()) echo GetPageFooter(); } // End of function DisplayDirListing() function DisplayFileHistory($FileName) { global $REPOS, $CVSROOT, $PServer, $UserName, $Password, $ScriptName; $CVSServer = new phpcvs($CVSROOT, $PServer, $UserName, $Password); echo GetPageHeader("phpCVSView CVS Repository", "phpCVSView CVS Repository"); if ($CVSServer->ConnectTcpAndLogon()) { $CVSServer->SendRoot(); $CVSServer->SendValidResponses(); $CVSServer->SendValidRequests(); $Elements = $CVSServer->RLOGFile($FileName, $REPOS); echo "<H3>Revision History for '".$REPOS.$_GET["ShowHist"]."'</H3>"; // List each revision with a HorizRule between them. for ($i = 1; $i <= $Elements[0]["TotalRevisions"]; $i++) { echo "<HR>\n"; echo "Revision: ".$Elements[$i]["Revision"]." "; echo "[<A HREF=\"$ScriptName?CVSROOT=$REPOS&ShowFile=".$FileName."&Rev=".$Elements[$i]["Revision"]."\">View"; echo "</a>] "; echo "[<A HREF=\"$ScriptName?CVSROOT=$REPOS&DownloadFile=".$FileName."&Rev=".$Elements[$i]["Revision"]."\">Download"; echo "</a>]"; echo "<BR>\n"; echo "Branch: Yet to identify.<BR>\n"; echo "Date: ".$Elements[$i]["Date"]."<BR>\n"; echo "Time: ".$Elements[$i]["Time"]."<BR>\n"; echo "Author: ".$Elements[$i]["Author"]."<BR>\n"; echo "State: ".$Elements[$i]["State"]."<BR>\n"; if (($i + 1) < $Elements[0]["TotalRevisions"]) { echo "Changes since ".$Elements[$i+1]["Revision"].": "; echo "+".$Elements[$i]["LinesAdd"]." -".$Elements[$i]["LinesSub"]."<br>\n"; } echo "<pre>".str_replace("\n", "<BR>", $Elements[$i]["Log"])."</pre>"; } echo "<HR>\n"; $CVSServer->DisconnectTcp(); } else { echo "ERROR: Unable to connect to the CVS PServer.<BR>"; } // End of if ($CVSServer->ConnectTcpAndLogon()) echo GetPageFooter(); } // End of function DisplayFileHistory() function DisplayFile() { global $REPOS, $CVSROOT, $PServer, $UserName, $Password, $FileToView, $FileRev; $CVSServer = new phpcvs($CVSROOT, $PServer, $UserName, $Password); echo GetPageHeader("phpCVSView CVS Repository", "phpCVSView CVS Repository"); if ($CVSServer->ConnectTcpAndLogon()) { $CVSServer->SendRoot(); $CVSServer->SendValidResponses(); $CVSServer->SendValidRequests(); echo "<H3>File Contents for Revision ".$FileRev." of '".$REPOS.$FileToView."'</H3>"; $Elements = $CVSServer->ViewFile($FileToView, $FileRev, $REPOS); // Format and Display the output. if (strpos($FileToView, ".php")) { $OutText = highlight_string($Elements["CONTENT"], true); $OutText = str_replace("<code>", "<pre>", $OutText); $OutText = str_replace("</code>", "</pre>", $OutText); echo $OutText; } else { $Find = array("\r", "\n", " ", "\t"); $Repl = array("", "<BR>", " ", " "); echo "<pre>".str_replace($Find, $Repl, $Elements["CONTENT"])."</pre>"; } $CVSServer->DisconnectTcp(); } echo GetPageFooter(); } function DownloadFile() { global $REPOS, $CVSROOT, $PServer, $UserName, $Password, $FileToDownload, $FileRev, $MIME_TYPE; $CVSServer = new phpcvs($CVSROOT, $PServer, $UserName, $Password); if ($CVSServer->ConnectTcpAndLogon()) { $CVSServer->SendRoot(); $CVSServer->SendValidResponses(); $CVSServer->SendValidRequests(); $Elements = $CVSServer->ViewFile($FileToDownload, $FileRev, $REPOS); // Send the file to the client. // $Elements["CONTENT"]; $PeriodPos = strrchr($FileToDownload, "."); $FileExt = substr($FileToDownload, $PeriodPos, strlen($FileToDownload)-$PeriodPos); if (isset($MIME_TYPE["$FileExt"])) { $ContentType = $MIME_TYPE["$FileExt"]; } else { $ContentType = "text/plain"; } header("content-type: ".$ContentType); echo $Elements["CONTENT"]; $CVSServer->DisconnectTcp(); } } if (isset($_GET["CVSROOT"])) { $REPOS = $_GET["CVSROOT"]; } else { $REPOS = "/"; } $REPOS = str_replace("//", "/", $REPOS); if (isset($_GET["ShowFile"])) { // Here we will show the contents of a file. $FileToView = $_GET["ShowFile"]; $FileRev = $_GET["Rev"]; DisplayFile(); } else { if (isset($_GET["ShowHist"])) { // Here we will show the Revision History of a given file. DisplayFileHistory($_GET["ShowHist"]); } else { if (isset($_GET["DownloadFile"])) { $FileToDownload = $_GET["DownloadFile"]; $FileRev = $_GET["Rev"]; DownloadFile(); } else { // Here we will just show the current file listing. DisplayDirListing(); } } } ?> |
From: <bch...@us...> - 2003-04-06 06:50:09
|
Update of /cvsroot/phpcvsview/phpcvsview In directory sc8-pr-cvs1:/tmp/cvs-serv1865 Modified Files: phpcvsmime.php Log Message: Fixed erroneous entries with periods in the file extension. Index: phpcvsmime.php =================================================================== RCS file: /cvsroot/phpcvsview/phpcvsview/phpcvsmime.php,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** phpcvsmime.php 6 Apr 2003 06:43:01 -0000 1.1 --- phpcvsmime.php 6 Apr 2003 06:50:06 -0000 1.2 *************** *** 32,38 **** $MIME_TYPES["wbxml"] = "application/vnd.wap.wbxml"; $MIME_TYPES["wmlc"] = "application/vnd.wap.wmlc"; - $MIME_TYPES[".wmlc"] = "application/vnd.wap.wmlc"; $MIME_TYPES["wmlsc"] = "application/vnd.wap.wmlscriptc"; - $MIME_TYPES[".wmlsc"] = "application/vnd.wap.wmlscriptc"; $MIME_TYPES["bcpio"] = "application/x-bcpio"; $MIME_TYPES["vcd"] = "application/x-cdlink"; --- 32,36 ---- *************** *** 47,55 **** $MIME_TYPES["gtar"] = "application/x-gtar"; $MIME_TYPES["hdf"] = "application/x-hdf"; ! $MIME_TYPES[".php"] = "application/x-httpd-php"; ! $MIME_TYPES[".php4"] = "application/x-httpd-php"; ! $MIME_TYPES[".php3"] = "application/x-httpd-php"; ! $MIME_TYPES[".phtml"] = "application/x-httpd-php"; ! $MIME_TYPES[".phps"] = "application/x-httpd-php-source"; $MIME_TYPES["js"] = "application/x-javascript"; $MIME_TYPES["skp"] = "application/x-koan"; --- 45,53 ---- $MIME_TYPES["gtar"] = "application/x-gtar"; $MIME_TYPES["hdf"] = "application/x-hdf"; ! $MIME_TYPES["php"] = "application/x-httpd-php"; ! $MIME_TYPES["php4"] = "application/x-httpd-php"; ! $MIME_TYPES["php3"] = "application/x-httpd-php"; ! $MIME_TYPES["phtml"] = "application/x-httpd-php"; ! $MIME_TYPES["phps"] = "application/x-httpd-php-source"; $MIME_TYPES["js"] = "application/x-javascript"; $MIME_TYPES["skp"] = "application/x-koan"; *************** *** 60,64 **** $MIME_TYPES["nc"] = "application/x-netcdf"; $MIME_TYPES["cdf"] = "application/x-netcdf"; ! $MIME_TYPES[".crl"] = "application/x-pkcs7-crl"; $MIME_TYPES["sh"] = "application/x-sh"; $MIME_TYPES["shar"] = "application/x-shar"; --- 58,62 ---- $MIME_TYPES["nc"] = "application/x-netcdf"; $MIME_TYPES["cdf"] = "application/x-netcdf"; ! $MIME_TYPES["crl"] = "application/x-pkcs7-crl"; $MIME_TYPES["sh"] = "application/x-sh"; $MIME_TYPES["shar"] = "application/x-shar"; *************** *** 68,72 **** $MIME_TYPES["sv4crc"] = "application/x-sv4crc"; $MIME_TYPES["tar"] = "application/x-tar"; ! $MIME_TYPES[".tgz"] = "application/x-tar"; $MIME_TYPES["tcl"] = "application/x-tcl"; $MIME_TYPES["tex"] = "application/x-tex"; --- 66,70 ---- $MIME_TYPES["sv4crc"] = "application/x-sv4crc"; $MIME_TYPES["tar"] = "application/x-tar"; ! $MIME_TYPES["tgz"] = "application/x-tar"; $MIME_TYPES["tcl"] = "application/x-tcl"; $MIME_TYPES["tex"] = "application/x-tex"; *************** *** 81,85 **** $MIME_TYPES["ustar"] = "application/x-ustar"; $MIME_TYPES["src"] = "application/x-wais-source"; ! $MIME_TYPES[".crt"] = "application/x-x509-ca-cert"; $MIME_TYPES["xhtml"] = "application/xhtml+xml"; $MIME_TYPES["xht"] = "application/xhtml+xml"; --- 79,83 ---- $MIME_TYPES["ustar"] = "application/x-ustar"; $MIME_TYPES["src"] = "application/x-wais-source"; ! $MIME_TYPES["crt"] = "application/x-x509-ca-cert"; $MIME_TYPES["xhtml"] = "application/xhtml+xml"; $MIME_TYPES["xht"] = "application/xhtml+xml"; *************** *** 116,120 **** $MIME_TYPES["djv"] = "image/vnd.djvu"; $MIME_TYPES["wbmp"] = "image/vnd.wap.wbmp"; ! $MIME_TYPES[".wbmp"] = "image/vnd.wap.wbmp"; $MIME_TYPES["ras"] = "image/x-cmu-raster"; $MIME_TYPES["pnm"] = "image/x-portable-anymap"; --- 114,118 ---- $MIME_TYPES["djv"] = "image/vnd.djvu"; $MIME_TYPES["wbmp"] = "image/vnd.wap.wbmp"; ! $MIME_TYPES["wbmp"] = "image/vnd.wap.wbmp"; $MIME_TYPES["ras"] = "image/x-cmu-raster"; $MIME_TYPES["pnm"] = "image/x-portable-anymap"; *************** *** 136,141 **** $MIME_TYPES["html"] = "text/html"; $MIME_TYPES["htm"] = "text/html"; ! $MIME_TYPES[".shtml"] = "text/html"; ! $MIME_TYPES[".jsp"] = "text/html"; $MIME_TYPES["asc"] = "text/plain"; $MIME_TYPES["txt"] = "text/plain"; --- 134,139 ---- $MIME_TYPES["html"] = "text/html"; $MIME_TYPES["htm"] = "text/html"; ! $MIME_TYPES["shtml"] = "text/html"; ! $MIME_TYPES["jsp"] = "text/html"; $MIME_TYPES["asc"] = "text/plain"; $MIME_TYPES["txt"] = "text/plain"; *************** *** 146,152 **** $MIME_TYPES["tsv"] = "text/tab-separated-values"; $MIME_TYPES["wml"] = "text/vnd.wap.wml"; ! $MIME_TYPES[".wml"] = "text/vnd.wap.wml"; $MIME_TYPES["wmls"] = "text/vnd.wap.wmlscript"; - $MIME_TYPES[".wmls"] = "text/vnd.wap.wmlscript"; $MIME_TYPES["etx"] = "text/x-setext"; $MIME_TYPES["xml"] = "text/xml"; --- 144,150 ---- $MIME_TYPES["tsv"] = "text/tab-separated-values"; $MIME_TYPES["wml"] = "text/vnd.wap.wml"; ! $MIME_TYPES["wml"] = "text/vnd.wap.wml"; ! $MIME_TYPES["wmls"] = "text/vnd.wap.wmlscript"; $MIME_TYPES["wmls"] = "text/vnd.wap.wmlscript"; $MIME_TYPES["etx"] = "text/x-setext"; $MIME_TYPES["xml"] = "text/xml"; *************** *** 161,165 **** $MIME_TYPES["movie"] = "video/x-sgi-movie"; $MIME_TYPES["ice"] = "x-conference/x-cooltalk"; - ?> --- 159,162 ---- |
From: <bch...@us...> - 2003-04-06 06:46:54
|
Update of /cvsroot/phpcvsview/phpcvsview In directory sc8-pr-cvs1:/tmp/cvs-serv1049 Modified Files: phpcvs.php test.php Log Message: Added File Log to both class and test.php. Added download capability to the File Log screen. Added syntax highlighting to the view file screen for PHP files using the internal highlighter Index: phpcvs.php =================================================================== RCS file: /cvsroot/phpcvsview/phpcvsview/phpcvs.php,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** phpcvs.php 22 Mar 2003 05:38:52 -0000 1.3 --- phpcvs.php 6 Apr 2003 06:46:51 -0000 1.4 *************** *** 24,31 **** **/ ! function phpcvs( $Repository = '', ! $PServer = '', ! $UserName = '', ! $Password = '') { $this->CVS_REPOSITORY = $Repository; --- 24,31 ---- **/ ! function phpcvs($Repository = '', ! $PServer = '', ! $UserName = '', ! $Password = '') { $this->CVS_REPOSITORY = $Repository; *************** *** 306,312 **** // Lets start receiving the response from the PServer. $RecvLN = ""; while(strncmp($RecvLN, "ok", 2) != 0){ ! $Elements .= substr($RecvLN, 2, strlen($RecvLN)-2); } // End of while(strncmp($RecvLN, "ok", 2) != 0) } // End of if ($this->SOCKET_HANDLE > -1) return $Elements; --- 306,408 ---- // Lets start receiving the response from the PServer. $RecvLN = ""; + $CurrentRevision = ""; + $RevisionCounter = 0; + $Elements["CODE"] = ""; while(strncmp($RecvLN, "ok", 2) != 0){ ! // if we have a line beginning with 'M revision' then this is a new revision. ! if (strncmp("M revision", $RecvLN, 10) == 0) { ! // New Revision details. ! $RevisionCounter = $RevisionCounter + 1; ! $CurrentRevision = substr($RecvLN, 11, strlen($RecvLN)-11); ! $Elements[$RevisionCounter]["Revision"] = $CurrentRevision; ! $RecvLN = fgets($this->SOCKET_HANDLE); ! ! // This line contains the Date, Author, State, and Line Counts. ! strtok($RecvLN, " :;\n\t"); ! strtok(" :;\t\n"); ! $Elements[$RevisionCounter]["Date"] = strtok(" ;\n\t"); ! $Elements[$RevisionCounter]["Time"] = strtok(" ;\n\t"); ! strtok(" :;\n\t"); ! $Elements[$RevisionCounter]["Author"] = strtok(" :;\n\t"); ! strtok(" :;\n\t"); ! $Elements[$RevisionCounter]["State"] = strtok(" :;\n\t"); ! strtok(" :;\n\t"); ! $Elements[$RevisionCounter]["LinesAdd"] = substr(strtok(" :;\n\t"), 1); ! $Elements[$RevisionCounter]["LinesSub"] = substr(strtok(" :;\n\t"), 1); ! ! // The following lines up until we get minuses or equals is the revision log. ! $RecvLN = fgets($this->SOCKET_HANDLE); ! $Elements[$RevisionCounter]["Log"] = ""; ! while((strncmp("M ----------------------------", $RecvLN, 30) != 0) && ! (strncmp("M ============================", $RecvLN, 30) != 0)){ ! // Add the text to the log. ! $Elements[$RevisionCounter]["Log"] .= substr($RecvLN, 2); ! $RecvLN = fgets($this->SOCKET_HANDLE); ! } // while ! } ! ! // if we have a line beginning with 'M RCS file' then we have the full file system path of the file. ! if (strncmp("M RCS file", $RecvLN, 10) == 0) { ! // Pull out the Full RCS filename. ! strtok($RecvLN, " :\t\n"); ! strtok(" :\t\n"); ! strtok(" :\t\n"); ! $Elements[0]["RCSFile"] = strtok(" :\t\n"); ! } ! ! // if we have a line beginning with 'M head' then we have the head revision number for this file. ! if (strncmp("M head", $RecvLN, 6) == 0) { ! // Pull out the head revision. ! strtok($RecvLN, " :\t\n"); ! strtok(" :\t\n"); ! $Elements[0]["HeadRev"] = strtok(" :\t\n"); ! } ! ! // if we have a line beginning with 'M branch' then we have the name of the head branch. ! if (strncmp("M branch", $RecvLN, 8) == 0) { ! // Pull out the head branch. ! strtok($RecvLN, " :\t\n"); ! strtok(" :\t\n"); ! $Elements[0]["HeadBranch"] = strtok(" :\t\n"); ! } ! ! // if we have a line beginning with 'M locks' then we have the locking scheme in use by this CVS server. ! if (strncmp("M locks", $RecvLN, 7) == 0) { ! // Pull out the locking methodology. ! strtok($RecvLN, " :\t\n"); ! strtok(" :\t\n"); ! $Elements[0]["Locks"] = strtok(" :\t\n"); ! } ! ! // if we have a line beginning with 'M access list' then we have the current accessing list. ! if (strncmp("M access list", $RecvLN, 13) == 0) { ! // Pull out the accessing list. ! strtok($RecvLN, " :\t\n"); ! strtok(" :\t\n"); ! strtok(" :\t\n"); ! $Elements[0]["AccessList"] = strtok(" :\t\n"); ! } ! ! // if we have a line beginning with 'M symbolic names' then we have the list of symbolic names for this file. ! if (strncmp("M symbolic names", $RecvLN, 16) == 0) { ! // Pull out the symbolic names. ! strtok($RecvLN, " :\t\n"); ! strtok(" :\t\n"); ! strtok(" :\t\n"); ! $Elements[0]["SymNames"] = strtok(" :\t\n"); ! } ! ! // if we have a line beginning with 'M keyword substitution' then we have the keywork substitutions. ! if (strncmp("M keywork substitutions", $RecvLN, 23) == 0) { ! strtok($RecvLN, " :\t\n"); ! strtok(" :\t\n"); ! strtok(" :\t\n"); ! $Elements[0]["KeywrdSubst"] = strtok(" :\t\n"); ! } ! ! $Elements["CODE"] .= substr($RecvLN, 2, strlen($RecvLN)-2); ! $RecvLN = fgets($this->SOCKET_HANDLE); } // End of while(strncmp($RecvLN, "ok", 2) != 0) + $Elements[0]["TotalRevisions"] = $RevisionCounter; } // End of if ($this->SOCKET_HANDLE > -1) return $Elements; *************** *** 355,360 **** if (strncmp($RecvLN, "Created", 7) == 0) { - echo "We are getting the file contents.<br>"; - // We are getting the file from the Server. $RecvLN = fgets($this->SOCKET_HANDLE); --- 451,454 ---- *************** *** 365,370 **** // RecvLN Holds the length of the file as a string $TotalBytes = $RecvLN + 0; - echo "Number of bytes = $RecvLN<br>"; - echo "Number of bytes = $TotalBytes<br>"; $Elements["CONTENT"] = fread($this->SOCKET_HANDLE, $TotalBytes); } --- 459,462 ---- Index: test.php =================================================================== RCS file: /cvsroot/phpcvsview/phpcvsview/test.php,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** test.php 22 Mar 2003 05:38:52 -0000 1.3 --- test.php 6 Apr 2003 06:46:51 -0000 1.4 *************** *** 10,13 **** --- 10,14 ---- $REPOS = ""; $CVSROOT = "/cvsroot/d/de/denet/"; + //$CVSROOT = "/cvsroot/p/ph/phpcvsview/"; $PServer = "cvs.sourceforge.net"; $UserName = "anonymous"; *************** *** 15,18 **** --- 16,20 ---- include("phpcvs.php"); + include("phpcvsmime.php"); function DisplayDirListing () { *************** *** 78,82 **** } // End of function DisplayDirListing() ! function DisplayFileHistory() { global $REPOS, $CVSROOT, $PServer, $UserName, $Password; --- 80,84 ---- } // End of function DisplayDirListing() ! function DisplayFileHistory($FileName) { global $REPOS, $CVSROOT, $PServer, $UserName, $Password; *************** *** 87,94 **** $CVSServer->SendValidResponses(); $CVSServer->SendValidRequests(); ! $Elements = $CVSServer->RLOG ($REPOS); $CVSServer->DisconnectTcp(); } // End of if ($CVSServer->ConnectTcpAndLogon()) } // End of function DisplayFileHistory() --- 89,126 ---- $CVSServer->SendValidResponses(); $CVSServer->SendValidRequests(); ! $Elements = $CVSServer->RLOGFile($FileName, $REPOS); ! ! echo "<code>".str_replace("\n", "<BR>", $Elements["CODE"])."</code>"; ! ! // List each revision with a HorizRule between them. ! for ($i = 1; $i <= $Elements[0]["TotalRevisions"]; $i++) { ! echo "<HR>\n"; ! echo "Revision: ".$Elements[$i]["Revision"]." "; ! echo "[<A HREF=\"/test.php?CVSROOT=$REPOS&ShowFile=".$FileName."&Rev=".$Elements[$i]["Revision"]."\">View"; ! echo "</a>] "; ! ! echo "[<A HREF=\"/test.php?CVSROOT=$REPOS&DownloadFile=".$FileName."&Rev=".$Elements[$i]["Revision"]."\">Download"; ! echo "</a>]"; ! ! echo "<BR>\n"; ! ! echo "Branch: Yet to identify.<BR>\n"; ! echo "Date: ".$Elements[$i]["Date"]."<BR>\n"; ! echo "Time: ".$Elements[$i]["Time"]."<BR>\n"; ! echo "Author: ".$Elements[$i]["Author"]."<BR>\n"; ! echo "State: ".$Elements[$i]["State"]."<BR>\n"; ! ! if (($i + 1) < $Elements[0]["TotalRevisions"]) { ! echo "Changes since ".$Elements[$i+1]["Revision"].": "; ! echo "+".$Elements[$i]["LinesAdd"]." -".$Elements[$i]["LinesSub"]."<br>\n"; ! } ! echo "<pre>".str_replace("\n", "<BR>", $Elements[$i]["Log"])."</pre>"; ! } ! echo "<HR>\n"; $CVSServer->DisconnectTcp(); + } else { + echo "ERROR: Unable to connect to the CVS PServer.<BR>"; } // End of if ($CVSServer->ConnectTcpAndLogon()) } // End of function DisplayFileHistory() *************** *** 105,111 **** echo "<H1>File Contents for Revision ".$FileRev." of '".$REPOS.$FileToView."'</H1>"; $Elements = $CVSServer->ViewFile($FileToView, $FileRev, $REPOS); - $FileOut = ""; ! echo "<PRE>".$Elements["CONTENT"]."</PRE>"; $CVSServer->DisconnectTcp(); --- 137,180 ---- echo "<H1>File Contents for Revision ".$FileRev." of '".$REPOS.$FileToView."'</H1>"; $Elements = $CVSServer->ViewFile($FileToView, $FileRev, $REPOS); ! // Format and Display the output. ! if (strpos($FileToView, ".php")) { ! $OutText = highlight_string($Elements["CONTENT"], true); ! $OutText = str_replace("<code>", "<pre>", $OutText); ! $OutText = str_replace("</code>", "</pre>", $OutText); ! echo $OutText; ! } else { ! $Find = array("\r", "\n", " ", "\t"); ! $Repl = array("", "<BR>", " ", " "); ! echo "<pre>".str_replace($Find, $Repl, $Elements["CONTENT"])."</pre>"; ! } ! // echo "<code>".ereg_replace(" ", " ", ereg_replace("\n", "<BR>", $Elements["CONTENT"]))."</code>"; ! ! $CVSServer->DisconnectTcp(); ! } ! } ! ! function DownloadFile() { ! global $REPOS, $CVSROOT, $PServer, $UserName, $Password, $FileToDownload, $FileRev, $MIME_TYPE; ! ! $CVSServer = new phpcvs($CVSROOT, $PServer, $UserName, $Password); ! ! if ($CVSServer->ConnectTcpAndLogon()) { ! $CVSServer->SendRoot(); ! $CVSServer->SendValidResponses(); ! $CVSServer->SendValidRequests(); ! $Elements = $CVSServer->ViewFile($FileToDownload, $FileRev, $REPOS); ! ! // Send the file to the client. ! // $Elements["CONTENT"]; ! $PeriodPos = strrchr($FileToDownload, "."); ! $FileExt = substr($FileToDownload, $PeriodPos, strlen($FileToDownload)-$PeriodPos); ! if (isset($MIME_TYPE["$FileExt"])) { ! $ContentType = $MIME_TYPE["$FileExt"]; ! } else { ! $ContentType = "text/plain"; ! } ! header("content-type: ".$ContentType); ! echo $Elements["CONTENT"]; $CVSServer->DisconnectTcp(); *************** *** 130,136 **** // Here we will show the Revision History of a given file. echo "<H1>Revision History for '".$REPOS.$_GET["ShowHist"]."'</H1>"; } else { ! // Here we will just show the current file listing. ! DisplayDirListing(); } } --- 199,212 ---- // Here we will show the Revision History of a given file. echo "<H1>Revision History for '".$REPOS.$_GET["ShowHist"]."'</H1>"; + DisplayFileHistory($_GET["ShowHist"]); } else { ! if (isset($_GET["DownloadFile"])) { ! $FileToDownload = $_GET["DownloadFile"]; ! $FileRev = $_GET["Rev"]; ! DownloadFile(); ! } else { ! // Here we will just show the current file listing. ! DisplayDirListing(); ! } } } |
From: <bch...@us...> - 2003-04-06 06:43:04
|
Update of /cvsroot/phpcvsview/phpcvsview In directory sc8-pr-cvs1:/tmp/cvs-serv532 Added Files: phpcvsmime.php Log Message: Added a lookup variable of mime types to be used by the test.php file. --- NEW FILE: phpcvsmime.php --- <?php /** * * * @version $Id: phpcvsmime.php,v 1.1 2003/04/06 06:43:01 bcheesem Exp $ * @copyright 2002 ARECOM International **/ $MIME_TYPES["ez"] = "application/andrew-inset"; $MIME_TYPES["hqx"] = "application/mac-binhex40"; $MIME_TYPES["cpt"] = "application/mac-compactpro"; $MIME_TYPES["doc"] = "application/msword"; $MIME_TYPES["bin"] = "application/octet-stream"; $MIME_TYPES["dms"] = "application/octet-stream"; $MIME_TYPES["lha"] = "application/octet-stream"; $MIME_TYPES["lzh"] = "application/octet-stream"; $MIME_TYPES["exe"] = "application/octet-stream"; $MIME_TYPES["class"] = "application/octet-stream"; $MIME_TYPES["so"] = "application/octet-stream"; $MIME_TYPES["dll"] = "application/octet-stream"; $MIME_TYPES["oda"] = "application/oda"; $MIME_TYPES["pdf"] = "application/pdf"; $MIME_TYPES["ai"] = "application/postscript"; $MIME_TYPES["eps"] = "application/postscript"; $MIME_TYPES["ps"] = "application/postscript"; $MIME_TYPES["smi"] = "application/smil"; $MIME_TYPES["smil"] = "application/smil"; $MIME_TYPES["mif"] = "application/vnd.mif"; $MIME_TYPES["xls"] = "application/vnd.ms-excel"; $MIME_TYPES["ppt"] = "application/vnd.ms-powerpoint"; $MIME_TYPES["wbxml"] = "application/vnd.wap.wbxml"; $MIME_TYPES["wmlc"] = "application/vnd.wap.wmlc"; $MIME_TYPES[".wmlc"] = "application/vnd.wap.wmlc"; $MIME_TYPES["wmlsc"] = "application/vnd.wap.wmlscriptc"; $MIME_TYPES[".wmlsc"] = "application/vnd.wap.wmlscriptc"; $MIME_TYPES["bcpio"] = "application/x-bcpio"; $MIME_TYPES["vcd"] = "application/x-cdlink"; $MIME_TYPES["pgn"] = "application/x-chess-pgn"; $MIME_TYPES["cpio"] = "application/x-cpio"; $MIME_TYPES["csh"] = "application/x-csh"; $MIME_TYPES["dcr"] = "application/x-director"; $MIME_TYPES["dir"] = "application/x-director"; $MIME_TYPES["dxr"] = "application/x-director"; $MIME_TYPES["dvi"] = "application/x-dvi"; $MIME_TYPES["spl"] = "application/x-futuresplash"; $MIME_TYPES["gtar"] = "application/x-gtar"; $MIME_TYPES["hdf"] = "application/x-hdf"; $MIME_TYPES[".php"] = "application/x-httpd-php"; $MIME_TYPES[".php4"] = "application/x-httpd-php"; $MIME_TYPES[".php3"] = "application/x-httpd-php"; $MIME_TYPES[".phtml"] = "application/x-httpd-php"; $MIME_TYPES[".phps"] = "application/x-httpd-php-source"; $MIME_TYPES["js"] = "application/x-javascript"; $MIME_TYPES["skp"] = "application/x-koan"; $MIME_TYPES["skd"] = "application/x-koan"; $MIME_TYPES["skt"] = "application/x-koan"; $MIME_TYPES["skm"] = "application/x-koan"; $MIME_TYPES["latex"] = "application/x-latex"; $MIME_TYPES["nc"] = "application/x-netcdf"; $MIME_TYPES["cdf"] = "application/x-netcdf"; $MIME_TYPES[".crl"] = "application/x-pkcs7-crl"; $MIME_TYPES["sh"] = "application/x-sh"; $MIME_TYPES["shar"] = "application/x-shar"; $MIME_TYPES["swf"] = "application/x-shockwave-flash"; $MIME_TYPES["sit"] = "application/x-stuffit"; $MIME_TYPES["sv4cpio"] = "application/x-sv4cpio"; $MIME_TYPES["sv4crc"] = "application/x-sv4crc"; $MIME_TYPES["tar"] = "application/x-tar"; $MIME_TYPES[".tgz"] = "application/x-tar"; $MIME_TYPES["tcl"] = "application/x-tcl"; $MIME_TYPES["tex"] = "application/x-tex"; $MIME_TYPES["texinfo"] = "application/x-texinfo"; $MIME_TYPES["texi"] = "application/x-texinfo"; $MIME_TYPES["t"] = "application/x-troff"; $MIME_TYPES["tr"] = "application/x-troff"; $MIME_TYPES["roff"] = "application/x-troff"; $MIME_TYPES["man"] = "application/x-troff-man"; $MIME_TYPES["me"] = "application/x-troff-me"; $MIME_TYPES["ms"] = "application/x-troff-ms"; $MIME_TYPES["ustar"] = "application/x-ustar"; $MIME_TYPES["src"] = "application/x-wais-source"; $MIME_TYPES[".crt"] = "application/x-x509-ca-cert"; $MIME_TYPES["xhtml"] = "application/xhtml+xml"; $MIME_TYPES["xht"] = "application/xhtml+xml"; $MIME_TYPES["zip"] = "application/zip"; $MIME_TYPES["au"] = "audio/basic"; $MIME_TYPES["snd"] = "audio/basic"; $MIME_TYPES["mid"] = "audio/midi"; $MIME_TYPES["midi"] = "audio/midi"; $MIME_TYPES["kar"] = "audio/midi"; $MIME_TYPES["mpga"] = "audio/mpeg"; $MIME_TYPES["mp2"] = "audio/mpeg"; $MIME_TYPES["mp3"] = "audio/mpeg"; $MIME_TYPES["aif"] = "audio/x-aiff"; $MIME_TYPES["aiff"] = "audio/x-aiff"; $MIME_TYPES["aifc"] = "audio/x-aiff"; $MIME_TYPES["m3u"] = "audio/x-mpegurl"; $MIME_TYPES["ram"] = "audio/x-pn-realaudio"; $MIME_TYPES["rm"] = "audio/x-pn-realaudio"; $MIME_TYPES["rpm"] = "audio/x-pn-realaudio-plugin"; $MIME_TYPES["ra"] = "audio/x-realaudio"; $MIME_TYPES["wav"] = "audio/x-wav"; $MIME_TYPES["pdb"] = "chemical/x-pdb"; $MIME_TYPES["xyz"] = "chemical/x-xyz"; $MIME_TYPES["bmp"] = "image/bmp"; $MIME_TYPES["gif"] = "image/gif"; $MIME_TYPES["ief"] = "image/ief"; $MIME_TYPES["jpeg"] = "image/jpeg"; $MIME_TYPES["jpg"] = "image/jpeg"; $MIME_TYPES["jpe"] = "image/jpeg"; $MIME_TYPES["png"] = "image/png"; $MIME_TYPES["tiff"] = "image/tiff"; $MIME_TYPES["tif"] = "image/tiff"; $MIME_TYPES["djvu"] = "image/vnd.djvu"; $MIME_TYPES["djv"] = "image/vnd.djvu"; $MIME_TYPES["wbmp"] = "image/vnd.wap.wbmp"; $MIME_TYPES[".wbmp"] = "image/vnd.wap.wbmp"; $MIME_TYPES["ras"] = "image/x-cmu-raster"; $MIME_TYPES["pnm"] = "image/x-portable-anymap"; $MIME_TYPES["pbm"] = "image/x-portable-bitmap"; $MIME_TYPES["pgm"] = "image/x-portable-graymap"; $MIME_TYPES["ppm"] = "image/x-portable-pixmap"; $MIME_TYPES["rgb"] = "image/x-rgb"; $MIME_TYPES["xbm"] = "image/x-xbitmap"; $MIME_TYPES["xpm"] = "image/x-xpixmap"; $MIME_TYPES["xwd"] = "image/x-xwindowdump"; $MIME_TYPES["igs"] = "model/iges"; $MIME_TYPES["iges"] = "model/iges"; $MIME_TYPES["msh"] = "model/mesh"; $MIME_TYPES["mesh"] = "model/mesh"; $MIME_TYPES["silo"] = "model/mesh"; $MIME_TYPES["wrl"] = "model/vrml"; $MIME_TYPES["vrml"] = "model/vrml"; $MIME_TYPES["css"] = "text/css"; $MIME_TYPES["html"] = "text/html"; $MIME_TYPES["htm"] = "text/html"; $MIME_TYPES[".shtml"] = "text/html"; $MIME_TYPES[".jsp"] = "text/html"; $MIME_TYPES["asc"] = "text/plain"; $MIME_TYPES["txt"] = "text/plain"; $MIME_TYPES["rtx"] = "text/richtext"; $MIME_TYPES["rtf"] = "text/rtf"; $MIME_TYPES["sgml"] = "text/sgml"; $MIME_TYPES["sgm"] = "text/sgml"; $MIME_TYPES["tsv"] = "text/tab-separated-values"; $MIME_TYPES["wml"] = "text/vnd.wap.wml"; $MIME_TYPES[".wml"] = "text/vnd.wap.wml"; $MIME_TYPES["wmls"] = "text/vnd.wap.wmlscript"; $MIME_TYPES[".wmls"] = "text/vnd.wap.wmlscript"; $MIME_TYPES["etx"] = "text/x-setext"; $MIME_TYPES["xml"] = "text/xml"; $MIME_TYPES["xsl"] = "text/xml"; $MIME_TYPES["mpeg"] = "video/mpeg"; $MIME_TYPES["mpg"] = "video/mpeg"; $MIME_TYPES["mpe"] = "video/mpeg"; $MIME_TYPES["qt"] = "video/quicktime"; $MIME_TYPES["mov"] = "video/quicktime"; $MIME_TYPES["mxu"] = "video/vnd.mpegurl"; $MIME_TYPES["avi"] = "video/x-msvideo"; $MIME_TYPES["movie"] = "video/x-sgi-movie"; $MIME_TYPES["ice"] = "x-conference/x-cooltalk"; ?> |
From: <bch...@us...> - 2003-03-22 05:38:55
|
Update of /cvsroot/phpcvsview/phpcvsview In directory sc8-pr-cvs1:/tmp/cvs-serv19186 Modified Files: phpcvs.php test.php Log Message: Added basic file viewing to the class and test page. Index: phpcvs.php =================================================================== RCS file: /cvsroot/phpcvsview/phpcvsview/phpcvs.php,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** phpcvs.php 22 Mar 2003 02:10:31 -0000 1.2 --- phpcvs.php 22 Mar 2003 05:38:52 -0000 1.3 *************** *** 237,241 **** // Determine if it is local dir or a subdir. if (strncmp($RecvLN, "M \n", 3) == 0) { ! $FileName = fgets($this->SOCKET_HANDLE, 13+strlen($this->CVS_REPOSITORY.$Module)); if (strncmp($FileName, "M RCS file", 10) == 0) { $FileName = fgets($this->SOCKET_HANDLE, 8192); --- 237,241 ---- // Determine if it is local dir or a subdir. if (strncmp($RecvLN, "M \n", 3) == 0) { ! $FileName = fgets($this->SOCKET_HANDLE, 12+strlen($this->CVS_REPOSITORY.$Module)); if (strncmp($FileName, "M RCS file", 10) == 0) { $FileName = fgets($this->SOCKET_HANDLE, 8192); *************** *** 312,315 **** --- 312,377 ---- return $Elements; } // End of function RLOGFile(); + + function ViewFile($File, $Revision, $Module="/") { + // Here we will export a copy of a given file, returning a series of "Strings". + if (strncmp($Module, "/", 1) == 0) { + $Module = substr($Module, 1, strlen($Module)-1); + } + + $SendCMD = "UseUnchanged\nCase\nArgument ".$Module.$File."\nDirectory .\n".$this->CVS_REPOSITORY."\nexpand-modules\n"; + fputs($this->SOCKET_HANDLE, $SendCMD); + + $RecvLN = "ABCD"; + while(strncmp($RecvLN, "ok", 2) != 0){ + $RecvLN = fgets($this->SOCKET_HANDLE); + } // End of while(strncmp($RecvLN, "ok", 2) != 0) + + // Send the checkout command. + $SendCMD = "Argument -n\nArgument -l\nArgument -N\nArgument -P\nArgument -r\nArgument ".$Revision."\nArgument ".$Module.$File."\nDirectory .\n".$this->CVS_REPOSITORY."\nco\n"; + fputs($this->SOCKET_HANDLE, $SendCMD); + + // Clear out the Return Elements, in preparation for returning the information. + $Elements = ""; + + $RecvLN = ""; + while(strncmp($RecvLN, "ok", 2) != 0){ + if (strncmp($RecvLN, "Clear-sticky ", 13) == 0) { + $RecvLN = fgets($this->SOCKET_HANDLE, 8192); + } + if (strncmp($RecvLN, "Set-static-directory ", 21) == 0) { + $RecvLN = fgets($this->SOCKET_HANDLE, 8192); + } + if (strncmp($RecvLN, "Mod-time", 8) == 0) { + // We had the Date and time this revision was modified. + $Elements["DATETIME"] = substr($RecvLN, 9, strlen($RecvLN)-9); + $RecvLN = fgets($this->SOCKET_HANDLE); + while(strncmp($RecvLN, "MT", 2) == 0){ + $RecvLN = fgets($this->SOCKET_HANDLE); + if (strncmp($RecvLN, "MT -updated", 11) == 0) { + $RecvLN = ""; + } + } // while + } + if (strncmp($RecvLN, "Created", 7) == 0) { + + echo "We are getting the file contents.<br>"; + + // We are getting the file from the Server. + $RecvLN = fgets($this->SOCKET_HANDLE); + $RecvLN = fgets($this->SOCKET_HANDLE); + $RecvLN = fgets($this->SOCKET_HANDLE); + $RecvLN = fgets($this->SOCKET_HANDLE); + + // RecvLN Holds the length of the file as a string + $TotalBytes = $RecvLN + 0; + echo "Number of bytes = $RecvLN<br>"; + echo "Number of bytes = $TotalBytes<br>"; + $Elements["CONTENT"] = fread($this->SOCKET_HANDLE, $TotalBytes); + } + $RecvLN = fgets($this->SOCKET_HANDLE); + } // End of while(strncmp($RecvLN, "ok", 2) != 0) + + return $Elements; + } function CVSLogon() { Index: test.php =================================================================== RCS file: /cvsroot/phpcvsview/phpcvsview/test.php,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** test.php 22 Mar 2003 02:10:31 -0000 1.2 --- test.php 22 Mar 2003 05:38:52 -0000 1.3 *************** *** 9,13 **** $REPOS = ""; ! $CVSROOT = "/cvsroot/d/de/denet"; $PServer = "cvs.sourceforge.net"; $UserName = "anonymous"; --- 9,13 ---- $REPOS = ""; ! $CVSROOT = "/cvsroot/d/de/denet/"; $PServer = "cvs.sourceforge.net"; $UserName = "anonymous"; *************** *** 88,94 **** --- 88,116 ---- $CVSServer->SendValidRequests(); $Elements = $CVSServer->RLOG ($REPOS); + + + $CVSServer->DisconnectTcp(); } // End of if ($CVSServer->ConnectTcpAndLogon()) } // End of function DisplayFileHistory() + function DisplayFile() { + global $REPOS, $CVSROOT, $PServer, $UserName, $Password, $FileToView, $FileRev; + + $CVSServer = new phpcvs($CVSROOT, $PServer, $UserName, $Password); + + if ($CVSServer->ConnectTcpAndLogon()) { + $CVSServer->SendRoot(); + $CVSServer->SendValidResponses(); + $CVSServer->SendValidRequests(); + echo "<H1>File Contents for Revision ".$FileRev." of '".$REPOS.$FileToView."'</H1>"; + $Elements = $CVSServer->ViewFile($FileToView, $FileRev, $REPOS); + $FileOut = ""; + + echo "<PRE>".$Elements["CONTENT"]."</PRE>"; + + $CVSServer->DisconnectTcp(); + } + } + if (isset($_GET["CVSROOT"])) { $REPOS = $_GET["CVSROOT"]; *************** *** 97,106 **** } if (isset($_GET["ShowFile"])) { // Here we will show the contents of a file. } else { if (isset($_GET["ShowHist"])) { // Here we will show the Revision History of a given file. ! echo "<H1>Revision History for '".$_GET["CVSROOT"].$_GET["ShowHist"]."'</H1>"; } else { // Here we will just show the current file listing. --- 119,133 ---- } + $REPOS = str_replace("//", "/", $REPOS); + if (isset($_GET["ShowFile"])) { // Here we will show the contents of a file. + $FileToView = $_GET["ShowFile"]; + $FileRev = $_GET["Rev"]; + DisplayFile(); } else { if (isset($_GET["ShowHist"])) { // Here we will show the Revision History of a given file. ! echo "<H1>Revision History for '".$REPOS.$_GET["ShowHist"]."'</H1>"; } else { // Here we will just show the current file listing. *************** *** 109,113 **** } - $REPOS = str_replace("//", "/", $REPOS); --- 136,139 ---- |