Tools::safeOutput($_GET['type']),
'lang' => Tools::safeOutput($lang),
'popup' => $popup,
'field_id' => isset($_GET['field_id']) ? (int)$_GET['field_id'] : '',
'fldr' => ''
)
);
?>
$file)
{
if ($file == ".") $current_folder = array('file' => $file);
elseif ($file == "..") $prev_folder = array('file' => $file);
elseif (is_dir($current_path.$subfolder.$subdir.$file))
{
$date = filemtime($current_path.$subfolder.$subdir.$file);
$size = foldersize($current_path.$subfolder.$subdir.$file);
$file_ext = lang_Type_dir;
$sorted[$k] = array('file' => $file, 'date' => $date, 'size' => $size, 'extension' => $file_ext);
} else
{
$file_path = $current_path.$subfolder.$subdir.$file;
$date = filemtime($file_path);
$size = filesize($file_path);
$file_ext = substr(strrchr($file, '.'), 1);
$sorted[$k] = array('file' => $file, 'date' => $date, 'size' => $size, 'extension' => $file_ext);
}
}
function filenameSort($x, $y)
{
return $x['file'] < $y['file'];
}
function dateSort($x, $y)
{
return $x['date'] < $y['date'];
}
function sizeSort($x, $y)
{
return $x['size'] - $y['size'];
}
function extensionSort($x, $y)
{
return $x['extension'] < $y['extension'];
}
switch ($sort_by)
{
case 'name':
usort($sorted, 'filenameSort');
break;
case 'date':
usort($sorted, 'dateSort');
break;
case 'size':
usort($sorted, 'sizeSort');
break;
case 'extension':
usort($sorted, 'extensionSort');
break;
default:
break;
}
if ($descending)
{
$sorted = array_reverse($sorted);
}
$files = array_merge(array($prev_folder), array($current_folder), $sorted);
?>
- /
$b)
{
$tmp_path .= $b."/";
if ($k == count($bc) - 2)
{
?>
-
-
">
-
There is an error! The upload folder there isn't. Check your config.php file.
">
- >
$file_array) {
$file = $file_array['file'];
if ($file == '.' || $file == '..' || is_dir($current_path.$subfolder.$subdir.$file) || in_array($file, $hidden_files) || !in_array(fix_strtolower($file_array['extension']), $ext) || ($filter != '' && strpos($file, $filter) === false))
continue;
$file_path = $current_path.$subfolder.$subdir.$file;
//check if file have illegal caracter
$filename = substr($file, 0, '-'.(strlen($file_array['extension']) + 1));
if ($file != fix_filename($file, $transliteration))
{
$file1 = fix_filename($file, $transliteration);
$file_path1 = ($current_path.$subfolder.$subdir.$file1);
if (file_exists($file_path1))
{
$i = 1;
$info = pathinfo($file1);
while (file_exists($current_path.$subfolder.$subdir.$info['filename'].".[".$i."].".$info['extension']))
{
$i++;
}
$file1 = $info['filename'].".[".$i."].".$info['extension'];
$file_path1 = ($current_path.$subfolder.$subdir.$file1);
}
$filename = substr($file1, 0, '-'.(strlen($file_array['extension']) + 1));
rename_file($file_path, fix_filename($filename, $transliteration), $transliteration);
$file = $file1;
$file_array['extension'] = fix_filename($file_array['extension'], $transliteration);
$file_path = $file_path1;
}
$is_img = false;
$is_video = false;
$is_audio = false;
$show_original = false;
$show_original_mini = false;
$mini_src = "";
$src_thumb = "";
$extension_lower = fix_strtolower($file_array['extension']);
if (in_array($extension_lower, $ext_img))
{
$src = $base_url.$cur_dir.rawurlencode($file);
$mini_src = $src_thumb = $thumbs_path.$subdir.$file;
if (strpos($src_thumb, _PS_ROOT_DIR_) === 0)
$mini = $thumb = __PS_BASE_URI__.substr($thumbs_path.$subdir.$file, strlen(_PS_ROOT_DIR_) + 1);
//add in thumbs folder if not exist
if (!file_exists($src_thumb))
{
try
{
create_img_gd($file_path, $src_thumb, 122, 91);
new_thumbnails_creation($current_path.$subfolder.$subdir, $file_path, $file, $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);
} catch (Exception $e)
{
$src_thumb = $mini_src = "";
}
}
$is_img = true;
//check if is smaller than thumb
list($img_width, $img_height, $img_type, $attr) = getimagesize($file_path);
if ($img_width < 122 && $img_height < 91)
{
$src_thumb = $current_path.$subfolder.$subdir.$file;
$show_original = true;
}
if ($img_width < 45 && $img_height < 38)
{
$mini_src = $current_path.$subfolder.$subdir.$file;
$show_original_mini = true;
}
}
$is_icon_thumb = false;
$is_icon_thumb_mini = false;
$no_thumb = false;
if ($src_thumb == "")
{
$no_thumb = true;
if (file_exists('img/'.$icon_theme.'/'.$extension_lower.".jpg"))
{
$src_thumb = 'img/'.$icon_theme.'/'.$extension_lower.".jpg";
} else
{
$src_thumb = "img/".$icon_theme."/default.jpg";
}
$is_icon_thumb = true;
}
if ($mini_src == "")
{
$is_icon_thumb_mini = false;
}
$class_ext = 0;
if (in_array($extension_lower, $ext_video))
{
$class_ext = 4;
$is_video = true;
} elseif (in_array($extension_lower, $ext_img))
{
$class_ext = 2;
} elseif (in_array($extension_lower, $ext_music))
{
$class_ext = 5;
$is_audio = true;
} elseif (in_array($extension_lower, $ext_misc))
{
$class_ext = 3;
} else
{
$class_ext = 1;
}
if ((!(Tools::getValue('type') == 1 && !$is_img) && !((Tools::getValue('type') == 3 && !$is_video) && (Tools::getValue('type') == 3 && !$is_audio))) && $class_ext > 0){
?>
-