fileeditor FileEditor is a powerfull multifile editor.

  1. Update: Version 1.0.1 corected the bug: Can't create new file.
  2. WARNING: All versions prior v.1.0 have a severe security hole. Please update it as soon as possible to latest version.
  3. Requirements
  4. Install
  5. Usage
  6. Usual parameters to be adjusted:
  7. Parameters to customize editor:
  8. Internally used parameters. Don't change:
  9. Change users permissions
  10. Resources
  11. Help

FileEditor is a powerful multifile editor. Usefull for CMS projects.

Supported languages: bg, cs, de, dk, en, eo, es, fi, fr, hr, it, ja, mk, nl, pl, pt, ro, ru, sk, zn

Supported programming syntaxes: basic, brainfuck, c, coldfusion, cpp, css, html, java, js, pas, perl, php, python, robotstxt, ruby, sql, tsql, vb, xml

FileEditor use EditArea plug-in developed by Christophe Dolivet ( http://www.cdolivet.com ).

Extension is XHTML valid.

Update: Version 1.0.1 corected the bug: Can't create new file.

In FileeditorController, line 83, changed;

echo file_put_contents($_POST['directory'].DIRECTORY_SEPARATOR.$_POST['filename'], ""); to

echo file_put_contents(self::safe($_POST['directory'].'/'.$_POST['filename']), "");

WARNING: All versions prior v.1.0 have a severe security hole. Please update it as soon as possible to latest version.

Requirements

Tested with Yii 1.1.7.

Install

  • Download latest release package from Yii extensions repository
  • Unpack it.
  • Copy fileeditor folder in /protected/extensions/
  • Copy FileeditorController.php file under protected/controllers/
  • Copy logFileEditor.txt in your root and make it writable. You can customize this filename and path, but you must change it name and path in FileeditorController. Here will be registered some informations about any ilegal attempt to access other files than files from your public folders.
  • For test, copy files folder in the root's site and make it writable. In production you can use any folders.
  • Important: In every writable folder add a .htaccess file, containing deny from all text.

Usage

  • In your editor page, insert next code and adjust it properly to your necessities.
  • Open FileeditorController and put same editableFolders as value for $editableFolders. If someone know how this parameter could be imported from extension in controller , please let me know.
$this->widget('application.extensions.fileeditor.fileeditor', array(
    'editableFolders'=>array(
            array('path'=>"files/css", 'label'=>'CSS'),
            array('path'=>"files/codes/php", 'label'=>'PHP'),
    ),
    'options'=>array(
        'name'=>'editor',
        'class'=>'editor',
        'editorwidth'=> '910',
        'min_width'=>'910',
        'min_height'=>'500',
        'cols'=>100,
        'rows'=>30,
        'language'=>'en',
        'syntax'=> 'php',
        'allow_resize'=>'y',
        'is_editable'=>true,
        'word_wrap'=>'true',
        'allow_toggle'=>true,
        'start_highlight'=>true,
        'toolbar'=>'new, load, save, |, search, go_to_line, |, undo, redo, |, select_font, |, syntax_selection, |, change_smooth_selection, highlight, reset_highlight, word_wrap, |, help',
        'plugins'=>'new',
        'load_callback'=> 'loadFileEditor',
        'save_callback'=> 'saveFileEditor',
        'EA_load_callback'=>'setEditorId',
        'EA_file_close_callback'=>'closeFileEditor',
        'is_multi_files'=> true
        )
    )
);

Usual parameters to be adjusted:

  • editableFolders: a multidimensional array, which keep path and label for every editable folder.

READ NEXT:

For folder's path use relative paths to site root. Example: 'protected/views/site/pages' or files.

Label of folder must be unique and without slash or backslash. For labels, use short and suggestive names.

Important: In every writable folder you must add a .htaccess file, containing deny from all text to avoid external access to files.

Don't expose your sensitive folders to public access. For public access you use custom folders in which everybody can change anything.

Don't forget to make folders writable.

Parameters to customize editor:

  • name: id and name for textarea editor(change it only if there is another #editor element)
  • class: class for textarea editor(change it only if there is another .editor element)
  • editorwidth: width for editor (integer value without px)
  • min_width: minim width for editor (integer value without px)
  • min_height: minim height for editor (integer value without px)
  • cols: number of columns for textarea editor (integer value)
  • rows: number of rows for textarea editor (integer value)
  • language: language for editor. Available languages: bg, cs, de, dk, en, eo, es, fi, fr, hr, it, ja, mk, nl, pl, pt, ro, ru, sk, zn
  • syntax: default syntax for editor. Available syntaxes: basic, brainfuck, c, coldfusion, cpp, css, html, java, js, pas, perl, php, python, robotstxt, ruby, sql, tsql, vb, xml
  • allow_resize: permit editor to be resized. Available options: both, x, y
  • is_editable: set if editor is editabe or not(read-only)(boolean: true/false without quotes)
  • word_wrap: set if editor will use word wrap facility (boolean: true/false without quotes)
  • allow_toggle: add a checkbox to permit switch between editor and textarea (boolean: true/false without quotes)
  • start_highlight: set if editor use highlight as default (boolean: true/false without quotes)
  • toolbar: set toolbar elements
  • plugins: used to extend EditArea functionalities

Internally used parameters. Don't change:

  • load_callback: the callback used to load files
  • save_callback: the callback used to save files
  • EA_load_callback: the callback used when editor is loaded
  • EA_file_close_callback: the callback used when a file is closed
  • is_multi_files: set editor to accept more files to be opened at one time(boolean: true/false without quotes)

Change users permissions

To change users permissions, adjust settings in protected/controllers/FileeditorController.php, using Yii mode.

Resources

Help

Any suggestion is very appreciate.

If somebody can help me to improve this extension (to automate import $editableFolders value from extension to FileeditorController, to avoid double declaration), please contact me.

Please before comment here asking help, contact me using Contact form from project page. Thank you.

14 0
18 followers
1 093 downloads
Yii Version: 1.1
License: BSD-2-Clause
Category: User Interface
Tags: edit, Editor, files
Developed by: matricks
Created on: Sep 20, 2011
Last updated: 13 years ago

Downloads

show all

Related Extensions