File: cvsgraphwrapper.php3

package info (click to toggle)
cvsgraph 1.1.2-4
  • links: PTS
  • area: main
  • in suites: woody
  • size: 264 kB
  • ctags: 325
  • sloc: ansic: 1,616; yacc: 596; lex: 338; makefile: 84; php: 42
file content (67 lines) | stat: -rw-r--r-- 2,164 bytes parent folder | download | duplicates (2)
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
<!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. */
	$cvsgraph = "/home/bertho/public_html/cvsgraph/cvsgraph";
	$cvsgraph_conf = "/home/bertho/public_html/cvsgraph/conf/cvsgraph.conf";

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

	/* Generate an imagemap */
	$mapname = "CvsGraphMap";
	$arg9 = "-9 '/~bertho/cvsgraph/'";
	$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=\"/~bertho/cvsgraph/mkimage.php3?r=$ur&m=$um&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="/~bertho/cvsgraph">CvsGraph</a> version 1.1.2
</address>
</body>
</html>