|
From: Jon O. <jon...@us...> - 2006-08-04 20:11:53
|
Update of /cvsroot/mxbb/mx_pafiledb/pafiledb/includes In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv5513/modules/mx_pafiledb/pafiledb/includes Modified Files: functions_pafiledb.php Log Message: statistics Index: functions_pafiledb.php =================================================================== RCS file: /cvsroot/mxbb/mx_pafiledb/pafiledb/includes/functions_pafiledb.php,v retrieving revision 1.38 retrieving revision 1.39 diff -C2 -d -r1.38 -r1.39 *** functions_pafiledb.php 4 Aug 2006 16:32:19 -0000 1.38 --- functions_pafiledb.php 4 Aug 2006 20:11:50 -0000 1.39 *************** *** 1055,1066 **** $filelist = false; ! if ( empty( $cat_id ) ) ! { ! $cat_where = ''; ! } ! else ! { ! $cat_where = "AND f1.file_catid = $cat_id"; ! } // --- 1055,1062 ---- $filelist = false; ! // ! // Category SQL ! // ! $cat_where = empty( $cat_id ) ? "AND f1.file_catid IN (" . $this->gen_cat_ids( '0' ) . ")" : "AND f1.file_catid = $cat_id"; // *************** *** 1084,1088 **** default: ! $sql = "SELECT f1.*, f1.file_id, r.votes_file, AVG(r.rate_point) AS rating, COUNT(r.votes_file) AS total_votes, u.user_id, u.username, COUNT(c.file_id) AS total_comments FROM " . PA_FILES_TABLE . " AS f1 LEFT JOIN " . PA_VOTES_TABLE . " AS r ON f1.file_id = r.votes_file --- 1080,1084 ---- default: ! $sql = "SELECT f1.*, f1.file_id, r.votes_file, IF(COUNT(r.rate_point)>0,AVG(r.rate_point),0) AS rating, COUNT(r.votes_file) AS total_votes, u.user_id, u.username, COUNT(c.file_id) AS total_comments FROM " . PA_FILES_TABLE . " AS f1 LEFT JOIN " . PA_VOTES_TABLE . " AS r ON f1.file_id = r.votes_file *************** *** 1163,1171 **** $db->sql_freeresult( $result ); ! $where_sql = ( !empty( $cat_id ) ) ? "AND file_catid = $cat_id" : ''; ! $sql = "SELECT COUNT(file_id) as total_file ! FROM " . PA_FILES_TABLE . " ! WHERE file_approved='1' ! $where_sql"; if ( !( $result = $db->sql_query( $sql ) ) ) --- 1159,1166 ---- $db->sql_freeresult( $result ); ! $sql = "SELECT COUNT(f1.file_id) as total_file ! FROM " . PA_FILES_TABLE . " AS f1 ! WHERE f1.file_approved='1' ! $cat_where"; if ( !( $result = $db->sql_query( $sql ) ) ) |