Completed
Push — master ( 65a58d...61df55 )
by Michael
08:26 queued 04:14
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
* $Id: print.php,v 1.16 2005/08/15 16:51:58 fx2024 Exp $
5
* Module: SmartFAQ
6
* Author: The SmartFactory <www.smartfactory.ca>
7
* Licence: GNU
8
*/
9
10
include_once __DIR__ . '/header.php';
11
12
$faqid = isset($_GET['faqid'])? intval($_GET['faqid']) : 0;
13
14
if ($faqid == 0) {
15
    redirect_header("javascript:history.go(-1)", 1, _MD_SF_NOFAQSELECTED);
16
    exit();
17
}
18
19
// Creating the FAQ handler object
20
$faq_handler =& sf_gethandler('faq');
21
22
// Creating the FAQ object for the selected FAQ
23
$faqObj = new sfFaq($faqid);
24
25
// If the selected FAQ was not found, exit
26
if ($faqObj->notLoaded()) {
27
    redirect_header("javascript:history.go(-1)", 1, _MD_SF_NOFAQSELECTED);
28
    exit();
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 (faqAccessGranted($faqObj) < 0) {
39
    redirect_header("javascript:history.go(-1)", 1, _NOPERM);
40
    exit;
41
}
42
43
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...
44
45
$who_where = $faqObj->getWhoAndWhen();
46
$comeFrom =  $faqObj->getComeFrom();
47
48
echo "<!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.01 Transitional//EN'>\n";
49
echo "<html>\n<head>\n";
50
echo "<title>" . _MD_SF_FAQCOMEFROM . " " . $xoopsConfig['sitename'] . "</title>\n";
51
echo "<meta http-equiv='Content-Type' content='text/html; charset=" . _CHARSET . "' />\n";
52
echo "<meta name='AUTHOR' content='" . $xoopsConfig['sitename'] . "' />\n";
53
echo "<meta name='COPYRIGHT' content='Copyright (c) 2001 by " . $xoopsConfig['sitename'] . "' />\n";
54
echo "<meta name='DESCRIPTION' content='" . $xoopsConfig['slogan'] . "' />\n";
55
echo "<meta name='GENERATOR' content='" . XOOPS_VERSION . "' />\n\n\n";
56
57
echo "<body bgcolor='#ffffff' text='#000000' onload='window.print()'>
58
     <div style='width: 650px; border: 1px solid #000; padding: 20px;'>
59
     <div style='text-align: center; display: block; margin: 0 0 6px 0;'><img src='" . XOOPS_URL . "/modules/smartfaq/assets/images/smartfaq_logo.png' border='0' alt='' /><h2 style='margin: 0;'>" . $faqObj->question() . "</h2></div>
60
     <div align='center'>" . $who_where . "</div>
61
                <div style='text-align: center; display: block; padding-bottom: 12px; margin: 0 0 6px 0; border-bottom: 2px solid #ccc;'></div>
62
                <div></div>
63
                <b><p>" . $faqObj->question() . "</p></b>
64
                <p>" . $answerObj->answer() . "</p>
65
                <div style='padding-top: 12px; border-top: 2px solid #ccc;'></div>
66
                <p>". $comeFrom . "</p>
67
            </div>
68
    <br />";
69
70
echo '<br />
71
          </body>
72
          </html>';
73