1
|
|
|
<?php declare(strict_types=1); |
2
|
|
|
|
3
|
|
|
use XoopsModules\Smartfaq\Helper; |
|
|
|
|
4
|
|
|
|
5
|
|
|
/** |
6
|
|
|
* **************************************************************************** |
7
|
|
|
* marquee - MODULE FOR XOOPS |
8
|
|
|
* Copyright (c) Hervé Thouzard (https://www.herve-thouzard.com) |
9
|
|
|
* |
10
|
|
|
* You may not change or alter any portion of this comment or credits |
11
|
|
|
* of supporting developers from this source code or any supporting source code |
12
|
|
|
* which is considered copyrighted (c) material of the original comment or credit authors. |
13
|
|
|
* This program is distributed in the hope that it will be useful, |
14
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
15
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
16
|
|
|
* |
17
|
|
|
* @copyright Hervé Thouzard (https://www.herve-thouzard.com) |
18
|
|
|
* @license GNU GPL 2.0 or later (https://www.gnu.org/licenses/gpl-2.0.html) |
19
|
|
|
* @author Hervé Thouzard (https://www.herve-thouzard.com) |
20
|
|
|
* |
21
|
|
|
* Version : |
22
|
|
|
* **************************************************************************** |
23
|
|
|
* |
24
|
|
|
* @param $limit |
25
|
|
|
* @param $dateFormat |
26
|
|
|
* @param $itemsSize |
27
|
|
|
* |
28
|
|
|
* @return array |
29
|
|
|
*/ |
30
|
|
|
|
31
|
|
|
// Script to list recent FAQ from the smartfaq module (tested with smartfaq 1.04) |
32
|
|
|
function b_marquee_smartfaq($limit, $dateFormat, $itemsSize) |
|
|
|
|
33
|
|
|
{ |
34
|
|
|
require_once XOOPS_ROOT_PATH . '/modules/smartfaq/include/functions.php'; |
35
|
|
|
$block = []; |
36
|
|
|
$smartModule = &sf_getModuleInfo(); |
|
|
|
|
37
|
|
|
$smartModuleConfig = &sf_getModuleConfig(); |
|
|
|
|
38
|
|
|
$categoryid = -1; |
39
|
|
|
$sort = 'datesub'; |
40
|
|
|
$maxQuestionLength = 99999; |
41
|
|
|
if ($itemsSize > 0) { |
42
|
|
|
$maxQuestionLength = $itemsSize; |
43
|
|
|
} |
44
|
|
|
// Creating the faq handler object |
45
|
|
|
/** @var \XoopsModules\Smartfaq\FaqHandler $faqHandler */ |
46
|
|
|
$faqHandler = Helper::getInstance()->getHandler('Faq'); |
47
|
|
|
// Creating the category handler object |
48
|
|
|
/** @var \XoopsModules\Smartfaq\CategoryHandler $categoryHandler */ |
49
|
|
|
$categoryHandler = Helper::getInstance()->getHandler('Category'); |
50
|
|
|
// Creating the last FAQs |
51
|
|
|
$faqsObj = $faqHandler->getAllPublished($limit, 0, $categoryid, $sort); |
52
|
|
|
$allcategories = $categoryHandler->getObjects(null, true); |
53
|
|
|
if ($faqsObj) { |
54
|
|
|
$userids = $faqids = []; |
55
|
|
|
foreach ($faqsObj as $key => $thisfaq) { |
56
|
|
|
$faqids[] = $thisfaq->getVar('faqid'); |
57
|
|
|
$userids[$thisfaq->uid()] = 1; |
58
|
|
|
} |
59
|
|
|
/** @var \XoopsModules\Smartfaq\AnswerHandler $answerHandler */ |
60
|
|
|
$answerHandler = Helper::getInstance()->getHandler('Answer'); |
61
|
|
|
$allanswers = $answerHandler->getLastPublishedByFaq($faqids); |
62
|
|
|
foreach ($allanswers as $key => $thisanswer) { |
63
|
|
|
$userids[$thisanswer->uid()] = 1; |
64
|
|
|
} |
65
|
|
|
/** @var \XoopsMemberHandler $memberHandler */ |
66
|
|
|
$memberHandler = xoops_getHandler('member'); |
67
|
|
|
$users = $memberHandler->getUsers(new \Criteria('uid', '(' . implode(',', array_keys($userids)) . ')', 'IN'), true); |
68
|
|
|
for ($i = 0, $iMax = count($faqsObj); $i < $iMax; ++$i) { |
69
|
|
|
$answerObj = $allanswers[$faqsObj[$i]->faqid()]; |
70
|
|
|
$title = $faqsObj[$i]->question($maxQuestionLength); |
71
|
|
|
$block[] = [ |
72
|
|
|
'date' => $faqsObj[$i]->datesub(), |
73
|
|
|
'category' => $allcategories[$faqsObj[$i]->categoryid()]->getVar('name'), |
74
|
|
|
'author' => sf_getLinkedUnameFromId($answerObj->uid(), $smartModuleConfig['userealname'], $users), |
|
|
|
|
75
|
|
|
'title' => $title, |
76
|
|
|
'link' => "<a href='" . XOOPS_URL . '/modules/smartfaq/faq.php?faqid=' . $faqsObj[$i]->faqid() . "'>" . $title . '</a>', |
77
|
|
|
]; |
78
|
|
|
} |
79
|
|
|
} |
80
|
|
|
|
81
|
|
|
return $block; |
82
|
|
|
} |
83
|
|
|
|
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