Announcement

Do not use the forums to submit bug reports, feature requests or patches, submit a New Ticket instead.

#1 2006-09-06 14:44:26

louDogg
New member
Registered: 2006-08-23
Posts: 9

ImageManager

I'm trying to install the imagemanager and things are not going well.  When I click on the image button this is the message that comes up. "Backend security error.".  Here is my code.
    xinha_editors = null;
    xinha_init    = null;
    xinha_config  = null;
    xinha_plugins = null;

    // This contains the names of textareas we will make into Xinha editors
    xinha_init = xinha_init ? xinha_init : function()
    {
      /** STEP 1 ***************************************************************
       * First, what are the plugins you will be using in the editors on this
       * page.  List all the plugins you will need, even if not all the editors
       * will use all the plugins.
       *
       * The list of plugins below is a good starting point, but if you prefer
       * a must simpler editor to start with then you can use the following
       *
       * xinha_plugins = xinha_plugins ? xinha_plugins : [ ];
       *
       * which will load no extra plugins at all.
       ************************************************************************/

      xinha_plugins = xinha_plugins ? xinha_plugins :
      [
       'FullScreen', 'ImageManager', 'PasteText'
      ];
             // THIS BIT OF JAVASCRIPT LOADS THE PLUGINS, NO TOUCHING  smile
             if(!HTMLArea.loadPlugins(xinha_plugins, xinha_init)) return;

      /** STEP 2 ***************************************************************
       * Now, what are the names of the textareas you will be turning into
       * editors?
       ************************************************************************/

      xinha_editors = xinha_editors ? xinha_editors :
      [
        'textArea'
      ];

      /** STEP 3 ***************************************************************
       * We create a default configuration to be used by all the editors.
       * If you wish to configure some of the editors differently this will be
       * done in step 5.
       *
       * If you want to modify the default config you might do something like this.
       *
       *   xinha_config = new HTMLArea.Config();
       *   xinha_config.width  = '640px';
       *   xinha_config.height = '420px';
       *
       *************************************************************************/

       xinha_config = xinha_config ? xinha_config() : new HTMLArea.Config();
       
       <?php
        session_start();
        $IMConfig = array();
        $IMConfig['images_dir'] = '/var/www/html/new_site/pics/';
        $IMConfig['images_url'] = 'http://www.test.com/new_site/pics';
        $IMConfig = serialize($IMConfig);
        if(!isset($_SESSION['Xinha:ImageManager']))
        {
          $_SESSION['Xinha:ImageManager'] = uniqid('secret_');
        }
       
        function jsaddslashes($s){
         $o="";
         $l=strlen($s);
         for($i=0;$i<$l;$i++){
          $c=$s[$i];
          switch($c){
           case '<': $o.='\\x3C'; break;
           case '>': $o.='\\x3E'; break;
           case '\'': $o.='\\\''; break;
           case '\\': $o.='\\\\'; break;
           case '"':  $o.='\\"'; break;
           case "\n": $o.='\\n'; break;
           case "\r": $o.='\\r'; break;
           default:
           $o.=$c;
          }
         }
         return $o;
        }
               
       ?>

       xinha_config.ImageManager.backend_config = '<?php echo jsaddslashes($IMConfig)?>';
       xinha_config.ImageManager.backend_config_hash = '<?php echo sha1($IMConfig . $_SESSION[\'Xinha:ImageManager\'])?>';
         
       xinha_config.pageStyle = "@import url(http://www.test.com/new_site/custom.css);";
     
      /** STEP 4 ***************************************************************
       * We first create editors for the textareas.
       *
       * You can do this in two ways, either
       *
       *   xinha_editors   = HTMLArea.makeEditors(xinha_editors, xinha_config, xinha_plugins);
       *
       * if you want all the editor objects to use the same set of plugins, OR;
       *
       *   xinha_editors = HTMLArea.makeEditors(xinha_editors, xinha_config);
       *   xinha_editors['myTextArea'].registerPlugins(['Stylist','FullScreen']);
       *   xinha_editors['anotherOne'].registerPlugins(['CSS','SuperClean']);
       *
       * if you want to use a different set of plugins for one or more of the
       * editors.
       ************************************************************************/

      xinha_editors   = HTMLArea.makeEditors(xinha_editors, xinha_config, xinha_plugins);
     

      /** STEP 5 ***************************************************************
       * If you want to change the configuration variables of any of the
       * editors,  this is the place to do that, for example you might want to
       * change the width and height of one of the editors, like this...
       *
       *   xinha_editors.myTextArea.config.width  = '640px';
       *   xinha_editors.myTextArea.config.height = '480px';
       *
       ************************************************************************/
      

      /** STEP 6 ***************************************************************
       * Finally we "start" the editors, this turns the textareas into
       * Xinha editors.
       ************************************************************************/

      HTMLArea.startEditors(xinha_editors);
    }

    window.onload = xinha_init;

Offline

#2 2006-09-13 05:27:43

gogo
Xinha Leader
From: New Zealand
Registered: 2005-02-11
Posts: 1,015
Website

Re: ImageManager

Search the forums.


James Sleeman

Offline

#3 2006-09-13 15:29:18

koto
Xinha Pro
Registered: 2006-01-09
Posts: 58

Re: ImageManager

Hi!

New changes have been just commited to Xinha related to the problem - they are available from Subversion trunk (don't know if nighly built reflects them now).

There is now better, simpler and less error-prone way to pass configuration to backend for Linker,ImageManager and ExtendedFileManager plugins. See this and this for details.

The changes are also available in ExtendedFileManager plugin.

Cheers,
Chris Kotowicz

Last edited by koto (2006-09-13 15:31:03)

Offline

#4 2006-09-13 16:30:19

louDogg
New member
Registered: 2006-08-23
Posts: 9

Re: ImageManager

Thanks for the help

Offline

Board footer

Powered by FluxBB