1 | <?php |
||||||
2 | |||||||
3 | /** |
||||||
4 | * Module: SmartFAQ |
||||||
5 | * Author: The SmartFactory <www.smartfactory.ca> |
||||||
6 | * Licence: GNU |
||||||
7 | */ |
||||||
8 | |||||||
9 | use XoopsModules\Smartfaq; |
||||||
10 | |||||||
11 | require_once __DIR__ . '/header.php'; |
||||||
12 | |||||||
13 | $faqid = \Xmf\Request::getInt('faqid', 0, 'GET'); |
||||||
0 ignored issues
–
show
|
|||||||
14 | |||||||
15 | if (0 == $faqid) { |
||||||
16 | redirect_header('javascript:history.go(-1)', 1, _MD_SF_NOFAQSELECTED); |
||||||
0 ignored issues
–
show
The function
redirect_header was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||||
17 | } |
||||||
18 | |||||||
19 | // Creating the FAQ handler object |
||||||
20 | /** @var \XoopsModules\Smartfaq\FaqHandler $faqHandler */ |
||||||
21 | $faqHandler = \XoopsModules\Smartfaq\Helper::getInstance()->getHandler('Faq'); |
||||||
22 | |||||||
23 | // Creating the FAQ object for the selected FAQ |
||||||
24 | $faqObj = new Smartfaq\Faq($faqid); |
||||||
25 | |||||||
26 | // If the selected FAQ was not found, exit |
||||||
27 | if ($faqObj->notLoaded()) { |
||||||
28 | redirect_header('javascript:history.go(-1)', 1, _MD_SF_NOFAQSELECTED); |
||||||
29 | } |
||||||
30 | |||||||
31 | // Creating the category object that holds the selected FAQ |
||||||
32 | $categoryObj = $faqObj->category(); |
||||||
33 | |||||||
34 | // Creating the answer object |
||||||
35 | $answerObj = $faqObj->answer(); |
||||||
36 | |||||||
37 | // Check user permissions to access that category of the selected FAQ |
||||||
38 | if (Smartfaq\Utility::faqAccessGranted($faqObj) < 0) { |
||||||
39 | redirect_header('javascript:history.go(-1)', 1, _NOPERM); |
||||||
0 ignored issues
–
show
|
|||||||
40 | } |
||||||
41 | |||||||
42 | global $xoopsConfig, $xoopsDB, $xoopsModule, $myts; |
||||||
0 ignored issues
–
show
Compatibility
Best Practice
introduced
by
Use of
global functionality is not recommended; it makes your code harder to test, and less reusable.
Instead of relying on 1. Pass all data via parametersfunction myFunction($a, $b) {
// Do something
}
2. Create a class that maintains your stateclass MyClass {
private $a;
private $b;
public function __construct($a, $b) {
$this->a = $a;
$this->b = $b;
}
public function myFunction() {
// Do something
}
}
![]() |
|||||||
43 | |||||||
44 | $who_where = $faqObj->getWhoAndWhen(); |
||||||
45 | $comeFrom = $faqObj->getComeFrom(); |
||||||
46 | |||||||
47 | echo "<!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.01 Transitional//EN'>\n"; |
||||||
48 | echo "<html>\n<head>\n"; |
||||||
49 | echo '<title>' . _MD_SF_FAQCOMEFROM . ' ' . $xoopsConfig['sitename'] . "</title>\n"; |
||||||
50 | echo "<meta http-equiv='Content-Type' content='text/html; charset=" . _CHARSET . "'>\n"; |
||||||
0 ignored issues
–
show
|
|||||||
51 | echo "<meta name='AUTHOR' content='" . $xoopsConfig['sitename'] . "'>\n"; |
||||||
52 | echo "<meta name='COPYRIGHT' content='Copyright (c) 2001 by " . $xoopsConfig['sitename'] . "'>\n"; |
||||||
53 | echo "<meta name='DESCRIPTION' content='" . $xoopsConfig['slogan'] . "'>\n"; |
||||||
54 | echo "<meta name='GENERATOR' content='" . XOOPS_VERSION . "'>\n\n\n"; |
||||||
0 ignored issues
–
show
|
|||||||
55 | |||||||
56 | echo "<body bgcolor='#ffffff' text='#000000' onload='window.print()'> |
||||||
57 | <div style='width: 650px; border: 1px solid #000; padding: 20px;'> |
||||||
58 | <div style='text-align: center; display: block; margin: 0 0 6px 0;'><img src='" . XOOPS_URL . "/modules/smartfaq/assets/images/logo_module.png' border='0' alt=''><h2 style='margin: 0;'>" . $faqObj->question() . "</h2></div> |
||||||
0 ignored issues
–
show
|
|||||||
59 | <div align='center'>" . $who_where . "</div> |
||||||
60 | <div style='text-align: center; display: block; padding-bottom: 12px; margin: 0 0 6px 0; border-bottom: 2px solid #ccc;'></div> |
||||||
61 | <div></div> |
||||||
62 | <b><p>" . $faqObj->question() . '</p></b> |
||||||
63 | <p>' . $answerObj->answer() . "</p> |
||||||
64 | <div style='padding-top: 12px; border-top: 2px solid #ccc;'></div> |
||||||
65 | <p>" . $comeFrom . '</p> |
||||||
66 | </div> |
||||||
67 | <br>'; |
||||||
68 | |||||||
69 | echo '<br> |
||||||
70 | </body> |
||||||
71 | </html>'; |
||||||
72 |
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