fixed bug 3107124, config/shell parsing

This commit is contained in:
Roland Gruber 2010-11-11 18:54:52 +00:00
parent 106462ced7
commit cac820c1ad
2 changed files with 13 additions and 12 deletions

View File

@ -1,6 +1,8 @@
December 2010 3.3.0
- additional usability enhancements
- PDF export: higher resolution for logos
- fixed bugs:
-> ignore comment lines in shells file (3107124)
28.10.2010 3.2.0

View File

@ -39,24 +39,23 @@ $Id$
* @return array list of shell names
*/
function getshells() {
$return = array();
$shellPath = dirname(__FILE__) . '/../config/shells';
// Load shells from file
// load shells from file
if (file_exists($shellPath)) {
$shells = file($shellPath);
$i = 0;
while (count($shells) > $i) {
// remove whitespaces
trim($shells[$i]);
// remove lineend
$shells[$i] = substr($shells[$i], 0, strpos($shells[$i], "\n"));
for ($i = 0; $i < sizeof($shells); $i++) {
// remove whitespaces and line end
$shells[$i] = trim($shells[$i]);
// remove comments
if ($shells[$i]{0}=='#') unset ($shells[$i]);
else $i++;
if ((strlen($shells[$i]) == 0) || $shells[$i]{0}=='#') {
continue;
}
$return[] = $shells[$i];
}
// $shells is array with all valid shells
return $shells;
return $return;
}
else return array();
return $return;
}