Skip to content
Snippets Groups Projects
Commit 5f6cab91 authored by Graham Cole's avatar Graham Cole
Browse files

Make projects page shut up about projects it doesn't have permission to nose about in

parent 036a0c29
No related branches found
No related tags found
No related merge requests found
......@@ -8,28 +8,33 @@ foreach ($dirlist as $file) {
$object=array();
$object['filename'] = $file;
$ini_array = array();
$ini_data = file("/var/projects/trac/".$file."/conf/trac.ini");
$filepath = "/var/projects/trac/".$file."/conf/trac.ini";
// read trac.ini for this project
if (is_readable($filepath) && ($ini_data = file($filepath)) != FALSE) {
$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);
$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")) {
// only list projects whose trac.ini sets public = true
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;
$object['name'] = $ini_array['name'];
if ($object['name']=="") $object['name'] = $file;
$object['descr'] = $ini_array['descr'];
$projects[$file]=$object;
}
}
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment