Edit File by line

Deprecated: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in /home/sportsfever/public_html/filemanger/function.php on line 93

Warning: Undefined array key "page_file_edit_line" in /home/sportsfever/public_html/filemanger/edit_text_line.php on line 32
/home/sportsfe.../httpdocs/wp-conte.../plugins/wp-file-.../lib/php
File: elFinderVolumeDriver.class.php
return $result;
[5000] Fix | Delete
}
[5001] Fix | Delete
[5002] Fix | Delete
/**
[5003] Fix | Delete
* Return true if all mimes is directory or files
[5004] Fix | Delete
*
[5005] Fix | Delete
* @param string $mime1 mimetype
[5006] Fix | Delete
* @param string $mime2 mimetype
[5007] Fix | Delete
*
[5008] Fix | Delete
* @return bool
[5009] Fix | Delete
* @author Dmitry (dio) Levashov
[5010] Fix | Delete
**/
[5011] Fix | Delete
protected function isSameType($mime1, $mime2)
[5012] Fix | Delete
{
[5013] Fix | Delete
return ($mime1 == 'directory' && $mime1 == $mime2) || ($mime1 != 'directory' && $mime2 != 'directory');
[5014] Fix | Delete
}
[5015] Fix | Delete
[5016] Fix | Delete
/**
[5017] Fix | Delete
* If file has required attr == $val - return file path,
[5018] Fix | Delete
* If dir has child with has required attr == $val - return child path
[5019] Fix | Delete
*
[5020] Fix | Delete
* @param string $path file path
[5021] Fix | Delete
* @param string $attr attribute name
[5022] Fix | Delete
* @param bool $val attribute value
[5023] Fix | Delete
*
[5024] Fix | Delete
* @return string|false
[5025] Fix | Delete
* @author Dmitry (dio) Levashov
[5026] Fix | Delete
**/
[5027] Fix | Delete
protected function closestByAttr($path, $attr, $val)
[5028] Fix | Delete
{
[5029] Fix | Delete
$stat = $this->stat($path);
[5030] Fix | Delete
[5031] Fix | Delete
if (empty($stat)) {
[5032] Fix | Delete
return false;
[5033] Fix | Delete
}
[5034] Fix | Delete
[5035] Fix | Delete
$v = isset($stat[$attr]) ? $stat[$attr] : false;
[5036] Fix | Delete
[5037] Fix | Delete
if ($v == $val) {
[5038] Fix | Delete
return $path;
[5039] Fix | Delete
}
[5040] Fix | Delete
[5041] Fix | Delete
return $stat['mime'] == 'directory'
[5042] Fix | Delete
? $this->childsByAttr($path, $attr, $val)
[5043] Fix | Delete
: false;
[5044] Fix | Delete
}
[5045] Fix | Delete
[5046] Fix | Delete
/**
[5047] Fix | Delete
* Return first found children with required attr == $val
[5048] Fix | Delete
*
[5049] Fix | Delete
* @param string $path file path
[5050] Fix | Delete
* @param string $attr attribute name
[5051] Fix | Delete
* @param bool $val attribute value
[5052] Fix | Delete
*
[5053] Fix | Delete
* @return string|false
[5054] Fix | Delete
* @author Dmitry (dio) Levashov
[5055] Fix | Delete
**/
[5056] Fix | Delete
protected function childsByAttr($path, $attr, $val)
[5057] Fix | Delete
{
[5058] Fix | Delete
foreach ($this->scandirCE($path) as $p) {
[5059] Fix | Delete
if (($_p = $this->closestByAttr($p, $attr, $val)) != false) {
[5060] Fix | Delete
return $_p;
[5061] Fix | Delete
}
[5062] Fix | Delete
}
[5063] Fix | Delete
return false;
[5064] Fix | Delete
}
[5065] Fix | Delete
[5066] Fix | Delete
protected function isMyReload($target = '', $ARGtarget = '')
[5067] Fix | Delete
{
[5068] Fix | Delete
if ($this->rootModified || (!empty($this->ARGS['cmd']) && $this->ARGS['cmd'] === 'parents')) {
[5069] Fix | Delete
return true;
[5070] Fix | Delete
}
[5071] Fix | Delete
if (!empty($this->ARGS['reload'])) {
[5072] Fix | Delete
if ($ARGtarget === '') {
[5073] Fix | Delete
$ARGtarget = isset($this->ARGS['target']) ? $this->ARGS['target']
[5074] Fix | Delete
: ((isset($this->ARGS['targets']) && is_array($this->ARGS['targets']) && count($this->ARGS['targets']) === 1) ?
[5075] Fix | Delete
$this->ARGS['targets'][0] : '');
[5076] Fix | Delete
}
[5077] Fix | Delete
if ($ARGtarget !== '') {
[5078] Fix | Delete
$ARGtarget = strval($ARGtarget);
[5079] Fix | Delete
if ($target === '') {
[5080] Fix | Delete
return (strpos($ARGtarget, $this->id) === 0);
[5081] Fix | Delete
} else {
[5082] Fix | Delete
$target = strval($target);
[5083] Fix | Delete
return ($target === $ARGtarget);
[5084] Fix | Delete
}
[5085] Fix | Delete
}
[5086] Fix | Delete
}
[5087] Fix | Delete
return false;
[5088] Fix | Delete
}
[5089] Fix | Delete
[5090] Fix | Delete
/**
[5091] Fix | Delete
* Update subdirs cache data
[5092] Fix | Delete
*
[5093] Fix | Delete
* @param string $path
[5094] Fix | Delete
* @param bool $subdirs
[5095] Fix | Delete
*
[5096] Fix | Delete
* @return void
[5097] Fix | Delete
*/
[5098] Fix | Delete
protected function updateSubdirsCache($path, $subdirs)
[5099] Fix | Delete
{
[5100] Fix | Delete
if (isset($this->cache[$path])) {
[5101] Fix | Delete
if ($subdirs) {
[5102] Fix | Delete
$this->cache[$path]['dirs'] = 1;
[5103] Fix | Delete
} else {
[5104] Fix | Delete
unset($this->cache[$path]['dirs']);
[5105] Fix | Delete
}
[5106] Fix | Delete
}
[5107] Fix | Delete
if ($this->sessionCaching['subdirs']) {
[5108] Fix | Delete
$this->sessionCache['subdirs'][$path] = $subdirs;
[5109] Fix | Delete
}
[5110] Fix | Delete
if ($this->sessionCaching['rootstat'] && $path == $this->root) {
[5111] Fix | Delete
unset($this->sessionCache['rootstat'][$this->getRootstatCachekey()]);
[5112] Fix | Delete
}
[5113] Fix | Delete
}
[5114] Fix | Delete
[5115] Fix | Delete
/***************** get content *******************/
[5116] Fix | Delete
[5117] Fix | Delete
/**
[5118] Fix | Delete
* Return required dir's files info.
[5119] Fix | Delete
* If onlyMimes is set - return only dirs and files of required mimes
[5120] Fix | Delete
*
[5121] Fix | Delete
* @param string $path dir path
[5122] Fix | Delete
*
[5123] Fix | Delete
* @return array
[5124] Fix | Delete
* @author Dmitry (dio) Levashov
[5125] Fix | Delete
**/
[5126] Fix | Delete
protected function getScandir($path)
[5127] Fix | Delete
{
[5128] Fix | Delete
$files = array();
[5129] Fix | Delete
[5130] Fix | Delete
!isset($this->dirsCache[$path]) && $this->cacheDir($path);
[5131] Fix | Delete
[5132] Fix | Delete
foreach ($this->dirsCache[$path] as $p) {
[5133] Fix | Delete
if (($stat = $this->stat($p)) && empty($stat['hidden'])) {
[5134] Fix | Delete
$files[] = $stat;
[5135] Fix | Delete
}
[5136] Fix | Delete
}
[5137] Fix | Delete
[5138] Fix | Delete
return $files;
[5139] Fix | Delete
}
[5140] Fix | Delete
[5141] Fix | Delete
[5142] Fix | Delete
/**
[5143] Fix | Delete
* Return subdirs tree
[5144] Fix | Delete
*
[5145] Fix | Delete
* @param string $path parent dir path
[5146] Fix | Delete
* @param int $deep tree deep
[5147] Fix | Delete
* @param string $exclude
[5148] Fix | Delete
*
[5149] Fix | Delete
* @return array
[5150] Fix | Delete
* @author Dmitry (dio) Levashov
[5151] Fix | Delete
*/
[5152] Fix | Delete
protected function gettree($path, $deep, $exclude = '')
[5153] Fix | Delete
{
[5154] Fix | Delete
$dirs = array();
[5155] Fix | Delete
[5156] Fix | Delete
!isset($this->dirsCache[$path]) && $this->cacheDir($path);
[5157] Fix | Delete
[5158] Fix | Delete
foreach ($this->dirsCache[$path] as $p) {
[5159] Fix | Delete
$stat = $this->stat($p);
[5160] Fix | Delete
[5161] Fix | Delete
if ($stat && empty($stat['hidden']) && $p != $exclude && $stat['mime'] == 'directory') {
[5162] Fix | Delete
$dirs[] = $stat;
[5163] Fix | Delete
if ($deep > 0 && !empty($stat['dirs'])) {
[5164] Fix | Delete
$dirs = array_merge($dirs, $this->gettree($p, $deep - 1));
[5165] Fix | Delete
}
[5166] Fix | Delete
}
[5167] Fix | Delete
}
[5168] Fix | Delete
[5169] Fix | Delete
return $dirs;
[5170] Fix | Delete
}
[5171] Fix | Delete
[5172] Fix | Delete
/**
[5173] Fix | Delete
* Recursive files search
[5174] Fix | Delete
*
[5175] Fix | Delete
* @param string $path dir path
[5176] Fix | Delete
* @param string $q search string
[5177] Fix | Delete
* @param array $mimes
[5178] Fix | Delete
*
[5179] Fix | Delete
* @return array
[5180] Fix | Delete
* @throws elFinderAbortException
[5181] Fix | Delete
* @author Dmitry (dio) Levashov
[5182] Fix | Delete
*/
[5183] Fix | Delete
protected function doSearch($path, $q, $mimes)
[5184] Fix | Delete
{
[5185] Fix | Delete
$result = array();
[5186] Fix | Delete
$matchMethod = empty($this->doSearchCurrentQuery['matchMethod']) ? 'searchMatchName' : $this->doSearchCurrentQuery['matchMethod'];
[5187] Fix | Delete
$timeout = $this->options['searchTimeout'] ? $this->searchStart + $this->options['searchTimeout'] : 0;
[5188] Fix | Delete
if ($timeout && $timeout < time()) {
[5189] Fix | Delete
$this->setError(elFinder::ERROR_SEARCH_TIMEOUT, $this->path($this->encode($path)));
[5190] Fix | Delete
return $result;
[5191] Fix | Delete
}
[5192] Fix | Delete
[5193] Fix | Delete
foreach ($this->scandirCE($path) as $p) {
[5194] Fix | Delete
elFinder::extendTimeLimit($this->options['searchTimeout'] + 30);
[5195] Fix | Delete
[5196] Fix | Delete
if ($timeout && ($this->error || $timeout < time())) {
[5197] Fix | Delete
!$this->error && $this->setError(elFinder::ERROR_SEARCH_TIMEOUT, $this->path($this->encode($path)));
[5198] Fix | Delete
break;
[5199] Fix | Delete
}
[5200] Fix | Delete
[5201] Fix | Delete
[5202] Fix | Delete
$stat = $this->stat($p);
[5203] Fix | Delete
[5204] Fix | Delete
if (!$stat) { // invalid links
[5205] Fix | Delete
continue;
[5206] Fix | Delete
}
[5207] Fix | Delete
[5208] Fix | Delete
if (!empty($stat['hidden']) || !$this->mimeAccepted($stat['mime'], $mimes)) {
[5209] Fix | Delete
continue;
[5210] Fix | Delete
}
[5211] Fix | Delete
[5212] Fix | Delete
$name = $stat['name'];
[5213] Fix | Delete
[5214] Fix | Delete
if ($this->doSearchCurrentQuery['excludes']) {
[5215] Fix | Delete
foreach ($this->doSearchCurrentQuery['excludes'] as $exclude) {
[5216] Fix | Delete
if ($this->stripos($name, $exclude) !== false) {
[5217] Fix | Delete
continue 2;
[5218] Fix | Delete
}
[5219] Fix | Delete
}
[5220] Fix | Delete
}
[5221] Fix | Delete
[5222] Fix | Delete
if ((!$mimes || $stat['mime'] !== 'directory') && $this->$matchMethod($name, $q, $p) !== false) {
[5223] Fix | Delete
$stat['path'] = $this->path($stat['hash']);
[5224] Fix | Delete
if ($this->URL && !isset($stat['url'])) {
[5225] Fix | Delete
$path = str_replace($this->separator, '/', substr($p, strlen($this->root) + 1));
[5226] Fix | Delete
if ($this->encoding) {
[5227] Fix | Delete
$path = str_replace('%2F', '/', rawurlencode($this->convEncIn($path, true)));
[5228] Fix | Delete
} else {
[5229] Fix | Delete
$path = str_replace('%2F', '/', rawurlencode($path));
[5230] Fix | Delete
}
[5231] Fix | Delete
$stat['url'] = $this->URL . $path;
[5232] Fix | Delete
}
[5233] Fix | Delete
[5234] Fix | Delete
$result[] = $stat;
[5235] Fix | Delete
}
[5236] Fix | Delete
if ($stat['mime'] == 'directory' && $stat['read'] && !isset($stat['alias'])) {
[5237] Fix | Delete
if (!$this->options['searchExDirReg'] || !preg_match($this->options['searchExDirReg'], $p)) {
[5238] Fix | Delete
$result = array_merge($result, $this->doSearch($p, $q, $mimes));
[5239] Fix | Delete
}
[5240] Fix | Delete
}
[5241] Fix | Delete
}
[5242] Fix | Delete
[5243] Fix | Delete
return $result;
[5244] Fix | Delete
}
[5245] Fix | Delete
[5246] Fix | Delete
/********************** manuipulations ******************/
[5247] Fix | Delete
[5248] Fix | Delete
/**
[5249] Fix | Delete
* Copy file/recursive copy dir only in current volume.
[5250] Fix | Delete
* Return new file path or false.
[5251] Fix | Delete
*
[5252] Fix | Delete
* @param string $src source path
[5253] Fix | Delete
* @param string $dst destination dir path
[5254] Fix | Delete
* @param string $name new file name (optionaly)
[5255] Fix | Delete
*
[5256] Fix | Delete
* @return string|false
[5257] Fix | Delete
* @throws elFinderAbortException
[5258] Fix | Delete
* @author Dmitry (dio) Levashov
[5259] Fix | Delete
*/
[5260] Fix | Delete
protected function copy($src, $dst, $name)
[5261] Fix | Delete
{
[5262] Fix | Delete
[5263] Fix | Delete
elFinder::checkAborted();
[5264] Fix | Delete
[5265] Fix | Delete
$srcStat = $this->stat($src);
[5266] Fix | Delete
[5267] Fix | Delete
if (!empty($srcStat['thash'])) {
[5268] Fix | Delete
$target = $this->decode($srcStat['thash']);
[5269] Fix | Delete
if (!$this->inpathCE($target, $this->root)) {
[5270] Fix | Delete
return $this->setError(elFinder::ERROR_COPY, $this->path($srcStat['hash']), elFinder::ERROR_MKOUTLINK);
[5271] Fix | Delete
}
[5272] Fix | Delete
$stat = $this->stat($target);
[5273] Fix | Delete
$this->clearcache();
[5274] Fix | Delete
return $stat && $this->symlinkCE($target, $dst, $name)
[5275] Fix | Delete
? $this->joinPathCE($dst, $name)
[5276] Fix | Delete
: $this->setError(elFinder::ERROR_COPY, $this->path($srcStat['hash']));
[5277] Fix | Delete
}
[5278] Fix | Delete
[5279] Fix | Delete
if ($srcStat['mime'] === 'directory') {
[5280] Fix | Delete
$testStat = $this->isNameExists($this->joinPathCE($dst, $name));
[5281] Fix | Delete
$this->clearcache();
[5282] Fix | Delete
[5283] Fix | Delete
if (($testStat && $testStat['mime'] !== 'directory') || (!$testStat && !$testStat = $this->mkdir($this->encode($dst), $name))) {
[5284] Fix | Delete
return $this->setError(elFinder::ERROR_COPY, $this->path($srcStat['hash']));
[5285] Fix | Delete
}
[5286] Fix | Delete
[5287] Fix | Delete
$dst = $this->decode($testStat['hash']);
[5288] Fix | Delete
[5289] Fix | Delete
// start time
[5290] Fix | Delete
$stime = microtime(true);
[5291] Fix | Delete
foreach ($this->getScandir($src) as $stat) {
[5292] Fix | Delete
if (empty($stat['hidden'])) {
[5293] Fix | Delete
// current time
[5294] Fix | Delete
$ctime = microtime(true);
[5295] Fix | Delete
if (($ctime - $stime) > 2) {
[5296] Fix | Delete
$stime = $ctime;
[5297] Fix | Delete
elFinder::checkAborted();
[5298] Fix | Delete
}
[5299] Fix | Delete
$name = $stat['name'];
[5300] Fix | Delete
$_src = $this->decode($stat['hash']);
[5301] Fix | Delete
if (!$this->copy($_src, $dst, $name)) {
[5302] Fix | Delete
$this->remove($dst, true); // fall back
[5303] Fix | Delete
return $this->setError($this->error, elFinder::ERROR_COPY, $this->_path($src));
[5304] Fix | Delete
}
[5305] Fix | Delete
}
[5306] Fix | Delete
}
[5307] Fix | Delete
[5308] Fix | Delete
$this->added[] = $testStat;
[5309] Fix | Delete
[5310] Fix | Delete
return $dst;
[5311] Fix | Delete
}
[5312] Fix | Delete
[5313] Fix | Delete
if ($this->options['copyJoin']) {
[5314] Fix | Delete
$test = $this->joinPathCE($dst, $name);
[5315] Fix | Delete
if ($this->isNameExists($test)) {
[5316] Fix | Delete
$this->remove($test);
[5317] Fix | Delete
}
[5318] Fix | Delete
}
[5319] Fix | Delete
if ($res = $this->convEncOut($this->_copy($this->convEncIn($src), $this->convEncIn($dst), $this->convEncIn($name)))) {
[5320] Fix | Delete
$path = is_string($res) ? $res : $this->joinPathCE($dst, $name);
[5321] Fix | Delete
$this->clearstatcache();
[5322] Fix | Delete
$this->added[] = $this->stat($path);
[5323] Fix | Delete
return $path;
[5324] Fix | Delete
}
[5325] Fix | Delete
[5326] Fix | Delete
return $this->setError(elFinder::ERROR_COPY, $this->path($srcStat['hash']));
[5327] Fix | Delete
}
[5328] Fix | Delete
[5329] Fix | Delete
/**
[5330] Fix | Delete
* Move file
[5331] Fix | Delete
* Return new file path or false.
[5332] Fix | Delete
*
[5333] Fix | Delete
* @param string $src source path
[5334] Fix | Delete
* @param string $dst destination dir path
[5335] Fix | Delete
* @param string $name new file name
[5336] Fix | Delete
*
[5337] Fix | Delete
* @return string|false
[5338] Fix | Delete
* @throws elFinderAbortException
[5339] Fix | Delete
* @author Dmitry (dio) Levashov
[5340] Fix | Delete
*/
[5341] Fix | Delete
protected function move($src, $dst, $name)
[5342] Fix | Delete
{
[5343] Fix | Delete
$stat = $this->stat($src);
[5344] Fix | Delete
$stat['realpath'] = $src;
[5345] Fix | Delete
$this->rmTmb($stat); // can not do rmTmb() after _move()
[5346] Fix | Delete
$this->clearcache();
[5347] Fix | Delete
[5348] Fix | Delete
$res = $this->convEncOut($this->_move($this->convEncIn($src), $this->convEncIn($dst), $this->convEncIn($name)));
[5349] Fix | Delete
// if moving it didn't work try to copy / delete
[5350] Fix | Delete
if (!$res) {
[5351] Fix | Delete
if ($this->copy($src, $dst, $name)) {
[5352] Fix | Delete
$res = $this->remove($src);
[5353] Fix | Delete
}
[5354] Fix | Delete
}
[5355] Fix | Delete
[5356] Fix | Delete
if ($res) {
[5357] Fix | Delete
$this->clearstatcache();
[5358] Fix | Delete
if ($stat['mime'] === 'directory') {
[5359] Fix | Delete
$this->updateSubdirsCache($dst, true);
[5360] Fix | Delete
}
[5361] Fix | Delete
$path = is_string($res) ? $res : $this->joinPathCE($dst, $name);
[5362] Fix | Delete
$this->added[] = $this->stat($path);
[5363] Fix | Delete
$this->removed[] = $stat;
[5364] Fix | Delete
return $path;
[5365] Fix | Delete
}
[5366] Fix | Delete
[5367] Fix | Delete
return $this->setError(elFinder::ERROR_MOVE, $this->path($stat['hash']));
[5368] Fix | Delete
}
[5369] Fix | Delete
[5370] Fix | Delete
/**
[5371] Fix | Delete
* Copy file from another volume.
[5372] Fix | Delete
* Return new file path or false.
[5373] Fix | Delete
*
[5374] Fix | Delete
* @param Object $volume source volume
[5375] Fix | Delete
* @param string $src source file hash
[5376] Fix | Delete
* @param string $destination destination dir path
[5377] Fix | Delete
* @param string $name file name
[5378] Fix | Delete
*
[5379] Fix | Delete
* @return string|false
[5380] Fix | Delete
* @throws elFinderAbortException
[5381] Fix | Delete
* @author Dmitry (dio) Levashov
[5382] Fix | Delete
*/
[5383] Fix | Delete
protected function copyFrom($volume, $src, $destination, $name)
[5384] Fix | Delete
{
[5385] Fix | Delete
[5386] Fix | Delete
elFinder::checkAborted();
[5387] Fix | Delete
[5388] Fix | Delete
if (($source = $volume->file($src)) == false) {
[5389] Fix | Delete
return $this->addError(elFinder::ERROR_COPY, '#' . $src, $volume->error());
[5390] Fix | Delete
}
[5391] Fix | Delete
[5392] Fix | Delete
$srcIsDir = ($source['mime'] === 'directory');
[5393] Fix | Delete
[5394] Fix | Delete
$errpath = $volume->path($source['hash']);
[5395] Fix | Delete
[5396] Fix | Delete
$errors = array();
[5397] Fix | Delete
try {
[5398] Fix | Delete
$thash = $this->encode($destination);
[5399] Fix | Delete
elFinder::$instance->trigger('paste.copyfrom', array(&$thash, &$name, '', elFinder::$instance, $this), $errors);
[5400] Fix | Delete
} catch (elFinderTriggerException $e) {
[5401] Fix | Delete
return $this->addError(elFinder::ERROR_COPY, $name, $errors);
[5402] Fix | Delete
}
[5403] Fix | Delete
[5404] Fix | Delete
if (!$this->nameAccepted($name, $srcIsDir)) {
[5405] Fix | Delete
return $this->addError(elFinder::ERROR_COPY, $name, $srcIsDir ? elFinder::ERROR_INVALID_DIRNAME : elFinder::ERROR_INVALID_NAME);
[5406] Fix | Delete
}
[5407] Fix | Delete
[5408] Fix | Delete
if (!$this->allowCreate($destination, $name, $srcIsDir)) {
[5409] Fix | Delete
return $this->addError(elFinder::ERROR_COPY, $name, elFinder::ERROR_PERM_DENIED);
[5410] Fix | Delete
}
[5411] Fix | Delete
[5412] Fix | Delete
if (!$source['read']) {
[5413] Fix | Delete
return $this->addError(elFinder::ERROR_COPY, $errpath, elFinder::ERROR_PERM_DENIED);
[5414] Fix | Delete
}
[5415] Fix | Delete
[5416] Fix | Delete
if ($srcIsDir) {
[5417] Fix | Delete
$test = $this->isNameExists($this->joinPathCE($destination, $name));
[5418] Fix | Delete
$this->clearcache();
[5419] Fix | Delete
[5420] Fix | Delete
if (($test && $test['mime'] != 'directory') || (!$test && !$test = $this->mkdir($this->encode($destination), $name))) {
[5421] Fix | Delete
return $this->addError(elFinder::ERROR_COPY, $errpath);
[5422] Fix | Delete
}
[5423] Fix | Delete
[5424] Fix | Delete
//$path = $this->joinPathCE($destination, $name);
[5425] Fix | Delete
$path = $this->decode($test['hash']);
[5426] Fix | Delete
[5427] Fix | Delete
foreach ($volume->scandir($src) as $entr) {
[5428] Fix | Delete
$this->copyFrom($volume, $entr['hash'], $path, $entr['name']);
[5429] Fix | Delete
}
[5430] Fix | Delete
[5431] Fix | Delete
$this->added[] = $test;
[5432] Fix | Delete
} else {
[5433] Fix | Delete
// size check
[5434] Fix | Delete
if (!isset($source['size']) || $source['size'] > $this->uploadMaxSize) {
[5435] Fix | Delete
return $this->setError(elFinder::ERROR_UPLOAD_FILE_SIZE);
[5436] Fix | Delete
}
[5437] Fix | Delete
[5438] Fix | Delete
// MIME check
[5439] Fix | Delete
$mimeByName = $this->mimetype($source['name'], true);
[5440] Fix | Delete
if ($source['mime'] === $mimeByName) {
[5441] Fix | Delete
$mimeByName = '';
[5442] Fix | Delete
}
[5443] Fix | Delete
if (!$this->allowPutMime($source['mime']) || ($mimeByName && !$this->allowPutMime($mimeByName))) {
[5444] Fix | Delete
return $this->addError(elFinder::ERROR_UPLOAD_FILE_MIME, $errpath);
[5445] Fix | Delete
}
[5446] Fix | Delete
[5447] Fix | Delete
if (strpos($source['mime'], 'image') === 0 && ($dim = $volume->dimensions($src))) {
[5448] Fix | Delete
if (is_array($dim)) {
[5449] Fix | Delete
$dim = isset($dim['dim']) ? $dim['dim'] : null;
[5450] Fix | Delete
}
[5451] Fix | Delete
if ($dim) {
[5452] Fix | Delete
$s = explode('x', $dim);
[5453] Fix | Delete
$source['width'] = $s[0];
[5454] Fix | Delete
$source['height'] = $s[1];
[5455] Fix | Delete
}
[5456] Fix | Delete
}
[5457] Fix | Delete
[5458] Fix | Delete
if (($fp = $volume->open($src)) == false
[5459] Fix | Delete
|| ($path = $this->saveCE($fp, $destination, $name, $source)) == false) {
[5460] Fix | Delete
$fp && $volume->close($fp, $src);
[5461] Fix | Delete
return $this->addError(elFinder::ERROR_COPY, $errpath);
[5462] Fix | Delete
}
[5463] Fix | Delete
$volume->close($fp, $src);
[5464] Fix | Delete
[5465] Fix | Delete
$this->added[] = $this->stat($path);;
[5466] Fix | Delete
}
[5467] Fix | Delete
[5468] Fix | Delete
return $path;
[5469] Fix | Delete
}
[5470] Fix | Delete
[5471] Fix | Delete
/**
[5472] Fix | Delete
* Remove file/ recursive remove dir
[5473] Fix | Delete
*
[5474] Fix | Delete
* @param string $path file path
[5475] Fix | Delete
* @param bool $force try to remove even if file locked
[5476] Fix | Delete
*
[5477] Fix | Delete
* @return bool
[5478] Fix | Delete
* @throws elFinderAbortException
[5479] Fix | Delete
* @author Dmitry (dio) Levashov
[5480] Fix | Delete
*/
[5481] Fix | Delete
protected function remove($path, $force = false)
[5482] Fix | Delete
{
[5483] Fix | Delete
$stat = $this->stat($path);
[5484] Fix | Delete
[5485] Fix | Delete
if (empty($stat)) {
[5486] Fix | Delete
return $this->setError(elFinder::ERROR_RM, $this->relpathCE($path), elFinder::ERROR_FILE_NOT_FOUND);
[5487] Fix | Delete
}
[5488] Fix | Delete
[5489] Fix | Delete
$stat['realpath'] = $path;
[5490] Fix | Delete
$this->rmTmb($stat);
[5491] Fix | Delete
$this->clearcache();
[5492] Fix | Delete
[5493] Fix | Delete
if (!$force && !empty($stat['locked'])) {
[5494] Fix | Delete
return $this->setError(elFinder::ERROR_LOCKED, $this->path($stat['hash']));
[5495] Fix | Delete
}
[5496] Fix | Delete
[5497] Fix | Delete
if ($stat['mime'] == 'directory' && empty($stat['thash'])) {
[5498] Fix | Delete
$ret = $this->delTree($this->convEncIn($path));
[5499] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function