Link|UnLink * ` against the YSFGateway remote-control port configured in * /etc/ysfgateway. Triggers a 2 s `setTimeout` reload. * * Inputs: * /etc/ysfgateway Gateway config + remote port. Remote * Commands must be enabled there for * this form to do anything. * /usr/local/etc/YSFHosts.txt Reflector picklist. * /usr/local/etc/FCSHosts.txt Optional FCS rooms 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 YSF is Enabled $testMMDVModeYSF = getConfigItem("System Fusion Network", "Enable", $mmdvmconfigs); if ( $testMMDVModeYSF == 1 ) { //Load the ysfgateway config file $ysfGatewayConfigFile = '/etc/ysfgateway'; if (fopen($ysfGatewayConfigFile,'r')) { $configysfgateway = parse_ini_file($ysfGatewayConfigFile, true); } // Check that the remote is enabled if ( $configysfgateway['Remote Commands']['Enable'] == 1 ) { $remotePort = $configysfgateway['Remote Commands']['Port']; if (!empty($_POST) && isset($_POST["ysfMgrSubmit"])) { // Handle Posted Data if (preg_match('/[^A-Za-z0-9]/',$_POST['ysfLinkHost'])) { unset ($_POST['ysfLinkHost']);} if ($_POST["Link"] == "LINK") { if ($_POST['ysfLinkHost'] == "none") { $remoteCommand = "cd /var/log/pi-star && sudo /usr/local/bin/RemoteCommand ".$remotePort." UnLink"; } else { $formattedLinkTarget = preg_replace('/([a-zA-Z]+)([0-9]+)/', '$1 $2', $_POST['ysfLinkHost']); $remoteCommand = "cd /var/log/pi-star && sudo /usr/local/bin/RemoteCommand ".$remotePort." Link".$formattedLinkTarget; } } elseif ($_POST["Link"] == "UNLINK") { $remoteCommand = "cd /var/log/pi-star && sudo /usr/local/bin/RemoteCommand ".$remotePort." UnLink"; } else { echo "YSF 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['ysfLinkHost'])) { echo "YSF 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 "YSF 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 ?> YSF Link Manager
ReflectorReflector Link / Un-LinkLink / Un-Link ActionAction
Link UnLink