/** * Show Form */ public function actionIndex() { $model = new ContactUs(); if (isset($_POST['ContactUs'])) { $model->attributes = $_POST['ContactUs']; if ($model->save()) { // Do we need to email? if (Yii::app()->params['contactusemail']) { // Build Message $message = Yii::t('contactus', "New Contact Us Form Submitted<br /><br />\n\t\t\t\t\t\t\t\t\t\t\t\t Id: {id}<br />\n\t\t\t\t\t\t\t\t\t\t\t\t\tBy: {name}<br />\n\t\t\t\t\t\t\t\t\t\t\t\t\tEmail: {email}<br />\n\t\t\t\t\t\t\t\t\t\t\t\t\tSubject: {subject}<br />\n\t\t\t\t\t\t\t\t\t\t\t\t\t========================<br />\n\t\t\t\t\t\t\t\t\t\t\t\t\t{msg}<br />\n\t\t\t\t\t\t\t\t\t\t\t\t\t========================<br /><br />\n\t\t\t\t\t\t\t\t\t\t\t\t\tRegards, the {team} Team.", array('{id}' => $model->id, '{name}' => $model->name, '{email}' => $model->email, '{subject}' => $model->subject, '{msg}' => $model->content, '{team}' => Yii::app()->name)); $email = Yii::app()->email; $email->subject = Yii::t('contactus', 'New Contact Us Form: {subject}', array('{subject}' => $model->subject)); $email->to = Yii::app()->params['emailout']; $email->from = $model->email; $email->replyTo = Yii::app()->params['emailout']; $email->message = $message; $email->send(); } Yii::app()->user->setFlash('success', Yii::t('contactus', 'Thank You. The form submitted successfully.')); $model = new ContactUs(); } } // If we are a member then fill in if (Yii::app()->user->id) { $user = Members::model()->findByPk(Yii::app()->user->id); if ($user) { $model->name = $user->username; $model->email = $user->email; } } $this->render('index', array('model' => $model)); }
public function contactAction() { $config = Zend_Registry::get('config'); $this->view->headScript()->appendFile($config->baseurl . '/js/jquery.validate.min.js'); $this->view->headScript()->appendFile($config->baseurl . '/js/contact.js'); $form = new ContactUs(); $this->view->form = $form; if ($this->getRequest()->isPost()) { if ($form->isValid($_POST)) { // $isValid = $this->_helper->common->validReCaptcha($this->_getAllParams()); // // if ($isValid) { $name = $form->getValue('name'); $email = $form->getValue('email'); $body = nl2br($form->getValue('body')); $db = Zend_Registry::get('db'); $db->beginTransaction(); $this->mailQueue->addToQueue(MailType::CONTACT_US, $name, '联系我们', $email, Constant::SYSTEM_MAIL, $body, $this->_helper->generator->generateCurrentTime()); $db->commit(); $this->_flashMessenger->addMessage("您的留言已经发送,我们会尽快处理并与您取得联系!谢谢您对我们的支持!!"); $this->_redirect('/contact'); // } else { // throw new Exception('验证码错误!'); // } } } }
public function handleSubmit() { // validate the post if (isset($_POST['name']) && strlen($_POST['name']) > 0 && (isset($_POST['message']) && strlen($_POST['message']) > 0)) { // get and sanitise input $name = filter_var($_POST['name'], FILTER_SANITIZE_STRING); $email = filter_var($_POST['email'], FILTER_SANITIZE_STRING); $phone = filter_var($_POST['phone'], FILTER_SANITIZE_STRING); $message = filter_var($_POST['message'], FILTER_SANITIZE_STRING); // validate the email // error_log("HERE!!!!" . filter_var($email, FILTER_VALIDATE_EMAIL)); if (!filter_var($email, FILTER_VALIDATE_EMAIL)) { $this->response['result'] = false; $this->response['output'] = $this->form . "<p class=\"error\">Your email address appears to be invalid, please check and try again!</p>"; return false; } // check the HONEEEEYpot. if (strlen($_POST['leavemeblank']) > 0) { $this->response['result'] = false; $this->response['output'] = "Sorry you've supplied too much information!"; return false; } error_log("Attempting an email send"); // try and send the email $contactUs = new ContactUs(); $this->response['result'] = $contactUs->sendEmail($name, $email, $phone, $message); // response $this->response['output'] = "Thank you - we'll be in touch real soon"; } else { $this->response['result'] = false; $this->response['output'] = $this->form . "<p class=\"error\">Please check all required fields have been supplied.</p>"; } }
/** * Store a newly created resource in storage. * * @return Response */ public function update($id) { $input = Input::all(); $val = ContactUs::validate($input); if ($val->fails()) { return Redirect::back()->withErrors($val); } $contactus = ContactUs::find($id); $contactus->title = Input::get('title'); $contactus->address = Input::get('address'); $contactus->city = Input::get('city'); $contactus->state = Input::get('state'); $contactus->zip = Input::get('zip'); $contactus->email_1 = Input::get('email_1'); $contactus->email_2 = Input::get('email_2'); $contactus->phone_1 = Input::get('phone_1'); $contactus->phone_2 = Input::get('phone_2'); // Original record $original = ContactUs::find($id); // If nothing changed do not make call to database and return with warning message. if ($original->title != $contactus->title || $original->address != $contactus->address || $original->city != $contactus->city || $original->state != $contactus->state || $original->zip != $contactus->zip || $original->email_1 != $contactus->email_1 || $original->email_2 != $contactus->email_2 || $original->phone_1 != $contactus->phone_1 || $original->phone_2 != $contactus->phone_2) { $contactus->save(); return Redirect::back()->with('message', FlashMessage::DisplayAlert('Information Updated Successfully!', 'success')); } return Redirect::back()->with('message', FlashMessage::DisplayAlert('Nothing to update. No changes made.', 'warning')); }
public function run() { // Clear data on table if exists. DB::table('contactus')->delete(); // Seed table with data below. ContactUs::create(['title' => 'Animal Shelter', 'address' => '111 Someplace Street', 'city' => 'Heaven', 'state' => 'NJ', 'zip' => '10000', 'email_1' => '*****@*****.**', 'email_2' => '*****@*****.**', 'phone_1' => '777-777-1111', 'phone_2' => '888-888-0000']); // Display message if seeding was successful. $this->command->info('Contact Us table seeded!'); }
/** * index, default action **/ public function index() { $this->strTemplateName = 'home'; if ($_POST && $_POST['mode'] == 'submit') { $_POST['dob'] = sprintf('%s-%02s-%02s', (int) $_POST['dob-yyyy'] ? $_POST['dob-yyyy'] : '', (int) $_POST['dob-mm'] ? $_POST['dob-mm'] : '', (int) $_POST['dob-dd'] ? $_POST['dob-dd'] : ''); //die($_POST['dob']); list($this->blnSuccess, $this->aryErrorMsgList, $this->aryRequest) = $this->filter($_POST, __METHOD__); if ($this->blnSuccess) { $objContactUs = new ContactUs($this->aryRequest); list($intContactUsID, $blnSendEmail) = $objContactUs->save(); if ($intContactUsID && $blnSendEmail) { header('Location: ?action=thankyou'); exit; } } else { $this->_setBackDob($_POST); } } }
public function showWelcome() { $posters = Poster::all(); $columns = EnlightenColumn::orderBy('created_at', 'desc')->take(8)->get(); $backstages = BackStage::orderBy('created_at', 'desc')->take(8)->get(); $contacts = ContactUs::all(); if (count($contacts) != 0) { $contact = $contacts[0]; return View::make('home.home', array('posters' => $posters, 'columns' => $columns, 'backstages' => $backstages, 'contact' => $contact, 'links' => $this->link())); } else { return View::make('home.home', array('posters' => $posters, 'columns' => $columns, 'backstages' => $backstages, 'links' => $this->link())); } }
echo CHtml::activeLabel($model, 'email'); ?> <?php echo CHtml::activeTextField($model, 'email', array('class' => 'textboxcontact tiptopfocus', 'title' => Yii::t('contactus', 'Please enter your email address'))); ?> <?php echo CHtml::error($model, 'email', array('class' => 'errorfield')); ?> <br /> <?php echo CHtml::activeLabel($model, 'subject'); ?> <?php echo CHtml::activeDropDownList($model, 'subject', ContactUs::model()->getTopics(), array('class' => 'textboxcontact')); ?> <?php echo CHtml::error($model, 'subject', array('class' => 'errorfield')); ?> <br /> <?php echo CHtml::activeLabel($model, 'content'); ?> <?php echo CHtml::activeTextArea($model, 'content', array('class' => 'textareacontact tiptopfocus', 'title' => Yii::t('contactus', 'Please enter your message'))); ?> <?php echo CHtml::error($model, 'content', array('class' => 'errorfield'));
* @author Brett O'Donnell <*****@*****.**> * @author Zain Ul abidin <*****@*****.**> * @copyright 2013 Mr PHP * @link https://github.com/cornernote/yii-dressing * @license BSD-3-Clause https://raw.github.com/cornernote/yii-dressing/master/license.txt */ $this->pageTitle = $this->getName() . ' ' . Yii::t('dressing', ucfirst($task)); $contactUs = $id ? ContactUs::model()->findByPk($id) : new ContactUs('search'); /** @var YdActiveForm $form */ $form = $this->beginWidget('dressing.widgets.YdActiveForm', array('id' => 'contactUs-' . $task . '-form', 'type' => 'horizontal', 'action' => array('/contactUs/delete', 'id' => $id, 'task' => $task, 'confirm' => 1))); echo $this->getGridIdHiddenFields($id); echo $form->beginModalWrap(); echo $form->errorSummary($contactUs); echo '<fieldset>'; echo '<legend>' . Yii::t('dressing', 'Selected Records') . '</legend>'; $contactUss = ContactUs::model()->findAll('t.id IN (' . implode(',', YdHelper::getGridIds($id)) . ')'); if ($contactUss) { echo '<ul>'; foreach ($contactUss as $contactUs) { echo '<li>'; echo $contactUs->getName(); echo '</li>'; } echo '</ul>'; } echo '</fieldset>'; echo $form->endModalWrap(); echo '<div class="' . $form->getSubmitRowClass() . '">'; $this->widget('bootstrap.widgets.TbButton', array('buttonType' => 'submit', 'type' => 'primary', 'label' => Yii::t('dressing', 'Confirm ' . ucfirst($task)), 'htmlOptions' => array('class' => 'pull-right'))); echo '</div>'; $this->endWidget();
/** * Delete an item */ public function actiondelete() { if (isset($_GET['id']) && ($model = ContactUs::model()->findByPk($_GET['id']))) { $model->delete(); Yii::app()->user->setFlash('success', Yii::t('contactus', 'Item Deleted.')); $this->redirect(array('index')); } else { $this->redirect(array('index')); } }
$errors .= "<br/>"; } $errors .= "A valid email address is required"; } return $errors; } public function sendEmail() { $output = array('wasSent' => false, 'error' => '', 'status' => ''); if ($this->isValidForm()) { $options = array("recipients" => $this->recipients, "subject" => $this->subject, "message" => $this->message, "senderEmail" => $this->fromEmail, "senderName" => $this->fromName); try { $mandrillMailer = new MandrillEmailSender($options); $output['result'] = $mandrillMailer->sendEmail(); $output['wasSent'] = true; } catch (Exception $e) { $output['error'] = 'Exception occurred. ' . $e->getMessage(); } if ($output["wasSent"]) { $output["status"] = "Thank you for contacting us. We will get back to you shortly"; } else { $output["status"] = "Sorry! Your message was not sent. Please try again later. Thank you"; } } else { $output['status'] = $this->getErrors(); } echo json_encode($output); } } $obj = new ContactUs(); $obj->sendEmail();
/** * Returns the data model based on the primary key given in the GET variable. * If the data model is not found, an HTTP exception will be raised. * @param integer $id the ID of the model to be loaded * @return ContactUs the loaded model * @throws CHttpException */ public function loadModel($id) { $model = ContactUs::model()->findByPk($id); if ($model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } return $model; }
/** * @return Response::json */ public function contactUs() { $contactus = ContactUs::find(1); return Response::json($contactus); }
/** * Draw page text */ public function DrawText() { global $objLogin; $objGallery = new GalleryAlbums(); $objContactUs = ContactUs::Instance(); $replace_needles = 1; $module_page = false; if (!count($this->page)) { return false; } // dont show this page if it was expired if (!$objLogin->IsLoggedInAsAdmin() && $this->page['finish_publishing'] != '0000-00-00' && date('Y-m-d') > $this->page['finish_publishing']) { draw_important_message(_PAGE_EXPIRED); return false; } if ($this->page['content_type'] == 'article' && isset($this->page['page_text'])) { $page_text = decode_text($this->page['page_text'], false); echo '<div class="pages_contents">'; if (preg_match('/{module:gallery}/i', $page_text)) { $module_page = true; $page_text = @preg_replace('/{module:gallery}/i', $objGallery->DrawGallery(false), $page_text, 1); } if (preg_match_all('/{module:album=(.*?)}/i', $page_text, $matches)) { $module_page = true; if (is_array($matches[1])) { foreach ($matches[1] as $key => $val) { if (strtolower($val) != 'code') { $val = @preg_replace('/[^A-Za-z0-9:]/i', '', $val); $page_text = @preg_replace('/{module:album=' . $val . '}/i', $objGallery->DrawAlbum($val, false), $page_text, 1); } } } } if (self::$PROJECT == 'MedicalAppointment') { if (preg_match('/{module:about_us}/i', $page_text)) { $module_page = true; $page_text = @preg_replace('/{module:about_us}/i', Clinic::DrawAboutUs(false), $page_text, 1); } } if (self::$PROJECT == 'HotelSite') { if (preg_match('/{module:about_us}/i', $page_text)) { $module_page = true; $page_text = @preg_replace('/{module:about_us}/i', Hotels::DrawAboutUs(false), $page_text, 1); } if (preg_match('/{module:rooms}/i', $page_text)) { $module_page = true; $page_text = @preg_replace('/{module:rooms}/i', Rooms::DrawRoomsInfo(false), $page_text, 1); } if (preg_match('/{module:testimonials}/i', $page_text)) { $module_page = true; $page_text = @preg_replace('/{module:testimonials}/i', Testimonials::DrawTestimonails(false), $page_text, 1); } } if (preg_match('/{module:contact_us}/i', $page_text)) { $module_page = true; $page_text = @preg_replace('/{module:contact_us}/i', $objContactUs->DrawContactUsForm(false), $page_text, 1); } if (preg_match('/{module:faq}/i', $page_text)) { $module_page = true; $page_text = @preg_replace('/{module:faq}/i', FaqCategories::DrawFaqList(false), $page_text, 1); } if (function_exists('get_magic_quotes_gpc') && get_magic_quotes_gpc()) { $page_text = stripslashes($page_text); } if ($this->page['is_home']) { if (self::$PROJECT == 'HotelSite') { Campaigns::DrawCampaignBanner('standard'); Campaigns::DrawCampaignBanner('global'); } } //echo $page_text; //echo "<hr>"; // draw all needed blocks for Home page if ($this->page['is_home']) { if (self::$PROJECT == 'BusinessDirectory') { if (ModulesSettings::Get('listings', 'show_categories_home_block') == 'yes') { Categories::DrawHomePageBlock(); } } else { if (self::$PROJECT == 'ShoppingCart') { if (ModulesSettings::Get('products_catalog', 'is_active') == 'yes') { Campaigns::DrawCampaignBanner(); if (ModulesSettings::Get('products_catalog', 'show_featured_block') == 'home page') { Products::DrawFeaturedBlock('home'); } if (ModulesSettings::Get('products_catalog', 'show_new_products_block') == 'home page') { Products::DrawNewProductsBlock(); } Categories::DrawHomePageBlock(); } } } } // draw comments form if (!$this->page['is_home'] && !$module_page) { if (Modules::IsModuleInstalled('comments')) { if (ModulesSettings::Get('comments', 'comments_allow') == 'yes' && $this->page['comments_allowed']) { $objComments = new Comments(); $objComments->DrawArticleComments($this->page['id']); } } } echo '</div>'; } else { if ($this->page['content_type'] == 'link' && isset($this->page['link_url'])) { $link_url = decode_text($this->page['link_url']); echo '<div class="pages_contents">'; echo '<a href="' . $link_url . '">' . $link_url . '</a>'; echo '</div>'; } } }
public function run() { ContactUs::create(['number' => 13232323232.0, 'people' => '林小姐', 'postcode' => '666666', 'address' => '广州市天河区水荫路34号省文化厅大院演音大楼205', 'site' => 'wwwgzhm.com']); }
/** * Send the reply */ public function actionsend() { if (isset($_POST['id']) && ($model = ContactUs::model()->findByPk($_POST['id']))) { // Add the new message $message = Yii::t('contactus', "You have received a new reply from <b>{replyername}</b><br /><br />\n\t\t\t\t\t\t\t\t\t\t\t =====================<br />\n\t\t\t\t\t\t\t\t\t\t\t {msg}<br />\n\t\t\t\t\t\t\t\t\t\t\t =====================<br /><br />\n\t\t\t\t\t\t\t\t\t\t\t Regards, The {team} Team.<br /><br />", array('{replyername}' => Yii::app()->user->username, '{msg}' => $_POST['message'], '{team}' => Yii::app()->name)); // Build Old Message $message .= Yii::t('contactus', "New Contact Us Form Submitted<br /><br />\n\t\t\t\t\t\t\t\t\t\t Id: {id}<br />\n\t\t\t\t\t\t\t\t\t\t\tBy: {name}<br />\n\t\t\t\t\t\t\t\t\t\t\tEmail: {email}<br />\n\t\t\t\t\t\t\t\t\t\t\tSubject: {subject}<br />\n\t\t\t\t\t\t\t\t\t\t\t========================<br />\n\t\t\t\t\t\t\t\t\t\t\t{msg}<br />\n\t\t\t\t\t\t\t\t\t\t\t========================<br /><br />\n\t\t\t\t\t\t\t\t\t\t\tRegards, the {team} Team.", array('{id}' => $model->id, '{name}' => $model->name, '{email}' => $model->email, '{subject}' => $model->subject, '{msg}' => $model->content, '{team}' => Yii::app()->name)); $email = Yii::app()->email; $email->subject = Yii::t('contactus', 'Re: {subject}', array('{subject}' => $model->subject)); $email->to = $_POST['email'] ? $_POST['email'] : $model->email; $email->from = Yii::app()->params['emailout']; $email->replyTo = Yii::app()->params['emailout']; $email->message = $message; $email->send(); } else { exit; } }
/** * Return instance of the class */ public static function Instance() { if (self::$instance == null) { self::$instance = new ContactUs(); } return self::$instance; }