98edf9b52a746b209ac916fe3b410f00b6d16eb0
[ccan] / web / staticmoduleinfo.php
1 <?php
2 session_start();
3 include('logo.html');
4 include('menulist.html');
5 include('static-configuration');
6 $module_path=$argv[1];
7 $module=$argv[2];
8 $maintainer=extract_field('maintainer',$module_path);
9 $author=extract_field('author',$module_path);
10 $summary=extract_field('summary',$module_path);
11 $see_also=extract_field('see_also',$module_path);
12 $description=htmlize_field('description',$module_path);
13 $example=extract_field('example',$module_path);
14 $dependencies=htmlspecialchars(shell_exec('tools/ccan_depends --direct '.$module_path));
15 $extdepends=htmlspecialchars(shell_exec('tools/ccan_depends --compile --non-ccan '.$module_path));
16 $licence=extract_field('licence',$module_path);
17 $license=extract_field('license',$module_path);
18 $url_prefix = getenv("URLPREFIX");
19 ?>
20 <div class='content'>
21 <table align="center" width="70%" border="0" cellpadding="3" cellspacing="1">
22 <tr align="center">
23 <td>
24 <a href="<?=$repo_base.$module?>">Browse Source</a>
25 </td>
26 <td>
27 <a href="<?=$url_prefix?><?=$tar_dir?>/with-deps/<?=$module?>.tar.bz2">Download</a>
28 <a href="<?=$url_prefix?><?=$tar_dir?>/<?=$module?>.tar.bz2">(without any required ccan dependencies)</a>
29 </tr>
30 </table>
31
32 <p>
33 </p>
34
35 <table align="center" width="70%" border="0" cellpadding="8" cellspacing="1">
36 <tr align="left">
37 <td><h3>Module: </h3> <?=$module?> </td>
38 </tr>
39
40 <tr align="left">
41 <td><h3>Summary: </h3> <?=$summary?></td>
42 </tr>
43
44 <?php
45 if ($maintainer) {
46 ?>
47 <tr align="left"> 
48 <td><h3>Maintainer: </h3> <?=$maintainer?></td>
49 </tr>
50 <?php
51 }
52
53 if ($author) {
54 ?>
55 <tr align="left"> 
56 <td><h3>Author: </h3> <?=$author?></td>
57 </tr>
58 <?php
59 }
60
61 if ($dependencies) {
62 ?>
63 <tr align="left">
64 <td><h3>Dependencies: </h3> <pre> <?php
65         foreach (preg_split("/\s+/", $dependencies) as $dep) {
66                 echo '<a href="'.substr($dep, 5).'.html">'.$dep.'</a> ';
67         }
68 ?></pre></td>
69 </tr>
70 <?php 
71 }
72
73 if ($extdepends) {
74 ?>
75 <tr align="left">
76 <td><h3>External dependencies: </h3> <?php
77         foreach (split("\n", $extdepends) as $dep) {
78                 $fields=preg_split("/\s+/", $dep);
79                 echo $fields[0].' ';
80                 if (count($fields) > 1)
81                         echo '(version '.$fields[1].') ';
82                 echo '<br>';
83         }
84 ?></td>
85 </tr>
86 <?php 
87 }
88 ?>
89 <tr align="left">
90 <td><h3>Description: </h3> <?=$description;?> </td>
91 </tr>
92
93 <?php 
94 if ($see_also) {
95 ?>
96 <tr align="left">
97 <td><h3>See Also: </h3> <pre> <?php
98         foreach (preg_split("/[\s,]+/", trim($see_also)) as $see) {
99                 echo '<a href="'.substr($see, 5).'.html">'.$see.'</a> ';
100         }
101 ?></pre></td>
102 </tr>
103 <?php
104 }
105
106 if ($example) {
107 ?>
108 <tr align="left"> 
109 <td><h3>Example: </h3> <pre><?=$example?></pre></td>
110 </tr>
111 <?php
112 }
113
114 if ($licence) {
115 ?>
116 <tr align="left"> 
117 <td><h3>License: </h3> <?=$licence?></td>
118 </tr>
119 <?php
120 }
121
122 if ($license) {
123 ?>
124 <tr align="left"> 
125 <td><h3>License: </h3> <?=$license?></td>
126 </tr>
127 <?php
128 }
129 ?>
130 </table>
131 </div>
132 </body></html>