Example #1
0
 function add()
 {
     // Is logged in?
     $this->session = new Session();
     if (!$this->session->get('email') && !$this->session->get('id')) {
         die(redirect(''));
     }
     $r = new Mon_realm();
     $r = $r->find_all();
     $ml = new Mon_log();
     $ml = $ml->find_all();
     $rids = array();
     foreach ($r as $realm) {
         $rids[$realm->id] = $realm->tested_realm;
     }
     $mls = array();
     foreach ($ml as $m) {
         $mls[$m->id] = $m->ts_scheduled;
     }
     if ($_POST["action"] == "addmonser") {
         $data = $_POST;
         unset($data["action"]);
         unset($data["addmonser"]);
         $data["ts"] = date("c");
         // Let's store directly ISO 860 timestamps
         $m = new Mon_ser($data);
         $m->save();
     }
     pass_var("rids", $rids);
     pass_var("mls", $mls);
     pass_var('title', "Add a monitored server");
     pass_var('message', "Add a monitored server");
 }
 function index()
 {
     $realms = new Realm();
     $mls = new Mon_ser_log();
     $mss = new Mon_ser();
     pass_var("realms", $realms->find_all());
     pass_var("mls", $mls->find_all());
     pass_var("mss", $mss->find_all());
     pass_var('title', "Monitored servers log index");
     pass_var('message', "List of monitored servers log");
 }