-
Notifications
You must be signed in to change notification settings - Fork 3
/
print.php
73 lines (57 loc) · 2.69 KB
/
print.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
<?php declare(strict_types=1);
/**
* Module: SmartFAQ
* Author: The SmartFactory <www.smartfactory.ca>
* Licence: GNU
*/
use Xmf\Request;
use XoopsModules\Smartfaq;
use XoopsModules\Smartfaq\Helper;
require_once __DIR__ . '/header.php';
$faqid = Request::getInt('faqid', 0, 'GET');
if (0 == $faqid) {
redirect_header('<script>javascript:history.go(-1)</script>', 1, _MD_SF_NOFAQSELECTED);
}
// Creating the FAQ handler object
/** @var \XoopsModules\Smartfaq\FaqHandler $faqHandler */
$faqHandler = Helper::getInstance()->getHandler('Faq');
// Creating the FAQ object for the selected FAQ
$faqObj = new Smartfaq\Faq($faqid);
// If the selected FAQ was not found, exit
if ($faqObj->notLoaded()) {
redirect_header('<script>javascript:history.go(-1)</script>', 1, _MD_SF_NOFAQSELECTED);
}
// Creating the category object that holds the selected FAQ
$categoryObj = $faqObj->category();
// Creating the answer object
$answerObj = $faqObj->answer();
// Check user permissions to access that category of the selected FAQ
if (Smartfaq\Utility::faqAccessGranted($faqObj) < 0) {
redirect_header('<script>javascript:history.go(-1)</script>', 1, _NOPERM);
}
global $xoopsConfig, $xoopsDB, $xoopsModule, $myts;
$who_where = $faqObj->getWhoAndWhen();
$comeFrom = $faqObj->getComeFrom();
echo "<!DOCTYPE HTML>\n";
echo "<html>\n<head>\n";
echo '<title>' . _MD_SF_FAQCOMEFROM . ' ' . $xoopsConfig['sitename'] . "</title>\n";
echo "<meta http-equiv='Content-Type' content='text/html; charset=" . _CHARSET . "'>\n";
echo "<meta name='AUTHOR' content='" . $xoopsConfig['sitename'] . "'>\n";
echo "<meta name='COPYRIGHT' content='Copyright (c) 2001 by " . $xoopsConfig['sitename'] . "'>\n";
echo "<meta name='DESCRIPTION' content='" . $xoopsConfig['slogan'] . "'>\n";
echo "<meta name='GENERATOR' content='" . XOOPS_VERSION . "'>\n\n\n";
echo "<body bgcolor='#ffffff' text='#000000' onload='window.print()'>
<div style='width: 650px; border: 1px solid #000; padding: 20px;'>
<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>
<div align='center'>" . $who_where . "</div>
<div style='text-align: center; display: block; padding-bottom: 12px; margin: 0 0 6px 0; border-bottom: 2px solid #ccc;'></div>
<div></div>
<b><p>" . $faqObj->question() . '</p></b>
<p>' . $answerObj->answer() . "</p>
<div style='padding-top: 12px; border-top: 2px solid #ccc;'></div>
<p>" . $comeFrom . '</p>
</div>
<br>';
echo '<br>
</body>
</html>';