Welcome Guest, Not a member yet? Register   Sign In
fckeditor with codeigniter
#1

[eluser]crwtrue[/eluser]
I used these instruction to include fckeditor with my codeigniter application:
http://ellislab.com/forums/viewthread/107642/

I changed the toolbarset to default and changed in the filemanager config:

$Config['Enabled'] = true ;
$Config['UserFilesPath'] = '/home/example/images' ;

To enable user to upload a picture but could these be done in the ci application controller?

Second question is that i save the users "webpage" in text-field in mysql table.
What i sould do to the user input to make it safe(example.mysql injection) for the database?
#2

[eluser]umefarooq[/eluser]
Answer for your second question just enable global_xss_filtering TRUE in config.php file
#3

[eluser]LuckyFella73[/eluser]
[quote author="crwtrue" date="1251712459"]

...
To enable user to upload a picture but could these be done in the ci application controller?
[/quote]
You can use the file uploading class provided by codeigniter.
Have a look at the http://ellislab.com/codeigniter/user-gui...ading.html

Quote:Second question is that i save the users "webpage" in text-field in mysql table.
What i sould do to the user input to make it safe(example.mysql injection) for the database?
Additionally to xss filtering use the active record class, then all data saved into
the database is escaped automaticly.
#4

[eluser]crwtrue[/eluser]
Quote:You can use the file uploading class provided by codeigniter.
Have a look at the http://ellislab.com/codeigniter/user-gui...ading.html

How can i do this? Sould i change the FileUpload-function call in the fckeditor/editor/filemanager/connectors/php/upload.php to ci's $this->upload->do_upload?

but can i even use upload-class in those fckeditor-scripts?
#5

[eluser]LuckyFella73[/eluser]
What I meant was you can disable the file upload module from fck editor
(or better: just enable the textarea replacement) and send the form
as usual to your controler/method where the form validation and fileupload runs.
That is at least the way I do it. I never tried the supplied file upload
functions comming with this rte tools - it's just that I like to know what
happens uploading a file and I'm not familiar with these libraries in detail.
#6

[eluser]crwtrue[/eluser]
Quote:just enable the textarea replacement

What that means? and how i do it?

About the fileupload i can change the form to an multipart() and add input file field but
then using the fckeditor aint the same cause the picture is allways in the same place.
Could i make fckeditor to use codeigniter upload-class?

Also when i used fckeditor upload it allways changed file permissions for the uploaded image.
In the fckeditor filemanager config there was properties to change those uploaded file permisions but they only worked with apache not IIS.

Also in fckeditor filemanager config there are the options:

$Config['UserFilesPath'] = '/userfiles/' ; <- i changed this to upload images folder

$Config['UserFilesAbsolutePath'] = '' ; <- sould i change this to somethink?

I am asking cause when i click the browse server button in fckeditor add image option fckeditor creates a folder and maybe that is causing those file permissions?
#7

[eluser]LuckyFella73[/eluser]
hi crwtrue,

like posted before I have no experience with uploading file via
fckeditor. In a project I did a while ago I had this js in my
header:
Code:
[removed][removed]
    <s+c+r+i+pt type="text/j+a+v+a+s+c+r+i+p+t">
window.onload = function()
{
    // Automatically calculates the editor base path based on the _samples directory.
    // This is usefull only for these samples. A real application should use something like this:
    // oFCKeditor.BasePath = '/fckeditor/' ;    // '/fckeditor/' is the default value.
    //var sBasePath = document.location.href.substring(0,document.location.href.lastIndexOf('_samples')) ;

    var teaser_editor = new FCKeditor('teaser');
    teaser_editor.ToolbarSet = 'mkb_slim';
    teaser_editor.BasePath    = '&lt;?php echo(base_url());?&gt;javascript/fckeditor/' ;
    teaser_editor.ReplaceTextarea() ;
}
</s+c+r+i+p+t>

The effect is that all form elements type textarea become a rich-text-editor.
Thats all I needed that time. "mkb_slim" is a manually defined toolbarset I
defined. You could take a standard toolbarset privided with the donwnload
package. Additionally I had an input field type "file" and sent the form to
my controller using the CI fileupload class. I don't know if you can modify
fck editor to use the CI upload class but even if you want to do that there
is no reason to modify because you can just use the CI upload class. Or did
I misunderstand you?

Have a look at the fck docs - here is a link how to set up fck editor 2.x:
http://docs.fckeditor.net/FCKeditor_2.x/...JavaScript




Theme © iAndrew 2016 - Forum software by © MyBB