forum.coppermine-gallery.net

Support => cpg1.5 bridging => cpg1.5.x Support => cpg1.5 bridge contributions => Topic started by: extrabigmehdi on March 18, 2009, 11:02:53 pm

Title: Bridge for Joomla 1.5 ready
Post by: extrabigmehdi on March 18, 2009, 11:02:53 pm
hi,
I've just recently adapted my bridge for Joomla 1.5 to work with cpg 1.5.

I've managed to make it work without any hacks on Coppermine core files
People can grab the bridge , and test it from here:

EDIT:
link to bridge has changed to
http://www.mehdiplugins.com/misc/index.htm

No attachments as I  prefer to keep stuff I  distribute on my website, sorry.


Title: Re: Bridge for Joomla 1.5 ready
Post by: François Keller on March 19, 2009, 06:53:09 am
Quote
I've managed to make it work without any hacks on Coppermine core files
it's a good new, thank's i'll test it
Title: Re: Bridge for Joomla 1.5 ready
Post by: Joachim Müller on March 19, 2009, 07:44:35 am
Excellent news.
The best thing is that no fiddling with core files is needed and that the visual integration is done using a plugin. Excellent. What license do the bridge and the plugin come with? I couldn't find reference to a particular license in the bundle. Are we allowed to bundle the plugin and the bridge file with the package, i.e. are those two components under GNU GPL or a compatible license? Of course your inline credits would remain and additionally you would be credited both in the readme as well as the coppermine site.
If those two components (bridge & plugin) would be shipped with coppermine, people would just have to copy the component into Joomla (step one of your instructions) - that would be very easy.
There's a lot of need in the community for an official Joomla-bridge in my opinion. Anything that makes integration easier is very welcome imo.
Thanks again, Mehdi. I'm looking forward to your reply. I really would love to see your compoments go into the core. Please answer as soon as you can.

Joachim
Title: Re: Bridge for Joomla 1.5 ready
Post by: extrabigmehdi on March 19, 2009, 02:50:57 pm
hi,
Quote
The best thing is that no fiddling with core files is needed and that the visual integration is done using a plugin
I must admit that enabling / disabling visual integration through Coppermine admin panel  is quite convenient.
It's only recently that I've understood how Coppermine plugin work (partly because of lack of examples in package) , but I  don't have courage/time to re-apply this enhancement to previous bridge (and update all instructions etc..). Maybe later.

Quote
I couldn't find reference to a particular license in the bundle.
I'm not a specialist of all open source license available. But officially I announce all my stuff as GPL2 on Joomla extension website.

Quote
Are we allowed to bundle the plugin and the bridge file with the package
I'm sorry  :-\, but I'm making few bucks with the ads on my website, and hence I do not wish.
Moreover, I  update from time to time  files on my website , if this can help to solve/bypass issues.
However I can change my mind if the average user perceive this too much  as an annoyance,
or if ever I'm not able one day to ensure proper distribution of these files.

I  would also add , that user might still want to edit the $joomQS setting in  joomla15.inc.php file of the bridge.
This is basically the query string passed to joomla before calling it. The reason is that the bridge cannot guess to which joomla's menu item, the user wish to associate coppermine,when enabling visual integration (by default, no menu item)  .If user could decide the  $joomQS  setting from the bridge manager this would be nice. Why the available settings in bridge manager are not just simply customizable ?

Concerning the code used in my bridge, I guess I'm not respecting the "spirit" of the  "Inspekt package" . I  got
to access directly to stored superglobals with "_source" property  (especially $COOKIE) before calling Joomla .
Title: Re: Bridge for Joomla 1.5 ready
Post by: Joachim Müller on March 20, 2009, 11:53:46 am
I'm sorry  :-\, but I'm making few bucks with the ads on my website, and hence I do not wish.
That's why I suggested to bundle only the plugin and the bridge file with the release. Users would still have to visit your site to get the stuff that needs to go into the joomla folder. It would just mean that things are less confusing for newbies who have issues even copying files and folders into the correct location.
It's no taboo to discuss the final step of the bridge manager.
Another possible way would be to force end users to visit your site by giving out API keys (similar to what wordpress and akismet are doing) and performing a check against the API key in the bridge manager. This way, you could force the end user to visit your site as well. Imo your request is legitimate to force people to visit your site. My focus lies on two things: bundle the core bridge component with coppermine, so that the coppermine documentation could as well say that there is bridging support for Joomla. This way, much more users would learn about your bridge file imo.

Concerning the code used in my bridge, I guess I'm not respecting the "spirit" of the  "Inspekt package" . I  got
to access directly to stored superglobals with "_source" property  (especially $COOKIE) before calling Joomla .
Why do you do that? That's not a bright move imo - you're deliberately ruining the additional security that is created by using Inspekt. Why do you re-globalize all of them instead of just looking up the ones you actually need and populating your variable scope with just the needed stuff? The idea behind using Inspekt is that you deliberately need to "ask" for particular superglobals instead of allowing them blindly. This is suppossed to help prevent vulnerabilities that used to creep in previously because of sloppy coding.
Title: Re: Bridge for Joomla 1.5 ready
Post by: extrabigmehdi on March 20, 2009, 02:29:29 pm
hi Joachim,
Quote
That's why I suggested to bundle only the plugin and the bridge file with the release. Users would still have to visit your site to get the stuff that needs to go into the joomla folder.
The joomla component is very basic. All it does is displaying the {COPPERMINE_TEMPLATE_HTML} tag inside Joomla.
This way the bridge can capture Joomla output and replace this tag, by the output of the gallery.
There's even a way to use no joomla component at all, it just might be more complicated to explain.

Quote
Another possible way would be to force end users to visit your site by giving out API keys (similar to what wordpress and akismet are doing) and performing a check against the API key in the bridge manager. This way, you could force the end user to visit your site as well. Imo your request is legitimate to force people to visit your site.
well that's a bit a weird solution.  At least when people visit website they take few minutes to read some instruction.
All of this looks like a dumb problem  :-[...  Probably I  should write true interesting articles, instead of giving away  stuff, and then expecting people to come back.

Quote
This way, much more users would learn about your bridge file imo.
Lot of people already know it I  think.
But I  guess people will adopt it more easily if it's officially supported by  Coppermine.

Quote
Why do you do that? That's not a bright move imo - you're deliberately ruining the additional security that is created by using Inspekt.
I'm not ruining the security introduced by Inspeckt at all.
But you have to be aware of the logic the bridge, that's why I bring this to your attention.
I  proceed this way:
1- restore some superglobals
2- call the full joomla install (yep, joomla included like a 'vulgar'  script).
3- destroy again superglobals.

Because I  cannot predict how Joomla will handle all superglobals (that's a big CMS), I'm just giving it  all the superglobals it can expect. In a similar way, Joomla destroy all globals at begin, and I have to bypass this otherwise all Coppermine globals  will be destroyed and it won't work.

I think I've done my best regarding security , just be aware that the bridge is  a different "beast". Joomla and Coppermine,
are both handling in different way security,  and I'm just ensuring that security solutions adopted by both script is not breaking logic adopted by my bridge.

"Final problem", I currently know: Coppermine & Joomla are using same class PHPMailer. Usually Joomla doesn't load by default the
class PHPMailer, and hence no conflict occurs. But I  got once a user complaining that a conflict occured .

I've told  more or less all the potential problems.
Once you understand that the full Joomla install is included inside Coppermine by the bridge, you should realize all that it implies.
Title: Re: Bridge for Joomla 1.5 ready
Post by: Joachim Müller on March 20, 2009, 06:13:18 pm
Thanks for your patience to explain all those things to me. I must confess that I'm a complete novice when it comes to Joomla, so please bare with me.

"Final problem", I currently know: Coppermine & Joomla are using same class PHPMailer. Usually Joomla doesn't load by default the
class PHPMailer, and hence no conflict occurs. But I  got once a user complaining that a conflict occured .
This should be pretty easy to solve: we can savely rename "our" class or wrap it inside a if (!function_exists('function_name') {-construct.

I'll do that this weekend.

Joachim
Title: Re: Bridge for Joomla 1.5 ready
Post by: phill104 on March 20, 2009, 07:25:51 pm
extrabigmehdi

I'd like to thank you for excellent bridge. It is the only one that works well and as such I have been using it for a long time now. It is so good to see that you are continuing development to coppermine 1.5 as I would be lost without your efforts. This bridge  should enable a lot more users to integrate Coppermine and Joomla where before many struggled to apply the code changes. Keep up the good work.

As for people visiting your site, I'm sure people will still visit simply to get their themes sorted with your css integrator ( http://www.mehdiplugins.com/misc/cssintegrator.htm ), and get instructions on getting their themes to work properly. I'm sure if you included these links in the plugins details then you could increase traffic to your site.
Title: Re: Bridge for Joomla 1.5 ready
Post by: Nibbler on March 20, 2009, 07:32:33 pm
This should be pretty easy to solve: we can savely rename "our" class or wrap it inside a if (!function_exists('function_name') {-construct.

Renaming is safer. We don't want to end up using Joomla's copy of the class instead of our own.
Title: Re: Bridge for Joomla 1.5 ready
Post by: Joachim Müller on March 21, 2009, 01:24:04 pm
It should be safe to just rename the class, right?
Editing include/mailer.inc.php, finding
Code: [Select]
$mail = new PHPmailer();and replacing that string with
Code: [Select]
$mail = new cpg_PHPmailer();Then find
Code: [Select]
class PHPMailer {and replace with
Code: [Select]
class cpg_PHPMailer {Taking a closer look: we have another class named SMTP that might be there two times, so we'd have to rename that as well.

We don't want to end up using Joomla's copy of the class instead of our own.
Why not? They use PHPmailer as well. Couldn't we just wrap the two classes into corresponding if (!class_exists('class_name') {-code and get away with that? After all, the users of the joomla bridge warp "our" gallery into an entire CMS - the CMS should know what it is doing anyway.
Title: Re: Bridge for Joomla 1.5 ready
Post by: extrabigmehdi on March 21, 2009, 01:55:54 pm
@Joachim Müller ,
Quote
I must confess that I'm a complete novice when it comes to Joomla, so please bare with me.
For your information, Joomla! has a small learning curve. It's currently the easiest CMS to use (with its "predecessor" Mambo).
And also it has quite enough flexibility for most people. I think even Microsoft is annoyed by Joomla, since recently I saw an article bashing Joomla! (http://www.itworldcanada.com/Pages/Docbase/ViewArticle.aspx?ID=idgml-3bf489e1-05db-458a-8482-bbd5af38f51b&Portal=252cc78a-a947-4072-84be-f50cac8ec48e&ParaStart=-2&ParaEnd=8&direction=next&News=Daily+ITwire&Next=Next) , but full of lies (and answer (http://community.joomla.org/blogs/community/770-my-response-to-it-world-canada-post-qmicrosoft-sweet-er-than-open-sourceq.html) by "Joomla community"). So now you should  be curious, and try it   ...  ;)

@Phill Luckhurst
Quote
It is so good to see that you are continuing development to coppermine 1.5 as I would be lost without your efforts.
Fortunately, it was easy enough  for me to port old bridge to new version of CPG 1.5 .  I've heard that the release of CPG 1.5  might be imminent, so I  tried to release bridge a  bit in advance. 

Quote
I'm sure if you included these links in the plugins details then you could increase traffic to your site.
For the moment I don't have the mind to think about this. Even if the bridge is included in Coppermine package, it might need to be updated.
Just recently I've added for instance a better support for community builder users (no more hacks for them).

About the PHPMailer issue:
I've noticed some difference between the class used by Joomla & Coppermine.
Joomla: version used is 1.73, and charset utf-8.
Coppermine: version used is 2.0.3 ,  and charset iso-8859-1

Anyway it's a relatively  minor issue, since lot of people used before  my bridge, and only one user reported by mail he got a problem.
I hope no other class/function conflict will be discovered.
Title: Re: Bridge for Joomla 1.5 ready
Post by: Nibbler on March 21, 2009, 03:08:30 pm
It should be safe to just rename the class, right?
Editing include/mailer.inc.php, finding
Code: [Select]
$mail = new PHPmailer();and replacing that string with
Code: [Select]
$mail = new cpg_PHPmailer();Then find
Code: [Select]
class PHPMailer {and replace with
Code: [Select]
class cpg_PHPMailer {Taking a closer look: we have another class named SMTP that might be there two times, so we'd have to rename that as well.

Yes, both need renaming.

Why not? They use PHPmailer as well. Couldn't we just wrap the two classes into corresponding if (!class_exists('class_name') {-code and get away with that? After all, the users of the joomla bridge warp "our" gallery into an entire CMS - the CMS should know what it is doing anyway.

Our copy has changes for Inspekt plus an additional SMTP bugfix that's not in the official PHPMailer release. Theirs probably has changes too. Plus the fact that we may ship totally different versions of the class to each other. It's just asking for trouble to blindly use code we don't control.
Title: Re: Bridge for Joomla 1.5 ready
Post by: Joachim Müller on March 22, 2009, 12:22:18 pm
OK, so it's the renaming-schedule. I'm not sure about the impact of renaming the smtp class though, and I currently can not test SMTP. Should we just blindly change without testing or do you have the opportunity to test a renamed SMTP class?
Title: Re: Bridge for Joomla 1.5 ready
Post by: extrabigmehdi on March 22, 2009, 01:03:02 pm
@Joachim,
I think renaming will have zero impact on how Coppermine works.
I just made a search though all Coppermine files,  and the string "PHPmailer"
is only used on the file mailer.inc.php .
Title: Re: Bridge for Joomla 1.5 ready
Post by: Joachim Müller on March 22, 2009, 03:16:43 pm
I just made a search though all Coppermine files,  and the string "PHPmailer"
I have done so before, I know that. That's why I said
Editing include/mailer.inc.php, finding
Code: [Select]
$mail = new PHPmailer();and replacing that string with
Code: [Select]
$mail = new cpg_PHPmailer();Then find
Code: [Select]
class PHPMailer {and replace with
Code: [Select]
class cpg_PHPMailer {
The word "SMTP" occurs much more often in the code - sometimes as class name, sometimes not. That's why I said
Taking a closer look: we have another class named SMTP that might be there two times, so we'd have to rename that as well.
SMTP is the trickier part.
Title: Re: Bridge for Joomla 1.5 ready
Post by: extrabigmehdi on March 22, 2009, 03:56:13 pm
Yes a conflict might occurs with the SMTP class too, as Joomla also use it.
A bit annoying I guess.
Title: Re: Bridge for Joomla 1.5 ready
Post by: Nibbler on March 22, 2009, 04:08:32 pm
Renamed both classes, tested SMTP and committed.
Title: Re: Bridge for Joomla 1.5 ready
Post by: extrabigmehdi on May 26, 2009, 06:57:41 am
hi,
could you rename function called deldir in file pluginmgr.php ?
Same function is used by Joomla 1.5 when enabling "legacy mode"
(in joomla, function is located at: plugins/system/legacy/functions.php).

Someone has reported me by mail problem with cpg 1.4x , but obviously there's same
problem with cpg 1.5x.

thanks in advance
Title: Re: Bridge for Joomla 1.5 ready
Post by: Joachim Müller on May 26, 2009, 08:44:28 am
Did as you suggested and replaced local function deldir with global function cpg_folder_file_delete. SVN revision 5998
Title: Re: Bridge for Joomla 1.5 ready
Post by: dougyang83 on January 20, 2010, 11:42:25 am
joomla is dead end for me...

:(
Title: Re: Bridge for Joomla 1.5 ready
Post by: Joachim Müller on January 20, 2010, 11:54:33 am
Your posting is useless. cpg1.5.x goes unsupported as of now, as it's still in beta stage. Don't clutter threads with needless remarks like yours.
Title: Re: Bridge for Joomla 1.5 ready
Post by: jeepguy_1980 on March 15, 2010, 12:30:02 am
Not a support request.

Can anyone verify that this bridge works with the latest CPG1.5. It has worked for me after the last few updates and I want to verify that it does still work before I begin trouble shooting.

Title: Re: Bridge for Joomla 1.5 ready
Post by: phill104 on March 15, 2010, 08:30:37 am
Yes, it does work - http://www.windsurf.me.uk/cpg133
Title: Re: Bridge for Joomla 1.5 ready
Post by: Αndré on March 15, 2010, 10:21:29 am
http://www.windsurf.me.uk/cpg133
Quote
<!--Coppermine Photo Gallery 1.5.2 (beta)-->
The latest release is cpg1.5.3 (RC) ;)
Title: Re: Bridge for Joomla 1.5 ready
Post by: phill104 on March 15, 2010, 04:25:06 pm
Ooops, I haven't checked that one for a bit. :-[
Title: Re: Bridge for Joomla 1.5 ready
Post by: jeepguy_1980 on March 16, 2010, 12:08:33 am
The latest release is cpg1.5.3 (RC) ;)

Ooops, I haven't checked that one for a bit. :-[

Thanks. It wasn't working under 1.5.2 for me either, so I can begin troubleshooting.
Title: Re: Bridge for Joomla 1.5 ready
Post by: extrabigmehdi on July 12, 2010, 06:18:19 am
hi,
finally updated my bridge for stable release of Coppermine.
Notably, a flash upload bug has been fixed.

I bypass the flash cookie bug, by posting the full cookie array, indirectly with the get_user_pass function.
Title: Re: Bridge for Joomla 1.5 ready
Post by: Shane on August 14, 2010, 03:15:43 am
Site:  http://philmontforum.com/15test/cpg

Question about the bridge and compatibility with the Final Extract plugin.  I asked for help with the Final Extract plugin over on the plugin board and Andre answered with the following:

I think it's the bridging that makes trouble. If I go to Coppermine's group manager, the guest group has the id 50. If I watch as guest at Coppermine's debug output, my group id is 150. I'm not familiar with bridging nor have looked at the plugin code yet. As an alternative you could just edit your theme.php and remove the login/logout button. Please read the docs and/or search the board if you don't know what you have to do.

Apparently, the Final Extract plugin cannot work properly when the group id is the actual id+100.  I dug into the joomla15.inc.php file and found the following code:

Code: [Select]
//------------joomla groups don't change, so let's give them directly
        function collect_groups() {
            //------ actual joomla groups' values + 100
            $udb_groups = Array( $this->guestgroup => "Guests", 118 => "Registered" , 119 => "Author", 120 => "Editor", 121 => "Publisher", 123 => "Manager", 124 => "Administrator", 125 => "Super Administrator" );
            return $udb_groups;
        }
        
        //------------ function usertype_into_gid no more necessary ----------------
        //------------  just use :$user->get('gid') --------------------------------
        //------------- note: the old $my->gid is reached now by $user->get('aid') -
        
        //------------let's override the coppermine authenticate function ----------------------------------------------------
        //------------ this makes things much easier: no need to bother with cookies, session, or user password. sweet! ------
        
        function authenticate() {
            //well, the aim of this function is after all to convert data from "JFactory::getUser" object into "$USER_DATA"
            global $USER_DATA;
            
            $joomUser= & JFactory::getUser();
            if (!$joomUser->get('guest')) { //user connected
                //we don't call function load_user_data
                //we handle data directly
                
                $USER_DATA['user_id'] = $joomUser->get('id');
                $USER_DATA['user_name'] = $joomUser->get('username');
                $gid=100+$joomUser->get('gid');
                $supported_groups = Array(118,119,120,121,123,124,125);  //100 + numbers in core_acl_aro_groups table
                if (!in_array($gid,$supported_groups))
                    die("Non standard joomla group used. Sorry this is not supported by the bridge");
                    
                if ($this->use_post_based_groups) {
                    $USER_DATA['groups'] = array( 0 => $gid );
                } else {
                    $USER_DATA['groups'] = array( 0 => (in_array($gid-100,$this->admingroups) ? 1 : 2) );
                }
            }//end if user connected
            else { //this is a guest
                $this->load_guest_data();
            }//end if this is a guest

Is the change in group id necessary?  Is there any way to get the Joomla bridge and the Final Extract plugin to play nice with each other?

I appreciate any help!
Shane

(edited to correct misspelled link)
Title: Re: Bridge for Joomla 1.5 ready
Post by: extrabigmehdi on August 14, 2010, 03:27:21 am
@Shane

Quote
Is the change in group id necessary?  
Frankly I just studied other bridge source code for coppermine, and imitated the change .
EDIT:
I  think that to avoid problems, coppermine  must use different group numbers , depending if it's user post based group or not.
Title: Re: Bridge for Joomla 1.5 ready
Post by: Shane on September 16, 2010, 10:37:12 pm
I figured out how to get the additional Joomla groups to load into Coppermine (with Joomla 1.5, I just can't figure out how to get the additional groups to work with Joomla).

In my site database, the additional group "Reunion Committee" has a Joomla group id (gid) of 31.

I edited the bridge file joomla15.inc.php:

line 369: replace:
Code: [Select]
$udb_groups = Array( $this->guestgroup => "Guests", 118 => "Registered" , 119 => "Author", 120 => "Editor", 121 => "Publisher", 123 => "Manager", 124 => "Administrator", 125 => "Super Administrator" );
with:
Code: [Select]
$udb_groups = Array( $this->guestgroup => "Guests", 118 => "Registered" , 119 => "Author", 120 => "Editor", 121 => "Publisher", 123 => "Manager", 124 => "Administrator", 125 => "Super Administrator", 131 => "Reunion Committee" );
line 392: replace:
Code: [Select]
$supported_groups = Array(118,119,120,121,123,124,125);  //100 + numbers in core_acl_aro_groups table
with:
Code: [Select]
$supported_groups = Array(118,119,120,121,123,124,125,131);  //100 + numbers in core_acl_aro_groups table
Line numbers may or may not be accurate depending on any other changes to the file.  Once bridged (selecting that bridge will use Joomla groups) the additional "Reunion Committee" group is present in the CPG groups list and database.
Title: Re: Bridge for Joomla 1.5 ready
Post by: extrabigmehdi on September 16, 2010, 11:42:55 pm
@Shane
yes the group supported are hardcoded in the bridge code. I didn't want to bother with complicated code, knowing that default Joomla group do not change.
I'll try to update later bridge for Joomla 1.6 , and then the dynamic Joomla group will be supported.
Title: Re: Bridge for Joomla 1.5 ready
Post by: Florian_W on January 24, 2011, 09:30:34 am
@Shane
yes the group supported are hardcoded in the bridge code. I didn't want to bother with complicated code, knowing that default Joomla group do not change.
I'll try to update later bridge for Joomla 1.6 , and then the dynamic Joomla group will be supported.


@extrabigmehdi

I know that Joomla 1.6 is very new, but do you know, if and when you update your coppermine bridge for Joomla 1.6?

Cheers
Florian
Title: Re: Bridge for Joomla 1.5 ready
Post by: extrabigmehdi on January 24, 2011, 12:47:55 pm
@Florian_W
I'm currently busy with a little project, and don't want to make false promises.
I hope soon...
Title: Re: Bridge for Joomla 1.5 ready
Post by: Florian_W on January 24, 2011, 06:54:11 pm
Thank you MEHDI for you fast reply,
I hope that we hear from you soon ! I would be delighted
Title: Re: Bridge for Joomla 1.5 ready
Post by: Florian_W on March 29, 2011, 11:47:03 am
@Florian_W
I'm currently busy with a little project, and don't want to make false promises.
I hope soon...
@ Mehdi

I know that you're busy.....you wrote it in one of your last posts.
Is it possible that you contact me directly via mail. I have a question about your bridge for Joomla 1.6 I want to discuss with you personally.

Thank you
Florian
Title: Re: Bridge for Joomla 1.5 ready
Post by: vlado85 on December 11, 2011, 02:06:36 pm
Hi,

I try to add Facebook share and Facebook like button, but I have problems with sharing.

When you click on button, link is broken. Facebook see link like: www.mysite.com/coppermine
without link to my picture like: www.mysite.com/cpg/displayimage.php?pid=75#top_display_media

is there a way to solve this?