################################################################################ # PHCDownload - Download Management System ################################################################################ # Copyright (c) 2005 by Alex G-White -- http://www.phpcredo.com # PHCDL is free to use software. Please visit the website for futher licence # information on distribution and use. ################################################################################ require_once( "global.php" ); user_hash_check(); $get_categories = $db->query("SELECT c.category_id, c.category_name, c.category_description, c.category_file_total, c.category_file_subtotal, c.category_newfile_id FROM {$TBLPREFIX}categories c WHERE c.category_sub_id = 0 ORDER BY c.category_order, category_name" ); if( $db->numrows() == 0 ) { message_report( $ld['lang_f_no_categories'] ); } else { $gui->page_title = $ld['lang_f_page_title_index']; $tp->call( "category_header" ); while( $category = $db->data( $get_categories ) ) { $tp->call( "category_row" ); $category['category_files'] = format_category_filecount( $category['category_file_total'], $category['category_file_subtotal'] ); $category['category_name'] = html_format( $category['category_name'] ); $category['category_description'] = html_format( $category['category_description'] ); //Sub-category quick-links $get_subcategory_names = $db->query( "SELECT `category_id`,`category_name` FROM `{$TBLPREFIX}categories` WHERE `category_sub_id` = '{$category['category_id']}' ORDER BY `category_name`" ); if( $db->numrows() == 0 || $config['SUBCATLINKS_MODE'] == "0" || $config['SUBCATLINKS_MODE'] == "2" ) { $category['category_sub_cats'] = ""; } else { //Get sub-categories $category['category_sub_cats'] = $tp->call( "sub_category", 1 ); while( $subcategory = $db->data( $get_subcategory_names ) ) { $category['category_sub_cats'] .= $tp->call( "sub_category_item", 1 ); $category['category_sub_cats'] = $tp->cache( $subcategory, 0, $category['category_sub_cats'] ); } $category['category_sub_cats'] = preg_replace( "/, $/", "", $category['category_sub_cats'] ); } //Show latest file added to category, or category branch $get_category_file = $db->query( "SELECT `file_id`, `file_name`, `file_downloads`, `file_timestamp`, `file_mark_timestamp` FROM `{$TBLPREFIX}files` WHERE `file_id` = {$category['category_newfile_id']}" ); if( $db->numrows() != 0 ) { $category_file = $db->data( $get_category_file ); $category['category_newfile'] = $tp->call( "category_newfile", 1 ); $category_file['file_timestamp'] = strftime( $config['SHORTDATE'], $category_file['file_timestamp'] ); $category_file['file_mark_timestamp'] = strftime( $config['SHORTDATE'], $category_file['file_mark_timestamp'] ); $category_file['file_name'] = get_sliced_name( html_format( $category_file['file_name'] ), $config['FILENAMECUT'] ); $category_file['file_downloads'] = get_num_format( $category_file['file_downloads'] ); $category['category_newfile'] = $tp->cache( $category_file, 0, $category['category_newfile'] ); } else { $category['category_newfile'] = $tp->call( "category_no_newfile", 1 ); } $tp->cache( $category ); } $tp->call( "category_footer" ); $tp->call( "page_index_footer" ); build_category_menu(); } build_page( Y_HEADER, Y_FOOTER, Y_BAR, Y_ANNOUNCE, Y_LANG, Y_DUMP );