3.0.0MPAKÿüÌINFOÌüÿ# # This file contains Installation Informations. # This file does not include Installation Instructions for the normal User. # Please do not edit this file if you are not the Module Author. # # Please read the provided install.txt for Informations on how to install this Module. # # Module Name [name] Top Downloaded Attachments [/name] # Module Directory Name [short_name] top_attachments [/short_name] # your name [author] Acyd Burn [/author] # your email [email] n/a [/email] # your webpage url [url] http://www.detecties.com/phpbb2018 [/url] # module version [version] 3.0.1 [/version] # required minimum Statistics Mod Version [stats_mod_version] 3.0.1beta3s [/stats_mod_version] # default update time [update_time] 360 [/update_time] [check_update_site] http://www.detecties.com/phpbb2018 [/check_update_site] # extra info for the user [extra_info] This Module will print out the most downloaded Files. The Attachment Mod Version 2.3.x have to be installed in order to let this Module work. You are able to exclude Images from the statistic too. [/extra_info] # admin panel integration [admin_panel] option:exclude_images type:number trigger:enum title:exclude_images_title explain:exclude_images_explain default:0 [/admin_panel]ÌÌÿINFOÿÌÌÿüÌLANGÌüÿÌÌÿLANGÿÌÌÿüÌMODÌüÿstart_module(true); $core->set_content('statistical'); // // Get the user-definable variables // -- exclude_images (TRUE/FALSE) $user_variables = $core->get_user_defines(); $exclude_images = intval($user_variables['exclude_images']); $core->set_view('rows', $core->return_limit); $core->set_view('columns', 7); $core->define_view('set_columns', array( $core->pre_defined('rank'), 'filename' => $lang['Filename'], 'filecomment' => $lang['Filecomment'], 'size' => $lang['Size'], 'downloads' => $lang['Downloads'], 'posttime' => $lang['Posttime'], 'posttopic' => $lang['Posted_in_topic']) ); $core->set_header($lang['module_name']); $core->assign_defined_view('width_rows', array( '10%', '20%', '20%', '10%', '5%', '15%', '20%') ); $attachment_mod_installed = ( isset($attach_config) ) ? TRUE : FALSE; $attachment_version = ($attachment_mod_installed) ? ATTACH_VERSION : ''; if ($attachment_version == '') { $attachment_version = $attach_config['attach_version']; } if ( !$attachment_mod_installed ) { message_die(GENERAL_MESSAGE, "The Attachment Mod have to be installed in order to see the Top Downloaded Attachments."); } if ( (!strstr($attachment_version, '2.3.')) ) { if ( (!strstr($attachment_version, '2.4.')) ) { message_die(GENERAL_MESSAGE, 'Wrong Attachment Mod Version detected.
Please update your Attachment Mod (V' . $attachment_version . ') to at least Version 2.3.0.'); } } $language = $board_config['default_lang']; if( !file_exists($phpbb_root_path . 'language/lang_' . $language . '/lang_admin_attach.'.$phpEx) ) { $language = $attach_config['board_lang']; } include($phpbb_root_path . 'language/lang_' . $language . '/lang_admin_attach.' . $phpEx); $order_by = 'download_count DESC LIMIT ' . $core->return_limit; /* $sql = "SELECT a.post_id, p.forum_id as post_forum_id, t.topic_title, d.* FROM " . ATTACHMENTS_TABLE . " a, " . ATTACHMENTS_DESC_TABLE . " d, " . POSTS_TABLE . " p, " . TOPICS_TABLE . " t WHERE (a.post_id = p.post_id) AND (p.topic_id = t.topic_id) AND (a.attach_id = d.attach_id)"; */ if ( $userdata['session_logged_in'] ) { if ($userdata['user_level'] == ADMIN) { $sql = "SELECT a.post_id, p.forum_id as post_forum_id, t.topic_title, d.* FROM " . ATTACHMENTS_TABLE . " a, " . ATTACHMENTS_DESC_TABLE . " d, " . POSTS_TABLE . " p, " . TOPICS_TABLE . " t WHERE (a.post_id = p.post_id) AND (p.topic_id = t.topic_id) AND (a.attach_id = d.attach_id)"; } else if ($userdata['user_level'] == MOD) { $sql = "SELECT a.post_id, p.forum_id as post_forum_id, t.topic_title, d.*, f.forum_id FROM " . ATTACHMENTS_TABLE . " a, " . ATTACHMENTS_DESC_TABLE . " d, " . POSTS_TABLE . " p, " . TOPICS_TABLE . " t, " . FORUMS_TABLE . " f WHERE (a.post_id = p.post_id) AND (p.topic_id = t.topic_id) AND (t.forum_id = f.forum_id) AND (t.topic_status <> 2) AND (f.auth_view <> 2) AND (a.attach_id = d.attach_id)"; } else if (($userdata['user_level'] != ADMIN)or($userdata['user_level'] != MOD)) { $sql = "SELECT a.post_id, p.forum_id as post_forum_id, t.topic_title, d.*, f.forum_id FROM " . ATTACHMENTS_TABLE . " a, " . ATTACHMENTS_DESC_TABLE . " d, " . POSTS_TABLE . " p, " . TOPICS_TABLE . " t, " . FORUMS_TABLE . " f WHERE (a.post_id = p.post_id) AND (p.topic_id = t.topic_id) AND (t.forum_id = f.forum_id) AND (t.topic_status <> 2) AND (f.auth_view <> 2) AND (f.auth_view <> 3) AND (a.attach_id = d.attach_id)"; } } else { $sql = "SELECT a.post_id, p.forum_id as post_forum_id, t.topic_title, d.*, f.forum_id FROM " . ATTACHMENTS_TABLE . " a, " . ATTACHMENTS_DESC_TABLE . " d, " . POSTS_TABLE . " p, " . TOPICS_TABLE . " t, " . FORUMS_TABLE . " f WHERE (a.post_id = p.post_id) AND (p.topic_id = t.topic_id) AND (t.forum_id = f.forum_id) AND (t.topic_status <> 2) AND (f.auth_view <> 1) AND (f.auth_view <> 2) AND (f.auth_view <> 3) AND (a.attach_id = d.attach_id)"; } if ($exclude_images) { $sql .= " AND d.mimetype NOT LIKE '%image%'"; } $sql .= " ORDER BY " . $order_by; $result = $core->sql_query($sql, 'Couldn\'t query attachments'); $attachments = $core->sql_fetchrowset($result); $num_attachments = $core->sql_numrows($result); $data = array(); for ($i = 0; $i < $num_attachments; $i++) { // filename_link $data[$i]['filename_link'] = ''; $filename = trim($attachments[$i]['real_filename']); $filename_2 = ''; if (strlen($filename) > 22) { $filename_2 = substr($filename, 0, 20) . '...'; } $view_attachment = append_sid('download.' . $phpEx . '?id=' . $attachments[$i]['attach_id']); $data[$i]['filename_link'] = ($filename_2 != '') ? '' . $filename_2 . '' : '' . $filename . ''; // comment_field $data[$i]['comment_field'] = ''; $comment = trim($attachments[$i]['comment']); $comment_2 = ''; if (strlen($comment) > 22) { $comment_2 = substr($comment, 0, 20) . '...'; } $data[$i]['comment_field'] = ($comment_2 != '') ? '' . $comment_2 . '' : $comment; // size $data[$i]['size'] = intval($attachments[$i]['filesize']); if ($data[$i]['size'] >= 1048576) { $data[$i]['size'] = round($data[$i]['size'] / 1048576 * 100) / 100 . ' ' . $lang['MB']; } else if ($data[$i]['size'] >= 1024) { $data[$i]['size'] = round($data[$i]['size'] / 1024 * 100) / 100 . ' ' . $lang['KB']; } else { $data[$i]['size'] = $data[$i]['size'] . ' ' . $lang['Bytes']; } // Download Count $data[$i]['download_count'] = intval($attachments[$i]['download_count']); // Post Time $data[$i]['post_time'] = create_date($board_config['default_dateformat'], intval($attachments[$i]['filetime']), $board_config['board_timezone']); // Topic Title $data[$i]['topic_title'] = ''; $topic_title = trim($attachments[$i]['topic_title']); $topic_title_2 = ''; if (strlen($topic_title) > 22) { $topic_title_2 = substr($topic_title, 0, 20) . '...'; } $view_topic = append_sid($phpbb_root_path . 'viewtopic.' . $phpEx . '?' . POST_POST_URL . '=' . intval($attachments[$i]['post_id']) . '#' . intval($attachments[$i]['post_id'])); $data[$i]['topic_title'] = ($topic_title_2 != '') ? '' . $topic_title_2 . '' : '' . $topic_title . ''; $data[$i]['forum_id'] = intval($attachments[$i]['post_forum_id']); } $core->set_data($data); $core->define_view('set_rows', array( '$core->pre_defined()', '$core->data(\'filename_link\')', '$core->data(\'comment_field\')', '$core->data(\'size\')', '$core->data(\'download_count\')', '$core->data(\'post_time\')', '$core->data(\'topic_title\')' )); $core->run_module(); ?>ÌÌÿMODÿÌÌ