file.php 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. <?php
  2. /**
  3. * The file entry point of ZenTaoPMS.
  4. *
  5. * @copyright Copyright 2009-2023 禅道软件(青岛)有限公司(ZenTao Software (Qingdao) Co., Ltd. www.cnezsoft.com)
  6. * @license ZPL(http://zpl.pub/page/zplv12.html) or AGPL(https://www.gnu.org/licenses/agpl-3.0.en.html)
  7. * @author Chunsheng Wang <chunsheng@cnezsoft.com>
  8. * @package entries
  9. * @version 1
  10. * @link https://www.zentao.net
  11. */
  12. class fileEntry extends entry
  13. {
  14. /**
  15. * GET method.
  16. *
  17. * @access public
  18. * @return string
  19. */
  20. public function get($fileID)
  21. {
  22. $control = $this->loadController('file', 'download');
  23. $control->download($fileID);
  24. $data = $this->getData();
  25. if(!$data or !isset($data->status)) return $this->send400('error');
  26. if(isset($data->status) and $data->status == 'fail') return $this->sendError(zget($data, 'code', 400), $data->message);
  27. return $this->send(200, $data);
  28. }
  29. /**
  30. * PUT method.
  31. *
  32. * @access public
  33. * @return string
  34. */
  35. public function put($fileID)
  36. {
  37. $uid = $this->param('uid', '');
  38. $action = $this->param('action', '');
  39. if($action == 'remove') unset($_SESSION['album']['used'][$uid][$fileID]);
  40. return $this->send(200, array('id' => $fileID));
  41. }
  42. }