X-Git-Url: https://defaria.com/gitweb/?a=blobdiff_plain;f=web%2Fphp%2Fclearscm.php;h=e43d016881e8d5cd4375385cdd19893b61fdcc67;hb=4e6b4fea57d9c7b9ac35b47afcb45a8c3e2b0e81;hp=5b4bf11ffa1581a4c801e223f278b927a80459ee;hpb=020a4a5ea2be725b155cae3a2cadc9aba3911b9b;p=clearscm.git diff --git a/web/php/clearscm.php b/web/php/clearscm.php index 5b4bf11..e43d016 100644 --- a/web/php/clearscm.php +++ b/web/php/clearscm.php @@ -12,6 +12,10 @@ // (c) Copyright 2007, ClearSCM Inc., all rights reserved // //////////////////////////////////////////////////////////////////////////////// +include_once "scm.php"; + +date_default_timezone_set('America/Los_Angeles'); + $base = $_SERVER['DOCUMENT_ROOT']; function menu_css () { @@ -63,9 +67,9 @@ function menu () {
@@ -81,11 +85,11 @@ function menu () { -
  • CVS +
  • Git
    @@ -184,12 +188,11 @@ function copyright ($start_year = "", $email = "info@clearscm.com", $home = "") { global $base; - global $base1; $today = getdate (); $current_year = $today ["year"]; - $this_file = $base1 . "/" . $_SERVER['PHP_SELF']; + $this_file = $base . "/" . $_SERVER['PHP_SELF']; $mod_time = date ("F d Y @ g:i a", filemtime ($this_file)); @@ -209,20 +212,6 @@ $current_year, ClearSCM Inc. - All rights reserved END; } // copyright -function get_file_from_cvs ($file, - $machine = "clearscm.com", - $port = ":8080", - $path = "/viewvc/clearscm.com/") { - $user = "andrew"; - $password = "airafed"; - $url = "http://$user:$password@$machine$port$path$file?view=co"; - - $contents = @file ($url) - or die ("$url not found"); - - return $contents; -} # get_file_from_cvs - function display_contents_as_code ($contents) { print "
    "; print ""; @@ -274,18 +263,11 @@ function display_contents_as_snippet ($contents) { print ""; } // display_contents_as_snippet -function display_code ($file, - $machine = "clearscm.com", - $port = ":8080", - $path = "/viewvc/clearscm.com/") { - display_contents_as_code (get_file_from_cvs ($file, $machine, $port, $path)); +function display_code ($file) { + display_contents_as_code (getSCMFile ($file)); } # display_code -function cvs_man ($file, - $machine = "clearscm.com", - $port = ":8080", - $path = "/viewvc/clearscm.com/") { - +function scm_man ($file) { $desc_spec = array ( 0 => array ("pipe", "r"), // stdout 1 => array ("pipe", "w"), // stdin @@ -302,7 +284,7 @@ function cvs_man ($file, $stdout = $pipes [1]; $stderr = $pipes [2]; - $contents = get_file_from_cvs ($file, $machine, $port, $path); + $contents = getSCMFile ($file); // Write to stdin foreach ($contents as $line) { @@ -310,27 +292,15 @@ function cvs_man ($file, } // foreach fclose ($stdin); - $end_of_index = 0; - $pre_just_ended = 0; - $machine = "clearscm.com"; - $port = ""; - $path = "/viewvc/clearscm.com/"; - $url = "http://$machine$port$path$file?view=co"; - $history = "http://$machine$port$path$file"; + $end_of_index = 0; + $pre_just_ended = 0; + $url = "/gitweb/?p=clearscm.git;a=blob_plain;f=$file;hb=HEAD"; + $history = "/gitweb/?p=clearscm.git;a=history;f=$file;hb=HEAD"; // Now get the output and write it out while (!feof ($stdout)) { $line = fgets ($stdout); - if (preg_match ("//", $line)) { - $end_of_index = 1; - continue; - } - - if (!$end_of_index) { - continue; - } // if - // Filter some CVS keywords properly $line = preg_replace ("/\\\$Revision\:\s*(\S*)\s*\\\$/", "Revision $1", @@ -383,13 +353,8 @@ function cvs_man ($file, } // while fclose ($stdout); - - //while (!feof ($stderr)) { - // echo fgets ($stderr) . "
    "; - //} // while - fclose ($stderr); proc_close ($pod2html); -} // cvs_man +} // scm_man ?>