-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathprint.php
More file actions
63 lines (50 loc) · 2.13 KB
/
print.php
File metadata and controls
63 lines (50 loc) · 2.13 KB
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
<?php
/**
* Print Faq page
*
* @copyright INBOX International
* @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU General Public License (GPL)
* @since 1.0
* @author Rodrigo Pereira Lima <rodrigo@inboxinternational.com>
* @package imfaq
* @version $Id$
*/
include_once 'header.php';
require_once XOOPS_ROOT_PATH.'/class/template.php';
$imfaq_faq_handler = icms_getModuleHandler ( 'faq' );
$clean_faq_id = isset ( $_GET ['faq_id'] ) ? intval ( $_GET ['faq_id'] ) : 0;
$clean_short_url = isset ( $_GET ['short_url'] ) ? $_GET ['short_url'] : '';
if ($clean_short_url != '' && $clean_faq_id == 0) {
$criteria = new CriteriaCompo ( );
$criteria->add ( new Criteria ( 'short_url', urlencode ( $clean_short_url ) ) );
$faqObj = $imfaq_faq_handler->getObjects ( $criteria );
$faqObj = $faqObj [0];
$clean_faq_id = $faqObj->getVar ( 'faq_id' );
} else {
$faqObj = $imfaq_faq_handler->get ( $clean_faq_id );
}
if (!$faqObj || !is_object( $faqObj ) || $faqObj->isNew ()) {
redirect_header("javascript:history.go(-1)", 1, _MD_IMFAQ_NOFAQSELECTED);
}
// Check user permissions to access that category of the selected ITEM
if (!$faqObj->accessGranted ()){
redirect_header("javascript:history.go(-1)", 1, _NOPERM);
}
$imfaq_cat_handler = icms_getModuleHandler('category');
$category = $imfaq_cat_handler->get($faqObj->getVar ( 'faq_cid','e' ));
$icmsTpl = new XoopsTpl();
global $xoopsConfig;
$myts = MyTextSanitizer::getInstance();
$faq= $faqObj->toArray();
$printtitle = $xoopsConfig['sitename']." - ". $category->getVar('cat_title','e') . ' > ' . strip_tags($faqObj->getVar ( 'faq_question','n' ));
$who_where = $faq['faq_info'];
$icmsTpl->assign('printtitle', $printtitle);
$icmsTpl->assign('printlogourl', ICMS_URL.'/images/logo.gif');
$icmsTpl->assign('lang_author_date', $who_where);
$icmsTpl->assign('faq', $faq);
$icmsTpl->assign('current_language', $xoopsConfig['language']);
$icmsTpl->assign('theme_set', $xoopsConfig['theme_set']);
$icmsTpl->assign('display_whowhen_link', $xoopsModuleConfig['show_faq_info']);
$icmsTpl->assign('module_footer', $xoopsModuleConfig['module_footer']);
$icmsTpl->display('db:imfaq_print.html');
?>