Location: PHPKode > projects > Yup! - Yii based filehoster > yup/protected/controllers/SiteController.php
<?php

class SiteController extends Controller
{
    
    /**
     * 
     * @return void
     */
    public function actions()
    {
        return array(
            'captcha'=>array(
                'class'=>'CCaptchaAction',
                'backColor'=>0xFFFFFF,
            ),
            // page action renders "static" pages stored under 'protected/views/site/pages'
            'page'=>array(
                'class'=>'CViewAction',
            ),
        );
    }

    
    /**
     * 
     * @return void
     */
    public function actionContact()
    {
        $model = new ContactForm();
        
        // Formular wurde abgeschicht
        if(isset($_POST['ContactForm'])) {
            // Attibute der Form zuweisen
            $model->attributes = $_POST['ContactForm'];
            
            // Form validieren
            if($model->validate()) {
                // Versuchen Mail zu verschicken
                $headers = "From: {$model->email}\r\nReply-To: {$model->email}";
                if (@mail(Yii::app()->params['adminEmail'], $model->subject, $model->body, $headers)) {
                    Yii::app()->user->setFlash('contact', Yii::t('site', 'Vielen Dank für deine Nachricht. Wir werden diese so schnell wie möglich bearbeiten.'));
                }
                else {
                    Yii::app()->user->setFlash('contact', Yii::t('site', 'Deine E-Mail konnte leider nicht versandt werden. Schreibe bitte direkt deine Nachricht an {email}. Vielen Dank!', array('{email}' => Yii::app()->params['adminEmail'])));
                }
                
                $this->refresh();
            }
        }
        
        $this->render('contact', array('model' => $model));
    }
    
    
    /**
     * 
     * @return void
     */
    public function actionError()
    {
        if($error = Yii::app()->errorHandler->error) {
            if(Yii::app()->request->isAjaxRequest) {
                echo $error['message'];
            }
            else {
                $this->render('error', $error);
            }
        }
    }

}
Return current item: Yup! - Yii based filehoster