/**
  * passthru constructor ... 
  * allows us to attach a callback method
  * @param core
  * @param callback
  */
 public function __construct(Iface $core, $callback)
 {
     parent::__construct($core);
     if (!is_callable($callback)) {
         throw $this->handle(new Exception('invalid sanitizer', $callback));
     }
     $this->sanitizer = $callback;
 }
Beispiel #2
0
 public function deletePassthru()
 {
     if (!$this->session->userdata('logged_in')) {
         $this->_fullOut('failure', array(), "not loged in");
         return false;
     }
     $orign = new Location($this->oh);
     $orign->name = $_POST['origin'];
     $orign->load();
     $destination = new Location($this->oh);
     $destination->name = $_POST['destination'];
     $destination->load();
     if ($orign->id && $destination->id) {
         $newPass = new Passthru($this->oh);
         $newPass->origin_id = $orign->id;
         $newPass->destination_id = $destination->id;
         $newPass->element_id = $_POST['element_id'];
         if ($newPass->delete()) {
             $newPass->reverse();
             if ($newPass->delete()) {
                 $this->_fullOut('success', $_POST);
                 return true;
             }
         }
     }
     json_encode($this->_fullOut('failure', $_POST));
 }