elFinderVolumeTrashMySQL.class.php 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. <?php
  2. /**
  3. * elFinder driver for trash bin at MySQL Database
  4. *
  5. * @author NaokiSawada
  6. **/
  7. class elFinderVolumeTrashMySQL extends elFinderVolumeMySQL
  8. {
  9. /**
  10. * Driver id
  11. * Must be started from letter and contains [a-z0-9]
  12. * Used as part of volume id.
  13. *
  14. * @var string
  15. **/
  16. protected $driverId = 'tm';
  17. public function __construct()
  18. {
  19. parent::__construct();
  20. // original option of the Trash
  21. $this->options['lockEverything'] = false; // Lock all items in the trash to disable delete, move, rename.
  22. // common options as the volume driver
  23. $this->options['alias'] = 'Trash';
  24. $this->options['quarantine'] = '';
  25. $this->options['rootCssClass'] = 'elfinder-navbar-root-trash';
  26. $this->options['copyOverwrite'] = false;
  27. $this->options['uiCmdMap'] = array('paste' => 'hidden', 'mkdir' => 'hidden', 'copy' => 'restore');
  28. $this->options['disabled'] = array('archive', 'duplicate', 'edit', 'extract', 'mkfile', 'places', 'put', 'rename', 'resize', 'upload');
  29. }
  30. public function mount(array $opts)
  31. {
  32. if ($this->options['lockEverything']) {
  33. if (!is_array($opts['attributes'])) {
  34. $opts['attributes'] = array();
  35. }
  36. $attr = array(
  37. 'pattern' => '/./',
  38. 'locked' => true,
  39. );
  40. array_unshift($opts['attributes'], $attr);
  41. }
  42. // force set `copyJoin` to true
  43. $opts['copyJoin'] = true;
  44. return parent::mount($opts);
  45. }
  46. }