Forums / General / ezmultiupload extension in 4.0.1

ezmultiupload extension in 4.0.1

Author Message

John Smith

Thursday 27 May 2010 4:36:32 am

Hi guys,

Hope you can help me. I know ezmultiupload extension does not work in 4.0.1 due to ezSession class.

Is there any way I can update my 4.0.1 install quickly to make the extension work only for the public website?

Any idea about which files I need to download from svn? Some guys already made it working

http://projects.ez.no/ezmultiupload/reviews/works_slick_on_4_0_x_stable_svn

André R.

Thursday 27 May 2010 10:56:41 am

Here are some patches to get you started:

ezmultiupload:

Index: modules/ezmultiupload/upload.php
===================================================================
--- modules/ezmultiupload/upload.php (revision 94)
+++ modules/ezmultiupload/upload.php (working copy)
@@ -101,7 +101,12 @@
     $tpl->setVariable( 'file_types', $availableFileTypesStr );
     $tpl->setVariable( 'session_id', session_id() );
     $tpl->setVariable( 'session_name', session_name() );
-    $tpl->setVariable( 'user_session_hash', eZSession::getUserSessionHash() );
+
+    if ( class_exists( 'eZSession', false ) )
+        $tpl->setVariable( 'user_session_hash', eZSession::getUserSessionHash() );
+    else
+        $tpl->setVariable( 'user_session_hash', 'a2e4822a98337283e39f7b60acf85ec9' );
+
     $tpl->setVariable( 'parent_node', $parentNode );

     // Process template and set path data

eZ Publish:

Index: lib/ezutils/classes/ezsession.php
===================================================================
--- lib/ezutils/classes/ezsession.php (revision 24978)
+++ lib/ezutils/classes/ezsession.php (working copy)
@@ -330,6 +330,18 @@
         }
         session_name( $sessionName );
     }
+    else
+    {
+        $sessionName = session_name();
+    }
+
+    // Allow session bye post params for use by flash, but use $_POST directly
+    // to avoid session double start issues ( #014686 ) caused by eZHTTPTool
+    if ( isset( $_POST[ $sessionName ] ) && isset( $_POST[ 'UserSessionHash' ] ) )
+    {
+        // First use session id from post params (for use in flash upload)  
+        session_id( $_POST[ $sessionName ] );
+    }
     session_set_save_handler(
         'ezsessionopen',
         'ezsessionclose',

eZ Online Editor 5: http://projects.ez.no/ezoe || eZJSCore (Ajax): http://projects.ez.no/ezjscore || eZ Publish EE http://ez.no/eZPublish/eZ-Publish-Enterprise-Subscription
@: http://twitter.com/andrerom

John Smith

Friday 28 May 2010 3:25:02 am

Cheers Andre,

It seems to be working now. No errors, thankyou very much....

The only thing which I have noticed is that sometimes on the "Multiupload" page system displays the thumbnails of the pictures just uploaded, sometimes it does not.

There is no problem with the gallery page.

Is there any settings I am missing?

Neo Pixel

Monday 28 June 2010 2:30:59 pm

"

Here are some patches to get you started:

ezmultiupload:

Index: modules/ezmultiupload/upload.php
===================================================================
--- modules/ezmultiupload/upload.php<span> </span>(revision 94)
+++ modules/ezmultiupload/upload.php<span> </span>(working copy)
@@ -101,7 +101,12 @@
     $tpl->setVariable( 'file_types', $availableFileTypesStr );
     $tpl->setVariable( 'session_id', session_id() );
     $tpl->setVariable( 'session_name', session_name() );
-    $tpl->setVariable( 'user_session_hash', eZSession::getUserSessionHash() );
+
+    if ( class_exists( 'eZSession', false ) )
+        $tpl->setVariable( 'user_session_hash', eZSession::getUserSessionHash() );
+    else
+        $tpl->setVariable( 'user_session_hash', 'a2e4822a98337283e39f7b60acf85ec9' );
+
     $tpl->setVariable( 'parent_node', $parentNode );

     // Process template and set path data

eZ Publish:

Index: lib/ezutils/classes/ezsession.php
===================================================================
--- lib/ezutils/classes/ezsession.php<span> </span>(revision 24978)
+++ lib/ezutils/classes/ezsession.php<span> </span>(working copy)
@@ -330,6 +330,18 @@
         }
         session_name( $sessionName );
     }
+    else
+    {
+        $sessionName = session_name();
+    }
+
+    // Allow session bye post params for use by flash, but use $_POST directly
+    // to avoid session double start issues ( #014686 ) caused by eZHTTPTool
+    if ( isset( $_POST[ $sessionName ] ) && isset( $_POST[ 'UserSessionHash' ] ) )
+    {
+        // First use session id from post params (for use in flash upload)  
+        session_id( $_POST[ $sessionName ] );
+    }
     session_set_save_handler(
         'ezsessionopen',
         'ezsessionclose',
"

Hi Andre,

Do I just add these patches to the code that's already there?

I don't want to break it!

thanks

Asking stupid questions so you don't have to!

André R.

Wednesday 07 July 2010 3:51:46 am

These are diff files, if they apply cleanly, then you should be safe. If they don't, you should apply it manually locally on a install first, before you put it on production server. But remember that this is 4.0.x patches only, no need to use them on 4.1+ installs.

eZ Online Editor 5: http://projects.ez.no/ezoe || eZJSCore (Ajax): http://projects.ez.no/ezjscore || eZ Publish EE http://ez.no/eZPublish/eZ-Publish-Enterprise-Subscription
@: http://twitter.com/andrerom

Neo Pixel

Sunday 11 July 2010 8:03:22 am

Hi Andre,

My apologies for being a bit dense but I don't see where to put these patches of code within the files... are you saying these replace all the code or just bits of it in the original files???

Can you please post 4.0.1 code for both with the patches applied?

I'd really appreciate it.

Thanks :)

Asking stupid questions so you don't have to!

André R.

Tuesday 13 July 2010 2:41:50 pm

> Can you please post 4.0.1 code for both with the patches applied?

You really should learn to work with diff files if you want to backport features, so here are the two options:

The proper way is to checkout eZ Publish stable/4.0 from svn or git and apply the patche using:
patch -p0 < <patch-file>
Where <patch-file> is path to your saved patch file (with .diff file ending), and make sure you remvoe the <span> tags that this forum seems to add to the source code.
Then same approach with multiupload.

Alternatively you can do it manually, this way you don't need to have a svn/git checkout, you easily see on the first 4 lines which file i being changed, and on line 5 you see the line number where the patch sequence begins, after that it's just a matter of removing lines starting with - and adding lines that start with +.

I have done this for you for 4.0, you can download file and replace with view file -> raw:

http://github.com/andrerom/ezpublish/commit/6f15634c44d520b4358e5334ba302481abe2597c#diff-0

For ezmultiupload, you'll have to do it yourself (do you work with anyone that has experience with working with patches?) as I don't have a handy fork to place it in.
The file affected is extension/ezmultiupload/modules/ezmultiupload/upload.php

eZ Online Editor 5: http://projects.ez.no/ezoe || eZJSCore (Ajax): http://projects.ez.no/ezjscore || eZ Publish EE http://ez.no/eZPublish/eZ-Publish-Enterprise-Subscription
@: http://twitter.com/andrerom

Neo Pixel

Wednesday 18 August 2010 3:53:53 am

Thank you so much I really appreciate your help.

I'll try this out later.

Asking stupid questions so you don't have to!