|
From: OryNider <ory...@us...> - 2008-03-27 14:31:37
|
Update of /cvsroot/mxbb/mx_smartor In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv22215 Modified Files: album_lists.php Log Message: Upgrade for 2.8.2 finaly :D Index: album_lists.php =================================================================== RCS file: /cvsroot/mxbb/mx_smartor/album_lists.php,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** album_lists.php 8 Feb 2008 10:47:59 -0000 1.24 --- album_lists.php 27 Mar 2008 14:30:59 -0000 1.25 *************** *** 74,108 **** */ ! $sql = "SELECT c.*, COUNT(p.pic_id) AS count ! FROM ". ALBUM_CAT_TABLE ." AS c ! LEFT JOIN ". ALBUM_TABLE ." AS p ON c.cat_id = p.pic_cat_id ! WHERE cat_id <> 0 ! GROUP BY cat_id ! ORDER BY cat_order ASC"; ! if( !($result = $db->sql_query($sql)) ) ! { ! mx_message_die(GENERAL_ERROR, 'Could not query categories list', '', __LINE__, __FILE__, $sql); ! } ! ! $catrows = array(); ! while( $row = $db->sql_fetchrow($result) ) ! { ! $album_user_access = album_user_access($row['cat_id'], $row, 1, 0, 0, 0, 0, 0); // VIEW ! if ($album_user_access['view'] == 1) ! { ! $catrows[] = $row; ! } ! } ! $allowed_cat = ''; // For Recent Public Pics below ! // $catrows now stores all categories which this user can view. Dump them out! ! for ($i = 0; $i < count($catrows); $i++) ! { // -------------------------------- // Build allowed category-list (for recent pics after here) // -------------------------------- $allowed_cat .= ($allowed_cat == '') ? $catrows[$i]['cat_id'] : ',' . $catrows[$i]['cat_id']; ! } // END of Categories Index --- 74,123 ---- */ ! // ! // Get Album Config ! // ! if (($mx_cache->get('album_cat_list')) && ($use_cache)) ! { ! $catrows = $mx_cache->get('album_cat_list'); ! } ! else ! { ! $sql = "SELECT c.*, COUNT(p.pic_id) AS count ! FROM ". ALBUM_CAT_TABLE ." AS c ! LEFT JOIN ". ALBUM_TABLE ." AS p ON c.cat_id = p.pic_cat_id ! WHERE cat_id <> 0 ! GROUP BY cat_id ! ORDER BY cat_order ASC"; ! if( !($result = $db->sql_query($sql)) ) ! { ! mx_message_die(GENERAL_ERROR, 'Could not query categories list', '', __LINE__, __FILE__, $sql); ! } ! ! $catrows = array(); ! while( $row = $db->sql_fetchrow($result) ) ! { ! $album_user_access = album_user_access($row['cat_id'], $row, 1, 0, 0, 0, 0, 0); // VIEW ! if ($album_user_access['view'] == 1) ! { ! $catrows[] = $row; ! } ! } ! if ($use_cache) ! { ! $mx_cache->put('album_cat_list', $catrows); ! } ! } ! ! $allowed_cat = ''; // For Recent Public Pics below ! // $catrows now stores all categories which this user can view. Dump them out! ! for ($i = 0; $i < count($catrows); $i++) ! { // -------------------------------- // Build allowed category-list (for recent pics after here) // -------------------------------- $allowed_cat .= ($allowed_cat == '') ? $catrows[$i]['cat_id'] : ',' . $catrows[$i]['cat_id']; ! } // END of Categories Index *************** *** 116,153 **** if ($allowed_cat != '') { ! ! $sql = "SELECT p.*, u.user_id, u.username, r.rate_pic_id, AVG(r.rate_point) AS rating, COUNT(DISTINCT c.comment_id) AS comments ! FROM ". ALBUM_TABLE ." AS p ! LEFT JOIN ". USERS_TABLE ." AS u ON p.pic_user_id = u.user_id ! LEFT JOIN ". ALBUM_CAT_TABLE ." AS ct ON p.pic_cat_id = ct.cat_id ! LEFT JOIN ". ALBUM_RATE_TABLE ." AS r ON p.pic_id = r.rate_pic_id ! LEFT JOIN ". ALBUM_COMMENT_TABLE ." AS c ON p.pic_id = c.comment_pic_id ! WHERE p.pic_cat_id IN ($allowed_cat) AND ( p.pic_approval = 1 OR ct.cat_approval = 0 ) ! GROUP BY p.pic_id ! ORDER BY pic_time DESC ! LIMIT ". $album_sp_config['img_cols'] * $album_sp_config['img_rows']; ! /* ! // this fix it's not working on some sql versions ! $sql = "SELECT p.pic_id, p.pic_title, p.pic_desc, p.pic_user_id, p.pic_user_ip, p.pic_username, p.pic_time, p.pic_cat_id, p.pic_view_count, u.user_id, u.username, r.rate_pic_id, AVG(r.rate_point) AS rating, COUNT(DISTINCT c.comment_id) AS comments ! FROM ". ALBUM_TABLE ." AS p, ". ALBUM_COMMENT_TABLE ." AS c, ". USERS_TABLE ." AS u, ". ALBUM_CAT_TABLE ." AS ct , ". ALBUM_RATE_TABLE ." AS r ! WHERE p.pic_user_id = u.user_id ! AND p.pic_cat_id = ct.cat_id ! AND p.pic_id = r.rate_pic_id ! AND p.pic_id = c.comment_pic_id ! AND p.pic_cat_id IN ($allowed_cat) AND ( p.pic_approval = 1 OR ct.cat_approval = 0 ) ! GROUP BY p.pic_id ! ORDER BY pic_time DESC ! LIMIT ". $album_sp_config['img_cols'] * $album_sp_config['img_rows']; ! */ ! if( !($result = $db->sql_query($sql)) ) { ! mx_message_die(GENERAL_ERROR, 'Could not query recent pics information', '', __LINE__, __FILE__, $sql); } ! $recentrow = array(); ! while( $row = $db->sql_fetchrow($result) ) ! { ! $recentrow[] = $row; } --- 131,166 ---- if ($allowed_cat != '') { ! if (($mx_cache->get('album_recent_list')) && ($use_cache)) { ! $recentrow = $mx_cache->get('album_recent_list'); } + else + { + $sql = "SELECT p.*, u.user_id, u.username, r.rate_pic_id, AVG(r.rate_point) AS rating, COUNT(DISTINCT c.comment_id) AS comments + FROM ". ALBUM_TABLE ." AS p + LEFT JOIN ". USERS_TABLE ." AS u ON p.pic_user_id = u.user_id + LEFT JOIN ". ALBUM_CAT_TABLE ." AS ct ON p.pic_cat_id = ct.cat_id + LEFT JOIN ". ALBUM_RATE_TABLE ." AS r ON p.pic_id = r.rate_pic_id + LEFT JOIN ". ALBUM_COMMENT_TABLE ." AS c ON p.pic_id = c.comment_pic_id + WHERE p.pic_cat_id IN ($allowed_cat) AND ( p.pic_approval = 1 OR ct.cat_approval = 0 ) + GROUP BY p.pic_id + ORDER BY pic_time DESC + LIMIT ". $album_sp_config['img_cols'] * $album_sp_config['img_rows']; + if( !($result = $db->sql_query($sql)) ) + { + mx_message_die(GENERAL_ERROR, 'Could not query recent pics information', '', __LINE__, __FILE__, $sql); + } ! $recentrow = array(); ! while( $row = $db->sql_fetchrow($result) ) ! { ! $recentrow[] = $row; ! } ! ! if ($use_cache) ! { ! $mx_cache->put('album_recent_list', $recentrow); ! } } *************** *** 198,202 **** 'TITLE' => $recentrow[$j]['pic_title'], 'POSTER' => $recent_poster, ! 'TIME' => create_date($board_config['default_dateformat'], $recentrow[$j]['pic_time'], $board_config['board_timezone']), 'VIEW' => $recentrow[$j]['pic_view_count'], --- 211,215 ---- 'TITLE' => $recentrow[$j]['pic_title'], 'POSTER' => $recent_poster, ! 'TIME' => create_date2($board_config['default_dateformat'], $recentrow[$j]['pic_time'], $board_config['board_timezone']), 'VIEW' => $recentrow[$j]['pic_view_count'], *************** *** 205,209 **** 'COMMENTS' => ($album_config['comment'] == 1) ? ( '<a href="'. append_sid(this_fap_toplisturl("smartor_mode=album_showpage&pic_id=". $recentrow[$j]['pic_id'], TRUE)) . '">' . $lang['Comments'] . '</a>: ' . $recentrow[$j]['comments'] . '<br />') : '' ! // 'IP' => ($userdata['user_level'] == ADMIN) ? $lang['IP_Address'] . ': <a href="http://www.nic.com/cgi-bin/whois.cgi?query=' . decode_ip($recentrow[$j]['pic_user_ip']) . '" target="_blank">' . decode_ip($recentrow[$j]['pic_user_ip']) .'</a><br />' : '' ) ); --- 218,222 ---- 'COMMENTS' => ($album_config['comment'] == 1) ? ( '<a href="'. append_sid(this_fap_toplisturl("smartor_mode=album_showpage&pic_id=". $recentrow[$j]['pic_id'], TRUE)) . '">' . $lang['Comments'] . '</a>: ' . $recentrow[$j]['comments'] . '<br />') : '' ! // 'IP' => ($userdata['user_level'] == ADMIN) ? $lang['IP_Address'] . ': <a href="http://www.nic.com/cgi-bin/whois.cgi?query=' . decode_ip2($recentrow[$j]['pic_user_ip']) . '" target="_blank">' . decode_ip2($recentrow[$j]['pic_user_ip']) .'</a><br />' : '' ) ); *************** *** 237,275 **** if ($allowed_cat != '') { ! $sql = "SELECT p.pic_id, p.pic_title, p.pic_desc, p.pic_user_id, p.pic_user_ip, p.pic_username, p.pic_time, p.pic_cat_id, p.pic_view_count, u.user_id, u.username, r.rate_pic_id, AVG(r.rate_point) AS rating, COUNT(DISTINCT c.comment_id) AS comments ! FROM ". ALBUM_TABLE ." AS p ! LEFT JOIN ". USERS_TABLE ." AS u ON p.pic_user_id = u.user_id ! LEFT JOIN ". ALBUM_CAT_TABLE ." AS ct ON p.pic_cat_id = ct.cat_id ! LEFT JOIN ". ALBUM_RATE_TABLE ." AS r ON p.pic_id = r.rate_pic_id ! LEFT JOIN ". ALBUM_COMMENT_TABLE ." AS c ON p.pic_id = c.comment_pic_id ! WHERE p.pic_cat_id IN ($allowed_cat) AND ( p.pic_approval = 1 OR ct.cat_approval = 0 ) ! GROUP BY p.pic_id ! ORDER BY pic_view_count DESC ! LIMIT ". $album_sp_config['img_cols'] * $album_sp_config['img_rows']; ! ! /* ! ! // this fix it's not working on some sql versions ! $sql = "SELECT p.pic_id, p.pic_title, p.pic_desc, p.pic_user_id, p.pic_user_ip, p.pic_username, p.pic_time, p.pic_cat_id, p.pic_view_count, u.user_id, u.username, r.rate_pic_id, AVG(r.rate_point) AS rating, SUM( c.comment_id) AS comments ! FROM ". ALBUM_TABLE ." AS p, ". ALBUM_COMMENT_TABLE ." AS c, ". USERS_TABLE ." AS u, ". ALBUM_CAT_TABLE ." AS ct , ". ALBUM_RATE_TABLE ." AS r ! WHERE p.pic_user_id = u.user_id ! AND p.pic_cat_id = ct.cat_id ! AND p.pic_id = r.rate_pic_id ! AND p.pic_id = c.comment_pic_id ! AND p.pic_cat_id IN ($allowed_cat) AND ( p.pic_approval = 1 OR ct.cat_approval = 0 ) ! GROUP BY p.pic_id ! ORDER BY pic_view_count DESC ! LIMIT ". $album_sp_config['img_cols'] * $album_sp_config['img_rows']; ! */ ! if( !($result = $db->sql_query($sql)) ) { ! mx_message_die(GENERAL_ERROR, 'Could not query recent pics information', '', __LINE__, __FILE__, $sql); } - $mostrow = array(); ! while( $row = $db->sql_fetchrow($result) ) ! { ! $mostrow[] = $row; } --- 250,287 ---- if ($allowed_cat != '') { ! if (($mx_cache->get('album_most_list')) && ($use_cache)) { ! $mostrow= $mx_cache->get('album_most_list'); } + else + { + $sql = "SELECT p.pic_id, p.pic_title, p.pic_desc, p.pic_user_id, p.pic_user_ip, p.pic_username, p.pic_time, p.pic_cat_id, p.pic_view_count, u.user_id, u.username, r.rate_pic_id, AVG(r.rate_point) AS rating, COUNT(DISTINCT c.comment_id) AS comments + FROM ". ALBUM_TABLE ." AS p + LEFT JOIN ". USERS_TABLE ." AS u ON p.pic_user_id = u.user_id + LEFT JOIN ". ALBUM_CAT_TABLE ." AS ct ON p.pic_cat_id = ct.cat_id + LEFT JOIN ". ALBUM_RATE_TABLE ." AS r ON p.pic_id = r.rate_pic_id + LEFT JOIN ". ALBUM_COMMENT_TABLE ." AS c ON p.pic_id = c.comment_pic_id + WHERE p.pic_cat_id IN ($allowed_cat) AND ( p.pic_approval = 1 OR ct.cat_approval = 0 ) + GROUP BY p.pic_id + ORDER BY pic_view_count DESC + LIMIT ". $album_sp_config['img_cols'] * $album_sp_config['img_rows']; ! if( !($result = $db->sql_query($sql)) ) ! { ! mx_message_die(GENERAL_ERROR, 'Could not query most viewed pics information', '', __LINE__, __FILE__, $sql); ! } ! ! $mostrow = array(); ! ! while( $row = $db->sql_fetchrow($result) ) ! { ! $mostrow[] = $row; ! } ! ! if ($use_cache) ! { ! $mx_cache->put('album_most_list', $mostrow); ! } } *************** *** 320,324 **** 'TITLE' => $mostrow[$j]['pic_title'], 'POSTER' => $most_poster, ! 'TIME' => create_date($board_config['default_dateformat'], $mostrow[$j]['pic_time'], $board_config['board_timezone']), 'VIEW' => $mostrow[$j]['pic_view_count'], --- 332,336 ---- 'TITLE' => $mostrow[$j]['pic_title'], 'POSTER' => $most_poster, ! 'TIME' => create_date2($board_config['default_dateformat'], $mostrow[$j]['pic_time'], $board_config['board_timezone']), 'VIEW' => $mostrow[$j]['pic_view_count'], *************** *** 327,331 **** 'COMMENTS' => ($album_config['comment'] == 1) ? ( '<a href="'. append_sid(this_fap_toplisturl("smartor_mode=album_showpage&pic_id=". $mostrow[$j]['pic_id'], TRUE)) . '">' . $lang['Comments'] . '</a>: ' . $mostrow[$j]['comments'] . '<br />') : '' ! // 'IP' => ($userdata['user_level'] == ADMIN) ? $lang['IP_Address'] . ': <a href="http://www.nic.com/cgi-bin/whois.cgi?query=' . decode_ip($recentrow[$j]['pic_user_ip']) . '" target="_blank">' . decode_ip($recentrow[$j]['pic_user_ip']) .'</a><br />' : '' ) ); --- 339,343 ---- 'COMMENTS' => ($album_config['comment'] == 1) ? ( '<a href="'. append_sid(this_fap_toplisturl("smartor_mode=album_showpage&pic_id=". $mostrow[$j]['pic_id'], TRUE)) . '">' . $lang['Comments'] . '</a>: ' . $mostrow[$j]['comments'] . '<br />') : '' ! // 'IP' => ($userdata['user_level'] == ADMIN) ? $lang['IP_Address'] . ': <a href="http://www.nic.com/cgi-bin/whois.cgi?query=' . decode_ip2($recentrow[$j]['pic_user_ip']) . '" target="_blank">' . decode_ip2($recentrow[$j]['pic_user_ip']) .'</a><br />' : '' ) ); *************** *** 360,384 **** if ($allowed_cat != '') { ! ! $sql = "SELECT p.pic_id, p.pic_title, p.pic_desc, p.pic_user_id, p.pic_user_ip, p.pic_username, p.pic_time, p.pic_cat_id, p.pic_view_count, u.user_id, u.username, r.rate_pic_id, AVG(r.rate_point) AS rating, COUNT(DISTINCT c.comment_id) AS comments ! FROM ". ALBUM_TABLE ." AS p ! LEFT JOIN ". USERS_TABLE ." AS u ON p.pic_user_id = u.user_id ! LEFT JOIN ". ALBUM_CAT_TABLE ." AS ct ON p.pic_cat_id = ct.cat_id ! LEFT JOIN ". ALBUM_RATE_TABLE ." AS r ON p.pic_id = r.rate_pic_id ! LEFT JOIN ". ALBUM_COMMENT_TABLE ." AS c ON p.pic_id = c.comment_pic_id ! WHERE p.pic_cat_id IN ($allowed_cat) AND ( p.pic_approval = 1 OR ct.cat_approval = 0 ) ! GROUP BY p.pic_id ! ORDER BY rating DESC ! LIMIT ". $album_sp_config['img_cols'] * $album_sp_config['img_rows']; ! if( !($result = $db->sql_query($sql)) ) { ! mx_message_die(GENERAL_ERROR, 'Could not query highest rated pics information', '', __LINE__, __FILE__, $sql); } ! $highestrow = array(); ! while( $row = $db->sql_fetchrow($result) ) ! { ! $highestrow[] = $row; } --- 372,407 ---- if ($allowed_cat != '') { ! if (($mx_cache->get('album_highest_list')) && ($use_cache)) { ! $highestrow = $mx_cache->get('album_highest_list'); } + else + { + $sql = "SELECT p.pic_id, p.pic_title, p.pic_desc, p.pic_user_id, p.pic_user_ip, p.pic_username, p.pic_time, p.pic_cat_id, p.pic_view_count, u.user_id, u.username, r.rate_pic_id, AVG(r.rate_point) AS rating, COUNT(DISTINCT c.comment_id) AS comments + FROM ". ALBUM_TABLE ." AS p + LEFT JOIN ". USERS_TABLE ." AS u ON p.pic_user_id = u.user_id + LEFT JOIN ". ALBUM_CAT_TABLE ." AS ct ON p.pic_cat_id = ct.cat_id + LEFT JOIN ". ALBUM_RATE_TABLE ." AS r ON p.pic_id = r.rate_pic_id + LEFT JOIN ". ALBUM_COMMENT_TABLE ." AS c ON p.pic_id = c.comment_pic_id + WHERE p.pic_cat_id IN ($allowed_cat) AND ( p.pic_approval = 1 OR ct.cat_approval = 0 ) + GROUP BY p.pic_id + ORDER BY rating DESC + LIMIT ". $album_sp_config['img_cols'] * $album_sp_config['img_rows']; + if( !($result = $db->sql_query($sql)) ) + { + mx_message_die(GENERAL_ERROR, 'Could not query highest rated pics information', '', __LINE__, __FILE__, $sql); + } ! $highestrow = array(); ! while( $row = $db->sql_fetchrow($result) ) ! { ! $highestrow[] = $row; ! } ! ! if ($use_cache) ! { ! $mx_cache->put('album_highest_list', $highestrow); ! } } *************** *** 429,433 **** 'H_TITLE' => $highestrow[$j]['pic_title'], 'H_POSTER' => $highest_poster, ! 'H_TIME' => create_date($board_config['default_dateformat'], $highestrow[$j]['pic_time'], $board_config['board_timezone']), 'H_VIEW' => $highestrow[$j]['pic_view_count'], --- 452,456 ---- 'H_TITLE' => $highestrow[$j]['pic_title'], 'H_POSTER' => $highest_poster, ! 'H_TIME' => create_date2($board_config['default_dateformat'], $highestrow[$j]['pic_time'], $board_config['board_timezone']), 'H_VIEW' => $highestrow[$j]['pic_view_count'], *************** *** 435,439 **** 'H_COMMENTS' => ($album_config['comment'] == 1) ? ( '<a href="'. append_sid(this_fap_toplisturl("smartor_mode=album_showpage&pic_id=". $highestrow[$j]['pic_id'], TRUE)) . '">' . $lang['Comments'] . '</a>: ' . $highestrow[$j]['comments'] . '<br />') : '' ! // 'H_IP' => ($userdata['user_level'] == ADMIN) ? $lang['IP_Address'] . ': <a href="http://www.nic.com/cgi-bin/whois.cgi?query=' . decode_ip($highestrow[$j]['pic_user_ip']) . '" target="_blank">' . decode_ip($highestrow[$j]['pic_user_ip']) .'</a><br />' : '' ) ); --- 458,462 ---- 'H_COMMENTS' => ($album_config['comment'] == 1) ? ( '<a href="'. append_sid(this_fap_toplisturl("smartor_mode=album_showpage&pic_id=". $highestrow[$j]['pic_id'], TRUE)) . '">' . $lang['Comments'] . '</a>: ' . $highestrow[$j]['comments'] . '<br />') : '' ! // 'H_IP' => ($userdata['user_level'] == ADMIN) ? $lang['IP_Address'] . ': <a href="http://www.nic.com/cgi-bin/whois.cgi?query=' . decode_ip2($highestrow[$j]['pic_user_ip']) . '" target="_blank">' . decode_ip2($highestrow[$j]['pic_user_ip']) .'</a><br />' : '' ) ); *************** *** 468,503 **** if ($allowed_cat != '') { ! /* ! $sql = "SELECT p.pic_id, p.pic_title, p.pic_desc, p.pic_user_id, p.pic_user_ip, p.pic_username, p.pic_time, p.pic_cat_id, p.pic_view_count, u.user_id, u.username, r.rate_pic_id, AVG(r.rate_point) AS rating, SUM( c.comment_id) AS comments ! FROM ". ALBUM_TABLE ." AS p, ". ALBUM_COMMENT_TABLE ." AS c, ". USERS_TABLE ." AS u, ". ALBUM_CAT_TABLE ." AS ct , ". ALBUM_RATE_TABLE ." AS r ! WHERE p.pic_user_id = u.user_id ! AND p.pic_cat_id = ct.cat_id ! AND p.pic_id = r.rate_pic_id ! AND p.pic_id = c.comment_pic_id ! AND p.pic_cat_id IN ($allowed_cat) AND ( p.pic_approval = 1 OR ct.cat_approval = 0 ) ! GROUP BY p.pic_id ! ORDER BY RAND() ! LIMIT ". $album_sp_config['img_cols'] * $album_sp_config['img_rows']; ! */ ! $sql = "SELECT p.pic_id, p.pic_title, p.pic_desc, p.pic_user_id, p.pic_user_ip, p.pic_username, p.pic_time, p.pic_cat_id, p.pic_view_count, u.user_id, u.username, r.rate_pic_id, AVG(r.rate_point) AS rating, COUNT(DISTINCT c.comment_id) AS comments ! FROM ". ALBUM_TABLE ." AS p ! LEFT JOIN ". USERS_TABLE ." AS u ON p.pic_user_id = u.user_id ! LEFT JOIN ". ALBUM_CAT_TABLE ." AS ct ON p.pic_cat_id = ct.cat_id ! LEFT JOIN ". ALBUM_RATE_TABLE ." AS r ON p.pic_id = r.rate_pic_id ! LEFT JOIN ". ALBUM_COMMENT_TABLE ." AS c ON p.pic_id = c.comment_pic_id ! WHERE p.pic_cat_id IN ($allowed_cat) AND ( p.pic_approval = 1 OR ct.cat_approval = 0 ) ! GROUP BY p.pic_id ! ORDER BY RAND() ! LIMIT ". $album_sp_config['img_cols'] * $album_sp_config['img_rows']; ! if( !($result = $db->sql_query($sql)) ) { ! mx_message_die(GENERAL_ERROR, 'Could not query rand pics information', '', __LINE__, __FILE__, $sql); } ! $randrow = array(); ! while( $row = $db->sql_fetchrow($result) ) ! { ! $randrow[] = $row; } --- 491,526 ---- if ($allowed_cat != '') { ! if (($mx_cache->get('album_rand_list')) && ($use_cache)) { ! $randrow = $mx_cache->get('album_rand_list'); } + else + { + $sql = "SELECT p.pic_id, p.pic_title, p.pic_desc, p.pic_user_id, p.pic_user_ip, p.pic_username, p.pic_time, p.pic_cat_id, p.pic_view_count, u.user_id, u.username, r.rate_pic_id, AVG(r.rate_point) AS rating, COUNT(DISTINCT c.comment_id) AS comments + FROM ". ALBUM_TABLE ." AS p + LEFT JOIN ". USERS_TABLE ." AS u ON p.pic_user_id = u.user_id + LEFT JOIN ". ALBUM_CAT_TABLE ." AS ct ON p.pic_cat_id = ct.cat_id + LEFT JOIN ". ALBUM_RATE_TABLE ." AS r ON p.pic_id = r.rate_pic_id + LEFT JOIN ". ALBUM_COMMENT_TABLE ." AS c ON p.pic_id = c.comment_pic_id + WHERE p.pic_cat_id IN ($allowed_cat) AND ( p.pic_approval = 1 OR ct.cat_approval = 0 ) + GROUP BY p.pic_id + ORDER BY RAND() + LIMIT ". $album_sp_config['img_cols'] * $album_sp_config['img_rows']; + if( !($result = $db->sql_query($sql)) ) + { + mx_message_die(GENERAL_ERROR, 'Could not query rand pics information', '', __LINE__, __FILE__, $sql); + } ! $randrow = array(); ! while( $row = $db->sql_fetchrow($result) ) ! { ! $randrow[] = $row; ! } ! ! if ($use_cache) ! { ! $mx_cache->put('album_rand_list', $randrow); ! } } *************** *** 550,554 **** 'TITLE' => $randrow[$j]['pic_title'], 'POSTER' => $rand_poster, ! 'TIME' => create_date($board_config['default_dateformat'], $randrow[$j]['pic_time'], $board_config['board_timezone']), 'VIEW' => $randrow[$j]['pic_view_count'], --- 573,577 ---- 'TITLE' => $randrow[$j]['pic_title'], 'POSTER' => $rand_poster, ! 'TIME' => create_date2($board_config['default_dateformat'], $randrow[$j]['pic_time'], $board_config['board_timezone']), 'VIEW' => $randrow[$j]['pic_view_count'], *************** *** 558,562 **** 'COMMENTS' => ($album_config['comment'] == 1) ? ( '<a href="'. append_sid(this_fap_toplisturl("smartor_mode=album_showpage&pic_id=". $randrow[$j]['pic_id'], TRUE)) . '">' . $lang['Comments'] . '</a>: ' . $randrow[$j]['comments'] . '<br />') : '' ! // 'IP' => ($userdata['user_level'] == ADMIN) ? $lang['IP_Address'] . ': <a href="http://www.nic.com/cgi-bin/whois.cgi?query=' . decode_ip($randrow[$j]['pic_user_ip']) . '" target="_blank">' . decode_ip($randrow[$j]['pic_user_ip']) .'</a><br />' : '' ) ); --- 581,585 ---- 'COMMENTS' => ($album_config['comment'] == 1) ? ( '<a href="'. append_sid(this_fap_toplisturl("smartor_mode=album_showpage&pic_id=". $randrow[$j]['pic_id'], TRUE)) . '">' . $lang['Comments'] . '</a>: ' . $randrow[$j]['comments'] . '<br />') : '' ! // 'IP' => ($userdata['user_level'] == ADMIN) ? $lang['IP_Address'] . ': <a href="http://www.nic.com/cgi-bin/whois.cgi?query=' . decode_ip2($randrow[$j]['pic_user_ip']) . '" target="_blank">' . decode_ip2($randrow[$j]['pic_user_ip']) .'</a><br />' : '' ) ); |