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
: $this->setError(elFinder::ERROR_NOT_DIR);
[2000] Fix | Delete
}
[2001] Fix | Delete
[2002] Fix | Delete
/**
[2003] Fix | Delete
* Return directory content or false on error
[2004] Fix | Delete
*
[2005] Fix | Delete
* @param string $hash file hash
[2006] Fix | Delete
*
[2007] Fix | Delete
* @return array|false
[2008] Fix | Delete
* @author Dmitry (dio) Levashov
[2009] Fix | Delete
**/
[2010] Fix | Delete
public function scandir($hash)
[2011] Fix | Delete
{
[2012] Fix | Delete
if (($dir = $this->dir($hash)) == false) {
[2013] Fix | Delete
return false;
[2014] Fix | Delete
}
[2015] Fix | Delete
[2016] Fix | Delete
$path = $this->decode($hash);
[2017] Fix | Delete
if ($res = $dir['read']
[2018] Fix | Delete
? $this->getScandir($path)
[2019] Fix | Delete
: $this->setError(elFinder::ERROR_PERM_DENIED)) {
[2020] Fix | Delete
[2021] Fix | Delete
$dirs = null;
[2022] Fix | Delete
if ($this->sessionCaching['subdirs'] && isset($this->sessionCache['subdirs'][$path])) {
[2023] Fix | Delete
$dirs = $this->sessionCache['subdirs'][$path];
[2024] Fix | Delete
}
[2025] Fix | Delete
if ($dirs !== null || (isset($dir['dirs']) && $dir['dirs'] != 1)) {
[2026] Fix | Delete
$_dir = $dir;
[2027] Fix | Delete
if ($dirs || $this->subdirs($hash)) {
[2028] Fix | Delete
$dir['dirs'] = 1;
[2029] Fix | Delete
} else {
[2030] Fix | Delete
unset($dir['dirs']);
[2031] Fix | Delete
}
[2032] Fix | Delete
if ($dir !== $_dir) {
[2033] Fix | Delete
$this->updateCache($path, $dir);
[2034] Fix | Delete
}
[2035] Fix | Delete
}
[2036] Fix | Delete
}
[2037] Fix | Delete
[2038] Fix | Delete
return $res;
[2039] Fix | Delete
}
[2040] Fix | Delete
[2041] Fix | Delete
/**
[2042] Fix | Delete
* Return dir files names list
[2043] Fix | Delete
*
[2044] Fix | Delete
* @param string $hash file hash
[2045] Fix | Delete
* @param null $intersect
[2046] Fix | Delete
*
[2047] Fix | Delete
* @return array|false
[2048] Fix | Delete
* @author Dmitry (dio) Levashov
[2049] Fix | Delete
*/
[2050] Fix | Delete
public function ls($hash, $intersect = null)
[2051] Fix | Delete
{
[2052] Fix | Delete
if (($dir = $this->dir($hash)) == false || !$dir['read']) {
[2053] Fix | Delete
return false;
[2054] Fix | Delete
}
[2055] Fix | Delete
[2056] Fix | Delete
$list = array();
[2057] Fix | Delete
$path = $this->decode($hash);
[2058] Fix | Delete
[2059] Fix | Delete
$check = array();
[2060] Fix | Delete
if ($intersect) {
[2061] Fix | Delete
$check = array_flip($intersect);
[2062] Fix | Delete
}
[2063] Fix | Delete
[2064] Fix | Delete
foreach ($this->getScandir($path) as $stat) {
[2065] Fix | Delete
if (empty($stat['hidden']) && (!$check || isset($check[$stat['name']])) && $this->mimeAccepted($stat['mime'])) {
[2066] Fix | Delete
$list[$stat['hash']] = $stat['name'];
[2067] Fix | Delete
}
[2068] Fix | Delete
}
[2069] Fix | Delete
[2070] Fix | Delete
return $list;
[2071] Fix | Delete
}
[2072] Fix | Delete
[2073] Fix | Delete
/**
[2074] Fix | Delete
* Return subfolders for required folder or false on error
[2075] Fix | Delete
*
[2076] Fix | Delete
* @param string $hash folder hash or empty string to get tree from root folder
[2077] Fix | Delete
* @param int $deep subdir deep
[2078] Fix | Delete
* @param string $exclude dir hash which subfolders must be exluded from result, required to not get stat twice on cwd subfolders
[2079] Fix | Delete
*
[2080] Fix | Delete
* @return array|false
[2081] Fix | Delete
* @author Dmitry (dio) Levashov
[2082] Fix | Delete
**/
[2083] Fix | Delete
public function tree($hash = '', $deep = 0, $exclude = '')
[2084] Fix | Delete
{
[2085] Fix | Delete
$path = $hash ? $this->decode($hash) : $this->root;
[2086] Fix | Delete
[2087] Fix | Delete
if (($dir = $this->stat($path)) == false || $dir['mime'] != 'directory') {
[2088] Fix | Delete
return false;
[2089] Fix | Delete
}
[2090] Fix | Delete
[2091] Fix | Delete
$dirs = $this->gettree($path, $deep > 0 ? $deep - 1 : $this->treeDeep - 1, $exclude ? $this->decode($exclude) : null);
[2092] Fix | Delete
array_unshift($dirs, $dir);
[2093] Fix | Delete
return $dirs;
[2094] Fix | Delete
}
[2095] Fix | Delete
[2096] Fix | Delete
/**
[2097] Fix | Delete
* Return part of dirs tree from required dir up to root dir
[2098] Fix | Delete
*
[2099] Fix | Delete
* @param string $hash directory hash
[2100] Fix | Delete
* @param bool|null $lineal only lineal parents
[2101] Fix | Delete
*
[2102] Fix | Delete
* @return array|false
[2103] Fix | Delete
* @throws elFinderAbortException
[2104] Fix | Delete
* @author Dmitry (dio) Levashov
[2105] Fix | Delete
*/
[2106] Fix | Delete
public function parents($hash, $lineal = false)
[2107] Fix | Delete
{
[2108] Fix | Delete
if (($current = $this->dir($hash)) == false) {
[2109] Fix | Delete
return false;
[2110] Fix | Delete
}
[2111] Fix | Delete
[2112] Fix | Delete
$args = func_get_args();
[2113] Fix | Delete
// checks 3rd param `$until` (elFinder >= 2.1.24)
[2114] Fix | Delete
$until = '';
[2115] Fix | Delete
if (isset($args[2])) {
[2116] Fix | Delete
$until = $args[2];
[2117] Fix | Delete
}
[2118] Fix | Delete
[2119] Fix | Delete
$path = $this->decode($hash);
[2120] Fix | Delete
$tree = array();
[2121] Fix | Delete
[2122] Fix | Delete
while ($path && $path != $this->root) {
[2123] Fix | Delete
elFinder::checkAborted();
[2124] Fix | Delete
$path = $this->dirnameCE($path);
[2125] Fix | Delete
if (!($stat = $this->stat($path)) || !empty($stat['hidden']) || !$stat['read']) {
[2126] Fix | Delete
return false;
[2127] Fix | Delete
}
[2128] Fix | Delete
[2129] Fix | Delete
array_unshift($tree, $stat);
[2130] Fix | Delete
if (!$lineal) {
[2131] Fix | Delete
foreach ($this->gettree($path, 0) as $dir) {
[2132] Fix | Delete
elFinder::checkAborted();
[2133] Fix | Delete
if (!isset($tree[$dir['hash']])) {
[2134] Fix | Delete
$tree[$dir['hash']] = $dir;
[2135] Fix | Delete
}
[2136] Fix | Delete
}
[2137] Fix | Delete
}
[2138] Fix | Delete
[2139] Fix | Delete
if ($until && $until === $this->encode($path)) {
[2140] Fix | Delete
break;
[2141] Fix | Delete
}
[2142] Fix | Delete
}
[2143] Fix | Delete
[2144] Fix | Delete
return $tree ? array_values($tree) : array($current);
[2145] Fix | Delete
}
[2146] Fix | Delete
[2147] Fix | Delete
/**
[2148] Fix | Delete
* Create thumbnail for required file and return its name or false on failed
[2149] Fix | Delete
*
[2150] Fix | Delete
* @param $hash
[2151] Fix | Delete
*
[2152] Fix | Delete
* @return false|string
[2153] Fix | Delete
* @throws ImagickException
[2154] Fix | Delete
* @throws elFinderAbortException
[2155] Fix | Delete
* @author Dmitry (dio) Levashov
[2156] Fix | Delete
*/
[2157] Fix | Delete
public function tmb($hash)
[2158] Fix | Delete
{
[2159] Fix | Delete
$path = $this->decode($hash);
[2160] Fix | Delete
$stat = $this->stat($path);
[2161] Fix | Delete
[2162] Fix | Delete
if (isset($stat['tmb'])) {
[2163] Fix | Delete
$res = $stat['tmb'] == "1" ? $this->createTmb($path, $stat) : $stat['tmb'];
[2164] Fix | Delete
if (!$res) {
[2165] Fix | Delete
list($type) = explode('/', $stat['mime']);
[2166] Fix | Delete
$fallback = $this->options['resourcePath'] . DIRECTORY_SEPARATOR . strtolower($type) . '.png';
[2167] Fix | Delete
if (is_file($fallback)) {
[2168] Fix | Delete
$res = $this->tmbname($stat);
[2169] Fix | Delete
if (!copy($fallback, $this->tmbPath . DIRECTORY_SEPARATOR . $res)) {
[2170] Fix | Delete
$res = false;
[2171] Fix | Delete
}
[2172] Fix | Delete
}
[2173] Fix | Delete
}
[2174] Fix | Delete
// tmb garbage collection
[2175] Fix | Delete
if ($res && $this->options['tmbGcMaxlifeHour'] && $this->options['tmbGcPercentage'] > 0) {
[2176] Fix | Delete
$rand = mt_rand(1, 10000);
[2177] Fix | Delete
if ($rand <= $this->options['tmbGcPercentage'] * 100) {
[2178] Fix | Delete
register_shutdown_function(array('elFinder', 'GlobGC'), $this->tmbPath . DIRECTORY_SEPARATOR . '*.png', $this->options['tmbGcMaxlifeHour'] * 3600);
[2179] Fix | Delete
}
[2180] Fix | Delete
}
[2181] Fix | Delete
return $res;
[2182] Fix | Delete
}
[2183] Fix | Delete
return false;
[2184] Fix | Delete
}
[2185] Fix | Delete
[2186] Fix | Delete
/**
[2187] Fix | Delete
* Return file size / total directory size
[2188] Fix | Delete
*
[2189] Fix | Delete
* @param string file hash
[2190] Fix | Delete
*
[2191] Fix | Delete
* @return array
[2192] Fix | Delete
* @throws elFinderAbortException
[2193] Fix | Delete
* @author Dmitry (dio) Levashov
[2194] Fix | Delete
*/
[2195] Fix | Delete
public function size($hash)
[2196] Fix | Delete
{
[2197] Fix | Delete
return $this->countSize($this->decode($hash));
[2198] Fix | Delete
}
[2199] Fix | Delete
[2200] Fix | Delete
/**
[2201] Fix | Delete
* Open file for reading and return file pointer
[2202] Fix | Delete
*
[2203] Fix | Delete
* @param string file hash
[2204] Fix | Delete
*
[2205] Fix | Delete
* @return Resource|false
[2206] Fix | Delete
* @author Dmitry (dio) Levashov
[2207] Fix | Delete
**/
[2208] Fix | Delete
public function open($hash)
[2209] Fix | Delete
{
[2210] Fix | Delete
if (($file = $this->file($hash)) == false
[2211] Fix | Delete
|| $file['mime'] == 'directory') {
[2212] Fix | Delete
return false;
[2213] Fix | Delete
}
[2214] Fix | Delete
// check extra option for network stream pointer
[2215] Fix | Delete
if (func_num_args() > 1) {
[2216] Fix | Delete
$opts = func_get_arg(1);
[2217] Fix | Delete
} else {
[2218] Fix | Delete
$opts = array();
[2219] Fix | Delete
}
[2220] Fix | Delete
return $this->fopenCE($this->decode($hash), 'rb', $opts);
[2221] Fix | Delete
}
[2222] Fix | Delete
[2223] Fix | Delete
/**
[2224] Fix | Delete
* Close file pointer
[2225] Fix | Delete
*
[2226] Fix | Delete
* @param Resource $fp file pointer
[2227] Fix | Delete
* @param string $hash file hash
[2228] Fix | Delete
*
[2229] Fix | Delete
* @return void
[2230] Fix | Delete
* @author Dmitry (dio) Levashov
[2231] Fix | Delete
**/
[2232] Fix | Delete
public function close($fp, $hash)
[2233] Fix | Delete
{
[2234] Fix | Delete
$this->fcloseCE($fp, $this->decode($hash));
[2235] Fix | Delete
}
[2236] Fix | Delete
[2237] Fix | Delete
/**
[2238] Fix | Delete
* Create directory and return dir info
[2239] Fix | Delete
*
[2240] Fix | Delete
* @param string $dsthash destination directory hash
[2241] Fix | Delete
* @param string $name directory name
[2242] Fix | Delete
*
[2243] Fix | Delete
* @return array|false
[2244] Fix | Delete
* @author Dmitry (dio) Levashov
[2245] Fix | Delete
**/
[2246] Fix | Delete
public function mkdir($dsthash, $name)
[2247] Fix | Delete
{
[2248] Fix | Delete
if ($this->commandDisabled('mkdir')) {
[2249] Fix | Delete
return $this->setError(elFinder::ERROR_PERM_DENIED);
[2250] Fix | Delete
}
[2251] Fix | Delete
[2252] Fix | Delete
if (!$this->nameAccepted($name, true)) {
[2253] Fix | Delete
return $this->setError(elFinder::ERROR_INVALID_DIRNAME);
[2254] Fix | Delete
}
[2255] Fix | Delete
[2256] Fix | Delete
if (($dir = $this->dir($dsthash)) == false) {
[2257] Fix | Delete
return $this->setError(elFinder::ERROR_TRGDIR_NOT_FOUND, '#' . $dsthash);
[2258] Fix | Delete
}
[2259] Fix | Delete
[2260] Fix | Delete
$path = $this->decode($dsthash);
[2261] Fix | Delete
[2262] Fix | Delete
if (!$dir['write'] || !$this->allowCreate($path, $name, true)) {
[2263] Fix | Delete
return $this->setError(elFinder::ERROR_PERM_DENIED);
[2264] Fix | Delete
}
[2265] Fix | Delete
[2266] Fix | Delete
if (substr($name, 0, 1) === '/' || substr($name, 0, 1) === '\\') {
[2267] Fix | Delete
return $this->setError(elFinder::ERROR_INVALID_DIRNAME);
[2268] Fix | Delete
}
[2269] Fix | Delete
[2270] Fix | Delete
$dst = $this->joinPathCE($path, $name);
[2271] Fix | Delete
$stat = $this->isNameExists($dst);
[2272] Fix | Delete
if (!empty($stat)) {
[2273] Fix | Delete
return $this->setError(elFinder::ERROR_EXISTS, $name);
[2274] Fix | Delete
}
[2275] Fix | Delete
$this->clearcache();
[2276] Fix | Delete
[2277] Fix | Delete
$mkpath = $this->convEncOut($this->_mkdir($this->convEncIn($path), $this->convEncIn($name)));
[2278] Fix | Delete
if ($mkpath) {
[2279] Fix | Delete
$this->clearstatcache();
[2280] Fix | Delete
$this->updateSubdirsCache($path, true);
[2281] Fix | Delete
$this->updateSubdirsCache($mkpath, false);
[2282] Fix | Delete
}
[2283] Fix | Delete
[2284] Fix | Delete
return $mkpath ? $this->stat($mkpath) : false;
[2285] Fix | Delete
}
[2286] Fix | Delete
[2287] Fix | Delete
/**
[2288] Fix | Delete
* Create empty file and return its info
[2289] Fix | Delete
*
[2290] Fix | Delete
* @param string $dst destination directory
[2291] Fix | Delete
* @param string $name file name
[2292] Fix | Delete
*
[2293] Fix | Delete
* @return array|false
[2294] Fix | Delete
* @author Dmitry (dio) Levashov
[2295] Fix | Delete
**/
[2296] Fix | Delete
public function mkfile($dst, $name)
[2297] Fix | Delete
{
[2298] Fix | Delete
if ($this->commandDisabled('mkfile')) {
[2299] Fix | Delete
return $this->setError(elFinder::ERROR_PERM_DENIED);
[2300] Fix | Delete
}
[2301] Fix | Delete
[2302] Fix | Delete
if (!$this->nameAccepted($name, false)) {
[2303] Fix | Delete
return $this->setError(elFinder::ERROR_INVALID_NAME);
[2304] Fix | Delete
}
[2305] Fix | Delete
[2306] Fix | Delete
if (substr($name, 0, 1) === '/' || substr($name, 0, 1) === '\\') {
[2307] Fix | Delete
return $this->setError(elFinder::ERROR_INVALID_DIRNAME);
[2308] Fix | Delete
}
[2309] Fix | Delete
[2310] Fix | Delete
$mimeByName = $this->mimetype($name, true);
[2311] Fix | Delete
if ($mimeByName && !$this->allowPutMime($mimeByName)) {
[2312] Fix | Delete
return $this->setError(elFinder::ERROR_UPLOAD_FILE_MIME, $name);
[2313] Fix | Delete
}
[2314] Fix | Delete
[2315] Fix | Delete
if (($dir = $this->dir($dst)) == false) {
[2316] Fix | Delete
return $this->setError(elFinder::ERROR_TRGDIR_NOT_FOUND, '#' . $dst);
[2317] Fix | Delete
}
[2318] Fix | Delete
[2319] Fix | Delete
$path = $this->decode($dst);
[2320] Fix | Delete
[2321] Fix | Delete
if (!$dir['write'] || !$this->allowCreate($path, $name, false)) {
[2322] Fix | Delete
return $this->setError(elFinder::ERROR_PERM_DENIED);
[2323] Fix | Delete
}
[2324] Fix | Delete
[2325] Fix | Delete
if ($this->isNameExists($this->joinPathCE($path, $name))) {
[2326] Fix | Delete
return $this->setError(elFinder::ERROR_EXISTS, $name);
[2327] Fix | Delete
}
[2328] Fix | Delete
[2329] Fix | Delete
$this->clearcache();
[2330] Fix | Delete
$res = false;
[2331] Fix | Delete
if ($path = $this->convEncOut($this->_mkfile($this->convEncIn($path), $this->convEncIn($name)))) {
[2332] Fix | Delete
$this->clearstatcache();
[2333] Fix | Delete
$res = $this->stat($path);
[2334] Fix | Delete
}
[2335] Fix | Delete
return $res;
[2336] Fix | Delete
}
[2337] Fix | Delete
[2338] Fix | Delete
/**
[2339] Fix | Delete
* Rename file and return file info
[2340] Fix | Delete
*
[2341] Fix | Delete
* @param string $hash file hash
[2342] Fix | Delete
* @param string $name new file name
[2343] Fix | Delete
*
[2344] Fix | Delete
* @return array|false
[2345] Fix | Delete
* @throws elFinderAbortException
[2346] Fix | Delete
* @author Dmitry (dio) Levashov
[2347] Fix | Delete
*/
[2348] Fix | Delete
public function rename($hash, $name)
[2349] Fix | Delete
{
[2350] Fix | Delete
if ($this->commandDisabled('rename')) {
[2351] Fix | Delete
return $this->setError(elFinder::ERROR_PERM_DENIED);
[2352] Fix | Delete
}
[2353] Fix | Delete
[2354] Fix | Delete
if (!($file = $this->file($hash))) {
[2355] Fix | Delete
return $this->setError(elFinder::ERROR_FILE_NOT_FOUND);
[2356] Fix | Delete
}
[2357] Fix | Delete
[2358] Fix | Delete
if ($name === $file['name']) {
[2359] Fix | Delete
return $file;
[2360] Fix | Delete
}
[2361] Fix | Delete
[2362] Fix | Delete
if (!empty($this->options['netkey']) && !empty($file['isroot'])) {
[2363] Fix | Delete
// change alias of netmount root
[2364] Fix | Delete
$rootKey = $this->getRootstatCachekey();
[2365] Fix | Delete
// delete old cache data
[2366] Fix | Delete
if ($this->sessionCaching['rootstat']) {
[2367] Fix | Delete
unset($this->sessionCaching['rootstat'][$rootKey]);
[2368] Fix | Delete
}
[2369] Fix | Delete
if (elFinder::$instance->updateNetVolumeOption($this->options['netkey'], 'alias', $name)) {
[2370] Fix | Delete
$this->clearcache();
[2371] Fix | Delete
$this->rootName = $this->options['alias'] = $name;
[2372] Fix | Delete
return $this->stat($this->root);
[2373] Fix | Delete
} else {
[2374] Fix | Delete
return $this->setError(elFinder::ERROR_TRGDIR_NOT_FOUND, $name);
[2375] Fix | Delete
}
[2376] Fix | Delete
}
[2377] Fix | Delete
[2378] Fix | Delete
if (!empty($file['locked'])) {
[2379] Fix | Delete
return $this->setError(elFinder::ERROR_LOCKED, $file['name']);
[2380] Fix | Delete
}
[2381] Fix | Delete
[2382] Fix | Delete
$isDir = ($file['mime'] === 'directory');
[2383] Fix | Delete
[2384] Fix | Delete
if (!$this->nameAccepted($name, $isDir)) {
[2385] Fix | Delete
return $this->setError($isDir ? elFinder::ERROR_INVALID_DIRNAME : elFinder::ERROR_INVALID_NAME);
[2386] Fix | Delete
}
[2387] Fix | Delete
[2388] Fix | Delete
if (!$isDir) {
[2389] Fix | Delete
$mimeByName = $this->mimetype($name, true);
[2390] Fix | Delete
if ($mimeByName && !$this->allowPutMime($mimeByName)) {
[2391] Fix | Delete
return $this->setError(elFinder::ERROR_UPLOAD_FILE_MIME, $name);
[2392] Fix | Delete
}
[2393] Fix | Delete
}
[2394] Fix | Delete
[2395] Fix | Delete
$path = $this->decode($hash);
[2396] Fix | Delete
$dir = $this->dirnameCE($path);
[2397] Fix | Delete
$stat = $this->isNameExists($this->joinPathCE($dir, $name));
[2398] Fix | Delete
if ($stat) {
[2399] Fix | Delete
return $this->setError(elFinder::ERROR_EXISTS, $name);
[2400] Fix | Delete
}
[2401] Fix | Delete
[2402] Fix | Delete
if (!$this->allowCreate($dir, $name, ($file['mime'] === 'directory'))) {
[2403] Fix | Delete
return $this->setError(elFinder::ERROR_PERM_DENIED);
[2404] Fix | Delete
}
[2405] Fix | Delete
[2406] Fix | Delete
$this->rmTmb($file); // remove old name tmbs, we cannot do this after dir move
[2407] Fix | Delete
[2408] Fix | Delete
[2409] Fix | Delete
if ($path = $this->convEncOut($this->_move($this->convEncIn($path), $this->convEncIn($dir), $this->convEncIn($name)))) {
[2410] Fix | Delete
$this->clearcache();
[2411] Fix | Delete
return $this->stat($path);
[2412] Fix | Delete
}
[2413] Fix | Delete
return false;
[2414] Fix | Delete
}
[2415] Fix | Delete
[2416] Fix | Delete
/**
[2417] Fix | Delete
* Create file copy with suffix "copy number" and return its info
[2418] Fix | Delete
*
[2419] Fix | Delete
* @param string $hash file hash
[2420] Fix | Delete
* @param string $suffix suffix to add to file name
[2421] Fix | Delete
*
[2422] Fix | Delete
* @return array|false
[2423] Fix | Delete
* @throws elFinderAbortException
[2424] Fix | Delete
* @author Dmitry (dio) Levashov
[2425] Fix | Delete
*/
[2426] Fix | Delete
public function duplicate($hash, $suffix = 'copy')
[2427] Fix | Delete
{
[2428] Fix | Delete
if ($this->commandDisabled('duplicate')) {
[2429] Fix | Delete
return $this->setError(elFinder::ERROR_COPY, '#' . $hash, elFinder::ERROR_PERM_DENIED);
[2430] Fix | Delete
}
[2431] Fix | Delete
[2432] Fix | Delete
if (($file = $this->file($hash)) == false) {
[2433] Fix | Delete
return $this->setError(elFinder::ERROR_COPY, elFinder::ERROR_FILE_NOT_FOUND);
[2434] Fix | Delete
}
[2435] Fix | Delete
[2436] Fix | Delete
$path = $this->decode($hash);
[2437] Fix | Delete
$dir = $this->dirnameCE($path);
[2438] Fix | Delete
$name = $this->uniqueName($dir, $file['name'], sprintf($this->options['duplicateSuffix'], $suffix));
[2439] Fix | Delete
[2440] Fix | Delete
if (!$this->allowCreate($dir, $name, ($file['mime'] === 'directory'))) {
[2441] Fix | Delete
return $this->setError(elFinder::ERROR_PERM_DENIED);
[2442] Fix | Delete
}
[2443] Fix | Delete
[2444] Fix | Delete
return ($path = $this->copy($path, $dir, $name)) == false
[2445] Fix | Delete
? false
[2446] Fix | Delete
: $this->stat($path);
[2447] Fix | Delete
}
[2448] Fix | Delete
[2449] Fix | Delete
/**
[2450] Fix | Delete
* Save uploaded file.
[2451] Fix | Delete
* On success return array with new file stat and with removed file hash (if existed file was replaced)
[2452] Fix | Delete
*
[2453] Fix | Delete
* @param Resource $fp file pointer
[2454] Fix | Delete
* @param string $dst destination folder hash
[2455] Fix | Delete
* @param $name
[2456] Fix | Delete
* @param string $tmpname file tmp name - required to detect mime type
[2457] Fix | Delete
* @param array $hashes exists files hash array with filename as key
[2458] Fix | Delete
*
[2459] Fix | Delete
* @return array|false
[2460] Fix | Delete
* @throws elFinderAbortException
[2461] Fix | Delete
* @internal param string $src file name
[2462] Fix | Delete
* @author Dmitry (dio) Levashov
[2463] Fix | Delete
*/
[2464] Fix | Delete
public function upload($fp, $dst, $name, $tmpname, $hashes = array())
[2465] Fix | Delete
{
[2466] Fix | Delete
if ($this->commandDisabled('upload')) {
[2467] Fix | Delete
return $this->setError(elFinder::ERROR_PERM_DENIED);
[2468] Fix | Delete
}
[2469] Fix | Delete
[2470] Fix | Delete
if (($dir = $this->dir($dst)) == false) {
[2471] Fix | Delete
return $this->setError(elFinder::ERROR_TRGDIR_NOT_FOUND, '#' . $dst);
[2472] Fix | Delete
}
[2473] Fix | Delete
[2474] Fix | Delete
if (empty($dir['write'])) {
[2475] Fix | Delete
return $this->setError(elFinder::ERROR_PERM_DENIED);
[2476] Fix | Delete
}
[2477] Fix | Delete
[2478] Fix | Delete
if (!$this->nameAccepted($name, false)) {
[2479] Fix | Delete
return $this->setError(elFinder::ERROR_INVALID_NAME);
[2480] Fix | Delete
}
[2481] Fix | Delete
[2482] Fix | Delete
$mimeByName = '';
[2483] Fix | Delete
if ($this->mimeDetect === 'internal') {
[2484] Fix | Delete
$mime = $this->mimetype($tmpname, $name);
[2485] Fix | Delete
} else {
[2486] Fix | Delete
$mime = $this->mimetype($tmpname, $name);
[2487] Fix | Delete
$mimeByName = $this->mimetype($name, true);
[2488] Fix | Delete
if ($mime === 'unknown') {
[2489] Fix | Delete
$mime = $mimeByName;
[2490] Fix | Delete
}
[2491] Fix | Delete
}
[2492] Fix | Delete
[2493] Fix | Delete
if (!$this->allowPutMime($mime) || ($mimeByName && !$this->allowPutMime($mimeByName))) {
[2494] Fix | Delete
return $this->setError(elFinder::ERROR_UPLOAD_FILE_MIME, '(' . $mime . ')');
[2495] Fix | Delete
}
[2496] Fix | Delete
[2497] Fix | Delete
$tmpsize = (int)sprintf('%u', filesize($tmpname));
[2498] Fix | Delete
if ($this->uploadMaxSize > 0 && $tmpsize > $this->uploadMaxSize) {
[2499] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function