BxFilesUploaderHTML5.php 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  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 Files Files
  7. * @ingroup UnaModules
  8. *
  9. * @{
  10. */
  11. class BxFilesUploaderHTML5 extends BxTemplUploaderHTML5
  12. {
  13. protected $_oModule;
  14. public function __construct ($aObject, $sStorageObject, $sUniqId, $oTemplate)
  15. {
  16. parent::__construct($aObject, $sStorageObject, $sUniqId, $oTemplate);
  17. $this->_oModule = BxDolModule::getInstance('bx_files');
  18. }
  19. protected function getGhostTemplateVars($aFile, $iProfileId, $iContentId, $oStorage, $oImagesTranscoder)
  20. {
  21. $sTitle = $this->_oModule->_oDb->getFileTitle($aFile['id']);
  22. $a = array(
  23. 'file_title' => $sTitle ? $sTitle : $aFile['file_name']
  24. );
  25. $a['file_title_attr'] = bx_html_attribute($a['file_title']);
  26. return $a;
  27. }
  28. protected function isUseTranscoderForPreview($oImagesTranscoder, $aFile)
  29. {
  30. if (!$oImagesTranscoder)
  31. return false;
  32. if (in_array($aFile['ext'], array('jpg', 'jpeg', 'png', 'gif', /* when ImageMagick is used - 'tif', 'tiff', 'bmp', 'ico', 'psd' */)) && (is_a($oImagesTranscoder, 'BxDolTranscoderImage') || is_a($oImagesTranscoder, 'BxDolTranscoderProxy')))
  33. return true;
  34. return false;
  35. }
  36. protected function isAdmin ($iContentId = 0)
  37. {
  38. return $this->_oModule->_isModerator (false);
  39. }
  40. }
  41. /** @} */