Announcement

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

#1 2005-08-19 15:11:47

ianw
New member
Registered: 2005-08-19
Posts: 2

Another ImageManager question

Hello all,

I am trying to get imagemanger set up on my system where i have dynamic image libraries depending on the user. i have it set up like how the wiki says, i have the config.js file changed to config.php, and variables passed in for the directories, like this:
       

 
       .....
       xinha_config = xinha_config ? xinha_config() : new HTMLArea.Config();
       
    <?php 
    $IMConfig = array();
        $IMConfig['images_dir'] = $absPath.'/img/';
        $IMConfig['images_url'] = $relPath.'/img/';
        $IMConfig = serialize($IMConfig);

        if(!isset($_SESSION['Xinha:ImageManager'])) 
        {
          $_SESSION['Xinha:ImageManager'] = uniqid('secret_');
        }
    ?>

       xinha_config.ImageManager.backend_config      
         = '<?php echo jsaddslashes($IMConfig)?>';
       xinha_config.ImageManager.backend_config_hash 
         = '<?php echo sha1($IMConfig . $_SESSION['Xinha:ImageManager'])?>';
       ....

It seems to be fine, but when i test it and open up imagemanager, i get the backend security error. the directories are generated right when i view source, so that is not a problem. is there any other config i have to do in the plugins config file or elsewhere? thanks for the help.

Offline

#2 2005-08-20 00:39:05

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

Re: Another ImageManager question

I don't see a session_start(); call there anywhere.  If you don't have one, put it right before $IMConfig = array();


James Sleeman

Offline

#3 2005-08-20 00:45:21

MySchizoBuddy
Xinha Community Member
Registered: 2005-08-17
Posts: 22

Re: Another ImageManager question

don't u actually have to use the other php code as well

        <?php
        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;
        }
        ?>

I placed this code right before

xinha_config.ImageManager.backend_config      
         = '<?php echo jsaddslashes($IMConfig)?>';

becasue it is called by it
and yeah I'm having the same backend security error


gogo the documentation of imagemanager doesn't say anything about session_start() call,
what ianw is doing is exactly what the documentation has. :S are we missing something.

plus the path to ur images folder. can u give me an example. this images folder is the one inside the Xinha directory. can i use my uploads folder that is outside xinha directory.

here is my directory structure
www
--blog
----uploads
----plugins
------serendipity_event_xinha
--------xinha-nightly
-----------plugins

etc.


my url is pointed to the blog folder. so if i do http://myschizobuddy.com i see content of blog folder.
So what should the paths be.

Last edited by MySchizoBuddy (2005-08-20 00:58:40)

Offline

#4 2005-08-20 04:11:18

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

Re: Another ImageManager question

Yes you should also use jsspecialchars (or your own equivalent).  session_start() is required in order before you can use $_SESSION in PHP (and have it actually work).  You can use a folder anywhere you want, provided your server doesn't have safe_mode or base_dir restrictions enabled.


James Sleeman

Offline

#5 2005-08-20 06:09:37

MySchizoBuddy
Xinha Community Member
Registered: 2005-08-17
Posts: 22

Re: Another ImageManager question

ok this is what i have

<?php
        session_start();
        $IMConfig = array();
        $IMConfig['images_dir'] = $absPath.'/uploads/';;
        $IMConfig['images_url'] = $relPath.'/uploads/';
        $IMConfig = serialize($IMConfig);
        if(!isset($_SESSION['Xinha:ImageManager'])) 
        {
          $_SESSION['Xinha:ImageManager'] = uniqid('secret_');
        }
?>

<?php
        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'])?>';

I'm still getting backend security error.
my html output is

xinha_config.ImageManager.backend_config = 'a:2:{s:10:\"images_dir\";s:9:\"/uploads/\";s:10:\"images_url\";s:9:\"/uploads/\";}';
xinha_config.ImageManager.backend_config_hash = 'a23ccbfedef329abb76b60f460e1b20e8de5e714';

can anyone post there directory structure and the code. I'm still confused at the paths.

Last edited by MySchizoBuddy (2005-08-20 06:12:41)

Offline

#6 2005-08-20 11:32:01

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

Re: Another ImageManager question

Post the url to your config.js and to a phpinfo.php file (file containing <?php phpinfo(); ?>) on your server.


James Sleeman

Offline

#7 2005-08-20 22:30:37

MySchizoBuddy
Xinha Community Member
Registered: 2005-08-17
Posts: 22

Re: Another ImageManager question

here is my phpinfo
I do not have config.js file. I have all my code in one php file. I'm making xinha plugin to work with s9y and the config.js method does not work at all.

Last edited by MySchizoBuddy (2005-08-20 22:31:07)

Offline

#8 2005-08-22 17:14:19

ianw
New member
Registered: 2005-08-19
Posts: 2

Re: Another ImageManager question

I have the session_start() earlier on in the script, and the jssaddslashes function. is there anything that should be modified in the config.inc.php file in the imagemanager plugin folder?

Offline

Board footer

Powered by FluxBB