Fields with * are mandatory

Dios - Do It Open Source

How to - fileeditor


  • 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.


In your editor page, insert next code and adjust it properly to your necessities.
Open FileeditorController and put same editableFolders as value for $editableFolders.

$this->widget('application.extensions.fileeditor.fileeditor', array(
          array('path'=>"files/css", 'label'=>'CSS'),
          array('path'=>"files/codes/php", 'label'=>'PHP'),
           'editorwidth'=> '910',
           'syntax'=> 'php',
           'toolbar'=>'new, load, save, |, search, go_to_line, |, undo, redo, |, select_font, |, syntax_selection, |, change_smooth_selection, highlight, reset_highlight, word_wrap, |, help',
           'load_callback'=> 'loadFileEditor',
           'save_callback'=> 'saveFileEditor',
           'is_multi_files'=> true

Usual parameters to be adjusted:

editableFolders: a multidimensional array, which keep in key/value format the path and the 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 will use custom folders, where 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 the user's permissions, adjust settings in protected/controllers/FileeditorController.php, using Yii mode.