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 December 2010 3.3.0
- additional usability enhancements - additional usability enhancements
- PDF export: higher resolution for logos - PDF export: higher resolution for logos
- fixed bugs:
-> ignore comment lines in shells file (3107124)
28.10.2010 3.2.0 28.10.2010 3.2.0

View File

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