# HG changeset patch # User Michiel Broek # Date 1435318925 -7200 # Node ID 313efe6bf5b330421baf6d7192ee62d623b7d4be # Parent 6570b282eaef600c54d2a1980fce0e97920d1ae5 Fixed profile steps updateing from the web interface. diff -r 6570b282eaef -r 313efe6bf5b3 www-thermferm/profiles.php --- a/www-thermferm/profiles.php Sun Jun 21 20:15:43 2015 +0200 +++ b/www-thermferm/profiles.php Fri Jun 26 13:42:05 2015 +0200 @@ -257,38 +257,21 @@ $error = ''; switch ($result) { - case 0: $sock = open_socket(); - if ($sock != false) { - socket_write($sock, 'PROFILE PUTS '.$_POST['UUID'], 4096); - for ($i = 1; $i <= 8; $i++) { - /* - * Use small delays so the remote really sees single lines. - * This is a real bug between client/server programming, - * the PHP side is line oriented, the server is reading blocks. - * So we just send the data slowly and the server just sees lines. - */ + case 0: $cmd = array("PROFILE PUTS ".$_POST['UUID']); + for ($i = 1; $i <= 8; $i++) { if (($_POST['steptime'.$i] > 0) || ($_POST['resttime'.$i] > 0)) { - usleep(20000); - socket_write($sock, $_POST['steptime'.$i].','.$_POST['resttime'.$i].','.$_POST['target'.$i], 4096); - } - unset($_POST['steptime'.$i]); - unset($_POST['resttime'.$i]); - unset($_POST['target'.$i]); + $cmd[] = $_POST['steptime'.$i].','.$_POST['resttime'.$i].','.$_POST['target'.$i]; } - usleep(20000); - socket_write($sock, '.', 4096); - /* Absorb response */ - while (1) { - $line = socket_read($sock, 4096); - if ($line === '') - break; - } - socket_close($sock); - unset($_POST['UUID']); - unset($_POST['key']); - load('profiles.php'); - return; - } + unset($_POST['steptime'.$i]); + unset($_POST['resttime'.$i]); + unset($_POST['target'.$i]); + } + $cmd[] = "."; + send_array($cmd); + unset($_POST['UUID']); + unset($_POST['key']); + load('profiles.php'); + return; break; case 1: $error = 'Missing data'; break;