/** * delete * * @return \Phalcon\Http\ResponseInterface */ public function deleteAction() { $hash_id = $this->request->get('id', 'string', ''); $res_file = ResFile::findFirst(['hash_id = :hash_id: and user_id = :user_id:', 'bind' => ['hash_id' => $hash_id, 'user_id' => $this->current_user->id]]); if ($res_file) { Filesystem::delete(public_path() . '/' . $res_file->path); $res_file->delete(); // active UserActive::record('file-delete', $this->current_user->id); } return $this->response->redirect('file/lists'); }
/** * Pocket * * @return \Phalcon\Http\ResponseInterface * @throws \Workflow\Exception\PocketException */ public function pocketAction() { $request_token = $this->request->get('request_token'); $pocket = new \Workflow\Api\Pocket(''); $pocket->setConfig($this->config); $access_token = $pocket->authorizeCode($request_token); $pocket_oauth = UserOauth::findFirst(["user_id = :user_id: and app = 'pocket'", 'bind' => ['user_id' => $this->current_user->id]]); if ($pocket_oauth) { $pocket_oauth->access_token = $access_token; $pocket_oauth->save(); // active UserActive::record('oauth-edit', $this->current_user->id); } else { $oauth = new UserOauth(); $oauth->user_id = $this->current_user->id; $oauth->app = 'pocket'; $oauth->access_token = $access_token; $oauth->create(); // active UserActive::record('oauth-create', $this->current_user->id); } return $this->response->redirect('user/app'); }
/** * delete * * @return \Phalcon\Http\ResponseInterface */ public function deleteAction() { $hash_id = $this->request->get('id', 'string', ''); $res_text = ResText::findFirst(['hash_id = :hash_id: and user_id = :user_id:', 'bind' => ['hash_id' => $hash_id, 'user_id' => $this->current_user->id]]); if ($res_text) { $res_text->delete(); // active UserActive::record('text-delete', $this->current_user->id); } return $this->response->redirect('text/lists'); }
/** * change password * @return \Phalcon\Http\ResponseInterface */ public function passwordAction() { if ($this->request->isPost() && $this->security->checkToken()) { $password = $this->request->getPost('password'); $password1 = $this->request->getPost('password1'); $password2 = $this->request->getPost('password2'); if ($password1 != $password2) { return $this->response->redirect('user/password'); } try { $user = $this->auth->check(['username' => $this->current_user->username, 'password' => $password]); $user->password_hash = $this->security->hash($password2); $user->updated_at = date('Y-m-d H:i:s'); $user->save(); // active UserActive::record('user-password', $this->current_user->id); } catch (\Exception $e) { $this->flashSession->error($e->getMessage()); return $this->response->redirect('user/password'); } return $this->response->redirect('workflow/lists'); } }
/** * @return \Phalcon\Http\ResponseInterface */ public function deleteAction() { $hash_id = $this->request->get('id', 'string', ''); // delete if ($this->workflow->delete($hash_id, $this->current_user->id)) { // active UserActive::record('workflow-delete', $this->current_user->id); } return $this->response->redirect('workflow/lists'); }