Exemple #1
0
        $contend2 = new contend_queue($addr);
        $contend2->add_to_queue($cmd1);
    } else {
        $contend->add_to_queue($cmd1);
    }
    unset($cmd1);
}
if ($contend->protect) {
    if ($addr > 0) {
        $result = $db->query("SELECT count(*) AS cnt FROM command_queue WHERE addr={$addr}");
    } else {
        $result = $db->query("SELECT count(*) AS cnt FROM command_queue");
    }
    $row = $result->fetchArray();
    if ($row['cnt'] > 0) {
        if (isset($contend2)) {
            $contend = $contend2;
        } else {
            include "contend/queue.php";
            $contend = new contend_queue($addr);
        }
        $contend->warning = true;
        $refresh = true;
    }
}
$response = $contend->view();
if ($refresh) {
    $response['refresh'] = $response['refresh'] ? $response['refresh'] : true;
}
header("Content-type: application/json");
echo json_encode($response);
Exemple #2
0
    if ($addr > 0) {
        $result = $db->query("SELECT count(*) AS cnt FROM command_queue WHERE addr={$addr}");
    } else {
        $result = $db->query("SELECT count(*) AS cnt FROM command_queue");
    }
    $row = $result->fetchArray();
    if ($row['cnt'] > 0) {
        // header('Location: http://'.$_SERVER['HTTP_HOST']."/?page=queue&addr=$addr");
        // It need absolute address (RFC) but it can't work with tunnels
        //header("Location: /?page=queue&addr=$addr");
        //exit;
        if (isset($contend2)) {
            $contend = $contend2;
        } else {
            include "contend/queue.php";
            $contend = new contend_queue($addr);
        }
        $contend->warning = true;
        $refresh = true;
    }
}
// view part
echo '<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Heating</title>  <meta http-equiv="content-language" content="en" />
';
if ($refresh) {
    if ($page == 'queue') {
        echo '<meta http-equiv="Refresh" content="' . $refresh_value . '; URL=' . "/?page=queue&addr={$addr}\" />\n";