1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: 66: 67: 68: 69: 70: 71: 72: 73: 74: 75: 76: 77: 78: 79: 80: 81: 82: 83: 84: 85: 86: 87: 88: 89: 90: 91: 92: 93: 94: 95: 96: 97: 98: 99: 100: 101: 102: 103: 104: 105: 106: 107: 108: 109: 110: 111: 112: 113: 114:
<?php
class elFinderPlugin
{
protected $opts = array();
protected function getCurrentOpts($volume)
{
$name = substr(get_class($this), 14);
$opts = $this->opts;
if (is_object($volume)) {
$volOpts = $volume->getOptionsPlugin($name);
if (is_array($volOpts)) {
$opts = array_merge($opts, $volOpts);
}
}
return $opts;
}
protected function iaEnabled($opts, $elfinder = null)
{
if (!$opts['enable']) {
return false;
}
if ($elfinder && !empty($opts['disableWithContentSaveId'])) {
$session = $elfinder->getSession();
$urlContentSaveIds = $session->get('urlContentSaveIds', array());
if (!empty(elFinder::$currentArgs['contentSaveId']) && ($contentSaveId = elFinder::$currentArgs['contentSaveId'])) {
if (!empty($urlContentSaveIds[$contentSaveId])) {
$elfinder->removeUrlContentSaveId($contentSaveId);
return false;
}
}
}
if (isset($opts['onDropWith']) && !is_null($opts['onDropWith'])) {
if (isset($_REQUEST['dropWith']) && $_REQUEST['dropWith']) {
$onDropWith = $opts['onDropWith'];
$action = (int)$_REQUEST['dropWith'];
if (!is_array($onDropWith)) {
$onDropWith = array($onDropWith);
}
foreach ($onDropWith as $key) {
$key = (int)$key;
if (($action & $key) === $key) {
return true;
}
}
}
return false;
}
if (isset($opts['offDropWith']) && !is_null($opts['offDropWith']) && isset($_REQUEST['dropWith'])) {
$offDropWith = $opts['offDropWith'];
$action = (int)$_REQUEST['dropWith'];
if (!is_array($offDropWith)) {
$offDropWith = array($offDropWith);
}
$res = true;
foreach ($offDropWith as $key) {
$key = (int)$key;
if ($key === 0) {
if ($action === 0) {
$res = false;
break;
}
} else {
if (($action & $key) === $key) {
$res = false;
break;
}
}
}
if (!$res) {
return false;
}
}
return true;
}
}