public function actionCreate() { $model = new Server('superuser'); $settings = new ServerConfig('superuser'); $this->performAjaxValidation($model); $adv = false; if (isset($_POST['Server'])) { $model->attributes = $_POST['Server']; $settings->attributes = $_POST['ServerConfig']; $settings->give_role = @$_POST['cheat_role']; $settings->tp_role = @$_POST['cheat_role']; $model->sendData = @$_POST['send_data']; if ($model->validate() && $settings->validate()) { $model->save(false); $settings->server_id = $model->id; $settings->scenario = 'create'; $settings->save(); Yii::log('Created server ' . $model->id); $user = User::model()->findByPk((int) $_POST['user-assign']); $model->setOwner($user); if ($user) { $user->setServerFtpAccess($model->id, 'rw'); } $model->createDefaultCommands(); McBridge::get()->serverCmd($model->id, 'run_s:builtin:script setup'); $this->redirect(array('view', 'id' => $model->id)); } else { $adv = true; } } $this->render('view', array('model' => $model, 'settings' => $settings, 'edit' => true, 'jars' => $this->listJars(), 'advanced' => $adv, 'my' => false)); }