Limpieza
git-svn-id: https://192.168.0.254/svn/Proyectos.Incam_PROFIND_Web/trunk@11 3fe1ab16-cfe0-e34b-8c9f-7d8c168d430d
This commit is contained in:
parent
b1700a833e
commit
803a79de0a
@ -22,25 +22,6 @@ class SiteController extends Controller
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Declares class-based actions.
|
||||
*/
|
||||
public function actions()
|
||||
{
|
||||
return array(
|
||||
// captcha action renders the CAPTCHA image displayed on the contact page
|
||||
'captcha'=>array(
|
||||
'class'=>'CCaptchaAction',
|
||||
'backColor'=>0xFFFFFF,
|
||||
),
|
||||
// page action renders "static" pages stored under 'protected/views/site/pages'
|
||||
// They can be accessed via: index.php?r=site/page&view=FileName
|
||||
'page'=>array(
|
||||
'class'=>'CViewAction',
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* This is the default 'index' action that is invoked
|
||||
* when an action is not explicitly requested by users.
|
||||
@ -66,32 +47,6 @@ class SiteController extends Controller
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays the contact page
|
||||
*/
|
||||
public function actionContact()
|
||||
{
|
||||
$model=new ContactForm;
|
||||
if(isset($_POST['ContactForm']))
|
||||
{
|
||||
$model->attributes=$_POST['ContactForm'];
|
||||
if($model->validate())
|
||||
{
|
||||
$name='=?UTF-8?B?'.base64_encode($model->name).'?=';
|
||||
$subject='=?UTF-8?B?'.base64_encode($model->subject).'?=';
|
||||
$headers="From: $name <{$model->email}>\r\n".
|
||||
"Reply-To: {$model->email}\r\n".
|
||||
"MIME-Version: 1.0\r\n".
|
||||
"Content-type: text/plain; charset=UTF-8";
|
||||
|
||||
mail(Yii::app()->params['adminEmail'],$subject,$model->body,$headers);
|
||||
Yii::app()->user->setFlash('contact','Thank you for contacting us. We will respond to you as soon as possible.');
|
||||
$this->refresh();
|
||||
}
|
||||
}
|
||||
$this->render('contact',array('model'=>$model));
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays the login page
|
||||
*/
|
||||
|
||||
@ -1,42 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* ContactForm class.
|
||||
* ContactForm is the data structure for keeping
|
||||
* contact form data. It is used by the 'contact' action of 'SiteController'.
|
||||
*/
|
||||
class ContactForm extends CFormModel
|
||||
{
|
||||
public $name;
|
||||
public $email;
|
||||
public $subject;
|
||||
public $body;
|
||||
public $verifyCode;
|
||||
|
||||
/**
|
||||
* Declares the validation rules.
|
||||
*/
|
||||
public function rules()
|
||||
{
|
||||
return array(
|
||||
// name, email, subject and body are required
|
||||
array('name, email, subject, body', 'required'),
|
||||
// email has to be a valid email address
|
||||
array('email', 'email'),
|
||||
// verifyCode needs to be entered correctly
|
||||
array('verifyCode', 'captcha', 'allowEmpty'=>!CCaptcha::checkRequirements()),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Declares customized attribute labels.
|
||||
* If not declared here, an attribute would have a label that is
|
||||
* the same as its name with the first letter in upper case.
|
||||
*/
|
||||
public function attributeLabels()
|
||||
{
|
||||
return array(
|
||||
'verifyCode'=>'Verification Code',
|
||||
);
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user