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
if ($fp = fopen($arc, 'rb')) {
[3000] Fix | Delete
$fstat = stat($arc);
[3001] Fix | Delete
$stat = array(
[3002] Fix | Delete
'size' => $fstat['size'],
[3003] Fix | Delete
'ts' => $fstat['mtime'],
[3004] Fix | Delete
'mime' => $this->mimetype($arc, $name)
[3005] Fix | Delete
);
[3006] Fix | Delete
$path = $this->decode($file0['phash']);
[3007] Fix | Delete
$resPath = $this->saveCE($fp, $path, $name, $stat);
[3008] Fix | Delete
fclose($fp);
[3009] Fix | Delete
}
[3010] Fix | Delete
}
[3011] Fix | Delete
}
[3012] Fix | Delete
$this->rmdirRecursive($dir);
[3013] Fix | Delete
}
[3014] Fix | Delete
return $resPath;
[3015] Fix | Delete
}
[3016] Fix | Delete
[3017] Fix | Delete
/**
[3018] Fix | Delete
* Resize image
[3019] Fix | Delete
*
[3020] Fix | Delete
* @param string $hash image file
[3021] Fix | Delete
* @param int $width new width
[3022] Fix | Delete
* @param int $height new height
[3023] Fix | Delete
* @param int $x X start poistion for crop
[3024] Fix | Delete
* @param int $y Y start poistion for crop
[3025] Fix | Delete
* @param string $mode action how to mainpulate image
[3026] Fix | Delete
* @param string $bg background color
[3027] Fix | Delete
* @param int $degree rotete degree
[3028] Fix | Delete
* @param int $jpgQuality JEPG quality (1-100)
[3029] Fix | Delete
*
[3030] Fix | Delete
* @return array|false
[3031] Fix | Delete
* @throws ImagickException
[3032] Fix | Delete
* @throws elFinderAbortException
[3033] Fix | Delete
* @author Dmitry (dio) Levashov
[3034] Fix | Delete
* @author Alexey Sukhotin
[3035] Fix | Delete
* @author nao-pon
[3036] Fix | Delete
* @author Troex Nevelin
[3037] Fix | Delete
*/
[3038] Fix | Delete
public function resize($hash, $width, $height, $x, $y, $mode = 'resize', $bg = '', $degree = 0, $jpgQuality = null)
[3039] Fix | Delete
{
[3040] Fix | Delete
if ($this->commandDisabled('resize')) {
[3041] Fix | Delete
return $this->setError(elFinder::ERROR_PERM_DENIED);
[3042] Fix | Delete
}
[3043] Fix | Delete
[3044] Fix | Delete
if ($mode === 'rotate' && $degree == 0) {
[3045] Fix | Delete
return array('losslessRotate' => ($this->procExec(ELFINDER_EXIFTRAN_PATH . ' -h') === 0 || $this->procExec(ELFINDER_JPEGTRAN_PATH . ' -version') === 0));
[3046] Fix | Delete
}
[3047] Fix | Delete
[3048] Fix | Delete
if (($file = $this->file($hash)) == false) {
[3049] Fix | Delete
return $this->setError(elFinder::ERROR_FILE_NOT_FOUND);
[3050] Fix | Delete
}
[3051] Fix | Delete
[3052] Fix | Delete
if (!$file['write'] || !$file['read']) {
[3053] Fix | Delete
return $this->setError(elFinder::ERROR_PERM_DENIED);
[3054] Fix | Delete
}
[3055] Fix | Delete
[3056] Fix | Delete
$path = $this->decode($hash);
[3057] Fix | Delete
[3058] Fix | Delete
$work_path = $this->getWorkFile($this->encoding ? $this->convEncIn($path, true) : $path);
[3059] Fix | Delete
[3060] Fix | Delete
if (!$work_path || !is_writable($work_path)) {
[3061] Fix | Delete
if ($work_path && $path !== $work_path && is_file($work_path)) {
[3062] Fix | Delete
unlink($work_path);
[3063] Fix | Delete
}
[3064] Fix | Delete
return $this->setError(elFinder::ERROR_PERM_DENIED);
[3065] Fix | Delete
}
[3066] Fix | Delete
[3067] Fix | Delete
if ($this->imgLib !== 'imagick' && $this->imgLib !== 'convert') {
[3068] Fix | Delete
if (elFinder::isAnimationGif($work_path)) {
[3069] Fix | Delete
return $this->setError(elFinder::ERROR_UNSUPPORT_TYPE);
[3070] Fix | Delete
}
[3071] Fix | Delete
}
[3072] Fix | Delete
[3073] Fix | Delete
if (elFinder::isAnimationPng($work_path)) {
[3074] Fix | Delete
return $this->setError(elFinder::ERROR_UNSUPPORT_TYPE);
[3075] Fix | Delete
}
[3076] Fix | Delete
[3077] Fix | Delete
switch ($mode) {
[3078] Fix | Delete
[3079] Fix | Delete
case 'propresize':
[3080] Fix | Delete
$result = $this->imgResize($work_path, $width, $height, true, true, null, $jpgQuality);
[3081] Fix | Delete
break;
[3082] Fix | Delete
[3083] Fix | Delete
case 'crop':
[3084] Fix | Delete
$result = $this->imgCrop($work_path, $width, $height, $x, $y, null, $jpgQuality);
[3085] Fix | Delete
break;
[3086] Fix | Delete
[3087] Fix | Delete
case 'fitsquare':
[3088] Fix | Delete
$result = $this->imgSquareFit($work_path, $width, $height, 'center', 'middle', ($bg ? $bg : $this->options['tmbBgColor']), null, $jpgQuality);
[3089] Fix | Delete
break;
[3090] Fix | Delete
[3091] Fix | Delete
case 'rotate':
[3092] Fix | Delete
$result = $this->imgRotate($work_path, $degree, ($bg ? $bg : $this->options['bgColorFb']), null, $jpgQuality);
[3093] Fix | Delete
break;
[3094] Fix | Delete
[3095] Fix | Delete
default:
[3096] Fix | Delete
$result = $this->imgResize($work_path, $width, $height, false, true, null, $jpgQuality);
[3097] Fix | Delete
break;
[3098] Fix | Delete
}
[3099] Fix | Delete
[3100] Fix | Delete
$ret = false;
[3101] Fix | Delete
if ($result) {
[3102] Fix | Delete
$this->rmTmb($file);
[3103] Fix | Delete
$this->clearstatcache();
[3104] Fix | Delete
$fstat = stat($work_path);
[3105] Fix | Delete
$imgsize = getimagesize($work_path);
[3106] Fix | Delete
if ($path !== $work_path) {
[3107] Fix | Delete
$file['size'] = $fstat['size'];
[3108] Fix | Delete
$file['ts'] = $fstat['mtime'];
[3109] Fix | Delete
if ($imgsize) {
[3110] Fix | Delete
$file['width'] = $imgsize[0];
[3111] Fix | Delete
$file['height'] = $imgsize[1];
[3112] Fix | Delete
}
[3113] Fix | Delete
if ($fp = fopen($work_path, 'rb')) {
[3114] Fix | Delete
$ret = $this->saveCE($fp, $this->dirnameCE($path), $this->basenameCE($path), $file);
[3115] Fix | Delete
fclose($fp);
[3116] Fix | Delete
}
[3117] Fix | Delete
} else {
[3118] Fix | Delete
$ret = true;
[3119] Fix | Delete
}
[3120] Fix | Delete
if ($ret) {
[3121] Fix | Delete
$this->clearcache();
[3122] Fix | Delete
$ret = $this->stat($path);
[3123] Fix | Delete
if ($imgsize) {
[3124] Fix | Delete
$ret['width'] = $imgsize[0];
[3125] Fix | Delete
$ret['height'] = $imgsize[1];
[3126] Fix | Delete
}
[3127] Fix | Delete
}
[3128] Fix | Delete
}
[3129] Fix | Delete
if ($path !== $work_path) {
[3130] Fix | Delete
is_file($work_path) && unlink($work_path);
[3131] Fix | Delete
}
[3132] Fix | Delete
[3133] Fix | Delete
return $ret;
[3134] Fix | Delete
}
[3135] Fix | Delete
[3136] Fix | Delete
/**
[3137] Fix | Delete
* Remove file/dir
[3138] Fix | Delete
*
[3139] Fix | Delete
* @param string $hash file hash
[3140] Fix | Delete
*
[3141] Fix | Delete
* @return bool
[3142] Fix | Delete
* @throws elFinderAbortException
[3143] Fix | Delete
* @author Dmitry (dio) Levashov
[3144] Fix | Delete
*/
[3145] Fix | Delete
public function rm($hash)
[3146] Fix | Delete
{
[3147] Fix | Delete
return $this->commandDisabled('rm')
[3148] Fix | Delete
? $this->setError(elFinder::ERROR_PERM_DENIED)
[3149] Fix | Delete
: $this->remove($this->decode($hash));
[3150] Fix | Delete
}
[3151] Fix | Delete
[3152] Fix | Delete
/**
[3153] Fix | Delete
* Search files
[3154] Fix | Delete
*
[3155] Fix | Delete
* @param string $q search string
[3156] Fix | Delete
* @param array $mimes
[3157] Fix | Delete
* @param null $hash
[3158] Fix | Delete
*
[3159] Fix | Delete
* @return array
[3160] Fix | Delete
* @throws elFinderAbortException
[3161] Fix | Delete
* @author Dmitry (dio) Levashov
[3162] Fix | Delete
*/
[3163] Fix | Delete
public function search($q, $mimes, $hash = null)
[3164] Fix | Delete
{
[3165] Fix | Delete
$res = array();
[3166] Fix | Delete
$matchMethod = null;
[3167] Fix | Delete
$args = func_get_args();
[3168] Fix | Delete
if (!empty($args[3])) {
[3169] Fix | Delete
$matchMethod = 'searchMatch' . $args[3];
[3170] Fix | Delete
if (!is_callable(array($this, $matchMethod))) {
[3171] Fix | Delete
return array();
[3172] Fix | Delete
}
[3173] Fix | Delete
}
[3174] Fix | Delete
[3175] Fix | Delete
$dir = null;
[3176] Fix | Delete
if ($hash) {
[3177] Fix | Delete
$dir = $this->decode($hash);
[3178] Fix | Delete
$stat = $this->stat($dir);
[3179] Fix | Delete
if (!$stat || $stat['mime'] !== 'directory' || !$stat['read']) {
[3180] Fix | Delete
$q = '';
[3181] Fix | Delete
}
[3182] Fix | Delete
}
[3183] Fix | Delete
if ($mimes && $this->onlyMimes) {
[3184] Fix | Delete
$mimes = array_intersect($mimes, $this->onlyMimes);
[3185] Fix | Delete
if (!$mimes) {
[3186] Fix | Delete
$q = '';
[3187] Fix | Delete
}
[3188] Fix | Delete
}
[3189] Fix | Delete
$this->searchStart = time();
[3190] Fix | Delete
[3191] Fix | Delete
$qs = preg_split('/"([^"]+)"| +/', $q, -1, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE);
[3192] Fix | Delete
$query = $excludes = array();
[3193] Fix | Delete
foreach ($qs as $_q) {
[3194] Fix | Delete
$_q = trim($_q);
[3195] Fix | Delete
if ($_q !== '') {
[3196] Fix | Delete
if ($_q[0] === '-') {
[3197] Fix | Delete
if (isset($_q[1])) {
[3198] Fix | Delete
$excludes[] = substr($_q, 1);
[3199] Fix | Delete
}
[3200] Fix | Delete
} else {
[3201] Fix | Delete
$query[] = $_q;
[3202] Fix | Delete
}
[3203] Fix | Delete
}
[3204] Fix | Delete
}
[3205] Fix | Delete
if (!$query) {
[3206] Fix | Delete
$q = '';
[3207] Fix | Delete
} else {
[3208] Fix | Delete
$q = join(' ', $query);
[3209] Fix | Delete
$this->doSearchCurrentQuery = array(
[3210] Fix | Delete
'q' => $q,
[3211] Fix | Delete
'excludes' => $excludes,
[3212] Fix | Delete
'matchMethod' => $matchMethod
[3213] Fix | Delete
);
[3214] Fix | Delete
}
[3215] Fix | Delete
[3216] Fix | Delete
if ($q === '' || $this->commandDisabled('search')) {
[3217] Fix | Delete
return $res;
[3218] Fix | Delete
}
[3219] Fix | Delete
[3220] Fix | Delete
// valided regex $this->options['searchExDirReg']
[3221] Fix | Delete
if ($this->options['searchExDirReg']) {
[3222] Fix | Delete
if (false === preg_match($this->options['searchExDirReg'], '')) {
[3223] Fix | Delete
$this->options['searchExDirReg'] = '';
[3224] Fix | Delete
}
[3225] Fix | Delete
}
[3226] Fix | Delete
[3227] Fix | Delete
// check the leaf root too
[3228] Fix | Delete
if (!$mimes && (is_null($dir) || $dir == $this->root)) {
[3229] Fix | Delete
$rootStat = $this->stat($this->root);
[3230] Fix | Delete
if (!empty($rootStat['phash'])) {
[3231] Fix | Delete
if ($this->stripos($rootStat['name'], $q) !== false) {
[3232] Fix | Delete
$res = array($rootStat);
[3233] Fix | Delete
}
[3234] Fix | Delete
}
[3235] Fix | Delete
}
[3236] Fix | Delete
[3237] Fix | Delete
return array_merge($res, $this->doSearch(is_null($dir) ? $this->root : $dir, $q, $mimes));
[3238] Fix | Delete
}
[3239] Fix | Delete
[3240] Fix | Delete
/**
[3241] Fix | Delete
* Return image dimensions
[3242] Fix | Delete
*
[3243] Fix | Delete
* @param string $hash file hash
[3244] Fix | Delete
*
[3245] Fix | Delete
* @return array|string
[3246] Fix | Delete
* @author Dmitry (dio) Levashov
[3247] Fix | Delete
**/
[3248] Fix | Delete
public function dimensions($hash)
[3249] Fix | Delete
{
[3250] Fix | Delete
if (($file = $this->file($hash)) == false) {
[3251] Fix | Delete
return false;
[3252] Fix | Delete
}
[3253] Fix | Delete
// Throw additional parameters for some drivers
[3254] Fix | Delete
if (func_num_args() > 1) {
[3255] Fix | Delete
$args = func_get_arg(1);
[3256] Fix | Delete
} else {
[3257] Fix | Delete
$args = array();
[3258] Fix | Delete
}
[3259] Fix | Delete
return $this->convEncOut($this->_dimensions($this->convEncIn($this->decode($hash)), $file['mime'], $args));
[3260] Fix | Delete
}
[3261] Fix | Delete
[3262] Fix | Delete
/**
[3263] Fix | Delete
* Return has subdirs
[3264] Fix | Delete
*
[3265] Fix | Delete
* @param string $hash file hash
[3266] Fix | Delete
*
[3267] Fix | Delete
* @return bool
[3268] Fix | Delete
* @author Naoki Sawada
[3269] Fix | Delete
**/
[3270] Fix | Delete
public function subdirs($hash)
[3271] Fix | Delete
{
[3272] Fix | Delete
return (bool)$this->subdirsCE($this->decode($hash));
[3273] Fix | Delete
}
[3274] Fix | Delete
[3275] Fix | Delete
/**
[3276] Fix | Delete
* Return content URL (for netmout volume driver)
[3277] Fix | Delete
* If file.url == 1 requests from JavaScript client with XHR
[3278] Fix | Delete
*
[3279] Fix | Delete
* @param string $hash file hash
[3280] Fix | Delete
* @param array $options options array
[3281] Fix | Delete
*
[3282] Fix | Delete
* @return boolean|string
[3283] Fix | Delete
* @author Naoki Sawada
[3284] Fix | Delete
*/
[3285] Fix | Delete
public function getContentUrl($hash, $options = array())
[3286] Fix | Delete
{
[3287] Fix | Delete
if (($file = $this->file($hash)) === false) {
[3288] Fix | Delete
return false;
[3289] Fix | Delete
}
[3290] Fix | Delete
if (!empty($options['onetime']) && $this->options['onetimeUrl']) {
[3291] Fix | Delete
if (is_callable($this->options['onetimeUrl'])) {
[3292] Fix | Delete
return call_user_func_array($this->options['onetimeUrl'], array($file, $options, $this));
[3293] Fix | Delete
} else {
[3294] Fix | Delete
$ret = false;
[3295] Fix | Delete
if ($tmpdir = elFinder::getStaticVar('commonTempPath')) {
[3296] Fix | Delete
if ($source = $this->open($hash)) {
[3297] Fix | Delete
if ($_dat = tempnam($tmpdir, 'ELF')) {
[3298] Fix | Delete
$token = md5($_dat . session_id());
[3299] Fix | Delete
$dat = $tmpdir . DIRECTORY_SEPARATOR . 'ELF' . $token;
[3300] Fix | Delete
if (rename($_dat, $dat)) {
[3301] Fix | Delete
$info = stream_get_meta_data($source);
[3302] Fix | Delete
if (!empty($info['uri'])) {
[3303] Fix | Delete
$tmp = $info['uri'];
[3304] Fix | Delete
} else {
[3305] Fix | Delete
$tmp = tempnam($tmpdir, 'ELF');
[3306] Fix | Delete
if ($dest = fopen($tmp, 'wb')) {
[3307] Fix | Delete
if (!stream_copy_to_stream($source, $dest)) {
[3308] Fix | Delete
$tmp = false;
[3309] Fix | Delete
}
[3310] Fix | Delete
fclose($dest);
[3311] Fix | Delete
}
[3312] Fix | Delete
}
[3313] Fix | Delete
$this->close($source, $hash);
[3314] Fix | Delete
if ($tmp) {
[3315] Fix | Delete
$info = array(
[3316] Fix | Delete
'file' => base64_encode($tmp),
[3317] Fix | Delete
'name' => $file['name'],
[3318] Fix | Delete
'mime' => $file['mime'],
[3319] Fix | Delete
'ts' => $file['ts']
[3320] Fix | Delete
);
[3321] Fix | Delete
if (file_put_contents($dat, json_encode($info))) {
[3322] Fix | Delete
$conUrl = elFinder::getConnectorUrl();
[3323] Fix | Delete
$ret = $conUrl . (strpos($conUrl, '?') !== false? '&' : '?') . 'cmd=file&onetime=1&target=' . $token;
[3324] Fix | Delete
[3325] Fix | Delete
}
[3326] Fix | Delete
}
[3327] Fix | Delete
if (!$ret) {
[3328] Fix | Delete
unlink($dat);
[3329] Fix | Delete
}
[3330] Fix | Delete
} else {
[3331] Fix | Delete
unlink($_dat);
[3332] Fix | Delete
}
[3333] Fix | Delete
}
[3334] Fix | Delete
}
[3335] Fix | Delete
}
[3336] Fix | Delete
return $ret;
[3337] Fix | Delete
}
[3338] Fix | Delete
}
[3339] Fix | Delete
if (empty($file['url']) && $this->URL) {
[3340] Fix | Delete
$path = str_replace($this->separator, '/', substr($this->decode($hash), strlen(rtrim($this->root, '/' . $this->separator)) + 1));
[3341] Fix | Delete
if ($this->encoding) {
[3342] Fix | Delete
$path = $this->convEncIn($path, true);
[3343] Fix | Delete
}
[3344] Fix | Delete
$path = str_replace('%2F', '/', rawurlencode($path));
[3345] Fix | Delete
return $this->URL . $path;
[3346] Fix | Delete
} else {
[3347] Fix | Delete
$ret = false;
[3348] Fix | Delete
if (!empty($file['url']) && $file['url'] != 1) {
[3349] Fix | Delete
return $file['url'];
[3350] Fix | Delete
} else if (!empty($options['temporary']) && ($tempInfo = $this->getTempLinkInfo('temp_' . md5($hash . session_id())))) {
[3351] Fix | Delete
if (is_readable($tempInfo['path'])) {
[3352] Fix | Delete
touch($tempInfo['path']);
[3353] Fix | Delete
$ret = $tempInfo['url'] . '?' . rawurlencode($file['name']);
[3354] Fix | Delete
} else if ($source = $this->open($hash)) {
[3355] Fix | Delete
if ($dest = fopen($tempInfo['path'], 'wb')) {
[3356] Fix | Delete
if (stream_copy_to_stream($source, $dest)) {
[3357] Fix | Delete
$ret = $tempInfo['url'] . '?' . rawurlencode($file['name']);
[3358] Fix | Delete
}
[3359] Fix | Delete
fclose($dest);
[3360] Fix | Delete
}
[3361] Fix | Delete
$this->close($source, $hash);
[3362] Fix | Delete
}
[3363] Fix | Delete
}
[3364] Fix | Delete
return $ret;
[3365] Fix | Delete
}
[3366] Fix | Delete
}
[3367] Fix | Delete
[3368] Fix | Delete
/**
[3369] Fix | Delete
* Get temporary contents link infomation
[3370] Fix | Delete
*
[3371] Fix | Delete
* @param string $name
[3372] Fix | Delete
*
[3373] Fix | Delete
* @return boolean|array
[3374] Fix | Delete
* @author Naoki Sawada
[3375] Fix | Delete
*/
[3376] Fix | Delete
public function getTempLinkInfo($name = null)
[3377] Fix | Delete
{
[3378] Fix | Delete
if ($this->tmpLinkPath) {
[3379] Fix | Delete
if (!$name) {
[3380] Fix | Delete
$name = 'temp_' . md5($_SERVER['REMOTE_ADDR'] . (string)microtime(true));
[3381] Fix | Delete
} else if (substr($name, 0, 5) !== 'temp_') {
[3382] Fix | Delete
$name = 'temp_' . $name;
[3383] Fix | Delete
}
[3384] Fix | Delete
register_shutdown_function(array('elFinder', 'GlobGC'), $this->tmpLinkPath . DIRECTORY_SEPARATOR . 'temp_*', elFinder::$tmpLinkLifeTime);
[3385] Fix | Delete
return array(
[3386] Fix | Delete
'path' => $path = $this->tmpLinkPath . DIRECTORY_SEPARATOR . $name,
[3387] Fix | Delete
'url' => $this->tmpLinkUrl . '/' . rawurlencode($name)
[3388] Fix | Delete
);
[3389] Fix | Delete
}
[3390] Fix | Delete
return false;
[3391] Fix | Delete
}
[3392] Fix | Delete
[3393] Fix | Delete
/**
[3394] Fix | Delete
* Get URL of substitute image by request args `substitute` or 4th argument $maxSize
[3395] Fix | Delete
*
[3396] Fix | Delete
* @param string $target Target hash
[3397] Fix | Delete
* @param array $srcSize Size info array [width, height]
[3398] Fix | Delete
* @param resource $srcfp Source file file pointer
[3399] Fix | Delete
* @param integer $maxSize Maximum pixel of substitute image
[3400] Fix | Delete
*
[3401] Fix | Delete
* @return boolean
[3402] Fix | Delete
* @throws ImagickException
[3403] Fix | Delete
* @throws elFinderAbortException
[3404] Fix | Delete
*/
[3405] Fix | Delete
public function getSubstituteImgLink($target, $srcSize, $srcfp = null, $maxSize = null)
[3406] Fix | Delete
{
[3407] Fix | Delete
$url = false;
[3408] Fix | Delete
$file = $this->file($target);
[3409] Fix | Delete
$force = !in_array($file['mime'], array('image/jpeg', 'image/png', 'image/gif'));
[3410] Fix | Delete
if (!$maxSize) {
[3411] Fix | Delete
$args = elFinder::$currentArgs;
[3412] Fix | Delete
if (!empty($args['substitute'])) {
[3413] Fix | Delete
$maxSize = $args['substitute'];
[3414] Fix | Delete
}
[3415] Fix | Delete
}
[3416] Fix | Delete
if ($maxSize && $srcSize[0] && $srcSize[1]) {
[3417] Fix | Delete
if ($this->getOption('substituteImg')) {
[3418] Fix | Delete
$maxSize = intval($maxSize);
[3419] Fix | Delete
$zoom = min(($maxSize / $srcSize[0]), ($maxSize / $srcSize[1]));
[3420] Fix | Delete
if ($force || $zoom < 1) {
[3421] Fix | Delete
$width = round($srcSize[0] * $zoom);
[3422] Fix | Delete
$height = round($srcSize[1] * $zoom);
[3423] Fix | Delete
$jpgQuality = 50;
[3424] Fix | Delete
$preserveExif = false;
[3425] Fix | Delete
$unenlarge = true;
[3426] Fix | Delete
$checkAnimated = true;
[3427] Fix | Delete
$destformat = $file['mime'] === 'image/jpeg'? null : 'png';
[3428] Fix | Delete
if (!$srcfp) {
[3429] Fix | Delete
elFinder::checkAborted();
[3430] Fix | Delete
$srcfp = $this->open($target);
[3431] Fix | Delete
}
[3432] Fix | Delete
if ($srcfp && ($tempLink = $this->getTempLinkInfo())) {
[3433] Fix | Delete
elFinder::checkAborted();
[3434] Fix | Delete
$dest = fopen($tempLink['path'], 'wb');
[3435] Fix | Delete
if ($dest && stream_copy_to_stream($srcfp, $dest)) {
[3436] Fix | Delete
fclose($dest);
[3437] Fix | Delete
if ($this->imageUtil('resize', $tempLink['path'], compact('width', 'height', 'jpgQuality', 'preserveExif', 'unenlarge', 'checkAnimated', 'destformat'))) {
[3438] Fix | Delete
$url = $tempLink['url'];
[3439] Fix | Delete
// set expire to 1 min left
[3440] Fix | Delete
touch($tempLink['path'], time() - elFinder::$tmpLinkLifeTime + 60);
[3441] Fix | Delete
} else {
[3442] Fix | Delete
unlink($tempLink['path']);
[3443] Fix | Delete
}
[3444] Fix | Delete
}
[3445] Fix | Delete
$this->close($srcfp, $target);
[3446] Fix | Delete
}
[3447] Fix | Delete
}
[3448] Fix | Delete
}
[3449] Fix | Delete
}
[3450] Fix | Delete
[3451] Fix | Delete
return $url;
[3452] Fix | Delete
}
[3453] Fix | Delete
[3454] Fix | Delete
/**
[3455] Fix | Delete
* Return temp path
[3456] Fix | Delete
*
[3457] Fix | Delete
* @return string
[3458] Fix | Delete
* @author Naoki Sawada
[3459] Fix | Delete
*/
[3460] Fix | Delete
public function getTempPath()
[3461] Fix | Delete
{
[3462] Fix | Delete
$tempPath = null;
[3463] Fix | Delete
if (isset($this->tmpPath) && $this->tmpPath && is_writable($this->tmpPath)) {
[3464] Fix | Delete
$tempPath = $this->tmpPath;
[3465] Fix | Delete
} else if (isset($this->tmp) && $this->tmp && is_writable($this->tmp)) {
[3466] Fix | Delete
$tempPath = $this->tmp;
[3467] Fix | Delete
} else if (elFinder::getStaticVar('commonTempPath') && is_writable(elFinder::getStaticVar('commonTempPath'))) {
[3468] Fix | Delete
$tempPath = elFinder::getStaticVar('commonTempPath');
[3469] Fix | Delete
} else if (function_exists('sys_get_temp_dir')) {
[3470] Fix | Delete
$tempPath = sys_get_temp_dir();
[3471] Fix | Delete
} else if ($this->tmbPathWritable) {
[3472] Fix | Delete
$tempPath = $this->tmbPath;
[3473] Fix | Delete
}
[3474] Fix | Delete
if ($tempPath && DIRECTORY_SEPARATOR !== '/') {
[3475] Fix | Delete
$tempPath = str_replace('/', DIRECTORY_SEPARATOR, $tempPath);
[3476] Fix | Delete
}
[3477] Fix | Delete
if(opendir($tempPath)){
[3478] Fix | Delete
return $tempPath;
[3479] Fix | Delete
} else if (defined( 'WP_TEMP_DIR' )) {
[3480] Fix | Delete
return get_temp_dir();
[3481] Fix | Delete
} else {
[3482] Fix | Delete
$custom_temp_path = WP_CONTENT_DIR.'/temp';
[3483] Fix | Delete
if (!is_dir($custom_temp_path)) {
[3484] Fix | Delete
mkdir($custom_temp_path, 0777, true);
[3485] Fix | Delete
}
[3486] Fix | Delete
return $custom_temp_path;
[3487] Fix | Delete
}
[3488] Fix | Delete
}
[3489] Fix | Delete
[3490] Fix | Delete
/**
[3491] Fix | Delete
* (Make &) Get upload taget dirctory hash
[3492] Fix | Delete
*
[3493] Fix | Delete
* @param string $baseTargetHash
[3494] Fix | Delete
* @param string $path
[3495] Fix | Delete
* @param array $result
[3496] Fix | Delete
*
[3497] Fix | Delete
* @return boolean|string
[3498] Fix | Delete
* @author Naoki Sawada
[3499] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function