Newer
Older
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
<?php
$dirlist = scandir("/var/projects/trac");
$projects = array();
foreach ($dirlist as $file) {
if ($file[0]!=".") {
$object=array();
$object['filename'] = $file;
$ini_array = array();
$ini_data = file("/var/projects/trac/".$file."/conf/trac.ini");
$projectsection = FALSE;
foreach ($ini_data as $ini_line) {
if (trim($ini_line) == "[project]") {
$projectsection = TRUE;
} else if ($projectsection && (1 == preg_match("/^\[.*\]$/", trim($ini_line)))) {
$projectsection = FALSE;
} else if ($projectsection) {
list($key, $value) = split("=", $ini_line);
$ini_array[trim($key)] = trim($value);
}
}
if (isset($ini_array['public']) && ($ini_array['public'] == "true")) {
$object['name'] = $ini_array['name'];
if ($object['name']=="") $object['name'] = $file;
$object['descr'] = $ini_array['descr'];
$projects[$file]=$object;
}
}
}
$smarty->assign("projects", $projects);
$output = $smarty->fetch("projects.tpl");
$smarty->assign("title", "Projects");
$smarty->assign("body", $output);
$sidebar = file_get_contents("../static/fragments/Projects-secondary.txt");
$smarty->assign("secondary", $sidebar);
?>