zfolder.php 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. <?php
  2. /**
  3. * The root folder entry point for yueku.
  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 zfolderEntry extends entry
  13. {
  14. /**
  15. * GET method.
  16. *
  17. * @param string $folderID
  18. * @access public
  19. * @return string
  20. */
  21. public function get($folderID)
  22. {
  23. $this->app->loadApiConfig('zdisk');
  24. $nodes = array();
  25. $now = gmdate("Y-m-d\TH:i:s\Z");
  26. if(isset($this->config->zdisk->$folderID))
  27. {
  28. foreach($this->config->zdisk->$folderID as $nodeID => $node)
  29. {
  30. $nodes[] = array(
  31. 'id' => $nodeID,
  32. 'parentID' => $folderID,
  33. 'storeID' => 0,
  34. 'name' => $node['name'] . ($node['type'] == 'file' ? '.txt' : ''),
  35. 'type' => $node['type'],
  36. 'size' => $node['type'] == 'file' ? 1000000 : 0,
  37. 'createdTime' => $now,
  38. 'accessedTime' => $now,
  39. 'editedTime' => $now,
  40. 'modifiedTime' => $now,
  41. );
  42. }
  43. }
  44. return $this->send(200, array('nodes' => $nodes));
  45. }
  46. }