diff --git a/components/projects.php b/components/projects.php index 0c090b71ca066056ee52c68fcc21914cfa376d3c..66bcd43789ac9fc7a90bfb977b0095bfb467d4e0 100644 --- a/components/projects.php +++ b/components/projects.php @@ -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; + } } } }