Passed
Push — master ( 81ba93...c6c854 )
by Michael
03:30
created
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');
14
15
if (0 == $faqid) {
16
    redirect_header('javascript:history.go(-1)', 1, _MD_SF_NOFAQSELECTED);
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);
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 global state, we recommend one of these alternatives:

1. Pass all data via parameters

function myFunction($a, $b) {
    // Do something
}

2. Create a class that maintains your state

class MyClass {
    private $a;
    private $b;

    public function __construct($a, $b) {
        $this->a = $a;
        $this->b = $b;
    }

    public function myFunction() {
        // Do something
    }
}
Loading history...
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";
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";
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>
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