1
|
|
|
<?php declare(strict_types=1); |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* **************************************************************************** |
5
|
|
|
* marquee - MODULE FOR XOOPS |
6
|
|
|
* Copyright (c) Hervé Thouzard (https://www.herve-thouzard.com) |
7
|
|
|
* |
8
|
|
|
* You may not change or alter any portion of this comment or credits |
9
|
|
|
* of supporting developers from this source code or any supporting source code |
10
|
|
|
* which is considered copyrighted (c) material of the original comment or credit authors. |
11
|
|
|
* This program is distributed in the hope that it will be useful, |
12
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
13
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
14
|
|
|
* |
15
|
|
|
* @copyright Hervé Thouzard (https://www.herve-thouzard.com) |
16
|
|
|
* @license GNU GPL 2.0 or later (https://www.gnu.org/licenses/gpl-2.0.html) |
17
|
|
|
* @author Hervé Thouzard (https://www.herve-thouzard.com) |
18
|
|
|
* |
19
|
|
|
* Version : |
20
|
|
|
* **************************************************************************** |
21
|
|
|
* |
22
|
|
|
* @param $limit |
23
|
|
|
* @param $dateFormat |
24
|
|
|
* @param $itemsSize |
25
|
|
|
* |
26
|
|
|
* @return array |
27
|
|
|
*/ |
28
|
|
|
|
29
|
|
|
use XoopsModules\Wfdownloads; |
|
|
|
|
30
|
|
|
|
31
|
|
|
// Script to list recent files from the wfdownloads module (tested with wfdownloads 3.1) |
32
|
|
|
/** |
33
|
|
|
* @param $limit |
34
|
|
|
* @param $dateFormat |
35
|
|
|
* @param $itemsSize |
36
|
|
|
* @return array |
37
|
|
|
*/ |
38
|
|
|
function b_marquee_wfdownloads($limit, $dateFormat, $itemsSize) |
|
|
|
|
39
|
|
|
{ |
40
|
|
|
$block = []; |
41
|
|
|
global $xoopsUser; |
42
|
|
|
/** @var \XoopsModuleHandler $moduleHandler */ |
43
|
|
|
$moduleHandler = xoops_getHandler('module'); |
44
|
|
|
$wfModule = $moduleHandler->getByDirname('wfdownloads'); |
45
|
|
|
/** @var \XoopsConfigHandler $configHandler */ |
46
|
|
|
$configHandler = xoops_getHandler('config'); |
47
|
|
|
$wfModuleConfig = $configHandler->getConfigsByCat(0, $wfModule->getVar('mid')); |
48
|
|
|
$groups = is_object($xoopsUser) ? $xoopsUser->getGroups() : XOOPS_GROUP_ANONYMOUS; |
49
|
|
|
/** @var \XoopsGroupPermHandler $grouppermHandler */ |
50
|
|
|
$grouppermHandler = xoops_getHandler('groupperm'); |
51
|
|
|
$allowed_cats = $grouppermHandler->getItemIds('WFDownCatPerm', $groups, $wfModule->getVar('mid')); |
52
|
|
|
$criteria = new \Criteria('cid', '(' . implode(',', $allowed_cats) . ')', 'IN'); |
|
|
|
|
53
|
|
|
$criteria = new \CriteriaCompo(new \Criteria('offline', 0)); |
54
|
|
|
$criteria->setSort('published'); |
55
|
|
|
$criteria->setOrder('DESC'); |
56
|
|
|
$criteria->setLimit($limit); |
57
|
|
|
$downloadHandler = Wfdownloads\Helper::getInstance()->getHandler('Download'); |
|
|
|
|
58
|
|
|
$categoryHandler = Wfdownloads\Helper::getInstance()->getHandler('Category'); |
59
|
|
|
$buffer_category = []; |
60
|
|
|
$downloads = $downloadHandler->getObjects($criteria); |
61
|
|
|
foreach (array_keys($downloads) as $i) { |
62
|
|
|
$download = $downloads[$i]->toArray(); |
63
|
|
|
if ($itemsSize > 0) { |
64
|
|
|
$title = xoops_substr($download['title'], 0, $itemsSize); |
65
|
|
|
} else { |
66
|
|
|
$title = $download['title']; |
67
|
|
|
} |
68
|
|
|
if (isset($buffer_category[$download['cid']])) { |
69
|
|
|
$categtitle = $buffer_category[$download['cid']]; |
70
|
|
|
} else { |
71
|
|
|
$category = $categoryHandler->get($download['cid']); |
72
|
|
|
$categtitle = $buffer_category[$download['cid']] = $category->getVar('title'); |
73
|
|
|
} |
74
|
|
|
$block[] = [ |
75
|
|
|
'date' => formatTimestamp($download['published'], $wfModuleConfig['dateformat']), |
76
|
|
|
'category' => $categtitle, |
77
|
|
|
'author' => $download['publisher'], |
78
|
|
|
'title' => $title, |
79
|
|
|
'link' => "<a href='" . XOOPS_URL . '/modules/wfdownloads/singlefile.php?cid=' . $download['cid'] . '&lid=' . $download['lid'] . "'>" . $title . '</a>', |
80
|
|
|
]; |
81
|
|
|
} |
82
|
|
|
|
83
|
|
|
return $block; |
84
|
|
|
} |
85
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths