Skip to content

Instantly share code, notes, and snippets.

Created September 4, 2012 23:48
Show Gist options
  • Save anonymous/3628185 to your computer and use it in GitHub Desktop.
Save anonymous/3628185 to your computer and use it in GitHub Desktop.
<?php
// unit test
class TestController extends AppController {
var $name = 'Test';
var $helpers = array('Html', 'Ajax', 'Form', 'Javascript', 'Validanguage', 'Cache', 'Session', 'Fck');
var $components = array('Validation', 'Auth', 'RequestHandler', 'Cookie', 'Session', 'Email', 'Upload');
var $uses = array("CmsPage", "Websetting");
function beforeFilter() {
parent::beforeFilter();
$this->Auth->allow('index',
'__sendContactUsEmail', 'show_captcha', 'captcha_play', 'reloadcapcha');
}
function __sendContactUsEmail($userData) {
$Websetting = $this->Websetting->find('first', array('conditions' => array('Websetting.id' => 1), 'fields' => "*"));
$contactUsEmail = $Websetting['Websetting']['contact_us_email'];
$this->Email->to = $contactUsEmail;
$this->Email->subject = 'New Contact Request';
$this->Email->from = $userData['email'];
$this->Email->sendAs = 'html';
$this->set('name', $userData['name']);
$this->set('email', $userData['email']);
$this->set('message', $userData['message']);
$this->Email->template = 'contact_us';
if ($this->Email->send()) {
return "Success";
} else {
return "Failure";
}
}
function index($id = NULL) {
echo "test";
$Order = $this->Order->find('first', array(
'conditions' => array('Order.id' =>'8'),
'limit' =>1,
'fields' => "*"));
print_r($Order);
exit;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment