/** * This function create or update the LS update key * @return html */ public function submitkey() { if (Yii::app()->request->getPost('keyid')) { // We trim it, just in case user added a space... $submittedUpdateKey = trim(Yii::app()->request->getPost('keyid')); $updateModel = new UpdateForm(); $check = $updateModel->checkUpdateKeyonServer($submittedUpdateKey); if ($check->result) { // If the key is validated by server, we update the local database with this key $updateKey = $updateModel->setUpdateKey($submittedUpdateKey); $check = new stdClass(); $check->result = TRUE; $check->view = "key_updated"; } // then, we render the what returned the server (views and key infos or error ) echo $this->_renderWelcome($check); } else { return $this->_renderErrorString("key_null"); } }