| 318 | 
           richard | 
           1 | 
           <?php
  | 
        
        
           | 2304 | 
           tom.houday | 
           2 | 
           # $Id: network.php 3287 2025-05-24 17:44:18Z rexy $
  | 
        
        
           | 2956 | 
           rexy | 
           3 | 
           // written by steweb57, Rexy, Tom HOUDAYER & Pierre RIVAULT
  | 
        
        
           | 318 | 
           richard | 
           4 | 
              | 
        
        
           | 861 | 
           richard | 
           5 | 
           /********************
  | 
        
        
           | 2316 | 
           tom.houday | 
           6 | 
           *  READ CONF FILES  *
  | 
        
        
           | 861 | 
           richard | 
           7 | 
           *********************/
  | 
        
        
           | 2316 | 
           tom.houday | 
           8 | 
           define('CONF_FILE', '/usr/local/etc/alcasar.conf');
  | 
        
        
            | 
            | 
           9 | 
           define('ETHERS_FILE', '/usr/local/etc/alcasar-ethers');
  | 
        
        
            | 
            | 
           10 | 
           define('ETHERS_INFO_FILE', '/usr/local/etc/alcasar-ethers-info');
  | 
        
        
           | 2558 | 
           rexy | 
           11 | 
           define('DNS_LOCAL_FILE', '/etc/hosts');
  | 
        
        
           | 2304 | 
           tom.houday | 
           12 | 
           define('LETS_ENCRYPT_FILE', '/usr/local/etc/alcasar-letsencrypt');
  | 
        
        
           | 2956 | 
           rexy | 
           13 | 
           define('TEMP_FILE', '/tmp/alcasar.conf.temp');
  | 
        
        
            | 
            | 
           14 | 
              | 
        
        
           | 2316 | 
           tom.houday | 
           15 | 
           $conf_files = [CONF_FILE, ETHERS_FILE, ETHERS_INFO_FILE, DNS_LOCAL_FILE, LETS_ENCRYPT_FILE];
  | 
        
        
            | 
            | 
           16 | 
              | 
        
        
            | 
            | 
           17 | 
           // Files reading test
  | 
        
        
            | 
            | 
           18 | 
           foreach ($conf_files as $file) {
  | 
        
        
            | 
            | 
           19 | 
           	if (!file_exists($file)) {
  | 
        
        
            | 
            | 
           20 | 
           		exit("Requested file $file isn't present");
  | 
        
        
            | 
            | 
           21 | 
           	}
  | 
        
        
            | 
            | 
           22 | 
           	if (!is_readable($file)) {
  | 
        
        
            | 
            | 
           23 | 
           		exit("Can't read the file $file");
  | 
        
        
            | 
            | 
           24 | 
           	}
  | 
        
        
           | 841 | 
           richard | 
           25 | 
           }
  | 
        
        
           | 2316 | 
           tom.houday | 
           26 | 
              | 
        
        
            | 
            | 
           27 | 
           // Read ALCASAR CONF_FILE
  | 
        
        
            | 
            | 
           28 | 
           $file_conf = fopen(CONF_FILE, 'r');
  | 
        
        
            | 
            | 
           29 | 
           if (!$file_conf) {
  | 
        
        
            | 
            | 
           30 | 
           	exit('Error opening the file '.CONF_FILE);
  | 
        
        
            | 
            | 
           31 | 
           }
  | 
        
        
            | 
            | 
           32 | 
           while (!feof($file_conf)) {
  | 
        
        
            | 
            | 
           33 | 
           	$buffer = fgets($file_conf, 4096);
  | 
        
        
            | 
            | 
           34 | 
           	if ((strpos($buffer, '=') !== false) && (substr($buffer, 0, 1) !== '#')) {
  | 
        
        
           | 2450 | 
           tom.houday | 
           35 | 
           		$tmp = explode('=', $buffer, 2);
  | 
        
        
           | 2316 | 
           tom.houday | 
           36 | 
           		$conf[trim($tmp[0])] = trim($tmp[1]);
  | 
        
        
            | 
            | 
           37 | 
           	}
  | 
        
        
            | 
            | 
           38 | 
           }
  | 
        
        
            | 
            | 
           39 | 
           fclose($file_conf);
  | 
        
        
            | 
            | 
           40 | 
              | 
        
        
            | 
            | 
           41 | 
           // Choice of language
  | 
        
        
           | 318 | 
           richard | 
           42 | 
           $Language = 'en';
  | 
        
        
           | 2316 | 
           tom.houday | 
           43 | 
           if (isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) {
  | 
        
        
            | 
            | 
           44 | 
           	$Langue	  = explode(',', $_SERVER['HTTP_ACCEPT_LANGUAGE']);
  | 
        
        
            | 
            | 
           45 | 
           	$Language = strtolower(substr(chop($Langue[0]), 0, 2));
  | 
        
        
            | 
            | 
           46 | 
           }
  | 
        
        
           | 2853 | 
           rexy | 
           47 | 
           if ($Language === 'fr') {
  | 
        
        
           | 318 | 
           richard | 
           48 | 
           	$l_network_title	= "Configuration réseau";
  | 
        
        
            | 
            | 
           49 | 
           	$l_internet_legend	= "INTERNET";
  | 
        
        
           | 1733 | 
           richard | 
           50 | 
           	$l_ip_mask		= "Masque";
  | 
        
        
           | 3132 | 
           rexy | 
           51 | 
           	$l_ip_router		= "Routeur";
  | 
        
        
           | 736 | 
           franck | 
           52 | 
           	$l_ip_public		= "Adresse IP publique";
  | 
        
        
           | 2316 | 
           tom.houday | 
           53 | 
           	$l_ip_dns1		= "DNS n°1";
  | 
        
        
            | 
            | 
           54 | 
           	$l_ip_dns2		= "DNS n°2";
  | 
        
        
           | 861 | 
           richard | 
           55 | 
           	$l_dhcp_title		= "Service DHCP";
  | 
        
        
           | 862 | 
           richard | 
           56 | 
           	$l_dhcp_state		= "Mode actuel";
  | 
        
        
           | 1484 | 
           richard | 
           57 | 
           	$l_DHCP_on		= "actif";
  | 
        
        
            | 
            | 
           58 | 
           	$l_DHCP_off		= "inactif";
  | 
        
        
           | 2304 | 
           tom.houday | 
           59 | 
           	$l_DHCP_off_explain	= "/!\\ Avant d'arrêter le serveur DHCP, vous devez renseigner les paramètres d'un serveur externe (cf. documentation).";
  | 
        
        
           | 2717 | 
           tom.houday | 
           60 | 
           	$l_static_dhcp_title	= "Réservation d'adresses IP statiques (DHCP)";
  | 
        
        
           | 841 | 
           richard | 
           61 | 
           	$l_mac_address		= "Adresse MAC";
  | 
        
        
            | 
            | 
           62 | 
           	$l_ip_address		= "Adresse IP";
  | 
        
        
           | 1959 | 
           richard | 
           63 | 
           	$l_host_name		= "Nom d'hôte";
  | 
        
        
            | 
            | 
           64 | 
           	$l_del			= "Supprimer de la liste";
  | 
        
        
           | 841 | 
           richard | 
           65 | 
           	$l_add_to_list		= "Ajouter";
  | 
        
        
           | 1733 | 
           richard | 
           66 | 
           	$l_apply		= "Appliquer les changements";
  | 
        
        
           | 3250 | 
           rexy | 
           67 | 
           	$l_local_dns		= "Résolution locale de nom (DNS)";
  | 
        
        
           | 1733 | 
           richard | 
           68 | 
           	$l_import_cert		= "Import de certificat";
  | 
        
        
            | 
            | 
           69 | 
           	$l_private_key		= "Clé privée (.key) :";
  | 
        
        
           | 2813 | 
           rexy | 
           70 | 
           	$l_certificate		= "Certificat (.crt ou .cer) :";
  | 
        
        
            | 
            | 
           71 | 
           	$l_server_chain		= "Chaîne de certification (.crt, .cer ou .pem) :";
  | 
        
        
            | 
            | 
           72 | 
           	$l_default_cert		= "Revenir au certificat d'origine :";
  | 
        
        
           | 1740 | 
           richard | 
           73 | 
           	$l_import		= "Importer";
  | 
        
        
           | 1743 | 
           clement.si | 
           74 | 
           	$l_current_certificate  = "Certificat actuel";
  | 
        
        
            | 
            | 
           75 | 
           	$l_validated		= "Validé par :";
  | 
        
        
           | 2316 | 
           tom.houday | 
           76 | 
           	$l_empty		= "Vide";
  | 
        
        
           | 2326 | 
           tom.houday | 
           77 | 
           	$l_yes			= "Oui";
  | 
        
        
            | 
            | 
           78 | 
           	$l_no			= "Non";
  | 
        
        
           | 2736 | 
           rexy | 
           79 | 
           	$l_ssl_title		= "Chiffrer les flux d'authentification entre les utilisateurs et ALCASAR";
  | 
        
        
           | 3040 | 
           rexy | 
           80 | 
           	$l_ssh_title		= "SSH";
  | 
        
        
            | 
            | 
           81 | 
           	$l_ssh_port			= "Port";
  | 
        
        
           | 3041 | 
           rexy | 
           82 | 
           	$l_ssh_from			= "IP autorisée";
  | 
        
        
           | 3051 | 
           rexy | 
           83 | 
           	$l_ssh_wan_activate	= "Activer SSH côté WAN";
  | 
        
        
            | 
            | 
           84 | 
           	$l_ssh_lan_activate	= "Activer SSH côté LAN";
  | 
        
        
            | 
            | 
           85 | 
           	$l_all_ip			= "Pour autoriser toutes les @IP sources: 0.0.0.0";
  | 
        
        
            | 
            | 
           86 | 
           	$l_interlan_title	= "Autoriser l'accès au réseau situé entre ALCASAR et le routeur d'accès à Internet";
  | 
        
        
           | 2326 | 
           tom.houday | 
           87 | 
           	$l_cert_expiration	= "Date d'expiration :";
  | 
        
        
           | 2380 | 
           tom.houday | 
           88 | 
           	$l_cert_commonname	= "Nom commun :";
  | 
        
        
            | 
            | 
           89 | 
           	$l_cert_organization	= "Organisation :";
  | 
        
        
           | 2813 | 
           rexy | 
           90 | 
           	$l_upload_certificate	= "Importer un certificat officiel";
  | 
        
        
            | 
            | 
           91 | 
           	$l_le_integration	= "Intégrer un certificat Let's Encrypt";
  | 
        
        
           | 2326 | 
           tom.houday | 
           92 | 
           	$l_le_status		= "Status :";
  | 
        
        
            | 
            | 
           93 | 
           	$l_disabled		= "Inactif";
  | 
        
        
            | 
            | 
           94 | 
           	$l_pending_validation	= "En attente de validation";
  | 
        
        
            | 
            | 
           95 | 
           	$l_enabled		= "Actif";
  | 
        
        
            | 
            | 
           96 | 
           	$l_le_email		= "Email :";
  | 
        
        
            | 
            | 
           97 | 
           	$l_le_domain_name	= "Nom de domaine :";
  | 
        
        
            | 
            | 
           98 | 
           	$l_send			= "Envoyer";
  | 
        
        
            | 
            | 
           99 | 
           	$l_le_ask_on		= "Demandé le :";
  | 
        
        
            | 
            | 
           100 | 
           	$l_le_dns_entry_txt	= "Entrée DNS TXT :";
  | 
        
        
            | 
            | 
           101 | 
           	$l_le_challenge		= "Challenge :";
  | 
        
        
            | 
            | 
           102 | 
           	$l_recheck		= "Revérifier";
  | 
        
        
            | 
            | 
           103 | 
           	$l_cancel		= "Annuler";
  | 
        
        
            | 
            | 
           104 | 
           	$l_le_api		= "API :";
  | 
        
        
            | 
            | 
           105 | 
           	$l_le_next_renewal	= "Prochain renouvellement :";
  | 
        
        
            | 
            | 
           106 | 
           	$l_renew		= "Renouveller";
  | 
        
        
            | 
            | 
           107 | 
           	$l_renew_force		= "Renouveller (forcer)";
  | 
        
        
           | 2813 | 
           rexy | 
           108 | 
           	$l_previous_LE_cert	= "Revenir au certificat Let's Encrypt :";
  | 
        
        
           | 2956 | 
           rexy | 
           109 | 
           	$l_gw_weight    = "Poids";
  | 
        
        
            | 
            | 
           110 | 
           	$l_error        = "Erreur";
  | 
        
        
            | 
            | 
           111 | 
           	$l_error_bad_ip = "Ceci n'est pas une adresse IP valide";
  | 
        
        
            | 
            | 
           112 | 
           	$l_error_bad_ip_CIDR = "Ceci n'est pas une adresse CIDR valide";
  | 
        
        
            | 
            | 
           113 | 
           	$l_error_bad_ip_port = "Ceci n'est pas une adresse IP + port valide";
  | 
        
        
            | 
            | 
           114 | 
           	$l_error_weight = "Ceci n'est pas un poids valide";
  | 
        
        
            | 
            | 
           115 | 
               $l_change_successful = "Changement effectué avec succès";
  | 
        
        
            | 
            | 
           116 | 
              | 
        
        
           | 2853 | 
           rexy | 
           117 | 
           } else if ($Language === 'es') {
  | 
        
        
            | 
            | 
           118 | 
           	$l_network_title	= "Configuración de Red";
  | 
        
        
            | 
            | 
           119 | 
           	$l_internet_legend	= "INTERNET";
  | 
        
        
            | 
            | 
           120 | 
           	$l_ip_mask		= "Máscara";
  | 
        
        
           | 3132 | 
           rexy | 
           121 | 
           	$l_ip_router		= "Router";
  | 
        
        
           | 2853 | 
           rexy | 
           122 | 
           	$l_ip_public		= "IP Pública";
  | 
        
        
            | 
            | 
           123 | 
           	$l_ip_dns1		= "DNS n°1";
  | 
        
        
            | 
            | 
           124 | 
           	$l_ip_dns2		= "DNS n°2";
  | 
        
        
            | 
            | 
           125 | 
           	$l_dhcp_title		= "Servicio DHCP";
  | 
        
        
            | 
            | 
           126 | 
           	$l_dhcp_state		= "Modo actual";
  | 
        
        
            | 
            | 
           127 | 
           	$l_DHCP_on		= "activado";
  | 
        
        
            | 
            | 
           128 | 
           	$l_DHCP_off		= "desactivado";
  | 
        
        
            | 
            | 
           129 | 
           	$l_DHCP_off_explain	= "/!\\ Antes de desactivar el servidor DHCP, debe escribir los parámetros externos de DHCP en el archivo de configuración (consulte la Documentación";
  | 
        
        
            | 
            | 
           130 | 
           	$l_static_dhcp_title	= "Reserva de direcciones IP estáticas (DHCP)";
  | 
        
        
            | 
            | 
           131 | 
           	$l_mac_address		= "Dirección MAC";
  | 
        
        
            | 
            | 
           132 | 
           	$l_ip_address		= "Dirección IP";
  | 
        
        
            | 
            | 
           133 | 
           	$l_host_name		= "Nombre de Host";
  | 
        
        
            | 
            | 
           134 | 
           	$l_del			= "Borrar de la lista";
  | 
        
        
            | 
            | 
           135 | 
           	$l_add_to_list		= "Agregar";
  | 
        
        
            | 
            | 
           136 | 
           	$l_apply		= "Aplicar cambios";
  | 
        
        
           | 3250 | 
           rexy | 
           137 | 
           	$l_local_dns		= "Resolución local de Nombres (DNS)";
  | 
        
        
           | 2853 | 
           rexy | 
           138 | 
           	$l_import_cert		= "Importar Certificado";
  | 
        
        
            | 
            | 
           139 | 
           	$l_private_key		= "Clave Privada (.key) :";
  | 
        
        
            | 
            | 
           140 | 
           	$l_certificate		= "Certificado (.crt) :";
  | 
        
        
            | 
            | 
           141 | 
           	$l_server_chain		= "Cadena completa (de ser necesario: .crt) :";
  | 
        
        
            | 
            | 
           142 | 
           	$l_default_cert		= "Volverl al certificado por defecto";
  | 
        
        
            | 
            | 
           143 | 
           	$l_import		= "Importar";
  | 
        
        
            | 
            | 
           144 | 
           	$l_current_certificate  = "Certificado en uso";
  | 
        
        
            | 
            | 
           145 | 
           	$l_validated		= "Validado por :";
  | 
        
        
            | 
            | 
           146 | 
           	$l_empty		= "Vacío";
  | 
        
        
            | 
            | 
           147 | 
           	$l_yes			= "Si";
  | 
        
        
            | 
            | 
           148 | 
           	$l_no			= "No";
  | 
        
        
            | 
            | 
           149 | 
           	$l_ssl_title		= "La autenticación de cifrado fluye entre usuarios y ALCASAR";
  | 
        
        
           | 3040 | 
           rexy | 
           150 | 
           	$l_ssh_title		= "SSH";
  | 
        
        
            | 
            | 
           151 | 
           	$l_ssh_port			= "Puerto";
  | 
        
        
           | 3041 | 
           rexy | 
           152 | 
           	$l_ssh_from			= "IP autorizada";
  | 
        
        
           | 3051 | 
           rexy | 
           153 | 
           	$l_ssh_wan_activate	= "Activar SSH en el lado WAN";
  | 
        
        
            | 
            | 
           154 | 
           	$l_ssh_lan_activate	= "Activar SSH en el lado LAN";
  | 
        
        
            | 
            | 
           155 | 
           	$l_all_ip			= "Para permitir todas las @IP de origen : 0.0.0.0";
  | 
        
        
           | 3046 | 
           rexy | 
           156 | 
           	$l_interlan_title = "Permitir el acceso a la red entre ALCASAR y el router de acceso a Internet";
  | 
        
        
           | 2853 | 
           rexy | 
           157 | 
           	$l_cert_expiration	= "Fecha de vencimiento:";
  | 
        
        
            | 
            | 
           158 | 
           	$l_cert_commonname	= "Common name:";
  | 
        
        
            | 
            | 
           159 | 
           	$l_cert_organization	= "Organización:";
  | 
        
        
            | 
            | 
           160 | 
           	$l_upload_certificate	= "Importar un certificado";
  | 
        
        
            | 
            | 
           161 | 
           	$l_le_integration	= "Integración con Let's Encrypt";
  | 
        
        
            | 
            | 
           162 | 
           	$l_le_status		= "Estado:";
  | 
        
        
            | 
            | 
           163 | 
           	$l_disabled		= "Desactivado";
  | 
        
        
            | 
            | 
           164 | 
           	$l_pending_validation	= "Validación pendiente";
  | 
        
        
            | 
            | 
           165 | 
           	$l_enabled		= "Activado";
  | 
        
        
            | 
            | 
           166 | 
           	$l_le_email		= "Email:";
  | 
        
        
            | 
            | 
           167 | 
           	$l_le_domain_name	= "Nombre de dominio:";
  | 
        
        
            | 
            | 
           168 | 
           	$l_send			= "Enviar";
  | 
        
        
            | 
            | 
           169 | 
           	$l_le_ask_on		= "Preguntar el:";
  | 
        
        
            | 
            | 
           170 | 
           	$l_le_dns_entry_txt	= "Entrada DNS TXT:";
  | 
        
        
            | 
            | 
           171 | 
           	$l_le_challenge		= "Desafío:";
  | 
        
        
            | 
            | 
           172 | 
           	$l_recheck		= "Verificar";
  | 
        
        
            | 
            | 
           173 | 
           	$l_cancel		= "Cancelar";
  | 
        
        
            | 
            | 
           174 | 
           	$l_le_api		= "API:";
  | 
        
        
            | 
            | 
           175 | 
           	$l_le_next_renewal	= "Siguiente renovación:";
  | 
        
        
            | 
            | 
           176 | 
           	$l_renew		= "Renovar";
  | 
        
        
            | 
            | 
           177 | 
           	$l_renew_force		= "Renovar (forzado)";
  | 
        
        
            | 
            | 
           178 | 
           	$l_previous_LE_cert	= "Volver al certificado de Let's Encrypt :";
  | 
        
        
           | 2971 | 
           rexy | 
           179 | 
               $l_gw_weight	= "Peso";
  | 
        
        
            | 
            | 
           180 | 
               $l_error		= "Error";
  | 
        
        
            | 
            | 
           181 | 
               $l_error_bad_ip	= "Esta no es una dirección IP válida";
  | 
        
        
           | 2972 | 
           rexy | 
           182 | 
               $l_error_bad_ip_CIDR	= "Esta no es una dirección CIDR válida";
  | 
        
        
           | 2971 | 
           rexy | 
           183 | 
               $l_error_bad_ip_port	= "Esto no es una dirección IP + puerto válidos";
  | 
        
        
            | 
            | 
           184 | 
               $l_error_weight	= "Esto no es un peso válido";
  | 
        
        
            | 
            | 
           185 | 
               $l_change_successful	= "Cambio completado con éxito";
  | 
        
        
           | 2853 | 
           rexy | 
           186 | 
           } else {
  | 
        
        
           | 318 | 
           richard | 
           187 | 
           	$l_network_title	= "Network configuration";
  | 
        
        
            | 
            | 
           188 | 
           	$l_internet_legend	= "INTERNET";
  | 
        
        
           | 1733 | 
           richard | 
           189 | 
           	$l_ip_mask		= "Mask";
  | 
        
        
           | 3132 | 
           rexy | 
           190 | 
           	$l_ip_router		= "Router";
  | 
        
        
           | 318 | 
           richard | 
           191 | 
           	$l_ip_public		= "Public IP address";
  | 
        
        
           | 2316 | 
           tom.houday | 
           192 | 
           	$l_ip_dns1		= "DNS n°1";
  | 
        
        
            | 
            | 
           193 | 
           	$l_ip_dns2		= "DNS n°2";
  | 
        
        
           | 861 | 
           richard | 
           194 | 
           	$l_dhcp_title		= "DHCP service";
  | 
        
        
           | 862 | 
           richard | 
           195 | 
           	$l_dhcp_state		= "Current mode";
  | 
        
        
           | 1484 | 
           richard | 
           196 | 
           	$l_DHCP_on		= "enabled";
  | 
        
        
            | 
            | 
           197 | 
           	$l_DHCP_off		= "disabled";
  | 
        
        
           | 2304 | 
           tom.houday | 
           198 | 
           	$l_DHCP_off_explain	= "/!\\ Before disabling the DHCP server, you must write the extern DHCP parameters in the config file (see Documentation)";
  | 
        
        
           | 2717 | 
           tom.houday | 
           199 | 
           	$l_static_dhcp_title	= "Static IP addresses reservation (DHCP)";
  | 
        
        
           | 2708 | 
           tom.houday | 
           200 | 
           	$l_mac_address		= "MAC address";
  | 
        
        
            | 
            | 
           201 | 
           	$l_ip_address		= "IP address";
  | 
        
        
           | 1959 | 
           richard | 
           202 | 
           	$l_host_name		= "Host name";
  | 
        
        
            | 
            | 
           203 | 
           	$l_del			= "Delete from list";
  | 
        
        
           | 841 | 
           richard | 
           204 | 
           	$l_add_to_list		= "Add";
  | 
        
        
           | 1733 | 
           richard | 
           205 | 
           	$l_apply		= "Apply changes";
  | 
        
        
           | 2717 | 
           tom.houday | 
           206 | 
           	$l_local_dns		= "Local name resolution (DNS";
  | 
        
        
           | 1733 | 
           richard | 
           207 | 
           	$l_import_cert		= "Certificate import";
  | 
        
        
            | 
            | 
           208 | 
           	$l_private_key		= "Private key (.key) :";
  | 
        
        
           | 2813 | 
           rexy | 
           209 | 
           	$l_certificate		= "Certificate (.crt or .cer) :";
  | 
        
        
            | 
            | 
           210 | 
           	$l_server_chain		= "Server-chain (.crt, .cer or .pem) :";
  | 
        
        
            | 
            | 
           211 | 
           	$l_default_cert		= "Back to default certificate :";
  | 
        
        
           | 1740 | 
           richard | 
           212 | 
           	$l_import		= "Import";
  | 
        
        
           | 1743 | 
           clement.si | 
           213 | 
           	$l_current_certificate  = "Current certificate";
  | 
        
        
            | 
            | 
           214 | 
           	$l_validated		= "Validated by :";
  | 
        
        
           | 2316 | 
           tom.houday | 
           215 | 
           	$l_empty		= "Empty";
  | 
        
        
           | 2326 | 
           tom.houday | 
           216 | 
           	$l_yes			= "Yes";
  | 
        
        
            | 
            | 
           217 | 
           	$l_no			= "No";
  | 
        
        
           | 2736 | 
           rexy | 
           218 | 
           	$l_ssl_title		= "Cipher authentication flows between users and ALCASAR";
  | 
        
        
           | 3040 | 
           rexy | 
           219 | 
           	$l_ssh_title		= "SSH";
  | 
        
        
            | 
            | 
           220 | 
           	$l_ssh_port			= "Port";
  | 
        
        
           | 3041 | 
           rexy | 
           221 | 
           	$l_ssh_from			= "Authorized IP";
  | 
        
        
           | 3051 | 
           rexy | 
           222 | 
           	$l_ssh_wan_activate	= "Activate SSH on WAN side";
  | 
        
        
            | 
            | 
           223 | 
           	$l_ssh_lan_activate	= "Activate SSH on LAN side";
  | 
        
        
            | 
            | 
           224 | 
           	$l_all_ip			= "To allow all source IP addresses: 0.0.0.0";
  | 
        
        
           | 3046 | 
           rexy | 
           225 | 
           	$l_interlan_title = "Authorize access to the network located between ALCASAR and Internet broadband router";
  | 
        
        
           | 2326 | 
           tom.houday | 
           226 | 
           	$l_cert_expiration	= "Expiration date:";
  | 
        
        
            | 
            | 
           227 | 
           	$l_cert_commonname	= "Common name:";
  | 
        
        
            | 
            | 
           228 | 
           	$l_cert_organization	= "Organization:";
  | 
        
        
           | 2813 | 
           rexy | 
           229 | 
           	$l_upload_certificate	= "Import an officlal certificate";
  | 
        
        
            | 
            | 
           230 | 
           	$l_le_integration	= "Integrate a Let's Encrypt certificate";
  | 
        
        
           | 2326 | 
           tom.houday | 
           231 | 
           	$l_le_status		= "Status:";
  | 
        
        
            | 
            | 
           232 | 
           	$l_disabled		= "Disabled";
  | 
        
        
            | 
            | 
           233 | 
           	$l_pending_validation	= "Pending validation";
  | 
        
        
            | 
            | 
           234 | 
           	$l_enabled		= "Enabled";
  | 
        
        
            | 
            | 
           235 | 
           	$l_le_email		= "Email:";
  | 
        
        
            | 
            | 
           236 | 
           	$l_le_domain_name	= "Domain name:";
  | 
        
        
            | 
            | 
           237 | 
           	$l_send			= "Send";
  | 
        
        
            | 
            | 
           238 | 
           	$l_le_ask_on		= "Ask on:";
  | 
        
        
            | 
            | 
           239 | 
           	$l_le_dns_entry_txt	= "DNS TXT entry:";
  | 
        
        
            | 
            | 
           240 | 
           	$l_le_challenge		= "Challenge:";
  | 
        
        
            | 
            | 
           241 | 
           	$l_recheck		= "Recheck";
  | 
        
        
            | 
            | 
           242 | 
           	$l_cancel		= "Cancel";
  | 
        
        
            | 
            | 
           243 | 
           	$l_le_api		= "API:";
  | 
        
        
            | 
            | 
           244 | 
           	$l_le_next_renewal	= "Next renewal:";
  | 
        
        
            | 
            | 
           245 | 
           	$l_renew		= "Renew";
  | 
        
        
            | 
            | 
           246 | 
           	$l_renew_force		= "Renew (force)";
  | 
        
        
           | 2813 | 
           rexy | 
           247 | 
           	$l_previous_LE_cert	= "Back to the Let's Encrypt certificate :";
  | 
        
        
           | 2956 | 
           rexy | 
           248 | 
               $l_gw_weight = "Weight";
  | 
        
        
            | 
            | 
           249 | 
               $l_error        = "Error";
  | 
        
        
            | 
            | 
           250 | 
               $l_error_bad_ip = "This is not a valid IP";
  | 
        
        
            | 
            | 
           251 | 
               $l_error_bad_ip_CIDR = "This is not a valid CIDR IP";
  | 
        
        
            | 
            | 
           252 | 
               $l_error_bad_ip_port = "This is not a valid IP + port";
  | 
        
        
            | 
            | 
           253 | 
               $l_error_weight = "This is not a valid weight";
  | 
        
        
            | 
            | 
           254 | 
               $l_change_successful = "Network updated successfully";
  | 
        
        
           | 318 | 
           richard | 
           255 | 
           }
  | 
        
        
           | 2316 | 
           tom.houday | 
           256 | 
              | 
        
        
            | 
            | 
           257 | 
           $reg_ip      = '/^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$/';
  | 
        
        
            | 
            | 
           258 | 
           $reg_ip_cidr = '/^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])(\/([0-9]|[1-2][0-9]|3[0-2]))$/';
  | 
        
        
           | 2956 | 
           rexy | 
           259 | 
           $reg_ip_port = '/^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])(\:([1-9]|[1-9][0-9]|[1-9][0-9]{2}|[1-9][0-9]{3}|[1-5][0-9]{4}|6[0-4][0-9]{3}|65[0-4][0-9]{2}|655[0-2][0-9]|6553[0-5]))$/';
  | 
        
        
           | 2380 | 
           tom.houday | 
           260 | 
           $reg_mac     = '/^([0-9A-Fa-f]{2}[:-]){5}([0-9A-Fa-f]{2})$/';
  | 
        
        
            | 
            | 
           261 | 
           $reg_host    = '/^[a-zA-Z0-9-_]+$/';
  | 
        
        
           | 2956 | 
           rexy | 
           262 | 
           $reg_weight  = '/^[0-9]*$/';
  | 
        
        
            | 
            | 
           263 | 
           $ext_conf_error = false;
  | 
        
        
           | 2316 | 
           tom.houday | 
           264 | 
              | 
        
        
            | 
            | 
           265 | 
           $choix = (isset($_POST['choix'])) ? $_POST['choix'] : '';
  | 
        
        
            | 
            | 
           266 | 
           switch ($choix) {
  | 
        
        
            | 
            | 
           267 | 
           	case 'DHCP_On':
  | 
        
        
            | 
            | 
           268 | 
           		exec('sudo /usr/local/bin/alcasar-dhcp.sh -on');
  | 
        
        
           | 2708 | 
           tom.houday | 
           269 | 
           		header('Location: '.$_SERVER['PHP_SELF']);
  | 
        
        
            | 
            | 
           270 | 
           		exit();
  | 
        
        
           | 2316 | 
           tom.houday | 
           271 | 
           	case 'DHCP_Off':
  | 
        
        
            | 
            | 
           272 | 
           		exec('sudo /usr/local/bin/alcasar-dhcp.sh -off');
  | 
        
        
           | 2708 | 
           tom.houday | 
           273 | 
           		header('Location: '.$_SERVER['PHP_SELF']);
  | 
        
        
            | 
            | 
           274 | 
           		exit();
  | 
        
        
           | 2316 | 
           tom.houday | 
           275 | 
           	case 'new_mac':
  | 
        
        
           | 2380 | 
           tom.houday | 
           276 | 
           		$new_mac_addr = trim($_POST['add_mac']);
  | 
        
        
            | 
            | 
           277 | 
           		$new_ip_addr  = trim($_POST['add_ip']);
  | 
        
        
            | 
            | 
           278 | 
           		if (((!empty($new_mac_addr)) && (preg_match($reg_mac, $new_mac_addr))) && ((!empty($new_ip_addr)) && (preg_match($reg_ip, $new_ip_addr)))) {
  | 
        
        
           | 2316 | 
           tom.houday | 
           279 | 
           			$tab = file(ETHERS_FILE);
  | 
        
        
            | 
            | 
           280 | 
           			if ($tab) { // the file isn't empty
  | 
        
        
            | 
            | 
           281 | 
           				$insert = true;
  | 
        
        
            | 
            | 
           282 | 
           				foreach ($tab as $line) { // verify that MAC or IP address doesn't exist
  | 
        
        
            | 
            | 
           283 | 
           					$field = explode(' ', $line);
  | 
        
        
            | 
            | 
           284 | 
           					$mac_addr = trim($field[0]);
  | 
        
        
            | 
            | 
           285 | 
           					$ip_addr  = trim($field[1]);
  | 
        
        
            | 
            | 
           286 | 
           					if (strcasecmp($new_mac_addr, $mac_addr) === 0) {
  | 
        
        
            | 
            | 
           287 | 
           						$insert = false;
  | 
        
        
            | 
            | 
           288 | 
           						break;
  | 
        
        
           | 841 | 
           richard | 
           289 | 
           					}
  | 
        
        
           | 2316 | 
           tom.houday | 
           290 | 
           					if (strcasecmp($new_ip_addr, $ip_addr) === 0) {
  | 
        
        
            | 
            | 
           291 | 
           						$insert = false;
  | 
        
        
            | 
            | 
           292 | 
           						break;
  | 
        
        
           | 841 | 
           richard | 
           293 | 
           					}
  | 
        
        
            | 
            | 
           294 | 
           				}
  | 
        
        
           | 2316 | 
           tom.houday | 
           295 | 
           				if ($insert) {
  | 
        
        
            | 
            | 
           296 | 
           					$line = $new_mac_addr . ' ' . $new_ip_addr . "\n";
  | 
        
        
            | 
            | 
           297 | 
           					$pointeur = fopen(ETHERS_FILE, 'a');
  | 
        
        
            | 
            | 
           298 | 
           					fwrite($pointeur, $line);
  | 
        
        
            | 
            | 
           299 | 
           					fclose($pointeur);
  | 
        
        
            | 
            | 
           300 | 
           					$pointeur = fopen(ETHERS_INFO_FILE, 'a');
  | 
        
        
            | 
            | 
           301 | 
           					$line = "$new_mac_addr $new_ip_addr #" . trim($_POST['info'],"\x00..\x20") . "\n";
  | 
        
        
            | 
            | 
           302 | 
           					fwrite($pointeur, $line);
  | 
        
        
            | 
            | 
           303 | 
           					fclose($pointeur);
  | 
        
        
            | 
            | 
           304 | 
           					exec('sudo /usr/bin/systemctl reload chilli');
  | 
        
        
           | 1959 | 
           richard | 
           305 | 
           				}
  | 
        
        
           | 841 | 
           richard | 
           306 | 
           			}
  | 
        
        
           | 1959 | 
           richard | 
           307 | 
           		}
  | 
        
        
           | 2708 | 
           tom.houday | 
           308 | 
           		header('Location: '.$_SERVER['PHP_SELF']);
  | 
        
        
            | 
            | 
           309 | 
           		exit();
  | 
        
        
           | 2316 | 
           tom.houday | 
           310 | 
           	case 'del_mac':
  | 
        
        
            | 
            | 
           311 | 
           		foreach ($_POST as $key => $value) {
  | 
        
        
            | 
            | 
           312 | 
           			if ($value == 'on') {
  | 
        
        
            | 
            | 
           313 | 
           				$ether_file = ETHERS_FILE;
  | 
        
        
            | 
            | 
           314 | 
           				$ether_file_info = ETHERS_INFO_FILE;
  | 
        
        
           | 2559 | 
           rexy | 
           315 | 
           				exec("/bin/sed -i ".escapeshellarg("/^$key/d")." $ether_file");
  | 
        
        
            | 
            | 
           316 | 
           				exec("/bin/sed -i ".escapeshellarg("/^$key/d")." $ether_file_info");
  | 
        
        
           | 2316 | 
           tom.houday | 
           317 | 
           				exec('sudo /usr/bin/systemctl reload chilli');
  | 
        
        
           | 841 | 
           richard | 
           318 | 
           			}
  | 
        
        
            | 
            | 
           319 | 
           		}
  | 
        
        
           | 2708 | 
           tom.houday | 
           320 | 
           		header('Location: '.$_SERVER['PHP_SELF']);
  | 
        
        
            | 
            | 
           321 | 
           		exit();
  | 
        
        
           | 2316 | 
           tom.houday | 
           322 | 
           	case 'new_host':
  | 
        
        
           | 2380 | 
           tom.houday | 
           323 | 
           		$add_host = trim($_POST['add_host']);
  | 
        
        
            | 
            | 
           324 | 
           		$add_ip   = trim($_POST['add_ip']);
  | 
        
        
            | 
            | 
           325 | 
           		if (((!empty($add_host)) && (preg_match($reg_host, $add_host))) && ((!empty($add_ip)) && (preg_match($reg_ip, $add_ip)))) {
  | 
        
        
           | 2316 | 
           tom.houday | 
           326 | 
           			$tab = file(DNS_LOCAL_FILE);
  | 
        
        
            | 
            | 
           327 | 
           			if ($tab) { // the file isn't empty
  | 
        
        
            | 
            | 
           328 | 
           				$insert = true;
  | 
        
        
           | 2559 | 
           rexy | 
           329 | 
           				foreach ($tab as $line) { // verify that host or IP address doesn't exist
  | 
        
        
            | 
            | 
           330 | 
           					if (preg_match('/^\d+/', $line)) {
  | 
        
        
            | 
            | 
           331 | 
           						$field = preg_split("/\s+/",$line);
  | 
        
        
            | 
            | 
           332 | 
           						$ip_addr = $field[0];
  | 
        
        
            | 
            | 
           333 | 
           						$host_name = trim($field[1]);
  | 
        
        
            | 
            | 
           334 | 
           						if (strcasecmp($add_host, $host_name) === 0) {
  | 
        
        
            | 
            | 
           335 | 
           							$insert = false;
  | 
        
        
            | 
            | 
           336 | 
           							break;
  | 
        
        
            | 
            | 
           337 | 
           						}
  | 
        
        
           | 841 | 
           richard | 
           338 | 
           					}
  | 
        
        
           | 2559 | 
           rexy | 
           339 | 
           				}
  | 
        
        
           | 2316 | 
           tom.houday | 
           340 | 
           				if ($insert) {
  | 
        
        
           | 2688 | 
           lucas.echa | 
           341 | 
           					exec("sudo /usr/local/bin/alcasar-dns-local.sh --add $add_ip $add_host");
  | 
        
        
           | 1959 | 
           richard | 
           342 | 
           				}
  | 
        
        
           | 841 | 
           richard | 
           343 | 
           			}
  | 
        
        
           | 2380 | 
           tom.houday | 
           344 | 
           		}
  | 
        
        
           | 2708 | 
           tom.houday | 
           345 | 
           		header('Location: '.$_SERVER['PHP_SELF']);
  | 
        
        
            | 
            | 
           346 | 
           		exit();
  | 
        
        
           | 2316 | 
           tom.houday | 
           347 | 
           	case 'del_host':
  | 
        
        
            | 
            | 
           348 | 
           		foreach ($_POST as $key => $value) {
  | 
        
        
            | 
            | 
           349 | 
           			if ($value == 'on') {
  | 
        
        
           | 2559 | 
           rexy | 
           350 | 
           				$del_host = explode ("|", $key);
  | 
        
        
            | 
            | 
           351 | 
           				$del_ip = str_replace("_",".",$del_host[0]);
  | 
        
        
            | 
            | 
           352 | 
           				exec("sudo /usr/local/bin/alcasar-dns-local.sh --del $del_ip $del_host[1]");
  | 
        
        
           | 2316 | 
           tom.houday | 
           353 | 
           			}
  | 
        
        
           | 841 | 
           richard | 
           354 | 
           		}
  | 
        
        
           | 2708 | 
           tom.houday | 
           355 | 
           		header('Location: '.$_SERVER['PHP_SELF']);
  | 
        
        
            | 
            | 
           356 | 
           		exit();
  | 
        
        
           | 2316 | 
           tom.houday | 
           357 | 
              | 
        
        
           | 2813 | 
           rexy | 
           358 | 
           	case 'set_default_cert':
  | 
        
        
           | 2316 | 
           tom.houday | 
           359 | 
           		exec('sudo alcasar-importcert.sh -d');
  | 
        
        
            | 
            | 
           360 | 
           		break;
  | 
        
        
           | 2813 | 
           rexy | 
           361 | 
           	case 'set_last_LE_cert':
  | 
        
        
            | 
            | 
           362 | 
           		exec('sudo alcasar-letsencrypt.sh --install-cert');
  | 
        
        
            | 
            | 
           363 | 
           		break;
  | 
        
        
           | 2316 | 
           tom.houday | 
           364 | 
           	case 'import_cert':	// Import certificate
  | 
        
        
           | 2479 | 
           tom.houday | 
           365 | 
           		$maxsize = 100000;
  | 
        
        
           | 2316 | 
           tom.houday | 
           366 | 
           		if (isset($_FILES['key']) && isset($_FILES['crt']) && ($_FILES['key']['error'] == 0) && ($_FILES['crt']['error'] == 0)) {
  | 
        
        
            | 
            | 
           367 | 
           			if ($_FILES['key']['size'] <= $maxsize && $_FILES['crt']['size'] <= $maxsize) {
  | 
        
        
           | 2479 | 
           tom.houday | 
           368 | 
           				if (pathinfo($_FILES['key']['name'])['extension'] == 'key' && ((pathinfo($_FILES['crt']['name'])['extension'] == 'crt') || (pathinfo($_FILES['crt']['name'])['extension'] == 'cer'))) {
  | 
        
        
           | 2316 | 
           tom.houday | 
           369 | 
           					$dest = '/tmp/';
  | 
        
        
           | 2380 | 
           tom.houday | 
           370 | 
           					$scpath = '';
  | 
        
        
           | 2813 | 
           rexy | 
           371 | 
           					if (isset($_FILES['sc']) && ((pathinfo($_FILES['sc']['name'])['extension'] == 'crt') || (pathinfo($_FILES['sc']['name'])['extension'] == 'cer') || (pathinfo($_FILES['sc']['name']['extension'] == 'pem')))){
  | 
        
        
            | 
            | 
           372 | 
           						$scpath = $dest.'server-chain.pem';
  | 
        
        
           | 2316 | 
           tom.houday | 
           373 | 
           						move_uploaded_file($_FILES['sc']['tmp_name'], $scpath);
  | 
        
        
            | 
            | 
           374 | 
           					}
  | 
        
        
           | 2380 | 
           tom.houday | 
           375 | 
           					$keypath = $dest.'alcasar.key';
  | 
        
        
            | 
            | 
           376 | 
           					$crtpath = $dest.'alcasar.crt';
  | 
        
        
           | 2316 | 
           tom.houday | 
           377 | 
           					move_uploaded_file($_FILES['key']['tmp_name'], $keypath);
  | 
        
        
            | 
            | 
           378 | 
           					move_uploaded_file($_FILES['crt']['tmp_name'], $crtpath);
  | 
        
        
            | 
            | 
           379 | 
           					exec("sudo alcasar-importcert.sh -i $crtpath -k $keypath -c $scpath");
  | 
        
        
           | 2688 | 
           lucas.echa | 
           380 | 
           					if (file_exists($crtpath)) unlink($crtpath);
  | 
        
        
            | 
            | 
           381 | 
           					if (file_exists($keypath)) unlink($keypath);
  | 
        
        
           | 2610 | 
           tom.houday | 
           382 | 
           					if (file_exists($scpath))  unlink($scpath);
  | 
        
        
           | 2316 | 
           tom.houday | 
           383 | 
           				}
  | 
        
        
           | 1959 | 
           richard | 
           384 | 
           			}
  | 
        
        
            | 
            | 
           385 | 
           		}
  | 
        
        
           | 2316 | 
           tom.houday | 
           386 | 
           		break;
  | 
        
        
           | 3041 | 
           rexy | 
           387 | 
           	case 'enable_lan_ssh': // Activate SSH on LAN
  | 
        
        
            | 
            | 
           388 | 
           		if (isset($_POST['sshlan'])) {
  | 
        
        
           | 3042 | 
           rexy | 
           389 | 
           			exec('sudo /usr/local/bin/alcasar-ssh.sh --on -l -p'.escapeshellarg($_POST["ssh_port"]).' -i'.escapeshellarg($_POST["ssh_from"]),$output,$exitCode);
  | 
        
        
            | 
            | 
           390 | 
           			if($exitCode === 1){
  | 
        
        
            | 
            | 
           391 | 
           				echo("<html><script>if(!alert(`$l_error_bad_ip_port`)){window.location.href = window.location.href;}</script></html>");
  | 
        
        
            | 
            | 
           392 | 
           			}else{
  | 
        
        
            | 
            | 
           393 | 
           				header('Location: '.$_SERVER['PHP_SELF']);
  | 
        
        
            | 
            | 
           394 | 
           			}
  | 
        
        
           | 3041 | 
           rexy | 
           395 | 
           		} else{
  | 
        
        
            | 
            | 
           396 | 
           			exec('sudo /usr/local/bin/alcasar-ssh.sh --off -l');
  | 
        
        
            | 
            | 
           397 | 
           			header('Location: '.$_SERVER['PHP_SELF']);
  | 
        
        
            | 
            | 
           398 | 
           		}
  | 
        
        
            | 
            | 
           399 | 
           		exit();	
  | 
        
        
           | 3040 | 
           rexy | 
           400 | 
           	case 'enable_wan_ssh': // Activate SSH on WAN
  | 
        
        
            | 
            | 
           401 | 
           		if (isset($_POST['togglessh'])) {
  | 
        
        
           | 3041 | 
           rexy | 
           402 | 
           			exec('sudo /usr/local/bin/alcasar-ssh.sh --on -w -p'.escapeshellarg($_POST["ssh_port"]).' -i'.escapeshellarg($_POST["ssh_from"]),$output,$exitCode);
  | 
        
        
            | 
            | 
           403 | 
           			if($exitCode === 1){
  | 
        
        
            | 
            | 
           404 | 
           				echo("<html><script>if(!alert(`$l_error_bad_ip_port`)){window.location.href = window.location.href;}</script></html>");
  | 
        
        
            | 
            | 
           405 | 
           			}else{
  | 
        
        
            | 
            | 
           406 | 
           				header('Location: '.$_SERVER['PHP_SELF']);
  | 
        
        
            | 
            | 
           407 | 
           			}
  | 
        
        
           | 3040 | 
           rexy | 
           408 | 
           		} else{
  | 
        
        
           | 3041 | 
           rexy | 
           409 | 
           			exec('sudo /usr/local/bin/alcasar-ssh.sh --off -w');
  | 
        
        
            | 
            | 
           410 | 
           			header('Location: '.$_SERVER['PHP_SELF']);
  | 
        
        
           | 3040 | 
           rexy | 
           411 | 
           		}
  | 
        
        
            | 
            | 
           412 | 
           		exit();
  | 
        
        
           | 2324 | 
           tom.houday | 
           413 | 
           	case 'https_login':	// Set HTTPS login status
  | 
        
        
           | 3041 | 
           rexy | 
           414 | 
           		if (isset($_POST['https_login']))	 {
  | 
        
        
           | 2324 | 
           tom.houday | 
           415 | 
           			exec('sudo /usr/local/bin/alcasar-https.sh --on');
  | 
        
        
            | 
            | 
           416 | 
           		} else {
  | 
        
        
            | 
            | 
           417 | 
           			exec('sudo /usr/local/bin/alcasar-https.sh --off');
  | 
        
        
            | 
            | 
           418 | 
           		}
  | 
        
        
            | 
            | 
           419 | 
           		header('Location: '.$_SERVER['PHP_SELF']);
  | 
        
        
            | 
            | 
           420 | 
           		exit();
  | 
        
        
           | 3046 | 
           rexy | 
           421 | 
           	case 'interlan':
  | 
        
        
            | 
            | 
           422 | 
           		if (isset($_POST['interlan']))	 {
  | 
        
        
           | 3049 | 
           rexy | 
           423 | 
           			exec('/bin/sed -i "s/^INTERLAN=.*/INTERLAN=on/g" '.CONF_FILE);
  | 
        
        
           | 3046 | 
           rexy | 
           424 | 
           		} else {
  | 
        
        
           | 3049 | 
           rexy | 
           425 | 
           			exec('/bin/sed -i "s/^INTERLAN=.*/INTERLAN=off/g" '.CONF_FILE);
  | 
        
        
           | 3046 | 
           rexy | 
           426 | 
           		}
  | 
        
        
            | 
            | 
           427 | 
           		exec('sudo /usr/local/bin/alcasar-iptables.sh');
  | 
        
        
            | 
            | 
           428 | 
           		header('Location: '.$_SERVER['PHP_SELF']);
  | 
        
        
            | 
            | 
           429 | 
           		exit();
  | 
        
        
           | 318 | 
           richard | 
           430 | 
           }
  | 
        
        
            | 
            | 
           431 | 
              | 
        
        
           | 2316 | 
           tom.houday | 
           432 | 
           // Network changes
  | 
        
        
            | 
            | 
           433 | 
           if ($choix === 'network_change') {
  | 
        
        
           | 2956 | 
           rexy | 
           434 | 
               exec('sudo /usr/local/bin/alcasar-network.sh --save');
  | 
        
        
            | 
            | 
           435 | 
           	$modification_network = false;
  | 
        
        
            | 
            | 
           436 | 
           	$modification_dns = false;
  | 
        
        
            | 
            | 
           437 | 
           	$modification_proxy = false;
  | 
        
        
            | 
            | 
           438 | 
           	$ext_conf_error_list = [];
  | 
        
        
            | 
            | 
           439 | 
           	copy(CONF_FILE, TEMP_FILE);
  | 
        
        
           | 1733 | 
           richard | 
           440 | 
              | 
        
        
           | 2956 | 
           rexy | 
           441 | 
           	if (isset($_POST['dns1']) && (trim($_POST['dns1']) !== $conf['DNS1'])) {
  | 
        
        
            | 
            | 
           442 | 
           	    if (!preg_match($reg_ip, $_POST['dns1'])) {
  | 
        
        
            | 
            | 
           443 | 
                       $ext_conf_error = true;
  | 
        
        
            | 
            | 
           444 | 
                       $ext_conf_error_list[] = $l_error.': '.$l_ip_dns1.': '.$l_error_bad_ip;
  | 
        
        
            | 
            | 
           445 | 
                   }
  | 
        
        
            | 
            | 
           446 | 
           		file_put_contents(TEMP_FILE, str_replace('DNS1='.$conf['DNS1'], 'DNS1='.trim($_POST['dns1']), file_get_contents(TEMP_FILE)));
  | 
        
        
            | 
            | 
           447 | 
           		$modification_dns = true;
  | 
        
        
           | 318 | 
           richard | 
           448 | 
           	}
  | 
        
        
           | 2956 | 
           rexy | 
           449 | 
           	if (isset($_POST['dns2']) && (trim($_POST['dns2']) !== $conf['DNS2'])) {
  | 
        
        
            | 
            | 
           450 | 
           	    if (!preg_match($reg_ip, $_POST['dns2'])) {
  | 
        
        
            | 
            | 
           451 | 
                       $ext_conf_error = true;
  | 
        
        
            | 
            | 
           452 | 
                       $ext_conf_error_list[] = $l_error.': '.$l_ip_dns2.': '.$l_error_bad_ip;
  | 
        
        
            | 
            | 
           453 | 
                   }
  | 
        
        
            | 
            | 
           454 | 
           		file_put_contents(TEMP_FILE, str_replace('DNS2='.$conf['DNS2'], 'DNS2='.trim($_POST['dns2']), file_get_contents(TEMP_FILE)));
  | 
        
        
            | 
            | 
           455 | 
           		$modification_dns = true;
  | 
        
        
           | 318 | 
           richard | 
           456 | 
           	}
  | 
        
        
           | 2956 | 
           rexy | 
           457 | 
               if (isset($_POST['ip_private']) && (trim($_POST['ip_private']) !== $conf['PRIVATE_IP'])) {
  | 
        
        
            | 
            | 
           458 | 
                   if (!preg_match($reg_ip_cidr, $_POST['ip_private'])) {
  | 
        
        
            | 
            | 
           459 | 
                       $ext_conf_error = true;
  | 
        
        
            | 
            | 
           460 | 
                       $ext_conf_error_list[] = $l_error.': '.$l_ip_address.' LAN: '.$l_error_bad_ip_CIDR;
  | 
        
        
            | 
            | 
           461 | 
                   }
  | 
        
        
            | 
            | 
           462 | 
                   file_put_contents(TEMP_FILE, str_replace('PRIVATE_IP='.$conf['PRIVATE_IP'], 'PRIVATE_IP='.trim($_POST['ip_private']), file_get_contents(TEMP_FILE)));
  | 
        
        
            | 
            | 
           463 | 
                   $modification_network = true;
  | 
        
        
            | 
            | 
           464 | 
               }
  | 
        
        
            | 
            | 
           465 | 
           	if (isset($_POST['ip_public']) && (trim($_POST['ip_public']) !== $conf['PUBLIC_IP'])) {
  | 
        
        
            | 
            | 
           466 | 
           	    if (!preg_match($reg_ip_cidr, $_POST['ip_public'])) {
  | 
        
        
            | 
            | 
           467 | 
                       $ext_conf_error = true;
  | 
        
        
            | 
            | 
           468 | 
                       $ext_conf_error_list[] = $l_error.': '.$l_ip_address.' WAN: '.$l_error_bad_ip_CIDR;
  | 
        
        
            | 
            | 
           469 | 
                   }
  | 
        
        
            | 
            | 
           470 | 
           		file_put_contents(TEMP_FILE, str_replace('PUBLIC_IP='.$conf['PUBLIC_IP'], 'PUBLIC_IP='.trim($_POST['ip_public']), file_get_contents(TEMP_FILE)));
  | 
        
        
            | 
            | 
           471 | 
           		$modification_network = true;
  | 
        
        
           | 2316 | 
           tom.houday | 
           472 | 
           	}
  | 
        
        
           | 2956 | 
           rexy | 
           473 | 
               if (isset($_POST['ip_gw']) && (trim($_POST['ip_gw']) !== $conf['GW'])) {
  | 
        
        
            | 
            | 
           474 | 
                   if (!preg_match($reg_ip, $_POST['ip_gw'])) {
  | 
        
        
            | 
            | 
           475 | 
                       $ext_conf_error = true;
  | 
        
        
            | 
            | 
           476 | 
                       $ext_conf_error_list[] = $l_error.': '.$l_ip_router.' 1: '.$l_error_bad_ip;
  | 
        
        
            | 
            | 
           477 | 
                   }
  | 
        
        
            | 
            | 
           478 | 
                   file_put_contents(TEMP_FILE, str_replace('GW='.$conf['GW'], 'GW='.trim($_POST['ip_gw']), file_get_contents(TEMP_FILE)));
  | 
        
        
            | 
            | 
           479 | 
                   $modification_network = true;
  | 
        
        
            | 
            | 
           480 | 
               }
  | 
        
        
            | 
            | 
           481 | 
               if (isset($_POST['enable_proxy']) && $_POST['enable_proxy'] == 'P_Enabled')
  | 
        
        
            | 
            | 
           482 | 
               {
  | 
        
        
            | 
            | 
           483 | 
                   if ($conf['PROXY'] !== 'On')
  | 
        
        
            | 
            | 
           484 | 
                   {
  | 
        
        
            | 
            | 
           485 | 
                       file_put_contents(TEMP_FILE, str_replace('PROXY='.$conf['PROXY'], 'PROXY=On', file_get_contents(TEMP_FILE)));
  | 
        
        
            | 
            | 
           486 | 
                       $modification_proxy = true;
  | 
        
        
            | 
            | 
           487 | 
                   }
  | 
        
        
            | 
            | 
           488 | 
                   if (isset($_POST['proxy']) && (trim($_POST['proxy']) !== $conf['PROXY_IP'])) {
  | 
        
        
            | 
            | 
           489 | 
                       if (!preg_match($reg_ip_port, $_POST['proxy'])) {
  | 
        
        
            | 
            | 
           490 | 
                           $ext_conf_error = true;
  | 
        
        
            | 
            | 
           491 | 
                           $ext_conf_error_list[] = $l_error.': Proxy: '.$l_error_bad_ip_port;
  | 
        
        
            | 
            | 
           492 | 
                       }
  | 
        
        
            | 
            | 
           493 | 
                       file_put_contents(TEMP_FILE, str_replace('PROXY_IP='.$conf['PROXY_IP'], 'PROXY_IP='.trim($_POST['proxy']), file_get_contents(TEMP_FILE)));
  | 
        
        
            | 
            | 
           494 | 
                       $modification_proxy = true;
  | 
        
        
            | 
            | 
           495 | 
                   }
  | 
        
        
           | 2979 | 
           rexy | 
           496 | 
                   if ($conf['MULTIWAN'] !== 'off')
  | 
        
        
           | 2956 | 
           rexy | 
           497 | 
                   {
  | 
        
        
           | 2979 | 
           rexy | 
           498 | 
                       file_put_contents(TEMP_FILE, str_replace('MULTIWAN='.$conf['MULTIWAN'], 'MULTIWAN=off', file_get_contents(TEMP_FILE)));
  | 
        
        
           | 2956 | 
           rexy | 
           499 | 
                       $modification_network = true;
  | 
        
        
            | 
            | 
           500 | 
                   }
  | 
        
        
            | 
            | 
           501 | 
               }
  | 
        
        
            | 
            | 
           502 | 
               else
  | 
        
        
            | 
            | 
           503 | 
               {
  | 
        
        
            | 
            | 
           504 | 
                   //set multiwan value to off and delete every "WANx=" line
  | 
        
        
           | 2979 | 
           rexy | 
           505 | 
                   if ($_POST['gw_count'] === "1" && $conf['MULTIWAN'] !== 'off')
  | 
        
        
           | 2956 | 
           rexy | 
           506 | 
                   {
  | 
        
        
           | 2979 | 
           rexy | 
           507 | 
                       file_put_contents(TEMP_FILE, str_replace('MULTIWAN='.$conf['MULTIWAN'], 'MULTIWAN=off', file_get_contents(TEMP_FILE)));
  | 
        
        
           | 2956 | 
           rexy | 
           508 | 
                       $temp = 1;
  | 
        
        
            | 
            | 
           509 | 
                       while (isset($conf['WAN'.$temp]))
  | 
        
        
            | 
            | 
           510 | 
                       {
  | 
        
        
            | 
            | 
           511 | 
                           file_put_contents(TEMP_FILE, str_replace('WAN'.$temp.'='.$conf['WAN'.$temp]."\n", '', file_get_contents(TEMP_FILE)));
  | 
        
        
            | 
            | 
           512 | 
                           $temp++;
  | 
        
        
            | 
            | 
           513 | 
                       }
  | 
        
        
            | 
            | 
           514 | 
                       $modification_network = true;
  | 
        
        
            | 
            | 
           515 | 
                   }
  | 
        
        
            | 
            | 
           516 | 
                   if ($_POST['gw_count'] !== "1")
  | 
        
        
            | 
            | 
           517 | 
                   {
  | 
        
        
            | 
            | 
           518 | 
                       $changed = false;
  | 
        
        
            | 
            | 
           519 | 
                       //testing the existence of a change in the routing configuration
  | 
        
        
            | 
            | 
           520 | 
                       exec("grep \"^WAN\" " . CONF_FILE . " | wc -l", $nb_gw);
  | 
        
        
            | 
            | 
           521 | 
                       if ($_POST['gw_count'] == ($nb_gw[0] + 1))
  | 
        
        
            | 
            | 
           522 | 
                       {
  | 
        
        
            | 
            | 
           523 | 
                           if ($_POST['weight'] !== $conf['PUBLIC_WEIGHT']) {
  | 
        
        
            | 
            | 
           524 | 
                               $changed = true;
  | 
        
        
            | 
            | 
           525 | 
                           }
  | 
        
        
            | 
            | 
           526 | 
                           else {
  | 
        
        
            | 
            | 
           527 | 
                               for($i=1;$i<$_POST['gw_count'];$i++)
  | 
        
        
            | 
            | 
           528 | 
                               {
  | 
        
        
            | 
            | 
           529 | 
                                   if( '"'.$_POST['ip_gw_'.$i].','.$_POST['weight_'.$i].'"' != $conf['WAN'.$i])
  | 
        
        
            | 
            | 
           530 | 
                                   {
  | 
        
        
            | 
            | 
           531 | 
                                       $changed = true;
  | 
        
        
            | 
            | 
           532 | 
                                       break;
  | 
        
        
            | 
            | 
           533 | 
                                   }
  | 
        
        
            | 
            | 
           534 | 
                               }
  | 
        
        
            | 
            | 
           535 | 
                           }
  | 
        
        
            | 
            | 
           536 | 
                       }
  | 
        
        
            | 
            | 
           537 | 
                       else
  | 
        
        
            | 
            | 
           538 | 
                       {
  | 
        
        
            | 
            | 
           539 | 
                           $changed = true;
  | 
        
        
            | 
            | 
           540 | 
                       }
  | 
        
        
           | 2316 | 
           tom.houday | 
           541 | 
              | 
        
        
           | 2956 | 
           rexy | 
           542 | 
                       if ($changed == true)
  | 
        
        
            | 
            | 
           543 | 
                       {
  | 
        
        
            | 
            | 
           544 | 
                           //deleting all the old lines containing "WANx="
  | 
        
        
            | 
            | 
           545 | 
                           $temp = 1;
  | 
        
        
            | 
            | 
           546 | 
                           while (isset($conf['WAN'.$temp]))
  | 
        
        
            | 
            | 
           547 | 
                           {
  | 
        
        
            | 
            | 
           548 | 
                               file_put_contents(TEMP_FILE, str_replace('WAN'.$temp.'='.$conf['WAN'.$temp]."\n", '', file_get_contents(TEMP_FILE)));
  | 
        
        
            | 
            | 
           549 | 
                               $temp++;
  | 
        
        
            | 
            | 
           550 | 
                           }
  | 
        
        
            | 
            | 
           551 | 
                           //setting back the line "WAN1=" which will be our base
  | 
        
        
            | 
            | 
           552 | 
                           if (!preg_match($reg_weight, $_POST['weight'])) {
  | 
        
        
            | 
            | 
           553 | 
                               $ext_conf_error = true;
  | 
        
        
            | 
            | 
           554 | 
                               $ext_conf_error_list[] = $l_error.': '.$l_gw_weight.' 1: '.$l_error_weight;
  | 
        
        
            | 
            | 
           555 | 
                           }
  | 
        
        
            | 
            | 
           556 | 
                           file_put_contents(TEMP_FILE, str_replace('PUBLIC_WEIGHT='.$conf['PUBLIC_WEIGHT'], 'PUBLIC_WEIGHT='.(($_POST['weight'] !== '')?$_POST['weight']:1), file_get_contents(TEMP_FILE)));
  | 
        
        
            | 
            | 
           557 | 
                           //Set Multiwan status
  | 
        
        
           | 2979 | 
           rexy | 
           558 | 
                           file_put_contents(TEMP_FILE, str_replace('MULTIWAN='.$conf['MULTIWAN'], "MULTIWAN=on\nWAN1=", file_get_contents(TEMP_FILE)));
  | 
        
        
           | 2956 | 
           rexy | 
           559 | 
                           //Adding the correct number of "WANx=" lines, numbered
  | 
        
        
            | 
            | 
           560 | 
                           for($i=2;$i<$_POST['gw_count'];$i++)
  | 
        
        
            | 
            | 
           561 | 
                           {
  | 
        
        
            | 
            | 
           562 | 
                               file_put_contents(TEMP_FILE, str_replace('WAN'.($i-1).'=', 'WAN'.($i-1)."=\nWAN".$i.'=', file_get_contents(TEMP_FILE)));
  | 
        
        
            | 
            | 
           563 | 
                           }
  | 
        
        
            | 
            | 
           564 | 
                           //Adding the content
  | 
        
        
            | 
            | 
           565 | 
                           for($i=1;$i<$_POST['gw_count'];$i++)
  | 
        
        
            | 
            | 
           566 | 
                           {
  | 
        
        
            | 
            | 
           567 | 
                               if (!preg_match($reg_ip, $_POST['ip_gw_'.$i])) {
  | 
        
        
            | 
            | 
           568 | 
                                   $ext_conf_error = true;
  | 
        
        
            | 
            | 
           569 | 
                                   $ext_conf_error_list[] = $l_error.': '.$l_ip_router.' '.($i+1).': '.$l_error_bad_ip;
  | 
        
        
            | 
            | 
           570 | 
                               }
  | 
        
        
            | 
            | 
           571 | 
                               if (!preg_match($reg_weight, $_POST['weight_'.$i])) {
  | 
        
        
            | 
            | 
           572 | 
                                   $ext_conf_error = true;
  | 
        
        
            | 
            | 
           573 | 
                                   $ext_conf_error_list[] = $l_error.': '.$l_gw_weight.' '.($i+1).': '.$l_error_weight;
  | 
        
        
            | 
            | 
           574 | 
                               }
  | 
        
        
            | 
            | 
           575 | 
                               file_put_contents(TEMP_FILE, str_replace('WAN'.$i.'=', 'WAN'.$i.'="'.$_POST['ip_gw_'.$i].','.(($_POST['weight_'.$i] === "0" || $_POST['weight_'.$i] === "")?"1":$_POST['weight_'.$i]).'"', file_get_contents(TEMP_FILE)));
  | 
        
        
            | 
            | 
           576 | 
                           }
  | 
        
        
            | 
            | 
           577 | 
                           $modification_network = true;
  | 
        
        
            | 
            | 
           578 | 
                       }
  | 
        
        
            | 
            | 
           579 | 
                   }
  | 
        
        
            | 
            | 
           580 | 
                   //set proxy value to off
  | 
        
        
            | 
            | 
           581 | 
                   if ($conf['PROXY'] !== 'Off')
  | 
        
        
            | 
            | 
           582 | 
                   {
  | 
        
        
            | 
            | 
           583 | 
                       file_put_contents(TEMP_FILE, str_replace('PROXY='.$conf['PROXY'], 'PROXY=Off', file_get_contents(TEMP_FILE)));
  | 
        
        
           | 2979 | 
           rexy | 
           584 | 
                       if($_POST['gw_count'] !== "1" && $conf['MULTIWAN'] !== 'on') {
  | 
        
        
            | 
            | 
           585 | 
                           file_put_contents(TEMP_FILE, str_replace('MULTIWAN='.$conf['MULTIWAN'], 'MULTIWAN=on', file_get_contents(TEMP_FILE)));
  | 
        
        
           | 2956 | 
           rexy | 
           586 | 
                           $modification_network = true;
  | 
        
        
            | 
            | 
           587 | 
                       }
  | 
        
        
            | 
            | 
           588 | 
                       $modification_proxy = true;
  | 
        
        
            | 
            | 
           589 | 
                   }
  | 
        
        
            | 
            | 
           590 | 
               }
  | 
        
        
           | 2316 | 
           tom.houday | 
           591 | 
              | 
        
        
           | 2956 | 
           rexy | 
           592 | 
               //if no errors are detected
  | 
        
        
            | 
            | 
           593 | 
               if ($ext_conf_error == false) {
  | 
        
        
            | 
            | 
           594 | 
                   copy(TEMP_FILE, CONF_FILE);
  | 
        
        
            | 
            | 
           595 | 
                   //DNS values modification, several services needs to be reloading, reloads the full server.
  | 
        
        
            | 
            | 
           596 | 
                   if ($modification_dns) {
  | 
        
        
            | 
            | 
           597 | 
                       exec('sudo /usr/local/bin/alcasar-conf.sh -apply');
  | 
        
        
            | 
            | 
           598 | 
                   }
  | 
        
        
            | 
            | 
           599 | 
                   //External network modifications, no service reloading
  | 
        
        
            | 
            | 
           600 | 
                   if ($modification_network) {
  | 
        
        
            | 
            | 
           601 | 
                       exec('sudo /usr/local/bin/alcasar-network.sh');
  | 
        
        
            | 
            | 
           602 | 
                       exec('sudo /usr/local/bin/alcasar-iptables.sh');
  | 
        
        
            | 
            | 
           603 | 
                   }
  | 
        
        
            | 
            | 
           604 | 
                   //If only the proxy has been modified, only the firewall needs a change
  | 
        
        
            | 
            | 
           605 | 
                   else if ($modification_proxy) {
  | 
        
        
            | 
            | 
           606 | 
                       exec('sudo /usr/local/bin/alcasar-iptables.sh');
  | 
        
        
            | 
            | 
           607 | 
                   }
  | 
        
        
            | 
            | 
           608 | 
               }
  | 
        
        
            | 
            | 
           609 | 
               unlink(TEMP_FILE);
  | 
        
        
            | 
            | 
           610 | 
              | 
        
        
           | 2316 | 
           tom.houday | 
           611 | 
           	// Read CONF_FILE updated
  | 
        
        
            | 
            | 
           612 | 
           	$file_conf = fopen(CONF_FILE, 'r');
  | 
        
        
            | 
            | 
           613 | 
           	if (!$file_conf) {
  | 
        
        
            | 
            | 
           614 | 
           		exit('Error opening the file '.CONF_FILE);
  | 
        
        
            | 
            | 
           615 | 
           	}
  | 
        
        
            | 
            | 
           616 | 
           	while (!feof($file_conf)) {
  | 
        
        
            | 
            | 
           617 | 
           		$buffer = fgets($file_conf, 4096);
  | 
        
        
            | 
            | 
           618 | 
           		if ((strpos($buffer, '=') !== false) && (substr($buffer, 0, 1) !== '#')) {
  | 
        
        
           | 2450 | 
           tom.houday | 
           619 | 
           			$tmp = explode('=', $buffer, 2);
  | 
        
        
           | 2316 | 
           tom.houday | 
           620 | 
           			$conf[trim($tmp[0])] = trim($tmp[1]);
  | 
        
        
            | 
            | 
           621 | 
           		}
  | 
        
        
            | 
            | 
           622 | 
           	}
  | 
        
        
            | 
            | 
           623 | 
           	fclose($file_conf);
  | 
        
        
           | 318 | 
           richard | 
           624 | 
           }
  | 
        
        
           | 2316 | 
           tom.houday | 
           625 | 
              | 
        
        
            | 
            | 
           626 | 
           // Let's Encrypt actions
  | 
        
        
            | 
            | 
           627 | 
           if ($choix === 'le_issueCert') {
  | 
        
        
            | 
            | 
           628 | 
           	// TODO: check ndd & mail format
  | 
        
        
            | 
            | 
           629 | 
           	$email      = $_POST['email'];
  | 
        
        
            | 
            | 
           630 | 
           	$domainName = $_POST['domainname'];
  | 
        
        
            | 
            | 
           631 | 
           	exec('sudo /usr/local/bin/alcasar-letsencrypt.sh --issue --email '.escapeshellarg($email).' --domain '.escapeshellarg($domainName), $output, $exitCode);
  | 
        
        
            | 
            | 
           632 | 
           	$cmdResponse = implode("<br>\n", $output);
  | 
        
        
           | 1822 | 
           raphael.pi | 
           633 | 
           }
  | 
        
        
           | 2316 | 
           tom.houday | 
           634 | 
           if ($choix === 'le_renewCert') {
  | 
        
        
            | 
            | 
           635 | 
           	if ((isset($_POST['recheck'])) && ((!empty($_POST['recheck'])) || (!empty($_POST['recheck_force'])))) {
  | 
        
        
            | 
            | 
           636 | 
           		$forceOpt = (!empty($_POST['recheck_force'])) ? ' --force' : '';
  | 
        
        
           | 318 | 
           richard | 
           637 | 
              | 
        
        
           | 2316 | 
           tom.houday | 
           638 | 
           		exec('sudo /usr/local/bin/alcasar-letsencrypt.sh --renew' . $forceOpt, $output, $exitCode);
  | 
        
        
           | 1822 | 
           raphael.pi | 
           639 | 
              | 
        
        
           | 2316 | 
           tom.houday | 
           640 | 
           		$cmdResponse = implode("<br>\n", $output);
  | 
        
        
            | 
            | 
           641 | 
           	} else if ((isset($_POST['cancel'])) && (!empty($_POST['cancel']))) {
  | 
        
        
            | 
            | 
           642 | 
           		file_put_contents(LETS_ENCRYPT_FILE, preg_replace('/challenge=.*/','challenge=', file_get_contents(LETS_ENCRYPT_FILE)));
  | 
        
        
            | 
            | 
           643 | 
           		file_put_contents(LETS_ENCRYPT_FILE, preg_replace('/domainRequest=.*/','domainRequest=', file_get_contents(LETS_ENCRYPT_FILE)));
  | 
        
        
            | 
            | 
           644 | 
           	}
  | 
        
        
           | 1822 | 
           raphael.pi | 
           645 | 
           }
  | 
        
        
            | 
            | 
           646 | 
              | 
        
        
           | 2316 | 
           tom.houday | 
           647 | 
           // Read Let's Encrypt configuration file
  | 
        
        
            | 
            | 
           648 | 
           $file_conf_LE = fopen(LETS_ENCRYPT_FILE, 'r');
  | 
        
        
            | 
            | 
           649 | 
           if (!$file_conf_LE) {
  | 
        
        
            | 
            | 
           650 | 
           	exit('Error opening the file '.LETS_ENCRYPT_FILE);
  | 
        
        
           | 2299 | 
           tom.houday | 
           651 | 
           }
  | 
        
        
           | 2316 | 
           tom.houday | 
           652 | 
           while (!feof($file_conf_LE)) {
  | 
        
        
            | 
            | 
           653 | 
           	$buffer = fgets($file_conf_LE, 4096);
  | 
        
        
           | 2299 | 
           tom.houday | 
           654 | 
           	if ((strpos($buffer, '=') !== false) && (substr($buffer, 0, 1) !== '#')) {
  | 
        
        
           | 2450 | 
           tom.houday | 
           655 | 
           		$tmp = explode('=', $buffer, 2);
  | 
        
        
           | 2316 | 
           tom.houday | 
           656 | 
           		$LE_conf[trim($tmp[0])] = trim($tmp[1]);
  | 
        
        
           | 1822 | 
           raphael.pi | 
           657 | 
           	}
  | 
        
        
            | 
            | 
           658 | 
           }
  | 
        
        
           | 2316 | 
           tom.houday | 
           659 | 
           fclose($file_conf_LE);
  | 
        
        
            | 
            | 
           660 | 
              | 
        
        
            | 
            | 
           661 | 
           // Fonction de test de connectivité internet
  | 
        
        
            | 
            | 
           662 | 
           function internetTest() {
  | 
        
        
            | 
            | 
           663 | 
           	$host = 'www.google.fr'; # Google Test
  | 
        
        
            | 
            | 
           664 | 
           	$port = '80';
  | 
        
        
            | 
            | 
           665 | 
              | 
        
        
            | 
            | 
           666 | 
           	if (! $sock = @fsockopen($host, $port, $num, $error, 5)) {
  | 
        
        
            | 
            | 
           667 | 
           		return false;
  | 
        
        
            | 
            | 
           668 | 
           	} else {
  | 
        
        
            | 
            | 
           669 | 
           		fclose($sock);
  | 
        
        
            | 
            | 
           670 | 
           		return true;
  | 
        
        
            | 
            | 
           671 | 
           	}
  | 
        
        
            | 
            | 
           672 | 
           }
  | 
        
        
            | 
            | 
           673 | 
              | 
        
        
            | 
            | 
           674 | 
           $internet_connected = InternetTest();
  | 
        
        
            | 
            | 
           675 | 
           if ($internet_connected) {
  | 
        
        
           | 2404 | 
           tom.houday | 
           676 | 
           	$ch = curl_init('https://api.ipify.org/');
  | 
        
        
            | 
            | 
           677 | 
           	curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  | 
        
        
            | 
            | 
           678 | 
           	$internet_publicIP = curl_exec($ch);
  | 
        
        
            | 
            | 
           679 | 
           	curl_close($ch);
  | 
        
        
           | 2316 | 
           tom.houday | 
           680 | 
           } else {
  | 
        
        
            | 
            | 
           681 | 
           	$internet_publicIP = '-.-.-.-';
  | 
        
        
            | 
            | 
           682 | 
           }
  | 
        
        
            | 
            | 
           683 | 
              | 
        
        
           | 2956 | 
           rexy | 
           684 | 
           // Network interfaces, will be use later for multiple LAN interfaces
  | 
        
        
            | 
            | 
           685 | 
           $interfacesIgnored = ['lo', 'tun[0-9]*', $conf['INTIF']];
  | 
        
        
           | 2316 | 
           tom.houday | 
           686 | 
           exec("ip -o link show | awk -F': ' '{print $2}' | sed '/^" . implode('\\|', $interfacesIgnored) . "$/d'", $interfacesAvailable);
  | 
        
        
            | 
            | 
           687 | 
              | 
        
        
           | 2956 | 
           rexy | 
           688 | 
           //retreive gateway(s) parameters
  | 
        
        
            | 
            | 
           689 | 
           $gateways = [
  | 
        
        
           | 2316 | 
           tom.houday | 
           690 | 
           	(object) [
  | 
        
        
           | 2956 | 
           rexy | 
           691 | 
           		'gateway'   => $conf['GW'],
  | 
        
        
            | 
            | 
           692 | 
                   'weight'    => $conf['PUBLIC_WEIGHT']
  | 
        
        
           | 2316 | 
           tom.houday | 
           693 | 
           	]
  | 
        
        
            | 
            | 
           694 | 
           ];
  | 
        
        
           | 2956 | 
           rexy | 
           695 | 
           exec("grep \"^WAN\" " . CONF_FILE . " | wc -l", $nbIfaces);
  | 
        
        
            | 
            | 
           696 | 
           if ($nbIfaces > 0)
  | 
        
        
            | 
            | 
           697 | 
           {
  | 
        
        
            | 
            | 
           698 | 
               for ($i = 1; $i <= $nbIfaces[0]; $i++) {
  | 
        
        
            | 
            | 
           699 | 
                   exec("grep \"WAN" . $i . "=\" " . CONF_FILE . " | awk -F'\"' '{ print $2 }' | awk -F, '{ print $1 }'", $temp_gw);
  | 
        
        
            | 
            | 
           700 | 
                   exec("grep \"WAN" . $i . "=\" " . CONF_FILE . " | awk -F'\"' '{ print $2 }' | awk -F, '{ print $2 }'", $temp_weight);
  | 
        
        
            | 
            | 
           701 | 
                   $gateways[] = (object) [
  | 
        
        
            | 
            | 
           702 | 
                       'gateway'   => $temp_gw[0],
  | 
        
        
            | 
            | 
           703 | 
                       'weight'    => $temp_weight[0]
  | 
        
        
            | 
            | 
           704 | 
                   ];
  | 
        
        
            | 
            | 
           705 | 
                   $temp_gw = "";
  | 
        
        
            | 
            | 
           706 | 
                   $temp_weight = "";
  | 
        
        
            | 
            | 
           707 | 
               }
  | 
        
        
            | 
            | 
           708 | 
           }
  | 
        
        
            | 
            | 
           709 | 
              | 
        
        
            | 
            | 
           710 | 
           //retreive internal networks parameters
  | 
        
        
           | 2316 | 
           tom.houday | 
           711 | 
           $internalNetworks = [
  | 
        
        
            | 
            | 
           712 | 
           	(object) [
  | 
        
        
            | 
            | 
           713 | 
           		'interface' => $conf['INTIF'],
  | 
        
        
            | 
            | 
           714 | 
           		'ip'        => $conf['PRIVATE_IP']
  | 
        
        
            | 
            | 
           715 | 
           	]
  | 
        
        
            | 
            | 
           716 | 
           ];
  | 
        
        
            | 
            | 
           717 | 
              | 
        
        
           | 1740 | 
           richard | 
           718 | 
           ?>
  | 
        
        
           | 2813 | 
           rexy | 
           719 | 
           <!DOCTYPE HTML>
  | 
        
        
           | 2316 | 
           tom.houday | 
           720 | 
           <html>
  | 
        
        
           | 318 | 
           richard | 
           721 | 
           <head>
  | 
        
        
           | 2316 | 
           tom.houday | 
           722 | 
           	<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  | 
        
        
            | 
            | 
           723 | 
           	<title><?= $l_network_title ?></title>
  | 
        
        
           | 2817 | 
           rexy | 
           724 | 
           	<link rel="stylesheet" href="/css/acc.css" type="text/css">
  | 
        
        
           | 2316 | 
           tom.houday | 
           725 | 
           	<script src="/js/jquery.min.js"></script>
  | 
        
        
            | 
            | 
           726 | 
           	<script src="/js/jquery.connections.js"></script>
  | 
        
        
            | 
            | 
           727 | 
           	<script type="text/javascript">
  | 
        
        
            | 
            | 
           728 | 
           	function MAC_Control(formulaire){
  | 
        
        
           | 3287 | 
           rexy | 
           729 | 
           		// MAC control (hexadecimal upper case and '- or :' separator)
  | 
        
        
            | 
            | 
           730 | 
           		//var regex_mac = /^([0-9a-fA-F]{2}(-|:)){5}[0-9a-fA-F]{2}$/;
  | 
        
        
            | 
            | 
           731 | 
           		var regex_mac = /^([0-9A-Fa-f]{2}[:-]){5}([0-9A-Fa-f]{2})$/;
  | 
        
        
           | 2316 | 
           tom.houday | 
           732 | 
           		if (regex_mac.test(document.forms[formulaire].add_mac.value)){
  | 
        
        
            | 
            | 
           733 | 
           			document.forms[formulaire].add_mac.value = document.forms[formulaire].add_mac.value.toUpperCase().replace(/:/g, '-');
  | 
        
        
            | 
            | 
           734 | 
           			return true;
  | 
        
        
            | 
            | 
           735 | 
           		} else {
  | 
        
        
            | 
            | 
           736 | 
           			alert('Invalid MAC address');
  | 
        
        
            | 
            | 
           737 | 
           			return false;
  | 
        
        
            | 
            | 
           738 | 
           		}
  | 
        
        
           | 1578 | 
           richard | 
           739 | 
           	}
  | 
        
        
           | 2316 | 
           tom.houday | 
           740 | 
           	</script>
  | 
        
        
            | 
            | 
           741 | 
           	<style>
  | 
        
        
           | 2813 | 
           rexy | 
           742 | 
           		.network-configurator {
  | 
        
        
            | 
            | 
           743 | 
           			width: 100%;
  | 
        
        
            | 
            | 
           744 | 
           		}
  | 
        
        
            | 
            | 
           745 | 
           		.network-configurator > * {
  | 
        
        
            | 
            | 
           746 | 
           			display: inline-block;
  | 
        
        
            | 
            | 
           747 | 
           			vertical-align: top;
  | 
        
        
            | 
            | 
           748 | 
           			text-align: center;
  | 
        
        
            | 
            | 
           749 | 
           		}
  | 
        
        
            | 
            | 
           750 | 
           		.network-configurator > .internet, .network-configurator > .alcasar {
  | 
        
        
            | 
            | 
           751 | 
           			width: 20%;
  | 
        
        
            | 
            | 
           752 | 
           		}
  | 
        
        
            | 
            | 
           753 | 
           		.network-configurator > .externals, .network-configurator > .internals {
  | 
        
        
            | 
            | 
           754 | 
           			width: 30%;
  | 
        
        
            | 
            | 
           755 | 
           		}
  | 
        
        
            | 
            | 
           756 | 
           		.network-configurator .actions {
  | 
        
        
           | 2956 | 
           rexy | 
           757 | 
                       position: absolute;
  | 
        
        
           | 2813 | 
           rexy | 
           758 | 
           			background-color: #ddd;
  | 
        
        
            | 
            | 
           759 | 
           			padding: 0 2px;
  | 
        
        
            | 
            | 
           760 | 
           		}
  | 
        
        
            | 
            | 
           761 | 
           		.network-configurator .actions a {
  | 
        
        
            | 
            | 
           762 | 
           			text-decoration: none;
  | 
        
        
            | 
            | 
           763 | 
           		}
  | 
        
        
            | 
            | 
           764 | 
           		.network-configurator .actions a:hover {
  | 
        
        
            | 
            | 
           765 | 
           			font-weight: bold;
  | 
        
        
            | 
            | 
           766 | 
           		}
  | 
        
        
           | 2956 | 
           rexy | 
           767 | 
           		.network-configurator .actions-externals {
  | 
        
        
            | 
            | 
           768 | 
           			right: 0;
  | 
        
        
            | 
            | 
           769 | 
           			border-radius: 5px;
  | 
        
        
            | 
            | 
           770 | 
                       position: relative;
  | 
        
        
            | 
            | 
           771 | 
                       text-decoration: none;
  | 
        
        
           | 2813 | 
           rexy | 
           772 | 
           		}
  | 
        
        
            | 
            | 
           773 | 
           		.network-configurator > .alcasar .actions-internals {
  | 
        
        
            | 
            | 
           774 | 
           			bottom: 0;
  | 
        
        
            | 
            | 
           775 | 
           			right: 0;
  | 
        
        
            | 
            | 
           776 | 
           			border-radius: 5px 0;
  | 
        
        
            | 
            | 
           777 | 
           		}
  | 
        
        
            | 
            | 
           778 | 
           		.network-configurator .actions-network {
  | 
        
        
            | 
            | 
           779 | 
           			right: 0;
  | 
        
        
           | 2956 | 
           rexy | 
           780 | 
           			border-radius: 5px;
  | 
        
        
            | 
            | 
           781 | 
                       position: relative;
  | 
        
        
            | 
            | 
           782 | 
                       text-decoration: none;
  | 
        
        
           | 2813 | 
           rexy | 
           783 | 
           		}
  | 
        
        
            | 
            | 
           784 | 
           		.network-configurator .network-box {
  | 
        
        
            | 
            | 
           785 | 
           			display: inline-block;
  | 
        
        
            | 
            | 
           786 | 
           			min-height: 100px;
  | 
        
        
            | 
            | 
           787 | 
           			margin: 5px;
  | 
        
        
            | 
            | 
           788 | 
           			padding: 3px;
  | 
        
        
            | 
            | 
           789 | 
           			text-align: left;
  | 
        
        
            | 
            | 
           790 | 
           			background-color: #f7f3ef;
  | 
        
        
            | 
            | 
           791 | 
           			position: relative;
  | 
        
        
            | 
            | 
           792 | 
           			border-radius: 5px;
  | 
        
        
            | 
            | 
           793 | 
           			border: 2px solid grey;
  | 
        
        
            | 
            | 
           794 | 
           		}
  | 
        
        
            | 
            | 
           795 | 
           		.network-configurator .network-connector {
  | 
        
        
            | 
            | 
           796 | 
           			display: inline-block;
  | 
        
        
            | 
            | 
           797 | 
           			position: absolute;
  | 
        
        
            | 
            | 
           798 | 
           			top: 50%;
  | 
        
        
            | 
            | 
           799 | 
           			margin-top: -5px;
  | 
        
        
            | 
            | 
           800 | 
           			margin-left: -5px;
  | 
        
        
            | 
            | 
           801 | 
           			width: 10px;
  | 
        
        
            | 
            | 
           802 | 
           			height: 10px;
  | 
        
        
            | 
            | 
           803 | 
           			border-radius: 5px;
  | 
        
        
            | 
            | 
           804 | 
           			background-color: black;
  | 
        
        
            | 
            | 
           805 | 
           		}
  | 
        
        
            | 
            | 
           806 | 
           		.network-configurator .network-connector[data-connector-direction="left"] {
  | 
        
        
           | 2956 | 
           rexy | 
           807 | 
           			border-radius: 5px 0 0 5px;
  | 
        
        
           | 2813 | 
           rexy | 
           808 | 
           		}
  | 
        
        
            | 
            | 
           809 | 
           		.network-configurator .network-connector[data-connector-direction="right"] {
  | 
        
        
           | 2956 | 
           rexy | 
           810 | 
           			border-radius: 0 5px 5px 0;
  | 
        
        
           | 2813 | 
           rexy | 
           811 | 
           		}
  | 
        
        
            | 
            | 
           812 | 
           		.network-configurator div[data-network-type] {
  | 
        
        
            | 
            | 
           813 | 
           			position: relative;
  | 
        
        
            | 
            | 
           814 | 
           		}
  | 
        
        
           | 2316 | 
           tom.houday | 
           815 | 
           	</style>
  | 
        
        
            | 
            | 
           816 | 
           	<script>
  | 
        
        
            | 
            | 
           817 | 
           	$(document).ready(function () {
  | 
        
        
            | 
            | 
           818 | 
              | 
        
        
           | 2956 | 
           rexy | 
           819 | 
                   setTimeout(function(){$("#change_success").fadeOut('normal');}, 10000);
  | 
        
        
           | 2316 | 
           tom.houday | 
           820 | 
              | 
        
        
           | 2956 | 
           rexy | 
           821 | 
           	    //Will be used later for multiple LAN interfaces
  | 
        
        
            | 
            | 
           822 | 
           		let interfacesAvailable = <?= ((!empty($interfacesAvailable)) ? "['".implode("', '", $interfacesAvailable)."']" : '[]') ?>;
  | 
        
        
            | 
            | 
           823 | 
           		const wireStyles = { available: { border: '5px double green' } };
  | 
        
        
            | 
            | 
           824 | 
              | 
        
        
            | 
            | 
           825 | 
           		// Add gateway
  | 
        
        
            | 
            | 
           826 | 
           		$('.network-configurator').on('click', '.add-external-network', function (event) {
  | 
        
        
           | 2316 | 
           tom.houday | 
           827 | 
           			event.preventDefault();
  | 
        
        
           | 2956 | 
           rexy | 
           828 | 
           			ifaces_count = parseInt(document.getElementById("gw_count").getAttribute('value'));
  | 
        
        
            | 
            | 
           829 | 
           			$('.network-configurator .externals .network-box #ext_gateways').append(' \
  | 
        
        
            | 
            | 
           830 | 
           			            <div id="ip_routeur_' + ifaces_count + '" data-info_type="gateway" data-number="'+ ifaces_count +'">\
  | 
        
        
            | 
            | 
           831 | 
                                   <label for="ext_gateway_' + ifaces_count + '"><?= $l_ip_router.' ' ?></label><span class="gw_number">'+ (ifaces_count + 1) +'</span> <input style="width:100px" type="text" name="ip_gw_' + ifaces_count + '" id="ext_gateway_' + ifaces_count + '" value="" /> \
  | 
        
        
            | 
            | 
           832 | 
                                   <label for="ext_weight_'+ ifaces_count +'"><?= $l_gw_weight ?></label> <input style="width:20px" type="text" name="weight_' + ifaces_count + '" id="ext_weight_'+ ifaces_count +'" value="0"/> \
  | 
        
        
            | 
            | 
           833 | 
                                   <div class="actions actions-network" style="display:inline-block; width:11px"><a href="#" style="display:block; text-align:center" class="remove-network" title="Supprimer ce réseau">-</a></div><br></div> ');
  | 
        
        
            | 
            | 
           834 | 
                       ifaces_count++;
  | 
        
        
            | 
            | 
           835 | 
                       document.getElementById("gw_count").setAttribute('value', ifaces_count);
  | 
        
        
            | 
            | 
           836 | 
                       updateGatewayView();
  | 
        
        
            | 
            | 
           837 | 
                       $('div.network-connector[data-connector-network]').connections('update');
  | 
        
        
           | 2316 | 
           tom.houday | 
           838 | 
           		});
  | 
        
        
            | 
            | 
           839 | 
              | 
        
        
            | 
            | 
           840 | 
           		// Add internal network
  | 
        
        
           | 2956 | 
           rexy | 
           841 | 
           		$('.network-configurator').on('click', '.add-internal-network', function (event) {
  | 
        
        
           | 2316 | 
           tom.houday | 
           842 | 
           			event.preventDefault();
  | 
        
        
            | 
            | 
           843 | 
           			$('.network-configurator .internals').append(' \
  | 
        
        
            | 
            | 
           844 | 
           					<div data-network-type="internal"> \
  | 
        
        
            | 
            | 
           845 | 
           						<div class="network-connector" data-connector-network="internal" data-connector-direction="left"></div> \
  | 
        
        
            | 
            | 
           846 | 
           						<div class="network-box"> \
  | 
        
        
            | 
            | 
           847 | 
           							<div class="actions actions-network"><a href="#" class="remove-network" title="Supprimer ce réseau">-</a></div> \
  | 
        
        
            | 
            | 
           848 | 
           							<label for="int_interface_X"><?= 'Interface' ?></label> <select name="interface" id="int_interface_X" disabled><option value=""></option></select><br> \
  | 
        
        
            | 
            | 
           849 | 
           							<label for="int_ip_X"><?= $l_ip_address ?></label> <input style="width:150px" type="text" name="ip_private" id="int_ip_X" value="" /><br> \
  | 
        
        
            | 
            | 
           850 | 
           						</div> \
  | 
        
        
            | 
            | 
           851 | 
           					</div>');
  | 
        
        
            | 
            | 
           852 | 
           			addWire($('div[data-network-type="internal"]:last'));
  | 
        
        
            | 
            | 
           853 | 
           		});
  | 
        
        
            | 
            | 
           854 | 
              | 
        
        
           | 2956 | 
           rexy | 
           855 | 
           		// Remove gateway
  | 
        
        
            | 
            | 
           856 | 
           		$('.network-box').on('click', '.remove-network', function (event) {
  | 
        
        
           | 2316 | 
           tom.houday | 
           857 | 
           			event.preventDefault();
  | 
        
        
           | 2956 | 
           rexy | 
           858 | 
           			$(this).parent().parent().fadeOut(200, function() {
  | 
        
        
           | 2316 | 
           tom.houday | 
           859 | 
              | 
        
        
           | 2956 | 
           rexy | 
           860 | 
           			    $(this).remove();
  | 
        
        
            | 
            | 
           861 | 
           				//update network numbers
  | 
        
        
            | 
            | 
           862 | 
                           $('div[data-info_type="gateway"]').each(function (index, value) {
  | 
        
        
            | 
            | 
           863 | 
                               updateGatewayNumbers($(this), index);
  | 
        
        
            | 
            | 
           864 | 
                           });
  | 
        
        
            | 
            | 
           865 | 
                           ifaces_count = parseInt(document.getElementById("gw_count").getAttribute('value'));
  | 
        
        
            | 
            | 
           866 | 
                           document.getElementById("gw_count").setAttribute('value', (ifaces_count - 1));
  | 
        
        
            | 
            | 
           867 | 
                           updateGatewayView();
  | 
        
        
            | 
            | 
           868 | 
              | 
        
        
            | 
            | 
           869 | 
                           $('div.network-connector[data-connector-network]').connections('update');
  | 
        
        
           | 2316 | 
           tom.houday | 
           870 | 
           			});
  | 
        
        
            | 
            | 
           871 | 
           		});
  | 
        
        
            | 
            | 
           872 | 
              | 
        
        
           | 2956 | 
           rexy | 
           873 | 
           		//proxy enabled or disabled
  | 
        
        
            | 
            | 
           874 | 
           		$('.network-configurator').on('click', '.enable_proxy', function(event){
  | 
        
        
            | 
            | 
           875 | 
           		    if ($(this).is(':checked'))
  | 
        
        
            | 
            | 
           876 | 
                       {
  | 
        
        
            | 
            | 
           877 | 
                           document.getElementById("add_external").setAttribute('hidden', 'true');
  | 
        
        
            | 
            | 
           878 | 
                           document.getElementById("ext_proxy").removeAttribute('disabled');
  | 
        
        
            | 
            | 
           879 | 
                           $('div[id="ip_routeur_0"]').children('span').html('');
  | 
        
        
            | 
            | 
           880 | 
                           $('div[data-info_type="gateway"]').each(function(index, value) {
  | 
        
        
            | 
            | 
           881 | 
                               if ($(this).attr('data-number') !== "0")
  | 
        
        
            | 
            | 
           882 | 
                               {
  | 
        
        
            | 
            | 
           883 | 
                                   $(this).attr('hidden', 'true');
  | 
        
        
            | 
            | 
           884 | 
                               }
  | 
        
        
            | 
            | 
           885 | 
                               else
  | 
        
        
            | 
            | 
           886 | 
                               {
  | 
        
        
            | 
            | 
           887 | 
                                   $(this).children('input[id="ext_weight_0"]').attr('hidden', 'true');
  | 
        
        
            | 
            | 
           888 | 
                                   $(this).children('label[for="ext_weight_0"]').attr('hidden', 'true');
  | 
        
        
            | 
            | 
           889 | 
                                   $(this).children('div[class="actions actions-network"]').css('display', 'none');
  | 
        
        
            | 
            | 
           890 | 
                               }
  | 
        
        
            | 
            | 
           891 | 
                           });
  | 
        
        
            | 
            | 
           892 | 
                       }
  | 
        
        
            | 
            | 
           893 | 
                       else
  | 
        
        
            | 
            | 
           894 | 
                       {
  | 
        
        
            | 
            | 
           895 | 
                           document.getElementById("add_external").removeAttribute('hidden');
  | 
        
        
            | 
            | 
           896 | 
                           document.getElementById("ext_proxy").setAttribute('disabled', 'true');
  | 
        
        
            | 
            | 
           897 | 
                           $('div[id="ip_routeur_0"]').children('span').html('1');
  | 
        
        
            | 
            | 
           898 | 
                           $('div[data-info_type="gateway"]').each(function(index, value) {
  | 
        
        
            | 
            | 
           899 | 
                               if ($(this).attr('data-number') !== "0")
  | 
        
        
            | 
            | 
           900 | 
                               {
  | 
        
        
            | 
            | 
           901 | 
                                   $(this).removeAttr('hidden');
  | 
        
        
            | 
            | 
           902 | 
                               }
  | 
        
        
            | 
            | 
           903 | 
                               else
  | 
        
        
            | 
            | 
           904 | 
                               {
  | 
        
        
            | 
            | 
           905 | 
                                   $(this).children('input[id="ext_weight_0"]').removeAttr('hidden');
  | 
        
        
            | 
            | 
           906 | 
                                   $(this).children('label[for="ext_weight_0"]').removeAttr('hidden');
  | 
        
        
            | 
            | 
           907 | 
                                   $(this).children('div[class="actions actions-network"]').css('display', 'inline-block');
  | 
        
        
            | 
            | 
           908 | 
                               }
  | 
        
        
            | 
            | 
           909 | 
                           });
  | 
        
        
            | 
            | 
           910 | 
                           updateGatewayView();
  | 
        
        
            | 
            | 
           911 | 
                       }
  | 
        
        
            | 
            | 
           912 | 
                       $('div.network-connector[data-connector-network]').connections('update');
  | 
        
        
            | 
            | 
           913 | 
                   });
  | 
        
        
            | 
            | 
           914 | 
              | 
        
        
            | 
            | 
           915 | 
           		//Add a wire between two connectors
  | 
        
        
           | 2316 | 
           tom.houday | 
           916 | 
           		const addWire = function (network) {
  | 
        
        
            | 
            | 
           917 | 
           			const networkType = network.data('networkType');
  | 
        
        
            | 
            | 
           918 | 
           			if (networkType === 'external') {
  | 
        
        
           | 2956 | 
           rexy | 
           919 | 
                           $().connections({ from: 'div[data-network-type="internet"]>div.network-connector[data-connector-network="internet"]', to: network.children('div.network-connector[data-connector-network="internet"]'), css: wireStyles.available, within: network });
  | 
        
        
            | 
            | 
           920 | 
                           $().connections({ from: 'div[data-network-type="alcasar"]>div.network-connector[data-connector-network="external"]', to: network.children('div.network-connector[data-connector-network="external"]'), css: wireStyles.available, within: network });
  | 
        
        
            | 
            | 
           921 | 
                       } else if (networkType === 'internal') {
  | 
        
        
            | 
            | 
           922 | 
           				$().connections({ from: 'div[data-network-type="alcasar"]>div.network-connector[data-connector-network="internal"]', to: network.children('div.network-connector[data-connector-network="internal"]'), css: wireStyles.available, within: network });
  | 
        
        
           | 2316 | 
           tom.houday | 
           923 | 
           			}
  | 
        
        
           | 2325 | 
           tom.houday | 
           924 | 
           		};
  | 
        
        
           | 2316 | 
           tom.houday | 
           925 | 
              | 
        
        
           | 2956 | 
           rexy | 
           926 | 
           		//reindex the gateway numbers when a gateway is deleted
  | 
        
        
            | 
            | 
           927 | 
           		const updateGatewayNumbers = function(gateway, number) {
  | 
        
        
            | 
            | 
           928 | 
           		    old_number = gateway.attr('data-number');
  | 
        
        
            | 
            | 
           929 | 
                       gateway.attr('data-number', number);
  | 
        
        
            | 
            | 
           930 | 
                       gateway.attr('id', 'ip_routeur_'+number);
  | 
        
        
            | 
            | 
           931 | 
                       if (number === 0)
  | 
        
        
            | 
            | 
           932 | 
                       {
  | 
        
        
            | 
            | 
           933 | 
                           gateway.children('input[id="ext_gateway_'+old_number+'"]').attr('name', 'ip_gw');
  | 
        
        
            | 
            | 
           934 | 
                           gateway.children('input[id="ext_weight_'+old_number+'"]').attr('name', 'weight');
  | 
        
        
            | 
            | 
           935 | 
                       }
  | 
        
        
            | 
            | 
           936 | 
                       else
  | 
        
        
            | 
            | 
           937 | 
                       {
  | 
        
        
            | 
            | 
           938 | 
                           gateway.children('input[id="ext_gateway_'+old_number+'"]').attr('name', 'ip_gw_'+number);
  | 
        
        
            | 
            | 
           939 | 
                           gateway.children('input[id="ext_weight_'+old_number+'"]').attr('name', 'weight_'+number);
  | 
        
        
            | 
            | 
           940 | 
                       }
  | 
        
        
            | 
            | 
           941 | 
                       gateway.children('label[for="ext_gateway_'+old_number+'"]').attr('for', 'ext_gateway_'+number);
  | 
        
        
            | 
            | 
           942 | 
                       gateway.children('input[id="ext_gateway_'+old_number+'"]').attr('id', 'ext_gateway_'+number);
  | 
        
        
            | 
            | 
           943 | 
                       gateway.children('label[for="ext_weight_'+old_number+'"]').attr('for', 'ext_weight_'+number);
  | 
        
        
            | 
            | 
           944 | 
                       gateway.children('input[id="ext_weight_'+old_number+'"]').attr('id', 'ext_weight_'+number);
  | 
        
        
            | 
            | 
           945 | 
                       gateway.children('span[class="gw_number"]').html((number+1)+' ');
  | 
        
        
            | 
            | 
           946 | 
              | 
        
        
            | 
            | 
           947 | 
                   };
  | 
        
        
            | 
            | 
           948 | 
              | 
        
        
            | 
            | 
           949 | 
           		//hide the delete button and the weight field when there is only one gateway (or when there is a proxy)
  | 
        
        
            | 
            | 
           950 | 
           		const updateGatewayView = function() {
  | 
        
        
            | 
            | 
           951 | 
                       ifaces_count = parseInt(document.getElementById("gw_count").getAttribute('value'));
  | 
        
        
            | 
            | 
           952 | 
                       if (ifaces_count === 1)
  | 
        
        
            | 
            | 
           953 | 
                       {
  | 
        
        
            | 
            | 
           954 | 
                           $('div#ip_routeur_0').children('input[id="ext_weight_0"]').attr('hidden', 'true');
  | 
        
        
            | 
            | 
           955 | 
                           $('div#ip_routeur_0').children('label[for="ext_weight_0"]').attr('hidden', 'true');
  | 
        
        
            | 
            | 
           956 | 
                           $('div#ip_routeur_0').children('div[class="actions actions-network"]').css('display', 'none');
  | 
        
        
            | 
            | 
           957 | 
                       }
  | 
        
        
            | 
            | 
           958 | 
                       else
  | 
        
        
            | 
            | 
           959 | 
                       {
  | 
        
        
            | 
            | 
           960 | 
                           $('div#ip_routeur_0').children('input[id="ext_weight_0"]').removeAttr('hidden');
  | 
        
        
            | 
            | 
           961 | 
                           $('div#ip_routeur_0').children('label[for="ext_weight_0"]').removeAttr('hidden');
  | 
        
        
            | 
            | 
           962 | 
                           $('div#ip_routeur_0').children('div[class="actions actions-network"]').css('display', 'inline-block');
  | 
        
        
            | 
            | 
           963 | 
                       }
  | 
        
        
            | 
            | 
           964 | 
                   };
  | 
        
        
            | 
            | 
           965 | 
              | 
        
        
            | 
            | 
           966 | 
           		//resize the connections to fit the window
  | 
        
        
           | 2325 | 
           tom.houday | 
           967 | 
           		window.addEventListener('resize', function () {
  | 
        
        
            | 
            | 
           968 | 
           			$('div.network-connector[data-connector-network]').connections('update');
  | 
        
        
            | 
            | 
           969 | 
           		});
  | 
        
        
            | 
            | 
           970 | 
              | 
        
        
           | 2956 | 
           rexy | 
           971 | 
           		// Add wires to existing networks at page first render
  | 
        
        
           | 2316 | 
           tom.houday | 
           972 | 
           		$('div[data-network-type="external"]').add('div[data-network-type="internal"]').each(function (index, element) {
  | 
        
        
            | 
            | 
           973 | 
           			addWire($(this));
  | 
        
        
           | 2325 | 
           tom.houday | 
           974 | 
           		});
  | 
        
        
           | 2316 | 
           tom.houday | 
           975 | 
           	});
  | 
        
        
            | 
            | 
           976 | 
           	</script>
  | 
        
        
           | 318 | 
           richard | 
           977 | 
           </head>
  | 
        
        
            | 
            | 
           978 | 
           <body>
  | 
        
        
           | 3028 | 
           rexy | 
           979 | 
           <div id="ldoverlay" class="overlay">
  | 
        
        
            | 
            | 
           980 | 
           	<div class="lds-spinner" id="spinner"><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div></div>
  | 
        
        
            | 
            | 
           981 | 
           </div>
  | 
        
        
           | 2813 | 
           rexy | 
           982 | 
           <div class="panel">
  | 
        
        
            | 
            | 
           983 | 
           	<div class="panel-header"><?= $l_network_title ?></div>
  | 
        
        
            | 
            | 
           984 | 
           	<div class="panel-row">
  | 
        
        
            | 
            | 
           985 | 
           		<form action="<?= htmlspecialchars($_SERVER['PHP_SELF']) ?>" method="post">
  | 
        
        
            | 
            | 
           986 | 
           			<div class="network-configurator">
  | 
        
        
            | 
            | 
           987 | 
           				<div class="internet">
  | 
        
        
            | 
            | 
           988 | 
           					<div data-network-type="internet">
  | 
        
        
            | 
            | 
           989 | 
           						<div class="network-box">
  | 
        
        
            | 
            | 
           990 | 
           							<?= $l_internet_legend ?> <img src="/images/state_<?= (($internet_connected) ? 'ok' : 'error') ?>.gif"><br>
  | 
        
        
            | 
            | 
           991 | 
           							<?= $l_ip_public ?> : <?= $internet_publicIP ?><br>
  | 
        
        
            | 
            | 
           992 | 
           							<label for="dns1"><?= $l_ip_dns1 ?></label> : <input style="width:120px" type="text" id="dns1" name="dns1" value="<?= $conf['DNS1'] ?>" /><br>
  | 
        
        
            | 
            | 
           993 | 
           							<label for="dns2"><?= $l_ip_dns2 ?></label> : <input style="width:120px" type="text" id="dns2" name="dns2" value="<?= $conf['DNS2'] ?>" />
  | 
        
        
            | 
            | 
           994 | 
           						</div>
  | 
        
        
            | 
            | 
           995 | 
           						<div class="network-connector" data-connector-network="internet" data-connector-direction="right"></div>
  | 
        
        
            | 
            | 
           996 | 
           					</div>
  | 
        
        
           | 2956 | 
           rexy | 
           997 | 
           				</div><div id="externals_id" class="externals">
  | 
        
        
           | 2813 | 
           rexy | 
           998 | 
           						<div data-network-type="external">
  | 
        
        
            | 
            | 
           999 | 
           							<div class="network-connector" data-connector-network="internet" data-connector-direction="left"></div>
  | 
        
        
           | 2316 | 
           tom.houday | 
           1000 | 
           							<div class="network-box">
  | 
        
        
           | 2956 | 
           rexy | 
           1001 | 
           								<label for="ext_interface">Interface</label> <input name="ext_interface" id="ext_interface" value="<?= $conf['EXTIF'] ?>" disabled="disabled"/><br>
  | 
        
        
            | 
            | 
           1002 | 
           								<label for="ext_ip"><?= $l_ip_address ?></label> <input style="width:130px" type="text" name="ip_public" id="ext_ip" value="<?= $conf['PUBLIC_IP'] ?>" /><br>
  | 
        
        
            | 
            | 
           1003 | 
                                           <input class="enable_proxy" type="checkbox" name="enable_proxy" value="P_Enabled" <?php if($conf['PROXY'] === 'on' || $conf['PROXY'] === 'On') { echo 'checked'; }?>/>
  | 
        
        
            | 
            | 
           1004 | 
                                           <label for="proxy">Proxy</label> <input style="width:140px" type="text" name="proxy" id="ext_proxy" value=<?= $conf['PROXY_IP']?> <?php echo ($conf['PROXY'] === 'on' || $conf['PROXY'] === 'On')? '' : 'disabled'?>/><br>
  | 
        
        
            | 
            | 
           1005 | 
                                           <div id="ext_gateways" >
  | 
        
        
            | 
            | 
           1006 | 
                                               <input type="text" name="gw_count" id="gw_count" value="<?=count($gateways)?>" hidden="hidden"/>
  | 
        
        
            | 
            | 
           1007 | 
                                               <?php foreach ($gateways as $index => $network):
  | 
        
        
            | 
            | 
           1008 | 
                                                   if ($index == 0) {?>
  | 
        
        
            | 
            | 
           1009 | 
                                                       <div id="ip_routeur_<?= $index ?>" data-info_type="gateway" data-number="<?= $index ?>">
  | 
        
        
            | 
            | 
           1010 | 
                                                           <label for="ext_gateway_<?= $index ?>"><?= $l_ip_router.' ' ?></label>
  | 
        
        
            | 
            | 
           1011 | 
                                                           <span class="gw_number"><?= ($conf['PROXY'] === 'on' || $conf['PROXY'] === 'On')?'':($index+1) ?> </span>
  | 
        
        
            | 
            | 
           1012 | 
                                                           <input style="width:100px" type="text" name="ip_gw" id="ext_gateway_<?= $index ?>" value="<?= $network->gateway ?>" />
  | 
        
        
            | 
            | 
           1013 | 
                                                           <label for="ext_weight_<?= $index ?>" <?php echo ($conf['PROXY'] === 'on' || $conf['PROXY'] === 'On'|| $conf['MULTIWAN'] === 'Off' || $conf['MULTIWAN'] === 'off')? 'hidden' : '' ?>><?= $l_gw_weight ?></label>
  | 
        
        
            | 
            | 
           1014 | 
                                                           <input style="width:20px" type="text" name="weight" id="ext_weight_<?= $index ?>" value="<?= $network->weight ?>" <?php echo ($conf['PROXY'] === 'on' || $conf['PROXY'] === 'On' || $conf['MULTIWAN'] === 'Off' || $conf['MULTIWAN'] === 'off')? 'hidden' : '' ?>/>
  | 
        
        
            | 
            | 
           1015 | 
                                                           <div class="actions actions-network" style="display: <?php echo ($conf['PROXY'] === 'on' || $conf['PROXY'] === 'On'|| $conf['MULTIWAN'] === 'Off' || $conf['MULTIWAN'] === 'off')? 'none' : 'inline-block' ?>; width:11px">
  | 
        
        
            | 
            | 
           1016 | 
                                                               <a style="display:block; text-align:center" href="#" class="remove-network" title="Supprimer ce réseau">-</a>
  | 
        
        
            | 
            | 
           1017 | 
                                                           </div><br>
  | 
        
        
            | 
            | 
           1018 | 
                                                       </div>
  | 
        
        
            | 
            | 
           1019 | 
                                                   <?php } else {?>
  | 
        
        
            | 
            | 
           1020 | 
                                                       <div id="ip_routeur_<?= $index ?>" data-info_type="gateway" data-number="<?= $index ?>" <?php echo ($conf['PROXY'] === 'on' || $conf['PROXY'] === 'On')? 'hidden' : '' ?>>
  | 
        
        
            | 
            | 
           1021 | 
                                                           <label for="ext_gateway_<?= $index ?>"><?= $l_ip_router.' ' ?></label>
  | 
        
        
            | 
            | 
           1022 | 
                                                           <span class="gw_number"><?= ($index+1) ?> </span>
  | 
        
        
            | 
            | 
           1023 | 
                                                           <input style="width:100px" type="text" name="ip_gw_<?= $index ?>" id="ext_gateway_<?= $index ?>" value="<?= $network->gateway ?>"/>
  | 
        
        
            | 
            | 
           1024 | 
                                                           <label for="ext_weight_<?= $index ?>"><?= $l_gw_weight ?></label>
  | 
        
        
            | 
            | 
           1025 | 
                                                           <input style="width:20px" type="text" name="weight_<?= $index ?>" id="ext_weight_<?= $index ?>" value="<?= $network->weight ?>"/>
  | 
        
        
            | 
            | 
           1026 | 
                                                           <div class="actions actions-network" style="display:inline-block; width:11px">
  | 
        
        
            | 
            | 
           1027 | 
                                                               <a style="display:block; text-align:center" href="#" class="remove-network" title="Supprimer ce réseau">-</a>
  | 
        
        
            | 
            | 
           1028 | 
                                                           </div><br>
  | 
        
        
            | 
            | 
           1029 | 
                                                       </div>
  | 
        
        
            | 
            | 
           1030 | 
                                               <?php } endforeach; ?>
  | 
        
        
            | 
            | 
           1031 | 
                                           </div>
  | 
        
        
            | 
            | 
           1032 | 
                                           <div class="actions actions-externals" style="margin: 0 auto; width:11px"><a id="add_external" href="#" class="add-external-network" title="Ajouter un réseau externe" <?php echo ($conf['PROXY'] === 'on' || $conf['PROXY'] === 'On')? 'hidden' : '' ?>>+</a></div>
  | 
        
        
            | 
            | 
           1033 | 
                                       </div>
  | 
        
        
           | 2813 | 
           rexy | 
           1034 | 
           							<div class="network-connector" data-connector-network="external" data-connector-direction="right"></div>
  | 
        
        
           | 2316 | 
           tom.houday | 
           1035 | 
           						</div>
  | 
        
        
           | 2813 | 
           rexy | 
           1036 | 
           				</div><div class="alcasar">
  | 
        
        
            | 
            | 
           1037 | 
           					<div data-network-type="alcasar">
  | 
        
        
            | 
            | 
           1038 | 
           						<div class="network-connector" data-connector-network="external" data-connector-direction="left"></div>
  | 
        
        
            | 
            | 
           1039 | 
           						<div class="network-box">
  | 
        
        
            | 
            | 
           1040 | 
           							<div class="alcasar-logo"><img src="/images/logo-alcasar.png" style="width: 100px;height: 100px;"></div>
  | 
        
        
            | 
            | 
           1041 | 
           							<!-- <div class="actions actions-internals">
  | 
        
        
            | 
            | 
           1042 | 
           								<div><a href="#" class="add-internal-network" title="Ajouter un réseau interne">+</a></div>
  | 
        
        
            | 
            | 
           1043 | 
           								<div><a href="#" class="add-internal-wifi-network">++</a></div>
  | 
        
        
            | 
            | 
           1044 | 
           							</div> -->
  | 
        
        
            | 
            | 
           1045 | 
           						</div>
  | 
        
        
            | 
            | 
           1046 | 
           						<div class="network-connector" data-connector-network="internal" data-connector-direction="right"></div>
  | 
        
        
            | 
            | 
           1047 | 
           					</div>
  | 
        
        
           | 2956 | 
           rexy | 
           1048 | 
           				</div><div id="internals_id" class="internals" data-count="1">
  | 
        
        
           | 2813 | 
           rexy | 
           1049 | 
           					<?php foreach ($internalNetworks as $network): ?>
  | 
        
        
            | 
            | 
           1050 | 
           						<div data-network-type="internal">
  | 
        
        
            | 
            | 
           1051 | 
           							<div class="network-connector" data-connector-network="internal" data-connector-direction="left"></div>
  | 
        
        
           | 2316 | 
           tom.houday | 
           1052 | 
           							<div class="network-box">
  | 
        
        
           | 2813 | 
           rexy | 
           1053 | 
           								<!-- <div class="actions actions-network"><a href="#" class="remove-network" title="Supprimer ce réseau">-</a></div> -->
  | 
        
        
            | 
            | 
           1054 | 
           								<label for="int_interface_<?= $index ?>"><?= 'Interface' ?></label> <select name="int_interface[<?= $index ?>]" id="int_interface_<?= $index ?>" disabled><option value="<?= $network->interface ?>"><?= $network->interface ?></option></select><br>
  | 
        
        
            | 
            | 
           1055 | 
           								<label for="int_ip_<?= $index ?>"><?= $l_ip_address ?></label> <input style="width:150px" type="text" name="ip_private" id="int_ip_<?= $index ?>" value="<?= $network->ip ?>" /><br>
  | 
        
        
           | 2316 | 
           tom.houday | 
           1056 | 
           							</div>
  | 
        
        
            | 
            | 
           1057 | 
           						</div>
  | 
        
        
           | 2813 | 
           rexy | 
           1058 | 
           					<? endforeach; ?>
  | 
        
        
           | 2316 | 
           tom.houday | 
           1059 | 
           				</div>
  | 
        
        
           | 2813 | 
           rexy | 
           1060 | 
           			</div>
  | 
        
        
           | 2956 | 
           rexy | 
           1061 | 
                       <?php if ($ext_conf_error == true) {
  | 
        
        
            | 
            | 
           1062 | 
                           echo '<span style="color:red">';
  | 
        
        
            | 
            | 
           1063 | 
                           $temp = 0;
  | 
        
        
            | 
            | 
           1064 | 
                           while (isset($ext_conf_error_list[$temp])) {
  | 
        
        
            | 
            | 
           1065 | 
                               echo $ext_conf_error_list[$temp].'<br>';
  | 
        
        
            | 
            | 
           1066 | 
                               $temp++;
  | 
        
        
            | 
            | 
           1067 | 
                           }
  | 
        
        
            | 
            | 
           1068 | 
                           echo '</span>';
  | 
        
        
            | 
            | 
           1069 | 
                       }
  | 
        
        
            | 
            | 
           1070 | 
                       else if (($choix === 'network_change') && ($modification_proxy || $modification_dns || $modification_network)) {
  | 
        
        
            | 
            | 
           1071 | 
                           echo '<span id="change_success" style="color:green">'.$l_change_successful.'</span>';
  | 
        
        
            | 
            | 
           1072 | 
                       }?>
  | 
        
        
           | 2813 | 
           rexy | 
           1073 | 
           			<hr>
  | 
        
        
            | 
            | 
           1074 | 
           			<div style="text-align: center; margin: 5px">
  | 
        
        
            | 
            | 
           1075 | 
           				<input type="hidden" name="choix" value="network_change">
  | 
        
        
           | 3028 | 
           rexy | 
           1076 | 
           				<input type="submit" onClick="document.getElementById('ldoverlay').style.display='block';" value="<?= $l_apply ?>">
  | 
        
        
           | 2813 | 
           rexy | 
           1077 | 
           			</div>
  | 
        
        
            | 
            | 
           1078 | 
           		</form>
  | 
        
        
           | 2316 | 
           tom.houday | 
           1079 | 
           	</div>
  | 
        
        
           | 2813 | 
           rexy | 
           1080 | 
           </div>
  | 
        
        
            | 
            | 
           1081 | 
           <br>
  | 
        
        
            | 
            | 
           1082 | 
           <div class="panel">
  | 
        
        
            | 
            | 
           1083 | 
           	<div class="panel-header"><?= $l_static_dhcp_title ?></div>
  | 
        
        
            | 
            | 
           1084 | 
           </div>
  | 
        
        
           | 2304 | 
           tom.houday | 
           1085 | 
           <table width="100%" cellspacing="0" cellpadding="5" border="1">
  | 
        
        
           | 2708 | 
           tom.houday | 
           1086 | 
           	<tr><td width="50%" align="center" valign="middle">
  | 
        
        
            | 
            | 
           1087 | 
           		<form action="network.php" method="POST">
  | 
        
        
           | 2316 | 
           tom.houday | 
           1088 | 
           		<table cellspacing="2" cellpadding="3" border="1">
  | 
        
        
           | 2708 | 
           tom.houday | 
           1089 | 
           		<tr><th><?= $l_mac_address ?></th><th><?= $l_ip_address ?></th><th>Info<th><?= $l_del ?></th></tr>
  | 
        
        
           | 2316 | 
           tom.houday | 
           1090 | 
           		<?php
  | 
        
        
           | 2708 | 
           tom.houday | 
           1091 | 
           		// Read the "ether" file
  | 
        
        
            | 
            | 
           1092 | 
           		exec('sudo /sbin/ip link show '.escapeshellarg($conf["INTIF"]), $output);
  | 
        
        
            | 
            | 
           1093 | 
           		$detail = explode(' ', $output[1]);
  | 
        
        
            | 
            | 
           1094 | 
           		$intif_mac_addr = strtoupper(str_replace(':', '-', $detail[5]));
  | 
        
        
            | 
            | 
           1095 | 
           		unset($output); unset($detail);
  | 
        
        
           | 2316 | 
           tom.houday | 
           1096 | 
           		$line_exist = false;
  | 
        
        
           | 2708 | 
           tom.houday | 
           1097 | 
           		$tab = file(ETHERS_INFO_FILE);
  | 
        
        
            | 
            | 
           1098 | 
           		if ($tab) { // le fichier n'est pas vide
  | 
        
        
           | 2316 | 
           tom.houday | 
           1099 | 
           			foreach ($tab as $line) {
  | 
        
        
           | 2708 | 
           tom.houday | 
           1100 | 
           				$fields = explode(' ', $line);
  | 
        
        
            | 
            | 
           1101 | 
           				$mac_addr = $fields[0];
  | 
        
        
            | 
            | 
           1102 | 
           				$ip_addr  = $fields[1];
  | 
        
        
           | 2713 | 
           tom.houday | 
           1103 | 
           				$info     = (isset($fields[2])) ? implode(' ', array_slice($fields, 2)) : ' ';
  | 
        
        
           | 2956 | 
           rexy | 
           1104 | 
              | 
        
        
           | 2708 | 
           tom.houday | 
           1105 | 
           				echo '<tr>';
  | 
        
        
            | 
            | 
           1106 | 
           				echo "<td>$mac_addr</td>";
  | 
        
        
            | 
            | 
           1107 | 
           				echo "<td>$ip_addr</td>";
  | 
        
        
            | 
            | 
           1108 | 
           				if ($mac_addr !== $intif_mac_addr) {
  | 
        
        
            | 
            | 
           1109 | 
           					echo '<td>'.ltrim($info, '#').'</td>';
  | 
        
        
            | 
            | 
           1110 | 
           					echo "<td><input type=\"checkbox\" name=\"$mac_addr\"></td>";
  | 
        
        
            | 
            | 
           1111 | 
           					$line_exist=True;
  | 
        
        
            | 
            | 
           1112 | 
           				} else {
  | 
        
        
            | 
            | 
           1113 | 
           					echo '<td>ALCASAR</td>';
  | 
        
        
            | 
            | 
           1114 | 
           					echo '<td></td>';
  | 
        
        
           | 2316 | 
           tom.houday | 
           1115 | 
           				}
  | 
        
        
           | 2708 | 
           tom.houday | 
           1116 | 
           				echo '</tr>';
  | 
        
        
           | 1959 | 
           richard | 
           1117 | 
           			}
  | 
        
        
            | 
            | 
           1118 | 
           		}
  | 
        
        
           | 2316 | 
           tom.houday | 
           1119 | 
           		?>
  | 
        
        
            | 
            | 
           1120 | 
           		</table>
  | 
        
        
            | 
            | 
           1121 | 
           		<?php if ($line_exist): ?>
  | 
        
        
           | 2708 | 
           tom.houday | 
           1122 | 
           			<input type="hidden" name="choix" value="del_mac">
  | 
        
        
           | 3028 | 
           rexy | 
           1123 | 
           			<input type="submit" onClick="document.getElementById('ldoverlay').style.display='block';" value="<?= $l_apply ?>">
  | 
        
        
           | 2316 | 
           tom.houday | 
           1124 | 
           		<?php endif; ?>
  | 
        
        
            | 
            | 
           1125 | 
           		</form>
  | 
        
        
           | 2708 | 
           tom.houday | 
           1126 | 
           	</td><td width="50%" valign="middle" align="center">
  | 
        
        
            | 
            | 
           1127 | 
           		<form name="new_mac" action="network.php" method="POST">
  | 
        
        
            | 
            | 
           1128 | 
           			<table cellspacing="2" cellpadding="3" border="1">
  | 
        
        
            | 
            | 
           1129 | 
           				<tr><th><?= $l_mac_address ?></th><th><?= $l_ip_address ?></th><th>Info</th><td></td></tr>
  | 
        
        
            | 
            | 
           1130 | 
           				<tr><td>Ex. : 12-2F-36-A4-DF-43</td><td>Ex. : 192.168.182.10</td><td>Ex. : Switch<td></td></tr>
  | 
        
        
            | 
            | 
           1131 | 
           				<tr><td><input type="text" name="add_mac" size="17"></td>
  | 
        
        
            | 
            | 
           1132 | 
           				<td><input type="text" name="add_ip" size="10"></td>
  | 
        
        
            | 
            | 
           1133 | 
           				<td><input type="text" name="info" size="10"></td>
  | 
        
        
            | 
            | 
           1134 | 
           				<td>
  | 
        
        
            | 
            | 
           1135 | 
           					<input type="hidden" name="choix" value="new_mac">
  | 
        
        
           | 3028 | 
           rexy | 
           1136 | 
           					<input type="submit" onClick="document.getElementById('ldoverlay').style.display='block';" class="button" value="<?= $l_add_to_list ?>" onclick="return MAC_Control('new_mac');">
  | 
        
        
           | 2708 | 
           tom.houday | 
           1137 | 
           				</td>
  | 
        
        
            | 
            | 
           1138 | 
           			</tr></table>
  | 
        
        
           | 2316 | 
           tom.houday | 
           1139 | 
           		</form>
  | 
        
        
           | 2708 | 
           tom.houday | 
           1140 | 
           	</td></tr>
  | 
        
        
           | 1959 | 
           richard | 
           1141 | 
           </table>
  | 
        
        
           | 2316 | 
           tom.houday | 
           1142 | 
           <br>
  | 
        
        
           | 2813 | 
           rexy | 
           1143 | 
           <div class="panel">
  | 
        
        
            | 
            | 
           1144 | 
           	<div class="panel-header"><?= $l_local_dns ?></div>
  | 
        
        
            | 
            | 
           1145 | 
           </div>
  | 
        
        
           | 2709 | 
           tom.houday | 
           1146 | 
           <table width="100%" cellspacing="0" cellpadding="5" border="1">
  | 
        
        
            | 
            | 
           1147 | 
           	<tr>
  | 
        
        
            | 
            | 
           1148 | 
           		<td width="50%" align="center">
  | 
        
        
            | 
            | 
           1149 | 
           			<form action="<?= htmlspecialchars($_SERVER['PHP_SELF']) ?>" method="POST">
  | 
        
        
            | 
            | 
           1150 | 
           			<table cellspacing="2" cellpadding="3" border="1">
  | 
        
        
            | 
            | 
           1151 | 
           			<tr><th><?= $l_ip_address ?></th><th><?= $l_host_name ?></th><th><?= $l_del ?></th></tr>
  | 
        
        
            | 
            | 
           1152 | 
           			<?php
  | 
        
        
            | 
            | 
           1153 | 
           			// Read the "dns_local" file
  | 
        
        
            | 
            | 
           1154 | 
           			$line_exist = false;
  | 
        
        
            | 
            | 
           1155 | 
           			$tab = file(DNS_LOCAL_FILE);
  | 
        
        
            | 
            | 
           1156 | 
           			if ($tab) { // not empty
  | 
        
        
            | 
            | 
           1157 | 
           				foreach ($tab as $line) {
  | 
        
        
            | 
            | 
           1158 | 
           					if (preg_match ('/^\d+/', $line)) { # begin with one or several digit
  | 
        
        
            | 
            | 
           1159 | 
           						$line_exist = true;
  | 
        
        
            | 
            | 
           1160 | 
           						$field = preg_split("/\s+/",$line); # split with one or several whitespace (or tab)
  | 
        
        
            | 
            | 
           1161 | 
           						$ip_addr   = $field[0];
  | 
        
        
            | 
            | 
           1162 | 
           						$host_name = $field[1];
  | 
        
        
            | 
            | 
           1163 | 
           						echo "<tr><td>$ip_addr</td>";
  | 
        
        
            | 
            | 
           1164 | 
           						echo "<td>$host_name</td>";
  | 
        
        
            | 
            | 
           1165 | 
           						if (($ip_addr == "127.0.0.1")|($host_name == "alcasar")) {
  | 
        
        
            | 
            | 
           1166 | 
           							echo "<td>";}
  | 
        
        
            | 
            | 
           1167 | 
           						else {
  | 
        
        
            | 
            | 
           1168 | 
           							echo "<td><input type=\"checkbox\" name=\"$ip_addr|$host_name\">";
  | 
        
        
            | 
            | 
           1169 | 
           						}
  | 
        
        
            | 
            | 
           1170 | 
           						echo "</td></tr>";
  | 
        
        
            | 
            | 
           1171 | 
           					}
  | 
        
        
            | 
            | 
           1172 | 
           				}
  | 
        
        
            | 
            | 
           1173 | 
           			}
  | 
        
        
            | 
            | 
           1174 | 
           			if (!$line_exist) {
  | 
        
        
            | 
            | 
           1175 | 
           				echo '<tr><td colspan="3" style="text-align: center;font-style: italic;">'.$l_empty.'</td></tr>';
  | 
        
        
            | 
            | 
           1176 | 
           			}
  | 
        
        
            | 
            | 
           1177 | 
           			?>
  | 
        
        
            | 
            | 
           1178 | 
           			</table>
  | 
        
        
            | 
            | 
           1179 | 
           			<?php if ($line_exist): ?>
  | 
        
        
            | 
            | 
           1180 | 
           				<input type="hidden" name="choix" value="del_host">
  | 
        
        
           | 3028 | 
           rexy | 
           1181 | 
           				<input type="submit" onClick="document.getElementById('ldoverlay').style.display='block';" value="<?= $l_apply ?>">
  | 
        
        
           | 2709 | 
           tom.houday | 
           1182 | 
           			<?php endif; ?>
  | 
        
        
            | 
            | 
           1183 | 
           			</form>
  | 
        
        
            | 
            | 
           1184 | 
           		</td>
  | 
        
        
            | 
            | 
           1185 | 
           		<td width="50%" valign="middle" align="center">
  | 
        
        
            | 
            | 
           1186 | 
           			<form name="new_host" action="<?= htmlspecialchars($_SERVER['PHP_SELF']) ?>" method="POST">
  | 
        
        
            | 
            | 
           1187 | 
           			<table cellspacing="2" cellpadding="3" border="1">
  | 
        
        
            | 
            | 
           1188 | 
           			<tr>
  | 
        
        
            | 
            | 
           1189 | 
           				<th><?= $l_ip_address ?></th><th><?= $l_host_name ?></th><td></td>
  | 
        
        
            | 
            | 
           1190 | 
           			</tr>
  | 
        
        
            | 
            | 
           1191 | 
           			<tr>
  | 
        
        
            | 
            | 
           1192 | 
           				<td>Ex. : 192.168.182.10</td><td>Ex. : my_nas</td><td></td>
  | 
        
        
            | 
            | 
           1193 | 
           			</tr>
  | 
        
        
            | 
            | 
           1194 | 
           			<tr>
  | 
        
        
            | 
            | 
           1195 | 
           				<td><input type="text" name="add_ip" size="10"><input type="hidden" name="choix" value="new_host"></td>
  | 
        
        
            | 
            | 
           1196 | 
           				<td><input type="text" name="add_host" size="17"></td>
  | 
        
        
           | 3028 | 
           rexy | 
           1197 | 
           				<td><input type="submit" onClick="document.getElementById('ldoverlay').style.display='block';" class="button" value="<?= $l_add_to_list ?>"></td>
  | 
        
        
           | 2709 | 
           tom.houday | 
           1198 | 
           			</tr>
  | 
        
        
            | 
            | 
           1199 | 
           			</table>
  | 
        
        
            | 
            | 
           1200 | 
           			</form>
  | 
        
        
            | 
            | 
           1201 | 
           		</td>
  | 
        
        
            | 
            | 
           1202 | 
           	</tr>
  | 
        
        
            | 
            | 
           1203 | 
           </table>
  | 
        
        
            | 
            | 
           1204 | 
           <br>
  | 
        
        
           | 2813 | 
           rexy | 
           1205 | 
           <div class="panel">
  | 
        
        
            | 
            | 
           1206 | 
           	<div class="panel-header"><?= $l_ssl_title ?></div>
  | 
        
        
            | 
            | 
           1207 | 
           	<div class="panel-row">
  | 
        
        
           | 2609 | 
           rexy | 
           1208 | 
           		<form method="post" action="<?= htmlspecialchars($_SERVER['PHP_SELF']) ?>">
  | 
        
        
           | 3041 | 
           rexy | 
           1209 | 
           			<input type="hidden" name="choix" value="https_login">
  | 
        
        
            | 
            | 
           1210 | 
           			<input type="checkbox" name="https_login" id="https_login" <?= ($conf['HTTPS_LOGIN'] === 'on')? "checked": "" ?>><b><?= $l_ssl_title ?></b><br>
  | 
        
        
            | 
            | 
           1211 | 
           			<input type="submit" onClick="document.getElementById('ldoverlay').style.display='block';" value="<?= $l_apply ?>"><br>
  | 
        
        
           | 2609 | 
           rexy | 
           1212 | 
           		</form>
  | 
        
        
           | 2813 | 
           rexy | 
           1213 | 
           	</div>
  | 
        
        
            | 
            | 
           1214 | 
           </div>
  | 
        
        
           | 2609 | 
           rexy | 
           1215 | 
           <br>
  | 
        
        
           | 2813 | 
           rexy | 
           1216 | 
           <div class="panel">
  | 
        
        
           | 3046 | 
           rexy | 
           1217 | 
           	<div class="panel-header"><?= $l_interlan_title ?></div>
  | 
        
        
            | 
            | 
           1218 | 
           	<div class="panel-row">
  | 
        
        
            | 
            | 
           1219 | 
           		<form method="post" action="<?= htmlspecialchars($_SERVER['PHP_SELF']) ?>">
  | 
        
        
            | 
            | 
           1220 | 
           			<input type="hidden" name="choix" value="interlan">
  | 
        
        
            | 
            | 
           1221 | 
           			<input type="checkbox" name="interlan" id="interlan" <?= ($conf['INTERLAN'] === 'on')? "checked": "" ?>><b><?= $l_interlan_title ?></b><br>
  | 
        
        
            | 
            | 
           1222 | 
           			<input type="submit" onClick="document.getElementById('ldoverlay').style.display='block';" value="<?= $l_apply ?>"><br>
  | 
        
        
            | 
            | 
           1223 | 
           		</form>
  | 
        
        
            | 
            | 
           1224 | 
           	</div>
  | 
        
        
            | 
            | 
           1225 | 
           </div>
  | 
        
        
            | 
            | 
           1226 | 
           <br>
  | 
        
        
            | 
            | 
           1227 | 
           <div class="panel">
  | 
        
        
           | 3040 | 
           rexy | 
           1228 | 
           	<div class="panel-header"><?= $l_ssh_title ?></div>
  | 
        
        
           | 3041 | 
           rexy | 
           1229 | 
           	<table width="100%" cellspacing="0" cellpadding="5" border="1">
  | 
        
        
            | 
            | 
           1230 | 
           	<tr>
  | 
        
        
            | 
            | 
           1231 | 
           		<td width="50%" align="center">
  | 
        
        
            | 
            | 
           1232 | 
           			<div class="panel-row">
  | 
        
        
            | 
            | 
           1233 | 
           				<form method="post" action="<?= htmlspecialchars($_SERVER['PHP_SELF']) ?>">
  | 
        
        
            | 
            | 
           1234 | 
           					<input type="hidden" name="choix" value="enable_lan_ssh">
  | 
        
        
           | 3042 | 
           rexy | 
           1235 | 
           					<input type="checkbox" name="sshlan" id="sshlan" <?= $conf['SSH_LAN'] !== '0' ? "checked": "" ?> onchange="document.getElementById('sshtablelan').style.display = this.checked ? 'block' : 'none';"> <b><?= $l_ssh_lan_activate ?></b><br><br>
  | 
        
        
            | 
            | 
           1236 | 
           					<div id="sshtablelan" style="display:<?= $conf['SSH_LAN'] !== '0'? "block": "none" ?>">
  | 
        
        
            | 
            | 
           1237 | 
           					<table cellspacing="2" cellpadding="3" border="1">
  | 
        
        
            | 
            | 
           1238 | 
           						<tr>
  | 
        
        
            | 
            | 
           1239 | 
           							<th><?= $l_ssh_port ?></th><th><?= $l_ssh_from ?></th>
  | 
        
        
            | 
            | 
           1240 | 
           						</tr>
  | 
        
        
            | 
            | 
           1241 | 
           						<tr>
  | 
        
        
            | 
            | 
           1242 | 
           							<td><input style="width:120px" type="text" id="ssh_port" name="ssh_port" value="<?= $conf['SSH_LAN'] !== '0' ? $conf['SSH_LAN']:22 ?>" /></td>
  | 
        
        
            | 
            | 
           1243 | 
           							<td><input style="width:120px" type="text" id="ssh_from" name="ssh_from" value="<?= explode('/',$conf['SSH_ADMIN_FROM'])[0] ?>" /></td>		
  | 
        
        
            | 
            | 
           1244 | 
           						</tr>
  | 
        
        
            | 
            | 
           1245 | 
           					</table>
  | 
        
        
           | 3051 | 
           rexy | 
           1246 | 
           					<p><?= $l_all_ip ?></p>
  | 
        
        
           | 3042 | 
           rexy | 
           1247 | 
           				</div>
  | 
        
        
           | 3041 | 
           rexy | 
           1248 | 
           					<input type="submit" onClick="document.getElementById('ldoverlay').style.display='block';" value="<?= $l_apply ?>"><br>
  | 
        
        
            | 
            | 
           1249 | 
           				</form>
  | 
        
        
            | 
            | 
           1250 | 
           			</div>
  | 
        
        
            | 
            | 
           1251 | 
           		</td>
  | 
        
        
            | 
            | 
           1252 | 
           		<td width="50%" align="center">
  | 
        
        
            | 
            | 
           1253 | 
           			<div class="panel-row">
  | 
        
        
            | 
            | 
           1254 | 
           				<form method="post" action="<?= htmlspecialchars($_SERVER['PHP_SELF']) ?>">
  | 
        
        
            | 
            | 
           1255 | 
           				<input type="hidden" name="choix" value="enable_wan_ssh">
  | 
        
        
           | 3042 | 
           rexy | 
           1256 | 
           				<input type="checkbox" name="togglessh" id="togglessh" <?= $conf['SSH_WAN'] !== '0'? "checked": "" ?> onchange="document.getElementById('sshtablewan').style.display = this.checked ? 'block' : 'none';"> <b><?= $l_ssh_wan_activate ?></b><br><br>
  | 
        
        
            | 
            | 
           1257 | 
           				<div id="sshtablewan" style="display:<?= $conf['SSH_WAN'] !== '0'? "block": "none" ?>">
  | 
        
        
           | 3041 | 
           rexy | 
           1258 | 
           					<table cellspacing="2" cellpadding="3" border="1">
  | 
        
        
            | 
            | 
           1259 | 
           						<tr>
  | 
        
        
            | 
            | 
           1260 | 
           							<th><?= $l_ssh_port ?></th><th><?= $l_ssh_from ?></th>
  | 
        
        
            | 
            | 
           1261 | 
           						</tr>
  | 
        
        
            | 
            | 
           1262 | 
           						<tr>
  | 
        
        
           | 3042 | 
           rexy | 
           1263 | 
           							<td><input style="width:120px" type="text" id="ssh_port" name="ssh_port" value="<?= $conf['SSH_WAN'] !== '0' ? $conf['SSH_WAN']:22 ?>" /></td>
  | 
        
        
            | 
            | 
           1264 | 
           							<td><input style="width:120px" type="text" id="ssh_from" name="ssh_from" value="<?= explode('/',$conf['SSH_ADMIN_FROM'])[1] ?>" /></td>		
  | 
        
        
           | 3041 | 
           rexy | 
           1265 | 
           						</tr>
  | 
        
        
            | 
            | 
           1266 | 
           					</table>
  | 
        
        
           | 3051 | 
           rexy | 
           1267 | 
           					<p><?= $l_all_ip ?></p>
  | 
        
        
           | 3041 | 
           rexy | 
           1268 | 
           				</div>
  | 
        
        
            | 
            | 
           1269 | 
           				<input type="submit" onClick="document.getElementById('ldoverlay').style.display='block';" value="<?= $l_apply ?>"><br>
  | 
        
        
            | 
            | 
           1270 | 
           				</form>
  | 
        
        
            | 
            | 
           1271 | 
           			</div>
  | 
        
        
            | 
            | 
           1272 | 
           		</td>
  | 
        
        
            | 
            | 
           1273 | 
           	</tr>
  | 
        
        
            | 
            | 
           1274 | 
           	</table>
  | 
        
        
           | 3040 | 
           rexy | 
           1275 | 
           </div>
  | 
        
        
            | 
            | 
           1276 | 
           <br>
  | 
        
        
            | 
            | 
           1277 | 
           <div class="panel">
  | 
        
        
           | 2813 | 
           rexy | 
           1278 | 
           	<div class="panel-header"><?= $l_import_cert ?></div>
  | 
        
        
            | 
            | 
           1279 | 
           	<div class="panel-row">
  | 
        
        
            | 
            | 
           1280 | 
           		<div class="panel-cell">
  | 
        
        
           | 2297 | 
           tom.houday | 
           1281 | 
           			<?php
  | 
        
        
           | 3040 | 
           rexy | 
           1282 | 
           			$certificateInfos = openssl_x509_parse(file_get_contents('/etc/pki/tls/certs/alcasar.crt'));
  | 
        
        
           | 2297 | 
           tom.houday | 
           1283 | 
           			$cert_expiration_date = date('d-m-Y H:i:s', $certificateInfos['validTo_time_t']);
  | 
        
        
            | 
            | 
           1284 | 
           			$domain               = $certificateInfos['subject']['CN'];
  | 
        
        
            | 
            | 
           1285 | 
           			$organization         = (isset($certificateInfos['subject']['O'])) ? $certificateInfos['subject']['O'] : '';
  | 
        
        
            | 
            | 
           1286 | 
           			$CAdomain             = $certificateInfos['issuer']['CN'];
  | 
        
        
            | 
            | 
           1287 | 
           			$CAorganization       = (isset($certificateInfos['issuer']['O'])) ? $certificateInfos['issuer']['O'] : '';
  | 
        
        
            | 
            | 
           1288 | 
           			?>
  | 
        
        
            | 
            | 
           1289 | 
           			<h3><?= $l_current_certificate ?></h3>
  | 
        
        
           | 2813 | 
           rexy | 
           1290 | 
           			<b><?= $l_cert_commonname ?></b> <?= $domain ?><br>
  | 
        
        
            | 
            | 
           1291 | 
           			<b><?= $l_cert_expiration ?></b> <?= $cert_expiration_date ?><br>
  | 
        
        
            | 
            | 
           1292 | 
           			<b><?= $l_cert_organization ?></b> <?= $organization ?><br>
  | 
        
        
            | 
            | 
           1293 | 
           			<b><?= $l_validated ?></b> <?= $CAdomain ?> (<?= $CAorganization ?>)<br>
  | 
        
        
            | 
            | 
           1294 | 
           		</div>
  | 
        
        
            | 
            | 
           1295 | 
           		<div class="panel-cell">
  | 
        
        
            | 
            | 
           1296 | 
           			<?
  | 
        
        
            | 
            | 
           1297 | 
           			if (file_exists('/etc/pki/tls/certs/alcasar.crt.old') && file_exists('/etc/pki/tls/private/alcasar.key.old')){ // An old default certificate exist ?
  | 
        
        
            | 
            | 
           1298 | 
           				echo "<form method=\"post\" action=\"".htmlspecialchars($_SERVER['PHP_SELF'])."\">\n";
  | 
        
        
            | 
            | 
           1299 | 
           				echo "\t\t\t\t<input type=\"hidden\" name=\"choix\" value=\"set_default_cert\">\n";
  | 
        
        
           | 3238 | 
           rexy | 
           1300 | 
           				echo "\t\t\t\t<input type=\"submit\" onClick=\"document.getElementById('ldoverlay').style.display='block';\" value=\"$l_default_cert\"> (alcasar.lan)<br>\n";
  | 
        
        
           | 2813 | 
           rexy | 
           1301 | 
           				echo "\t\t\t</form>\n";}
  | 
        
        
            | 
            | 
           1302 | 
           			if (!empty($LE_conf['domainRequest']) && ($domain != $LE_conf['domainRequest'])) { // A Let's encrypt certificate exist & it's not the active one ?
  | 
        
        
            | 
            | 
           1303 | 
           				echo "\t\t\t<form method=\"post\" action=\"".htmlspecialchars($_SERVER['PHP_SELF'])."\">\n";
  | 
        
        
            | 
            | 
           1304 | 
           				echo "\t\t\t\t<input type=\"hidden\" name=\"choix\" value=\"set_last_LE_cert\">\n";
  | 
        
        
           | 3028 | 
           rexy | 
           1305 | 
           				echo "\t\t\t\t<input type=\"submit\" onClick=\"document.getElementById('ldoverlay').style.display='block';\" value=\"".$l_previous_LE_cert."\"> (".$LE_conf['domainRequest'].")\n";
  | 
        
        
           | 2813 | 
           rexy | 
           1306 | 
           				echo "\t\t\t</form>\n";}
  | 
        
        
            | 
            | 
           1307 | 
           			?>
  | 
        
        
            | 
            | 
           1308 | 
           		</div>
  | 
        
        
            | 
            | 
           1309 | 
           	</div>
  | 
        
        
            | 
            | 
           1310 | 
           	<div class="panel-row">
  | 
        
        
            | 
            | 
           1311 | 
           		<div class="panel-cell">
  | 
        
        
           | 2326 | 
           tom.houday | 
           1312 | 
           			<h3><?= $l_upload_certificate ?></h3>
  | 
        
        
           | 2324 | 
           tom.houday | 
           1313 | 
           			<form method="post" action="<?= htmlspecialchars($_SERVER['PHP_SELF']) ?>" enctype="multipart/form-data">
  | 
        
        
            | 
            | 
           1314 | 
           				<?= $l_private_key;?> <input type="file" name="key"><br>
  | 
        
        
            | 
            | 
           1315 | 
           				<?= $l_certificate;?> <input type="file" name="crt"><br>
  | 
        
        
            | 
            | 
           1316 | 
           				<?= $l_server_chain;?> <input type="file" name="sc"><br>
  | 
        
        
            | 
            | 
           1317 | 
           				<input type="hidden" name="choix" value="import_cert">
  | 
        
        
           | 3028 | 
           rexy | 
           1318 | 
           				<input type="submit" onClick="document.getElementById('ldoverlay').style.display='block';" value="<?= $l_import ?>">
  | 
        
        
           | 2297 | 
           tom.houday | 
           1319 | 
           			</form>
  | 
        
        
           | 2813 | 
           rexy | 
           1320 | 
           		</div>
  | 
        
        
            | 
            | 
           1321 | 
           		<div class="panel-cell">
  | 
        
        
           | 2304 | 
           tom.houday | 
           1322 | 
           			<?php
  | 
        
        
            | 
            | 
           1323 | 
           			// Get step
  | 
        
        
            | 
            | 
           1324 | 
           			if (empty($LE_conf['domainRequest'])) {
  | 
        
        
            | 
            | 
           1325 | 
           				$step = 1;
  | 
        
        
            | 
            | 
           1326 | 
           			} else if (!empty($LE_conf['challenge'])) {
  | 
        
        
            | 
            | 
           1327 | 
           				$step = 2;
  | 
        
        
            | 
            | 
           1328 | 
           			} else if (($domain === $LE_conf['domainRequest']) && (empty($LE_conf['challenge']))) {
  | 
        
        
            | 
            | 
           1329 | 
           				$step = 3;
  | 
        
        
            | 
            | 
           1330 | 
           			} else {
  | 
        
        
            | 
            | 
           1331 | 
           				$step = 1;
  | 
        
        
            | 
            | 
           1332 | 
           			}
  | 
        
        
            | 
            | 
           1333 | 
           			?>
  | 
        
        
           | 3040 | 
           rexy | 
           1334 | 
           			<h3><?= $l_le_integration ?></h3>
  | 
        
        
           | 2324 | 
           tom.houday | 
           1335 | 
           			<?php if ($step === 1): ?>
  | 
        
        
           | 2316 | 
           tom.houday | 
           1336 | 
           				<form method="post" action="<?= htmlspecialchars($_SERVER['PHP_SELF']) ?>">
  | 
        
        
            | 
            | 
           1337 | 
           					<input type="hidden" name="choix" value="le_issueCert">
  | 
        
        
           | 2326 | 
           tom.houday | 
           1338 | 
           					<?= $l_le_status ?> <?= $l_disabled ?><br>
  | 
        
        
            | 
            | 
           1339 | 
           					<?= $l_le_email ?> <input type="text" name="email" placeholder="adresse@email.com"<?= ((!empty($LE_conf['email'])) ? ' value="'.$LE_conf['email'].'"' : '') ?>><br>
  | 
        
        
            | 
            | 
           1340 | 
           					<?= $l_le_domain_name ?> <input type="text" name="domainname" placeholder="alcasar.domain.tld" required><br>
  | 
        
        
           | 3028 | 
           rexy | 
           1341 | 
           					<input type="submit" onClick="document.getElementById('ldoverlay').style.display='block';" name="issue" value="<?= $l_send ?>"><br>
  | 
        
        
           | 2304 | 
           tom.houday | 
           1342 | 
           				</form>
  | 
        
        
            | 
            | 
           1343 | 
           			<?php elseif ($step === 2): ?>
  | 
        
        
           | 2316 | 
           tom.houday | 
           1344 | 
           				<form method="post" action="<?= htmlspecialchars($_SERVER['PHP_SELF']) ?>">
  | 
        
        
            | 
            | 
           1345 | 
           					<input type="hidden" name="choix" value="le_renewCert">
  | 
        
        
           | 2326 | 
           tom.houday | 
           1346 | 
           					<?= $l_le_status ?> <?= $l_pending_validation ?><br>
  | 
        
        
            | 
            | 
           1347 | 
           					<?= $l_le_domain_name ?> <?= $LE_conf['domainRequest'] ?><br>
  | 
        
        
           | 3040 | 
           rexy | 
           1348 | 
           					<?= $l_le_ask_on ?> <?= date('d-m-Y H:i:s', $LE_conf['dateIssueRequest']) ?><br>
  | 
        
        
           | 2326 | 
           tom.houday | 
           1349 | 
           					<?= $l_le_dns_entry_txt ?> "<?= '_acme-challenge.'.$LE_conf['domainRequest'] ?>"<br>
  | 
        
        
            | 
            | 
           1350 | 
           					<?= $l_le_challenge ?> "<?= $LE_conf['challenge'] ?>"<br>
  | 
        
        
           | 3028 | 
           rexy | 
           1351 | 
           					<input type="submit" onClick="document.getElementById('ldoverlay').style.display='block';" name="recheck" value="<?= $l_recheck ?>"> <input type="submit" onClick="document.getElementById('ldoverlay').style.display='block';" name="cancel" value="<?= $l_cancel ?>"><br>
  | 
        
        
           | 2304 | 
           tom.houday | 
           1352 | 
           				</form>
  | 
        
        
            | 
            | 
           1353 | 
           			<?php elseif ($step === 3): ?>
  | 
        
        
           | 2316 | 
           tom.houday | 
           1354 | 
           				<form method="post" action="<?= htmlspecialchars($_SERVER['PHP_SELF']) ?>">
  | 
        
        
            | 
            | 
           1355 | 
           					<input type="hidden" name="choix" value="le_renewCert">
  | 
        
        
           | 2326 | 
           tom.houday | 
           1356 | 
           					<?= $l_le_status ?> <?= $l_enabled ?><br>
  | 
        
        
            | 
            | 
           1357 | 
           					<?= $l_le_domain_name ?> <?= $LE_conf['domainRequest'] ?><br>
  | 
        
        
            | 
            | 
           1358 | 
           					<?= $l_le_api ?>  <?= $LE_conf['dnsapi'] ?><br>
  | 
        
        
            | 
            | 
           1359 | 
           					<?= $l_le_next_renewal ?> <?= date('d-m-Y', $LE_conf['dateNextRenewal']) ?><br>
  | 
        
        
           | 2304 | 
           tom.houday | 
           1360 | 
           					<?php if ($LE_conf['dateNextRenewal'] <= date('U')): ?>
  | 
        
        
           | 3028 | 
           rexy | 
           1361 | 
           						<input type="submit" onClick="document.getElementById('ldoverlay').style.display='block';" name="recheck" value="<?= $l_renew ?>"><br>
  | 
        
        
           | 2304 | 
           tom.houday | 
           1362 | 
           					<?php else: ?>
  | 
        
        
           | 3028 | 
           rexy | 
           1363 | 
           						<input type="submit" onClick="document.getElementById('ldoverlay').style.display='block';" name="recheck_force" value="<?= $l_renew_force ?>"><br>
  | 
        
        
           | 2304 | 
           tom.houday | 
           1364 | 
           					<?php endif; ?>
  | 
        
        
            | 
            | 
           1365 | 
           				</form>
  | 
        
        
            | 
            | 
           1366 | 
           			<?php endif; ?>
  | 
        
        
            | 
            | 
           1367 | 
           			<?php if (isset($cmdResponse)): ?>
  | 
        
        
            | 
            | 
           1368 | 
           				<p><?= $cmdResponse ?></p>
  | 
        
        
            | 
            | 
           1369 | 
           			<?php endif; ?>
  | 
        
        
           | 2813 | 
           rexy | 
           1370 | 
           		</div>
  | 
        
        
            | 
            | 
           1371 | 
           	</div>
  | 
        
        
            | 
            | 
           1372 | 
           </div>
  | 
        
        
           | 318 | 
           richard | 
           1373 | 
           </body>
  | 
        
        
            | 
            | 
           1374 | 
           </html>
  |