Completed
Push — master ( 1b2f30...7ddb60 )
by Michael
05:43 queued 01:48
created

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
3
/**
4
 * Module: SmartFAQ
5
 * Author: The SmartFactory <www.smartfactory.ca>
6
 * Licence: GNU
7
 */
8
9
include_once __DIR__ . '/header.php';
10
11
$faqid = isset($_GET['faqid']) ? (int)$_GET['faqid'] : 0;
12
13
if ($faqid == 0) {
14
    redirect_header('javascript:history.go(-1)', 1, _MD_SF_NOFAQSELECTED);
15
}
16
17
// Creating the FAQ handler object
18
$faqHandler = sf_gethandler('faq');
19
20
// Creating the FAQ object for the selected FAQ
21
$faqObj = new sfFaq($faqid);
22
23
// If the selected FAQ was not found, exit
24
if ($faqObj->notLoaded()) {
25
    redirect_header('javascript:history.go(-1)', 1, _MD_SF_NOFAQSELECTED);
26
}
27
28
// Creating the category object that holds the selected FAQ
29
$categoryObj = $faqObj->category();
30
31
// Creating the answer object
32
$answerObj = $faqObj->answer();
33
34
// Check user permissions to access that category of the selected FAQ
35
if (faqAccessGranted($faqObj) < 0) {
36
    redirect_header('javascript:history.go(-1)', 1, _NOPERM);
37
}
38
39
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...
40
41
$who_where = $faqObj->getWhoAndWhen();
42
$comeFrom  = $faqObj->getComeFrom();
43
44
echo "<!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.01 Transitional//EN'>\n";
45
echo "<html>\n<head>\n";
46
echo '<title>' . _MD_SF_FAQCOMEFROM . ' ' . $xoopsConfig['sitename'] . "</title>\n";
47
echo "<meta http-equiv='Content-Type' content='text/html; charset=" . _CHARSET . "' />\n";
48
echo "<meta name='AUTHOR' content='" . $xoopsConfig['sitename'] . "' />\n";
49
echo "<meta name='COPYRIGHT' content='Copyright (c) 2001 by " . $xoopsConfig['sitename'] . "' />\n";
50
echo "<meta name='DESCRIPTION' content='" . $xoopsConfig['slogan'] . "' />\n";
51
echo "<meta name='GENERATOR' content='" . XOOPS_VERSION . "' />\n\n\n";
52
53
echo "<body bgcolor='#ffffff' text='#000000' onload='window.print()'>
54
     <div style='width: 650px; border: 1px solid #000; padding: 20px;'>
55
     <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>
56
     <div align='center'>" . $who_where . "</div>
57
                <div style='text-align: center; display: block; padding-bottom: 12px; margin: 0 0 6px 0; border-bottom: 2px solid #ccc;'></div>
58
                <div></div>
59
                <b><p>" . $faqObj->question() . '</p></b>
60
                <p>' . $answerObj->answer() . "</p>
61
                <div style='padding-top: 12px; border-top: 2px solid #ccc;'></div>
62
                <p>" . $comeFrom . '</p>
63
            </div>
64
    <br />';
65
66
echo '<br />
67
          </body>
68
          </html>';
69