glFusion Wiki

Site Tools


glfusion:development:api:advanced_editor:start

Integrating the Advanced Editor into a Plugin

glFusion include the FCKeditor to provide WYSIWYG editing capabilities.

Uploading Image Files with the Advanced Editor

By default, the upload connector in the advanced editor is disabled. When the editor is started, a check is made to see if a cookie is set using the name $_CONF['cookie_name'].'fckeditor'. The value of this cookie is a security token. The security token is then validated to ensure it has not expired and matches the token created when the user started the editor. If the check is OK, then the upload connector is enabled.

Prior to calling the page output, the cookie can be set using this code:

@setcookie ($_CONF['cookie_name'].'fckeditor', SEC_createTokenGeneral('advancededitor'),
  time() + 1200, $_CONF['cookie_path'],
  $_CONF['cookiedomain'], $_CONF['cookiesecure']);

The advanced editor then does the following check:

$cookiename = $_CONF['cookie_name'].'fckeditor';
if ( isset($_COOKIE[$cookiename]) ) {
    $token = $_COOKIE[$cookiename];
} else {
    $token = '';
}

if (SEC_checkTokenGeneral($token,'advancededitor')) {
    $Config['Enabled'] = true;
} else {
    $Config['Enabled'] = false;
}
glfusion/development/api/advanced_editor/start.txt · Last modified: 2017/04/12 21:15 (external edit)

Page Tools