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: Limit categories?  (Read 7774 times)

0 Members and 1 Guest are viewing this topic.

Tilbo

  • Coppermine newbie
  • Offline Offline
  • Posts: 8
Limit categories?
« on: December 16, 2006, 08:16:55 pm »

I've made a small module to show some images from a specific categorie, cat=10

I'm using cpmfetch (1.9.4) on a joomlaportal. The module looks like this:
Code: [Select]
<?php
defined
'_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' );
include_once 
"./gallery/cpmfetch/cpmfetch.php";
$objCpm = new cpm('path_to/gallery/cpmfetch/cpmfetch_config.php');
$objCpm->cpm_viewRandomMediaFromCategory(1,2,10);
//$objCpm->cpm_close(); 
?>
The problem is that all the categories till cat=10 returning images but cat 10 and up not!! It's strange!
I've tryed to look what's causing this but it's weird and frustrating!
Who has a clue?


« Last Edit: December 30, 2006, 08:19:50 pm by vuud »
Logged

vuud

  • Moderator
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 1803
  • [cpmfetch.fistfullofcode.com]
    • Fist Full Of Code
Re: Limit categories?
« Reply #1 on: December 18, 2006, 08:40:41 pm »

I've made a small module to show some images from a specific categorie, cat=10

I'm using cpmfetch (1.9.4) on a joomlaportal. The module looks like this:
Code: [Select]
<?php
defined
'_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' );
include_once 
"./gallery/cpmfetch/cpmfetch.php";
$objCpm = new cpm('path_to/gallery/cpmfetch/cpmfetch_config.php');
$objCpm->cpm_viewRandomMediaFromCategory(1,2,10);
//$objCpm->cpm_close(); 
?>
The problem is that all the categories till cat=10 returning images but cat 10 and up not!! It's strange!
I've tryed to look what's causing this but it's weird and frustrating!
Who has a clue?

So you get nothing back when you do the above call?

Please post a link to your forum also


Logged
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

Tilbo

  • Coppermine newbie
  • Offline Offline
  • Posts: 8
Re: Limit categories?
« Reply #2 on: December 19, 2006, 06:43:07 pm »

Nope, I ve edit the parameter yet to cat=6! But I want only to show images from cat=10. If I change it to cat=10 nothing turns up!
http://www.tilbo.com/index.php?option=com_content&task=blogsection&id=6&Itemid=119
Logged

Tilbo

  • Coppermine newbie
  • Offline Offline
  • Posts: 8
Re: Limit categories?
« Reply #3 on: December 29, 2006, 12:00:07 pm »

Installed 1.95 dev
All cat's work fine until cat 9, 10 and up give an error on line 903 in cpmfetch_dao.php

Code: [Select]
function addPathInfo($data) {

if (array_key_exists('pFilename',$data[0])) {
$newdata = array();
foreach ($data as $row) {
$row['fullPathToThumb']  = $this->getImageToUse($row['pFilepath'], $row['pFilename'] ,$this->cfg['thumb_pfx']);
$row['fullPathToNormal'] =  $this->getImageToUse($row['pFilepath'], $row['pFilename'] ,$this->cfg['normal_pfx']);
$row['fullPathToFull']   = $this->getImageToUse($row['pFilepath'], $row['pFilename'] ,"");
array_push($newdata,$row);
}
} else {
$newdata = $data;
}

return($newdata);
}

Logged

vuud

  • Moderator
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 1803
  • [cpmfetch.fistfullofcode.com]
    • Fist Full Of Code
Re: Limit categories?
« Reply #4 on: December 30, 2006, 06:13:07 am »

Installed 1.95 dev
All cat's work fine until cat 9, 10 and up give an error on line 903 in cpmfetch_dao.php

Code: [Select]
function addPathInfo($data) {

if (array_key_exists('pFilename',$data[0])) {
$newdata = array();
foreach ($data as $row) {
$row['fullPathToThumb']  = $this->getImageToUse($row['pFilepath'], $row['pFilename'] ,$this->cfg['thumb_pfx']);
$row['fullPathToNormal'] =  $this->getImageToUse($row['pFilepath'], $row['pFilename'] ,$this->cfg['normal_pfx']);
$row['fullPathToFull']   = $this->getImageToUse($row['pFilepath'], $row['pFilename'] ,"");
array_push($newdata,$row);
}
} else {
$newdata = $data;
}

return($newdata);
}



And the error was?  Please paste the exact code.

This is like calling an auto mechanic and saying my engine makes a wierd noise, how do I fix it?



Logged
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

Tilbo

  • Coppermine newbie
  • Offline Offline
  • Posts: 8
Re: Limit categories?
« Reply #5 on: December 30, 2006, 09:07:25 am »

Your right, sorry  :-[
This is the errorcode:
Code: [Select]
Warning: array_key_exists(): The second argument should be either an array or an object in /****/****/*****/****.***/public_html/gallery/cpmfetch/cpmfetch_dao.php on line 903
Logged

vuud

  • Moderator
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 1803
  • [cpmfetch.fistfullofcode.com]
    • Fist Full Of Code
Re: Limit categories?
« Reply #6 on: December 30, 2006, 05:07:48 pm »

Your right, sorry  :-[
This is the errorcode:
Code: [Select]
Warning: array_key_exists(): The second argument should be either an array or an object in /****/****/*****/****.***/public_html/gallery/cpmfetch/cpmfetch_dao.php on line 903


Change line 903 to this:

Code: [Select]
if (is_array($data) && array_key_exists('pFilename',$data[0])) {
For some reason, the cat=10 is not returning any results...  The change will make the error go away - but I am not sure why you are not getting any data back...





« Last Edit: December 31, 2006, 10:30:12 pm by vuud »
Logged
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

  • Moderator
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 1803
  • [cpmfetch.fistfullofcode.com]
    • Fist Full Of Code
Re: Limit categories?
« Reply #7 on: December 30, 2006, 05:10:21 pm »

Your right, sorry  :-[
This is the errorcode:
Code: [Select]
Warning: array_key_exists(): The second argument should be either an array or an object in /****/****/*****/****.***/public_html/gallery/cpmfetch/cpmfetch_dao.php on line 903



Wait... Your bridged eh...

In your cpmfetch.inc.php file find the line that says:

'cfBridgedTo' => false

and change it to

'cfBridgedTo' => true



Logged
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

  • Moderator
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 1803
  • [cpmfetch.fistfullofcode.com]
    • Fist Full Of Code
Re: Limit categories?
« Reply #8 on: December 30, 2006, 06:30:15 pm »

Your right, sorry  :-[
This is the errorcode:
Code: [Select]
Warning: array_key_exists(): The second argument should be either an array or an object in /****/****/*****/****.***/public_html/gallery/cpmfetch/cpmfetch_dao.php on line 903



Can you please let me know if my other suggestions worked?

I tested it here against 1.4.10 and the category 10 works fine...

Vuud
Logged
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

Tilbo

  • Coppermine newbie
  • Offline Offline
  • Posts: 8
Re: Limit categories?
« Reply #9 on: December 30, 2006, 07:14:35 pm »

Hi Vuud,

Changing:
Code: [Select]
In your cpmfetch.inc.php file find the line that says:

'cfBridgedTo' => false

and change it to

'cfBridgedTo' => true

Is working perfect  ;D

Happy new year and thanks for your support  ;)
Logged
Pages: [1]   Go Up
 

Page created in 0.02 seconds with 19 queries.