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: Fetch last 4 updated album with details  (Read 4144 times)

0 Members and 1 Guest are viewing this topic.

bb3

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 39
Fetch last 4 updated album with details
« on: December 21, 2009, 06:13:17 pm »

Hi,

I just want to know if it is possible to fetch last 4 updated albums with details like in the "cpm_showAlbumsUpdatedOverLastDays($numberOfDays,$options="")" (no. of lates files, album name, category name)

thanks

http://redlens.org

Logged

bb3

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 39
Re: Fetch last 4 updated album with details
« Reply #1 on: February 01, 2010, 03:55:12 pm »

hi there,

i just want to update this query.

I want to know how to fetch only 4 updated albums instead of "ALL" updated albums since "date" thanks
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Logged

bb3

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 39
Re: Fetch last 4 updated album with details
« Reply #3 on: February 02, 2010, 06:35:40 am »

sorry for that joachim...

i've already made a research but still no luck... i tried to put this code

Code: [Select]
<style type="text/css">.style {border:1px solid #CCC;}</style>
<?php require_once "./gallery/cpmfetch/cpmfetch.php"$objCpm = new cpm("./gallery/cpmfetch/cpmfetch_config.php")
;$objCpm->cpm_setfilter($filter ".jpg");
$options = array("imagewidth"=>"100","imageheight"=>"75","imageStyle"=>"style")
;$objCpm->cpm_showAlbumsUpdatedOverLastDays(7,$options); $albumstoshow 3;
 
$objCpm->cpm_close();?>
           

and replace cpmfetch_dao.php code

Code: [Select]
function getMediaAddedSince ($timestamp) {
$resultset = array();

if (is_numeric($timestamp)) {
$sqlcode = "SELECT {$this->sqlPostSelect} " . $this->sqlSelect
. ', c.name AS cName, count( p.pid ) AS count '
. ' FROM '
. $this->sqlTableSelect
. " WHERE a.category = c.cid "
. $this->sqlUserDataLink
. " AND p.approved='YES' {$this->privacyfilter} AND p.ctime > " . $timestamp
. ' GROUP BY a.category, a.aid'
. ' ORDER BY c.name, p.mtime';

to this

Code: [Select]
function getMediaAddedSince ($timestamp) {
$resultset = array();

if (is_numeric($timestamp)) {
$sqlcode = "SELECT {$this->sqlPostSelect} " . $this->sqlSelect
. ', c.name AS cName, count( p.pid ) AS count '
. ' FROM '
. $this->sqlTableSelect
. " WHERE a.category = c.cid "
. $this->sqlUserDataLink
. " AND p.approved='YES' {$this->privacyfilter} AND p.ctime > " . $timestamp
. ' GROUP BY a.category, a.aid'
. ' ORDER BY p.ctime DESC';

but it is still showing "ALL" of the updated album...

thanks
Logged

bb3

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 39
Re: Fetch last 4 updated album with details
« Reply #4 on: February 02, 2010, 07:10:29 am »

i figured it out.

find in cpmfetch_dao

Code: [Select]
function getMediaAddedSince ($timestamp) {
$resultset = array();

if (is_numeric($timestamp)) {
$sqlcode = "SELECT {$this->sqlPostSelect} " . $this->sqlSelect
. ', c.name AS cName, count( p.pid ) AS count '
. ' FROM '
. $this->sqlTableSelect
. " WHERE a.category = c.cid "
. $this->sqlUserDataLink
. " AND p.approved='YES' {$this->privacyfilter} AND p.ctime > " . $timestamp
. ' GROUP BY a.category, a.aid'
. ' ORDER BY c.name, p.mtime';

$resultset = $this->dbExecuteSql($sqlcode);
$this->addPathInfo($resultset);
}

change to

Code: [Select]
function getMediaAddedSince ($timestamp) {
$resultset = array();

if (is_numeric($timestamp)) {
$sqlcode = "SELECT {$this->sqlPostSelect} " . $this->sqlSelect
. ', c.name AS cName, count( p.pid ) AS count '
. ' FROM '
. $this->sqlTableSelect
. " WHERE a.category = c.cid "
. $this->sqlUserDataLink
. " AND p.approved='YES' {$this->privacyfilter} AND p.ctime > " . $timestamp
. ' GROUP BY a.category, a.aid'
. ' ORDER BY p.ctime DESC LIMIT 3 ';

$resultset = $this->dbExecuteSql($sqlcode);
$this->addPathInfo($resultset);
}
Logged
Pages: [1]   Go Up
 

Page created in 0.021 seconds with 20 queries.