3 if(
$_SESSION[
'RF'][
"verify"] !=
"RESPONSIVEfilemanager") die(
'forbiden');
6 if (!file_exists(
$dir))
return true;
7 if (!is_dir(
$dir))
return unlink(
$dir);
8 foreach (scandir(
$dir) as $item) {
9 if ($item ==
'.' || $item ==
'..')
continue;
16 if(file_exists($old_path)){
17 $info=pathinfo($old_path);
19 if(file_exists($new_path))
return false;
20 return copy($old_path,$new_path);
26 if(file_exists($old_path)){
27 $info=pathinfo($old_path);
29 if(file_exists($new_path))
return false;
30 return rename($old_path,$new_path);
36 if(file_exists($old_path)){
38 if(file_exists($new_path))
return false;
39 return rename($old_path,$new_path);
45 require_once(
'php_image_magician.php');
46 $magicianObj =
new imageLib($imgfile);
47 $magicianObj -> resizeImage($newwidth, $newheight,
'crop');
48 $magicianObj -> saveImage($imgthumb,80);
54 function create_img($imgfile, $imgthumb, $newwidth, $newheight=
"") {
56 require_once(
'php_image_magician.php');
57 $magicianObj =
new imageLib($imgfile);
58 $magicianObj -> resizeImage($newwidth, $newheight,
'auto');
59 $magicianObj -> saveImage($imgthumb,80);
67 $units = array(
'B',
'KB',
'MB',
'GB',
'TB');
69 while ( (round($size / 1024) > 0) && ($u < 4) ) {
73 return (number_format($size, 0) .
" " . $units[$u]);
79 $cleanPath = rtrim(
$path,
'/').
'/';
82 if ($t !=
"." && $t !=
"..") {
83 $currentFile = $cleanPath . $t;
84 if (is_dir($currentFile)) {
89 $size = filesize($currentFile);
101 $cleanPath = rtrim(
$path,
'/').
'/';
104 if ($t !=
"." && $t !=
"..") {
105 $currentFile = $cleanPath . $t;
106 if (is_dir($currentFile)) {
108 $total_count += $size;
120 $oldumask = umask(0);
122 mkdir(
$path, 0777,
true);
123 if($path_thumbs && !file_exists($path_thumbs))
124 mkdir($path_thumbs, 0777,
true) or die(
"$path_thumbs cannot be found");
130 $fileinfo = pathinfo(
$path);
131 if(!in_array(mb_strtolower($fileinfo[
'extension']),
$ext))
142 foreach( $phar as
$file )
144 if( $file->isFile() )
146 if(in_array(mb_strtolower($file->getExtension()),
$ext))
148 $files[] = $basepath.$file->getFileName( );
151 else if( $file->isDir() )
153 $iterator =
new DirectoryIterator( $file );
160 return strip_tags(preg_replace(
"/[^a-zA-Z0-9\.\[\]_| -]/",
'', $str));
165 if( function_exists(
'transliterator_transliterate' ) )
167 $str = transliterator_transliterate(
'Accents-Any', $str );
171 $str = iconv(
'UTF-8',
'ASCII//TRANSLIT//IGNORE', $str);
174 $str = preg_replace(
"/[^a-zA-Z0-9\.\[\]_| -]/",
'', $str );
177 $str=str_replace(array(
'"',
"'",
"/",
"\\"),
"",$str);
178 $str=strip_tags($str);
183 if( strpos( $str,
'.' ) === 0 )
192 return str_replace(
'~',
' ',dirname(str_replace(
' ',
'~',$str)));
196 if( function_exists(
'mb_strtoupper' ) )
197 return mb_strtoupper($str);
199 return strtoupper($str);
204 if( function_exists(
'mb_strtoupper' ) )
205 return mb_strtolower($str);
207 return strtolower($str);
212 $tmp_path =
$info[
'dirname'];
215 return $tmp_path.DIRECTORY_SEPARATOR.$str;
243 if(file_exists($img)){
245 $memory_usage = memory_get_usage();
246 $memory_limit = abs(intval(str_replace(
'M',
'',ini_get(
'memory_limit'))*1024*1024));
247 $image_properties = getimagesize($img);
248 $image_width = $image_properties[0];
249 $image_height = $image_properties[1];
250 $image_bits = $image_properties[
'bits'];
251 $image_memory_usage = $K64 + ($image_width * $image_height * ($image_bits ) * 2);
252 $thumb_memory_usage = $K64 + ($max_breedte * $max_hoogte * ($image_bits ) * 2);
253 $memory_needed = intval($memory_usage + $image_memory_usage + $thumb_memory_usage);
255 if($memory_needed > $memory_limit){
256 ini_set(
'memory_limit',(intval($memory_needed/1024/1024)+5) .
'M');
257 if(ini_get(
'memory_limit') == (intval($memory_needed/1024/1024)+5) .
'M'){
272 return $needle ===
"" || substr($haystack, -strlen($needle)) === $needle;
275 function new_thumbnails_creation($targetPath,$targetFile,
$name,
$current_path,
$relative_image_creation,
$relative_path_from_current_pos,
$relative_image_creation_name_to_prepend,
$relative_image_creation_name_to_append,
$relative_image_creation_width,
$relative_image_creation_height,
$fixed_image_creation,
$fixed_path_from_filemanager,
$fixed_image_creation_name_to_prepend,
$fixed_image_creation_to_append,
$fixed_image_creation_width,
$fixed_image_creation_height){
281 if (!file_exists($targetPath.$path))
create_folder($targetPath.$path,
false);
306 if (ini_get(
'allow_url_fopen')) {
307 return file_get_contents(
$url);
309 if (!function_exists(
'curl_version')) {
315 curl_setopt($ch, CURLOPT_HEADER, 0);
316 curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
317 curl_setopt($ch, CURLOPT_URL,
$url);
319 $data = curl_exec($ch);
330 return is_writable(
$dir);
335 $dir =
$dir.
'/'.md5(mt_rand(1,1000).mt_rand(1,1000));
337 if (($fp = @fopen(
$dir,
'ab')) === FALSE){
346 elseif ( ! is_file(
$dir) || ($fp = @fopen(
$dir,
'ab')) === FALSE){
362 if (function_exists(
$name) === FALSE)
return FALSE;
363 $disabled = explode(
',', ini_get(
'disable_functions'));
364 return !in_array(
$name, $disabled);
368 function rcopy($source, $destination, $is_rec = FALSE) {
369 if (is_dir($source)) {
370 if ($is_rec === FALSE){
371 $pinfo = pathinfo($source);
372 $destination = rtrim($destination,
'/').DIRECTORY_SEPARATOR.$pinfo[
'basename'];
374 if (is_dir($destination) === FALSE){
375 mkdir($destination, 0777,
true);
378 $files = scandir($source);
380 if ($file !=
"." && $file !=
"..") {
386 if (file_exists($source)){
387 if (is_dir($destination) === TRUE){
388 $pinfo = pathinfo($source);
389 $dest2 = rtrim($destination,
'/').DIRECTORY_SEPARATOR.$pinfo[
'basename'];
392 $dest2 = $destination;
395 copy($source, $dest2);
404 function rrename($source, $destination, $is_rec = FALSE) {
405 if (is_dir($source)) {
406 if ($is_rec === FALSE){
407 $pinfo = pathinfo($source);
408 $destination = rtrim($destination,
'/').DIRECTORY_SEPARATOR.$pinfo[
'basename'];
410 if (is_dir($destination) === FALSE){
411 mkdir($destination, 0777,
true);
414 $files = scandir($source);
416 if ($file !=
"." && $file !=
"..") {
422 if (file_exists($source)){
423 if (is_dir($destination) === TRUE){
424 $pinfo = pathinfo($source);
425 $dest2 = rtrim($destination,
'/').DIRECTORY_SEPARATOR.$pinfo[
'basename'];
428 $dest2 = $destination;
431 rename($source, $dest2);
440 $files = scandir($source);
443 if ($file !=
"." && $file !=
"..") {
444 if (is_dir($source.DIRECTORY_SEPARATOR.$file)){
448 unlink($source.DIRECTORY_SEPARATOR.$file);
453 return rmdir($source);
456 function debugger($input, $trace = FALSE, $halt = FALSE){
459 echo
"<br>----- DEBUG DUMP -----";
465 $debug = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS);
467 echo
"<br>-----STACK TRACE-----";
474 echo
"---------------------------<br>";
476 $ret = ob_get_contents();
$fixed_image_creation_height
$relative_image_creation_name_to_prepend
$_SESSION['RF']["verify"]
$relative_image_creation_height
new_thumbnails_creation($targetPath, $targetFile, $name, $current_path, $relative_image_creation, $relative_path_from_current_pos, $relative_image_creation_name_to_prepend, $relative_image_creation_name_to_append, $relative_image_creation_width, $relative_image_creation_height, $fixed_image_creation, $fixed_path_from_filemanager, $fixed_image_creation_name_to_prepend, $fixed_image_creation_to_append, $fixed_image_creation_width, $fixed_image_creation_height)
image_check_memory_usage($img, $max_breedte, $max_hoogte)
if(!isset($xoops->paths[$path_type])) if($path_type== 'var') $file
create_img_gd($imgfile, $imgthumb, $newwidth, $newheight="")
rename_file($old_path, $name, $transliteration)
config_loading($current_path, $fld)
rcopy($source, $destination, $is_rec=FALSE)
endsWith($haystack, $needle)
$relative_path_from_current_pos
rrename($source, $destination, $is_rec=FALSE)
defined('DS') or define('DS' DIRECTORY_SEPARATOR
is_function_callable($name)
create_folder($path=false, $path_thumbs=false)
rename_folder($old_path, $name, $transliteration)
$relative_image_creation_name_to_append
$fixed_image_creation_name_to_prepend
$fixed_image_creation_to_append
if(isset($_POST['name'])) $info
check_files_extensions_on_path($path, $ext)
$relative_image_creation_width
fix_filename($str, $transliteration)
$fixed_path_from_filemanager
duplicate_file($old_path, $name)
fix_path($path, $transliteration)
check_files_extensions_on_phar($phar, &$files, $basepath, $ext)
$fixed_image_creation_width
debugger($input, $trace=FALSE, $halt=FALSE)
rrename_after_cleaner($source)
create_img($imgfile, $imgthumb, $newwidth, $newheight="")