|
From: Jon O. <jon...@us...> - 2006-08-13 18:53:15
|
Update of /cvsroot/mxbb/mx_pafiledb In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv28185/modules/mx_pafiledb Modified Files: dload_lists.php dload_quickdl.php pafiledb.pak Added Files: dload_mini.php Log Message: More module blocks - Mini block - Latest Item block Index: dload_lists.php =================================================================== RCS file: /cvsroot/mxbb/mx_pafiledb/dload_lists.php,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** dload_lists.php 1 Aug 2006 21:03:24 -0000 1.22 --- dload_lists.php 13 Aug 2006 18:53:09 -0000 1.23 *************** *** 9,55 **** */ ! if ( !function_exists( 'read_block_config' ) ) { ! define( 'IN_PORTAL', true ); ! $mx_root_path = '../../'; ! $phpEx = substr(strrchr(__FILE__, '.'), 1); ! include_once( $mx_root_path . 'common.' . $phpEx ); ! ! // ! // Start session management ! // ! $mx_user->init($user_ip, PAGE_INDEX); ! // ! // End session management ! // ! ! $block_id = ( !empty( $HTTP_GET_VARS['block_id'] ) ) ? $HTTP_GET_VARS['block_id'] : $HTTP_POST_VARS['id']; ! if ( empty( $block_id ) ) ! { ! $sql = "SELECT * FROM " . BLOCK_TABLE . " WHERE block_title = 'PafileDB_toplist' LIMIT 1"; ! if ( !$result = $db->sql_query( $sql ) ) ! { ! mx_message_die( GENERAL_ERROR, "Could not query PafileDB_toplist module information", "", __LINE__, __FILE__, $sql ); ! } ! $row = $db->sql_fetchrow( $result ); ! $block_id = $row['block_id']; ! } ! $is_block = false; } - else - { - if( !defined('IN_PORTAL') || !is_object($mx_block)) - { - die("Hacking attempt"); - } - // - // Read Block Settings - // - $title = $mx_block->block_info['block_title']; - $block_size = ( isset( $block_size ) && !empty( $block_size ) ? $block_size : '100%' ); ! $is_block = true; ! global $images; ! } // --- 9,25 ---- */ ! if( !defined('IN_PORTAL') || !is_object($mx_block)) { ! die("Hacking attempt"); } ! // ! // Read Block Settings ! // ! $title = $mx_block->block_info['block_title']; ! $block_size = ( isset( $block_size ) && !empty( $block_size ) ? $block_size : '100%' ); ! ! $is_block = true; ! global $images; // *************** *** 59,561 **** define( 'MXBB_27x', file_exists( $mx_root_path . 'mx_login.php' ) ); - // =================================================== - // Include the common file - // =================================================== - include_once( $module_root_path . 'pafiledb/pafiledb_common.' . $phpEx ); - // ! // Read block Configuration // ! $album_sp_config['img_rows'] = $mx_block->get_parameters( 'num_of_rows' ); ! $album_sp_config['img_cols'] = $mx_block->get_parameters( 'num_of_cols' ); ! ! $album_sp_config['disp_late'] = $mx_block->get_parameters( 'display_latest_posts' ) == 'TRUE' ? 1 : 0; ! $album_sp_config['disp_high'] = $mx_block->get_parameters( 'display_top_ranked' ) == 'TRUE' ? 1 : 0; ! $album_sp_config['disp_rand'] = $mx_block->get_parameters( 'display_random_posts' ) == 'TRUE' ? 1 : 0; ! $album_sp_config['disp_most'] = $mx_block->get_parameters( 'display_most_posts' ) == 'TRUE' ? 1 : 0; ! ! $album_config['rate'] = 1; ! $album_config['fullpic_popup'] = 0; ! $album_config['comment'] = 1; ! $album_sp_config['rate_type'] = 1; // // Get pafiledb target block // ! $pafiledb_block_id = $mx_block->get_parameters( 'target_block' ); ! $pafiledb_page_id = intval($pafiledb_block_id) > 0 ? get_page_id( $pafiledb_block_id ) : get_page_id( 'dload.php', true ); ! ! // ! // Build Categories Index ! // ! $sql = "SELECT c.*, COUNT(p.file_id) AS count ! FROM " . PA_CATEGORY_TABLE . " AS c ! LEFT JOIN " . PA_FILES_TABLE . " AS p ON c.cat_id = p.file_catid ! 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(); ! ! $pafiledb = new pafiledb_public(); ! $pafiledb->init(); ! ! while ( $row = $db->sql_fetchrow( $result ) ) ! { ! // $album_user_access = album_user_access($row['cat_id'], $row, 1, 0, 0, 0, 0, 0); // VIEW ! if ( $pafiledb->auth_user[$row['cat_id']]['auth_read'] ) ! { ! $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 ! /* ! +---------------------------------------------------------- ! | Recent Public Pics ! +---------------------------------------------------------- ! */ ! if ( $album_sp_config['disp_late'] == 1 ) ! { ! if ( $allowed_cat != '' ) ! { ! $sql = "SELECT p.file_ssurl, p.file_id, p.file_name, p.file_desc, p.user_id, p.poster_ip, p.file_creator, p.file_time, p.file_update_time, p.file_catid, p.file_dls, u.user_id, u.username, r.votes_file, AVG(r.rate_point) AS rating, COUNT(DISTINCT c.comments_id) AS comments ! FROM " . PA_FILES_TABLE . " AS p ! LEFT JOIN " . USERS_TABLE . " AS u ON p.user_id = u.user_id ! LEFT JOIN " . PA_CATEGORY_TABLE . " AS ct ON p.file_catid = ct.cat_id ! LEFT JOIN " . PA_VOTES_TABLE . " AS r ON p.file_id = r.votes_file ! LEFT JOIN " . PA_COMMENTS_TABLE . " AS c ON p.file_id = c.file_id ! WHERE p.file_catid IN ($allowed_cat) AND p.file_approved = 1 ! GROUP BY p.file_id ! ORDER BY file_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; ! } ! ! $template->assign_block_vars( 'recent_pics_block', array() ); ! ! if ( count( $recentrow ) > 0 ) ! { ! for ( $i = 0; $i < count( $recentrow ); $i += $album_sp_config['img_cols'] ) ! { ! $template->assign_block_vars( 'recent_pics_block.recent_pics', array() ); ! ! for ( $j = $i; $j < ( $i + $album_sp_config['img_cols'] ); $j++ ) ! { ! if ( $j >= count( $recentrow ) ) ! { ! break; ! } ! $file_screenshot_url = trim( $recentrow[$j]['file_ssurl'] ); ! $template->assign_block_vars( 'recent_pics_block.recent_pics.recent_col', array( ! // 'U_PIC' => ($album_config['fullpic_popup']) ? append_sid($pafiledb->this_mxurl("smartor_mode=album_pic&pic_id=". $recentrow[$j]['pic_id'])) : append_sid($pafiledb->this_mxurl("smartor_mode=album_showpage&pic_id=". $recentrow[$j]['pic_id'])), ! // 'THUMBNAIL' => append_sid($pafiledb->this_mxurl("smartor_mode=album_thumbnail&pic_id=". $recentrow[$j]['pic_id'], TRUE)), ! // 'DESC' => $recentrow[$j]['pic_desc'] ! 'SS' => ( !empty( $file_screenshot_url ) ) ? '<hr><a href="' . append_sid( $pafiledb->this_mxurl_list( "action=file&file_id=" . $recentrow[$j]['file_id'], false, $pafiledb_page_id ) ) . '"><img src="' . $file_screenshot_url . '" width="100" border="0"></a><br /><span class="genmed"><i><a href="' . append_sid( $pafiledb->this_mxurl_list( "action=file&file_id=" . $recentrow[$j]['file_id'], false, $pafiledb_page_id ) ) . '">' . $recentrow[$j]['file_name'] . '</a></i></span>' : '' ! )); ! ! if ( ( $recentrow[$j]['user_id'] == ALBUM_GUEST ) or ( $recentrow[$j]['username'] == '' ) ) ! { ! $recent_poster = ( $recentrow[$j]['file_creator'] == '' ) ? $lang['Guest'] : $recentrow[$j]['file_creator']; ! } ! else ! { ! $recent_poster = '<a href="' . append_sid( PHPBB_URL . "profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . '=' . $recentrow[$j]['user_id'] ) . '">' . $recentrow[$j]['username'] . '</a>'; ! } ! ! $rating_image = paImageRating( $recentrow[$j]['rating'] ); ! ! $template->assign_block_vars( 'recent_pics_block.recent_pics.recent_detail', array( ! 'TITLE' => ( empty( $file_screenshot_url ) ) ? '<b>' . $lang['File_Title'] . ': <a href="' . append_sid( $pafiledb->this_mxurl_list( "action=file&file_id=" . $recentrow[$j]['file_id'], false, $pafiledb_page_id ) ) . '">' . $recentrow[$j]['file_name'] . '</a></b><br />' : '', ! 'DESC' => $recentrow[$j]['file_desc'], ! 'POSTER' => $recent_poster, ! 'TIME' => create_date( $board_config['default_dateformat'], $recentrow[$j]['file_time'], $board_config['board_timezone'] ), ! 'UPDATED' => create_date( $board_config['default_dateformat'], $recentrow[$j]['file_update_time'], $board_config['board_timezone'] ), ! 'VIEW' => $recentrow[$j]['file_dls'], ! 'RATING' => ( $pafiledb->ratings[$recentrow[$j]['file_catid']]['activated'] ) ? ( $lang['Rating'] . ': ' . $rating_image . ', ' ) : '', ! 'COMMENTS' => ( $pafiledb->comments[$recentrow[$j]['file_catid']]['activated'] ) ? ( '<a href="' . append_sid( $pafiledb->this_mxurl_list( "action=file&file_id=" . $recentrow[$j]['file_id'], false, $pafiledb_page_id ) ) . '">' . $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 />' : '' ! )); ! } ! } ! } ! else ! { ! // ! // No Pics Found ! // ! $template->assign_block_vars( 'recent_pics_block.no_pics', array() ); ! } ! } ! else ! { ! // ! // No Cats Found ! // ! $template->assign_block_vars( 'recent_pics_block.no_pics', array() ); ! } ! } ! ! /* ! +---------------------------------------------------------- ! | Most downloaded/viewed ! +---------------------------------------------------------- ! */ ! if ( $album_sp_config['disp_most'] == 1 ) ! { ! if ( $allowed_cat != '' ) ! { ! $sql = "SELECT p.file_ssurl, p.file_id, p.file_name, p.file_desc, p.user_id, p.poster_ip, p.file_creator, p.file_time, p.file_update_time, p.file_catid, p.file_dls, u.user_id, u.username, r.votes_file, AVG(r.rate_point) AS rating, COUNT(DISTINCT c.comments_id) AS comments ! FROM " . PA_FILES_TABLE . " AS p ! LEFT JOIN " . USERS_TABLE . " AS u ON p.user_id = u.user_id ! LEFT JOIN " . PA_CATEGORY_TABLE . " AS ct ON p.file_catid = ct.cat_id ! LEFT JOIN " . PA_VOTES_TABLE . " AS r ON p.file_id = r.votes_file ! LEFT JOIN " . PA_COMMENTS_TABLE . " AS c ON p.file_id = c.file_id ! WHERE p.file_catid IN ($allowed_cat) AND p.file_approved = 1 ! GROUP BY p.file_id ! ORDER BY file_dls 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; ! } ! ! $template->assign_block_vars( 'most_pics_block', array() ); ! ! if ( count( $mostrow ) > 0 ) ! { ! for ( $i = 0; $i < count( $mostrow ); $i += $album_sp_config['img_cols'] ) ! { ! $template->assign_block_vars( 'most_pics_block.most_pics', array() ); ! ! for ( $j = $i; $j < ( $i + $album_sp_config['img_cols'] ); $j++ ) ! { ! if ( $j >= count( $mostrow ) ) ! { ! break; ! } ! $file_screenshot_url = trim( $mostrow[$j]['file_ssurl'] ); ! $template->assign_block_vars( 'most_pics_block.most_pics.most_col', array( ! // 'U_PIC' => ($album_config['fullpic_popup']) ? append_sid(this_smartor_mxurl("smartor_mode=album_pic&pic_id=". $recentrow[$j]['pic_id'])) : append_sid(this_smartor_mxurl("smartor_mode=album_showpage&pic_id=". $recentrow[$j]['pic_id'])), ! // 'THUMBNAIL' => append_sid(this_smartor_mxurl("smartor_mode=album_thumbnail&pic_id=". $recentrow[$j]['pic_id'], TRUE)), ! // 'DESC' => $recentrow[$j]['pic_desc'] ! 'SS' => ( !empty( $file_screenshot_url ) ) ? '<hr><a href="' . append_sid( $pafiledb->this_mxurl_list( "action=file&file_id=" . $mostrow[$j]['file_id'], false, $pafiledb_page_id ) ) . '"><img src="' . $file_screenshot_url . '" width="100" border="0"></a><br /><span class="genmed"><i><a href="' . append_sid( $pafiledb->this_mxurl_list( "action=file&file_id=" . $mostrow[$j]['file_id'], false, $pafiledb_page_id ) ) . '">' . $mostrow[$j]['file_name'] . '</a></i></span>' : '' ! )); ! ! if ( ( $mostrow[$j]['user_id'] == ALBUM_GUEST ) or ( $mostrow[$j]['username'] == '' ) ) ! { ! $most_poster = ( $mostrow[$j]['file_creator'] == '' ) ? $lang['Guest'] : $mostrow[$j]['file_creator']; ! } ! else ! { ! $most_poster = '<a href="' . append_sid( PHPBB_URL . "profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . '=' . $mostrow[$j]['user_id'] ) . '">' . $mostrow[$j]['username'] . '</a>'; ! } ! ! $rating_image = paImageRating( $mostrow[$j]['rating'] ); ! ! $template->assign_block_vars( 'most_pics_block.most_pics.most_detail', array( ! 'TITLE' => ( empty( $file_screenshot_url ) ) ? '<b>' . $lang['File_Title'] . ': <a href="' . append_sid( $pafiledb->this_mxurl_list( "action=file&file_id=" . $mostrow[$j]['file_id'], false, $pafiledb_page_id ) ) . '">' . $mostrow[$j]['file_name'] . '</a></b><br />' : '', ! 'DESC' => $mostrow[$j]['file_desc'], ! 'POSTER' => $most_poster, ! 'TIME' => create_date( $board_config['default_dateformat'], $mostrow[$j]['file_time'], $board_config['board_timezone'] ), ! 'UPDATED' => create_date( $board_config['default_dateformat'], $mostrow[$j]['file_update_time'], $board_config['board_timezone'] ), ! 'VIEW' => $mostrow[$j]['file_dls'], ! 'RATING' => ( $pafiledb->ratings[$mostrow[$j]['file_catid']]['activated'] ) ? ( $lang['Rating'] . ': ' . $rating_image . ', ' ) : '', ! 'COMMENTS' => ( $pafiledb->comments[$mostrow[$j]['file_catid']]['activated'] ) ? ( '<a href="' . append_sid( $pafiledb->this_mxurl_list( "action=file&file_id=" . $mostrow[$j]['file_id'], false, $pafiledb_page_id ) ) . '">' . $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 />' : '' ! )); ! } ! } ! } ! else ! { ! // ! // No Pics Found ! // ! $template->assign_block_vars( 'most_pics_block.no_pics', array() ); ! } ! } ! else ! { ! // ! // No Cats Found ! // ! $template->assign_block_vars( 'most_pics_block.no_pics', array() ); ! } ! } ! ! /* ! +---------------------------------------------------------- ! | Highest Rated Pics ! | by MarkFulton.com ! +---------------------------------------------------------- ! */ ! if ( $album_sp_config['disp_high'] == 1 ) ! { ! if ( $allowed_cat != '' ) ! { ! $sql = "SELECT p.file_ssurl, p.file_id, p.file_name, p.file_desc, p.user_id, p.poster_ip, p.file_creator, p.file_time, p.file_update_time, p.file_catid, p.file_dls, u.user_id, u.username, r.votes_file, AVG(r.rate_point) AS rating, COUNT(DISTINCT c.comments_id) AS comments ! FROM " . PA_FILES_TABLE . " AS p ! LEFT JOIN " . USERS_TABLE . " AS u ON p.user_id = u.user_id ! LEFT JOIN " . PA_CATEGORY_TABLE . " AS ct ON p.file_catid = ct.cat_id ! LEFT JOIN " . PA_VOTES_TABLE . " AS r ON p.file_id = r.votes_file ! LEFT JOIN " . PA_COMMENTS_TABLE . " AS c ON p.file_id = c.file_id ! WHERE p.file_catid IN ($allowed_cat) AND p.file_approved = 1 ! GROUP BY p.file_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; ! } ! ! $template->assign_block_vars( 'highest_pics_block', array() ); ! ! if ( count( $highestrow ) > 0 ) ! { ! for ( $i = 0; $i < count( $highestrow ); $i += $album_sp_config['img_cols'] ) ! { ! $template->assign_block_vars( 'highest_pics_block.highest_pics', array() ); ! ! for ( $j = $i; $j < ( $i + $album_sp_config['img_cols'] ); $j++ ) ! { ! if ( $j >= count( $highestrow ) ) ! { ! break; ! } ! $file_screenshot_url = trim( $highestrow[$j]['file_ssurl'] ); ! $template->assign_block_vars( 'highest_pics_block.highest_pics.highest_col', array( ! // 'U_PIC' => ($album_config['fullpic_popup']) ? append_sid(this_smartor_mxurl("smartor_mode=album_pic&pic_id=". $highestrow[$j]['pic_id'])) : append_sid(this_smartor_mxurl("smartor_mode=album_showpage&pic_id=". $highestrow[$j]['pic_id'])), ! // 'THUMBNAIL' => append_sid(this_smartor_mxurl("smartor_mode=album_thumbnail&pic_id=". $highestrow[$j]['pic_id'], TRUE)), ! // 'DESC' => $highestrow[$j]['pic_desc'] ! 'SS' => ( !empty( $file_screenshot_url ) ) ? '<hr><a href="' . append_sid( $pafiledb->this_mxurl_list( "action=file&file_id=" . $highestrow[$j]['file_id'], false, $pafiledb_page_id ) ) . '"><img src="' . $file_screenshot_url . '" width="100" border="0"></a><br /><span class="genmed"><i><a href="' . append_sid( $pafiledb->this_mxurl_list( "action=file&file_id=" . $highestrow[$j]['file_id'], false, $pafiledb_page_id ) ) . '">' . $highestrow[$j]['file_name'] . '</a></i></span>' : '' ! )); ! ! if ( ( $highestrow[$j]['user_id'] == ALBUM_GUEST ) or ( $highestrow[$j]['username'] == '' ) ) ! { ! $highest_poster = ( $highestrow[$j]['file_creator'] == '' ) ? $lang['Guest'] : $highestrow[$j]['file_creator']; ! } ! else ! { ! $highest_poster = '<a href="' . append_sid( PHPBB_URL . "profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . '=' . $highestrow[$j]['user_id'] ) . '">' . $highestrow[$j]['username'] . '</a>'; ! } ! ! $rating_image = paImageRating( $highestrow[$j]['rating'] ); ! ! $template->assign_block_vars( 'highest_pics_block.highest_pics.highest_detail', array( ! 'H_TITLE' => ( empty( $file_screenshot_url ) ) ? '<b>' . $lang['File_Title'] . ': <a href="' . append_sid( $pafiledb->this_mxurl_list( "action=file&file_id=" . $highestrow[$j]['file_id'], false, $pafiledb_page_id ) ) . '">' . $highestrow[$j]['file_name'] . '</a></b><br />' : '', ! 'H_DESC' => $highestrow[$j]['file_desc'], ! 'H_POSTER' => $highest_poster, ! 'H_TIME' => create_date( $board_config['default_dateformat'], $highestrow[$j]['file_time'], $board_config['board_timezone'] ), ! 'UPDATED' => create_date( $board_config['default_dateformat'], $highestrow[$j]['file_update_time'], $board_config['board_timezone'] ), ! 'H_VIEW' => $highestrow[$j]['file_dls'], ! 'H_RATING' => ( $pafiledb->ratings[$highestrow[$j]['file_catid']]['activated'] ) ? ( $lang['Rating'] . ': ' . $rating_image . ', ' ) : '', ! 'H_COMMENTS' => ( $pafiledb->comments[$highestrow[$j]['file_catid']]['activated'] ) ? ( '<a href="' . append_sid( $pafiledb->this_mxurl_list( "action=file&file_id=" . $highestrow[$j]['file_id'], false, $pafiledb_page_id ) ) . '">' . $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 />' : '' ! )); ! } ! } ! } ! else ! { ! // ! // No Pics Found ! // ! $template->assign_block_vars( 'highest_pics_block.no_pics', array() ); ! } ! } ! else ! { ! // ! // No Cats Found ! // ! $template->assign_block_vars( 'highest_pics_block.no_pics', array() ); ! } ! } ! ! /* ! +---------------------------------------------------------- ! | Random Pics ! | by CLowN ! +---------------------------------------------------------- ! */ ! if ( $album_sp_config['disp_rand'] == 1 ) ! { ! if ( $allowed_cat != '' ) ! { ! $sql = "SELECT p.file_id, p.file_name, p.file_desc, p.user_id, p.poster_ip, p.file_creator, p.file_time, p.file_update_time, p.file_catid, p.file_dls, p.file_ssurl, u.user_id, u.username, r.votes_file, AVG(r.rate_point) AS rating, COUNT(DISTINCT c.comments_id) AS comments ! FROM " . PA_FILES_TABLE . " AS p ! LEFT JOIN " . USERS_TABLE . " AS u ON p.user_id = u.user_id ! LEFT JOIN " . PA_CATEGORY_TABLE . " AS ct ON p.file_catid = ct.cat_id ! LEFT JOIN " . PA_VOTES_TABLE . " AS r ON p.file_id = r.votes_file ! LEFT JOIN " . PA_COMMENTS_TABLE . " AS c ON p.file_id = c.file_id ! WHERE p.file_catid IN ($allowed_cat) AND p.file_approved = 1 ! GROUP BY p.file_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; ! } ! ! $template->assign_block_vars( 'random_pics_block', array() ); ! ! if ( count( $randrow ) > 0 ) ! { ! for ( $i = 0; $i < count( $randrow ); $i += $album_sp_config['img_cols'] ) ! { ! $template->assign_block_vars( 'random_pics_block.rand_pics', array() ); ! ! for ( $j = $i; $j < ( $i + $album_sp_config['img_cols'] ); $j++ ) ! { ! if ( $j >= count( $randrow ) ) ! { ! break; ! } ! ! $file_screenshot_url = trim( $randrow[$j]['file_ssurl'] ); ! $template->assign_block_vars( 'random_pics_block.rand_pics.rand_col', array( ! // 'U_PIC' => ($album_config['fullpic_popup']) ? append_sid($pafiledb->this_mxurl_list("smartor_mode=album_pic&pic_id=". $randrow[$j]['pic_id'])) : append_sid($pafiledb->this_mxurl_list("smartor_mode=album_showpage&pic_id=". $randrow[$j]['pic_id'])), ! // 'THUMBNAIL' => append_sid($pafiledb->this_mxurl_list("smartor_mode=album_thumbnail&pic_id=". $randrow[$j]['pic_id'], TRUE)), ! // 'DESC' => $randrow[$j]['file_desc'] ! 'SS' => ( !empty( $file_screenshot_url ) ) ? '<hr><a href="' . append_sid( $pafiledb->this_mxurl_list( "action=file&file_id=" . $randrow[$j]['file_id'], false, $pafiledb_page_id ) ) . '"><img src="' . $file_screenshot_url . '" width="100" border="0"></a><br /><span class="genmed"><i><a href="' . append_sid( $pafiledb->this_mxurl_list( "action=file&file_id=" . $randrow[$j]['file_id'], false, $pafiledb_page_id ) ) . '">' . $randrow[$j]['file_name'] . '</a></i></span>' : '' ! )); ! ! if ( ( $randrow[$j]['user_id'] == ALBUM_GUEST ) or ( $randrow[$j]['username'] == '' ) ) ! { ! $rand_poster = ( $randrow[$j]['file_creator'] == '' ) ? $lang['Guest'] : $randrow[$j]['file_creator']; ! } ! else ! { ! $rand_poster = '<a href="' . append_sid( PHPBB_URL . "profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . '=' . $randrow[$j]['user_id'] ) . '">' . $randrow[$j]['username'] . '</a>'; ! } ! ! $rating_image = paImageRating( $randrow[$j]['rating'] ); ! ! $template->assign_block_vars( 'random_pics_block.rand_pics.rand_detail', array( ! 'TITLE' => ( empty( $file_screenshot_url ) ) ? '<b>' . $lang['File_Title'] . ': <a href="' . append_sid( $pafiledb->this_mxurl_list( "action=file&file_id=" . $randrow[$j]['file_id'], false, $pafiledb_page_id ) ) . '">' . $randrow[$j]['file_name'] . '</a></b><br />' : '', ! 'DESC' => $randrow[$j]['file_desc'], ! 'POSTER' => $rand_poster, ! 'TIME' => create_date( $board_config['default_dateformat'], $randrow[$j]['file_time'], $board_config['board_timezone'] ), ! 'UPDATED' => create_date( $board_config['default_dateformat'], $randrow[$j]['file_update_time'], $board_config['board_timezone'] ), ! 'VIEW' => $randrow[$j]['file_dls'], ! 'RATING' => ( $pafiledb->ratings[$randrow[$j]['file_catid']]['activated'] ) ? ( $lang['Rating'] . ': ' . $rating_image . ', ' ) : '', ! 'COMMENTS' => ( $pafiledb->comments[$randrow[$j]['file_catid']]['activated'] ) ? ( '<a href="' . append_sid( $pafiledb->this_mxurl_list( "action=file&file_id=" . $randrow[$j]['file_id'], false, $pafiledb_page_id ) ) . '">' . $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 />' : '' ! )); ! } ! } ! } ! else ! { ! // ! // No Pics Found ! // ! $template->assign_block_vars( 'random_pics_block.no_pics', array() ); ! } ! } ! else ! { ! // ! // No Cats Found ! // ! $template->assign_block_vars( 'random_pics_block.no_pics', array() ); ! } ! } ! /* ! +---------------------------------------------------------- ! | Start output the page ! +---------------------------------------------------------- ! */ ! $page_title = $lang['Album']; ! if ( !$is_block ) { ! include( $mx_root_path . 'includes/page_header.' . $phpEx ); } ! $template->set_filenames( array( 'body' => 'pa_lists.tpl' ) ); ! ! $template->assign_vars( array( ! 'L_CATEGORY' => $lang['Category'], ! 'L_PICS' => $lang['Pics'], ! 'L_LAST_PIC' => $lang['Last_Pic'], ! ! 'U_YOUR_PERSONAL_GALLERY' => append_sid( $pafiledb->this_mxurl_list( "smartor_mode=album_personal&user_id=" . $userdata['user_id'] ) ), ! 'L_YOUR_PERSONAL_GALLERY' => $lang['Your_Personal_Gallery'], ! ! 'U_USERS_PERSONAL_GALLERIES' => append_sid( $pafiledb->this_mxurl_list( "smartor_mode=album_personal_index" ) ), ! 'L_USERS_PERSONAL_GALLERIES' => $lang['Users_Personal_Galleries'], ! ! 'S_COLS' => $album_sp_config['img_cols'], ! 'S_COL_WIDTH' => ( 100 / $album_sp_config['img_cols'] ) . '%', ! 'TARGET_BLANK' => ( $album_config['fullpic_popup'] ) ? 'target="_blank"' : '', ! 'L_RECENT_PUBLIC_PICS' => $lang['Recent_Public_Files'], ! 'L_TOPRATED_PUBLIC_PICS' => $lang['Toprated_Public_Files'], ! 'L_RANDOM_PUBLIC_PICS' => $lang['Random_Public_Files'], ! 'L_MOST_PUBLIC_PICS' => $lang['Most_Public_Files'], ! 'L_NO_PICS' => $lang['No_Pics'], ! 'L_FILE_TITLE' => $lang['File_Title'], ! 'L_FILE_DESC' => $lang['File_Desc'], ! 'L_VIEW' => $lang['Dls'], ! 'L_POSTER' => $lang['Poster'], ! 'L_POSTED' => $lang['Posted'], ! 'L_UPDATE_TIME' => $lang['Update_time'], ! 'L_PUBLIC_CATS' => $lang['Public_Categories'] ) ! ); ! ! // ! // Generate the page ! // ! $template->pparse( 'body' ); ! if ( !$is_block ) ! { ! include( $mx_root_path . 'includes/page_tail.' . $phpEx ); ! } ?> \ No newline at end of file --- 29,70 ---- define( 'MXBB_27x', file_exists( $mx_root_path . 'mx_login.php' ) ); // ! // Setup config parameters // ! $config_name = array( 'toplist_sort_method', 'toplist_display_options', 'toplist_pagination', 'toplist_use_pagination', 'toplist_filter_date', 'toplist_cat_id' ); ! for( $i = 0; $i < count( $config_name ); $i++ ) ! { ! $config_value = $mx_block->get_parameters( $config_name[$i] ); ! $toplist_config[$config_name[$i]] = $config_value; ! } // // Get pafiledb target block // ! $toplist_block_id = $mx_block->get_parameters( 'target_block' ); ! $toplist_page_id = intval($toplist_block_id) > 0 ? get_page_id( $toplist_block_id ) : get_page_id( 'dload.php', true ); ! // =================================================== ! // Include the common file ! // =================================================== ! include_once( $module_root_path . 'pafiledb/pafiledb_common.' . $phpEx ); ! $pafiledb_template->destroy(); ! // =================================================== ! // if the database disabled give them a nice message ! // =================================================== ! if ( intval( $pafiledb_config['module_enable'] ) ) { ! mx_message_die( GENERAL_MESSAGE, $lang['pafiledb_disable'] ); } ! // =================================================== ! // an array of all expected actions ! // =================================================== ! $actions = array( 'lists' => 'lists' ); ! $action = 'lists'; ! $pafiledb->module( $actions[$action] ); ! $pafiledb->modules[$actions[$action]]->main( $action ); ?> \ No newline at end of file --- NEW FILE: dload_mini.php --- <?php /** * * @package mxBB Portal Module - mx_pafiledb * @version $Id: dload_mini.php,v 1.1 2006/08/13 18:53:09 jonohlsson Exp $ * @copyright (c) 2002-2006 [Mohd Basri, PHP Arena, pafileDB, Jon Ohlsson] mxBB Project Team * @license http://opensource.org/licenses/gpl-license.php GNU General Public License v2 * */ if( !defined('IN_PORTAL') || !is_object($mx_block)) { die("Hacking attempt"); } // // Read Block Settings // $title = $mx_block->block_info['block_title']; $block_size = ( isset( $block_size ) && !empty( $block_size ) ? $block_size : '100%' ); $is_block = true; global $images; // // Definitions // define( 'MXBB_MODULE', true ); define( 'MXBB_27x', file_exists( $mx_root_path . 'mx_login.php' ) ); list( $trash, $mx_script_name_temp ) = split ( trim( $board_config['server_name'] ), PORTAL_URL ); $mx_script_name = preg_replace( '#^\/?(.*?)\/?$#', '\1', trim( $mx_script_name_temp ) ); // // Setup config parameters // $config_name = array( 'mini_default_cat_id', 'mini_display_options', 'mini_pagination' ); for( $i = 0; $i < count( $config_name ); $i++ ) { $config_value = $mx_block->get_parameters( $config_name[$i] ); $mini_config[$config_name[$i]] = $config_value; } // =================================================== // Include the common file // =================================================== include_once( $module_root_path . 'pafiledb/pafiledb_common.' . $phpEx ); $pafiledb_template->destroy(); // =================================================== // Get action variable other wise set it to the main // =================================================== $action = ( isset( $_REQUEST['action_mini'] ) ) ? htmlspecialchars( $_REQUEST['action_mini'] ) : 'mini'; // =================================================== // if the database disabled give them a nice message // =================================================== if ( intval( $pafiledb_config['module_enable'] ) ) { mx_message_die( GENERAL_MESSAGE, $lang['pafiledb_disable'] ); } // =================================================== // an array of all expected actions // =================================================== $actions = array( 'mini' => 'mini', 'download' => 'download' ); // =================================================== // Lets Build the page // =================================================== $page_title = $lang['Download']; if ( $action != 'download' ) { if ( !$is_block ) { include( $mx_root_path . 'includes/page_header.' . $phpEx ); } } $pafiledb->module( $actions[$action] ); $pafiledb->modules[$actions[$action]]->main( $action ); if ( $action != 'download' ) { if ( !$is_block ) { include( $mx_root_path . 'includes/page_tail.' . $phpEx ); } } ?> Index: pafiledb.pak =================================================================== RCS file: /cvsroot/mxbb/mx_pafiledb/pafiledb.pak,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** pafiledb.pak 30 Jun 2006 12:23:00 -0000 1.13 --- pafiledb.pak 13 Aug 2006 18:53:09 -0000 1.14 *************** *** 7,21 **** New_function=+:---------------------------=+:0=+:0=+:0=+:0=+:0 function=+:54=+:59=+:PafileDB_list=+:PafileDB download toplists=+:dload_lists.php=+: - parameter=+:59=+:109=+:display_latest_posts=+:Boolean=+:TRUE=+:=+:0 - parameter=+:59=+:110=+:display_most_posts=+:Boolean=+:TRUE=+:=+:0 - parameter=+:59=+:111=+:display_random_posts=+:Boolean=+:TRUE=+:=+:0 - parameter=+:59=+:112=+:display_top_ranked=+:Boolean=+:TRUE=+:=+:0 - parameter=+:59=+:113=+:num_of_cols=+:Number=+:1=+:=+:0 - parameter=+:59=+:114=+:num_of_rows=+:Number=+:3=+:=+:0 parameter=+:59=+:115=+:target_block=+:Function=+:0=+:get_list_formatted("block_list","{parameter_value}","{parameter_id}[]", "dload.php")=+:0 parameter=+:0=+:0=+:0=+:endoflist=+:0=+:0 block=+:=+:Demo - PafileDB_list=+:Demo block=+:59=+:0=+:5=+:0=+:0=+:0=+:0=+:1=+:1 function=+:0=+:0=+:0=+:endoflist=+:0=+:0 New_function=+:---------------------------=+:0=+:0=+:0=+:0=+:0 function=+:54=+:60=+:Quick dl=+:Quick download block - blog=+:dload_quickdl.php=+: parameter=+:60=+:116=+:pa_mapping=+:pa_mapping=+:=+:=+:0 --- 7,29 ---- New_function=+:---------------------------=+:0=+:0=+:0=+:0=+:0 function=+:54=+:59=+:PafileDB_list=+:PafileDB download toplists=+:dload_lists.php=+: parameter=+:59=+:115=+:target_block=+:Function=+:0=+:get_list_formatted("block_list","{parameter_value}","{parameter_id}[]", "dload.php")=+:0 + parameter=+:59=+:154=+:toplist_cat_id=+:pa_quick_cat=+:0=+:=+:1 + parameter=+:59=+:152=+:toplist_display_options=+:Checkbox_multiple_select=+:a:1:{i:0;s:4:"date";}=+:a:4:{i:0;s:4:"date";i:1;s:8:"username";i:2;s:7:"counter";i:3;s:4:"rate";}=+:1 + parameter=+:59=+:155=+:toplist_filter_date=+:Function=+:5=+:get_list_static("{parameter_id}[]",array("no limit", "1 day", "2 days", "3 days", "1 week", "2 weeks", "3 weeks", "1 month", "2 months", "3 months", "6 months", "1 year"),"{parameter_value}")=+:1 + parameter=+:59=+:114=+:toplist_pagination=+:Number=+:3=+:=+:0 + parameter=+:59=+:109=+:toplist_sort_method=+:Menu_single_select=+:latest=+:a:4:{i:0;s:6:"latest";i:1;s:12:"most_popular";i:2;s:8:"toprated";i:3;s:6:"random";}=+:1 + parameter=+:59=+:113=+:toplist_use_pagination=+:Boolean=+:TRUE=+:=+:1 parameter=+:0=+:0=+:0=+:endoflist=+:0=+:0 block=+:=+:Demo - PafileDB_list=+:Demo block=+:59=+:0=+:5=+:0=+:0=+:0=+:0=+:1=+:1 function=+:0=+:0=+:0=+:endoflist=+:0=+:0 New_function=+:---------------------------=+:0=+:0=+:0=+:0=+:0 + function=+:54=+:90=+:PafileDB_mini=+:Mini navigation block=+:dload_mini.php=+: + parameter=+:90=+:156=+:mini_default_cat_id=+:pa_quick_cat=+:0=+:=+:1 + parameter=+:90=+:158=+:mini_display_options=+:Checkbox_multiple_select=+:a:1:{i:0;s:4:"date";}=+:a:4:{i:0;s:4:"date";i:1;s:8:"username";i:2;s:7:"counter";i:3;s:4:"rate";}=+:1 + parameter=+:90=+:157=+:mini_pagination=+:Number=+:5=+:=+:1 + parameter=+:0=+:0=+:0=+:endoflist=+:0=+:0 + block=+:=+:Demo - PafileDB_mini=+:Demo block=+:90=+:0=+:5=+:0=+:0=+:0=+:0=+:1=+:1 + function=+:0=+:0=+:0=+:endoflist=+:0=+:0 + New_function=+:---------------------------=+:0=+:0=+:0=+:0=+:0 function=+:54=+:60=+:Quick dl=+:Quick download block - blog=+:dload_quickdl.php=+: parameter=+:60=+:116=+:pa_mapping=+:pa_mapping=+:=+:=+:0 Index: dload_quickdl.php =================================================================== RCS file: /cvsroot/mxbb/mx_pafiledb/dload_quickdl.php,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** dload_quickdl.php 27 Jun 2006 21:38:43 -0000 1.12 --- dload_quickdl.php 13 Aug 2006 18:53:09 -0000 1.13 *************** *** 9,55 **** */ ! if ( !function_exists( 'read_block_config' ) ) { ! define( 'IN_PORTAL', true ); ! $mx_root_path = '../../'; ! $phpEx = substr(strrchr(__FILE__, '.'), 1); ! include_once( $mx_root_path . 'common.' . $phpEx ); ! // ! // Start session management ! // ! $mx_user->init($user_ip, PAGE_INDEX); ! // ! // End session management ! // ! $block_id = ( !empty( $HTTP_GET_VARS['block_id'] ) ) ? $HTTP_GET_VARS['block_id'] : $HTTP_POST_VARS['id']; ! if ( empty( $block_id ) ) ! { ! $sql = "SELECT * FROM " . BLOCK_TABLE . " WHERE block_title = 'PafileDB' LIMIT 1"; ! if ( !$result = $db->sql_query( $sql ) ) ! { ! mx_message_die( GENERAL_ERROR, "Could not query PafileDB module information", "", __LINE__, __FILE__, $sql ); ! } ! $row = $db->sql_fetchrow( $result ); ! $block_id = $row['block_id']; ! } ! $is_block = false; ! } ! else ! { ! if( !defined('IN_PORTAL') || !is_object($mx_block)) ! { ! die("Hacking attempt"); ! } ! // ! // Read Block Settings ! // ! $title = $mx_block->block_info['block_title']; ! $block_size = ( isset( $block_size ) && !empty( $block_size ) ? $block_size : '100%' ); ! $is_block = true; ! global $images; ! } list( $trash, $mx_script_name_temp ) = split ( trim( $board_config['server_name'] ), PORTAL_URL ); --- 9,31 ---- */ ! if( !defined('IN_PORTAL') || !is_object($mx_block)) { ! die("Hacking attempt"); ! } ! // ! // Read Block Settings ! // ! $title = $mx_block->block_info['block_title']; ! $block_size = ( isset( $block_size ) && !empty( $block_size ) ? $block_size : '100%' ); ! $is_block = true; ! global $images; ! // ! // Definitions ! // ! define( 'MXBB_MODULE', true ); ! define( 'MXBB_27x', file_exists( $mx_root_path . 'mx_login.php' ) ); list( $trash, $mx_script_name_temp ) = split ( trim( $board_config['server_name'] ), PORTAL_URL ); |