staticmoduleinfo.php 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  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 moduleinfo'>
  21. <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>
  22. <h3>Module:</h3>
  23. <p><?=$module?></p>
  24. <h3>Summary:</h3>
  25. <p><?=$summary?></p>
  26. <?php
  27. if ($maintainer) {
  28. ?>
  29. <h3>Maintainer:</h3>
  30. <p><?=$maintainer?></p>
  31. <?php
  32. }
  33. if ($author) {
  34. ?>
  35. <h3>Author:</h3>
  36. <p><?=$author?></p>
  37. <?php
  38. }
  39. if ($dependencies) {
  40. ?>
  41. <h3>Dependencies:</h3>
  42. <ul class='dependencies'>
  43. <?php
  44. foreach (preg_split("/\s+/", $dependencies) as $dep) {
  45. if ($dep) {
  46. echo '<li><a href="'.substr($dep, 5).'.html">'.$dep.'</a></li>';
  47. }
  48. }
  49. ?>
  50. </ul>
  51. <?php
  52. }
  53. if ($extdepends) {
  54. ?>
  55. <h3>External dependencies:</h3>
  56. <ul class='external-dependencies'>
  57. <?php
  58. foreach (split("\n", $extdepends) as $dep) {
  59. $fields=preg_split("/\s+/", $dep);
  60. echo "<li>" . $fields[0].' ';
  61. if (count($fields) > 1)
  62. echo '(version '.$fields[1].') ';
  63. echo '</li>';
  64. }
  65. ?>
  66. </ul>
  67. <?php
  68. }
  69. ?>
  70. <h3>Description:</h3>
  71. <p><?=$description;?></p>
  72. <?php
  73. if ($see_also) {
  74. ?>
  75. <h3>See Also:</h3>
  76. <ul class='see-also'>
  77. <?php
  78. foreach (preg_split("/[\s,]+/", trim($see_also)) as $see) {
  79. echo '<li><a href="'.substr($see, 5).'.html">'.$see.'</a></li>';
  80. }
  81. ?>
  82. </ul>
  83. <?php
  84. }
  85. if ($example) {
  86. ?>
  87. <h3>Example:</h3>
  88. <pre class="prettyprint">
  89. <code class="language-c"><?=$example?></code>
  90. </pre>
  91. <?php
  92. }
  93. if ($license) {
  94. ?>
  95. <h3>License:</h3>
  96. <p><?=$license?></p>
  97. <?php
  98. }
  99. ?>
  100. </div>
  101. </body></html>