Enabling FCKeditor File Browser in NopCommerce

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
15 years ago
Seems like a few people want this.

It would also be a good idea to remove the other connectors on the next release as only the aspx one is required.

1) Set the correct browser connector.

Open /fckeditor/fckconfig.js.

Change the lines:


var _FileBrowserLanguage  = 'php' ;  // asp | aspx | cfm | lasso | perl | php | py
var _QuickUploadLanguage  = 'php' ;  // asp | aspx | cfm | lasso | perl | php | py


to


var _FileBrowserLanguage  = 'aspx' ;  // asp | aspx | cfm | lasso | perl | php | py
var _QuickUploadLanguage  = 'aspx' ;  // asp | aspx | cfm | lasso | perl | php | py


2) Set resources directory (you can call the folder whatever you want providing it actually exists in your site - I use "~/Resources"):

In web.config, add the following between the <appSettings> nodes:

    <add key="FCKeditor:BasePath" value="~/fckeditor/"/>
    <add key="FCKeditor:UserFilesPath" value="~/Resources"/>

3) We then need to disable theming on the connectors as this will cause any error otherwise.

Open /fckeditor/editor/filemanager/connectors/aspx/connector.aspx

Add:


Theme="" StylesheetTheme=""


to the page directive <%@ Page.....%>.

Do the same for upload.aspx.

4)Finally we need to enable the connector as it is disabled by default.

Within the same directory open up config.ascx.

Instead of returning false on the CheckAuthentication() function , change to the following:


  private bool CheckAuthentication()
  {
    // WARNING : DO NOT simply return "true". By doing so, you are allowing
    // "anyone" to upload and list the files in your server. You must implement
    // some kind of session validation here. Even something very simple as...
    //
    //    return ( Session[ "IsAuthorized" ] != null && (bool)Session[ "IsAuthorized" ] == true );
    //
    // ... where Session[ "IsAuthorized" ] is set to "true" as soon as the
    // user logs in your system.

        return HttpContext.Current.User.IsInRole("Admin");
  }


Admins you may have a better suggestion for checking auth using the NopCommerce membership provider?

Thats it.

Try going to a Product Detail, select the picture button and click browse server. It should work.

Regards,

Ben
15 years ago
Great post.

I guess adding:
return NopContext.Current.User.IsAdmin;
is secure enough.

Daniel
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.