diff -r 825210ba2707 -r 09b5efe0c633 www/includes/global.inc.php --- a/www/includes/global.inc.php Sat Apr 13 16:50:26 2024 +0200 +++ b/www/includes/global.inc.php Sun Apr 14 12:46:02 2024 +0200 @@ -24,25 +24,72 @@ /* * Look for the style names in the jqwidgets/styles directory. */ -$my_style = 'ui-redmond'; -//$my_style = 'ui-mbse'; +//$my_style = 'ui-redmond'; +$my_style = 'ui-mbse'; require_once($_SERVER['DOCUMENT_ROOT'].'/version.php'); +function open_socket() +{ + $sock = socket_create(AF_INET, SOCK_STREAM, SOL_TCP); + + if (!($sock === false)) { + if (socket_connect($sock, "localhost", 6554)) { + socket_set_option($sock, SOL_SOCKET, SO_RCVTIMEO, array('sec' => 15, 'usec' => 0)); + } else { + socket_close($sock); + } + } + return $sock; +} + + +/** + * @param string $command to send to the server. + * @return string with the complete reply from the + * server. This can be a multiline reply. + */ +function send_cmd($command) +{ + $sock = open_socket(); + if ($sock == false) { + return ""; + } + socket_write($sock, $command . "\r\n", 4096); + + $answer = ""; + while (1) { + $line = socket_read($sock, 4096); + if ($line === '') + break; + $answer .= $line; + } + socket_close($sock); + + return $answer; +} + + +function startsWith($haystack, $needle) +{ + return !strncmp($haystack, $needle, strlen($needle)); +} + + function page_header($title, $loadjs) { global $my_style; global $my_version; ?> - + - + ThermFerm v<?php echo $my_version;?> - <?php echo $title;?> - + - + @@ -72,6 +119,28 @@