$result = array("result" => array("code" => 200, "data" => $hardware->unAssignService($localId))); } else { $result = array("result" => array("code" => 400, "data" => array("error" => "Bad command"))); } echo json_encode($result); break; case "configureService": if (isset($_GET['srvLocalId']) and isset($_GET['hdwSerial']) and $user->isUserHardware($_GET['hdwSerial'])) { require '../class/ChiconHardware.class.php'; require '../class/ChiconService.class.php'; $hdwSerial = $_GET['hdwSerial']; $localId = $_GET['srvLocalId']; $myHdw = ChiconHardware::withSerial($db, $hdwSerial); if ($myHdw->isServiceRegistered($localId)) { $mySrv = ChiconService::withHardware($db, $_GET['srvLocalId'], $hdwSerial); $r = processConfig($mySrv, $myHdw); if (isset($r)) { $mySrv->setConfigArgs($r); } } } break; case "mapLed": if (isset($_GET['srvLocalId']) and isset($_GET['hdwSerial']) and isset($_GET['ledHdwId']) and isset($_GET['ledSrvId']) and $user->isUserHardware($_GET['hdwSerial'])) { require '../class/ChiconHardware.class.php'; $hdwSerial = $_GET['hdwSerial']; $localId = $_GET['srvLocalId']; $ledHdwId = $_GET['ledHdwId']; $ledSrvId = $_GET['ledSrvId']; $myHdw = ChiconHardware::withSerial($db, $hdwSerial); if ($myHdw->isServiceRegistered($localId)) {
redirectSelf(); } $result['page'] = "DB Requirements"; $result['mysql_check'] = dbVersionCheck(); $result['db_config'] = dbGetConfig(); } else { if (installerStep() === STEP_CONFIG) { if ($_SERVER['REQUEST_METHOD'] == "GET") { if (isRedirect()) { redirectSelf(); } $result['page'] = "Configuration"; $result['configuration'] = configGet(); } else { if ($_SERVER['REQUEST_METHOD'] == "POST") { if (processConfig()) { transitionNextStep(); } redirectSelf(); } } } else { if (installerStep() == STEP_PERMISSION) { if (isRedirect()) { redirectSelf(); } $result['page'] = 'Check Permission'; $result['permission'] = permissionProcess(); } else { if (installerStep() === STEP_WRITE) { $result['page'] = 'Write Files';
printf("Error: Unable to access footer '%s'.<BR>\n", $footer); } } } /* Start of Main */ $data = getFormData(); if ($data['debug']) { if (!remoteDebug($debug, $option)) { return; } } $timer = getTime(); if ($config['debug']) { printf("Debug: main() - Calling processConfig()<BR>\n"); } $status = processConfig(); if ($status) { /* Clean up and localize passed values. */ $r = !isset($data['r']) ? $config['results'] ? 10 : $config['results'] : $data['r']; //Set default for results per page. $r = $r < 1 ? $config['maxResults'] : $r; $o = !isset($data['o']) || $data['o'] < 1 ? 0 : $data['o']; //Set default for offset. $s = !isset($data['s']) || $data['s'] < 1 ? 0 : $data['s']; //Set result set to 0 if we don't have a cached one. $q = isset($data['q']) && $data['q'] != '' ? $data['q'] : ''; /* Search for results. */ if ($q) { if (function_exists('get_html_translation_table')) { if ($config['debug']) { printf("Debug: main() - Calling get_html_translation_table()<BR>\n");