| | |
| | | } |
| | | } |
| | | |
| | | function hasLine($filename, $search_pattern, $strict = 0) { |
| | | if($lines = @file($filename)) { |
| | | foreach($lines as $line) { |
| | | if($strict == 0) { |
| | | if(stristr($line, $search_pattern)) { |
| | | return true; |
| | | } |
| | | } else { |
| | | if(trim($line) == $search_pattern) { |
| | | return true; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | function is_installed($appname) { |
| | | exec('which '.escapeshellcmd($appname).' 2> /dev/null', $out, $returncode); |
| | | if(isset($out[0]) && stristr($out[0], $appname) && $returncode == 0) { |
| | |
| | | exec('date +%Z', $tzinfo); |
| | | $timezone = $tzinfo[0]; |
| | | } |
| | | |
| | | if(substr($timezone, 0, 1) === '/') $timezone = substr($timezone, 1); |
| | | |
| | | return $timezone; |
| | | } |