findBoxCore = new FindBoxCoreSystem(...array_values($f3->get('CORE.fb'))); // Set Admin F3 UI folder $f3->set('UI', 'src/OpenMind/Admin/ui/'); } public function Admin($f3) { echo Template::instance()->render('masterpage.tpl'); } public function ESLStatus($f3) { $eslStatus = $this->findBoxCore->GetAllESLStatus(); $f3->set('STATUS_BADGE_COLOR', [ 'BLOCKED,FC' => 'info', 'OFFLINE' => 'warning', 'BLOCKED,FC' => 'danger', 'NO_STATUS' => 'light', 'OK' => 'success' ]); $f3->set('ESL_STATUS', $eslStatus); $f3->set('PAGENAME', 'Dashboard'); $f3->set('CONTENT', 'labelstatus.tpl'); echo Template::instance()->render('masterpage.tpl'); } public function OML_Settings($f3) { global $frameworkUtils; $path = 'cfg/config.bin'; if (!file_exists($path)) throw new \Exception('Config file not found'); $data = file_get_contents($path); $config = $frameworkUtils->Decrypt($data); $f3->set('PAGENAME', 'OM-Link Settings'); $f3->set('CONTENT', 'omlsettings.tpl'); $f3->set('CONFIG_TEXT', $config); echo Template::instance()->render('masterpage.tpl'); } public function Config($f3) { global $frameworkUtils; $config = $f3->get('BODY'); if (strlen($config) == 0) { echo json_encode([ "err" => "Empty body command" ]); return; } $configOBJ = json_decode($config); switch ($configOBJ->method) { case 'saveconfig': $newConfig = $frameworkUtils->Encrypt($configOBJ->value); @rename('cfg/config.bin', 'cfg/config.bin.old'); @file_put_contents('cfg/config.bin', $newConfig); echo json_encode([ "err" => "Configuration saved" ]); break; case 'loadconfig': $config = $frameworkUtils->Decrypt(file_get_contents('cfg/config.bin')); echo json_encode([ "err" => "Configuration reloaded successfully", "value" => $config ]); break; case 'geteslstatus': $labelID = $configOBJ->label_id; $esl = new SmartESL($this->findBoxCore, [$labelID]); $status = $esl->GetStatus(true); $svgPath = $this->findBoxCore->GetTemplateImage($status[$configOBJ->label_id]['data']['template_id']); echo json_encode([ "err" => "Status reloaded successfully", "value" => $status[$configOBJ->label_id], "svgPath" => $svgPath ]); break; } return; } }