Advanced search  

News:

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

Pages: [1]   Go Down

Author Topic: Smart catlist plugin error (cpg 1.4 plugin on cpg 1.5)  (Read 10938 times)

0 Members and 1 Guest are viewing this topic.

Es

  • Coppermine newbie
  • Offline Offline
  • Posts: 2
Smart catlist plugin error (cpg 1.4 plugin on cpg 1.5)
« on: October 24, 2016, 12:19:24 pm »

Hello,

I hope I'm posting this in the right category, otherwise my apologies. I've made a stupid mistake. I was looking into making individual categories invisible and found this plugin called Smart Catlist (http://forum.coppermine-gallery.net/index.php?topic=60118.0). I did read that it was meant for cpg 1.4.x, but in this topic it was stated that it works for cpg1.5.x too: http://forum.coppermine-gallery.net/index.php/topic,74888.msg360589.html#msg360589. So I tried.

Now my gallery is rather broken as it won't load the main page anymore. It gives me a critical error, with debug mode on it reads:

Code: [Select]
While executing query 'SELECT aid, title, r.description, keyword, alb_hits, category, visibility, r.thumb, r.owner, depth AS level, lft, '0' AS pic_count
        FROM cpg15x_categories AS c
        INNER JOIN cpg15x_albums AS r ON r.category = c.cid
        WHERE c.depth >= 0 + 1
       
       
        ORDER BY r.pos ASC, r.aid ASC' in index.php on line 340

mySQL error: Column 'visibility' in field list is ambiguous

File: /home3/sroyce/public_html/madisondavenport.com/gallery/include/functions.inc.php - Line: 272

(The link to my gallery is: http://madisondavenport.com/gallery/)

I've searched the forum for similar problems and found 2 topics on this matter, but they unfortunately don't help me:
http://forum.coppermine-gallery.net/index.php/topic,76926.msg371640.html#msg371640
http://forum.coppermine-gallery.net/index.php/topic,67484.msg335015.html#msg335015

The first topic says I should add a c. somewhere (in my coding it says line 340). That line reads: "$result = cpg_db_query($sql);". Where should I add the c.?
The second topic says I should change the name of invisibility. Where do I find that? Do I have to access the MYSQL database to do so? But it also states that leads to more errors.

I've tried deinstalling the plugin, upgrading coppermine to the latest version and replacing the anycontent and config files with the backups I made before hand, that all doesn't work.

Any help will be much appreciated, and again apologies if I posted this wrongly!
Logged

gmc

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: us
  • Offline Offline
  • Gender: Male
  • Posts: 785
    • GMC Design Photo Gallery
Re: Smart catlist plugin error (cpg 1.4 plugin on cpg 1.5)
« Reply #1 on: October 24, 2016, 04:17:15 pm »

It appears the plugin added a column 'visibility' to the categories table... The SQL is joining categories and albums - and each now contain a 'visibility' column - so MySQL doesn't know which is intended...

The SQL defines the category table as 'c', and the albums table as 'r'...  You didn't say what release - but in 1.5.44, this code exists at line 322:
Code: [Select]
    // collect album info and album counts
    $sql = "SELECT aid, title, r.description, keyword, alb_hits, category, visibility, r.thumb, r.owner, depth AS level, lft, '0' AS pic_count
        FROM {$CONFIG['TABLE_CATEGORIES']} AS c
        INNER JOIN {$CONFIG['TABLE_ALBUMS']} AS r ON r.category = c.cid
        WHERE c.depth >= $CURRENT_CAT_DEPTH + 1
        $forbidden_set
        $lft_rgt
        ORDER BY $sort_order";
Since this is unmodified CPG - and the only albums has a visibility column as shipped - the albums table appears to be what is requested here...
Changing:
Code: [Select]
    $sql = "SELECT aid, title, r.description, keyword, alb_hits, category, visibility, r.thumb, r.owner, depth AS level, lft, '0' AS pic_countTo: (adding 'r.' to 'visibility;)
Code: [Select]
    $sql = "SELECT aid, title, r.description, keyword, alb_hits, category, r.visibility, r.thumb, r.owner, depth AS level, lft, '0' AS pic_countwill tell MySQL which table is requested.

If you don't intend to use the plugin, you could rename or drop the column 'visibility' in the category table instead.

I'd have to take a closer look at the plugin to see what it is trying to do... but one of the above should get you running again.

**Edited to correct sample as pointed out by Es in next post..
« Last Edit: October 27, 2016, 05:09:31 am by gmc »
Logged
Thanks!
Greg
My Coppermine Gallery
Need a web hosting account? See my gallery for an offer for CPG Forum users.
Send me money

Es

  • Coppermine newbie
  • Offline Offline
  • Posts: 2
Re: Smart catlist plugin error (cpg 1.4 plugin on cpg 1.5)
« Reply #2 on: October 26, 2016, 12:27:03 pm »

Hi gmc,

Thank you so much for your reply!! In your sample code you accidently added the 'r.' before category, but your explaination made clear that it should be in front of invisibility, and that works like a charm!

I deinstalled the plugin as part of my try to get the gallery to work again. From your explanation it seems that the plugin might work with this adjustment? I'd still like to make the categories invisible, but not at the cost of breaking my gallery haha!

Thank you so much for your help!
Es
Logged

gmc

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: us
  • Offline Offline
  • Gender: Male
  • Posts: 785
    • GMC Design Photo Gallery
Re: Smart catlist plugin error (cpg 1.4 plugin on cpg 1.5)
« Reply #3 on: October 27, 2016, 05:13:04 am »

I haven't had a chance to look at the plugin - but you can certainly try it..
There may be other places needing a similar change.

Thanks for pointing out the 'accident' in my post... I corrected it for anyone else encountering a similar issue.
Logged
Thanks!
Greg
My Coppermine Gallery
Need a web hosting account? See my gallery for an offer for CPG Forum users.
Send me money
Pages: [1]   Go Up
 

Page created in 0.017 seconds with 20 queries.