BxMessengerStorage.php 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  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 Messenger Messenger
  7. * @ingroup UnaModules
  8. *
  9. * @{
  10. */
  11. /**
  12. * Storage messenger module
  13. */
  14. class BxMessengerStorage extends BxDolStorage
  15. {
  16. function __construct($sObject)
  17. {
  18. $aObject = BxDolStorageQuery::getStorageObject($sObject);
  19. parent::__construct($aObject);
  20. }
  21. public function isValidFileExt($sFileName){
  22. $sExt = $this -> getFileExt($sFileName);
  23. return $this -> isValidExt($sExt);
  24. }
  25. public function isImageFile($sMimeType){
  26. $aImagesMimeTypes = array (
  27. 'image/bmp' => 'bmp',
  28. 'image/gif' => 'gif',
  29. 'image/jpeg' => 'jpg',
  30. 'image/pjpeg' => 'jpg',
  31. 'image/png' => 'png'
  32. );
  33. return isset($aImagesMimeTypes[$sMimeType]);
  34. }
  35. public function isImageExt($sFileName){
  36. $aImagesExts = array('bmp', 'gif', 'jpg', 'png');
  37. $sExt = $this -> getFileExt($sFileName);
  38. return in_array($sExt, $aImagesExts);
  39. }
  40. public function getRestrictedExt(){
  41. $sExts = $this->_aObject['ext_deny'];
  42. return $sExts ? explode(',', $sExts) : array();
  43. }
  44. }
  45. /** @} */