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: Toprated problem  (Read 2035 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: 15765
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.018 seconds with 19 queries.