[Phpcvsview-cvs-updates] phpcvsview cvsview.php,1.2,1.3 phpcvs.php,1.5,1.6
Status: Pre-Alpha
Brought to you by:
bcheesem
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); |