summaryrefslogtreecommitdiff
path: root/web/staticmoduleinfo.php
blob: 7f388c2cb1d8d9cca2e6c87907bbec060a7ce253 (plain)
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
<?php
session_start();
include('logo.html');
include('menulist.html');
include('static-configuration');
$module_path=$argv[1];
$module=$argv[2];
$maintainer=extract_field('maintainer',$module_path);
$author=extract_field('author',$module_path);
$summary=extract_field('summary',$module_path);
$see_also=extract_field('see_also',$module_path);
$description=htmlize_field('description',$module_path);
$example=extract_field('example',$module_path);
$dependencies=htmlspecialchars(shell_exec('tools/ccan_depends --direct '.$module_path));
$extdepends=htmlspecialchars(shell_exec('tools/ccan_depends --compile --non-ccan '.$module_path));
$licence=extract_field('licence',$module_path);
$license=extract_field('license',$module_path);
$url_prefix = getenv("URLPREFIX");
?>
<div class='content moduleinfo'>

<p><a href="<?=$repo_base.$module?>">Browse Source</a> <a href="<?=$url_prefix?><?=$tar_dir?>/with-deps/<?=$module?>.tar.bz2">Download</a> <a href="<?=$url_prefix?><?=$tar_dir?>/<?=$module?>.tar.bz2">(without any required ccan dependencies)</a></p>

<h3>Module:</h3>
<p><?=$module?></p>

<h3>Summary:</h3>
<p><?=$summary?></p>

<?php
if ($maintainer) {
?>
<h3>Maintainer:</h3>
<p><?=$maintainer?></p>
<?php
}

if ($author) {
?>
<h3>Author:</h3>
<p><?=$author?></p>
<?php
}

if ($dependencies) {
?>
<h3>Dependencies:</h3>
<ul class='dependencies'>
<?php
	foreach (preg_split("/\s+/", $dependencies) as $dep) {
		if ($dep) {
			echo '<li><a href="'.substr($dep, 5).'.html">'.$dep.'</a></li>';
		}
        }
?>
</ul>

<?php 
}

if ($extdepends) {
?>
<h3>External dependencies:</h3>
<ul class='external-dependencies'>
<?php
	foreach (split("\n", $extdepends) as $dep) {
		$fields=preg_split("/\s+/", $dep);
		echo "<li>" . $fields[0].' ';
		if (count($fields) > 1)
			echo '(version '.$fields[1].') ';
		echo '</li>';
        }
?>
</ul>
<?php 
}
?>

<h3>Description:</h3>
<p><?=$description;?></p>

<?php 
if ($see_also) {
?>
<h3>See Also:</h3>
<ul class='see-also'>
<?php
	foreach (preg_split("/[\s,]+/", trim($see_also)) as $see) {
		echo '<li><a href="'.substr($see, 5).'.html">'.$see.'</a></li>';
        }
?>
</ul>
<?php
}

if ($example) {
?>
<h3>Example:</h3>
<pre class="prettyprint">
<code class="language-c"><?=$example?></code>
</pre>
<?php
}

if ($license) {
?>
<h3>License:</h3>
<p><?=$license?></p>
<?php
}
?>
</div>
</body></html>