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: cpmFetch works perfectly, except cpm_viewMediaByPid  (Read 5398 times)

0 Members and 1 Guest are viewing this topic.

Dolkur

  • Coppermine newbie
  • Offline Offline
  • Posts: 9
cpmFetch works perfectly, except cpm_viewMediaByPid
« on: July 19, 2009, 03:34:17 pm »

Hi

I want to use the function cpm_viewMediaByPid, but I can not get it to work.

I've made a tryout file where I've tested all of the functions. All of them work, except the Pid one:
http://hg.faroenature.net/gallery/cpmfetch/myndatest.php  (code at the bottom)
How can I get it to work?

http://hg.faroenature.net/gallery/ (its a bit messy because I'm reworking it)
Code: [Select]
Coppermine Photo Gallery 1.4.19
cpmFetch: 2.0.0
MySQL: 5.1.30
PHP: 5.2.5

Great plugin!

- Janus
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: cpmFetch works perfectly, except cpm_viewMediaByPid
« Reply #1 on: July 20, 2009, 08:36:09 am »

Coppermine Photo Gallery 1.4.19
Upgrade!
Logged

Dolkur

  • Coppermine newbie
  • Offline Offline
  • Posts: 9
Re: cpmFetch works perfectly, except cpm_viewMediaByPid
« Reply #2 on: July 20, 2009, 10:28:09 am »

I knew you'd say that!!  ::)
So I went ahead and did, and ran into some other problems... which will be solved and: I'll be back!
Logged

Dolkur

  • Coppermine newbie
  • Offline Offline
  • Posts: 9
Re: cpmFetch works perfectly, except cpm_viewMediaByPid
« Reply #3 on: July 20, 2009, 03:38:40 pm »

Anyway... everything is updated (including database), except init.inc.php. Which for some reason wont work, http://forum.coppermine-gallery.net/index.php/topic,60693.0.html.

But cpmFetch works even though the rest of coppermine doesn't after the upgrade. And as far as I can tell cpmFetch doesn't use init.inc.php. So I'm trying to figure out just how cpm_viewMediaByPid is different from the other functions.
In http://cpmfetch.fistfullofcode.com/docs/stable_advanced/cpmfetch/cpm.html, it says:
Code: [Select]
cpm_viewLastAddedMedia (int $rows, int $columns, [array $options = ""]) the numbers are always referred to as integer.
Whereas:
Code: [Select]
cpm_viewMediaByPid (number $pid, [mixed $options = ""]) the number is referred to as a number.

Can it be that my "number" has a wrong format (integer or string)?

(PS. I wont be offended if the answer is: Get the upgrade to work!)
Logged

Dolkur

  • Coppermine newbie
  • Offline Offline
  • Posts: 9
Re: cpmFetch works perfectly, except cpm_viewMediaByPid
« Reply #4 on: July 20, 2009, 09:20:18 pm »

OK, I've solved it.

The cpm_viewMediaByPid sql query doesn't return any result when cpg_users is empty. This may happen when Coppermine is bridged - as mine is.

A cpm_viewMediaByPid sql query may look like this:
Code: [Select]
SELECT p.filepath AS pFilepath, p.filename AS pFilename, p.aid AS pAid, p.filesize AS pFilesize, p.title AS pTitle, p.caption AS pCaption, p.owner_name AS pOwner_name, p.owner_id as pOwnerId, p.ctime AS pCtime, p.hits AS pHits, p.pid AS pPid, p.pic_rating AS pPic_Rating, p.votes AS pVotes, p.pwidth AS pWidth, p.pheight AS pHeight, p.user1 as pUser1, p.user2 as pUser2, p.user3 as pUser3, p.user4 as pUser4, c.cid as cCid, c.name as cName, c.description as cDescription, c.pos as cPos, c.parent as cParent, c.thumb as cThumb, a.aid AS aAid, a.title AS aTitle, a.description AS aDescription, a.visibility as aVisibility, a.pos as aPos, a.category as aCategory, a.thumb as aThumb, a.keyword as aKeyword FROM cpg132_pictures AS p LEFT JOIN cpg132_albums AS a ON p.aid = a.aid LEFT JOIN cpg132_categories AS c ON a.category = c.cid, cpg132_users AS u WHERE p.pid = 4723 AND ((a.visibility = 0 OR a.visibility IS NULL) AND (a.alb_password IS NULL OR a.alb_password = "")) AND p.approved='YES'
It will not give any result with an empty user table, it will however give the correct result with a single arbitrary user in the user table.
Logged

Nibbler

  • Guest
Re: cpmFetch works perfectly, except cpm_viewMediaByPid
« Reply #5 on: July 20, 2009, 10:25:47 pm »

Deleting the default admin account is not recommended. You'll need it if you ever need to unbridge.
Logged

Dolkur

  • Coppermine newbie
  • Offline Offline
  • Posts: 9
Re: cpmFetch works perfectly, except cpm_viewMediaByPid
« Reply #6 on: July 22, 2009, 09:21:27 pm »

Yea... I have no idea how that happened.
Logged
Pages: [1]   Go Up
 

Page created in 0.026 seconds with 19 queries.