<?php

class DefaultController extends RController {

    public function actionIndex() {
        if (Yii::app()->user->isGuest == true) {
            $this->redirect(Yii::app()->user->loginUrl);
        }
        $this->render('index');
    }

    /**
     * This is the action to handle external exceptions.
     */
    public function actionError() {

        if ($error = Yii::app()->errorHandler->error) {
            if (Yii::app()->request->isAjaxRequest)
                echo $error['message'];
            else
                $this->render('application.views.site.error', $error);
        }
    }

}
