summaryrefslogtreecommitdiff
path: root/web/static-configuration
blob: 6686380521e1cf89dcbfb0cf9d66bb5f02107fd1 (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
<?php
//temp folder for uploads
$tempfolder = "/home/ccan/upload-temp/";

//location of upload script (for posting uploads)
$uploadscript = "http://ccodearchive.net/uploader.php";

//ccan admin
$ccanadmin = "rusty@rustcorp.com.au";

//email from 
$frommail = "ccan@ozlabs.org";

//tar home dir
$tar_dir = 'tarballs';

//where repo is: attach module name to browse
$repo_base = 'http://git.ozlabs.org/?p=ccan;a=tree;f=ccan/';

function extract_field($field,$module)
{
   return htmlspecialchars(shell_exec('tools/doc_extract '.$field.' '.$module.'/_info'));
}

// Convert double line breaks into paragraphs, and blank spaces into preformat.
function htmlize_field($field,$module)
{
   $state="inpara";
   $result="<p>";
   $raw=extract_field($field,$module);
   foreach (explode("\n", $raw) as $line) {
      if ($line == "") {
         switch ($state) {
	 case "inpara":
	    $state="endpara";
	    $result .= "</p>";
	    break;
	 }
      } else if ($line[0] == " " || $line[0] == "\t") {
         switch ($state) {
	 case "literal":
	    break;
	 case "inpara":
	    $result .= "</p>";
	 case "endpara":
	    $result .= "<pre>";
	    $state = "literal";
	 }
      } else {
         switch ($state) {
	 case "literal":
	    $result .= "</pre>";
	 case "endpara":
	    $result .= "<p>";
	    $state = "inpara";
	 }
      }
      $result .= $line . "\n";
   }

   switch ($state) {
      case "literal":
         $result .= "</pre>";
         break;
      case "inpara":
	 $result .= "</p>";
         break;
   }
   return $result;
}   
?>