public function resetSave() { if (($confirm = Request::get('fldConfirm')) == '' || $confirm != 'RESET CONFIG') { return Widget::popupWrapper('Invalid response, Reset cancelled', -1, 'Action Cancelled') . $this->index(); } else { DB::exec(DB::DEF, 'DELETE FROM tblConfig'); return Widget::popupWrapper('All configuration data has been erased', -1, 'Reset Complete') . $this->index(); } }
public function recentAlarmsAck() { if (($id = Request::get('fldModJackAlertID')) == '' || ($alert = Alerts::get($id)) === false) { return $this->index() . Widget::popupWrapper('Invalid Alert ID'); } $alert->status = Alerts::STATUS_SEEN; $alert->save(); return $this->index() . Widget::popupWrapper("Acknowledged Alert {$alert->id} - {$alert->desc}"); }
public function reload() { Config::clearCache(); Widget::popupWrapper('Sucessfully reloaded the config', 1000, 'Reload') . $this->index(); }
public function sendPW() { $sql = 'SELECT fldUserID FROM tblUser WHERE fldUser=?'; if (($id = DB::oneValue(DB::DEF, $sql, Request::get('fldEmail'))) === false) { $msg = 'This email does not exist on this system.<br>' . 'Either choose a new email address or register as new customer.' . $this->forgotPassword(); } else { $pw = Password::passGen(10, Password::MEDIUM); if (DB::driver() == DB::MYSQL) { $sql = 'UPDATE tblUser SET fldPassword=PASSWORD(?) WHERE fldUserID=?'; DB::exec(DB::DEF, $sql, [$pw, $id]); } else { $sql = 'UPDATE tblUser SET fldPassword=? WHERE fldUserID=?'; DB::exec(DB::DEF, $sql, [hash('md5', $pw), $id]); } // Update the Database with the new Password combo $boss = Cfg::get('boss'); $desc = Cfg::get('desc'); // create the email message to notify about a password request $body = '<h3>User requested password<br>Email: <b>%s</b></h3><br>From %s'; Mailer::envelope()->format(Mailer::HTML_TEXT)->from(Request::get('fldEmail'))->to($boss)->subject('User requested password')->body(sprintf($body, Request::get('fldEmail'), $desc))->send(); $body = <<<TXT Message from %s Here are your login details Password: %s Regards %s TXT; // create the email message to notify the user of his/her login details Mailer::envelope()->from($boss)->to(Request::get('fldEmail'))->subject('Login Request ' . $desc)->body(sprintf($body, $desc, $pw, $desc))->send(); $msg = 'Soon you will receive an email that will contain your login details.'; } return Widget::popupWrapper($msg, -1); }
public function newItem() { $defaults = ['cmd' => __CLASS__ . '::hello();', 'start' => strftime('%Y-%m-%d %H:%M'), 'cron' => '* * * * *', 'active' => 'No', 'lastRun' => '']; Scheduler::factory($defaults)->save(); return Widget::popupWrapper('New Item Created') . $this->index(); }