Advanced search  

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

Pages: [1]   Go Down

Author Topic: Toprated problem  (Read 3229 times)

0 Members and 1 Guest are viewing this topic.

plancast

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 25
Toprated problem
« on: February 27, 2015, 04:26:47 pm »

Hi,

I did a minor change in functions.inc.php where the toprated images only show those uploaded in the last 24 hours.  However, now when you click on the thumbnail in toprated it either goes to a completely different picture or comes up with "There was an error while processing a database query".  Site is www.snapfoto.com/foto.  Can anyone help, please?

Code: [Select]
    case 'toprated': // Top rated pictures

        if ($cat && $CURRENT_CAT_NAME) {
            $album_name = cpg_fetch_icon('top_rated', 2) . $lang_meta_album_names['toprated'] . ' - ' . $CURRENT_CAT_NAME;
        } else {
            $album_name = cpg_fetch_icon('top_rated', 2) . $lang_meta_album_names['toprated'];
        }

        $query = "SELECT COUNT(*)
                FROM {$CONFIG['TABLE_PICTURES']} AS r
                INNER JOIN {$CONFIG['TABLE_ALBUMS']} AS a ON a.aid = r.aid
                $RESTRICTEDWHERE
                AND ctime >= (UNIX_TIMESTAMP()-(24*60*60))
                AND approved = 'YES'
                AND r.votes >= '{$CONFIG['min_votes_for_rating']}'";

        $result = cpg_db_query($query);

        list($count) = mysql_fetch_row($result);
        mysql_free_result($result);

        list($ASC, $DESC, $limit, $flipped) = get_pic_data_ordering($count, $limit1, $limit2);

        $select_columns = implode(', ', $select_column_list);

        $query = "SELECT $select_columns
                FROM {$CONFIG['TABLE_PICTURES']} AS r
                INNER JOIN {$CONFIG['TABLE_ALBUMS']} AS a ON a.aid = r.aid
                $RESTRICTEDWHERE
                AND ctime >= (UNIX_TIMESTAMP()-(24*60*60))
AND approved = 'YES'
                AND r.votes >= '{$CONFIG['min_votes_for_rating']}'
                ORDER BY pic_rating $DESC, r.votes $DESC, pid $DESC
                $limit";

        $result = cpg_db_query($query);
        $rowset = cpg_db_fetch_rowset($result);
        mysql_free_result($result);

        if ($flipped) {
            $rowset = array_reverse($rowset);
        }

        if ($set_caption) {
            build_caption($rowset, array('pic_rating'));
        }

        $rowset = CPGPluginAPI::filter('thumb_caption_toprated', $rowset);

        return $rowset;
        break;
« Last Edit: February 27, 2015, 09:56:03 pm by Jeff Bailey »
Logged

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15764
Re: Toprated problem
« Reply #1 on: March 27, 2015, 09:44:05 am »

Have you also adjusted the code in function get_pic_pos? If not, you need to do so.
Logged

plancast

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 25
Re: Toprated problem
« Reply #2 on: March 27, 2015, 02:39:46 pm »

Thanks Andre -done!
Logged
Pages: [1]   Go Up
 

Page created in 0.016 seconds with 20 queries.