forum.coppermine-gallery.net

Dev Board => cpg1.4 Testing/Bugs => cpg1.4 Testing/Bugs: FIXED/CLOSED => Topic started by: Tranz on February 20, 2005, 09:42:41 pm

Title: incorrect "last viewed" date/time
Post by: Tranz on February 20, 2005, 09:42:41 pm
On my local system, it shows for last viewed:
Dec 31, 1969 at 04:33 PM (in db ctime: 1095277307)
On my web host system:
Aug 08, 2011 at 12:51 AM (in db ctime: 1101028774)

Local system would have the latest files, and I synchronised the remote files, so they should be updated. Also ran update.php

Other dates in gallery are correct.

Timezone difference in Config: -8

local: Windows, Apache 2, MySQL 4.1.8-nt
remote: Linux, Apache 1.33, MySQL 4.0.22

both: php 4.3.10
Title: Re: incorrect "last viewed" date/time
Post by: Tranz on February 21, 2005, 08:28:36 am
On the local system, I installed a brand new installation of dev version to have a bridged installation. Last viewed shows:
Jan 01, 1970 at 12:33 AM

So it's not some holdover that might have existed in the previous dev version.
Title: Re: incorrect "last viewed" date/time
Post by: Tranz on February 24, 2005, 11:35:31 pm
I fixed it but I'm not sure if it was kosher...

In functions.inc.php
FIND:
Code: [Select]
        case 'lasthits': // Last viewed pictures
                if ($META_ALBUM_SET && $CURRENT_CAT_NAME) {
                        $album_name = $lang_meta_album_names['lasthits'].' - '. $CURRENT_CAT_NAME;
                } else {
                        $album_name = $lang_meta_album_names['lasthits'];
                }
                $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 .= ', UNIX_TIMESTAMP(mtime) as mtime, aid, hits, lasthit_ip, owner_id, owner_name';
                $select_columns = '*'; //allows building any data into any thumbnail caption

REPLACE last line with:
Code: [Select]
                $select_columns = '*, UNIX_TIMESTAMP(mtime) as mtime'; //allows building any data into any thumbnail caption

I'm not sure if it is ok since it is already a SELECT * and I added more columns. But it worked.
Title: Re: incorrect "last viewed" date/time
Post by: Abbas Ali on February 25, 2005, 12:49:24 pm
Modified the code as suggested by TranzeNDance and marking this thread as fixed.