cpmFetch works perfectly, except cpm_viewMediaByPid cpmFetch works perfectly, except cpm_viewMediaByPid
 

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]

Main Menu

cpmFetch works perfectly, except cpm_viewMediaByPid

Started by Dolkur, July 19, 2009, 03:34:17 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Dolkur

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)
Coppermine Photo Gallery 1.4.19
cpmFetch: 2.0.0
MySQL: 5.1.30
PHP: 5.2.5


Great plugin!

- Janus

Joachim Müller


Dolkur

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!

Dolkur

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:
cpm_viewLastAddedMedia (int $rows, int $columns, [array $options = ""]) the numbers are always referred to as integer.
Whereas:
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!)

Dolkur

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:
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.

Nibbler

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

Dolkur