BxDolStudioStorages.php 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. <?php defined('BX_DOL') or die('hack attempt');
  2. /**
  3. * Copyright (c) UNA, Inc - https://una.io
  4. * MIT License - https://opensource.org/licenses/MIT
  5. *
  6. * @defgroup UnaStudio UNA Studio
  7. * @{
  8. */
  9. define('BX_DOL_STUDIO_STRG_TYPE_FILES', 'files');
  10. define('BX_DOL_STUDIO_STRG_TYPE_IMAGES', 'images');
  11. define('BX_DOL_STUDIO_STRG_TYPE_DEFAULT', BX_DOL_STUDIO_STRG_TYPE_FILES);
  12. class BxDolStudioStorages extends BxTemplStudioPage
  13. {
  14. protected $sPage;
  15. function __construct($sPage = "")
  16. {
  17. parent::__construct('storages');
  18. $this->oDb = new BxDolStudioStoragesQuery();
  19. $this->sPage = BX_DOL_STUDIO_STRG_TYPE_DEFAULT;
  20. if(is_string($sPage) && !empty($sPage))
  21. $this->sPage = $sPage;
  22. }
  23. public function init()
  24. {
  25. if(($sAction = bx_get('strg_action')) === false)
  26. return;
  27. $sAction = bx_process_input($sAction);
  28. $aResult = array('code' => 1, 'message' => _t('_adm_strg_err_cannot_process_action'));
  29. switch($sAction) {
  30. case 'get-page-by-type':
  31. $sValue = bx_process_input(bx_get('nav_value'));
  32. if(empty($sValue))
  33. break;
  34. $this->sPage = $sValue;
  35. $aResult = array('code' => 0, 'content' => $this->getPageCode());
  36. break;
  37. default:
  38. $sMethod = 'action' . $this->getClassName($sAction);
  39. if(method_exists($this, $sMethod))
  40. $aResult = $this->$sMethod();
  41. }
  42. echo json_encode($aResult);
  43. exit;
  44. }
  45. }
  46. /** @} */