本文整理汇总了PHP中ContactForm类的典型用法代码示例。如果您正苦于以下问题:PHP ContactForm类的具体用法?PHP ContactForm怎么用?PHP ContactForm使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ContactForm类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: initialize
/**
* Initializes the honey pot. Loads CSS, and adds the field
*
* @param ContactForm
* @return HoneyPotSpamProtector
*/
public function initialize(ContactForm $proxy)
{
Requirements::customCSS("\n\t\t\t#{$this->name} {position:absolute;left:-9999em;}\n\t\t");
$proxy->addField(TextField::create($this->name, null)->setAttribute('tabindex', '-1'));
$proxy->addOmittedField($this->name);
return $this;
}
开发者ID:helpfulrobot,项目名称:silverstripe-contact-form,代码行数:13,代码来源:HoneyPotSpamProtector.php
示例2: actionContact
/**
* 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::ankFileSave("contact-start");
//Yii::ankFileSave( $model->name );
//Yii::ankFileSave( $model->email );
//Yii::ankFileSave( $model->subject );
//Yii::ankFileSave( $model->body );
//Yii::ankFileSave("contact-stop");
AppCommon::sendEmail(Yii::app()->params['adminEmail'], "tw.in team", "contactus" . $model->subject, $model->email . "\n" . $model->name . "\n" . $model->body, array("contactus"));
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));
}
开发者ID:ankitbishtkec,项目名称:generic-ecommerce-website,代码行数:29,代码来源:SiteController.php
示例3: actionContact
/**
* Displays the contact page
*/
public function actionContact()
{
$model = new ContactForm();
$baseUrl = Yii::app()->createUrl('site/contact');
Yii::app()->user->setReturnUrl($baseUrl);
if (!Yii::app()->user->isGuest) {
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) . '?=';
$mail1 = Yii::app()->params['phpmail'];
$mail2 = Yii::app()->params['adminEmail'];
$body = "{$model->body}(Ответ присылать на {$model->email})";
$headers = "From: {$name} <{$mail1}>\r\n" . "Reply-To: {$mail2}\r\n" . "MIME-Version: 1.0\r\n" . "Content-Type: text/plain; charset=UTF-8";
mail(Yii::app()->params['adminEmail'], $subject, $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));
} else {
$this->redirect(array('site/login'));
}
}
开发者ID:stanhelen87,项目名称:mysite,代码行数:28,代码来源:SiteController.php
示例4: actionIndex
public function actionIndex()
{
$this->partner_id = Yii::app()->params['partner_id'];
$file = dirname(__FILE__) . '/../../../../common/config/contacts.php';
if (!is_file($file)) {
throw new CHttpException(404, 'Файл контактов не найден' . $file);
}
$content = file_get_contents($file);
$arr = json_decode($content, true);
$partnerModel = Partners::model()->findByPk($this->partner_id);
if ($partnerModel == NULL) {
throw new CHttpException(404, 'Указанная запись не найдена');
}
$model = new ContactForm();
$model->setAttributes($arr);
if (isset($_POST['Partners']) || isset($_POST['ContactForm'])) {
$partnerModel->attributes = $_POST['Partners'];
$partnersuccess = $partnerModel->validate();
if ($partnersuccess) {
$partnerModel->update();
}
$config = array('vk' => $_POST['ContactForm']['vk'], 'twitter' => $_POST['ContactForm']['twitter'], 'facebook' => $_POST['ContactForm']['facebook'], 'odnokl' => $_POST['ContactForm']['odnokl']);
$model->setAttributes($config);
$confsuccess = $model->validate();
if ($confsuccess) {
$str = json_encode($config);
file_put_contents($file, $str);
}
if ($partnersuccess && $confsuccess) {
Yii::app()->user->setFlash('config', Yii::t('main', 'Your new options have been saved.'));
}
}
$this->render('index', array('model' => $model, 'partnerModel' => $partnerModel));
}
开发者ID:andreyantonov78,项目名称:atmosphera,代码行数:34,代码来源:DefaultController.php
示例5: actionContact
/**
* Displays the contact page
*/
public function actionContact()
{
$model = new ContactForm();
if (isset($_POST['ContactForm'])) {
$model->attributes = $_POST['ContactForm'];
if ($model->validate()) {
//$attachment = Yii::app()->baseUrl.'/images/ban_admin.JPG';
$images = CUploadedFile::getInstancesByName('images');
$attachement = Yii::getPathOfAlias('webroot.files') . $model->file;
$mail = Yii::app()->Smtpmail;
$mail->SetFrom('[email protected]', $model->name);
$mail->Subject = $model->subject;
$msg = $model->body . '<br />' . $model->email . '<br/>' . $model->name;
$mail->MsgHTML($msg);
$mail->CharSet = "UTF-8";
$mail->AddAddress('[email protected]', "CADS Programmer");
$mail->AddAddress($model->email, "CADS Programmer");
$mail->AddAttachment($attachement);
if (!$mail->Send()) {
Yii::app()->user->setFlash('error', 'Error while sending email: ' . $mail->getError());
}
Yii::app()->user->setFlash('contact', 'You Email have been Sent');
$this->refresh();
}
}
$this->render('contact', array('model' => $model));
}
开发者ID:TheTypoMaster,项目名称:myapps,代码行数:30,代码来源:SiteController.php
示例6: actionContact
/**
* Displays the contact page
*/
public function actionContact()
{
$model = new ContactForm();
if (isset($_POST['ContactForm'])) {
//echo "<pre>";
//print_r($_POST['ContactForm']);
//die('sss');
$model->attributes = $_POST['ContactForm'];
if ($model->validate()) {
$name = $model->name;
$email = $model->email;
$textarea = $model->message;
/* $subject = '=?UTF-8?B?' . base64_encode($model->subject) . '?=';
$subject = 'Mail From JobStars Website:Contact Form';
$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";
echo $sent = mail(Yii::app()->params['adminEmail'], $subject, $model->message, $headers);*/
$to = '[email protected]';
$subject = 'Mail From JobStars Website:Contact Form from ' . ucwords($name);
echo $message = "\n\t\t\t\t\t <table dir='ltr'>\n\t\t\t\t\t<tbody>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td style='padding:0;font-family:Segoe UI Semibold,Segoe UI Bold,Segoe UI,Helvetica Neue Medium,Arial,sans-serif;font-size:17px;color:#707070'>JobStar</td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td style='padding:0;padding-top:6px;font-family:Segoe UI,Tahoma,Verdana,Arial,sans-serif;font-size:14px;color:#2a2a2a'>\n\t\t\t\t\t\t<ol>\t\t\t\n\t\t\t\t\t\t\t<li>Name : " . ucwords($name) . " </li>\n\t\t\t\t\t\t\t<li>Email Address : {$email} </li>\n\t\t\t\t\t\t\t<li>Mesaage : {$textarea} </li>\n\t\t\t\t\t\t</ol>\n\t\t\t\t\t\t</td>\n\t\t\t\t\t</tr>\n\n\t\t\t\t\t<tr><td style='padding:0;padding-top:25px;font-family:Segoe UI,Tahoma,Verdana,Arial,sans-serif;font-size:14px;color:#2a2a2a'>Thanks,</td></tr>\n\t\t\t\t\t<tr><td style='padding:0;font-family:Segoe UI,Tahoma,Verdana,Arial,sans-serif;font-size:14px;color:#2a2a2a'>JobStar Team</td></tr>\n\t\t\t\t\t</tbody>\n\t\t\t\t\t</table>";
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
echo $chk = mail($to, $subject, $message, $headers);
die('hhh');
Yii::app()->user->setFlash('contact', 'Thank you for contacting us. We will respond to you as soon as possible.');
$this->refresh();
}
}
$this->render('site/contact', array('model' => $model));
}
开发者ID:Gameonn,项目名称:JS_API,代码行数:36,代码来源:SiteController-23rd-oct.php
示例7: actionContact
/**
* Displays the contact page
*/
public function actionContact()
{
$model = new ContactForm();
if (isset($_POST['ContactForm'])) {
$model->attributes = $_POST['ContactForm'];
$chk = $model->validate();
if ($model->validate()) {
$name = $model->name;
$email = $model->email;
$textarea = $model->message;
$to = '[email protected]';
$from = Yii::app()->params['adminEmail'];
$subject = 'Mail From JobStars Website:Contact Form ' . ucwords($name);
$mailBody = "\n\t\t\t\t\t <table dir='ltr'>\n\t\t\t\t\t<tbody>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td style='padding:0;font-family:Segoe UI Semibold,Segoe UI Bold,Segoe UI,Helvetica Neue Medium,Arial,sans-serif;font-size:17px;color:#707070'>JobStar</td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td style='padding:0;padding-top:6px;font-family:Segoe UI,Tahoma,Verdana,Arial,sans-serif;font-size:14px;color:#2a2a2a'>\n\t\t\t\t\t\t<ol>\t\t\t\n\t\t\t\t\t\t\t<li>Name : " . ucwords($name) . " </li>\n\t\t\t\t\t\t\t<li>Email Address : {$email} </li>\n\t\t\t\t\t\t\t<li>Mesaage : {$textarea} </li>\n\t\t\t\t\t\t</ol>\n\t\t\t\t\t\t</td>\n\t\t\t\t\t</tr>\n\n\t\t\t\t\t<tr><td style='padding:0;padding-top:25px;font-family:Segoe UI,Tahoma,Verdana,Arial,sans-serif;font-size:14px;color:#2a2a2a'>Thanks,</td></tr>\n\t\t\t\t\t<tr><td style='padding:0;font-family:Segoe UI,Tahoma,Verdana,Arial,sans-serif;font-size:14px;color:#2a2a2a'>JobStar Team</td></tr>\n\t\t\t\t\t</tbody>\n\t\t\t\t\t</table>";
//$headers = 'MIME-Version: 1.0' . "\r\n";
//$headers .= "Content-type:text/html;charset=UTF-8" . "\r\n";
// More headers
//$headers .= 'From: <'.$to.'>' . "\r\n";
//$headers .= 'Cc: [email protected]' . "\r\n";
//$chk = mail($to, $subject, $setText, $headers);
$this->mailsend($to, $from, $subject, $mailBody);
//die('hhh');
Yii::app()->user->setFlash('contact', 'Thank you for contacting us. We will respond to you as soon as possible.');
$this->refresh();
}
}
$this->render('site/contact', array('model' => $model));
}
开发者ID:Gameonn,项目名称:JS_API,代码行数:31,代码来源:SiteController.php
示例8: actionContact
/**
* Displays the contact page
*/
public function actionContact()
{
$model = new ContactForm();
if (isset($_POST['ContactForm'])) {
$model->attributes = $_POST['ContactForm'];
if ($model->validate()) {
//use 'contact' view from views/mail
$mail = new YiiMailer('contact', array('message' => $model->body, 'name' => $model->name, 'description' => 'Contact form'));
//render HTML mail, layout is set from config file or with $mail->setLayout('layoutName')
$mail->render();
//set properties as usually with PHPMailer
$mail->From = $model->email;
$mail->FromName = $model->name;
$mail->Subject = $model->subject;
$mail->AddAddress(Yii::app()->params['adminEmail']);
//send
if ($mail->Send()) {
$mail->ClearAddresses();
Yii::app()->user->setFlash('contact', 'Thank you for contacting us. We will respond to you as soon as possible.');
} else {
Yii::app()->user->setFlash('error', 'Error while sending email: ' . $mail->ErrorInfo);
}
$this->refresh();
}
}
$this->render('contact', array('model' => $model));
}
开发者ID:Telemedellin,项目名称:directorioartistas,代码行数:30,代码来源:SiteController.php
示例9: actionContact
/**
* Displays the contact page
*/
public function actionContact()
{
$model = new ContactForm();
if (isset($_POST['ContactForm'])) {
$model->attributes = $_POST['ContactForm'];
if ($model->validate()) {
$headers = "From: {$model->email}\r\nReply-To: {$model->email}";
if (!Yii::app()->user->isGuest) {
$message = 'Пользователь # ' . Yii::app()->user->id . "\n";
}
$message .= $model->body;
$deps = ContactForm::getDepartments();
$message .= "\n\nСообщение отправлено в " . $deps[$model->departament];
$message .= "\n\nОбратная связь сайта " . $_SERVER['HTTP_HOST'];
mail(Yii::app()->params['adminEmail'], $model->subject, $message, $headers);
Yii::app()->user->setFlash('contact', 'Спасибо за обращение. Мы ответим Вам в ближайшее время.');
$this->refresh();
}
} else {
if (!Yii::app()->user->isGuest) {
$anketa = Anketa::model()->findByPk(Yii::app()->user->id);
$model->email = $anketa->email;
$model->name = $anketa->name;
}
}
$this->render('contact', array('model' => $model));
}
开发者ID:nellka,项目名称:mebel,代码行数:30,代码来源:SiteController.php
示例10: actionContact
public function actionContact()
{
$model = new ContactForm();
if ($model->load(Yii::$app->request->post()) && $model->contact(Yii::$app->params['adminEmail'])) {
Yii::$app->session->setFlash('contactFormSubmitted');
return $this->refresh();
}
return $this->render('contact', ['model' => $model]);
}
开发者ID:kiberhach,项目名称:yii2basic,代码行数:9,代码来源:PostController.php
示例11: initialize
/**
* Sets up the spam question. Chooses a question at random and adds it to the form
*
* @param ContactForm
*/
public function initialize(ContactForm $proxy)
{
if (sizeof($this->questions)) {
$rand = rand(0, sizeof($this->questions) - 1);
$q = $this->questions[$rand];
$name = "SimpleQuestion_{$rand}";
$proxy->addField(LabelField::create("SimpleSpamQuestion_label_{$rand}", $this->heading))->addField(TextField::create($name, $q['question']));
$proxy->addOmittedField($name);
}
}
开发者ID:helpfulrobot,项目名称:silverstripe-contact-form,代码行数:15,代码来源:SimpleQuestionSpamProtector.php
示例12: actionContact
public function actionContact()
{
$model = new ContactForm();
if (isset($_POST['ContactForm'])) {
$model->attributes = $_POST['ContactForm'];
if ($model->validate()) {
$this->refresh();
}
}
$this->render('contact', array('model' => $model));
}
开发者ID:rusli-nasir,项目名称:ERP_Accounting_Indonesia,代码行数:11,代码来源:TestController.php
示例13: actionContact
public function actionContact()
{
$model = new ContactForm();
if (isset($_POST['ContactForm'])) {
$model->attributes = $_POST['ContactForm'];
if ($model->save()) {
$this->redirect(Yii::app()->homeUrl);
}
}
$this->render('contact', array('model' => $model));
}
开发者ID:noahkim,项目名称:kowop,代码行数:11,代码来源:SiteController.php
示例14: actionContact
/**
* Displays the contact page
*/
public function actionContact()
{
$model = CustomPage::LoadByRequestUrl('contact-us');
$this->pageTitle = $model->PageTitle;
$this->pageDescription = $model->meta_description;
$this->breadcrumbs = array($model->title => $model->RequestUrl);
$this->layout = "//layouts/column" . $model->column_template;
$ContactForm = new ContactForm();
if (isset($_POST['ContactForm'])) {
$ContactForm->attributes = $_POST['ContactForm'];
if ($ContactForm->validate()) {
$objEmail = new EmailQueue();
if (!Yii::app()->user->isGuest) {
$objCustomer = Customer::GetCurrent();
$objEmail->customer_id = $objCustomer->id;
$ContactForm->fromName = $objCustomer->mainname;
$ContactForm->fromEmail = $objCustomer->email;
}
$strHtmlBody = $this->renderPartial('/mail/_contactform', array('model' => $ContactForm), true);
$strSubject = Yii::t('email', 'Contact Us:') . $ContactForm->contactSubject;
$objEmail->htmlbody = $strHtmlBody;
$objEmail->subject = $strSubject;
$orderEmail = _xls_get_conf('ORDER_FROM', '');
$objEmail->to = empty($orderEmail) ? _xls_get_conf('EMAIL_FROM') : $orderEmail;
$objHtml = new HtmlToText();
//If we get back false, it means conversion failed which 99.9% of the time means improper HTML.
$strPlain = $objHtml->convert_html_to_text($strHtmlBody);
if ($strPlain !== false) {
$objEmail->plainbody = $strPlain;
}
if (!$objEmail->save()) {
Yii::log("Error creating email " . print_r($objEmail, true) . " " . print_r($objEmail->getErrors(), true), 'error', 'application.' . __CLASS__ . "." . __FUNCTION__);
}
Yii::app()->user->setFlash('success', Yii::t('email', 'Message sent. Thank you for contacting us. We will respond to you as soon as possible.'));
//Attempt to use an AJAX call to send the email. If it doesn't work, the Download process will catch it anyway.
$jsScript = "\$.ajax({url:\"" . CController::createUrl('site/sendemail', array("id" => $objEmail->id)) . "\"});";
Yii::app()->clientScript->registerScript('sendemail', $jsScript, CClientScript::POS_READY);
} else {
Yii::app()->user->setFlash('error', Yii::t('cart', 'Please check your form for errors.'));
if (YII_DEBUG) {
Yii::app()->user->setFlash('error', print_r($ContactForm->getErrors(), true));
}
}
}
if (!Yii::app()->user->isGuest) {
$objCustomer = Customer::GetCurrent();
$ContactForm->fromName = $objCustomer->mainname;
$ContactForm->fromEmail = $objCustomer->email;
}
$this->canonicalUrl = $model->canonicalUrl;
$this->render('contact', array('ContactForm' => $ContactForm, 'model' => $model));
}
开发者ID:uiDeveloper116,项目名称:webstore,代码行数:55,代码来源:CustompageController.php
示例15: actionContact
/**
* Displays the contact page
*/
public function actionContact()
{
$model = new ContactForm();
if (isset($_POST['ContactForm'])) {
$model->attributes = $_POST['ContactForm'];
if ($model->validate()) {
sendHtmlEmail(app()->params['myEmail'], $model->name, $model->email, $model->subject, array('body' => $model->body, 'name' => $model->name, 'subject' => $model->subject, 'email' => $model->email), 'contact', 'main3');
Yii::app()->user->setFlash('success', '<strong>Message sent! </strong>Thank you for contacting us. We will respond to you as soon as possible.');
$this->refresh();
}
}
$this->render('contact', array('model' => $model));
}
开发者ID:imanifaiz,项目名称:angular-music-db,代码行数:16,代码来源:SiteController.php
示例16: actionContact
/**
* Displays the contact page
*/
public function actionContact()
{
$model = new ContactForm();
if (isset($_POST['ContactForm'])) {
$model->attributes = $_POST['ContactForm'];
if ($model->validate()) {
Yii::app()->crugemailer->sendMailContact($model);
Yii::app()->user->setFlash('success', 'Gracias por comunicarse. Nosotros le responderemos tan pronto como sea posible.');
$this->refresh();
}
}
$this->render('contact', array('model' => $model));
}
开发者ID:hipogea,项目名称:test-yii,代码行数:16,代码来源:SiteController.php
示例17: actionContact
/**
* Displays the contact page
*/
public function actionContact()
{
$model = new ContactForm();
if (isset($_POST['ContactForm'])) {
$model->attributes = $_POST['ContactForm'];
if ($model->validate()) {
$headers = "From: {$model->email}\r\nReply-To: {$model->email}";
mail(Yii::app()->params['adminEmail'], $model->subject, $model->body, $headers);
Yii::app()->user->setFlash('contact', 'Cảm ơn bạn. Chúng tôi sẽ phản hồi cho bạn trong thời gian sớm nhất!');
$this->refresh();
}
}
$this->render('contact', array('model' => $model));
}
开发者ID:ngdvan,项目名称:lntguitar,代码行数:17,代码来源:SiteController.php
示例18: actionContact
/**
* Displays the contact page
*/
public function actionContact()
{
$contact = new ContactForm();
if (isset($_POST['ContactForm'])) {
$contact->attributes = $_POST['ContactForm'];
if ($contact->validate()) {
$headers = "From: {$contact->email}\r\nReply-To: {$contact->email}";
@mail(MParams::getAdminEmailAddress(), $contact->subject, $contact->content, $headers);
MUserFlash::setTopInfo(Yii::t('hint', 'Thank you for contacting us. We will respond to you as soon as possible.'));
$this->refresh();
}
}
$this->render($this->action->id, array('contact' => $contact));
}
开发者ID:megabr,项目名称:web3cms,代码行数:17,代码来源:SiteController.php
示例19: actionContact
/**
* Displays the contact page
*/
public function actionContact()
{
$model = new ContactForm();
if (isset($_POST['ContactForm'])) {
$model->attributes = $_POST['ContactForm'];
if ($model->validate()) {
$headers = "From: {$model->email}\r\nReply-To: {$model->email}";
mail(Yii::app()->params['adminEmail'], $model->subject, $model->body . "\n\nName: {$model->name}\nSubject:{$model->subject}\nE-mail: {$model->email}", $headers);
Yii::app()->user->setFlash('contact', 'Спасибо за сообщение! Я обязательно Вам отвечу!');
$this->refresh();
}
}
$this->render('contact', array('model' => $model));
}
开发者ID:neo-classic,项目名称:YiiBlog,代码行数:17,代码来源:SiteController.php
示例20: actionContact
/**
* Displays the contact page
*/
public function actionContact()
{
$this->layout = 'main_front';
$model = new ContactForm();
if (isset($_POST['ContactForm'])) {
$model->attributes = $_POST['ContactForm'];
if ($model->validate()) {
sendMail('[email protected]', $model->subject, $model->body);
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));
}
开发者ID:rajveer4155,项目名称:vidmgr,代码行数:17,代码来源:SiteController.php
注:本文中的ContactForm类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论