diff --git a/Action/CreateFile.php b/Action/CreateFile.php index 2f1a59c..e8a2b7a 100644 --- a/Action/CreateFile.php +++ b/Action/CreateFile.php @@ -11,7 +11,7 @@ public function action($parent){ $path_thumb = $parent->path_thumb; $name = $parent->name; $util = new Utility(); - if ($create_text_files === FALSE) { + if ($config['create_text_files'] === FALSE) { $this->r = array('You are not allowed to edit this file.', 403); return; } diff --git a/Ajax/Chmod.php b/Ajax/Chmod.php index 1820735..301e0f9 100644 --- a/Ajax/Chmod.php +++ b/Ajax/Chmod.php @@ -13,7 +13,7 @@ public function action($parent){ if ( (is_dir($path) && $c['chmod_dirs'] === false) || (is_file($path) && $c['chmod_files'] === false) - || (is_function_callable("chmod") === false) ) + || ($util->is_function_callable("chmod") === false) ) { $this->r=array(sprintf('Changing %s permissions are not allowed.', (is_dir($path) ? 'folders' : 'files')),403); return; diff --git a/Dialog.php b/Dialog.php index de2fc02..cf5398f 100644 --- a/Dialog.php +++ b/Dialog.php @@ -444,7 +444,7 @@ public function two($app, $files, $twigArr, $config, $subdir, $filter, $translit if(!$util->create_img($file_path, $src_thumb, 122, 91)){ $src_thumb=$mini_src=""; }else{ - $util->new_thumbnails_creation($this->current_path.$rfm_subfolder.$subdir,$file_path,$file,$this->current_path,'','','','','','','',$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,$fixed_image_creation_option); +// $util->new_thumbnails_creation($this->current_path.$rfm_subfolder.$subdir,$file_path,$file,$this->current_path,'','','','','','','',$confixed_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,$fixed_image_creation_option); } } catch (Exception $e) { $src_thumb=$mini_src=""; @@ -540,7 +540,7 @@ public function two($app, $files, $twigArr, $config, $subdir, $filter, $translit //var_dump($twigArr['subdir']); $twigArr['file_array']['makeSize'] = $util->makeSize($file_array['size']); if((!($_GET['type']==1 && !$is_img) && !(($_GET['type']==3 && !$is_video) && ($_GET['type']==3 && !$is_audio))) && $class_ext > 0){ - $template = 'FileManager/two/two.html.twig'; + $template = 'FileManager/two.html.twig'; $html = $html . $app['twig']->render($template, $twigArr); //template! } } diff --git a/FileManagerControllerProvider.php b/FileManagerControllerProvider.php new file mode 100644 index 0000000..b37ab44 --- /dev/null +++ b/FileManagerControllerProvider.php @@ -0,0 +1,22 @@ +match('/', 'Rabies\FileManager\Dialog::Dialog'); + $indexController->match('upload', 'Rabies\FileManager\Upload::upload'); + $indexController->match('download', 'Rabies\FileManager\Download::download'); + $indexController->match('action/{action}', 'Rabies\FileManager\Action\ActionHandler::action'); + $indexController->match('ajax/{action}', 'Rabies\FileManager\Ajax\AjaxHandler::ajax'); + return $indexController; + } + + + +} \ No newline at end of file diff --git a/README.md b/README.md index 44174e2..826b52f 100644 --- a/README.md +++ b/README.md @@ -1,16 +1,63 @@ -# FileManager -Silex FileManager +# TinyMCE FileManager Plugin with Silex backend -Routing (in silex) -where admin is secured +Based on (https://github.com/trippo/ResponsiveFilemanager) -will need some updates in order to find the twig templates ect. +and see author repo (https://github.com/Kingtreemonkey/FileManager) - $app->get('admin/filemanager', 'Rabies\FileManager\Dialog::Dialog'); - $app->match('admin/filemanager/upload', 'Rabies\FileManager\Upload::upload'); - $app->match('admin/filemanager/download', 'Rabies\FileManager\Download::download'); - $app->match('admin/filemanager/action/{action}', 'Rabies\FileManager\Action\ActionHandler::action'); - $app->match('admin/filemanager/ajax/{action}', 'Rabies\FileManager\Ajax\AjaxHandler::ajax'); +## Installation +### manipulation on Silex + +Copy config file to config dir and add to project in app.php + +``` php +$app['FileManager'] = function() { + return require (__DIR__.'/../config/'."tinymce_filemanager.php"); + }; +``` + +Add ControllerProvider + +``` php +$app->mount('/filemanager', new \Rabies\FileManager\FileManagerControllerProvider()); +``` + +Copy Templates folder to Your twig templates dir ---------- + +### Add plugin to TinyMCE + +copy plugin file to tinymce plugin folder + +add responsivefilemanager to plugin list and buttons list in tinyMCE init + +add path to file manager and title + +``` +external_filemanager_path:"/filemanager", +filemanager_title:"Responsive Filemanager" +``` + +for example +``` +tinymce.init({ +selector: '.wysiwyg', +language: 'en', +browser_spellcheck: true, +theme: 'modern', +plugins: [ +'advlist autolink lists link image charmap print preview hr anchor pagebreak', +'searchreplace wordcount visualblocks visualchars code fullscreen', +'insertdatetime media nonbreaking save table contextmenu directionality', +'emoticons template paste textcolor colorpicker textpattern imagetools localautosave responsivefilemanager' +], +toolbar1: 'insertfile undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent ', +toolbar2: 'print preview | fontsizeselect forecolor backcolor emoticons | link media image responsivefilemanager | localautosave', +relative_urls: false, +image_advtab: true, +external_filemanager_path:"/filemanager", +filemanager_title:"Responsive Filemanager" +}); + +``` diff --git a/Templates/need_name/back,html.twig b/Templates/need_name/back.html.twig similarity index 100% rename from Templates/need_name/back,html.twig rename to Templates/need_name/back.html.twig diff --git a/Templates/two/two.html.twig b/Templates/two.html.twig similarity index 100% rename from Templates/two/two.html.twig rename to Templates/two.html.twig diff --git a/Upload.php b/Upload.php index 8175637..7ad0c0c 100644 --- a/Upload.php +++ b/Upload.php @@ -90,7 +90,7 @@ public function upload(Application $app, Request $req){ $memory_error = FALSE; }else{ // TODO something with this long function baaaah... - if( ! $util->new_thumbnails_creation($targetPath,$targetFile,$_FILES['file']['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,$relative_image_creation_option,$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,$fixed_image_creation_option)) + if( ! $util->new_thumbnails_creation($targetPath,$targetFile,$_FILES['file']['name'],$current_path,$config['relative_image_creation'],$config['relative_path_from_current_pos'],$config['relative_image_creation_name_to_prepend'],$config['relative_image_creation_name_to_append'],$config['relative_image_creation_width'],$config['relative_image_creation_height'],$config['relative_image_creation_option'],$config['fixed_image_creation'],$config['fixed_path_from_filemanager'],$config['fixed_image_creation_name_to_prepend'],$config['fixed_image_creation_to_append'],$config['fixed_image_creation_width'],$config['fixed_image_creation_height'],$config['fixed_image_creation_option'])) { $memory_error = FALSE; } @@ -100,32 +100,32 @@ public function upload(Application $app, Request $req){ $srcWidth = $imginfo[0]; $srcHeight = $imginfo[1]; // resize images if set - if ($image_resizing) + if ($config['image_resizing']) { - if ($image_resizing_width == 0) // if width not set + if ($config['image_resizing_width ']== 0) // if width not set { - if ($image_resizing_height == 0) + if ($config['image_resizing_height'] == 0) { - $image_resizing_width = $srcWidth; - $image_resizing_height = $srcHeight; + $config['image_resizing_width'] = $srcWidth; + $config['image_resizing_height'] = $srcHeight; } else { - $image_resizing_width = $image_resizing_height*$srcWidth/$srcHeight; + $config['image_resizing_width'] = $config['image_resizing_height']*$srcWidth/$srcHeight; } } - elseif ($image_resizing_height == 0) // if height not set + elseif ($config['image_resizing_height'] == 0) // if height not set { - $image_resizing_height = $image_resizing_width*$srcHeight/$srcWidth; + $config['image_resizing_height'] = $config['image_resizing_width']*$srcHeight/$srcWidth; } // new dims and create - $srcWidth = $image_resizing_width; - $srcHeight = $image_resizing_height; - $util->create_img($targetFile, $targetFile, $image_resizing_width, $image_resizing_height, $image_resizing_mode); + $srcWidth = $config['image_resizing_width']; + $srcHeight = $config['image_resizing_height']; + $util->create_img($targetFile, $targetFile, $config['image_resizing_width'], $config['image_resizing_height'], $config['image_resizing_mode']); } //max resizing limit control $resize = FALSE; - if ($image_max_width != 0 && $srcWidth > $image_max_width && $image_resizing_override === FALSE) + if ($image_max_width != 0 && $srcWidth > $image_max_width && $config['image_resizing_override'] === FALSE) { $resize = TRUE; $srcWidth = $image_max_width; @@ -133,7 +133,7 @@ public function upload(Application $app, Request $req){ $srcHeight = $image_max_width*$srcHeight/$srcWidth; } } - if ($image_max_height != 0 && $srcHeight > $image_max_height && $image_resizing_override === FALSE){ + if ($image_max_height != 0 && $srcHeight > $image_max_height && $config['image_resizing_override'] === FALSE){ $resize = TRUE; $srcHeight = $image_max_height; if ($image_max_width == 0){ diff --git a/composer.json b/composer.json new file mode 100644 index 0000000..e180b90 --- /dev/null +++ b/composer.json @@ -0,0 +1,15 @@ +{ + "name": "rabies/filemanager", + "description": "Completely Responsive Filemanager with integration for tinyMCE and Silex backend", + "keywords": ["filemanager","silex","tinymce"], + "license": "Creative Commons Attribution-NonCommercial 3.0 Unported License", + "authors": [ + { + "name": "Xpycts", + "homepage": "https://github.com/Xpycts/FileManager" + } + ], + "require": { + "php": ">=5.3.0" + } +} \ No newline at end of file diff --git a/config/tinymce_filemanager.php b/config/tinymce_filemanager.php new file mode 100644 index 0000000..9a7a0d0 --- /dev/null +++ b/config/tinymce_filemanager.php @@ -0,0 +1,449 @@ + +| in tinymce a new parameter added: filemanager_access_key:"myPrivateKey" +| example tinymce config: +| +| tiny init ... +| external_filemanager_path:"../filemanager/", +| filemanager_title:"Filemanager" , +| filemanager_access_key:"myPrivateKey" , +| ... +| +*/ + +//define('USE_ACCESS_KEYS', false); // TRUE or FALSE + +/* +|-------------------------------------------------------------------------- +| DON'T COPY THIS VARIABLES IN FOLDERS config.php FILES +|-------------------------------------------------------------------------- +*/ + +//define('DEBUG_ERROR_MESSAGE', true); // TRUE or FALSE + +/* +|-------------------------------------------------------------------------- +| Path configuration +|-------------------------------------------------------------------------- +| In this configuration the folder tree is +| root +| |- source <- upload folder +| |- thumbs <- thumbnail folder [must have write permission (755)] +| |- filemanager +| |- js +| | |- tinymce +| | | |- plugins +| | | | |- responsivefilemanager +| | | | | |- plugin.min.js +*/ + +$config = array( + + /* + |-------------------------------------------------------------------------- + | DON'T TOUCH (base url (only domain) of site). + |-------------------------------------------------------------------------- + | + | without final / (DON'T TOUCH) + | + */ + 'base_url' => ((isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] && ! in_array(strtolower($_SERVER['HTTPS']), array( 'off', 'no' ))) ? 'https' : 'http') . '://' . $_SERVER['HTTP_HOST'], + + /* + |-------------------------------------------------------------------------- + | path from base_url to base of upload folder + |-------------------------------------------------------------------------- + | + | with start and final / + | + */ + 'upload_dir' => '/uploads/images/', + /* + |-------------------------------------------------------------------------- + | relative path from filemanager folder to upload folder + |-------------------------------------------------------------------------- + | + | with final / + | + */ + 'current_path' => 'uploads/images/', + + /* + |-------------------------------------------------------------------------- + | relative path from filemanager folder to thumbs folder + |-------------------------------------------------------------------------- + | + | with final / + | DO NOT put inside upload folder + | + */ + 'thumbs_base_path' => 'uploads/thumbs/', + + + /* + |-------------------------------------------------------------------------- + | FTP configuration BETA VERSION + |-------------------------------------------------------------------------- + | + | If you want enable ftp use write these parametres otherwise leave empty + | Remember to set base_url properly to point in the ftp server domain and + | upload dir will be ftp_base_folder + upload_dir so without final / + | + */ + 'ftp_host' => false, + 'ftp_user' => "user", + 'ftp_pass' => "pass", + 'ftp_base_folder' => "base_folder", + 'ftp_base_url' => "http://site to ftp root", + /* -------------------------------------------------------------------------- + | path from ftp_base_folder to base of thumbs folder with start and final | + |--------------------------------------------------------------------------*/ + 'ftp_thumbs_dir' => '/thumbs/', + 'ftp_ssl' => false, + 'ftp_port' => 21, + + + // 'ftp_host' => "s108707.gridserver.com", + // 'ftp_user' => "test@responsivefilemanager.com", + // 'ftp_pass' => "Test.1234", + // 'ftp_base_folder' => "/domains/responsivefilemanager.com/html", + + + /* + |-------------------------------------------------------------------------- + | Access keys + |-------------------------------------------------------------------------- + | + | add access keys eg: array('myPrivateKey', 'someoneElseKey'); + | keys should only containt (a-z A-Z 0-9 \ . _ -) characters + | if you are integrating lets say to a cms for admins, i recommend making keys randomized something like this: + | $username = 'Admin'; + | $salt = 'dsflFWR9u2xQa' (a hard coded string) + | $akey = md5($username.$salt); + | DO NOT use 'key' as access key! + | Keys are CASE SENSITIVE! + | + */ + + 'access_keys' => array(), + + //-------------------------------------------------------------------------------------------------------- + // YOU CAN COPY AND CHANGE THESE VARIABLES INTO FOLDERS config.php FILES TO CUSTOMIZE EACH FOLDER OPTIONS + //-------------------------------------------------------------------------------------------------------- + + /* + |-------------------------------------------------------------------------- + | Maximum size of all files in source folder + |-------------------------------------------------------------------------- + | + | in Megabytes + | + */ + 'MaxSizeTotal' => false, + + /* + |-------------------------------------------------------------------------- + | Maximum upload size + |-------------------------------------------------------------------------- + | + | in Megabytes + | + */ + 'MaxSizeUpload' => 8, + + /* + |-------------------------------------------------------------------------- + | File and Folder permission + |-------------------------------------------------------------------------- + | + */ + 'fileFolderPermission' => 0755, + + + /* + |-------------------------------------------------------------------------- + | default language file name + |-------------------------------------------------------------------------- + */ + 'default_language' => "en_EN", + + /* + |-------------------------------------------------------------------------- + | Icon theme + |-------------------------------------------------------------------------- + | + | Default available: ico and ico_dark + | Can be set to custom icon inside filemanager/img + | + */ + 'icon_theme' => "ico", + + + //Show or not total size in filemanager (is possible to greatly increase the calculations) + 'show_total_size' => false, + //Show or not show folder size in list view feature in filemanager (is possible, if there is a large folder, to greatly increase the calculations) + 'show_folder_size' => false, + //Show or not show sorting feature in filemanager + 'show_sorting_bar' => true, + //Show or not show filters button in filemanager + 'show_filter_buttons' => true, + //Show or not language selection feature in filemanager + 'show_language_selection' => true, + //active or deactive the transliteration (mean convert all strange characters in A..Za..z0..9 characters) + 'transliteration' => false, + //convert all spaces on files name and folders name with $replace_with variable + 'convert_spaces' => false, + //convert all spaces on files name and folders name this value + 'replace_with' => "_", + //convert to lowercase the files and folders name + 'lower_case' => false, + + //Add ?484899493349 (time value) to returned images to prevent cache + 'add_time_to_img' => false, + + // -1: There is no lazy loading at all, 0: Always lazy-load images, 0+: The minimum number of the files in a directory + // when lazy loading should be turned on. + 'lazy_loading_file_number_threshold' => 0, + + + //******************************************* + //Images limit and resizing configuration + //******************************************* + + // set maximum pixel width and/or maximum pixel height for all images + // If you set a maximum width or height, oversized images are converted to those limits. Images smaller than the limit(s) are unaffected + // if you don't need a limit set both to 0 + 'image_max_width' => 0, + 'image_max_height' => 0, + 'image_max_mode' => 'auto', + /* + # $option: 0 / exact = defined size; + # 1 / portrait = keep aspect set height; + # 2 / landscape = keep aspect set width; + # 3 / auto = auto; + # 4 / crop= resize and crop; + */ + + //Automatic resizing // + // If you set $image_resizing to TRUE the script converts all uploaded images exactly to image_resizing_width x image_resizing_height dimension + // If you set width or height to 0 the script automatically calculates the other dimension + // Is possible that if you upload very big images the script not work to overcome this increase the php configuration of memory and time limit + 'image_resizing' => false, + 'image_resizing_width' => 0, + 'image_resizing_height' => 0, + 'image_resizing_mode' => 'auto', // same as $image_max_mode + 'image_resizing_override' => false, + // If set to TRUE then you can specify bigger images than $image_max_width & height otherwise if image_resizing is + // bigger than $image_max_width or height then it will be converted to those values + + + //****************** + // + // WATERMARK IMAGE + // + //Watermark url or false + 'image_watermark' => false, + # Could be a pre-determined position such as: + # tl = top left, + # t = top (middle), + # tr = top right, + # l = left, + # m = middle, + # r = right, + # bl = bottom left, + # b = bottom (middle), + # br = bottom right + # Or, it could be a co-ordinate position such as: 50x100 + 'image_watermark_position' => 'br', + # padding: If using a pre-determined position you can + # adjust the padding from the edges by passing an amount + # in pixels. If using co-ordinates, this value is ignored. + 'image_watermark_padding' => 0, + + //****************** + // Default layout setting + // + // 0 => boxes + // 1 => detailed list (1 column) + // 2 => columns list (multiple columns depending on the width of the page) + // YOU CAN ALSO PASS THIS PARAMETERS USING SESSION VAR => $_SESSION['RF']["VIEW"]= + // + //****************** + 'default_view' => 0, + + //set if the filename is truncated when overflow first row + 'ellipsis_title_after_first_row' => true, + + //************************* + //Permissions configuration + //****************** + 'delete_files' => true, + 'create_folders' => true, + 'delete_folders' => true, + 'upload_files' => true, + 'rename_files' => true, + 'rename_folders' => true, + 'duplicate_files' => true, + 'copy_cut_files' => true, // for copy/cut files + 'copy_cut_dirs' => true, // for copy/cut directories + 'chmod_files' => true, // change file permissions + 'chmod_dirs' => true, // change folder permissions + 'preview_text_files' => true, // eg.: txt, log etc. + 'edit_text_files' => true, // eg.: txt, log etc. + 'create_text_files' => true, // only create files with exts. defined in $editable_text_file_exts + + // you can preview these type of files if $preview_text_files is true + 'previewable_text_file_exts' => array( 'txt', 'log', 'xml', 'html', 'css', 'htm', 'js' ), + 'previewable_text_file_exts_no_prettify' => array( 'txt', 'log' ), + + // you can edit these type of files if $edit_text_files is true (only text based files) + // you can create these type of files if $create_text_files is true (only text based files) + // if you want you can add html,css etc. + // but for security reasons it's NOT RECOMMENDED! + 'editable_text_file_exts' => array( 'txt', 'log', 'xml', 'html', 'css', 'htm', 'js' ), + + // Preview with Google Documents + 'googledoc_enabled' => true, + 'googledoc_file_exts' => array( 'doc', 'docx', 'xls', 'xlsx', 'ppt', 'pptx' ), + + // Preview with Viewer.js + 'viewerjs_enabled' => true, + 'viewerjs_file_exts' => array( 'pdf', 'odt', 'odp', 'ods' ), + + // defines size limit for paste in MB / operation + // set 'FALSE' for no limit + 'copy_cut_max_size' => 100, + // defines file count limit for paste / operation + // set 'FALSE' for no limit + 'copy_cut_max_count' => 200, + //IF any of these limits reached, operation won't start and generate warning + + //********************** + //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', 'kmz' ), //Files + 'ext_video' => array( 'mov', 'mpeg', 'm4v', 'mp4', 'avi', 'mpg', 'wma', "flv", "webm" ), //Video + 'ext_music' => array( 'mp3', 'mpga', 'm4a', 'ac3', 'aiff', 'mid', 'ogg', 'wav' ), //Audio + 'ext_misc' => array( 'zip', 'rar', 'gz', 'tar', 'iso', 'dmg' ), //Archives + + /****************** + * AVIARY config + *******************/ + 'aviary_active' => true, + 'aviary_apiKey' => "2444282ef4344e3dacdedc7a78f8877d", + 'aviary_language' => "en", + 'aviary_theme' => "light", + 'aviary_tools' => "all", + 'aviary_maxSize' => "1400", + // Add or modify the Aviary options below as needed - they will be json encoded when added to the configuration so arrays can be utilized as needed + + //The filter and sorter are managed through both javascript and php scripts because if you have a lot of + //file in a folder the javascript script can't sort all or filter all, so the filemanager switch to php script. + //The plugin automatic swich javascript to php when the current folder exceeds the below limit of files number + 'file_number_limit_js' => 500, + + //********************** + // Hidden files and folders + //********************** + // set the names of any folders you want hidden (eg "hidden_folder1", "hidden_folder2" ) Remember all folders with these names will be hidden (you can set any exceptions in config.php files on folders) + 'hidden_folders' => array(), + // set the names of any files you want hidden. Remember these names will be hidden in all folders (eg "this_document.pdf", "that_image.jpg" ) + 'hidden_files' => array( 'config.php' ), + + /******************* + * JAVA upload + *******************/ + 'java_upload' => true, + 'JAVAMaxSizeUpload' => 200, //Gb + + + //************************************ + //Thumbnail for external use creation + //************************************ + + + // 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, + // 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/ + // PS if there isn't write permission in your destination folder you must set it + // + 'fixed_image_creation' => false, //activate or not the creation of one or more image resized with fixed path from filemanager folder + 'fixed_path_from_filemanager' => array( '../test/', '../test1/' ), //fixed path of the image folder from the current position on upload folder + 'fixed_image_creation_name_to_prepend' => array( '', 'test_' ), //name to prepend on filename + 'fixed_image_creation_to_append' => array( '_test', '' ), //name to appendon filename + 'fixed_image_creation_width' => array( 300, 400 ), //width of image (you can leave empty if you set height) + 'fixed_image_creation_height' => array( 200, '' ), //height of image (you can leave empty if you set width) + /* + # $option: 0 / exact = defined size; + # 1 / portrait = keep aspect set height; + # 2 / landscape = keep aspect set width; + # 3 / auto = auto; + # 4 / crop= resize and crop; + */ + 'fixed_image_creation_option' => array( 'crop', 'auto' ), //set the type of the crop + + + // New image resized creation with relative path inside to upload folder after uploading (thumbnails in relative mode) + // With Responsive filemanager you can create automatically resized image inside the upload folder, also more than one at a time + // just simply add a value in the array + // The image creation path is always relative so if i'm inside source/test/test1 and I upload an image, the path start from here + // + 'relative_image_creation' => false, //activate or not the creation of one or more image resized with relative path from upload folder + 'relative_path_from_current_pos' => array( './', './' ), //relative path of the image folder from the current position on upload folder + 'relative_image_creation_name_to_prepend' => array( '', '' ), //name to prepend on filename + 'relative_image_creation_name_to_append' => array( '_thumb', '_thumb1' ), //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) + /* + # $option: 0 / exact = defined size; + # 1 / portrait = keep aspect set height; + # 2 / landscape = keep aspect set width; + # 3 / auto = auto; + # 4 / crop= resize and crop; + */ + 'relative_image_creation_option' => array( 'crop', 'crop' ), //set the type of the crop + + + // Remember text filter after close filemanager for future session + 'remember_text_filter' => false, + +); + +return array_merge( + $config, + array( + 'MaxSizeUpload' => ((int)(ini_get('post_max_size')) < $config['MaxSizeUpload']) + ? (int)(ini_get('post_max_size')) : $config['MaxSizeUpload'], + 'ext'=> array_merge( + $config['ext_img'], + $config['ext_file'], + $config['ext_misc'], + $config['ext_video'], + $config['ext_music'] + ), + // For a list of options see: https://developers.aviary.com/docs/web/setup-guide#constructor-config + 'aviary_defaults_config' => array( + 'apiKey' => $config['aviary_apiKey'], + 'language' => $config['aviary_language'], + 'theme' => $config['aviary_theme'], + 'tools' => $config['aviary_tools'], + 'maxSize' => $config['aviary_maxSize'] + ), + ) +); diff --git a/tinymce/plugins/responsivefilemanager/img/insertfile.gif b/tinymce/plugins/responsivefilemanager/img/insertfile.gif new file mode 100644 index 0000000..93689cb Binary files /dev/null and b/tinymce/plugins/responsivefilemanager/img/insertfile.gif differ diff --git a/tinymce/plugins/responsivefilemanager/plugin.min.js b/tinymce/plugins/responsivefilemanager/plugin.min.js new file mode 100644 index 0000000..eb01cec --- /dev/null +++ b/tinymce/plugins/responsivefilemanager/plugin.min.js @@ -0,0 +1 @@ +tinymce.PluginManager.add("responsivefilemanager",function(e){function n(t){0===e.settings.external_filemanager_path.toLowerCase().indexOf(t.origin.toLowerCase())&&"responsivefilemanager"===t.data.sender&&(tinymce.activeEditor.insertContent(t.data.html),tinymce.activeEditor.windowManager.close(),window.removeEventListener?window.removeEventListener("message",n,!1):window.detachEvent("onmessage",n))}function t(){e.focus(!0);var t="RESPONSIVE FileManager";"undefined"!=typeof e.settings.filemanager_title&&e.settings.filemanager_title&&(t=e.settings.filemanager_title);var i="key";"undefined"!=typeof e.settings.filemanager_access_key&&e.settings.filemanager_access_key&&(i=e.settings.filemanager_access_key);var a="";"undefined"!=typeof e.settings.filemanager_sort_by&&e.settings.filemanager_sort_by&&(a="&sort_by="+e.settings.filemanager_sort_by);var s="false";"undefined"!=typeof e.settings.filemanager_descending&&e.settings.filemanager_descending&&(s=e.settings.filemanager_descending);var r="";"undefined"!=typeof e.settings.filemanager_subfolder&&e.settings.filemanager_subfolder&&(r="&fldr="+e.settings.filemanager_subfolder);var o="";"undefined"!=typeof e.settings.filemanager_crossdomain&&e.settings.filemanager_crossdomain&&(o="&crossdomain=1",window.addEventListener?window.addEventListener("message",n,!1):window.attachEvent("onmessage",n)),win=e.windowManager.open({title:t,file:e.settings.external_filemanager_path+"dialog.php?type=4&descending="+s+a+r+o+"&lang="+e.settings.language+"&akey="+i,width:860,height:570,inline:1,resizable:!0,maximizable:!0})}e.addButton("responsivefilemanager",{icon:"browse",tooltip:"Insert file",shortcut:"Ctrl+E",onclick:t}),e.addShortcut("Ctrl+E","",t),e.addMenuItem("responsivefilemanager",{icon:"browse",text:"Insert file",shortcut:"Ctrl+E",onclick:t,context:"insert"})}); \ No newline at end of file