2 ////////////////////////////////////////////////////////////////////////////////
4 // File: $RCSfile: clearscm.php,v $
5 // Revision: $Revision: 1.23 $
6 // Description: Reports large files
7 // Author: Andrew@DeFaria.com
8 // Created: Wed Apr 11 18:37:09 2007
9 // Modified: $Date: 2013/03/18 22:46:55 $
12 // (c) Copyright 2007, ClearSCM Inc., all rights reserved
14 ////////////////////////////////////////////////////////////////////////////////
15 include_once "scm.php";
17 date_default_timezone_set('America/Los_Angeles');
19 $base = $_SERVER['DOCUMENT_ROOT'];
21 function menu_css () {
24 $lines = @file ("$base/css/Menus.css")
25 or die ("Unable to open $base/css/Menus.css");
27 print "<style type=\"text/css\">\n";
29 foreach ($lines as $line) {
38 <div class="imrcmain0 imgl" style="width:100%;z-index:999999;position:relative;">
39 <div class="imcm imde" id="imouter0">
41 <li class="imatm" style="width:100px;"><a href="/"><span class="imea imeam"></span>Home</a></li>
43 <li class="imatm" style="width:145px;">
44 <a class="" href="/services"><span class="imea imeam"><span></span></span>Services</a>
47 <div class="imsubc" style="width:145px;top:0px;left:0px;">
49 <li><a href="/services/consultancy.php">Consultancy</a></li>
50 <li><a href="/services/custom_software.php">Custom Software Solutions</a></li>
51 <li><a href="/services/sysadmin.php">Systems Adminsitration</a></li>
52 <li><a href="/services/web.php">Web Applications</a></li>
53 <li><a href="/services/customers.php">Customers</a></li>
59 <li class="imatm" style="width:145px;">
60 <a class="" href="/services/scm"><span class="imea imeam"><span></span></span>SCM</a>
63 <div class="imsubc" style="width:145px;top:0px;left:0px;">
65 <li><a href="/clearcase"><span class="imea imeas"><span></span></span>Clearcase</a>
67 <div class="imsubc" style="width:140px;top:-23px;left:132px;">
69 <li><a href="/clearcase/triggers.php">Triggers</a></li>
70 <li><a href="/php/scm_man.php?file=cc/etf.pl">Evil Twin Finder</a></li>
71 <li><a href="/php/scm_man.php?file=cc/diffbl.pl">GUI DiffBL</a></li>
72 <li><a href="/php/scm_man.php?file=clearadm/viewager.cgi">View Ager</a></li>
73 <li><a href="/clearcase/OpenSourceBuild.php/">Open Source Builds</a></li>
78 <li><a href="/clearquest"><span class="imea imeas"><span></span></span>Clearquest</a>
80 <div class="imsubc" style="width:140px;top:-23px;left:132px;">
82 <li><a href="/clearquest/cqd">Clearquest Daemon</a></li>
83 <li><a href="/clearquest/db.php">DB Conversions</a></li>
88 <li><a href="/scm"><span class="imea imeas"><span></span></span>Git</a>
90 <div class="imsubc" style="width:140px;top:-23px;left:132px;">
92 <li><a href="/gitweb/?p=clearscm.git">Repository</a></li>
102 <li class="imatm" style="width:145px;"><a href="/scripts"><span class="imea imeam"><span></span></span>Scripting</a>
104 <div class="imsubc" style="width:146px;top:0px;left:0px;">
106 <li><a href="/scripts/perl.php">Perl</a></li>
107 <li><a href="/scripts/ecrd">ECRDig</a></li>
113 <li class="imatm" style="width:145px;"><a href="/sysadm"><span class="imea imeam"><span></span></span>Sysadm</a>
115 <div class="imsubc" style="width:146px;top:0px;left:0px;">
117 <li><a href="/sysadm/env">Environment</a></li>
123 <li class="imatm" style="width:145px;"><a href="#"><span class="imea imeam"><span></span></span>About</a>
125 <div class="imsubc" style="width:146px;top:0px;left:0px;">
127 <li><a href="/services">Services</a></li>
128 <li><a href="/people.php">Our People</a></li>
129 <li><a href="/contact.php">Contact Us</a></li>
136 <div class="imclear"> </div>
142 function heading () {
143 print "<div id=head>";
146 <h1 style="color:#fff;text-align:center;font-size:3em">ClearSCM Inc.</h1>
148 <div class="filtered">
149 <p><strong>You are viewing an unstyled version of this
150 page.</strong> Either your browser does not support Cascading
151 Style Sheets (CSS) or CSS styling has been disabled.</p>
156 function start_box ($type) {
158 <!--B--> <div class="rcbox"><div class="$type"><b class="xtop"><b class="xb1"></b><b class="xb2"></b><b class="xb3"></b><b class="xb4"></b></b><div class="xboxcontent">
162 function end_box () {
164 <!--A--> </div><b class="xbottom"><b class="xb4"></b><b class="xb3"></b><b class="xb2"></b><b class="xb1"></b></b></div></div>
168 function search_box () {
171 <!-- Start: Search my site with Google -->
172 <form method="get" action="http://www.google.com/search" name="search">
174 <input type="text" name="q" size="15" id="q" maxlength=255 value=""
175 onclick="document.search.q.value='';">
176 <input type="hidden" name="domains" value="clearscm.com">
177 <input type="hidden" name="sitesearch" value="clearscm.com">
180 <!-- End: Search my site with Google -->
186 function copyright ($start_year = "",
187 $author = "Andrew DeFaria",
188 $email = "info@clearscm.com",
193 $current_year = $today ["year"];
195 $this_file = $base . "/" . $_SERVER['PHP_SELF'];
197 $mod_time = date ("F d Y @ g:i a", filemtime ($this_file));
201 Last modified: $mod_time<br>
202 Copyright ©
205 if ($start_year != "") {
206 print "$start_year-";
210 $current_year, ClearSCM Inc. - All rights reserved
215 function display_contents_as_code ($contents) {
216 print "<div class=code>";
217 print "<table id=listing cellspacing=0 cellpadding=2 border=0 width=90%>";
221 foreach ($contents as $line) {
223 print " <td id=line-number><a name=line_$line_number></a>" .
224 $line_number++ . "</td>";
225 print " <td id=code><tt>";
227 for ($i = 0; $i < strlen ($line); $i++) {
228 if ($line [$i] == " ") {
229 if ($i == 0 && $line_number == 2) {
233 } else if ($line [$i] == "\t") {
234 echo " ";
235 } else if ($line [$i] != "\n") {
246 } // display_contents_as_code
248 function display_contents_as_snippet ($contents) {
249 print "<div class=code>";
251 foreach ($code as $line) {
252 for ($i = 0; $i < strlen ($line); $i++) {
253 if ($line [$i] == " ") {
255 } else if ($line [$i] == "\t") {
256 echo " ";
257 } else if ($line [$i] != "\n") {
264 } // display_contents_as_snippet
266 function display_code ($file) {
267 display_contents_as_code (getSCMFile ($file));
270 function scm_man ($file) {
272 0 => array ("pipe", "r"), // stdout
273 1 => array ("pipe", "w"), // stdin
274 2 => array ("pipe", "w"), // stderr
277 $pod2html = proc_open ("pod2html -cachedir /tmp -noindex -htmlroot=http://perldoc.perl.org", $desc_spec, $pipes);
279 if (!is_resource ($pod2html)) {
280 die ("Unable to start pod2html");
284 $stdout = $pipes [1];
285 $stderr = $pipes [2];
287 $contents = getSCMFile ($file);
290 foreach ($contents as $line) {
291 fwrite ($stdin, $line);
297 $url = "/gitweb/?p=clearscm.git;a=blob_plain;f=$file;hb=HEAD";
298 $history = "/gitweb/?p=clearscm.git;a=history;f=$file;hb=HEAD";
300 // Now get the output and write it out
301 while (!feof ($stdout)) {
302 $line = fgets ($stdout);
304 // Filter some CVS keywords properly
305 $line = preg_replace ("/\\\$Revision\:\s*(\S*)\s*\\\$/",
306 "Revision <a href=\"$history\">$1</a>",
308 $line = preg_replace ("/\\\$Date\:\s*(.*)\s*\\\$/",
311 $line = preg_replace ("/\\\$RCSfile\:\s*(\S*),v\s*\\\$/",
315 // Collapse adjacent <pre> sections to instead have a simple blank
317 if (preg_match ("/<\/pre>$/", $line)) {
318 $line = preg_replace ("/<\/pre>/", "", $line);
324 if (preg_match ("/^<pre>$/", $line)) {
325 if ($pre_just_ended) {
330 if ($pre_just_ended) {
332 echo "</pre></div>$line";
337 $line = preg_replace ("/<pre>/",
338 "<div class=code><pre>",
340 $line = preg_replace ("/<\/pre>/",
343 $line = preg_replace ("/<a name=.*>(.*)<\/a>/",
346 $line = preg_replace ("/NAME (\S*)<\/h1>/",
347 "NAME $1 <a href=\"$url\"><img src=\"/Icons/Download.jpg\" border=0 title=Download></a></h1>",
349 $line = preg_replace ("/NAME (\S*)<\/h2>/",
350 "NAME $1 <a href=\"$url\"><img src=\"/Icons/Download.jpg\" border=0 title=Download></a></h2>",
358 proc_close ($pod2html);