') { $server = '127.0.0.1'; } $url = 'http://' . $server . ':' . $port . '/query?'; if ($stats) { $url .= 'q=stats&'; } if ($clients) { $url .= 'q=clients&'; } if ($images) { $url .= 'q=images&'; } if ($diskSpace) { $url .= 'q=space&'; } if ($config) { $url .= 'q=config&'; } if ($altservers) { $url .= 'q=altservers&'; } $str = Download::asString($url, 3, $code); if ($str === false) return self::QUERY_UNREACHABLE; if ($code !== 200) return self::QUERY_NOT_200; $ret = json_decode($str, true); if (!is_array($ret)) return self::QUERY_NOT_JSON; return $ret; } }