function fbHandler($p) { $session = SessionHandler::getInstance(); $o = new Feedback(); $o->type = USER; $o->subject = $p['subj']; $o->body = $p['body']; $o->from = $session->id; $o->time_created = sql_datetime(time()); $o->store(); js_redirect(''); // jump to start page }
<?php $feedback = new Feedback(); if (!$feedback->isEnabled()) { throw new NotFoundException('Feedback is disabled'); } $info = $_POST; if ($feedback->validate($info)) { $feedback->store($info); header('Content-Type: application/json'); echo json_encode(true); exit; } echo $tpl->render(array('page' => 'feedback', 'title' => 'Give Feedback'));