From: <dw...@us...> - 2010-12-26 16:49:27
|
Revision: 61 http://nagios.svn.sourceforge.net/nagios/?rev=61&view=rev Author: dworth Date: 2010-12-26 16:49:21 +0000 (Sun, 26 Dec 2010) Log Message: ----------- correct trimming at read-time and minor cruft cleaning Modified Paths: -------------- nagiosvshell/branches/devel/data/read_perms.php Modified: nagiosvshell/branches/devel/data/read_perms.php =================================================================== --- nagiosvshell/branches/devel/data/read_perms.php 2010-12-26 16:49:15 UTC (rev 60) +++ nagiosvshell/branches/devel/data/read_perms.php 2010-12-26 16:49:21 UTC (rev 61) @@ -65,24 +65,22 @@ while(!feof($cgi)) //read through file and assign host and service status into separate arrays { - $line = fgets($cgi); //Gets a line from file pointer. if (!preg_match('/^\s*#/', $line) && preg_match($keyword_regex, $line, $keyword_matches)) { $perm = $keyword_matches[1]; - trim($line); - list($actual_perm, $userlist) = explode('=', $line, 2); + list($actual_perm, $userlist) = explode('=', trim($line), 2); $permusers = explode(',', $userlist); - foreach($permusers as $user) { $user = trim($user); } + array_walk($permusers, create_function('&$v', 'trim($v);')); $perms[$perm] = $permusers; } - }//end of WHILE + } fclose($cgi); return array('permissions' => $perms); -}//end of FUNCTION +} ?> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |