-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
103 changed files
with
990 additions
and
1,385 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
Deny from all | ||
Deny from all |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,56 +1,57 @@ | ||
<?php | ||
|
||
namespace Controllers\Core; | ||
|
||
use Models\Core\Cards; | ||
use Models\Core\Members; | ||
use Template; | ||
|
||
class CardsController extends Controller { | ||
public function index() | ||
{ | ||
$cards = new Cards($this->db); | ||
|
||
$this->f3->set('decks',array()); | ||
foreach ( $this->f3->get('category') as $index => $cat ) { | ||
$this->f3->set('decks['.$index.']',$cards->getByCat($index)); | ||
} | ||
|
||
$this->f3->set('content','app/views/cards.htm'); | ||
echo Template::instance()->render('app/templates/default.htm'); | ||
} | ||
public function alpha() | ||
{ | ||
$cards = new Cards($this->db); | ||
|
||
$this->f3->set('decks',$cards->allAlpha()); | ||
$this->f3->set('content','app/views/cards-alpha.htm'); | ||
echo Template::instance()->render('app/templates/default.htm'); | ||
} | ||
public function view($id='') | ||
{ | ||
$cards = new Cards($this->db); | ||
if ( !$cards->count(array('filename=?',$id)) ) { $this->f3->error(404); } | ||
else { | ||
$this->f3->set('info',$cards->getByFilename($id)); | ||
$this->f3->set('content','app/views/cards-view.htm'); | ||
echo Template::instance()->render('app/templates/default.htm'); | ||
} | ||
} | ||
public function members() | ||
{ | ||
$mem = new Members($this->db); | ||
|
||
$this->f3->set('members',$mem->allWhereMemCards()); | ||
$this->f3->set('content','app/views/cards-members.htm'); | ||
echo Template::instance()->render('app/templates/default.htm'); | ||
} | ||
public function upcoming() | ||
{ | ||
$upcoming = new Upcoming($this->db); | ||
|
||
$this->f3->set('decks',$upcoming->all()); | ||
$this->f3->set('content','app/views/cards-upcoming.htm'); | ||
echo Template::instance()->render('app/templates/default.htm'); | ||
} | ||
<?php | ||
|
||
namespace Controllers\Core; | ||
|
||
use Models\Core\Cards; | ||
use Models\Core\Upcoming; | ||
use Models\Core\Members; | ||
use Template; | ||
|
||
class CardsController extends Controller { | ||
public function index() | ||
{ | ||
$cards = new Cards($this->db); | ||
|
||
$this->f3->set('decks',array()); | ||
foreach ( $this->f3->get('category') as $index => $cat ) { | ||
$this->f3->set('decks['.$index.']',$cards->getByCat($index)); | ||
} | ||
|
||
$this->f3->set('content','app/themes/'.$this->f3->get('theme').'/views/cards.htm'); | ||
echo Template::instance()->render('app/themes/'.$this->f3->get('theme').'/templates/default.htm'); | ||
} | ||
public function alpha() | ||
{ | ||
$cards = new Cards($this->db); | ||
|
||
$this->f3->set('decks',$cards->allAlpha()); | ||
$this->f3->set('content','app/themes/'.$this->f3->get('theme').'/views/cards-alpha.htm'); | ||
echo Template::instance()->render('app/themes/'.$this->f3->get('theme').'/templates/default.htm'); | ||
} | ||
public function view($id='') | ||
{ | ||
$cards = new Cards($this->db); | ||
if ( !$cards->count(array('filename=?',$id)) ) { $this->f3->error(404); } | ||
else { | ||
$this->f3->set('info',$cards->getByFilename($id)); | ||
$this->f3->set('content','app/themes/'.$this->f3->get('theme').'/views/cards-view.htm'); | ||
echo Template::instance()->render('app/themes/'.$this->f3->get('theme').'/templates/default.htm'); | ||
} | ||
} | ||
public function members() | ||
{ | ||
$mem = new Members($this->db); | ||
|
||
$this->f3->set('members',$mem->allWhereMemCards()); | ||
$this->f3->set('content','app/themes/'.$this->f3->get('theme').'/views/cards-members.htm'); | ||
echo Template::instance()->render('app/themes/'.$this->f3->get('theme').'/templates/default.htm'); | ||
} | ||
public function upcoming() | ||
{ | ||
$upcoming = new Upcoming($this->db); | ||
|
||
$this->f3->set('decks',$upcoming->all()); | ||
$this->f3->set('content','app/themes/'.$this->f3->get('theme').'/views/cards-upcoming.htm'); | ||
echo Template::instance()->render('app/themes/'.$this->f3->get('theme').'/templates/default.htm'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,64 +1,64 @@ | ||
<?php | ||
|
||
namespace Controllers\Core; | ||
|
||
use Models\Core\Members; | ||
use Filler00\Mailer; | ||
use Template; | ||
|
||
class ContactController extends Controller { | ||
|
||
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'); | ||
} | ||
private function process() | ||
{ | ||
$this->f3->scrub($_POST); | ||
$audit = \Audit::instance(); | ||
$this->f3->set('SESSION.flash',array()); | ||
|
||
// validate form | ||
if ( !preg_match("/^[\w\- ]{2,30}$/", $this->f3->get('POST.name')) ) | ||
$this->f3->push('SESSION.flash',array('type'=>'warning','msg'=>'Invalid name.')); | ||
if ( !$audit->email($this->f3->get('POST.email'), FALSE) ) | ||
$this->f3->push('SESSION.flash',array('type'=>'warning','msg'=>'Invalid email address')); | ||
if ( !empty($this->f3->get('POST.url')) && !$audit->url($this->f3->get('POST.url')) ) | ||
$this->f3->push('SESSION.flash',array('type'=>'warning','msg'=>'Invalid URL.')); | ||
if ( empty($this->f3->get('POST.message')) ) | ||
$this->f3->push('SESSION.flash',array('type'=>'warning','msg'=>'Please include a message!')); | ||
|
||
// honey pot | ||
if ( $this->f3->get('POST.username') !== '' ) | ||
$this->f3->push('SESSION.flash',array('type'=>'warning','msg'=>'Please do not use autofill or similar tools!')); | ||
|
||
// if there are no errors, process the form | ||
if ( count($this->f3->get('SESSION.flash')) === 0 ) { | ||
$this->f3->set('POST.level',$this->f3->get('member')->level + 1); | ||
|
||
$mailer = new Mailer; | ||
$message = $mailer->message() | ||
->setSubject($this->f3->get('tcgname') . ': Contact Form') | ||
->setFrom(array($this->f3->get('noreplyemail') => 'MyTCG')) | ||
->setTo(array($this->f3->get('tcgemail'))) | ||
->setReplyTo(array($this->f3->get('POST.email'))) | ||
->setBody(Template::instance()->render('app/templates/emails/contact.htm'), 'text/html') | ||
; | ||
|
||
if ( $mailer->send($message) ) { | ||
$this->f3->push('SESSION.flash',array('type'=>'success','msg'=>'Your form has been sent. Thanks for contacting us!')); | ||
} 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!')); | ||
} | ||
} | ||
} | ||
<?php | ||
|
||
namespace Controllers\Core; | ||
|
||
use Models\Core\Members; | ||
use Filler00\Mailer; | ||
use Template; | ||
|
||
class ContactController extends Controller { | ||
|
||
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/themes/'.$this->f3->get('theme').'/views/contact.htm'); | ||
echo Template::instance()->render('app/themes/'.$this->f3->get('theme').'/templates/default.htm'); | ||
} | ||
private function process() | ||
{ | ||
$this->f3->scrub($_POST); | ||
$audit = \Audit::instance(); | ||
$this->f3->set('SESSION.flash',array()); | ||
|
||
// validate form | ||
if ( !preg_match("/^[\w\- ]{2,30}$/", $this->f3->get('POST.name')) ) | ||
$this->f3->push('SESSION.flash',array('type'=>'warning','msg'=>'Invalid name.')); | ||
if ( !$audit->email($this->f3->get('POST.email'), FALSE) ) | ||
$this->f3->push('SESSION.flash',array('type'=>'warning','msg'=>'Invalid email address')); | ||
if ( !empty($this->f3->get('POST.url')) && !$audit->url($this->f3->get('POST.url')) ) | ||
$this->f3->push('SESSION.flash',array('type'=>'warning','msg'=>'Invalid URL.')); | ||
if ( empty($this->f3->get('POST.message')) ) | ||
$this->f3->push('SESSION.flash',array('type'=>'warning','msg'=>'Please include a message!')); | ||
|
||
// honey pot | ||
if ( $this->f3->get('POST.username') !== '' ) | ||
$this->f3->push('SESSION.flash',array('type'=>'warning','msg'=>'Please do not use autofill or similar tools!')); | ||
|
||
// if there are no errors, process the form | ||
if ( count($this->f3->get('SESSION.flash')) === 0 ) { | ||
$this->f3->set('POST.level',$this->f3->get('member')->level + 1); | ||
|
||
$mailer = new Mailer; | ||
$message = $mailer->message() | ||
->setSubject($this->f3->get('tcgname') . ': Contact Form') | ||
->setFrom(array($this->f3->get('noreplyemail') => 'MyTCG')) | ||
->setTo(array($this->f3->get('tcgemail'))) | ||
->setReplyTo(array($this->f3->get('POST.email'))) | ||
->setBody(Template::instance()->render('app/themes/'.$this->f3->get('theme').'/templates/emails/contact.htm'), 'text/html') | ||
; | ||
|
||
if ( $mailer->send($message) ) { | ||
$this->f3->push('SESSION.flash',array('type'=>'success','msg'=>'Your form has been sent. Thanks for contacting us!')); | ||
} 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!')); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.