<?php header("Access-Control-Allow-Origin: *"); require_once __DIR__ . '/classes/connexion.php'; require_once __DIR__ . '/classes/checkAPI.php'; require_once __DIR__ . '/classes/Player.php'; $page_level = 1; $player = new Player(); if (isset($_GET['action'], $_GET['api']) && checkAPI($_GET['api'], $page_level)) { switch ($_REQUEST['action']) { case 'speaker': if (isset($_REQUEST['text'])) { $text = $_REQUEST['text']; $player->speak($text); echo 200; } else { echo 404; } break; } } else { if ($argc > 1) { } else { echo 401; } }
break; case 'GET': echo json_encode(getValues()); http_response_code(202); break; case 'PUT': if (isset($_REQUEST['id'])) { if (isset($_REQUEST['title'])) { update($_REQUEST); } } else { echo getLiveValues(); } break; case 'DELETE': if (checkAPI($_REQUEST['api'], $admin_level)) { delete($_REQUEST); } break; } } else { if ($argc > 1) { switch ($argv[1]) { case 'update': getLiveValues(); break; case 'battery': checkBattery(); break; } }
function print_sectionSlisting($sectionS, $id, $pp_kod) { if ($sectionS->num_rows == 0) { echo "<span class='text-danger'>NO SECTION S REGISTERED</span>"; } else { echo "<table class='table table-striped table-bordered table-hover' cellspacing='0' width='100%'>\n <thead>\n <tr class='primary' align='center'>\n <td>Active Ingredient</td>\n <td>Manufacturer</td>\n <td>Salt Form</td>\n <td>Strength</td>\n <td>Strength Salt-Free</td>\n <td>Source</td>\n <td>Section S</td>"; // if($id > 0) { // echo "<td><i class='fa fa-check' title='Comply'></i></td> // <td><i class='fa fa-close' title='Not Comply'></i></td> // <td><i class='fa fa-share' title='Escalate'></i></td> // <td> </td>"; // } echo "</tr>\n </thead>\n <tbody>"; while ($rows = $sectionS->fetch_assoc()) { $ras_desc = isEmpty($rows["ras_desc"]); $os_sykt = isEmpty($rows["os_sykt"]); $rbaj_desc = isEmpty($rows["rbaj_desc"]); $pba_kekuatan = isEmpty($rows["pba_kekuatan"]); $pba_kekuatan_rstf = isEmpty($rows["pba_kekuatan_rstf"]); $rstf_desc = isEmpty($rows["rstf_desc"]); $pbs_kod = $rows["pbs_kod"]; $headerstring = $rows["ras_desc"] . " / " . $rows["os_sykt"] . " / " . $rows["pba_kekuatan"]; ?> <tr align="center"> <td align="left"><?php echo $ras_desc; ?> </td> <td align="left"><?php echo $os_sykt; ?> </td> <td><?php echo $rbaj_desc; ?> </td> <td><?php echo $pba_kekuatan; ?> </td> <td><?php echo $pba_kekuatan_rstf; ?> </td> <td><?php echo $rstf_desc; ?> </td> <td> <?php //if($id > 0) { ?> <!--<button class="btn btn-primary btn-sm" onclick="evaluateAPI('<?php echo $pbs_kod; ?> ','<?php echo $headerstring; ?> ','<?php echo $pp_kod; ?> ')">View</button></td>--> <?php // } // else { ?> <button class="btn btn-primary btn-sm" onclick="showAPI('<?php echo $pbs_kod; ?> ','<?php echo $headerstring; ?> ')">View</button></td> <?php // } ?> <?php //if($id > 0) { ?> <!--<td><?php echo countYes($pbs_kod); ?> </td> <td><?php echo countNo($pbs_kod); ?> </td> <td><?php echo countEscalate($pbs_kod); ?> </td> <td><?php echo checkAPI($pbs_kod); ?> </td>--> <?php //} ?> </tr> <?php } echo "</tbody></table>"; } }
<?php header("Access-Control-Allow-Origin: *"); require_once __DIR__ . '/classes/connexion.php'; require_once __DIR__ . '/classes/checkAPI.php'; require_once __DIR__ . '/classes/Sync.php'; require_once __DIR__ . '/classes/Hue.php'; $page_level = 1; if (isset($_REQUEST['api']) && checkAPI($_REQUEST['api'], $page_level)) { switch ($_SERVER['REQUEST_METHOD']) { case 'GET': if (isset($_GET['lastmodified'])) { http_response_code(202); echo json_encode(get($_GET['lastmodified'], $_GET['api'])); } else { http_response_code(400); } break; } } else { http_response_code(403); } function get($lastmodified, $api) { $sync = new Sync(); $output = array(); if ($lastmodified < $sync->get(Sync::USER)) { $output[Sync::USER] = getUser($api); } if ($lastmodified < $sync->get(Sync::SCENARIOS)) { $output[Sync::SCENARIOS] = getScenarios();
header('Access-Control-Allow-Origin: *'); header('Access-Control-Allow-Headers: content-type'); header('Access-Control-Allow-Methods: GET, POST, PUT, DELETE'); require_once __DIR__ . '/classes/connexion.php'; require_once __DIR__ . '/classes/checkAPI.php'; require_once __DIR__ . '/classes/Sync.php'; $page_level = 1; $input = file_get_contents('php://input'); if ($input) { $input = json_decode($input); $api = $input->api; } else { $api = $_REQUEST['api']; } if (isset($api) && checkAPI($api, $page_level)) { switch ($_SERVER['REQUEST_METHOD']) { case 'PUT': add($input); break; case 'GET': echo json_encode(get($_GET)); break; case 'DELETE': delete($_REQUEST); break; } } function delete($arr) { if (isset($arr['scenario'])) {