Simple tip to clear the input if input must contain only numbers and letters:
<?php
$output = preg_replace('/[^A-Za-z0-9-]/', '', $input);
?>
<?php
$unixtime=CDateTimeParser::parse($model->time,'dd/MM/yyyy hh:mm');
echo Yii::app()->dateFormatter->format('dd MMM yyyy, hh:mm',$unixtime);
?>
More:
<?php
$purifier = new CHtmlPurifier();
$purifier->options = array(
'HTML.ForbiddenElements' => array('a'),
);
echo $purifier->purify($text);
?>
Check out:<?php
include_once('phpmailer/class.phpmailer.php');
class Mailer extends PHPMailer{
var $Host = "tls://email-smtp.us-east-1.amazonaws.com"; //Amazon Server
var $Username = "xxxxxxxxxxxxxxxxxx"; //Enter Username from Amazon
var $Password = "xxxxxxxxxxxxxxxxxxx"; //Enter Pasword from Amazon
var $Port = 465; //Port number from Amazon
var $SMTPAuth = true;
var $From = "myportal@example.com"; //From may be any email you want
var $FromName = "My Site";
var $CharSet = "UTF-8";
var $Sender = 'example@example.com'; //Sender has to be verified email !!!
var $SMTPDebug = false; // set true if you want to debug
/**
* Prevents the SMTP connection from being closed after each mail
* sending. If this is set to true then to close the connection
* requires an explicit call to SmtpClose().
* @var bool
*/
var $SMTPKeepAlive = true;
function Mailer(){
$this->IsSMTP();
}
function send_email($email,$subject,$body){
$this->ClearAddresses();
$this->SingleTo = true;
mb_internal_encoding("UTF-8"); //If you send in UTF-8 Encoding
$this->AddAddress($email);
$this->Subject = ($subject);
$this->Body=$body;
return $this->Send();
}
}
?>
3. Include this file in you application and call each time you want to send email:<?php
include_once('Mailer.php');
$mailer=new Mailer();
$mailer->send_email('myprivate@email.com','First email','Hello world!');
?>
You're done, you're ready to send emails using Amazon SES with PHPmailer.
$this->widget('zii.widgets.CListView',array(
'dataProvider'=>$dataProvider,
'pager' => array(
'maxButtonCount'=>Yii::app()->controller->isMobile?4:10,
),
));
If you're using YiiBooster dont' forget to add to the pager:'class' => 'bootstrap.widgets.TbPager',