CpmFetch 1.4 On... Displaying data and images from CPG on your website - Page 23 CpmFetch 1.4 On... Displaying data and images from CPG on your website - Page 23
 

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 1.4 On... Displaying data and images from CPG on your website

Started by vuud, July 08, 2005, 06:43:10 AM

Previous topic - Next topic

0 Members and 7 Guests are viewing this topic.

CPG Guru

Quote from: vuud on November 25, 2005, 11:48:01 PM
Quote from: CPG Guru on November 25, 2005, 06:50:15 PM
Hi Dear

Ive jusgt updated my 1.3.4. to 1.4.2 stable successfully, But now i face the following error on my index page

Unknown column 'u.user_website' in 'field list'
Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in /home/SITENAME/public_html/cpmfetch/cpmfetch_dao.php on line 695

Earlier it was working fine but now it isnt


Hello,

The release notes with the recent versions of cpmfetch include instructions for this problem.

Well they are for the beta, but this includes the new verions also

QuoteThe Coppermine Dev's have (in what I would would say was a logical move) changed some of the internal database structure, and replaced a few fields with generic fields. So instead of user web site, you have a few placeholder fields you can define into anything you want.

This of course breaks a bit of my code and stops CpmFetch from working. I am going to work out a permanent solution, but for the short term, if you really want to use CPG BETA 1.4.1 (and the dev's would appreciate you doing so, so would I) you must edit the top of the cpmfetch_dao.php file. There are two sections around line 54 and line 59. You need to comment out the one at line 54, and uncomment the one at line 59. Comment it by placing /* before it and */ after it. Uncomment by removing the same from the other section. If you are on a version prior to 1.4 you DO NOT NEED TO DO ANYTHING.

I am working on the next version of cpmfetch, but it keeps getting bumped due to this annoying thing called life. So hopefully I can get that out soon - which addresses many other "oddity" level problems also.

In the meantime a recent cpmfetch and the brief changes above are all thats needed to fix it.




Dear

Ive uncomment line54 & uncomment line59 as told by u but tell me wher is the other section as u mentioned " Uncomment by removing the same from the other section."

Now this is  showing the following error

Parse error: parse error, unexpected T_VARIABLE, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /home/SITENAME/public_html/cpmfetch/cpmfetch_dao.php on line 61


if convenient paste code over here or put copy of dao file here so that i can detach & use

Thanks

vuud

Quote from: CPG Guru on November 26, 2005, 03:10:37 AM
Quote from: vuud on November 25, 2005, 11:48:01 PM
Quote from: CPG Guru on November 25, 2005, 06:50:15 PM
Hi Dear

Ive jusgt updated my 1.3.4. to 1.4.2 stable successfully, But now i face the following error on my index page

Unknown column 'u.user_website' in 'field list'
Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in /home/SITENAME/public_html/cpmfetch/cpmfetch_dao.php on line 695

Earlier it was working fine but now it isnt


Hello,

The release notes with the recent versions of cpmfetch include instructions for this problem.

Well they are for the beta, but this includes the new verions also

QuoteThe Coppermine Dev's have (in what I would would say was a logical move) changed some of the internal database structure, and replaced a few fields with generic fields. So instead of user web site, you have a few placeholder fields you can define into anything you want.

This of course breaks a bit of my code and stops CpmFetch from working. I am going to work out a permanent solution, but for the short term, if you really want to use CPG BETA 1.4.1 (and the dev's would appreciate you doing so, so would I) you must edit the top of the cpmfetch_dao.php file. There are two sections around line 54 and line 59. You need to comment out the one at line 54, and uncomment the one at line 59. Comment it by placing /* before it and */ after it. Uncomment by removing the same from the other section. If you are on a version prior to 1.4 you DO NOT NEED TO DO ANYTHING.

I am working on the next version of cpmfetch, but it keeps getting bumped due to this annoying thing called life. So hopefully I can get that out soon - which addresses many other "oddity" level problems also.

In the meantime a recent cpmfetch and the brief changes above are all thats needed to fix it.




Dear

Ive uncomment line54 & uncomment line59 as told by u but tell me wher is the other section as u mentioned " Uncomment by removing the same from the other section."

Now this is  showing the following error

Parse error: parse error, unexpected T_VARIABLE, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /home/SITENAME/public_html/cpmfetch/cpmfetch_dao.php on line 61


if convenient paste code over here or put copy of dao file here so that i can detach & use

Thanks

When you started you had something like this in there:


// This is for CPG versions prior to 1.4
var $sqlPictureAlbumSelect = ' 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, a.title AS aTitle, a.description AS aDescription, p.pid AS pPid, p.pic_rating AS pPic_Rating,  p.votes AS pVotes, p.pwidth AS pWidth, p.pheight AS pHeight, u.user_lastvisit AS uUser_lastvisit, u.user_regdate AS uUser_regdate, u.user_email AS uUser_email, u.user_website AS uUser_website, u.user_location AS uUser_location, u.user_interests AS uUser_interest, u.user_occupation AS uUser_occupation';


// This is for CPG v 1.4.1 beta 1
/*
var $sqlPictureAlbumSelect = ' 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, a.title AS aTitle, a.description AS aDescription, p.pid AS pPid, p.pic_rating AS pPic_Rating,  p.votes AS pVotes, p.pwidth AS pWidth, p.pheight AS pHeight, u.user_lastvisit AS uUser_lastvisit, u.user_regdate AS uUser_regdate, u.user_email AS uUser_email';
*/


Both sections start with var $sqlPictureAlbumSelect .  You need to remove the /* and */ from around the second set and put them instead around the first set

Like so...


// This is for CPG versions prior to 1.4
/*
var $sqlPictureAlbumSelect = ' 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, a.title AS aTitle, a.description AS aDescription, p.pid AS pPid, p.pic_rating AS pPic_Rating,  p.votes AS pVotes, p.pwidth AS pWidth, p.pheight AS pHeight, u.user_lastvisit AS uUser_lastvisit, u.user_regdate AS uUser_regdate, u.user_email AS uUser_email, u.user_website AS uUser_website, u.user_location AS uUser_location, u.user_interests AS uUser_interest, u.user_occupation AS uUser_occupation';
*/

// This is for CPG v 1.4.1 beta 1
var $sqlPictureAlbumSelect = ' 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, a.title AS aTitle, a.description AS aDescription, p.pid AS pPid, p.pic_rating AS pPic_Rating,  p.votes AS pVotes, p.pwidth AS pWidth, p.pheight AS pHeight, u.user_lastvisit AS uUser_lastvisit, u.user_regdate AS uUser_regdate, u.user_email AS uUser_email';



The error you got is due to something going wrong in your commenting or uncommenting before.  Give it a whirl with the example above.

Sorry, I will work on the new version soon
Please post for help to the forum... PM me only if you are sending security related items (passwords, security problems, etc).

cpmFetch - Images, RSS feeds from CPG from outside CPG
New release notification signup also. 
See http://cpmfetch.fistfullofco

CPG Guru

THANKS Dear

Issue Resolved !!


The problem was also i was having ur 1.4 version of cpmfetch & now i download 1.6.2 & copy all the files in same directory & Site is working fine.

Also no need to say SORRY as you are favouring us for Free , So its our duty to say sorry because we are disturbing u again & again.

Anyway Good work. ;)


vuud


Glad to hear its working!  Take care

Quote from: CPG Guru on November 26, 2005, 09:18:39 AM
THANKS Dear

Issue Resolved !!


The problem was also i was having ur 1.4 version of cpmfetch & now i download 1.6.2 & copy all the files in same directory & Site is working fine.

Also no need to say SORRY as you are favouring us for Free , So its our duty to say sorry because we are disturbing u again & again.

Anyway Good work. ;)


Please post for help to the forum... PM me only if you are sending security related items (passwords, security problems, etc).

cpmFetch - Images, RSS feeds from CPG from outside CPG
New release notification signup also. 
See http://cpmfetch.fistfullofco

Hec Losame

Edited to update code

Hello Vuud,

      First of all i want to thank you for all the work that you put into this software and helping others.  That aside i want to bother you with a  of question. Fist i want to tell you that four weeks ago i had no knowledge what so ever of php (nor htlm for that case) but i been learnign.  I istalled phpBB forum.  I installed a CPG gallery and bridged it to the forums.  then i started a portal and i want to show a single random picture and the lastest picture in the portal.  After digging a little bit in this forums it was obvios that CPMFetch was the tool for the job, so i decided to use it.

     CPG is version 1.3.5 and CPMfetch is verison 1.6.2

     I downloaded it and installed it and when i went to the test page no images showed up.  After a digging more into this forums i learned about the bridging promblem, so i manually compied the users table of my phpBB to the CPM users table and problem resolved.  now i implemented the code in my portal and i get the following error:

Warning: open_basedir restriction in effect. File is in wrong directory in /home/httpd/vhosts/skanlo.com/httpdocs/gallery/cpmfetch/cpmfetch.php on line 25



   The code im using in my portal is the following:


<!-- GALLERY -->
<table width="100%" cellpadding="3" cellspacing="1" border="0" class="forumline">
  <tr>
    <td class="catHead" height="28" colspan="2"><span class="cattitle"><?php echo 'Gallery' ?></span></td>
  </tr>
  <tr>
     <?php
         include 
"../gallery/cpmfetch/cpmfetch.php";
         $objCpm = new cpm('/gallery');
      ?>

      <td class="row1" align="center" width="50%">
         <?php
            $objCpm
->cpm_viewRandomMedia (1,1);
          ?>

       </td>
      <td class="row1" align="center" width="50%">
         <?php
           $objCpm
->cpm_viewLastAddedMedia (1,1);
           $objCpm->cpm_close();
         ?>

    </td>
  </tr>
</table>
<br />
<!-- GALLERY -->



You can take a look at it at www.skanlo.com/elgym

The path for the gallery is www.skanlo.com/gallery
The path for CPGfetch is www.skanlo.com/gallery/cpmfetch

My question is how can i get rid of this warning?  I am very new at this there for not very savy about this things.

Thanks for your time and your help in advance.

Hec Losame.


vuud

Quote from: Hec Losame on November 27, 2005, 01:24:41 AM

Warning: open_basedir restriction in effect. File is in wrong directory in /home/httpd/vhosts/skanlo.com/httpdocs/gallery/cpmfetch/cpmfetch.php on line 25


According to http://www.php.net/features.safe-mode this is something to do with what files / directories PHP is allowed to open, and from what I can tell has something to do with how your server is configured....  Although I am at a complete loss as to why it does not happen when your cftest.php runs which seems fine...

It is possible that your portal (for security reasons) turns that on, and since its not in the portal directory you get that error?  I am guessing there.  You could check the source for phpbb and any .htaccess files it may come with.  Look for that setting, OR try moving the cpmfetch directory into the phpbb directory.

These are all guesses...






Please post for help to the forum... PM me only if you are sending security related items (passwords, security problems, etc).

cpmFetch - Images, RSS feeds from CPG from outside CPG
New release notification signup also. 
See http://cpmfetch.fistfullofco

Hec Losame

Quote from: vuud on November 27, 2005, 05:47:52 AM
Quote from: Hec Losame on November 27, 2005, 01:24:41 AM

Warning: open_basedir restriction in effect. File is in wrong directory in /home/httpd/vhosts/skanlo.com/httpdocs/gallery/cpmfetch/cpmfetch.php on line 25


According to http://www.php.net/features.safe-mode this is something to do with what files / directories PHP is allowed to open, and from what I can tell has something to do with how your server is configured....  Although I am at a complete loss as to why it does not happen when your cftest.php runs which seems fine...

It is possible that your portal (for security reasons) turns that on, and since its not in the portal directory you get that error?  I am guessing there.  You could check the source for phpbb and any .htaccess files it may come with.  Look for that setting, OR try moving the cpmfetch directory into the phpbb directory.

These are all guesses...


Vuud, thanks for the help. The pictures display and everything seems to work fine, but the warning is there, i was wondering if anyone knows a way to turn it off.  I made several experiments with the test code from your tutorial.  I made a file called example.php that had nothing but the test code.  That warnings comes up everywhere but from inside the cpmfetch directory.  My set up is the following:

My cpm gallery is at               www.skanlo.com/gallery
the cpmfetch directory is at   www.skanlo.com/gallery/cpmfetch
my portal is at                      www.skanlo.com/elgym

I got the warning in all of the following:  placing the example.php in my portal directory, placing it on the root directory.  placing it on the gallery directory.

then i put the example.php file inside the cpmfetch directory and no warning was displayed.  then i moved the whole cpmfetch directory to the root directory witht the example.php and no warning was displayed.  They i moved the whole cpmfetch directory again into my portal directory and no warning displayed.  So i concluded that no matter where the cpmfetch directory is at, as long as the your code is inside that directory, you have no warning being displayed.  Ofcourse this is not good new because i woul have put my whole portal inside the cpmfetch directory and that woul mean a lot of redirecting and recoding for a lot of stuff.  Right now im looking into turning off warnings even if its just during that part of the code.

Since i get hosted on a pay shared server, i dont think i will have acces to turn off the open_basedir thing.  At lest thats what i understand.

Also, i noticed that for the random picture it always shows the same picture.  I was wondering if this is a bug, or if im just really unlucky and i always get the same picture.  I would appreciate any insights about this.

Thanks again for your sharing your time and your knowledge.

Hec Losame

Hec Losame

Well, seems like i did it.  As i said above, im new to this, so for most of you this could have been obvious or simple.

I just added the line:

        error_reporting(0);

right before

        include "./cpmfetch/cpmfetch.php";
         $objCpm = new cpm('/gallery');


and the line

          error_reporting(E_ALL ^ E_NOTICE);

right after

           $objCpm->cpm_close();


I hope this is not bad or wrong in some way. I got this from http://mx2.php.net/error_reporting . At least the warning is gone and the pictures are displaying. 

Now I only have one question.  How come the random pictures is the same picture everysingle time?  Is this a bug, or may I be doing something wrong?  once again, i would appreciate any insights about this.

Hec Losame


Hec Losame

Hello its me again.  Sorry im it seems like im spamming.  I noticed that only images from public albums get displayed on the random image.  after reading the documentation i found out that i could include images from private albums by "calling the cpm_unlockPrivate(true) function".  I tested this on the example.php file i mentioned in my post above and gives me the error.  I was wondering if where should i make this call, i mean, where do i place this code.

Once more thanks for your time, your knowledge and your patience.

Hec Losame

vuud

Quote from: Hec Losame on November 27, 2005, 07:08:21 PM
Hello its me again.  Sorry im it seems like im spamming.  I noticed that only images from public albums get displayed on the random image.  after reading the documentation i found out that i could include images from private albums by "calling the cpm_unlockPrivate(true) function".  I tested this on the example.php file i mentioned in my post above and gives me the error.  I was wondering if where should i make this call, i mean, where do i place this code.

Once more thanks for your time, your knowledge and your patience.

Hec Losame


Gives you what error?

Did you include the $objCpm on the front of it?  Oh, and the docs are wrong... it should be like the below... Someone reported this a while back, but I have not updated the docs.

$objCpm->cpm_unlock_private(true);

My bad :(

Are your other issues all better now?


Please post for help to the forum... PM me only if you are sending security related items (passwords, security problems, etc).

cpmFetch - Images, RSS feeds from CPG from outside CPG
New release notification signup also. 
See http://cpmfetch.fistfullofco

Hec Losame

Quote from: vuud on November 27, 2005, 09:22:25 PM

Are your other issues all better now?




Vuud, everything is running smooth now.  you are a genius.  Thanks again for your help and your time.  I really appreciate it as i do appreciate this marvelous piece of code you have provide us.  Thanks.

Hec Losame

vuud


Subscribe to the mailing list, new version will be announced soon!

Have fun with it

Quote from: Hec Losame on November 28, 2005, 01:04:17 AM
Quote from: vuud on November 27, 2005, 09:22:25 PM

Are your other issues all better now?




Vuud, everything is running smooth now.  you are a genius.  Thanks again for your help and your time.  I really appreciate it as i do appreciate this marvelous piece of code you have provide us.  Thanks.

Hec Losame
Please post for help to the forum... PM me only if you are sending security related items (passwords, security problems, etc).

cpmFetch - Images, RSS feeds from CPG from outside CPG
New release notification signup also. 
See http://cpmfetch.fistfullofco

CPG Guru

Dear VUUD

Is there way out for pic of the day or pic of the week in your mod foer all or specific categories/ albums

or make some thing like that

Ive seen one other mod but there ive to modify my code heavily , iwant to have some crisp solution from u  ;)

vuud

Quote from: CPG Guru on November 28, 2005, 02:59:53 PM
Dear VUUD

Is there way out for pic of the day or pic of the week in your mod foer all or specific categories/ albums

or make some thing like that

Ive seen one other mod but there ive to modify my code heavily , iwant to have some crisp solution from u  ;)


Can you define what would make something "Pic or the day" or "Pic of the week"?

Thats a big ambigious

Please post for help to the forum... PM me only if you are sending security related items (passwords, security problems, etc).

cpmFetch - Images, RSS feeds from CPG from outside CPG
New release notification signup also. 
See http://cpmfetch.fistfullofco

CPG Guru


vuud

Quote from: CPG Guru on November 28, 2005, 04:07:46 PM
Dear Vuud

Please check this topic

http://forum.coppermine-gallery.net/index.php?topic=14600.0

I believe u'll make a shortcut to that

Okay, now I see.

No.

If that becomes a standard part of a cpg release I would definately do it, but I can't start coding against hacks to the software I am coding for,  Its just going to get out of hand.

I do have functions for random from most viewed and random from most popular, which are both sort of a stretch anyway.

Sorry, but that is just not going to happen

Again, sorry, but I can't do it.




Please post for help to the forum... PM me only if you are sending security related items (passwords, security problems, etc).

cpmFetch - Images, RSS feeds from CPG from outside CPG
New release notification signup also. 
See http://cpmfetch.fistfullofco

vuud


Sort a teaser, and to at least get myself motivated to finish it...

I have version 1.7.0 almost done.  Well, the code itself is, but the installer is not.  I took a day off and did nothing but recode the whole thing.

Yes, thats right - an installer.

The biggest plus for me is that I eliminated a lot of code and duplication.

The biggest plus for all of you is that

1) You will set the configuration once, and no matter what you do, all the programs know to read it. 

2) The configuration gets built of CPG settigns data, so no more futzing with setting prefixes and such

3) Support for cpg 1.4

4) Support to make bridging at least not a problem

5) Should be more IIS and other wierd server tolerant

6) I think the double backslash thing is gone

The big drawback is that this product contains WHEAT and SOY.  So those with allergies could have a problem.  PEANUT safe though.

Oh yeah, and some functions are going away, BUT the normal ones are still available to you - so you should only need to make very minor changes to your web pages. 

$objcpm = new cpmfetch("/cpg");

now becomes

$objcpm = new cpmfetch();

All thats left is to make the installer that builds your config files and a few tweaks to the data.

So hopefully in a day or two.

I am not taking feature requests specifically for this release, but if anyone has any gripes about something that was hard to do that I can make easier, now would be a good time to point it out to me.

Have a nice night and lets all hope for the best




Please post for help to the forum... PM me only if you are sending security related items (passwords, security problems, etc).

cpmFetch - Images, RSS feeds from CPG from outside CPG
New release notification signup also. 
See http://cpmfetch.fistfullofco

kehbop

Hi. I just can't get this to work at all. I really don't know any php but I've gotten a phpBB fetch to work and that seemed a lot more complex...
I'm using cpg 1.3.2

This is the code I'm am trying to use.
<?php 
include "gallery/cpmfetch/cpmfetch.php";
$objCpm = new cpm("/gallery");
$objCpm->cpm_viewLastAddedMedia (1,1);
$objCpm->cpm_close();
?>

It does not return any errors but it doesn't show any picture. My coppermine is in the /gallery/ folder.

When I try changing the code to this, as it has it in the documentation, it returns me with an error about not finding the right directory.
include "./cpmfetch/cpmfetch.php";

vuud

Quote from: kehbop on December 05, 2005, 06:26:37 AM
Hi. I just can't get this to work at all. I really don't know any php but I've gotten a phpBB fetch to work and that seemed a lot more complex...
I'm using cpg 1.3.2

This is the code I'm am trying to use.
<?php 
include "gallery/cpmfetch/cpmfetch.php";
$objCpm = new cpm("/gallery");
$objCpm->cpm_viewLastAddedMedia (1,1);
$objCpm->cpm_close();
?>

It does not return any errors but it doesn't show any picture. My coppermine is in the /gallery/ folder.

When I try changing the code to this, as it has it in the documentation, it returns me with an error about not finding the right directory.
include "./cpmfetch/cpmfetch.php";


By any chance are you bridged with PHPBB?  If so, this is a well known problem and has been talked about in the forums here a lot. 
Please post for help to the forum... PM me only if you are sending security related items (passwords, security problems, etc).

cpmFetch - Images, RSS feeds from CPG from outside CPG
New release notification signup also. 
See http://cpmfetch.fistfullofco

kehbop

So is there a solution?

I'm about to search for it now, but I don't want to keep searching for it if there isn't one...  :)