westdc-zf1/application/default/controllers/AboutController.php

67 lines
1.7 KiB
PHP
Executable File

<?php
class AboutController extends Zend_Controller_Action
{
function indexAction()
{
}
function preDispatch()
{
$this->view->config = Zend_Registry::get('config');
$this->messenger=$this->_helper->getHelper('FlashMessenger');
$this->view->messages = $this->messenger->getMessages();
}
function contactAction()
{
$form=new ContactForm();
$this->view->form=$form;
$this->view->addHelperPath('helper','Zend_View_Helper_');
if ($this->_request->isPost()) {
//发送邮件
$formData=$this->_request->getPost();
include_once("bcspamblock.php");
if (bcspamblock_verify() && $form->isValid($formData)) {
$mail=new Zend_Mail('utf-8');
$mail->setFrom($formData['email'],$formData['username']);
$mail->setBodyText($formData['body']);
$mail->setSubject($formData['subject']);
$mail->addTo($this->view->config->supportemail);
$mail->send();
$this->messenger->addMessage('发送成功!');
$this->_redirect('/about/contact');
}
} else {
$auth = Zend_Auth::getInstance();
if ($auth->hasIdentity()) {
$user=$auth->getIdentity();
$formData['username']=($user->realname)?$user->realname:$user->username;
$formData['email']=$user->email;
$form->populate($formData);
}
}
}
function termsAction()
{
}
function backgroundAction()
{
}
function legalAction()
{
}
function supportusAction()
{
}
function copyrightAction()
{
}
function linkAction()
{
}
function honorAction()
{
}
function sponsorsAction()
{
}
}