/** Receives the form submission from the edit action and updates the specific object. */ public function actionUpdate() { if ($this->request->isPost()) { // valid stylesheet? $layouts = new Layouts(); $post = $this->request->getPost(); if (in_array($post['layout'], $layouts->listDirectory('public'))) { // update our cached user row $this->userRow['layout'] = $post['layout']; // passwords identical? if (!empty($post['password1'])) { if ($post['password1'] == $post['password2']) { $this->userRow['password'] = sha1($post['password1']); } else { $this->flashFail = 'The passwords do not match'; $this->redirectTo('/settings'); } } $users = new Users(); $users->update()->set($this->userRow)->where($this->userRow['id']); $this->flashSuccess = 'Settings updated'; } else { $this->flashFail = 'Invalid stylesheet'; } } $this->redirectTo('/settings'); }