Файловый менеджер - Редактировать - /var/www/html/mod_jdownloads_stats.zip
Ðазад
PK ! ��-p p mod_jdownloads_stats.phpnu �[��� <?php /** * @version $Id: mod_jdownloads_stats.php * @package mod_jdownloads_stats * @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 the statistic values from the jDownloads component. */ defined( '_JEXEC' ) or die; use Joomla\CMS\Factory; use Joomla\CMS\Uri\Uri; use Joomla\CMS\Helper\ModuleHelper; use Joomla\CMS\HTML\HTMLHelper; use JDownloads\Module\JDownloadsStats\Site\Helper\JDownloadsStatsHelper; use JDownloads\Component\JDownloads\Site\Model\DownloadsModel; use Joomla\Database\DatabaseInterface; $app = Factory::getApplication(); $db = Factory::getContainer()->get(DatabaseInterface::class); $document = Factory::getApplication()->getDocument(); // Add bootstrap css and tooltip HTMLHelper::_('bootstrap.loadCss', true, $document->direction); HTMLHelper::_('bootstrap.tooltip', '.has-tooltip'); $user= Factory::getApplication()->getIdentity(); $text = $params->get( 'text' ); $text = JDownloadsStatsHelper::getOnlyLanguageSubstring($text); $text_admin = $params->get( 'text_admin' ); $text_admin = JDownloadsStatsHelper::getOnlyLanguageSubstring($text_admin); $color = trim($params->get( 'value_color' ) ); $alignment = ($params->get( 'alignment' ) ); // NOTE have to check if module has alternate layout $layout = $params->get('layout', 'default'); // See if the selected layout contains 'alternate' from jD3.2 series, if yes switch to default if(strpos($layout, 'alternate') !== false) { $layout = '_:default'; // For some reason the layouts from "$params->get('layout', 'default')" are preceded by "_:" } $result = JDownloadsStatsHelper::getData($params); $sumcats = JDownloadsStatsHelper::strToNumber($result['cats']); $sumfiles = JDownloadsStatsHelper::strToNumber($result['files']); $sumdownloads = JDownloadsStatsHelper::strToNumber($result['hits']); $sumviews = JDownloadsStatsHelper::strToNumber($result['views']); $moduleclass_sfx = $params->get('moduleclass_sfx'); if($moduleclass_sfx != '') { $moduleclass_sfx = htmlspecialchars($moduleclass_sfx); //only here if not empty } require ModuleHelper::getLayoutPath('mod_jdownloads_stats',$layout); ?>PK ! w'ܑ/ / $ src/Helper/JDownloadsStatsHelper.phpnu �[��� <?php /** * @version $Id: mod_jdownloads_stats.php v3.8 * @package mod_jdownloads_stats * @copyright (C) 2018 Arno Betz * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL * @author Arno Betz http://www.jDownloads.com */ namespace JDownloads\Module\JDownloadsStats\Site\Helper; \defined('_JEXEC') or die; use Joomla\CMS\Access\Access; use Joomla\CMS\Component\ComponentHelper; use Joomla\CMS\Factory; use Joomla\CMS\Router\Route; use Joomla\Registry\Registry; use Joomla\Utilities\ArrayHelper; use Joomla\CMS\Language\Text; use Joomla\CMS\MVC\Model\BaseDatabaseModel; use Joomla\Database\DatabaseInterface; use JDownloads\Component\JDownloads\Site\Helper\JDRouteHelper; use JDownloads\Component\JDownloads\Site\Model\DownloadsModel; abstract class JdownloadsStatsHelper { static function getData($params) { $app = Factory::getApplication(); $db = Factory::getContainer()->get(DatabaseInterface::class); $query = $db->getQuery(true); // Get the current user for authorisation checks $user = Factory::getApplication()->getIdentity(); $user->authorise('core.admin') ? $is_admin = true : $is_admin = false; $result = array(); $use_all_items = $params->get('use_all_items', 0); $app = Factory::getApplication(); $language = $app->getLanguageFilter(); // Access $access = true; $authorised = Access::getAuthorisedViewLevels(Factory::getUser()->get('id')); $groups = implode(',', $authorised); // get at first the categories $query->select('id')->from('#__jdownloads_categories'); $query->where('published = 1'); if (!$use_all_items){ $query->where('access IN ('.$groups.')'); } $query->where("id > '1'"); // remove 'root' cat $db->setQuery($query); $cats = $db->loadColumn(); $result['cats'] = (int)count($cats); $cats_id_list = implode(',', $cats); // get the Downloads $query->clear(); $query->select('COUNT(id)')->from('#__jdownloads_files AS a'); $query->where('a.published = 1'); if (!$use_all_items){ if ($user->id > 0){ // User is not a guest so we can generally use the user-id to find also the Downloads with single user access if ($is_admin){ // User is admin so we should display all possible Downloads - included the Downloads with single user access $query->where('((a.access IN ('.$groups.') AND a.user_access = 0) OR (a.access != 0 AND a.user_access != 0))'); } else { $query->where('((a.access IN ('.$groups.') AND a.user_access = 0) OR (a.access != 0 AND a.user_access = '.$db->quote($user->id). '))'); } } else { $query->where('a.access IN ('.$groups.')'); } } $query->where('a.catid IN ('.$cats_id_list.')'); $db->setQuery($query); $result['files'] = (int)$db->loadResult(); // get the Downloads $query->clear(); $query->select('SUM(downloads)')->from('#__jdownloads_files AS a'); $query->where('a.published = 1'); if (!$use_all_items){ if ($user->id > 0){ // User is not a guest so we can generally use the user-id to find also the Downloads with single user access if ($is_admin){ // User is admin so we should display all possible Downloads - included the Downloads with single user access $query->where('((a.access IN ('.$groups.') AND a.user_access = 0) OR (a.access != 0 AND a.user_access != 0))'); } else { $query->where('((a.access IN ('.$groups.') AND a.user_access = 0) OR (a.access != 0 AND a.user_access = '.$db->quote($user->id). '))'); } } else { $query->where('a.access IN ('.$groups.')'); } } $query->where('a.catid IN ('.$cats_id_list.')'); $db->setQuery($query); $result['hits'] = (int)$db->loadResult(); $query->clear(); $query->select('SUM(views)')->from('#__jdownloads_files AS a'); $query->where('a.published = 1'); if (!$use_all_items){ if ($user->id > 0){ // User is not a guest so we can generally use the user-id to find also the Downloads with single user access if ($is_admin){ // User is admin so we should display all possible Downloads - included the Downloads with single user access $query->where('((a.access IN ('.$groups.') AND a.user_access = 0) OR (a.access != 0 AND a.user_access != 0))'); } else { $query->where('((a.access IN ('.$groups.') AND a.user_access = 0) OR (a.access != 0 AND a.user_access = '.$db->quote($user->id). '))'); } } else { $query->where('a.access IN ('.$groups.')'); } } $query->where('a.catid IN ('.$cats_id_list.')'); $db->setQuery($query); $result['views'] = (int)$db->loadResult(); return $result; } /** * remove the language tag from a given text and return only the text * * @param string $msg */ public static function getOnlyLanguageSubstring($msg) { // Get the current locale language tag $lang = Factory::getApplication()->getLanguage(); $lang_key = $lang->getTag(); if ($msg == '' ) { return $msg; } // remove the language tag from the text $startpos = strpos($msg, '{'.$lang_key.'}') + strlen( $lang_key) + 2 ; $endpos = strpos($msg, '{/'.$lang_key.'}') ; if ($startpos !== false && $endpos !== false){ return substr($msg, $startpos, ($endpos - $startpos )); } else { return $msg; } } /** * Converts a string into Float while taking the given or locale number format into account * Used as default the defined separator characters from the Joomla main language ini file (as example: en-GB.ini) * * @param mixed $str * @param mixed $dec_point * @param mixed $thousands_sep * @param mixed $decimals * @return mixed */ public static function strToNumber( $str, $dec_point=null, $thousands_sep=null, $decimals = 0 ) { if( is_null($dec_point) || is_null($thousands_sep) ) { if( is_null($dec_point) ) { $dec_point = Text::_('DECIMALS_SEPARATOR'); } if( is_null($thousands_sep) ) { $thousands_sep = Text::_('THOUSANDS_SEPARATOR'); } } // in this case use we as default the en-GB format if (!$dec_point) $dec_point = '.'; if (!$thousands_sep) $thousands_sep = ','; $number = number_format($str, $decimals, $dec_point, $thousands_sep); return $number; } } ?>PK ! �rx - language/en-GB/en-GB.mod_jdownloads_stats.ininu �[��� ; mod_jdownloads_stats ; language file ; Note : All ini files need to be saved as UTF-8 - No BOM MOD_JDOWNLOADS_STATS="jDownloads Stats" MOD_JDOWNLOADS_STATS_XML_DESC="This module shows the statistic values from the jDownloads component. jDownloads version 4.0 or newer is required." MOD_JDOWNLOADS_STATS_TEXT_LABEL="Text:" MOD_JDOWNLOADS_STATS_TEXT_DESC="Enter the text for the module here. The following placeholders can be applied: #1 = Number of Files. #2 = Number of Categories. #3 = Number of completed downloads. #4 = Number of downloads detailed views. These placeholders will be replaced with the appropriate values. You can also use HTML tags in this field." MOD_JDOWNLOADS_STATS_TEXT_COLOR_LABEL="Text colour for Values:" MOD_JDOWNLOADS_STATS_TEXT_COLOR_DESC="You can enter a font colour for the Values here. This must be in hexadecimal format, e.g.: #990000 for dark red. For default color, use only: #." MOD_JDOWNLOADS_STATS_ALIGN_TITLE="Alignment" MOD_JDOWNLOADS_STATS_ALIGN_DESC="Alignment of the module" MOD_JDOWNLOADS_STATS_CLASS_SUFFIX_TITLE="Module Class Suffix:" MOD_JDOWNLOADS_STATS_CLASS_SUFFIX_DESC="A suffix to be applied to the css class of the module, this allows individual module styling." MOD_JDOWNLOADS_STATS_US_ALL_ITEMS="Use all items for calculation:" MOD_JDOWNLOADS_STATS_US_ALL_ITEMS_DESC="If Yes all categories and downloads may be used for the calculation. Special access rights for individual categories or downloads are then ignored." MOD_JDOWNLOADS_STATS_YES="Yes" MOD_JDOWNLOADS_STATS_NO="No"PK ! ���! ! 1 language/en-GB/en-GB.mod_jdownloads_stats.sys.ininu �[��� ; mod_jdownloads_stats ; language file ; Note : All ini files need to be saved as UTF-8 - No BOM MOD_JDOWNLOADS_STATS="jDownloads Stats" MOD_JDOWNLOADS_STATS_XML_DESC="This module shows the statistic values from the jDownloads component. jDownloads version 4.0 or newer is required."PK ! �E��J J 1 language/de-DE/de-DE.mod_jdownloads_stats.sys.ininu �[��� ; mod_jdownloads_stats ; language file ; Note : All ini files need to be saved as UTF-8 - No BOM MOD_JDOWNLOADS_STATS="jDownloads Statistik" MOD_JDOWNLOADS_STATS_XML_DESC="Dieses Modul zeigt die Anzahl der Kategorien und Downloads sowie weitere statistische Daten von jDownloads an. Es benötigt jDownloads v4.0 oder neuer."PK ! �~� - language/de-DE/de-DE.mod_jdownloads_stats.ininu �[��� ; mod_jdownloads_stats ; language file ; Note : All ini files need to be saved as UTF-8 - No BOM MOD_JDOWNLOADS_STATS="jDownloads Statistik" MOD_JDOWNLOADS_STATS_XML_DESC="Dieses Modul zeigt die Anzahl der Kategorien und Downloads sowie weitere statistische Daten von jDownloads an. Es benötigt jDownloads v.4.0 oder neuer." MOD_JDOWNLOADS_STATS_TEXT_LABEL="Text:" MOD_JDOWNLOADS_STATS_TEXT_DESC="Der angezeigte Text. Folgende Platzhalter können verwendet werden: #1 = Anzahl Downloads. #2 = Anzahl Kategorien. #3 = Anzahl heruntergeladener Dateien insgesamt. #4 = Anzahl der Aufrufe der Downloads Detailansicht. Diese Platzhalter werden mit den aktuellen Werten ersetzt. HTML kann hier auch verwendet werden.<br /><br />Für mehrsprachige Webseiten muss hier für jede Sprache eine eigener Text erstellt werden. Jeder Text muss dann mit den Begrenzern der jeweiligen Sprache gekennzeichnet werden.<br /><br />Beispiel für einen englischen und deutschen Text:<br />{en-GB}English Text{/en-GB} {de-DE}Deutscher Text{/de-DE}." MOD_JDOWNLOADS_STATS_TEXT_COLOR_LABEL="Textfarbe für Werte:" MOD_JDOWNLOADS_STATS_TEXT_COLOR_DESC="Hier kann eine Schriftfarbe nur für die Werte angegeben werden. Diese muss im Hexadezimalen Format (z.B.: #990000 für dunkel rot) angegeben werden. Für die Standardfarbe nur: # eingeben." MOD_JDOWNLOADS_STATS_ALIGN_TITLE="Modul Ausrichtung" MOD_JDOWNLOADS_STATS_ALIGN_DESC="Ausrichtung des Module Inhalts" MOD_JDOWNLOADS_STATS_CLASS_SUFFIX_TITLE="Modulklassensuffix:" MOD_JDOWNLOADS_STATS_CLASS_SUFFIX_DESC="Ein Suffix welches an die CSS-Klasse des Moduls angehangen wird. Dadurch besteht die Möglichkeit ein individuelles Modul Layout zu erstellen." MOD_JDOWNLOADS_STATS_US_ALL_ITEMS="Verwende alle Elemente:" MOD_JDOWNLOADS_STATS_US_ALL_ITEMS_DESC="Wenn aktiviert werden allen Kategorien und Downloads bei der Berechnung berücksichtigt. Bei Deaktivierung werden nur die Elemente berücksichtigt, die der aktuelle Besucher auch sehen darf (Zugriffsrechte)." MOD_JDOWNLOADS_STATS_YES="Ja" MOD_JDOWNLOADS_STATS_NO="Nein"PK ! j8�" " tmpl/default.phpnu �[��� <?php /** * @version $Id: mod_jdownloads_stats.php * @package mod_jdownloads_stats * @copyright (C) 2018 Arno Betz * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL * @author Arno Betz http://www.jDownloads.com */ // this is the default layout defined('_JEXEC') or die; use Joomla\CMS\Router\Route; use JDownloads\Component\JDownloads\Site\Helper\JDHelper; use JDownloads\Module\JDownloadsTop\Site\Helper\JDownloadsTopHelper; use Joomla\CMS\Factory; $html = '<div class="moduletable'.$moduleclass_sfx.'">'; if ($text <> ''){ $text = str_replace('#1', '<font color="'.$color.'">'.$sumfiles.'</font>', $text); $text = str_replace('#2', '<font color="'.$color.'">'.$sumcats.'</font>', $text); $text = str_replace('#3', '<font color="'.$color.'">'.$sumdownloads.'</font>', $text); $text = str_replace('#4', '<font color="'.$color.'">'.$sumviews.'</font>', $text); $html .= '<div style="text-align:'.$alignment.'">'.$text.'</div>'; } echo $html.'</div>'; ?>PK ! ���C� � mod_jdownloads_stats.xmlnu �[��� <?xml version="1.0" encoding="utf-8"?> <extension type="module" client="site" version="3.4" method="upgrade"> <name>jDownloads Stats</name> <author>Arno Betz</author> <creationDate>2026-02-10</creationDate> <copyright>(C) 2007-2026 by Arno Betz. All rights reserved.</copyright> <license>http://www.gnu.org/copyleft/gpl.html GNU/GPL</license> <authorEmail>info@jdownloads.com</authorEmail> <authorUrl>www.jDownloads.com</authorUrl> <version>4.1</version> <description>MOD_JDOWNLOADS_STATS_XML_DESC</description> <namespace path="src">JDownloads\Module\JDownloadsStats</namespace> <files> <filename module="mod_jdownloads_stats">mod_jdownloads_stats.php</filename> <filename>mod_jdownloads_stats.xml</filename> <folder>tmpl</folder> <folder>src</folder> <folder>language</folder> </files> <config> <fields name="params"> <fieldset name="basic"> <field name="text" type="textarea" cols="30" rows="10" default="{en-GB}The download archive contains currently #1 Downloads in #2 Categories. To date, these have been downloaded #3 times.{/en-GB} {de-DE}Das Download Archiv enthält aktuell #1 Dateien in #2 Kategorien. Bis heute wurden diese #3 mal heruntergeladen.{/de-DE}" label="MOD_JDOWNLOADS_STATS_TEXT_LABEL" description="MOD_JDOWNLOADS_STATS_TEXT_DESC" filter="raw"/> <field name="use_all_items" type="radio" class="btn-group" label="MOD_JDOWNLOADS_STATS_US_ALL_ITEMS" default="0" description="MOD_JDOWNLOADS_STATS_US_ALL_ITEMS_DESC"> <option value="1">MOD_JDOWNLOADS_STATS_YES</option> <option value="0">MOD_JDOWNLOADS_STATS_NO</option> </field> <field name="value_color" type="text" default="#990000" label="MOD_JDOWNLOADS_STATS_TEXT_COLOR_LABEL" description="MOD_JDOWNLOADS_STATS_TEXT_COLOR_DESC"/> <field name="alignment" type="list" label="MOD_JDOWNLOADS_STATS_ALIGN_TITLE" default="left" description="MOD_JDOWNLOADS_STATS_ALIGN_DESC"> <option value="left">left</option> <option value="right">right</option> <option value="center">center</option> <option value="justify">justify</option> </field> </fieldset> <fieldset name="advanced"> <field name="moduleclass_sfx" type="text" default="" label="MOD_JDOWNLOADS_STATS_CLASS_SUFFIX_TITLE" description="MOD_JDOWNLOADS_STATS_CLASS_SUFFIX_DESC" validate="CssIdentifier" /> </fieldset> </fields> </config> </extension>PK ! ��-p p mod_jdownloads_stats.phpnu �[��� PK ! w'ܑ/ / $ � src/Helper/JDownloadsStatsHelper.phpnu �[��� PK ! �rx - ;'