exit; } if (isset($_GET["is_installed"])) { is_installed(); exit; } if (isset($_GET["is-installed"])) { is_installed(); exit; } if (isset($_GET["install"])) { install(); exit; } if (isset($_GET["GetUUID"])) { GetUUID(); exit; } if (isset($_GET["restart"])) { restart(); exit; } if (isset($_GET["version"])) { version(); exit; } while (list($num, $ligne) = each($_GET)) { $a[] = "{$num}={$ligne}"; } writelogs_framework("Unable to understand " . @implode("&", $a), __FUNCTION__, __FILE__, __LINE__); function is_installed()
function build() { $unix = new unix(); $sock = new sockets(); $UnifiListenIP = null; $NETWORK_ALL_INTERFACES = $unix->NETWORK_ALL_INTERFACES(); $UnifiListenInterface = $sock->GET_INFO("UnifiListenInterface"); if ($UnifiListenInterface != null) { $UnifiListenIP = $NETWORK_ALL_INTERFACES[$UnifiListenIP]["IPADDR"]; if ($UnifiListenIP == "0.0.0.0") { $UnifiListenIP = null; } } $UnifiHTTPPort = intval($sock->GET_INFO("UnifiHTTPPort")); $UnifiHTTPSPort = intval($sock->GET_INFO("UnifiHTTPSPort")); $UnifiPortalPort = intval($sock->GET_INFO("UnifiPortalPort")); $UnifiPortalSSLPort = intval($sock->GET_INFO("UnifiPortalSSLPort")); $UnifiUDPPort = intval($sock->GET_INFO("UnifiUDPPort")); $UnifiUUID = $sock->GET_INFO("UnifiUUID"); if ($UnifiUUID == null) { $UnifiUUID = GetUUID(); } if ($UnifiHTTPPort == 0) { $UnifiHTTPPort = 8088; } if ($UnifiHTTPSPort == 0) { $UnifiHTTPSPort = 8443; } if ($UnifiPortalPort == 0) { $UnifiPortalPort = 8880; } if ($UnifiPortalSSLPort == 0) { $UnifiPortalSSLPort = 8943; } if ($UnifiUDPPort == 0) { $UnifiUDPPort = 3478; } $f[] = "## system.properties"; $f[] = "#"; $f[] = "# each unifi instance requires a set of ports:"; $f[] = "#"; $f[] = "unifi.http.port={$UnifiHTTPPort}"; $f[] = "unifi.https.port={$UnifiHTTPSPort}"; $f[] = "portal.http.port={$UnifiPortalPort}"; $f[] = "portal.https.port={$UnifiPortalSSLPort}"; $f[] = "# unifi.db.port=27117"; $f[] = "# unifi.stun.port={$UnifiUDPPort}"; $f[] = "#"; if ($UnifiListenIP != null) { $f[] = "system_ip={$UnifiListenIP} # the IP devices should be talking to for inform"; } $f[] = "# unifi.db.nojournal=false # disable mongodb journaling"; $f[] = "# unifi.db.extraargs # extra mongod args"; $f[] = "#"; $f[] = "## HTTPS options"; $f[] = "# unifi.https.ciphers=TLS_RSA_WITH_AES_256_CBC_SHA,TLS_RSA_WITH_AES_128_CBC_SHA"; $f[] = "# unifi.https.sslEnabledProtocols=TLSv1"; $f[] = "#"; $f[] = "#"; $f[] = "#" . date("Y-m-d H:i:s"); $f[] = "uuid={$UnifiUUID}\n"; if ($GLOBALS["OUTPUT"]) { echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]}, save settings done\n"; } @file_put_contents("/usr/lib/unifi/data/system.properties", @implode("\n", $f)); }