. * * Version 0.1 * Author: Daniel Larraz */ include_once $base_plugin.'php/paths.php'; include_once $base_plugin.'php/policies.php'; //------------------------------------------------------------------------------------------- function make_apache () /* ------------------------------------------------------------------------ */ { global $paths; global $section; global $plugin; global $url_plugin; $list ='
Apache Manager
'; $list .= make_certs_panel (); $list .= '
'; $list .= make_http_panel (); $list .='
'; $list .= '
'; $list .=' '; return $list; } /* ------------------------------------------------------------------------ */ function is_ssl_enabled($paths) /* ------------------------------------------------------------------------ */ { exec ("sudo ls ".$paths['ap2_ssl_link'], $ls); return ($ls[0] == $paths['ap2_ssl_link']); } /* ------------------------------------------------------------------------ */ function exists_cert ($filepath) /* ------------------------------------------------------------------------ */ { exec ("sudo ls ".$filepath, $return); return ( $return[0] == $filepath ); } /* ------------------------------------------------------------------------ */ function make_certs_panel () /* ------------------------------------------------------------------------ */ { global $paths; $list ='
HTTPS certificates
Server certificate
Server key
The private key has a password.
You have to input it so that Apache can use it.
Password:
Confirm password:
Individual settings
'.make_individual_http_panel().'
'; return $list; } /* ------------------------------------------------------------------------ */ function make_global_http_panel() /* ------------------------------------------------------------------------ */ { $list = '
Directory HTTP HTTPS
'; $list .= make_dir_row(''); return $list; } /* ------------------------------------------------------------------------ */ function make_individual_http_panel() /* ------------------------------------------------------------------------ */ { global $paths; $list = '
Directory HTTP HTTPS
'; $www_dir = opendir($paths['ap2_root']); while ($item = readdir($www_dir)) { if ( is_dir($paths['ap2_root'].$item) && $item != '..' && $item != '.') { $list .= make_dir_row($item); } } closedir($www_dir); $list .= '
'; return $list; } /* ------------------------------------------------------------------------ */ function make_dir_row($item) /* ------------------------------------------------------------------------ */ { global $paths; global $url_plugin; $http_radio = policy($paths, $item); $list = ' '; if ($http_radio == "global") { $img = $url_plugin.'images/default.png'; $list .= ''; } else { if ($http_radio == "http" || $http_radio == "both") { $img = $url_plugin.'images/check.png'; } else { $img = $url_plugin.'images/cross.png'; } $list .= ''; if ($http_radio == "https" || $http_radio == "both") { $img = $url_plugin.'images/check.png'; } else { $img = $url_plugin.'images/cross.png'; } $list .= ''; } $list .= '
/'.$item.'
'; return $list; } /* ------------------------------------------------------------------------ */ ?>