[phpcvsview-cvs-updates] phpcvsview cvsview.php,1.19,1.20 func_DirListing.php,1.8,1.9 func_FileAnnot
Status: Pre-Alpha
Brought to you by:
bcheesem
Update of /cvsroot/phpcvsview/phpcvsview In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24387 Modified Files: cvsview.php func_DirListing.php func_FileAnnotation.php func_FileDownload.php func_FileHistory.php func_FileView.php phpcvsmime.php Log Message: - added internationalization (i18n) support - updated copyright year - minor code cleanup Index: func_FileDownload.php =================================================================== RCS file: /cvsroot/phpcvsview/phpcvsview/func_FileDownload.php,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** func_FileDownload.php 19 Dec 2004 10:27:04 -0000 1.1 --- func_FileDownload.php 1 Feb 2005 15:11:01 -0000 1.2 *************** *** 9,26 **** * @author Brian A Cheeseman <bch...@us...> * @version $Id ! * @copyright 2003-2004 Brian A Cheeseman **/ - include_once("phpcvsmime.php"); - function DownloadFile($File, $Revision = "") { ! global $config, $env, $MIME_TYPES; // Calculate the path from the $env['script_name'] variable. ! $env['script_path'] = substr($env['script_name'], 0, strrpos($env['script_name'], "/")); ! if ($env['script_path'] == ""){ ! $env['script_path'] = "/"; ! } // Create our CVS connection object and set the required properties. --- 9,22 ---- * @author Brian A Cheeseman <bch...@us...> * @version $Id ! * @copyright 2003-2005 Brian A Cheeseman **/ function DownloadFile($File, $Revision = "") { ! global $config, $env, $lang, $MIME_TYPES; // Calculate the path from the $env['script_name'] variable. ! $env['script_path'] = substr($env['script_name'], 0, strrpos($env['script_name'], '/')); ! $env['script_path'] = (empty($env['script_path']))? '/' : $env['script_path']; // Create our CVS connection object and set the required properties. *************** *** 42,62 **** $Response = $CVSServer->ExportFile($File, $Revision); if ($Response !== true) { ! return; } // Get the mime type for the file. ! $FileExt = substr($File, strrpos($File, ".")+1); $MimeType = $MIME_TYPES[$FileExt]; ! if ($MimeType == "") { ! $MimeType = "text/plain"; } // Send the appropriate http header. ! header("Content-Type: $MimeType"); // Send the file contents. echo $CVSServer->FILECONTENTS; ! echo "<br />File Extension: $FileExt<br />"; ! echo "MIME TYPE IS: $MimeType"; // Close the connection. --- 38,58 ---- $Response = $CVSServer->ExportFile($File, $Revision); if ($Response !== true) { ! return; } // Get the mime type for the file. ! $FileExt = substr($File, strrpos($File, '.')+1); $MimeType = $MIME_TYPES[$FileExt]; ! if ($MimeType == '') { ! $MimeType = 'text/plain'; } // Send the appropriate http header. ! header('Content-Type: '.$MimeType); // Send the file contents. echo $CVSServer->FILECONTENTS; ! echo '<br />'.$lang['file_ext'].' '.$FileExt; ! echo '<br />'.$lang['mime_type'].' '. $MimeType; // Close the connection. Index: phpcvsmime.php =================================================================== RCS file: /cvsroot/phpcvsview/phpcvsview/phpcvsmime.php,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** phpcvsmime.php 2 Oct 2004 01:47:17 -0000 1.5 --- phpcvsmime.php 1 Feb 2005 15:11:01 -0000 1.6 *************** *** 9,13 **** * @author Brian A Cheeseman <bch...@us...> * @version $Id$ ! * @copyright 2003-2004 Brian A Cheeseman **/ --- 9,13 ---- * @author Brian A Cheeseman <bch...@us...> * @version $Id$ ! * @copyright 2003-2005 Brian A Cheeseman **/ Index: func_DirListing.php =================================================================== RCS file: /cvsroot/phpcvsview/phpcvsview/func_DirListing.php,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** func_DirListing.php 19 Dec 2004 04:51:37 -0000 1.8 --- func_DirListing.php 1 Feb 2005 15:11:01 -0000 1.9 *************** *** 9,18 **** * @author Brian A Cheeseman <bch...@us...> * @version $Id$ ! * @copyright 2003-2004 Brian A Cheeseman **/ function DisplayDirListing() { ! global $config, $env; // Create our CVS connection object and set the required properties. --- 9,18 ---- * @author Brian A Cheeseman <bch...@us...> * @version $Id$ ! * @copyright 2003-2005 Brian A Cheeseman **/ function DisplayDirListing() { ! global $config, $env, $lang; // Create our CVS connection object and set the required properties. *************** *** 36,40 **** // If we are in the Root of the CVS Repository then lets get the Module list. if (strlen($env['mod_path']) < 2) { ! $Modules = $CVSServer->getModuleList(); } else --- 36,40 ---- // If we are in the Root of the CVS Repository then lets get the Module list. if (strlen($env['mod_path']) < 2) { ! $Modules = $CVSServer->getModuleList(); } else *************** *** 59,63 **** // Display the Modules if we have them. if ($Modules !== false) { ! addModules($env['mod_path'], $Modules); } --- 59,63 ---- // Display the Modules if we have them. if ($Modules !== false) { ! addModules($env['mod_path'], $Modules); } *************** *** 70,74 **** $CVSServer->Disconnect(); } else { ! echo "Connection Failed."; } echo GetPageFooter(); --- 70,74 ---- $CVSServer->Disconnect(); } else { ! echo $lang['err_connect']; } echo GetPageFooter(); Index: func_FileHistory.php =================================================================== RCS file: /cvsroot/phpcvsview/phpcvsview/func_FileHistory.php,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** func_FileHistory.php 1 Feb 2005 07:20:52 -0000 1.7 --- func_FileHistory.php 1 Feb 2005 15:11:01 -0000 1.8 *************** *** 9,24 **** * @author Brian A Cheeseman <bch...@us...> * @version $Id$ ! * @copyright 2003-2004 Brian A Cheeseman **/ function DisplayFileHistory() { ! global $config, $env, $CVSServer; // Calculate the path from the $env['script_name'] variable. ! $env['script_path'] = substr($env['script_name'], 0, strrpos($env['script_name'], "/")); ! if ($env['script_path'] == "") { ! $env['script_path'] = "/"; ! } // Create our CVS connection object and set the required properties. --- 9,22 ---- * @author Brian A Cheeseman <bch...@us...> * @version $Id$ ! * @copyright 2003-2005 Brian A Cheeseman **/ function DisplayFileHistory() { ! global $config, $env, $lang; // Calculate the path from the $env['script_name'] variable. ! $env['script_path'] = substr($env['script_name'], 0, strrpos($env['script_name'], '/')); ! $env['script_path'] = (empty($env['script_path']))? '/' : $env['script_path']; // Create our CVS connection object and set the required properties. *************** *** 43,77 **** // Add the quick link navigation bar. ! echo GetQuickLinkBar($env['mod_path'], "Revision History for: ", false, true, ""); foreach ($CVSServer->FILES[0]["Revisions"] as $Revision) { ! $HREF = str_replace("//", "/", $env['script_name']."?mp=".$env['mod_path']); $DateTime = strtotime($Revision["date"]); ! echo "<hr /><p><a id=\"rd$DateTime\" />\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>)"; ! if ($Revision["PrevRevision"] != "") { ! echo " (<a href=\"$HREF&df&r1=".$Revision["Revision"]."&r2="; ! echo $Revision["PrevRevision"]."\">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"]), strtotime(gmdate("M d Y H:i:s")))." 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></p><pre>".$Revision["LogMessage"]."</pre>\n"; } ! echo "<hr />\n"; $CVSServer->Disconnect(); } else { ! echo "Connection Failed."; } echo GetDiffForm(); --- 41,75 ---- // Add the quick link navigation bar. ! echo GetQuickLinkBar($env['mod_path'], $lang['rev_history'], false, true, ""); foreach ($CVSServer->FILES[0]["Revisions"] as $Revision) { ! $HREF = str_replace('//', '/', $env['script_name'].'?mp='.$env['mod_path']); $DateTime = strtotime($Revision["date"]); ! echo '<hr /><p><a id="rd'.$DateTime.'" />'."\n"; ! echo '<b>'.$lang['revision'].'</b> '.$Revision["Revision"].' -'; ! echo ' (<a href="'.$HREF.'&fv&dt='.$DateTime.'">'.$lang['view'].'</a>)'; ! echo ' (<a href="'.$HREF.'&fd&dt='.$DateTime.'">'.$lang['download'].'</a>)'; ! if ($Revision["PrevRevision"] != '') { ! echo ' (<a href="'.$HREF.'&df&r1='.$Revision["Revision"].'&r2='; ! echo $Revision["PrevRevision"].'">'.$lang['diff'].'</a>)'; } ! echo ' (<a href="'.$HREF.'&fa='.$Revision["Revision"].'">'.$lang['annotate'].'</a>)<br />'."\n"; ! echo '<b>'.$lang['last_checkin'].'</b> '.strftime("%A %d %b %Y %T -0000", $DateTime).' ('.CalculateDateDiff($DateTime, strtotime(gmdate("M d Y H:i:s"))).' '.$lang['ago'].')<br />'."\n"; ! echo '<b>'.$lang['branch'].'</b> '.$Revision["Branches"].'<br />'."\n"; ! echo '<b>'.$lang['date'].'</b> '.strftime("%B %d, %Y", $DateTime).'<br />'."\n"; ! echo '<b>'.$lang['time'].'</b> '.strftime("%H:%M:%S", $DateTime).'<br />'."\n"; ! echo '<b>'.$lang['author'].'</b> '.$Revision["author"].'<br />'."\n"; ! echo '<b>'.$lang['state'].'</b> '.$Revision["state"].'<br />'."\n"; ! if ($Revision["PrevRevision"] != '') { ! echo '<b>'.$lang['changes'].$Revision["PrevRevision"].':</b> '.$Revision["lines"].'<br />'."\n"; } ! echo '<b>'.$lang['log_message'].'</b></p><pre>'.$Revision["LogMessage"].'</pre>'."\n"; } ! echo '<hr />'."\n"; $CVSServer->Disconnect(); } else { ! echo $lang['err_connect']; } echo GetDiffForm(); Index: func_FileView.php =================================================================== RCS file: /cvsroot/phpcvsview/phpcvsview/func_FileView.php,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** func_FileView.php 23 Jan 2005 04:35:24 -0000 1.12 --- func_FileView.php 1 Feb 2005 15:11:01 -0000 1.13 *************** *** 9,28 **** * @author Brian A Cheeseman <bch...@us...> * @version $Id$ ! * @copyright 2003-2004 Brian A Cheeseman **/ if ($config['GeSHi']['Enable']) { ! include_once($config['GeSHi']['Path'].'/geshi.php'); } function DisplayFileContents($File, $Revision = "") { ! global $config, $env; // Calculate the path from the $env['script_name'] variable. ! $env['script_path'] = substr($env['script_name'], 0, strrpos($env['script_name'], "/")); ! if ($env['script_path'] == ""){ ! $env['script_path'] = "/"; ! } // Create our CVS connection object and set the required properties. --- 9,26 ---- * @author Brian A Cheeseman <bch...@us...> * @version $Id$ ! * @copyright 2003-2005 Brian A Cheeseman **/ if ($config['GeSHi']['Enable']) { ! include_once($config['GeSHi']['Path'].'/geshi.php'); } function DisplayFileContents($File, $Revision = "") { ! global $config, $env, $lang; // Calculate the path from the $env['script_name'] variable. ! $env['script_path'] = substr($env['script_name'], 0, strrpos($env['script_name'], '/')); ! $env['script_path'] = (empty($env['script_path']))? '/' : $env['script_path']; // Create our CVS connection object and set the required properties. *************** *** 47,65 **** $Response = $CVSServer->ExportFile($File, $Revision); if ($Response !== true) { ! return; } // Add the quick link navigation bar. ! echo GetQuickLinkBar($env['mod_path'], "Code view for: ", true, true, $Revision); echo "<hr />\n"; if ($config['GeSHi']['Enable']) { ! // Create the GeSHi instance and parse the output. // TODO: setup code to auto identify the highlighting class to use for current file. ! $FileExt = substr($File, strrpos($File, ".")+1); $Language = guess_highlighter($FileExt); if (is_array($Language)) { ! $Language = $Language[0]; } --- 45,63 ---- $Response = $CVSServer->ExportFile($File, $Revision); if ($Response !== true) { ! return; } // Add the quick link navigation bar. ! echo GetQuickLinkBar($env['mod_path'], $lang['code_view'], true, true, $Revision); echo "<hr />\n"; if ($config['GeSHi']['Enable']) { ! // Create the GeSHi instance and parse the output. // TODO: setup code to auto identify the highlighting class to use for current file. ! $FileExt = substr($File, strrpos($File, '.')+1); $Language = guess_highlighter($FileExt); if (is_array($Language)) { ! $Language = $Language[0]; } *************** *** 71,84 **** // Display the file contents. ! echo "<table class=\"source\"><tr><td>"; echo $hlcontent; ! echo "</td></tr></table>"; } else { $search = array('<', '>', '\n', '\t'); ! $replace = array("<", ">", "", " "); $content = str_replace($search, $replace, $CVSServer->FILECONTENTS); ! $source = explode("\n", $content); $soure_size = sizeof($source); --- 69,82 ---- // Display the file contents. ! echo '<table class="source"><tr><td>'; echo $hlcontent; ! echo '</td></tr></table>'; } else { $search = array('<', '>', '\n', '\t'); ! $replace = array('<', '>', '', ' '); $content = str_replace($search, $replace, $CVSServer->FILECONTENTS); ! $source = explode('\n', $content); $soure_size = sizeof($source); *************** *** 94,98 **** $CVSServer->Disconnect(); } else { ! echo "ERROR: Could not connect to the PServer.<br>\n"; } echo GetPageFooter(); --- 92,96 ---- $CVSServer->Disconnect(); } else { ! echo $lang['err_connect']; } echo GetPageFooter(); Index: cvsview.php =================================================================== RCS file: /cvsroot/phpcvsview/phpcvsview/cvsview.php,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** cvsview.php 23 Jan 2005 01:47:56 -0000 1.19 --- cvsview.php 1 Feb 2005 15:11:00 -0000 1.20 *************** *** 9,47 **** * @author Brian A Cheeseman <bch...@us...> * @version $Id$ ! * @copyright 2003-2004 Brian A Cheeseman **/ require_once 'config.php'; ! global $config, $env, $ThemeName; $REPOS = ""; $env['script_name'] = $_SERVER['PHP_SELF']; $env['script_path'] = substr($env['script_name'], 0, strrpos($env['script_name'], "/")); ! if ($env['script_path'] == "") { ! $env['script_path'] = "/"; ! } if (isset($_GET["tm"])) { ! $ThemeName = $_GET["tm"]; ! } else { ! if (isset($_COOKIE["theme"])) { ! $ThemeName = $_COOKIE["theme"]; ! } ! else ! { ! $ThemeName = "Default"; ! } } ! // Re-Set our cookie with the theme name in it. This cookie is set to expire 1 Year from today. ! // This was done as there is no way to stop a cookie expiring. ! setcookie("theme", $ThemeName, time()+31536000, "/"); ! require_once "Themes/$ThemeName/theme.php"; require_once 'phpcvs.php'; require_once 'phpcvsmime.php'; - require_once 'utils.php'; require_once 'func_DirListing.php'; require_once 'func_FileHistory.php'; --- 9,51 ---- * @author Brian A Cheeseman <bch...@us...> * @version $Id$ ! * @copyright 2003-2005 Brian A Cheeseman **/ require_once 'config.php'; + require_once 'utils.php'; ! global $config, $env; $REPOS = ""; $env['script_name'] = $_SERVER['PHP_SELF']; $env['script_path'] = substr($env['script_name'], 0, strrpos($env['script_name'], "/")); + $env['script_path'] = (empty($env['script_path']))? '/' : $env['script_path']; + $env['language_path'] = 'languages/'; + $env['theme_path'] = 'Themes/'; ! // check if cookie exist, if so use cookie, otherwise use config value ! // then verify that config value is a valid entry ! $config['language'] = (empty($_COOKIE['config']['lang'])) ? $config['language'] : $_COOKIE['config']['lang']; ! $config['language'] = (in_array($config['language'], GetLanguagesList(), false)) ? $config['language'] : 'en'; ! ! $config['theme'] = (empty($_COOKIE['config']['theme'])) ? $config['theme'] : $_COOKIE['config']['theme']; ! $config['theme'] = (in_array($config['theme'], GetThemeList(), false)) ? $config['theme'] : 'Default'; if (isset($_GET["tm"])) { ! $config['theme'] = $_GET["tm"]; ! // Set cookie with theme info. This cookie is set to expire 1 year from today. ! setcookie("config[theme]", $config['theme'], time()+31536000, "/"); } ! if(isset($_GET["lg"])){ ! $config['language'] = $_GET["lg"]; ! // Set cookie with language info. This cookie is set to expire 1 year from today. ! setcookie('config[lang]', $config['language'], time()+31536000, "/"); ! } ! require_once $env['theme_path'] . $config['theme']."/theme.php"; ! require_once $env['language_path'] . $config['language'] .'.php'; require_once 'phpcvs.php'; require_once 'phpcvsmime.php'; require_once 'func_DirListing.php'; require_once 'func_FileHistory.php'; *************** *** 52,74 **** // Check for a module path ! if (isset($_GET["mp"])) { ! $env['mod_path'] = $_GET["mp"]; ! } else { ! $env['mod_path'] = "/"; ! } ! $env['mod_path'] = str_replace("//", "/", $env['mod_path']); if (isset($_GET["fh"])) { ! DisplayFileHistory(); } else { if (isset($_GET["fa"])) { ! DisplayFileAnnotation($env['mod_path'], $_GET["fa"]); } else { if (isset($_GET["fv"])) { ! DisplayFileContents($env['mod_path'], $_GET["dt"]); } else { if (isset($_GET["fd"])) { ! DownloadFile($env['mod_path'], $_GET["dt"]); } else --- 56,73 ---- // Check for a module path ! $env['mod_path'] = (isset($_GET["mp"])) ? $_GET["mp"] : "/"; $env['mod_path'] = str_replace("//", "/", $env['mod_path']); if (isset($_GET["fh"])) { ! DisplayFileHistory(); } else { if (isset($_GET["fa"])) { ! DisplayFileAnnotation($env['mod_path'], $_GET["fa"]); } else { if (isset($_GET["fv"])) { ! DisplayFileContents($env['mod_path'], $_GET["dt"]); } else { if (isset($_GET["fd"])) { ! DownloadFile($env['mod_path'], $_GET["dt"]); } else Index: func_FileAnnotation.php =================================================================== RCS file: /cvsroot/phpcvsview/phpcvsview/func_FileAnnotation.php,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** func_FileAnnotation.php 6 Oct 2004 08:40:29 -0000 1.7 --- func_FileAnnotation.php 1 Feb 2005 15:11:01 -0000 1.8 *************** *** 9,24 **** * @author Brian A Cheeseman <bch...@us...> * @version $Id$ ! * @copyright 2003-2004 Brian A Cheeseman **/ function DisplayFileAnnotation($File, $Revision = "") { ! global $config, $env; // Calculate the path from the $env['script_name'] variable. ! $env['script_path'] = substr($env['script_name'], 0, strrpos($env['script_name'], "/")); ! if ($env['script_path'] == "") { ! $env['script_path'] = "/"; ! } // Create our CVS connection object and set the required properties. --- 9,22 ---- * @author Brian A Cheeseman <bch...@us...> * @version $Id$ ! * @copyright 2003-2005 Brian A Cheeseman **/ function DisplayFileAnnotation($File, $Revision = "") { ! global $config, $env, $lang; // Calculate the path from the $env['script_name'] variable. ! $env['script_path'] = substr($env['script_name'], 0, strrpos($env['script_name'], '/')); ! $env['script_path'] = (empty($env['script_path']))? '/' : $env['script_path']; // Create our CVS connection object and set the required properties. *************** *** 40,53 **** $Response = $CVSServer->Annotate($File, $Revision); if ($Response !== true) { ! return; } // Start the output for the table. ! echo "<hr />\n"; ! echo "<table border=\"0\" cellpadding=\"2\" cellspacing=\"0\" width=\"100%\">\n"; ! $RowClass = "row1"; $search = array('<', '>', '\n'); ! $replace = array("<", ">", ""); $PrevRev = ""; $FirstLine = true; --- 38,51 ---- $Response = $CVSServer->Annotate($File, $Revision); if ($Response !== true) { ! return; } // Start the output for the table. ! echo '<hr />'."\n"; ! echo '<table border="0" cellpadding="2" cellspacing="0" width="100%">' ."\n"; ! $RowClass = 'row1'; $search = array('<', '>', '\n'); ! $replace = array('<', '>', ''); $PrevRev = ""; $FirstLine = true; *************** *** 55,68 **** if (strcmp($PrevRev, $Annotation["Revision"]) != 0) { if (!$FirstLine) { ! "</pre></td></tr>\n"; } else { $FirstLine = false; } ! echo "<tr class=\"$RowClass\"><td>".$Annotation["Revision"]."</td><td>".$Annotation["Author"]; ! echo "</td><td>".$Annotation["Date"]."</td><td><pre>".str_replace($search, $replace, $Annotation["Line"]); ! if ($RowClass == "row1") { ! $RowClass = "row2"; } else { ! $RowClass = "row1"; } } else{ --- 53,66 ---- if (strcmp($PrevRev, $Annotation["Revision"]) != 0) { if (!$FirstLine) { ! echo "</pre></td></tr>\n"; } else { $FirstLine = false; } ! echo '<tr class="'.$RowClass.'"><td>'.$Annotation["Revision"].'</td><td>'.$Annotation["Author"]; ! echo '</td><td>'.$Annotation["Date"].'</td><td><pre>'.str_replace($search, $replace, $Annotation["Line"]); ! if ($RowClass == 'row1') { ! $RowClass = 'row2'; } else { ! $RowClass = 'row1'; } } else{ *************** *** 71,80 **** $PrevRev = $Annotation["Revision"]; } ! echo "</table><hr />\n"; // Close the connection. $CVSServer->Disconnect(); } else{ ! echo "ERROR: Could not connect to the PServer.<br />\n"; } echo GetPageFooter(); --- 69,78 ---- $PrevRev = $Annotation["Revision"]; } ! echo '</table><hr />'."\n"; // Close the connection. $CVSServer->Disconnect(); } else{ ! echo $lang['err_connect']; } echo GetPageFooter(); |