|
From: Jon O. <jon...@us...> - 2005-04-11 17:56:22
|
Update of /cvsroot/mxbb/mx_pafiledb/pafiledb/modules In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2875/modules/mx_pafiledb/pafiledb/modules Modified Files: pa_file.php pa_mcp.php pa_post_comment.php pa_toplist.php pa_user_upload.php pa_viewall.php Log Message: finally upgrading this module/mod - merging phpBB mod, mxBB module (2.7.x and 2.8) -.permissions reviewed - pm notification added - and many many minor fixes all over the place Index: pa_viewall.php =================================================================== RCS file: /cvsroot/mxbb/mx_pafiledb/pafiledb/modules/pa_viewall.php,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** pa_viewall.php 9 Jan 2005 21:44:14 -0000 1.8 --- pa_viewall.php 11 Apr 2005 17:55:42 -0000 1.9 *************** *** 78,82 **** { message_die( GENERAL_MESSAGE, $lang['viewall_disabled'] ); ! }elseif ( !$this->auth_global['auth_viewall'] ) { if ( !$userdata['session_logged_in'] ) --- 78,83 ---- { message_die( GENERAL_MESSAGE, $lang['viewall_disabled'] ); ! } ! elseif ( !$this->auth_global['auth_viewall'] ) { if ( !$userdata['session_logged_in'] ) Index: pa_mcp.php =================================================================== RCS file: /cvsroot/mxbb/mx_pafiledb/pafiledb/modules/pa_mcp.php,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** pa_mcp.php 9 Jan 2005 21:44:14 -0000 1.6 --- pa_mcp.php 11 Apr 2005 17:55:41 -0000 1.7 *************** *** 48,52 **** // Pafiledb auth for mcp // =================================================== ! if ( ( !$this->auth[$cat_id]['auth_mod'] ) || !$userdata['session_logged_in'] ) { // if ( !$userdata['session_logged_in'] ) --- 48,52 ---- // Pafiledb auth for mcp // =================================================== ! if ( !($this->auth[$cat_id]['auth_mod'] && $userdata['session_logged_in']) ) { // if ( !$userdata['session_logged_in'] ) *************** *** 138,143 **** if ( $mode == 'do_approve' || $mode == 'do_unapprove' ) { ! if ( ( $pafiledb_config['validator'] == 'validator_mod' && $this->auth[$cat_id]['auth_mod'] ) || $userdata['user_level'] == ADMIN ) { if ( is_array( $file_ids ) && !empty( $file_ids ) ) { --- 138,145 ---- if ( $mode == 'do_approve' || $mode == 'do_unapprove' ) { ! if ( $this->auth[$cat_id]['auth_mod'] || $userdata['user_level'] == ADMIN ) { + $mode_temp = $mode == 'do_approve' ? 'approved' : 'unapproved'; + if ( is_array( $file_ids ) && !empty( $file_ids ) ) { *************** *** 145,148 **** --- 147,171 ---- { $this->file_approve( $mode, $temp_file_id ); + + if ( $pafiledb_config['pm_notify'] ) + { + $pa_pm = array(); + + // Populate the pa_pm variable + $pa_pm = pa_get_pm_data( $temp_file_id ); + + // Compose post header + $pa_message_tmp = pa_compose_pm( $pa_pm ); + $pa_message = $pa_message_tmp['message']; + $pa_update_message = $pa_message_tmp['update_message']; + + // PM notify + $pa_admins = pa_get_admins( true ); + + for ($i = 0; $i < count($pa_admins) || $i < 10; $ii) + { + pa_notify( $pafiledb_config['pm_notify'], $pa_message, $pa_admins[$i]['user_id'], $pa_pm['file_editor_id'], $info = $mode_temp ); + } + } } } *************** *** 150,154 **** --- 173,199 ---- { $this->file_approve( $mode, $file_id ); + + if ( $pafiledb_config['pm_notify'] ) + { + $pa_pm = array(); + + // Populate the pa_pm variable + $pa_pm = pa_get_pm_data( $file_id ); + + // Compose post header + $pa_message_tmp = pa_compose_pm( $pa_pm ); + $pa_message = $pa_message_tmp['message']; + $pa_update_message = $pa_message_tmp['update_message']; + + // PM notify + $pa_admins = pa_get_admins( true ); + + for ($i = 0; $i < count($pa_admins) || $i < 10; $ii) + { + pa_notify( $pafiledb_config['pm_notify'], $pa_message, $pa_admins[$i]['user_id'], $pa_pm['file_editor_id'], $info = $mode_temp ); + } + } } + $this->_pafiledb(); } *************** *** 294,298 **** 'row_set' => $all_file_rowset, 'approval' => 'unapprove' ) ); ! }elseif ( $mode == 'all_file' ) { $global_array = array( 0 => array( 'lang_var' => $lang['Approved_files'], --- 339,344 ---- 'row_set' => $all_file_rowset, 'approval' => 'unapprove' ) ); ! } ! elseif ( $mode == 'all_file' ) { $global_array = array( 0 => array( 'lang_var' => $lang['Approved_files'], *************** *** 305,319 **** 'row_set' => $all_file_rowset, 'approval' => 'unapprove' ) ); ! }elseif ( $mode == 'file_cat' ) { $global_array = array( 0 => array( 'lang_var' => $lang['All_files'], 'row_set' => $all_file_rowset, 'approval' => 'unapprove' ) ); ! }elseif ( $mode == 'approved' ) { $global_array = array( 0 => array( 'lang_var' => $lang['Approved_files'], 'row_set' => $approved_file_rowset, 'approval' => 'approve' ) ); ! }elseif ( $mode == 'broken' ) { $global_array = array( 0 => array( 'lang_var' => $lang['Broken_files'], --- 351,368 ---- 'row_set' => $all_file_rowset, 'approval' => 'unapprove' ) ); ! } ! elseif ( $mode == 'file_cat' ) { $global_array = array( 0 => array( 'lang_var' => $lang['All_files'], 'row_set' => $all_file_rowset, 'approval' => 'unapprove' ) ); ! } ! elseif ( $mode == 'approved' ) { $global_array = array( 0 => array( 'lang_var' => $lang['Approved_files'], 'row_set' => $approved_file_rowset, 'approval' => 'approve' ) ); ! } ! elseif ( $mode == 'broken' ) { $global_array = array( 0 => array( 'lang_var' => $lang['Broken_files'], *************** *** 372,379 **** { $approve = $unapprove = true; ! }elseif ( $files_data['approval'] == 'approve' ) { $approve = true; ! }elseif ( $files_data['approval'] == 'unapprove' ) { $unapprove = true; --- 421,430 ---- { $approve = $unapprove = true; ! } ! elseif ( $files_data['approval'] == 'approve' ) { $approve = true; ! } ! elseif ( $files_data['approval'] == 'unapprove' ) { $unapprove = true; Index: pa_post_comment.php =================================================================== RCS file: /cvsroot/mxbb/mx_pafiledb/pafiledb/modules/pa_post_comment.php,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** pa_post_comment.php 9 Jan 2005 21:44:14 -0000 1.7 --- pa_post_comment.php 11 Apr 2005 17:55:41 -0000 1.8 *************** *** 32,36 **** global $mx_root_path, $module_root_path, $is_block, $phpEx; // MX FIX ! // include_once($phpbb_root_path . 'includes/bbcode.'.$phpEx); include( $phpbb_root_path . 'includes/functions_post.' . $phpEx ); --- 32,36 ---- global $mx_root_path, $module_root_path, $is_block, $phpEx; // MX FIX ! include_once($phpbb_root_path . 'includes/bbcode.'.$phpEx); include( $phpbb_root_path . 'includes/functions_post.' . $phpEx ); Index: pa_file.php =================================================================== RCS file: /cvsroot/mxbb/mx_pafiledb/pafiledb/modules/pa_file.php,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** pa_file.php 9 Jan 2005 21:44:14 -0000 1.10 --- pa_file.php 11 Apr 2005 17:55:41 -0000 1.11 *************** *** 42,47 **** { case 'oracle': ! $sql = "SELECT f.*, AVG(r.rate_point) AS rating, COUNT(r.votes_file) AS total_votes, u.user_id, u.username, COUNT(c.comments_id) as total_comments ! FROM " . PA_FILES_TABLE . " AS f, " . PA_VOTES_TABLE . " AS r, " . USERS_TABLE . " AS u, " . PA_COMMENTS_TABLE . " AS c WHERE f.file_id = r.votes_file(+) AND f.user_id = u.user_id(+) --- 42,47 ---- { case 'oracle': ! $sql = "SELECT f.*, AVG(r.rate_point) AS rating, COUNT(r.votes_file) AS total_votes, u.user_id, u.username, COUNT(c.comments_id) as total_comments, cat.cat_allow_ratings, cat.cat_allow_comments ! FROM " . PA_FILES_TABLE . " AS f, " . PA_VOTES_TABLE . " AS r, " . USERS_TABLE . " AS u, " . PA_COMMENTS_TABLE . " AS c, " . PA_CATEGORY_TABLE . " AS cat WHERE f.file_id = r.votes_file(+) AND f.user_id = u.user_id(+) *************** *** 49,61 **** AND f.file_id = $file_id AND f.file_approved = 1 GROUP BY f.file_id "; break; default: ! $sql = "SELECT f.*, AVG(r.rate_point) AS rating, COUNT(r.votes_file) AS total_votes, u.user_id, u.username, COUNT(c.comments_id) as total_comments FROM " . PA_FILES_TABLE . " AS f LEFT JOIN " . PA_VOTES_TABLE . " AS r ON f.file_id = r.votes_file LEFT JOIN " . USERS_TABLE . " AS u ON f.user_id = u.user_id LEFT JOIN " . PA_COMMENTS_TABLE . " AS c ON f.file_id = c.file_id WHERE f.file_id = $file_id AND f.file_approved = 1 --- 49,63 ---- AND f.file_id = $file_id AND f.file_approved = 1 + AND f.file_catid = cat.cat_id GROUP BY f.file_id "; break; default: ! $sql = "SELECT f.*, AVG(r.rate_point) AS rating, COUNT(r.votes_file) AS total_votes, u.user_id, u.username, COUNT(c.comments_id) as total_comments, cat.cat_allow_ratings, cat.cat_allow_comments FROM " . PA_FILES_TABLE . " AS f LEFT JOIN " . PA_VOTES_TABLE . " AS r ON f.file_id = r.votes_file LEFT JOIN " . USERS_TABLE . " AS u ON f.user_id = u.user_id LEFT JOIN " . PA_COMMENTS_TABLE . " AS c ON f.file_id = c.file_id + LEFT JOIN " . PA_CATEGORY_TABLE . " AS cat ON f.file_catid = cat.cat_id WHERE f.file_id = $file_id AND f.file_approved = 1 *************** *** 147,151 **** $file_poster .= ( $file_data['user_id'] != ANONYMOUS ) ? $file_data['username'] : $lang['Guest']; $file_poster .= ( $file_data['user_id'] != ANONYMOUS ) ? '</a>' : ''; ! $pafiledb_template->assign_vars( array( 'L_CLICK_HERE' => $lang['Click_here'], 'L_AUTHOR' => $lang['Creator'], --- 149,158 ---- $file_poster .= ( $file_data['user_id'] != ANONYMOUS ) ? $file_data['username'] : $lang['Guest']; $file_poster .= ( $file_data['user_id'] != ANONYMOUS ) ? '</a>' : ''; ! ! if ( $file_data['cat_allow_ratings'] ) ! { ! $pafiledb_template->assign_block_vars( 'show_ratings', array( ) ); ! } ! $pafiledb_template->assign_vars( array( 'L_CLICK_HERE' => $lang['Click_here'], 'L_AUTHOR' => $lang['Creator'], *************** *** 190,196 **** 'AUTH_DOWNLOAD' => ( $this->auth[$file_data['file_catid']]['auth_download'] ) ? true : false, ! 'AUTH_RATE' => ( $this->auth[$file_data['file_catid']]['auth_rate'] ) ? true : false, 'AUTH_EMAIL' => ( $this->auth[$file_data['file_catid']]['auth_email'] ) ? true : false, ! 'INCLUDE_COMMENTS' => ( $this->auth[$file_data['file_catid']]['auth_view_comment'] ) ? true : false, 'DELETE_IMG' => $phpbb_root_path . $images['icon_delpost'], 'EDIT_IMG' => $phpbb_root_path . $images['icon_edit'], --- 197,203 ---- 'AUTH_DOWNLOAD' => ( $this->auth[$file_data['file_catid']]['auth_download'] ) ? true : false, ! 'AUTH_RATE' => ( $this->auth[$file_data['file_catid']]['auth_rate'] && $file_data['cat_allow_ratings'] ) ? true : false, 'AUTH_EMAIL' => ( $this->auth[$file_data['file_catid']]['auth_email'] ) ? true : false, ! 'INCLUDE_COMMENTS' => ( $this->auth[$file_data['file_catid']]['auth_view_comment'] && $file_data['cat_allow_comments'] ) ? true : false, 'DELETE_IMG' => $phpbb_root_path . $images['icon_delpost'], 'EDIT_IMG' => $phpbb_root_path . $images['icon_edit'], *************** *** 228,232 **** $custom_field->display_data( $file_id ); ! if ( $this->auth[$file_data['file_catid']]['auth_view_comment'] ) { /* - orig --- 235,239 ---- $custom_field->display_data( $file_id ); ! if ( $this->auth[$file_data['file_catid']]['auth_view_comment'] && $file_data['cat_allow_comments'] ) { /* - orig Index: pa_user_upload.php =================================================================== RCS file: /cvsroot/mxbb/mx_pafiledb/pafiledb/modules/pa_user_upload.php,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** pa_user_upload.php 9 Jan 2005 21:44:14 -0000 1.9 --- pa_user_upload.php 11 Apr 2005 17:55:41 -0000 1.10 *************** *** 118,123 **** $temp_id = $this->update_add_file(); $custom_field->file_update_data( $temp_id ); ! $this->_pafiledb(); ! if ( $pafiledb_config['need_validation'] == '0' ) { $message = $lang['Fileadded'] . '<br /><br />' . sprintf( $lang['Click_return'], '<a href="' . append_sid( pa_this_mxurl( "action=file&file_id=" . $temp_id ) ) . '">', '</a>' ); --- 118,123 ---- $temp_id = $this->update_add_file(); $custom_field->file_update_data( $temp_id ); ! ! if ( $this->auth[$cat_id]['auth_approval'] || ( $this->auth[$cat_id]['auth_mod'] && $userdata['session_logged_in'] )) { $message = $lang['Fileadded'] . '<br /><br />' . sprintf( $lang['Click_return'], '<a href="' . append_sid( pa_this_mxurl( "action=file&file_id=" . $temp_id ) ) . '">', '</a>' ); *************** *** 127,138 **** $message = $lang['Fileadded_not_validated'] . '<br /><br />' . sprintf( $lang['Click_return'], '<a href="' . append_sid( pa_this_mxurl( "action=category&cat_id=" . $cat_id ) ) . '">', '</a>' ); } ! // $mode = 'edit'; ! }elseif ( $file_id != '' ) { $file_id = $this->update_add_file( $file_id ); $custom_field->file_update_data( $file_id ); $this->_pafiledb(); $message = $lang['Fileedited'] . '<br /><br />' . sprintf( $lang['Click_return'], '<a href="' . append_sid( pa_this_mxurl( "action=file&file_id=" . $file_id ) ) . '">', '</a>' ); - // $mode = 'edit'; } --- 127,176 ---- $message = $lang['Fileadded_not_validated'] . '<br /><br />' . sprintf( $lang['Click_return'], '<a href="' . append_sid( pa_this_mxurl( "action=category&cat_id=" . $cat_id ) ) . '">', '</a>' ); } ! ! $this->_pafiledb(); ! ! $pa_pm = array(); ! ! // Populate the pa_pm variable ! $pa_pm = pa_get_pm_data( $temp_id ); ! ! // Compose post header ! $pa_message_tmp = pa_compose_pm( $pa_pm ); ! $pa_message = $pa_message_tmp['message']; ! $pa_update_message = $pa_message_tmp['update_message']; ! ! // PM notify ! $pa_admins = pa_get_admins( true); ! ! for ($i = 0; $i < count($pa_admins) || $i < 10; $ii) ! { ! pa_notify( $pafiledb_config['pm_notify'], $pa_message, $pa_admins[$i]['user_id'], $pa_pm['file_editor_id'], $info = 'new' ); ! } ! } ! elseif ( $file_id != '' ) { $file_id = $this->update_add_file( $file_id ); $custom_field->file_update_data( $file_id ); $this->_pafiledb(); + + $pa_pm = array(); + + // Populate the pa_pm variable + $pa_pm = pa_get_pm_data( $file_id ); + + // Compose post header + $pa_message_tmp = pa_compose_pm( $pa_pm ); + $pa_message = $pa_message_tmp['message']; + $pa_update_message = $pa_message_tmp['update_message']; + + // PM notify + $pa_admins = pa_get_admins( true); + + for ($i = 0; $i < count($pa_admins) || $i < 10; $i++) + { + pa_notify( $pafiledb_config['pm_notify'], $pa_message, $pa_admins[$i]['user_id'], $pa_pm['file_editor_id'], $info = 'edited' ); + } + $message = $lang['Fileedited'] . '<br /><br />' . sprintf( $lang['Click_return'], '<a href="' . append_sid( pa_this_mxurl( "action=file&file_id=" . $file_id ) ) . '">', '</a>' ); } *************** *** 157,161 **** $file_website = ''; $file_posticons = $pafiledb_functions->post_icons(); - // MX $file_cat_list = $this->jumpmenu_option(0, 0, '', true); $file_cat_list = ( !$cat_id ) ? $this->jumpmenu_option( 0, 0, '', true ) : $this->jumpmenu_option( 0, 0, array( $cat_id => 1 ), true, true ); $file_license = $pafiledb_functions->license_list(); --- 195,198 ---- *************** *** 172,176 **** $mode = 'ADD'; $l_title = $lang['Afiletitle']; ! }elseif ( $file_id != '' ) { $sql = 'SELECT * --- 209,214 ---- $mode = 'ADD'; $l_title = $lang['Afiletitle']; ! } ! elseif ( $file_id != '' ) { $sql = 'SELECT * *************** *** 182,185 **** --- 220,224 ---- } $file_info = $db->sql_fetchrow( $result ); + // AUTH CHECK if ( !( ( $this->auth[$file_info['file_catid']]['auth_edit_file'] && $file_info['user_id'] == $userdata['user_id'] ) || $this->auth[$file_info['file_catid']]['auth_mod'] ) ) *************** *** 203,207 **** $approved_checked_yes = ( $file_info['file_approved'] ) ? ' checked' : ''; $approved_checked_no = ( !$file_info['file_approved'] ) ? ' checked' : ''; - // MX addon $file_approved = ( $file_info['file_approved'] == '1' ) ? 1 : 0; $file_ssurl = $file_info['file_ssurl']; --- 242,245 ---- Index: pa_toplist.php =================================================================== RCS file: /cvsroot/mxbb/mx_pafiledb/pafiledb/modules/pa_toplist.php,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** pa_toplist.php 9 Jan 2005 21:44:14 -0000 1.9 --- pa_toplist.php 11 Apr 2005 17:55:41 -0000 1.10 *************** *** 149,152 **** --- 149,153 ---- 'L_30_DAYS' => $lang['30_days'], 'L_NEW_FILES' => sprintf( $lang['New_Files'], $days ), + /* - orig *************** *** 218,222 **** { case 'oracle': ! $sql = "SELECT f1.*, AVG(r.rate_point) AS rating, COUNT(r.votes_file) AS total_votes, u.user_id, u.username, c.cat_id, c.cat_name, COUNT(c.comments_id) AS total_comments FROM " . PA_FILES_TABLE . " AS f1, " . PA_VOTES_TABLE . " AS r, " . USERS_TABLE . " AS u, " . PA_CATEGORY_TABLE . " AS c, " . PA_COMMENTS_TABLE . " AS cm WHERE f1.file_id = r.votes_file(+) --- 219,223 ---- { case 'oracle': ! $sql = "SELECT f1.*, AVG(r.rate_point) AS rating, COUNT(r.votes_file) AS total_votes, u.user_id, u.username, c.cat_id, c.cat_name, COUNT(c.comments_id) AS total_comments, c.cat_name, c.cat_allow_ratings, c.cat_allow_comments FROM " . PA_FILES_TABLE . " AS f1, " . PA_VOTES_TABLE . " AS r, " . USERS_TABLE . " AS u, " . PA_CATEGORY_TABLE . " AS c, " . PA_COMMENTS_TABLE . " AS cm WHERE f1.file_id = r.votes_file(+) *************** *** 231,235 **** default: ! $sql = "SELECT f1.*, AVG(r.rate_point) AS rating, COUNT(r.votes_file) AS total_votes, u.user_id, u.username, c.cat_id, c.cat_name, COUNT(cm.comments_id) AS total_comments FROM " . PA_FILES_TABLE . " AS f1, " . PA_CATEGORY_TABLE . " AS c LEFT JOIN " . PA_VOTES_TABLE . " AS r ON f1.file_id = r.votes_file --- 232,236 ---- default: ! $sql = "SELECT f1.*, AVG(r.rate_point) AS rating, COUNT(r.votes_file) AS total_votes, u.user_id, u.username, c.cat_id, c.cat_name, COUNT(cm.comments_id) AS total_comments, c.cat_name, c.cat_allow_ratings, c.cat_allow_comments FROM " . PA_FILES_TABLE . " AS f1, " . PA_CATEGORY_TABLE . " AS c LEFT JOIN " . PA_VOTES_TABLE . " AS r ON f1.file_id = r.votes_file *************** *** 262,265 **** --- 263,276 ---- } + $pa_use_ratings = false; + for ( $i = 0; $i < count( $file_rowset ); $i++ ) + { + if ( $file_rowset[$i]['cat_allow_ratings'] ) + { + $pa_use_ratings = true; + break; + } + } + for ( $i = 0; $i < count( $file_rowset ); $i++ ) { *************** *** 335,340 **** 'FILE_SUBMITER' => $poster, 'DATE' => $date, ! 'RATING' => $rating, 'DOWNLOADS' => $file_rowset[$i]['file_dls'], 'U_FILE' => $file_url, --- 346,353 ---- 'FILE_SUBMITER' => $poster, 'DATE' => $date, ! 'RATING' => ( $file_rowset[$i]['cat_allow_ratings'] ? $rating : $lang['kb_no_ratings'] ), 'DOWNLOADS' => $file_rowset[$i]['file_dls'], + + 'SHOW_RATINGS' => ( $pa_use_ratings ) ? true : false, 'U_FILE' => $file_url, *************** *** 429,433 **** { case 'oracle': ! $sql = "SELECT f1.*, AVG(r.rate_point) AS rating, COUNT(r.votes_file) AS total_votes, u.user_id, u.username, c.cat_id, c.cat_name FROM " . PA_FILES_TABLE . " AS f1, " . PA_VOTES_TABLE . " AS r, " . USERS_TABLE . " AS u, " . PA_CATEGORY_TABLE . " AS c WHERE f1.file_id = r.votes_file(+) --- 442,446 ---- { case 'oracle': ! $sql = "SELECT f1.*, AVG(r.rate_point) AS rating, COUNT(r.votes_file) AS total_votes, u.user_id, u.username, c.cat_id, c.cat_name, c.cat_name, c.cat_allow_ratings, c.cat_allow_comments FROM " . PA_FILES_TABLE . " AS f1, " . PA_VOTES_TABLE . " AS r, " . USERS_TABLE . " AS u, " . PA_CATEGORY_TABLE . " AS c WHERE f1.file_id = r.votes_file(+) *************** *** 441,445 **** default: ! $sql = "SELECT f1.*, AVG(r.rate_point) AS rating, COUNT(r.votes_file) AS total_votes, u.user_id, u.username, c.cat_id, c.cat_name FROM " . PA_FILES_TABLE . " AS f1, " . PA_CATEGORY_TABLE . " AS c LEFT JOIN " . PA_VOTES_TABLE . " AS r ON f1.file_id = r.votes_file --- 454,458 ---- default: ! $sql = "SELECT f1.*, AVG(r.rate_point) AS rating, COUNT(r.votes_file) AS total_votes, u.user_id, u.username, c.cat_id, c.cat_name, c.cat_allow_ratings, c.cat_allow_comments FROM " . PA_FILES_TABLE . " AS f1, " . PA_CATEGORY_TABLE . " AS c LEFT JOIN " . PA_VOTES_TABLE . " AS r ON f1.file_id = r.votes_file *************** *** 464,467 **** --- 477,490 ---- } + $pa_use_ratings = false; + for ( $i = 0; $i < count( $searchset ); $i++ ) + { + if ( $searchset[$i]['cat_allow_ratings'] ) + { + $pa_use_ratings = true; + break; + } + } + for( $i = 0; $i < count( $searchset ); $i++ ) { *************** *** 541,545 **** 'FILE_SUBMITER' => $poster, 'DATE' => $date, ! 'RATING' => $rating, 'DOWNLOADS' => $searchset[$i]['file_dls'], 'U_FILE' => $file_url, --- 564,569 ---- 'FILE_SUBMITER' => $poster, 'DATE' => $date, ! 'RATING' => ( $searchset[$i]['cat_allow_ratings'] ? $rating : $lang['kb_no_ratings'] ), ! 'SHOW_RATINGS' => ( $pa_use_ratings ? true : false ), 'DOWNLOADS' => $searchset[$i]['file_dls'], 'U_FILE' => $file_url, *************** *** 550,553 **** --- 574,579 ---- } + $pafiledb_template->assign_vars( array( 'SHOW_RATINGS' => ( $pa_use_ratings ) ? true : false ) ); + $this->display( $lang['Download'], 'pa_toplist_body.tpl' ); } |