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: Last uploads always shows all  (Read 4090 times)

0 Members and 1 Guest are viewing this topic.

ralfs

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 37
Last uploads always shows all
« on: February 06, 2006, 12:01:53 pm »

Hi,

If I click on 'Last uploads' I get all my 5000 pictures in the result album.
I expected a time range of some days or weeks. Probably configurable by the admin.
This works with my 1.42 as well as the 1.43 online demo.

Bug or feature? I haven't found that issue in the forum so far.

Best regards,
Ralf
« Last Edit: February 06, 2006, 02:39:29 pm by Nibbler »
Logged

Abbas Ali

  • Administrator
  • Coppermine addict
  • *****
  • Country: in
  • Offline Offline
  • Gender: Male
  • Posts: 2165
  • Spread the PHP Web
    • Ranium Systems
Re: Last uploads always shows all
« Reply #1 on: February 06, 2006, 12:06:24 pm »

Feature definitely ;)
Logged
Chief Geek at Ranium Systems

ralfs

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 37
Re: Last uploads always shows all
« Reply #2 on: February 06, 2006, 12:25:31 pm »

Hmmm. Wouldn't it make sense to set up a number of max days for that result? All pictures is not really the answer to 'last uploaded pictures' ...

Regards,
Ralf
Logged

Abbas Ali

  • Administrator
  • Coppermine addict
  • *****
  • Country: in
  • Offline Offline
  • Gender: Male
  • Posts: 2165
  • Spread the PHP Web
    • Ranium Systems
Re: Last uploads always shows all
« Reply #3 on: February 06, 2006, 12:43:20 pm »

Last Uploaded is meant to show all the photos in descending order of upload date. In your case if you want to limit them then i think you can do so by modifying the code.


Abbas
Logged
Chief Geek at Ranium Systems

ralfs

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 37
Re: Last uploads always shows all
« Reply #4 on: February 06, 2006, 01:03:46 pm »

Ok, thank you very much for your fast response.
I'm not able to write PHP, so probably somebody else find that interesting enough. Or feature list for NG ..

Regards,
Ralf
Logged

Abbas Ali

  • Administrator
  • Coppermine addict
  • *****
  • Country: in
  • Offline Offline
  • Gender: Male
  • Posts: 2165
  • Spread the PHP Web
    • Ranium Systems
Re: Last uploads always shows all
« Reply #5 on: February 06, 2006, 01:32:19 pm »

Ok a quik mod.

Edit include/functions.inc.php

Replace

Code: [Select]
        case 'lastup': // Last uploads
                if ($META_ALBUM_SET && $CURRENT_CAT_NAME) {
                        $album_name = $lang_meta_album_names['lastup'].' - '. $CURRENT_CAT_NAME;
                } else {
                        $album_name = $lang_meta_album_names['lastup'];
                }

                $query = "SELECT COUNT(*) from {$CONFIG['TABLE_PICTURES']} WHERE approved = 'YES' $META_ALBUM_SET";
                $result = cpg_db_query($query);
                $nbEnr = mysql_fetch_array($result);
                $count = $nbEnr[0];
                mysql_free_result($result);


                //if($select_columns != '*' ) $select_columns .= ',title, caption, owner_id, owner_name, aid';
                $select_columns = '*'; //allows building any data into any thumbnail caption
                $query = "SELECT $select_columns FROM {$CONFIG['TABLE_PICTURES']} WHERE approved = 'YES' $META_ALBUM_SET ORDER BY pid DESC $limit";
                $result = cpg_db_query($query);

with

Code: [Select]
        case 'lastup': // Last uploads
                if ($META_ALBUM_SET && $CURRENT_CAT_NAME) {
                        $album_name = $lang_meta_album_names['lastup'].' - '. $CURRENT_CAT_NAME;
                } else {
                        $album_name = $lang_meta_album_names['lastup'];
                }
                $days = 5; // Change this to whatever you want
                $range = time() - ($days*24*60*60);
                $query = "SELECT COUNT(*) from {$CONFIG['TABLE_PICTURES']} WHERE approved = 'YES' AND ctime > '$range' $META_ALBUM_SET";
                $result = cpg_db_query($query);
                $nbEnr = mysql_fetch_array($result);
                $count = $nbEnr[0];
                mysql_free_result($result);


                //if($select_columns != '*' ) $select_columns .= ',title, caption, owner_id, owner_name, aid';
                $select_columns = '*'; //allows building any data into any thumbnail caption
                $query = "SELECT $select_columns FROM {$CONFIG['TABLE_PICTURES']} WHERE approved = 'YES' AND ctime > '$range' $META_ALBUM_SET ORDER BY pid DESC $limit";
                $result = cpg_db_query($query);

In above code change the value of $days to whatever suit you. Photos of last x days will be displayed in Last Uploads where x is the value of $days.


HTH
Abbas
Logged
Chief Geek at Ranium Systems

ralfs

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 37
Re: Last uploads always shows all
« Reply #6 on: February 06, 2006, 02:36:41 pm »

Changed to 14 days, up and running - great!

Thank you very much, this is real support.

Ralf
Logged

lordprodigy

  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Posts: 228
    • B514 ///
Re: Last uploads always shows all
« Reply #7 on: February 06, 2006, 08:00:52 pm »

Abbas, this is great. I have always wanted to make this configurable. One more thing. I would like the Last uploads to list ALBUMS and not the individual pictures. Is that possible? thanks.
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: Last uploads always shows all
« Reply #8 on: February 06, 2006, 09:19:58 pm »

lastalb meta album?
Logged

lordprodigy

  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Posts: 228
    • B514 ///
Re: Last uploads always shows all
« Reply #9 on: February 06, 2006, 10:17:49 pm »

thats true.  :-[
Logged
Pages: [1]   Go Up
 

Page created in 0.021 seconds with 20 queries.