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 $base = $_SERVER['DOCUMENT_ROOT'];
19 function menu_css () {
22 $lines = @file ("$base/css/Menus.css")
23 or die ("Unable to open $base/css/Menus.css");
25 print "<style type=\"text/css\">\n";
27 foreach ($lines as $line) {
36 <div class="imrcmain0 imgl" style="width:100%;z-index:999999;position:relative;">
37 <div class="imcm imde" id="imouter0">
39 <li class="imatm" style="width:100px;"><a href="/"><span class="imea imeam"></span>Home</a></li>
41 <li class="imatm" style="width:145px;">
42 <a class="" href="/services"><span class="imea imeam"><span></span></span>Services</a>
45 <div class="imsubc" style="width:145px;top:0px;left:0px;">
47 <li><a href="/services/consultancy.php">Consultancy</a></li>
48 <li><a href="/services/custom_software.php">Custom Software Solutions</a></li>
49 <li><a href="/services/sysadmin.php">Systems Adminsitration</a></li>
50 <li><a href="/services/web.php">Web Applications</a></li>
51 <li><a href="/services/customers.php">Customers</a></li>
57 <li class="imatm" style="width:145px;">
58 <a class="" href="/services/scm"><span class="imea imeam"><span></span></span>SCM</a>
61 <div class="imsubc" style="width:145px;top:0px;left:0px;">
63 <li><a href="/clearcase"><span class="imea imeas"><span></span></span>Clearcase</a>
65 <div class="imsubc" style="width:140px;top:-23px;left:132px;">
67 <li><a href="/clearcase/triggers.php">Triggers</a></li>
68 <li><a href="/php/scm_man.php?file=cc/etf.pl">Evil Twin Finder</a></li>
69 <li><a href="/php/scm_man.php?file=cc/diffbl.pl">GUI DiffBL</a></li>
70 <li><a href="/php/scm_man.php?file=clearadm/viewager.cgi">View Ager</a></li>
71 <li><a href="/clearcase/OpenSourceBuild.php/">Open Source Builds</a></li>
76 <li><a href="/clearquest"><span class="imea imeas"><span></span></span>Clearquest</a>
78 <div class="imsubc" style="width:140px;top:-23px;left:132px;">
80 <li><a href="/clearquest/cqd">Clearquest Daemon</a></li>
81 <li><a href="/clearquest/db.php">DB Conversions</a></li>
86 <li><a href="/scm"><span class="imea imeas"><span></span></span>Git</a>
88 <div class="imsubc" style="width:140px;top:-23px;left:132px;">
90 <li><a href="/gitweb/?p=.git;a=tree">Respository</a></li>
100 <li class="imatm" style="width:145px;"><a href="/scripts"><span class="imea imeam"><span></span></span>Scripting</a>
102 <div class="imsubc" style="width:146px;top:0px;left:0px;">
104 <li><a href="/scripts/perl.php">Perl</a></li>
105 <li><a href="/scripts/ecrd">ECRDig</a></li>
111 <li class="imatm" style="width:145px;"><a href="/sysadm"><span class="imea imeam"><span></span></span>Sysadm</a>
113 <div class="imsubc" style="width:146px;top:0px;left:0px;">
115 <li><a href="/sysadm/env">Environment</a></li>
121 <li class="imatm" style="width:145px;"><a href="#"><span class="imea imeam"><span></span></span>About</a>
123 <div class="imsubc" style="width:146px;top:0px;left:0px;">
125 <li><a href="/services">Services</a></li>
126 <li><a href="/people.php">Our People</a></li>
127 <li><a href="/contact.php">Contact Us</a></li>
134 <div class="imclear"> </div>
140 function heading () {
141 print "<div id=head>";
144 <h1 style="color:#fff;text-align:center;font-size:3em">ClearSCM Inc.</h1>
146 <div class="filtered">
147 <p><strong>You are viewing an unstyled version of this
148 page.</strong> Either your browser does not support Cascading
149 Style Sheets (CSS) or CSS styling has been disabled.</p>
154 function start_box ($type) {
156 <!--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">
160 function end_box () {
162 <!--A--> </div><b class="xbottom"><b class="xb4"></b><b class="xb3"></b><b class="xb2"></b><b class="xb1"></b></b></div></div>
166 function search_box () {
169 <!-- Start: Search my site with Google -->
170 <form method="get" action="http://www.google.com/search" name="search">
172 <input type="text" name="q" size="15" id="q" maxlength=255 value=""
173 onclick="document.search.q.value='';">
174 <input type="hidden" name="domains" value="clearscm.com">
175 <input type="hidden" name="sitesearch" value="clearscm.com">
178 <!-- End: Search my site with Google -->
184 function copyright ($start_year = "",
185 $author = "Andrew DeFaria",
186 $email = "info@clearscm.com",
191 $current_year = $today ["year"];
193 $this_file = $base . "/" . $_SERVER['PHP_SELF'];
195 $mod_time = date ("F d Y @ g:i a", filemtime ($this_file));
199 Last modified: $mod_time<br>
200 Copyright ©
203 if ($start_year != "") {
204 print "$start_year-";
208 $current_year, ClearSCM Inc. - All rights reserved
213 function display_contents_as_code ($contents) {
214 print "<div class=code>";
215 print "<table id=listing cellspacing=0 cellpadding=2 border=0 width=90%>";
219 foreach ($contents as $line) {
221 print " <td id=line-number><a name=line_$line_number></a>" .
222 $line_number++ . "</td>";
223 print " <td id=code><tt>";
225 for ($i = 0; $i < strlen ($line); $i++) {
226 if ($line [$i] == " ") {
227 if ($i == 0 && $line_number == 2) {
231 } else if ($line [$i] == "\t") {
232 echo " ";
233 } else if ($line [$i] != "\n") {
244 } // display_contents_as_code
246 function display_contents_as_snippet ($contents) {
247 print "<div class=code>";
249 foreach ($code as $line) {
250 for ($i = 0; $i < strlen ($line); $i++) {
251 if ($line [$i] == " ") {
253 } else if ($line [$i] == "\t") {
254 echo " ";
255 } else if ($line [$i] != "\n") {
262 } // display_contents_as_snippet
264 function display_code ($file) {
265 display_contents_as_code (getSCMFile ($file));
268 function scm_man ($file) {
270 0 => array ("pipe", "r"), // stdout
271 1 => array ("pipe", "w"), // stdin
272 2 => array ("pipe", "w"), // stderr
275 $pod2html = proc_open ("pod2html -cachedir /tmp -noindex -htmlroot=http://perldoc.perl.org", $desc_spec, $pipes);
277 if (!is_resource ($pod2html)) {
278 die ("Unable to start pod2html");
282 $stdout = $pipes [1];
283 $stderr = $pipes [2];
285 $contents = getSCMFile ($file);
288 foreach ($contents as $line) {
289 fwrite ($stdin, $line);
295 $url = "/gitweb/?p=.git;a=blob_plain;f=$file;hb=HEAD";
296 $history = "/gitweb/?p=.git;a=history;f=$file;hb=HEAD";
298 // Now get the output and write it out
299 while (!feof ($stdout)) {
300 $line = fgets ($stdout);
302 if (preg_match ("/<!-- INDEX END -->/", $line)) {
307 if (!$end_of_index) {
311 // Filter some CVS keywords properly
312 $line = preg_replace ("/\\\$Revision\:\s*(\S*)\s*\\\$/",
313 "Revision <a href=\"$history\">$1</a>",
315 $line = preg_replace ("/\\\$Date\:\s*(.*)\s*\\\$/",
318 $line = preg_replace ("/\\\$RCSfile\:\s*(\S*),v\s*\\\$/",
322 // Collapse adjacent <pre> sections to instead have a simple blank
324 if (preg_match ("/<\/pre>$/", $line)) {
325 $line = preg_replace ("/<\/pre>/", "", $line);
331 if (preg_match ("/^<pre>$/", $line)) {
332 if ($pre_just_ended) {
337 if ($pre_just_ended) {
339 echo "</pre></div>$line";
344 $line = preg_replace ("/<pre>/",
345 "<div class=code><pre>",
347 $line = preg_replace ("/<\/pre>/",
350 $line = preg_replace ("/<a name=.*>(.*)<\/a>/",
353 $line = preg_replace ("/NAME (\S*)<\/h1>/",
354 "NAME $1 <a href=\"$url\"><img src=\"/Icons/Download.jpg\" border=0 title=Download></a></h1>",
356 $line = preg_replace ("/NAME (\S*)<\/h2>/",
357 "NAME $1 <a href=\"$url\"><img src=\"/Icons/Download.jpg\" border=0 title=Download></a></h2>",
365 proc_close ($pod2html);