diff --git a/adm/filemanager/LICENSE b/adm/filemanager/LICENSE
new file mode 100644
index 00000000..92482346
--- /dev/null
+++ b/adm/filemanager/LICENSE
@@ -0,0 +1 @@
+This work is licensed under the Creative Commons Attribution-NonCommercial 3.0 Unported License. To view a copy of this license, visit http://creativecommons.org/licenses/by-nc/3.0/ or send a letter to Creative Commons, 444 Castro Street, Suite 900, Mountain View, California, 94041, USA.
diff --git a/adm/filemanager/ajax_calls.php b/adm/filemanager/ajax_calls.php
index 2bfd1045..e571d3fa 100755
--- a/adm/filemanager/ajax_calls.php
+++ b/adm/filemanager/ajax_calls.php
@@ -2,132 +2,131 @@
include('config/config.php');
-if ($_SESSION['verify'] != 'RESPONSIVEfilemanager')
- die('forbiden');
+if ($_SESSION['verify'] != 'RESPONSIVEfilemanager') {
+ die('forbiden');
+}
include('include/utils.php');
-if (isset($_GET['action']))
- switch ($_GET['action'])
- {
- case 'view':
- if (isset($_GET['type']))
- $_SESSION['view_type'] = $_GET['type'];
- else
- die('view type number missing');
- break;
- case 'sort':
- if (isset($_GET['sort_by']))
- $_SESSION['sort_by'] = $_GET['sort_by'];
- if (isset($_GET['descending']))
- $_SESSION['descending'] = $_GET['descending'] === 'true';
- break;
- case 'image_size':
- if (realpath(dirname(_PS_ROOT_DIR_.$_POST['path'])) != realpath(_PS_ROOT_DIR_.$upload_dir))
- die();
- $pos = strpos($_POST['path'], $upload_dir);
- if ($pos !== false)
- {
- $info = getimagesize(substr_replace($_POST['path'], $current_path, $pos, strlen($upload_dir)));
- echo json_encode($info);
- }
+if (isset($_GET['action'])) {
+ switch ($_GET['action']) {
+ case 'view':
+ if (isset($_GET['type'])) {
+ $_SESSION['view_type'] = $_GET['type'];
+ } else {
+ die('view type number missing');
+ }
+ break;
+ case 'sort':
+ if (isset($_GET['sort_by'])) {
+ $_SESSION['sort_by'] = $_GET['sort_by'];
+ }
+ if (isset($_GET['descending'])) {
+ $_SESSION['descending'] = $_GET['descending'] === 'true';
+ }
+ break;
+ case 'image_size':
+ if (realpath(dirname(_PS_ROOT_DIR_.$_POST['path'])) != realpath(_PS_ROOT_DIR_.$upload_dir)) {
+ die();
+ }
+ $pos = strpos($_POST['path'], $upload_dir);
+ if ($pos !== false) {
+ $info = getimagesize(substr_replace($_POST['path'], $current_path, $pos, strlen($upload_dir)));
+ echo json_encode($info);
+ }
- break;
- case 'save_img':
- $info = pathinfo($_POST['name']);
- if (strpos($_POST['path'], '/') === 0
- || strpos($_POST['path'], '../') !== false
- || strpos($_POST['path'], './') === 0
- || strpos($_POST['url'], 'http://featherfiles.aviary.com/') !== 0
- || $_POST['name'] != fix_filename($_POST['name'], $transliteration)
- || !in_array(strtolower($info['extension']), array('jpg', 'jpeg', 'png'))
- )
- die('wrong data');
- $image_data = get_file_by_url($_POST['url']);
- if ($image_data === false)
- {
- die('file could not be loaded');
- }
+ break;
+ case 'save_img':
+ $info = pathinfo($_POST['name']);
+ if (strpos($_POST['path'], '/') === 0
+ || strpos($_POST['path'], '../') !== false
+ || strpos($_POST['path'], './') === 0
+ || strpos($_POST['url'], 'http://featherfiles.aviary.com/') !== 0
+ || $_POST['name'] != fix_filename($_POST['name'], $transliteration)
+ || !in_array(strtolower($info['extension']), array('jpg', 'jpeg', 'png'))
+ ) {
+ die('wrong data');
+ }
+ $image_data = get_file_by_url($_POST['url']);
+ if ($image_data === false) {
+ die('file could not be loaded');
+ }
- $put_contents_path = $current_path;
+ $put_contents_path = $current_path;
- if (isset($_POST['path']))
- $put_contents_path .= str_replace("\0", "", $_POST['path']);
+ if (isset($_POST['path'])) {
+ $put_contents_path .= str_replace("\0", "", $_POST['path']);
+ }
- if (isset($_POST['name']))
- $put_contents_path .= str_replace("\0", "", $_POST['name']);
-
- file_put_contents($put_contents_path, $image_data);
- //new thumb creation
- //try{
- create_img_gd($current_path.$_POST['path'].$_POST['name'], $thumbs_base_path.$_POST['path'].$_POST['name'], 122, 91);
- new_thumbnails_creation($current_path.$_POST['path'], $current_path.$_POST['path'].$_POST['name'], $_POST['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);
- /*} catch (Exception $e) {
- $src_thumb=$mini_src="";
- }*/
- break;
- case 'extract':
- if (strpos($_POST['path'], '/') === 0 || strpos($_POST['path'], '../') !== false || strpos($_POST['path'], './') === 0)
- die('wrong path');
- $path = $current_path.$_POST['path'];
- $info = pathinfo($path);
- $base_folder = $current_path.fix_dirname($_POST['path']).'/';
- switch ($info['extension'])
- {
- case 'zip':
- $zip = new ZipArchive;
- if ($zip->open($path) === true)
- {
- //make all the folders
- for ($i = 0; $i < $zip->numFiles; $i++)
- {
- $OnlyFileName = $zip->getNameIndex($i);
- $FullFileName = $zip->statIndex($i);
- if ($FullFileName['name'][strlen($FullFileName['name']) - 1] == '/')
- {
- create_folder($base_folder.$FullFileName['name']);
- }
- }
- //unzip into the folders
- for ($i = 0; $i < $zip->numFiles; $i++)
- {
- $OnlyFileName = $zip->getNameIndex($i);
- $FullFileName = $zip->statIndex($i);
+ if (isset($_POST['name'])) {
+ $put_contents_path .= str_replace("\0", "", $_POST['name']);
+ }
- if (!($FullFileName['name'][strlen($FullFileName['name']) - 1] == '/'))
- {
- $fileinfo = pathinfo($OnlyFileName);
- if (in_array(strtolower($fileinfo['extension']), $ext))
- {
- copy('zip://'.$path.'#'.$OnlyFileName, $base_folder.$FullFileName['name']);
- }
- }
- }
- $zip->close();
- }
- else
- echo 'failed to open file';
- break;
- case 'gz':
- $p = new PharData($path);
- $p->decompress(); // creates files.tar
- break;
- case 'tar':
- // unarchive from the tar
- $phar = new PharData($path);
- $phar->decompressFiles();
- $files = array();
- check_files_extensions_on_phar($phar, $files, '', $ext);
- $phar->extractTo($current_path.fix_dirname($_POST['path']).'/', $files, true);
+ file_put_contents($put_contents_path, $image_data);
+ //new thumb creation
+ //try{
+ create_img_gd($current_path.$_POST['path'].$_POST['name'], $thumbs_base_path.$_POST['path'].$_POST['name'], 122, 91);
+ new_thumbnails_creation($current_path.$_POST['path'], $current_path.$_POST['path'].$_POST['name'], $_POST['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);
+ /*} catch (Exception $e) {
+ $src_thumb=$mini_src="";
+ }*/
+ break;
+ case 'extract':
+ if (strpos($_POST['path'], '/') === 0 || strpos($_POST['path'], '../') !== false || strpos($_POST['path'], './') === 0) {
+ die('wrong path');
+ }
+ $path = $current_path.$_POST['path'];
+ $info = pathinfo($path);
+ $base_folder = $current_path.fix_dirname($_POST['path']).'/';
+ switch ($info['extension']) {
+ case 'zip':
+ $zip = new ZipArchive;
+ if ($zip->open($path) === true) {
+ //make all the folders
+ for ($i = 0; $i < $zip->numFiles; $i++) {
+ $OnlyFileName = $zip->getNameIndex($i);
+ $FullFileName = $zip->statIndex($i);
+ if ($FullFileName['name'][strlen($FullFileName['name']) - 1] == '/') {
+ create_folder($base_folder.$FullFileName['name']);
+ }
+ }
+ //unzip into the folders
+ for ($i = 0; $i < $zip->numFiles; $i++) {
+ $OnlyFileName = $zip->getNameIndex($i);
+ $FullFileName = $zip->statIndex($i);
- break;
- }
- break;
- case 'media_preview':
+ if (!($FullFileName['name'][strlen($FullFileName['name']) - 1] == '/')) {
+ $fileinfo = pathinfo($OnlyFileName);
+ if (in_array(strtolower($fileinfo['extension']), $ext)) {
+ copy('zip://'.$path.'#'.$OnlyFileName, $base_folder.$FullFileName['name']);
+ }
+ }
+ }
+ $zip->close();
+ } else {
+ echo 'failed to open file';
+ }
+ break;
+ case 'gz':
+ $p = new PharData($path);
+ $p->decompress(); // creates files.tar
+ break;
+ case 'tar':
+ // unarchive from the tar
+ $phar = new PharData($path);
+ $phar->decompressFiles();
+ $files = array();
+ check_files_extensions_on_phar($phar, $files, '', $ext);
+ $phar->extractTo($current_path.fix_dirname($_POST['path']).'/', $files, true);
- $preview_file = $_GET['file'];
- $info = pathinfo($preview_file);
- ?>
+ break;
+ }
+ break;
+ case 'media_preview':
+
+ $preview_file = $_GET['file'];
+ $info = pathinfo($preview_file);
+ ?>
@@ -179,14 +178,13 @@ if (isset($_GET['action']))
Update Required
To play the media you will need to either update your browser to a recent version or update your
-
Flash plugin.
+
Flash plugin.
+ if (in_array(strtolower($info['extension']), $ext_music)) {
+ ?>
+
+ } elseif (in_array(strtolower($info['extension']), $ext_video)) {
+ ?>
\ No newline at end of file
+
+ }
+ break;
+ }
+} else {
+ die('no action passed');
+}
+?>
diff --git a/adm/filemanager/config/config.php b/adm/filemanager/config/config.php
index ebed5317..9b4a4457 100755
--- a/adm/filemanager/config/config.php
+++ b/adm/filemanager/config/config.php
@@ -1,17 +1,23 @@
employee->id_profile, Tab::getIdFromClassName('AdminProducts'));
$cms_accesses = Profile::getProfileAccess(Context::getContext()->employee->id_profile, Tab::getIdFromClassName('AdminCmsContent'));
-if (!$products_accesses['edit'] && !$cms_accesses['edit'])
- die(Tools::displayError());
+if (!$products_accesses['edit'] && !$cms_accesses['edit']) {
+ die(Tools::displayError());
+}
//------------------------------------------------------------------------------
// DON'T COPY THIS VARIABLES IN FOLDERS config.php FILES
//------------------------------------------------------------------------------
@@ -30,12 +36,13 @@ if (!$products_accesses['edit'] && !$cms_accesses['edit'])
// | | | |- responsivefilemanager
// | | | | |- plugin.min.js
-$base_url="http://".$_SERVER['HTTP_HOST']; // DON'T TOUCH (base url (only domain) of site (without final /)).
-$upload_dir = __PS_BASE_URI__.'img/cms/'; // path from base_url to base of upload folder (with start and final /)
+
+$base_url = Tools::getHttpHost(true); // DON'T TOUCH (base url (only domain) of site (without final /)).
+$base_url = Configuration::get('PS_SSL_ENABLED') && Configuration::get('PS_SSL_ENABLED_EVERYWHERE') ? $base_url : str_replace('https', 'http', $base_url);
+$upload_dir = Context::getContext()->shop->getBaseURI().'img/cms/'; // path from base_url to base of upload folder (with start and final /)
$current_path = _PS_ROOT_DIR_.'/img/cms/'; // relative path from filemanager folder to upload folder (with final /)
//thumbs folder can't put inside upload folder
$thumbs_base_path = _PS_ROOT_DIR_.'/img/tmp/cms/'; // relative path from filemanager folder to thumbs folder (with final /)
-$thumbs_base_path = _PS_ROOT_DIR_.'/img/cms/'; // relative path from filemanager folder to thumbs folder (with final /)
//--------------------------------------------------------------------------------------------------------
// YOU CAN COPY AND CHANGE THESE VARIABLES INTO FOLDERS config.php FILES TO CUSTOMIZE EACH FOLDER OPTIONS
@@ -79,7 +86,7 @@ $image_resizing_height=0;
//******************
$default_view=0;
-//set if the filename is truncated when overflow first row
+//set if the filename is truncated when overflow first row
$ellipsis_title_after_first_row=true;
//*************************
@@ -97,12 +104,12 @@ $duplicate_files=true;
//Allowed extensions (lowercase insert)
//**********************
$ext_img = array('jpg', 'jpeg', 'png', 'gif', 'bmp', 'tiff', 'svg'); //Images
-$ext_file = array('doc', 'docx','rtf', 'pdf', 'xls', 'xlsx', 'txt', 'csv','html','xhtml','psd','sql','log','fla','xml','ade','adp','mdb','accdb','ppt','pptx','odt','ots','ott','odb','odg','otp','otg','odf','ods','odp','css','ai'); //Files
-$ext_video = array('mov', 'mpeg', 'mp4', 'avi', 'mpg','wma',"flv","webm"); //Video
-$ext_music = array('mp3', 'm4a', 'ac3', 'aiff', 'mid','ogg','wav'); //Audio
-$ext_misc = array('zip', 'rar','gz','tar','iso','dmg'); //Archives
+$ext_file = array('pdf'); // array('doc', 'docx','rtf', 'pdf', 'xls', 'xlsx', 'txt', 'csv','html','xhtml','psd','sql','log','fla','xml','ade','adp','mdb','accdb','ppt','pptx','odt','ots','ott','odb','odg','otp','otg','odf','ods','odp','css','ai'); //Files
+$ext_video = array('mov', 'mpeg', 'mp4', 'avi', 'mpg', 'wma', 'flv', 'webm'); //Video
+$ext_music = array();//array('mp3', 'm4a', 'ac3', 'aiff', 'mid','ogg','wav'); //Audio
+$ext_misc = array();// array('zip', 'rar','gz','tar','iso','dmg'); //Archives
-$ext=array_merge($ext_img, $ext_file, $ext_misc, $ext_video,$ext_music); //allowed extensions
+$ext=array_merge($ext_img, $ext_file, $ext_misc, $ext_video, $ext_music); //allowed extensions
/******************
@@ -129,7 +136,7 @@ $hidden_folders = array();
$hidden_files = array('config.php');
/*******************
- * JAVA upload
+ * JAVA upload
*******************/
$java_upload=false;
$JAVAMaxSizeUpload=200; //Gb
@@ -141,7 +148,7 @@ $JAVAMaxSizeUpload=200; //Gb
// New image resized creation with fixed path from filemanager folder after uploading (thumbnails in fixed mode)
-// If you want create images resized out of upload folder for use with external script you can choose this method,
+// If you want create images resized out of upload folder for use with external script you can choose this method,
// You can create also more than one image at a time just simply add a value in the array
// Remember than the image creation respect the folder hierarchy so if you are inside source/test/test1/ the new image will create at
// path_from_filemanager/test/test1/
@@ -164,5 +171,3 @@ $relative_image_creation_name_to_prepend= array('','test_'); //name to prepend o
$relative_image_creation_name_to_append = array('_test',''); //name to append on filename
$relative_image_creation_width = array(300,400); //width of image (you can leave empty if you set height)
$relative_image_creation_height = array(200,''); //height of image (you can leave empty if you set width)
-
-?>
diff --git a/adm/filemanager/config/index.php b/adm/filemanager/config/index.php
new file mode 100644
index 00000000..08605e19
--- /dev/null
+++ b/adm/filemanager/config/index.php
@@ -0,0 +1,35 @@
+
+* @copyright 2007-2016 PrestaShop SA
+* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
+* International Registered Trademark & Property of PrestaShop SA
+*/
+
+header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
+header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
+
+header("Cache-Control: no-store, no-cache, must-revalidate");
+header("Cache-Control: post-check=0, pre-check=0", false);
+header("Pragma: no-cache");
+
+header("Location: ../");
+exit;
diff --git a/adm/filemanager/css/index.php b/adm/filemanager/css/index.php
new file mode 100644
index 00000000..08605e19
--- /dev/null
+++ b/adm/filemanager/css/index.php
@@ -0,0 +1,35 @@
+
+* @copyright 2007-2016 PrestaShop SA
+* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
+* International Registered Trademark & Property of PrestaShop SA
+*/
+
+header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
+header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
+
+header("Cache-Control: no-store, no-cache, must-revalidate");
+header("Cache-Control: post-check=0, pre-check=0", false);
+header("Pragma: no-cache");
+
+header("Location: ../");
+exit;
diff --git a/adm/filemanager/dialog.php b/adm/filemanager/dialog.php
index 9c9d6104..b67d1954 100755
--- a/adm/filemanager/dialog.php
+++ b/adm/filemanager/dialog.php
@@ -3,152 +3,178 @@ include('config/config.php');
$_SESSION["verify"] = "RESPONSIVEfilemanager";
-if (isset($_POST['submit']))
- include('upload.php');
-else
-{
-
- include('include/utils.php');
+if (isset($_POST['submit'])) {
+ include('upload.php');
+} else {
+ include('include/utils.php');
- if (isset($_GET['fldr'])
- && !empty($_GET['fldr'])
- && preg_match('/\.{1,2}[\/|\\\]/', urldecode($_GET['fldr'])) === 0
- )
- $subdir = urldecode(trim(str_replace("\0", '', $_GET['fldr']), '/').'/');
- else
- $subdir = '';
+ if (isset($_GET['fldr'])
+ && !empty($_GET['fldr'])
+ && preg_match('/\.{1,2}[\/|\\\]/', urldecode($_GET['fldr'])) === 0
+ ) {
+ $subdir = str_replace("\0", '', urldecode(trim($_GET['fldr'], '/').'/'));
+ } else {
+ $subdir = '';
+ }
//remember last position
- setcookie('last_position', $subdir, time() + (86400 * 7));
+ setcookie('last_position', $subdir, time() + (86400 * 7));
- if ($subdir == '')
- {
- if (!empty($_COOKIE['last_position'])
- && strpos($_COOKIE['last_position'], '.') === false
- )
- $subdir = trim($_COOKIE['last_position']);
- }
+ if ($subdir == '') {
+ if (!empty($_COOKIE['last_position'])
+ && strpos($_COOKIE['last_position'], '.') === false
+ ) {
+ $subdir = trim($_COOKIE['last_position']);
+ }
+ }
- if ($subdir == '/')
- $subdir = '';
+ if ($subdir == '/') {
+ $subdir = '';
+ }
- /***
- *SUB-DIR CODE
- ***/
- if (!isset($_SESSION['subfolder'])) $_SESSION['subfolder'] = '';
- $subfolder = '';
- if (!empty($_SESSION['subfolder']) && strpos($_SESSION['subfolder'], '../') === false
- && strpos($_SESSION['subfolder'], './') === false && strpos($_SESSION['subfolder'], '/') !== 0
- && strpos($_SESSION['subfolder'], '.') === false
- ) $subfolder = $_SESSION['subfolder'];
+ /***
+ *SUB-DIR CODE
+ ***/
+ if (!isset($_SESSION['subfolder'])) {
+ $_SESSION['subfolder'] = '';
+ }
+ $subfolder = '';
+ if (!empty($_SESSION['subfolder']) && strpos($_SESSION['subfolder'], '../') === false
+ && strpos($_SESSION['subfolder'], './') === false && strpos($_SESSION['subfolder'], '/') !== 0
+ && strpos($_SESSION['subfolder'], '.') === false
+ ) {
+ $subfolder = $_SESSION['subfolder'];
+ }
- if ($subfolder != '' && $subfolder[strlen($subfolder) - 1] != '/') $subfolder .= '/';
+ if ($subfolder != '' && $subfolder[strlen($subfolder) - 1] != '/') {
+ $subfolder .= '/';
+ }
- if (!file_exists($current_path.$subfolder.$subdir))
- {
- $subdir = '';
- if (!file_exists($current_path.$subfolder.$subdir))
- $subfolder = '';
- }
+ if (!file_exists($current_path.$subfolder.$subdir)) {
+ $subdir = '';
+ if (!file_exists($current_path.$subfolder.$subdir)) {
+ $subfolder = '';
+ }
+ }
- if (trim($subfolder) == '')
- {
- $cur_dir = $upload_dir.$subdir;
- $cur_path = $current_path.$subdir;
- $thumbs_path = $thumbs_base_path;
- $parent = $subdir;
- } else
- {
- $cur_dir = $upload_dir.$subfolder.$subdir;
- $cur_path = $current_path.$subfolder.$subdir;
- $thumbs_path = $thumbs_base_path.$subfolder;
- $parent = $subfolder.$subdir;
- }
+ if (trim($subfolder) == '') {
+ $cur_dir = $upload_dir.$subdir;
+ $cur_path = $current_path.$subdir;
+ $thumbs_path = $thumbs_base_path;
+ $parent = $subdir;
+ } else {
+ $cur_dir = $upload_dir.$subfolder.$subdir;
+ $cur_path = $current_path.$subfolder.$subdir;
+ $thumbs_path = $thumbs_base_path.$subfolder;
+ $parent = $subfolder.$subdir;
+ }
- $cycle = true;
- $max_cycles = 50;
- $i = 0;
- while ($cycle && $i < $max_cycles)
- {
- $i++;
- if ($parent == './') $parent = '';
- if (file_exists($current_path.$parent.'config.php'))
- {
- require_once($current_path.$parent.'config.php');
- $cycle = false;
- }
+ $cycle = true;
+ $max_cycles = 50;
+ $i = 0;
+ while ($cycle && $i < $max_cycles) {
+ $i++;
+ if ($parent == './') {
+ $parent = '';
+ }
+ if (file_exists($current_path.$parent.'config.php')) {
+ require_once($current_path.$parent.'config.php');
+ $cycle = false;
+ }
- if ($parent == '') $cycle = false;
- else $parent = fix_dirname($parent).'/';
- }
+ if ($parent == '') {
+ $cycle = false;
+ } else {
+ $parent = fix_dirname($parent).'/';
+ }
+ }
- if (!is_dir($thumbs_path.$subdir))
- {
- create_folder(false, $thumbs_path.$subdir);
- }
+ if (!is_dir($thumbs_path.$subdir)) {
+ create_folder(false, $thumbs_path.$subdir);
+ }
- if (isset($_GET['popup'])) $popup = $_GET['popup']; else $popup = 0;
+ if (isset($_GET['popup'])) {
+ $popup = $_GET['popup'];
+ } else {
+ $popup = 0;
+ }
//Sanitize popup
- $popup = !!$popup;
+ $popup = !!$popup;
//view type
- if (!isset($_SESSION['view_type']))
- {
- $view = $default_view;
- $_SESSION['view_type'] = $view;
- }
- if (isset($_GET['view']))
- {
- $view = $_GET['view'];
- $_SESSION['view_type'] = $view;
- }
- $view = $_SESSION['view_type'];
+ if (!isset($_SESSION['view_type'])) {
+ $view = $default_view;
+ $_SESSION['view_type'] = $view;
+ }
+ if (isset($_GET['view'])) {
+ $view = $_GET['view'];
+ $_SESSION['view_type'] = $view;
+ }
+ $view = $_SESSION['view_type'];
- if (isset($_GET['filter'])) $filter = fix_filename($_GET['filter'], $transliteration);
- else $filter = '';
+ if (isset($_GET['filter'])) {
+ $filter = fix_filename($_GET['filter'], $transliteration);
+ } else {
+ $filter = '';
+ }
- if (!isset($_SESSION['sort_by'])) $_SESSION['sort_by'] = '';
- if (isset($_GET['sort_by'])) $sort_by = $_SESSION['sort_by'] = fix_filename($_GET['sort_by'], $transliteration);
- else $sort_by = $_SESSION['sort_by'];
+ if (!isset($_SESSION['sort_by'])) {
+ $_SESSION['sort_by'] = '';
+ }
+ if (isset($_GET['sort_by'])) {
+ $sort_by = $_SESSION['sort_by'] = fix_filename($_GET['sort_by'], $transliteration);
+ } else {
+ $sort_by = $_SESSION['sort_by'];
+ }
- if (!isset($_SESSION['descending'])) $_SESSION['descending'] = false;
- if (isset($_GET['descending'])) $descending = $_SESSION['descending'] = fix_filename($_GET['descending'], $transliteration) === 'true';
- else $descending = $_SESSION['descending'];
+ if (!isset($_SESSION['descending'])) {
+ $_SESSION['descending'] = false;
+ }
+ if (isset($_GET['descending'])) {
+ $descending = $_SESSION['descending'] = fix_filename($_GET['descending'], $transliteration) === 'true';
+ } else {
+ $descending = $_SESSION['descending'];
+ }
- $lang = $default_language;
- if (isset($_GET['lang']) && $_GET['lang'] != 'undefined' && $_GET['lang'] != '')
- $lang = $_GET['lang'];
+ $lang = $default_language;
+ if (isset($_GET['lang']) && $_GET['lang'] != 'undefined' && $_GET['lang'] != '') {
+ $lang = $_GET['lang'];
+ }
- $language_file = 'lang/'.$default_language.'.php';
- if ($lang != $default_language)
- {
- $path_parts = pathinfo($lang);
- if (is_readable('lang/'.$path_parts['basename'].'.php'))
- $language_file = 'lang/'.$path_parts['basename'].'.php';
- else
- $lang = $default_language;
- }
+ $language_file = 'lang/'.$default_language.'.php';
+ if ($lang != $default_language) {
+ $path_parts = pathinfo($lang);
+ if (is_readable('lang/'.$path_parts['basename'].'.php')) {
+ $language_file = 'lang/'.$path_parts['basename'].'.php';
+ } else {
+ $lang = $default_language;
+ }
+ }
- require_once $language_file;
+ require_once $language_file;
- if (!isset($_GET['type'])) $_GET['type'] = 0;
- if (!isset($_GET['field_id'])) $_GET['field_id'] = '';
+ if (!isset($_GET['type'])) {
+ $_GET['type'] = 0;
+ }
+ if (!isset($_GET['field_id'])) {
+ $_GET['field_id'] = '';
+ }
- $get_params = http_build_query(
- array(
- 'type' => Tools::safeOutput($_GET['type']),
- 'lang' => Tools::safeOutput($lang),
- 'popup' => $popup,
- 'field_id' => isset($_GET['field_id']) ? (int)$_GET['field_id'] : '',
- 'fldr' => ''
- )
- );
- ?>
+ $get_params = http_build_query(
+ array(
+ 'type' => Tools::safeOutput($_GET['type']),
+ 'lang' => Tools::safeOutput($lang),
+ 'popup' => $popup,
+ 'field_id' => isset($_GET['field_id']) ? (int)$_GET['field_id'] : '',
+ 'fldr' => ''
+ )
+ );
+ ?>
@@ -192,17 +218,19 @@ else
+ if ($aviary_active) {
+ if (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off' || $_SERVER['SERVER_PORT'] == 443) {
+ ?>
-
+
+
+ }
+ }
+ ?>
@@ -309,135 +372,166 @@ else
-
+
-
+
$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);
- }
- }
+ //php sorting
+ $sorted = array();
+ $current_folder = array();
+ $prev_folder = array();
+ foreach ($files as $k => $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 filenameSort($x, $y)
+ {
+ return $x['file'] < $y['file'];
+ }
- function dateSort($x, $y)
- {
- return $x['date'] < $y['date'];
- }
+ function dateSort($x, $y)
+ {
+ return $x['date'] < $y['date'];
+ }
- function sizeSort($x, $y)
- {
- return $x['size'] - $y['size'];
- }
+ function sizeSort($x, $y)
+ {
+ return $x['size'] - $y['size'];
+ }
- function extensionSort($x, $y)
- {
- return $x['extension'] < $y['extension'];
- }
+ 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;
+ 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);
- }
+ if ($descending) {
+ $sorted = array_reverse($sorted);
+ }
- $files = array_merge(array($prev_folder), array($current_folder), $sorted);
- ?>
+ $files = array();
+ if (!empty($prev_folder)) {
+ $files = array($prev_folder);
+ }
+ if (!empty($current_folder)) {
+ $files = array_merge($files, array($current_folder));
+ }
+ $files = array_merge($files, $sorted);
+ ?>
@@ -447,57 +541,98 @@ else
-
->
+
->
@@ -513,31 +648,32 @@ else
+ $link = "dialog.php?".$get_params;
+ ?>
@@ -578,380 +718,473 @@ else
-
+
There is an error! The upload folder there isn't. Check your config.php file.
-
-
-
-
-
-
+
+
+
+
+
+
-
">
-
-
-
-
-
-
+
-
+
-
+
-
">
+ ">
- - >
-
-
+
@@ -975,7 +1208,8 @@ else
@@ -987,4 +1221,5 @@ else