Advanced search  

News:

cpg1.5.46 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter recently discovered vulnerabilities. It is important that all users who run version cpg1.5.44 or older update to this latest version as soon as possible.
[more]

Pages: 1 2 [3] 4   Go Down

Author Topic: jqeury.min.js conflict  (Read 22595 times)

0 Members and 1 Guest are viewing this topic.

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15429
Re: jqeury.min.js conflict
« Reply #40 on: February 04, 2014, 11:43:28 am »

Can I please know wath issues can cause?

We currently have a working gallery software. As Abbas said, if we update a third party library, we don't know what exactly may break, even if we test as thorough as possible.


Regarding the change to js/utils.php, this is my proposal. Find
Code: [Select]
$('#' + $(this).attr('id') + '_wrapper').css('display', ($(this).attr('checked')) ? 'block' : 'none');and replace with
Code: [Select]
$('#' + this.getAttribute('id') + '_wrapper').css('display', (this.checked) ? 'block' : 'none');
As we use plain JavaScript, this change works regardless of the jQuery version. Or does somebody see a disadvantage (browser compatibility, etc.)? If not, I'd like to add that change even to cpg1.5.x, so users don't need to modify that file.
Logged

Phill Luckhurst

  • Administrator
  • Coppermine addict
  • *****
  • Country: gb
  • Offline Offline
  • Gender: Male
  • Posts: 4483
    • Windsurf.me
Re: jqeury.min.js conflict
« Reply #41 on: February 04, 2014, 11:46:44 am »



2.replaced js_include('js/jquery-1.3.2.js'); with js_include('js/jquery-1.11.0.min.js'); in include/init.inc.php


There are a number of other files that hard code the jquery version such as pic_editor.php at line 257 , themes.inc.php at line 400 as well as in some theme.php files such as in eyeball a few times and obviously the sample theme.
Logged
It is a mistake to think you can solve any major problems just with potatoes.

allvip

  • Global Moderator
  • Coppermine addict
  • *****
  • Country: 00
  • Offline Offline
  • Posts: 1290
Re: jqeury.min.js conflict
« Reply #42 on: February 04, 2014, 11:49:17 am »

ok.thanks Abbas Ali and Andre.
Logged

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15429
Re: Re: jqeury.min.js conflict
« Reply #43 on: February 04, 2014, 11:49:30 am »

There are a number of other files that hard code the jquery version such as pic_editor.php at line 257 , themes.inc.php at line 400 as well as in some theme.php files such as in eyeball a few times and obviously the sample theme.

A simple plugin using the page_html hook could easily replace the jQuery version everywhere without fail, as it modifies the HTML output directly before it's submitted to the browser.
Logged

Phill Luckhurst

  • Administrator
  • Coppermine addict
  • *****
  • Country: gb
  • Offline Offline
  • Gender: Male
  • Posts: 4483
    • Windsurf.me
Re: jqeury.min.js conflict
« Reply #44 on: February 04, 2014, 11:52:04 am »

Sounds like a very good ideas coupled with your utils.php modification above. It could even be extended to get the latest jquery version from the cdn if needed. Users would then have less cause to complain about the bundled version.
Logged
It is a mistake to think you can solve any major problems just with potatoes.

allvip

  • Global Moderator
  • Coppermine addict
  • *****
  • Country: 00
  • Offline Offline
  • Posts: 1290
Re: Re: jqeury.min.js conflict
« Reply #45 on: February 04, 2014, 02:05:50 pm »

There are a number of other files that hard code the jquery version such as pic_editor.php at line 257 , themes.inc.php at line 400 as well as in some theme.php files such as in eyeball a few times and obviously the sample theme.

Thanks.I did not though about it.Is there something else in coppermine files that has to do with jquery 1.3.2?

checked all the files including themes/curve (but not the js and bridge folder) and even include/cpg15x.files.xml has 1.3.2 hardcoded once.

include/themes.inc.php can be found 5 times: in function <<<theme_javascript_head>>>,<<<theme_display_fullsize_pic>>> 2 times,<<<$template_sidebar>>> 1 time.

replaced with 1.11.0 in pic_editor.php,include/cpg15x.files.xml,include/themes.inc.php .after a short test everyting looks fine but can not test sidebar.I don't have a sidebar.


Logged

gmc

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: us
  • Offline Offline
  • Gender: Male
  • Posts: 723
    • GMC Design Photo Gallery
Re: jqeury.min.js conflict
« Reply #46 on: February 04, 2014, 03:00:04 pm »

I think Αndré's proposed change for utils.php would be fine in 1.5.x (at least I don't see a disadvantage to that method)... but I would agree with those saying the change to include the new jquery should wait until 1.6.
While there may be no security related issues with jquery - if we were to break a theme or plugin a user relied on by including new jquery in 1.5.28, the user would be unable to apply any future security fixes (1.5.30, etc) until the jquery issue were addressed...
With 1.6, they will have the option to stay on a still supported (for a while) 1.5 version - with any new security fixes - until they can address the compatibility issues and are ready to upgrade..

I was going to suggest possibly a 'hidden' config option in 1.5.x to specify the level of jquery to include - thinking it was only used in one place (init.inc.php) - but as it is hardcoded elsewhere - may not be best choice...
The plugin using page_html hook would certainly find them all.

As a 'strategic' direction - I would think a config option in 1.6 for the jquery versions to use with all hardcoded references changed to look there might be best choice (and maybe an option to indicate include from cpg distribution or load from cdn as Phill suggested?)
Would position for users to adopt jquery 2.x before CPG 1.7... :)
Logged
Thanks!
Greg
My Coppermine Gallery
Need a web hosting account? See my gallery for an offer for CPG Forum users.
Send me money

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15429
Re: jqeury.min.js conflict
« Reply #47 on: February 04, 2014, 03:19:05 pm »

As a 'strategic' direction - I would think a config option in 1.6 for the jquery versions to use with all hardcoded references changed to look there might be best choice (and maybe an option to indicate include from cpg distribution or load from cdn as Phill suggested?)
Would position for users to adopt jquery 2.x before CPG 1.7... :)

IMHO such an option will lull users into a false sense of security, as they will think "Hey, it's a official config option, so it will work with all versions of jQuery (or whatever library)". In cpg1.6.x, like in cpg1.5.x, we should stick with the jQuery version we bundle in the first release, so we can be sure that everything works as expected. Of course we still can provide an (unofficial) plugin to use a later jQuery version if users need it for a particular reason.

I'll create the plugin now. I assume the hardest task is to find a meaningful name, as the rest is just a simple str_replace line ;)
Logged

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15429
Logged

Phill Luckhurst

  • Administrator
  • Coppermine addict
  • *****
  • Country: gb
  • Offline Offline
  • Gender: Male
  • Posts: 4483
    • Windsurf.me
Re: jqeury.min.js conflict
« Reply #49 on: February 04, 2014, 04:10:20 pm »

Well done Andre. That has to be the smallest plugin yet lol.
Logged
It is a mistake to think you can solve any major problems just with potatoes.

allvip

  • Global Moderator
  • Coppermine addict
  • *****
  • Country: 00
  • Offline Offline
  • Posts: 1290
Re: jqeury.min.js conflict
« Reply #50 on: February 04, 2014, 04:18:43 pm »

great ideea.
thanks.
Logged

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15429
Re: Re: jqeury.min.js conflict
« Reply #51 on: February 04, 2014, 04:31:58 pm »

Find
Code: [Select]
$('#' + $(this).attr('id') + '_wrapper').css('display', ($(this).attr('checked')) ? 'block' : 'none');and replace with
Code: [Select]
$('#' + this.getAttribute('id') + '_wrapper').css('display', (this.checked) ? 'block' : 'none');

Committed in SVN revision 8668. Please report any unexpected behavior.
Logged

allvip

  • Global Moderator
  • Coppermine addict
  • *****
  • Country: 00
  • Offline Offline
  • Posts: 1290
Re: jqeury.min.js conflict
« Reply #52 on: February 04, 2014, 04:39:01 pm »

I still need to find out how to use jquery no conflict if I need to use 2 jquery version on the same page even if on the jquery website they don't recommend 2 version of jquery on the same page.
Logged

allvip

  • Global Moderator
  • Coppermine addict
  • *****
  • Country: 00
  • Offline Offline
  • Posts: 1290
Re: jqeury.min.js conflict
« Reply #53 on: February 04, 2014, 04:40:30 pm »

I know is off topic.
Logged

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15429
Re: jqeury.min.js conflict
« Reply #54 on: February 04, 2014, 04:43:17 pm »

Why do you want to use 2 versions simultaneously? As I said earlier, it's easy to use different jQuery versions on different Coppermine sections. Just wrap something like
Code: [Select]
global $CPG_PHP_SELF;
if ($CPG_PHP_SELF != 'whatever.php') {

}
around the plugin code that replaces the used jQuery version.
Logged

Phill Luckhurst

  • Administrator
  • Coppermine addict
  • *****
  • Country: gb
  • Offline Offline
  • Gender: Male
  • Posts: 4483
    • Windsurf.me
Re: jqeury.min.js conflict
« Reply #55 on: February 04, 2014, 04:49:22 pm »

I still need to find out how to use jquery no conflict if I need to use 2 jquery version on the same page even if on the jquery website they don't recommend 2 version of jquery on the same page.

I too have no idea why you want to do that. Just load the one version and be done with it. I can only assume you are trying to use a different package alongside coppermine and that is also loading jQuery. Simply remove the load from one of the packages.
Logged
It is a mistake to think you can solve any major problems just with potatoes.

allvip

  • Global Moderator
  • Coppermine addict
  • *****
  • Country: 00
  • Offline Offline
  • Posts: 1290
Re: jqeury.min.js conflict
« Reply #56 on: February 04, 2014, 04:55:22 pm »

If I use 2 jquery plugins:one that does not work with the latest jquery one that works with the latest jquery.

with this code I can use 1.11.0 for the filmstrip if I ad it to film function,1.6 for stars if I ad it to stars function and rest of the displayimage.php to use default coppermine 1.3.2? (is just an example) ?
Logged

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15429
Re: jqeury.min.js conflict
« Reply #57 on: February 04, 2014, 04:59:58 pm »

That's probably something you should ask in the jQuery boards. At least I have no clue if this will ever work, as I don't know how the plugins should "find" the correct jQuery version.
Logged

allvip

  • Global Moderator
  • Coppermine addict
  • *****
  • Country: 00
  • Offline Offline
  • Posts: 1290
Re: jqeury.min.js conflict
« Reply #58 on: February 04, 2014, 05:14:11 pm »

Loading multiple jquery version on the same page is bad ideea and not recommended by jquery website.
I will not use jquery plugins with old jquery versions.
Thanks for all the answers.
For me the topic is solved.
Logged

allvip

  • Global Moderator
  • Coppermine addict
  • *****
  • Country: 00
  • Offline Offline
  • Posts: 1290
Re: Re: jqeury.min.js conflict
« Reply #59 on: May 26, 2014, 03:29:19 pm »

Here we go: http://sourceforge.net/p/coppermine/code/HEAD/tree/branches/cpg1.5.x/plugins/jquery_update/

I created  jquery_update folder on my desktop.I downloded  codebase.php  and configuration.php and put them in the folder.I uploaded the folder to coppermine plugins folder on the server.Installed the plugin with coppermine plugin manager.

Reason for editing:  made a mistake when I test it.That's why was not working.

The plugin works VERY WELL.
« Last Edit: May 26, 2014, 09:16:09 pm by allvip »
Logged
Pages: 1 2 [3] 4   Go Up
 

Page created in 0.022 seconds with 20 queries.