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: Truncate Album Description problem with 1.5.x  (Read 4154 times)

0 Members and 1 Guest are viewing this topic.

Shane

  • Contributor
  • Coppermine regular visitor
  • ***
  • Offline Offline
  • Posts: 76
  • Choose Again
    • The Philmont Forum
Truncate Album Description problem with 1.5.x
« on: August 15, 2010, 10:29:56 pm »

site:  http://philmontforum.com/cpg

I am attempting to update the mod found at http://forum.coppermine-gallery.net/index.php/topic,40315.msg191082.html#msg191082 so it will work with my 1.5.x install.

I have made all of the changes needed to my theme.php file.  The truncation of the album description on the album list pages works perfectly.  I have the mod set to truncate album description to 120 characters.  Example - http://philmontforum.com/cpg/index.php?cat=10062

BUT... when I go to the thumbnail view for each album, the code returns the dreaded "Album not found"... Example - http://philmontforum.com/cpg/thumbnails.php?album=24

The code that returns "Album not found" is
Code: [Select]
// Get the name of an album
function get_album_desc($aid)
{
    global $CONFIG;
    global $lang_errors;
    $result = cpg_db_query("SELECT description from {$CONFIG['TABLE_ALBUMS']} WHERE aid='$aid'");
    $count = mysql_num_rows($result);
    if ($count > 0) {
        $row = mysql_fetch_array($result);
        return bb_decode($row['description']);
    } else {
        return "Album not found";
    }
}

I'm not a coder and have reached my limit of tinkering with this code.  Can anyone lead me in the right direction to make this code return the complete album description?

Thanks!
Logged

Shane

  • Contributor
  • Coppermine regular visitor
  • ***
  • Offline Offline
  • Posts: 76
  • Choose Again
    • The Philmont Forum
Re: Truncate Album Description problem with 1.5.x
« Reply #1 on: August 17, 2010, 01:36:32 pm »

I haven't given up...

I changed the code to find out exactly what the $result variable returned:
Code: [Select]
// Get the name of an album
function get_album_desc($aid)
{
    global $CONFIG;
global $lang_errors;
    $result = cpg_db_query("SELECT description from {$CONFIG['TABLE_ALBUMS']} WHERE aid='$aid'");
    //$count = mysql_num_rows($result);
    //if ($count > 0) {
        //$row = mysql_fetch_array($result);
        return bb_decode($result);
    //} else {
        //return "Album description should load here but the code is not working";
    //}
}

This code returned the text "Resource id #204".  Screenshot is attached.  I have also included a shot from mysqladmin showing part of the row of data for this album.

It appears that the query above is not retrieving the album description for some reason.

Logged

Shane

  • Contributor
  • Coppermine regular visitor
  • ***
  • Offline Offline
  • Posts: 76
  • Choose Again
    • The Philmont Forum
Re: Truncate Album Description problem with 1.5.x
« Reply #2 on: August 18, 2010, 01:21:37 am »

Looking at the debug for both the album list page and the thumbnail view page, the query shows as

Code: [Select]
SELECT description from cpg1412_albums WHERE aid = ''
So... the album id ($aid) is not being sent in the query to grab the description.

I looked through the sample theme.php for other instances where the query is looking at the $aid, and I tried the code with the line formatted similarly (taking the ' from around the variable...
Code: [Select]
$result = cpg_db_query("SELECT description from {$CONFIG['TABLE_ALBUMS']} WHERE aid = $aid");but this returns a mysql fatal error.

Any ideas?
Logged

Nibbler

  • Guest
Re: Truncate Album Description problem with 1.5.x
« Reply #3 on: August 18, 2010, 10:03:15 pm »

You need to change

Code: [Select]
$album_desc = get_album_desc($_GET[album]);

to

Code: [Select]
$album_desc = get_album_desc($superCage->get->getInt('album'));

This is due to changes introduced in 1.5 (http://documentation.coppermine-gallery.net/en/dev_superglobals.htm)
Logged

Shane

  • Contributor
  • Coppermine regular visitor
  • ***
  • Offline Offline
  • Posts: 76
  • Choose Again
    • The Philmont Forum
Re: Truncate Album Description problem with 1.5.x
« Reply #4 on: August 19, 2010, 03:18:58 am »

Thanks a ton Nibbler!  ;D  I really appreciate it.  I'm slowly learning a bit of coding from all of this tinkering, but I don't think I'd ever have figured this one out.

I have now read that documentation, and will try to learn how to use it for future tinkering.

Shane
Logged
Pages: [1]   Go Up
 

Page created in 0.018 seconds with 19 queries.