incorrect "last viewed" date/time incorrect "last viewed" date/time
 

News:

CPG Release 1.6.26
Correct PHP8.2 issues with user and language managers.
Additional fixes for PHP 8.2
Correct PHP8 error with SMF 2.0 bridge.
Correct IPTC supplimental category parsing.
Download and info HERE

Main Menu

incorrect "last viewed" date/time

Started by Tranz, February 20, 2005, 09:42:41 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Tranz

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

Tranz

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.

Tranz

I fixed it but I'm not sure if it was kosher...

In functions.inc.php
FIND:
        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:
                $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.

Abbas Ali

Modified the code as suggested by TranzeNDance and marking this thread as fixed.
Chief Geek at Ranium Systems