Reflector * ` against the M17Gateway remote-control port * configured in /etc/m17gateway. After action, triggers a 2 s * `setTimeout` reload. * * Inputs read at render time: * /etc/m17gateway Confirms the gateway is configured. * /usr/local/etc/M17Hosts.txt + optional /root/M17Hosts.txt for the * operator's reflector picklist. * * NOTE for the security pass: validation is whitelist-regex; no * setEmbeddableSecurityHeaders() call in this file. Coverage gap. */ if ($_SERVER["PHP_SELF"] == "/admin/index.php") { // Stop this working outside of the admin page include_once $_SERVER['DOCUMENT_ROOT'].'/config/config.php'; // MMDVMDash Config include_once $_SERVER['DOCUMENT_ROOT'].'/mmdvmhost/tools.php'; // MMDVMDash Tools include_once $_SERVER['DOCUMENT_ROOT'].'/mmdvmhost/functions.php'; // MMDVMDash Functions include_once $_SERVER['DOCUMENT_ROOT'].'/config/language.php'; // Translation Code // Check if M17 is Enabled $testMMDVModeM17 = getConfigItem("M17 Network", "Enable", $mmdvmconfigs); if ( $testMMDVModeM17 == 1 ) { //Load the m17gateway config file $m17GatewayConfigFile = '/etc/m17gateway'; if (fopen($m17GatewayConfigFile,'r')) { $configm17gateway = parse_ini_file($m17GatewayConfigFile, true); } // Check that the remote is enabled if ( $configm17gateway['Remote Commands']['Enable'] == 1 ) { $remotePort = $configm17gateway['Remote Commands']['Port']; if (!empty($_POST) && isset($_POST["m17MgrSubmit"])) { // Handle Posted Data if (preg_match('/[^A-Za-z0-9-]/',$_POST['m17LinkHost'])) { unset ($_POST['m17LinkHost']); unset ($_POST['m17LinkRoom']); } if (preg_match('/[^A-Z]/',$_POST['m17LinkRoom'])) { unset ($_POST['m17LinkHost']); unset ($_POST['m17LinkRoom']); } if ($_POST["Link"] == "LINK") { if ($_POST['m17LinkHost'] == "none") { $remoteCommand = "cd /var/log/pi-star && sudo /usr/local/bin/RemoteCommand ".$remotePort." Reflector unlink"; } else { $remoteCommand = "cd /var/log/pi-star && sudo /usr/local/bin/RemoteCommand ".$remotePort." Reflector ".$_POST['m17LinkHost']." ".$_POST['m17LinkRoom']; } } elseif ($_POST["Link"] == "UNLINK") { $remoteCommand = "cd /var/log/pi-star && sudo /usr/local/bin/RemoteCommand ".$remotePort." Reflector unlink"; } else { echo "M17 Link Manager\n"; echo "\n\n\n
Command Output
"; echo "Somthing wrong with your input, (Neither Link nor Unlink Sent) - please try again"; echo "
\n
\n"; unset($_POST); echo ''; } if (empty($_POST['m17LinkHost'])) { echo "M17 Link Manager\n"; echo "\n\n\n
Command Output
"; echo "Somthing wrong with your input, (No target specified) - please try again"; echo "
\n
\n"; unset($_POST); echo ''; } if (isset($remoteCommand)) { echo "M17 Link Manager\n"; echo "\n\n\n
Command Output
"; echo htmlspecialchars((string)exec($remoteCommand), ENT_QUOTES, 'UTF-8'); echo "
\n
\n"; echo ''; } } else { // Output HTML ?> M17 Link Manager
ReflectorReflector Link / Un-LinkLink / Un-Link ActionAction
Link UnLink