public function index() { if ($this->f3->exists('SESSION.userID')) { $members = new Members($this->db); $this->f3->set('member', $members->read(array('id=?', $this->f3->get('SESSION.userID')), [])[0]); } if ($this->f3->exists('POST.submit')) { $this->process(); } $this->f3->set('content', 'app/views/contact.htm'); echo Template::instance()->render('app/templates/default.htm'); }
public function logs() { if ($this->f3->exists('SESSION.userID')) { $members = new Members($this->db); $this->f3->set('member', $members->read(array('id=?', $this->f3->get('SESSION.userID')), [])[0]); $this->f3->set('content', 'app/views/logs.htm'); echo Template::instance()->render('app/templates/default.htm'); } else { $this->f3->reroute('/members/login'); } }
private function quit() { /*********************************** Process Quit Form! ************************************/ $this->f3->scrub($_POST); $members = new Members($this->db); $this->f3->set('member', $members->read(array('id=?', $this->f3->get('SESSION.userID')), [])[0]); $this->f3->set('SESSION.flash', array()); // nothing to validate! // if there are no errors, process the form if (count($this->f3->get('SESSION.flash')) === 0) { $mailer = new Mailer(); $message = $mailer->message()->setSubject($this->f3->get('tcgname') . ': Quit Form (' . $this->f3->get('member')->name . ')')->setFrom(array($this->f3->get('noreplyemail') => 'MyTCG'))->setTo(array($this->f3->get('tcgemail')))->setReplyTo(array($this->f3->get('member')->email))->setBody(Template::instance()->render('app/templates/emails/quit-notif.htm'), 'text/html'); if ($mailer->send($message)) { $this->f3->push('SESSION.flash', array('type' => 'success', 'msg' => 'Your quit form has been sent. Sorry to see you leave - we hope you\'ll change your mind and join us again in the future!')); } else { $this->f3->push('SESSION.flash', array('type' => 'danger', 'msg' => 'There was a problem processing your request. Please try again or contact us for assistance!')); } } }
public function delete($id = '') { /*********************************** Delete members ************************************/ $members = new Members($this->db); $this->f3->set('member', $members->read(array('id=?', $id), [])[0]); $this->f3->set('SESSION.flash', array()); if ($_SERVER['QUERY_STRING'] == "execute") { $members->delete($this->f3->get('member')->id); $this->f3->push('SESSION.flash', array('type' => 'success', 'msg' => 'Member ' . $this->f3->get('member')->name . ' deleted!')); $this->f3->reroute('/mytcg/members'); } $this->f3->set('content', 'app/views/mytcg/members_delete.htm'); echo Template::instance()->render('app/templates/admin.htm'); }