Friendica Communications Platform (please note that this is a clone of the repository at github, issues are handled there) https://friendi.ca
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

55 lines
1003 B

3 years ago
  1. <?php
  2. /**
  3. * @file src/Model/Storage/SystemStorage.php
  4. * @brief Storage backend system
  5. */
  6. namespace Friendica\Model\Storage;
  7. use \BadMethodCallException;
  8. /**
  9. * @brief System resource storage class
  10. *
  11. * This class is used to load system resources, like images.
  12. * Is not intended to be selectable by admins as default storage class.
  13. */
  14. class SystemResource implements IStorage
  15. {
  16. // Valid folders to look for resources
  17. const VALID_FOLDERS = ["images"];
  18. public static function get($filename)
  19. {
  20. $folder = dirname($filename);
  21. if (!in_array($folder, self::VALID_FOLDERS)) {
  22. return "";
  23. }
  24. if (!file_exists($filename)) {
  25. return "";
  26. }
  27. return file_get_contents($filename);
  28. }
  29. public static function put($data, $filename = "")
  30. {
  31. throw new BadMethodCallException();
  32. }
  33. public static function delete($filename)
  34. {
  35. throw new BadMethodCallException();
  36. }
  37. public static function getOptions()
  38. {
  39. return [];
  40. }
  41. public static function saveOptions($data)
  42. {
  43. return [];
  44. }
  45. }