|
From: Jon O. <jon...@us...> - 2006-08-15 19:08:43
|
Update of /cvsroot/mxbb/mx_pafiledb/pafiledb/includes In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv26301/modules/mx_pafiledb/pafiledb/includes Modified Files: functions_pafiledb.php Log Message: Fix for the quickdl block, to keep in sync with dynamic blocks Index: functions_pafiledb.php =================================================================== RCS file: /cvsroot/mxbb/mx_pafiledb/pafiledb/includes/functions_pafiledb.php,v retrieving revision 1.41 retrieving revision 1.42 diff -C2 -d -r1.41 -r1.42 *** functions_pafiledb.php 15 Aug 2006 14:09:54 -0000 1.41 --- functions_pafiledb.php 15 Aug 2006 19:08:33 -0000 1.42 *************** *** 731,735 **** * @param unknown_type $cat_id */ ! function display_categories_original( $cat_id = PA_ROOT_CAT ) { global $db, $pafiledb_template, $lang, $userdata, $phpEx, $images; --- 731,735 ---- * @param unknown_type $cat_id */ ! function display_categories_original( $cat_id = PA_ROOT_CAT, $action_name = 'action', $action_default = 'category', $map_xtra = '' ) { global $db, $pafiledb_template, $lang, $userdata, $phpEx, $images; *************** *** 741,745 **** if ( !$userdata['session_logged_in'] ) { ! $redirect = ( $cat_id != PA_ROOT_CAT ) ? $this->this_mxurl( "action=category&cat_id=$cat_id" ) : $this->this_mxurl(); redirect( append_sid( "login.$phpEx?redirect=$redirect", true ) ); } --- 741,745 ---- if ( !$userdata['session_logged_in'] ) { ! $redirect = ( $cat_id != PA_ROOT_CAT ) ? $this->this_mxurl( "$action_name=$action_default&cat_id=$cat_id" ) : $this->this_mxurl(); redirect( append_sid( "login.$phpEx?redirect=$redirect", true ) ); } *************** *** 791,795 **** $pafiledb_template->assign_block_vars( 'no_cat_parent', array( 'IS_HIGHER_CAT' => false, ! 'U_CAT' => append_sid( $this->this_mxurl( 'action=category&cat_id=' . $subcat_id ) ), 'SUB_CAT' => ( !empty( $sub_cat ) ) ? '<br /><b>' . $lang['Sub_category'] . ': </b>' . $sub_cat : '', 'CAT_IMAGE' => ( $is_new ) ? $images['pa_folder_new'] : $images['pa_folder'], --- 791,795 ---- $pafiledb_template->assign_block_vars( 'no_cat_parent', array( 'IS_HIGHER_CAT' => false, ! 'U_CAT' => append_sid( $this->this_mxurl( "$action_name=$action_default&cat_id=" . $subcat_id . $map_xtra ) ), 'SUB_CAT' => ( !empty( $sub_cat ) ) ? '<br /><b>' . $lang['Sub_category'] . ': </b>' . $sub_cat : '', 'CAT_IMAGE' => ( $is_new ) ? $images['pa_folder_new'] : $images['pa_folder'], *************** *** 834,838 **** $pafiledb_template->assign_block_vars( 'no_cat_parent', array( 'IS_HIGHER_CAT' => true, ! 'U_CAT' => append_sid( $this->this_mxurl( 'action=category&cat_id=' . $subcat_id ) ), 'CAT_NAME' => $subcat_row['cat_name'] ) ); --- 834,838 ---- $pafiledb_template->assign_block_vars( 'no_cat_parent', array( 'IS_HIGHER_CAT' => true, ! 'U_CAT' => append_sid( $this->this_mxurl( "$action_name=$action_default&cat_id=" . $subcat_id . $map_xtra) ), 'CAT_NAME' => $subcat_row['cat_name'] ) ); *************** *** 870,874 **** $pafiledb_template->assign_block_vars( 'no_cat_parent', array( 'IS_HIGHER_CAT' => false, ! 'U_CAT' => append_sid( $this->this_mxurl( 'action=category&cat_id=' . $sub_cat_rowset[$k]['cat_id'] ) ), 'SUB_CAT' => ( !empty( $sub_cat ) ) ? '<br /><b>' . $lang['Sub_category'] . ': </b>' . $sub_cat : '', 'CAT_IMAGE' => ( $is_new ) ? $images['pa_folder_new'] : $images['pa_folder'], --- 870,874 ---- $pafiledb_template->assign_block_vars( 'no_cat_parent', array( 'IS_HIGHER_CAT' => false, ! 'U_CAT' => append_sid( $this->this_mxurl( "$action_name=$action_default&cat_id=" . $sub_cat_rowset[$k]['cat_id'] . $map_xtra ) ), 'SUB_CAT' => ( !empty( $sub_cat ) ) ? '<br /><b>' . $lang['Sub_category'] . ': </b>' . $sub_cat : '', 'CAT_IMAGE' => ( $is_new ) ? $images['pa_folder_new'] : $images['pa_folder'], *************** *** 887,1042 **** /** - * display_categories - quickdl. - * - * @param unknown_type $cat_id - * @param unknown_type $pa_get_dynamic - */ - function display_categories_quickdl( $cat_id = PA_ROOT_CAT, $pa_get_dynamic = array() ) - { - global $db, $pafiledb_template, $lang, $userdata, $phpEx, $images; - global $pafiledb_config, $board_config, $debug; - global $phpbb_root_path, $mx_root_path, $module_root_path, $is_block, $phpEx; - - if ( $this->cat_empty() ) - { - mx_message_die( GENERAL_ERROR, 'Either you are not allowed to view any category, or there is no category in the database' ); - } - - $pafiledb_template->assign_vars( array( - 'CAT_PARENT' => true, - 'L_SUB_CAT' => $lang['Sub_category'], - 'L_CATEGORY' => $lang['Category'], - 'L_LAST_FILE' => $lang['Last_file'], - 'L_FILES' => $lang['Files'] ) - ); - - // - // output the root level category that allow file - // - if ( isset( $this->subcat_rowset[$cat_id] ) ) - { - foreach( $this->subcat_rowset[$cat_id] as $subcat_id => $subcat_row ) - { - if ( ( $subcat_row['cat_allow_file'] == PA_CAT_ALLOW_FILE ) ) - { - $last_file_info = array(); - $this->last_item_in_cat( $subcat_id, $last_file_info ); - - if ( !empty( $last_file_info['file_id'] ) && $this->auth_user[$subcat_id]['auth_read'] ) - { - $last_file_time = create_date( $board_config['default_dateformat'], $last_file_info['file_time'], $board_config['board_timezone'] ); - $last_file = $last_file_time . '<br />'; - $last_file_name = ( strlen( stripslashes( $last_file_info['file_name'] ) ) > 20 ) ? substr( stripslashes( $last_file_info['file_name'] ), 0, 20 ) . '...' : stripslashes( $last_file_info['file_name'] ); - $last_file .= '<a href="' . append_sid( $this->this_mxurl( 'actionqdl=download&file_id=' . $last_file_info['file_id'], true ) ) . '" alt="' . stripslashes( $last_file_info['file_name'] ) . '" title="' . stripslashes( $last_file_info['file_name'] ) . '">' . $last_file_name . '</a> '; - $last_file .= '<a href="' . append_sid( $this->this_mxurl( 'actionqdl=download&file_id=' . $last_file_info['file_id'], true ) ) . '"><img src="' . $images['pa_icon_latest_reply'] . '" border="0" alt="' . $lang['View_latest_file'] . '" title="' . $lang['View_latest_file'] . '" /></a>'; - } - else - { - $last_file = $lang['No_file']; - } - $is_new = false; - - if ( $this->new_item_in_cat( $subcat_id ) ) - { - $is_new = true; - } - - $sub_cat = $this->get_sub_cat( $subcat_id ); - - $map_xtra = !empty( $pa_get_dynamic[$subcat_id] ) ? '&dynamic_block=' . $pa_get_dynamic[$subcat_id] : ''; - - $pafiledb_template->assign_block_vars( 'no_cat_parent', array( - 'IS_HIGHER_CAT' => false, - 'U_CAT' => append_sid( $this->this_mxurl( 'actionqdl=quickdl&cat_id=' . $subcat_id . $map_xtra ) ), - 'SUB_CAT' => ( !empty( $sub_cat ) ) ? '<b>' . $lang['Sub_category'] . ': </b>' . $sub_cat : '', - 'CAT_IMAGE' => ( $is_new ) ? $images['pa_folder_new'] : $images['pa_folder'], - 'CAT_NEW_FILE' => ( $is_new ) ? $lang['New_file'] : $lang['No_new_file'], - 'CAT_NAME' => $subcat_row['cat_name'], - 'FILECAT' => $this->items_in_cat( $subcat_id ), - 'LAST_FILE' => $last_file, - 'CAT_DESC' => $subcat_row['cat_desc'] ) - ); - } - } - } - - if ( isset( $this->subcat_rowset[$cat_id] ) ) - { - foreach( $this->subcat_rowset[$cat_id] as $subcat_id => $subcat_row ) - { - $total_sub_cat = 0; - if ( isset( $this->subcat_rowset[$subcat_id] ) ) - { - foreach( $this->subcat_rowset[$subcat_id] as $sub_no_cat_id => $sub_no_cat_row ) - { - if ( $sub_no_cat_row['cat_allow_file'] == PA_CAT_ALLOW_FILE ) - { - $sub_cat_rowset[$total_sub_cat] = $sub_no_cat_row; - $total_sub_cat++; - } - } - } - - // - // Category container - // - if ( ( $subcat_row['cat_allow_file'] != PA_CAT_ALLOW_FILE ) ) - { - if ( $total_sub_cat ) - { - $pafiledb_template->assign_block_vars( 'no_cat_parent', array( - 'IS_HIGHER_CAT' => true, - 'U_CAT' => append_sid( $this->this_mxurl( 'actionqdl=category&cat_id=' . $subcat_id ) ), - 'CAT_NAME' => $subcat_row['cat_name'] ) - ); - } - for( $k = 0; $k < $total_sub_cat; $k++ ) - { - $last_file_info = array(); - $this->last_item_in_cat( $sub_cat_rowset[$k]['cat_id'], $last_file_info ); - - if ( $sub_cat_rowset[$k]['cat_parent'] == $subcat_id ) - { - if ( !empty( $last_file_info['file_id'] ) && $this->auth_user[$sub_cat_rowset[$k]['cat_id']]['auth_read'] ) - { - $last_file_time = create_date( $board_config['default_dateformat'], $last_file_info['file_time'], $board_config['board_timezone'] ); - $last_file = $last_file_time . '<br />'; - $last_file_name = ( strlen( $last_file_info['file_name'] ) > 20 ) ? substr( $last_file_info['file_name'], 0, 20 ) . '...' : $last_file_info['file_name']; - $last_file .= '<a href="' . append_sid( $this->this_mxurl( 'actionqdl=file&file_id=' . $last_file_info['file_id'] ) ) . '">' . $last_file_name . '</a> '; - $last_file .= '<a href="' . append_sid( $this->this_mxurl( 'actionqdl=file&file_id=' . $last_file_info['file_id'] ) ) . '"><img src="' . $images['pa_icon_latest_reply'] . '" border="0" alt="' . $lang['View_latest_file'] . '" title="' . $lang['View_latest_file'] . '" /></a>'; - } - else - { - $last_file = $lang['No_file']; - } - - $is_new = false; - - if ( $this->new_item_in_cat( $sub_cat_rowset[$k]['cat_id'] ) ) - { - $is_new = true; - } - - $sub_cat = $this->get_sub_cat( $sub_cat_rowset[$k]['cat_id'] ); - - $pafiledb_template->assign_block_vars( 'no_cat_parent', array( - 'IS_HIGER_CAT' => false, - 'U_CAT' => append_sid( $this->this_mxurl( 'actionqdl=category&cat_id=' . $sub_cat_rowset[$k]['cat_id'] ) ), - 'SUB_CAT' => ( !empty( $sub_cat ) ) ? '<b>' . $lang['Sub_category'] . ': </b>' . $sub_cat : '', - 'CAT_IMAGE' => ( $is_new ) ? $images['pa_folder_new'] : $images['pa_folder'], - 'CAT_NEW_FILE' => ( $is_new ) ? $lang['New_file'] : $lang['No_new_file'], - 'CAT_NAME' => $sub_cat_rowset[$k]['cat_name'], - 'FILECAT' => $this->items_in_cat( $sub_cat_rowset[$k]['cat_id'] ), - 'LAST_FILE' => $last_file, - 'CAT_DESC' => $sub_cat_rowset[$k]['cat_desc'] ) - ); - } // Have a permission to view the category - } // It is not parent category - } - } - } //higher Category - } - - /** * display items. * --- 887,890 ---- |