Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Action/CreateFile.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion Ajax/Chmod.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions Dialog.php
Original file line number Diff line number Diff line change
Expand Up @@ -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="";
Expand Down Expand Up @@ -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!
}
}
Expand Down
22 changes: 22 additions & 0 deletions FileManagerControllerProvider.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php
namespace Rabies\FileManager;

use Silex\Application;
use Silex\ControllerProviderInterface;

class FileManagerControllerProvider implements ControllerProviderInterface
{
public function connect(Application $app) {

$indexController = $app['controllers_factory'];
$indexController->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;
}



}
67 changes: 57 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -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"
});

```
File renamed without changes.
File renamed without changes.
28 changes: 14 additions & 14 deletions Upload.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand All @@ -100,40 +100,40 @@ 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;
if ($image_max_height == 0){
$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){
Expand Down
15 changes: 15 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -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"
}
}
Loading