-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmod_jdownloads_top.php
102 lines (87 loc) · 4.79 KB
/
mod_jdownloads_top.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
<?php
/**
* @version $Id: mod_jdownloads_top.php v3.9
* @package mod_jdownloads_top
* @copyright (C) 2018 Arno Betz
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
* @author Arno Betz http://www.jDownloads.com
*
* This module shows you the top (most downloaded) Downloads from the jDownloads component.
*/
defined( '_JEXEC' ) or die( 'Restricted access' );
require_once __DIR__ . '/helper.php';
require_once( JPATH_ROOT . DS . 'components' . DS . 'com_jdownloads' . DS . 'helpers' . DS .'jdownloads.php' );
$db = JFactory::getDBO();
$Itemid = JRequest::getVar("Itemid");
//add css
$document = JFactory::getDocument();
$document->addStyleSheet( JURI::base()."components/com_jdownloads/assets/css/jdownloads_modules.css");
// get published root menu link
$db->setQuery("SELECT id from #__menu WHERE link = 'index.php?option=com_jdownloads&view=categories' and published = 1 AND client_id = 0");
$root_itemid = $db->loadResult();
if ($root_itemid){
$Itemid = $root_itemid;
}
// get this option from configuration to see whether the links shall run the download without summary page
$app = JFactory::getApplication();
$jdparams = $app->getParams('com_jdownloads');
$direct_download_config = $jdparams->get('direct_download');
$detail_view_config = $jdparams->get('view_detailsite');
$before = trim($params->get( 'text_before' ) );
$text_before = modJdownloadsTopHelper::getOnlyLanguageSubstring($before);
$after = trim($params->get( 'text_after' ) );
$text_after = modJdownloadsTopHelper::getOnlyLanguageSubstring($after);
$catid = $params->get('catid', array());
$sum_view = intval(($params->get( 'sum_view' ) ));
$sum_char = intval(($params->get( 'sum_char' ) ));
$short_char = $params->get( 'short_char' ) ;
$short_version = $params->get( 'short_version' );
$detail_view = $params->get( 'detail_view' ) ;
$view_date = $params->get( 'view_date' ) ;
$view_date_same_line = $params->get( 'view_date_same_line' );
$view_date_text = $params->get( 'view_date_text' );
$view_date_text = modJdownloadsTopHelper::getOnlyLanguageSubstring($view_date_text);
// We use the standard short date format from the activated language when here is not a format defined
$date_format = $params->get( 'date_format', JText::_('DATE_FORMAT_LC4') );
$date_alignment = $params->get( 'date_alignment' );
$view_hits = $params->get( 'view_hits' ) ;
$view_hits_same_line = $params->get( 'view_hits_same_line' );
$hits_label = $params->get( 'hits_label' );
$hits_label = modJdownloadsTopHelper::getOnlyLanguageSubstring($hits_label);
$hits_alignment = $params->get( 'hits_alignment' );
$view_pics = $params->get( 'view_pics' ) ;
$view_pics_size = $params->get( 'view_pics_size' ) ;
//cam
$view_pics_link = $params->get( 'view_pics_link' ) ;
$view_numerical_list = $params->get( 'view_numerical_list' );
$view_thumbnails = $params->get( 'view_thumbnails' );
$view_thumbnails_size = $params->get( 'view_thumbnails_size' );
$view_thumbnails_link = $params->get( 'view_thumbnails_link' );
$view_thumbnails_dummy = $params->get( 'view_thumbnails_dummy' );
$hits_alignment = $params->get( 'hits_alignment' );
$cat_show = $params->get( 'cat_show' );
$cat_show_type = $params->get( 'cat_show_type' );
$cat_show_text = $params->get( 'cat_show_text' );
$cat_show_text = modJdownloadsTopHelper::getOnlyLanguageSubstring($cat_show_text);
$cat_show_text_color = $params->get( 'cat_show_text_color' );
$cat_show_text_size = $params->get( 'cat_show_text_size' );
$cat_show_as_link = $params->get( 'cat_show_as_link' );
$view_tooltip = $params->get( 'view_tooltip' );
$view_tooltip_length = intval($params->get( 'view_tooltip_length' ) );
$alignment = $params->get( 'alignment' );
$thumbfolder = JUri::base().'images/jdownloads/screenshots/thumbnails/';
$thumbnail = '';
$border = '';
$cat_show_text = trim($cat_show_text);
if ($cat_show_text) $cat_show_text = ' '.$cat_show_text.' ';
$view_date_text = trim($view_date_text);
if ($view_date_text) $view_date_text = $view_date_text.' ';
if ($sum_view == 0) $sum_view = 5;
$option = 'com_jdownloads';
$files = modJdownloadsTopHelper::getList($params);
if (!count($files)) {
return;
}
$moduleclass_sfx = htmlspecialchars($params->get('moduleclass_sfx'));
require JModuleHelper::getLayoutPath('mod_jdownloads_top',$params->get('layout', 'default'));
?>