|
From: Jon O. <jon...@us...> - 2006-08-13 18:52:36
|
Update of /cvsroot/mxbb/mx_linkdb/linkdb/modules In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv28103/modules/mx_linkdb/linkdb/modules Added Files: link_lists.php link_mini.php Log Message: More module blocks - Mini block - Latest Item block --- NEW FILE: link_mini.php --- <?php /** * * @package mxBB Portal Module - mx_pafiledb * @version $Id: link_mini.php,v 1.1 2006/08/13 18:52:33 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' ) ) { die( "Hacking attempt" ); } /** * Enter description here... * */ class linkdb_mini extends linkdb_public { /** * Enter description here... * * @param unknown_type $action */ function main( $action ) { global $template, $lang, $phpEx, $linkdb_config, $userdata; global $mx_root_path, $module_root_path, $is_block, $phpEx, $mx_request_vars, $mini_config; global $page_id; // ======================================================= // Request vars // ======================================================= $start = $mx_request_vars->request('mini_start', MX_TYPE_INT, 0); $cat_id = $mx_request_vars->request('cat_id', MX_TYPE_INT, $mini_config['mini_default_cat_id']); if ( empty( $cat_id ) ) { //mx_message_die( GENERAL_MESSAGE, $lang['Cat_not_exist'] ); } // // Sorting of items // $sort_method = $linkdb_config['sort_method']; $sort_order = $linkdb_config['sort_order']; // ======================================================= // If user not allowed to view file listing (read) and there is no sub Category // or the user is not allowed to view these category we gave him a nice message. // ======================================================= $show_category = false; if ( isset( $this->subcat_rowset[$cat_id] ) ) { foreach( $this->subcat_rowset[$cat_id] as $sub_cat_id => $sub_cat_row ) { if ( $this->auth_user[$sub_cat_id]['auth_view'] ) { $show_category = true; break; } } } if ( ( !$this->auth_user[$cat_id]['auth_read'] ) && ( !$show_category ) ) { if ( !$userdata['session_logged_in'] ) { // mx_redirect(append_sid($mx_root_path . "login.$phpEx?redirect=". $this->this_mxurl("action=category&cat_id=" . $cat_id, true), true)); } $message = sprintf( $lang['Sorry_auth_view'], $this->auth_user[$cat_id]['auth_read_type'] ); mx_message_die( GENERAL_MESSAGE, $message ); } if ( !isset( $this->cat_rowset[$cat_id] ) ) { //mx_message_die( GENERAL_MESSAGE, $lang['Cat_not_exist'] ); } $no_file_message = true; $filelist = false; $template->set_filenames( array( 'body' => 'link_mini.tpl' ) ); $sort_options_list = unserialize($mini_config['mini_display_options']); $linkdb_config['pagination'] = $mini_config['mini_pagination']; $total_num_items = $this->display_items( $sort_method, $sort_order, $start, $cat_id, $no_file_message, $sort_options_list ); $template->assign_vars( array( 'U_LINK' => append_sid( $this->this_mxurl() ), 'LINK' => $linkdb_config['module_name'], 'BLOCK_JUMPMENU' => $this->generate_jumpbox( $mini_config['mini_default_cat_id'], 0, array( $_GET['cat_id'] => 1 ) ), 'MX_PAGE' => $page_id, 'S_JUMPBOX_ACTION' => append_sid( $this->this_mxurl( ) ), 'BLOCK_PAGINATION' => mx_generate_pagination(append_sid( $this->this_mxurl( 'cat_id=' . $cat_id, false, false ) ), $total_num_items, $mini_config['mini_pagination'], $start, true, true, true, false, 'mini_start'), )); $this->display( $lang['Links'], 'link_mini.tpl' ); } } ?> --- NEW FILE: link_lists.php --- <?php /** * * @package mxBB Portal Module - mx_pafiledb * @version $Id: link_lists.php,v 1.1 2006/08/13 18:52:33 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' ) ) { die( "Hacking attempt" ); } /** * Enter description here... * */ class linkdb_lists extends linkdb_public { /** * Enter description here... * * @param unknown_type $action */ function main( $action ) { global $template, $lang, $phpEx, $linkdb_config, $userdata; global $mx_root_path, $module_root_path, $is_block, $phpEx, $mx_request_vars; global $toplist_page_id, $toplist_config; // ======================================================= // Request vars // ======================================================= $start = $mx_request_vars->request('link_start', MX_TYPE_INT, 0); // // Sorting of items // if ( isset( $toplist_config['toplist_sort_method'] ) ) { switch ( $toplist_config['toplist_sort_method'] ) { case 'latest': $sort_method = 'link_time'; break; case 'most_popular': $sort_method = 'link_dls'; break; case 'toprated': $sort_method = 'rating'; break; case 'random': $sort_method = 'RAND()'; break; default: $sort_method = $linkdb_config['sort_method']; } } else { $sort_method = $linkdb_config['sort_method']; } $sort_order = 'DESC'; $msg_today = date('mdY'); switch( $toplist_config['toplist_filter_date'] ) { case '0': $msg_time_filter_lo = 'no'; break; case '1': $msg_time_filter_lo = mktime(0, 0, 0 , intval(substr($msg_today, 0, 2)), intval(substr($msg_today, 2, 2) - 1), intval(substr($msg_today, 4, 4))); break; case '2': $msg_time_filter_lo = mktime(0, 0, 0 , intval(substr($msg_today, 0, 2)), intval(substr($msg_today, 2, 2) - 1), intval(substr($msg_today, 4, 4))); break; case '3': $msg_time_filter_lo = mktime(0, 0, 0 , intval(substr($msg_today, 0, 2)), intval(substr($msg_today, 2, 2) - 1), intval(substr($msg_today, 4, 4))); break; case '4': $msg_time_filter_lo = mktime(0, 0, 0 , intval(substr($msg_today, 0, 2)), intval(substr($msg_today, 2, 2) - 7), intval(substr($msg_today, 4, 4))); break; case '5': $msg_time_filter_lo = mktime(0, 0, 0 , intval(substr($msg_today, 0, 2)), intval(substr($msg_today, 2, 2) - 14), intval(substr($msg_today, 4, 4))); break; case '6': $msg_time_filter_lo = mktime(0, 0, 0 , intval(substr($msg_today, 0, 2)), intval(substr($msg_today, 2, 2) - 21), intval(substr($msg_today, 4, 4))); break; case '7': $msg_time_filter_lo = mktime(0, 0, 0 , intval(substr($msg_today, 0, 2) - 1), intval(substr($msg_today, 2, 2)), intval(substr($msg_today, 4, 4))); break; case '8': $msg_time_filter_lo = mktime(0, 0, 0 , intval(substr($msg_today, 0, 2) - 2), intval(substr($msg_today, 2, 2)), intval(substr($msg_today, 4, 4))); break; case '9': $msg_time_filter_lo = mktime(0, 0, 0 , intval(substr($msg_today, 0, 2) - 3), intval(substr($msg_today, 2, 2)), intval(substr($msg_today, 4, 4))); break; case '10': $msg_time_filter_lo = mktime(0, 0, 0 , intval(substr($msg_today, 0, 2) - 6), intval(substr($msg_today, 2, 2)), intval(substr($msg_today, 4, 4))); break; case '11': $msg_time_filter_lo = mktime(0, 0, 0 , intval(substr($msg_today, 0, 2)), intval(substr($msg_today, 2, 2)), intval(substr($msg_today, 4, 4) - 1)); break; default: $msg_time_filter_lo = 'no'; break; } if ( $msg_time_filter_lo != 'no' && !empty($msg_time_filter_lo) ) { $sql_xtra = " AND f1.link_time > " . $msg_time_filter_lo; } $filter_cat_id = false; if (intval($toplist_config['toplist_cat_id']) > 0) { $filter_cat_id = array(); $filter_cat_id['parent'] = $toplist_config['toplist_cat_id']; } $no_file_message = true; $filelist = false; $template->set_filenames( array( 'body' => 'link_lists.tpl' ) ); $sort_options_list = unserialize($toplist_config['toplist_display_options']); $linkdb_config['pagination'] = $toplist_config['toplist_pagination']; $total_num_items = $this->display_items( $sort_method, $sort_order, $start, $filter_cat_id, true, $sort_options_list, $sql_xtra, $toplist_page_id ); $template->assign_vars( array( 'U_LINK' => append_sid( $this->this_mxurl() ), 'LINK' => $linkdb_config['module_name'], 'BLOCK_PAGINATION' => mx_generate_pagination(append_sid( $this->this_mxurl( '', false, false ) ), $total_num_items, $toplist_config['toplist_pagination'], $start, true, true, true, false, 'link_start'), )); if ($toplist_config['toplist_use_pagination'] == 'TRUE') { $template->assign_block_vars( "toplist_pagination", array()); } $this->display( $lang['Links'], 'link_lists.tpl' ); } } ?> |