| | |
| | | |
| | | /* |
| | | This function returns a string that describes the installed |
| | | linux distribution. e.g. debian40 for Debian Linux 4.0 |
| | | Linux distribution. e.g. debian40 for Debian GNU/Linux 4.0 |
| | | */ |
| | | |
| | | |
| | |
| | | |
| | | //** Get distribution identifier |
| | | //** IMPORTANT! |
| | | // This is the same code as in /server/mods-available/monitor_core_module.inc.php |
| | | // So if you change it here, you also have to change it in |
| | | // /server/mods-available/monitor_core_module.inc.php! |
| | | // This is the same code as in server/mods-available/monitor_core_module.inc.php |
| | | // So if you change it here, you also have to change it in there! |
| | | function get_distname() { |
| | | |
| | | $distname = ''; |
| | |
| | | swriteln("Operating System: Gentoo $distver or compatible\n"); |
| | | |
| | | } else { |
| | | die('unrecognized linux distribution'); |
| | | die('unrecognized Linux distribution'); |
| | | } |
| | | |
| | | return array('name' => $distname, 'version' => $distver, 'id' => $distid, 'baseid' => $distbaseid); |
| | |
| | | } else { |
| | | return ''; |
| | | } |
| | | } |
| | | |
| | | function find_includes($file){ |
| | | global $httpd_root; |
| | | clearstatcache(); |
| | | if(is_file($file) && filesize($file) > 0){ |
| | | $includes[] = $file; |
| | | $inhalt = unix_nl(no_comments($file)); |
| | | $lines = explode("\n", $inhalt); |
| | | if(!empty($lines)){ |
| | | foreach($lines as $line){ |
| | | if(stristr($line, 'include ')){ |
| | | $include_file = str_replace("\n", '', trim(shell_exec("echo \"$line\" | awk '{print \$2}'"))); |
| | | if(substr($include_file,0,1) != '/'){ |
| | | $include_file = $httpd_root.'/'.$include_file; |
| | | } |
| | | if(is_file($include_file)){ |
| | | if($further_includes = find_includes($include_file)){ |
| | | $includes = array_merge($includes, $further_includes); |
| | | } |
| | | } else { |
| | | if(strstr($include_file, '*')){ |
| | | $more_files = explode("\n", shell_exec("ls -l $include_file | awk '{print \$9}'")); |
| | | if(!empty($more_files)){ |
| | | foreach($more_files as $more_file){ |
| | | if(is_file($more_file)){ |
| | | if($further_includes = find_includes($more_file)){ |
| | | $includes = array_merge($includes, $further_includes); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | unset($more_files); |
| | | $more_files = explode("\n", shell_exec("ls -l $include_file | awk '{print \$10}'")); |
| | | if(!empty($more_files)){ |
| | | foreach($more_files as $more_file){ |
| | | if(is_file($more_file)){ |
| | | if($further_includes = find_includes($more_file)){ |
| | | $includes = array_merge($includes, $further_includes); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | if(is_array($includes)){ |
| | | $includes = array_unique($includes); |
| | | return $includes; |
| | | } else { |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | function comment_out($file, $string){ |
| | |
| | | |
| | | } |
| | | |
| | | /* |
| | | * Get the port number of the ISPConfig controlpanel vhost |
| | | */ |
| | | |
| | | function get_ispconfig_port_number() { |
| | | global $conf; |
| | | $ispconfig_vhost_file = $conf['apache']['vhost_conf_dir'].'/ispconfig.vhost'; |
| | | |
| | | if(is_file($ispconfig_vhost_file)) { |
| | | $tmp = file_get_contents($ispconfig_vhost_file); |
| | | preg_match('/\<VirtualHost.*\:(\d{1,})\>/',$tmp,$matches); |
| | | $port_number = intval($matches[1]); |
| | | if($port_number > 0) { |
| | | return $port_number; |
| | | } else { |
| | | return '8080'; |
| | | } |
| | | } |
| | | } |
| | | |
| | | /* |
| | | * Get the port number of the ISPConfig controlpanel vhost |
| | | */ |
| | | |
| | | function is_ispconfig_ssl_enabled() { |
| | | global $conf; |
| | | $ispconfig_vhost_file = $conf['apache']['vhost_conf_dir'].'/ispconfig.vhost'; |
| | | |
| | | if(is_file($ispconfig_vhost_file)) { |
| | | $tmp = file_get_contents($ispconfig_vhost_file); |
| | | if(stristr($tmp,'SSLCertificateFile')) { |
| | | return true; |
| | | } else { |
| | | return false; |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | ?> |