id) { App::redirect('/'); } } function actionTrip() { $id = intval(App::getParam('id')); $trip = Trips::model()->getByPK($id); if (empty($_POST['name']) || $trip->isEmpty() || $trip->owner != App::$user->id) { App::error404(); } $trip->name = trim($_POST['name']); $trip->description = trim($_POST['description']); $trip->status = ($_POST['isPublic'] == 'true') ? Trips::STATUS_PUBLIC : Trips::STATUS_PRIVATE; $trip->save(); } }