File: cvsgraphwrapper.php.in

package info (click to toggle)
cvsgraph 1.7.0-5
  • links: PTS
  • area: main
  • in suites: bullseye, buster, sid
  • size: 1,332 kB
  • sloc: ansic: 5,248; sh: 950; yacc: 440; lex: 212; makefile: 68
file content (69 lines) | stat: -rw-r--r-- 2,154 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 3.2//EN">
<?php
	/* Some basic checks are in place */
	isset($r) || die("CVSroot must be set\n");
	isset($m) || die("CVSmodule must be set\n");
	isset($f) || die("File must be set\n");
	if(strchr($r, "'") || strchr($m, "'") || strchr($f, "'"))
		die("Invalid characters in arguments\n");
?>
<html>
<head>
	<title> <?php echo "CvsGraph of '$f'\n"; ?></title>
	<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
	<meta name="generator" content="handcrafted">
</head>
<body bgcolor="#f0f0f0">
<center>
<?php
	/* I'll be paranoid, set root and module here so no one can get access elsewhere */
	/* Remove this or change it to suit your needs */
//	$r = "/home/cvsgraph";
//	$m = "cvsgraph";

	/* Shell escape, PHP4 has functions for this, use them */
	$sr = "'" . $r . "'";
	$sm = "'" . $m . "'";
	$sf = "'" . $f . ",v'";

	/* Image references must be encoded properly */
	$ur = urlencode($r);
	$um = urlencode($m);
	$uf = urlencode($f);
	if(isset($cvsroot) && $cvsroot != "")
		$ucr= "&cvsroot=" . urlencode($cvsroot);	/* The cvsweb.cgi root */
	else
		$ucr = "";

	/* I expose the paths here (accessible via the server). */
	/* Set this to a private place to make it secure. */
	$prefix = "@prefix@";
	$exec_prefix = "@exec_prefix@";
	$cvsgraph = "@bindir@/cvsgraph";
	$cvsgraph_conf = "@sysconfdir@/cvsgraph.conf";

	/* Print a head line */
	echo "<h1>CvsGraph of '$f'</h1>\n";

	/* Generate an imagemap */
	$mapname = "CvsGraphMap";
	$arg9 = "-9 './'";
	$arg8 = "-8 '$ucr'";
	$arg0 = "-0 'Branch:'";
	$arg1 = "-1 'Revision:'";
	$arg2 = "-2 'Diff:'";
	$argM = "-M '$mapname'";
	passthru("$cvsgraph $arg0 $arg1 $arg2 $arg8 $arg9 $argM -i -c $cvsgraph_conf -r $sr -m $sm $sf");

	/* Link a CvsGraph image */
	echo "<img border=\"0\" usemap=\"#$mapname\" src=\"./mkimage.php?r=$ur&amp;m=$um&amp;f=$uf\" alt=\"CvsGraph of '$f'\">\n";
	echo "<p>\nClick on the revisions/branches to display them\n";
	echo "<br>\nClick between the revisions to display the diffs\n";
?>
<hr>
</center>
<address>
Created with <a href="http://www.akhphd.au.dk/~bertho/cvsgraph/">CvsGraph</a>
</address>
</body>
</html>