public function signUp()
 {
     $_action = 'signup';
     $_viewtype = 'traveler/signin';
     $_viewdata = array('env' => $this->_env, 'action' => $_action);
     if (Auth::check()) {
         return Redirect::to('me/');
     } else {
         if (Request::isMethod('post')) {
             // pas connecté
             if (Request::isMethod('post')) {
                 $email = Input::get('email');
                 $username = Input::get('username');
                 $password = Input::get('password');
                 $dbuser = Traveler::where('email', '=', $email)->first();
                 if ($dbuser) {
                     // user existant
                     $_viewdata['error'] = array('code' => "emailused");
                 } else {
                     if (!Traveler::where('email', '=', $email)->first()) {
                         // ok create
                         $user = new Traveler();
                         $user->email = $email;
                         $user->username = $username;
                         $user->password = sha1($password);
                         $user->save();
                         Auth::login($user);
                         return Redirect::to('me/');
                     }
                 }
             }
             if (Request::isMethod('get') || Request::isMethod('post')) {
                 return View::make($_viewtype, $_viewdata);
             }
         }
     }
 }
 /**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCreate()
 {
     $model = new Traveler();
     $componentId = false;
     $model->userId = Yii::app()->user->id;
     if (isset($_GET['componentId'])) {
         $componentId = $_GET['componentId'];
     }
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (isset($_POST['Traveler'])) {
         $model->attributes = $_POST['Traveler'];
         $model->status = 1;
         $model->revision = 0;
         if ($model->save()) {
             $model->rootId = $model->id;
             $model->save();
             $this->redirect(array('view', 'id' => $model->id));
         }
     }
     $this->render('create', array('model' => $model, 'componentId' => $componentId));
 }