private function onAdd() { $form = $this->formAdd(); if (false !== ($error = $form->validate($this->module))) { return $error . $this->templateAdd(); } $now = GWF_Time::getDate(14); $options = 0; $options |= isset($_POST['warbox']) ? WC_Warbox::WARBOX : 0; $options |= isset($_POST['multi']) ? WC_Warbox::MULTI_SOLVE : 0; $box = new WC_Warbox(array('wb_id' => '0', 'wb_sid' => $this->site->getID(), 'wb_name' => $form->getVar('name'), 'wb_user' => $form->getVar('user'), 'wb_pass' => $form->getVar('pass'), 'wb_weburl' => $form->getVar('url'), 'wb_port' => $form->getVar('port'), 'wb_host' => $form->getVar('host'), 'wb_ip' => gethostbyname($form->getVar('host')), 'wb_whitelist' => $form->getVar('wlist'), 'wb_blacklist' => $form->getVar('blist'), 'wb_launched_at' => $form->getVar('launch'), 'wb_status' => $form->getVar('status'), 'wb_options' => $options, 'wb_created_at' => $now, 'wb_updated_at' => $now)); if (false === $box->insert()) { return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__)) . $this->templateAdd(); } Module_WeChall::instance()->flushWarboxConfig(); return $this->module->message('msg_warbox_added') . $this->templateOverview(); }