txmodxoops /
tdmcreate
This project does not seem to handle request data directly as such no vulnerable execution paths were found.
include, or for example
via PHP's auto-loading mechanism.
| 1 | <?php |
||
| 2 | /* |
||
| 3 | You may not change or alter any portion of this comment or credits |
||
| 4 | of supporting developers from this source code or any supporting source code |
||
| 5 | which is considered copyrighted (c) material of the original comment or credit authors. |
||
| 6 | |||
| 7 | This program is distributed in the hope that it will be useful, |
||
| 8 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
||
| 9 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
||
| 10 | */ |
||
| 11 | |||
| 12 | /** |
||
| 13 | * My Module 3 module for xoops |
||
| 14 | * |
||
| 15 | * @copyright 2020 XOOPS Project (https://xooops.org) |
||
| 16 | * @license GPL 2.0 or later |
||
| 17 | * @package mymodule3 |
||
| 18 | * @since 1.0 |
||
| 19 | * @min_xoops 2.5.9 |
||
| 20 | * @author TDM XOOPS - Email:<[email protected]> - Website:<http://xoops.org> |
||
| 21 | */ |
||
| 22 | |||
| 23 | use Xmf\Request; |
||
| 24 | use XoopsModules\Mymodule3; |
||
| 25 | use XoopsModules\Mymodule3\Constants; |
||
| 26 | |||
| 27 | require __DIR__ . '/header.php'; |
||
| 28 | $tfId = Request::getInt('tf_id'); |
||
| 29 | if (file_exists($tcpdf = XOOPS_ROOT_PATH.'/Frameworks/tcpdf/tcpdf.php')) { |
||
| 30 | require_once $tcpdf; |
||
| 31 | } else { |
||
| 32 | redirect_header('testfields.php', 2, _MA_MYMODULE3_NO_PDF_LIBRARY); |
||
| 33 | } |
||
| 34 | // Get Instance of Handler |
||
| 35 | $testfieldsHandler = $helper->getHandler('testfields'); |
||
| 36 | |||
| 37 | $pdfData['content'] = strip_tags($testfieldsHandler->getVar('tf_textarea')); |
||
| 38 | $pdfData['content'] = strip_tags($testfieldsHandler->getVar('tf_dhtml')); |
||
| 39 | $pdfData['author'] = \XoopsUser::getUnameFromId($testfieldsHandler->getVar('tf_user')); |
||
| 40 | $pdfData['date'] = formatTimeStamp($testfieldsHandler->getVar('tf_textdateselect'), 's'); |
||
| 41 | |||
| 42 | // Get Config |
||
| 43 | $pdfData['creator'] = $GLOBALS['xoopsConfig']['xoops_sitename']; |
||
| 44 | $pdfData['subject'] = $GLOBALS['xoopsConfig']['slogan']; |
||
| 45 | $pdfData['keywords'] = $GLOBALS['xoopsConfig']['keywords']; |
||
| 46 | // Defines |
||
| 47 | define('MYMODULE3_CREATOR', $pdfData['creator']); |
||
| 48 | define('MYMODULE3_AUTHOR', $pdfData['author']); |
||
| 49 | define('MYMODULE3_HEADER_TITLE', $pdfData['title']); |
||
| 50 | define('MYMODULE3_HEADER_STRING', $pdfData['subject']); |
||
| 51 | define('MYMODULE3_HEADER_LOGO', 'logo.gif'); |
||
| 52 | define('MYMODULE3_IMAGES_PATH', XOOPS_ROOT_PATH.'/images/'); |
||
| 53 | $myts = MyTextSanitizer::getInstance(); |
||
| 54 | $content = ''; |
||
| 55 | $content .= $myts->undoHtmlSpecialChars($pdfData['content']); |
||
| 56 | $content = $myts->displayTarea($content); |
||
| 57 | $pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, _CHARSET, false); |
||
|
0 ignored issues
–
show
Bug
introduced
by
Loading history...
The type
TCPDF was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths Loading history...
|
|||
| 58 | $title = $myts->undoHtmlSpecialChars($pdfData['title']); |
||
| 59 | $keywords = $myts->undoHtmlSpecialChars($pdfData['keywords']); |
||
| 60 | $pdfData['fontsize'] = 12; |
||
| 61 | // For schinese |
||
| 62 | if (_LANGCODE == 'cn') { |
||
|
0 ignored issues
–
show
|
|||
| 63 | $pdf->SetFont('gbsn00lp', '', $pdfData['fontsize']); |
||
| 64 | } else { |
||
| 65 | $pdf->SetFont($pdfData['fontname'], '', $pdfData['fontsize']); |
||
| 66 | } |
||
| 67 | // Set document information |
||
| 68 | $pdf->SetCreator($pdfData['creator']); |
||
| 69 | $pdf->SetAuthor($pdfData['author']); |
||
| 70 | $pdf->SetTitle($title); |
||
| 71 | $pdf->SetKeywords($keywords); |
||
| 72 | // Set default header data |
||
| 73 | $pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, MYMODULE3_HEADER_TITLE, MYMODULE3_HEADER_STRING); |
||
|
0 ignored issues
–
show
|
|||
| 74 | // Set margins |
||
| 75 | $pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP + 10, PDF_MARGIN_RIGHT); |
||
|
0 ignored issues
–
show
|
|||
| 76 | // Set auto page breaks |
||
| 77 | $pdf->SetAutoPageBreak(true, PDF_MARGIN_BOTTOM); |
||
|
0 ignored issues
–
show
|
|||
| 78 | $pdf->SetHeaderMargin(PDF_MARGIN_HEADER); |
||
|
0 ignored issues
–
show
|
|||
| 79 | $pdf->SetFooterMargin(PDF_MARGIN_FOOTER); |
||
|
0 ignored issues
–
show
|
|||
| 80 | $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); //set image scale factor |
||
|
0 ignored issues
–
show
|
|||
| 81 | if (_LANGCODE == 'cn') { |
||
|
0 ignored issues
–
show
|
|||
| 82 | $pdf->setHeaderFont(array('gbsn00lp', '', $pdfData['fontsize'])); |
||
| 83 | $pdf->setFooterFont(array('gbsn00lp', '', $pdfData['fontsize'])); |
||
| 84 | } else { |
||
| 85 | $pdf->setHeaderFont(array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); |
||
|
0 ignored issues
–
show
|
|||
| 86 | $pdf->setFooterFont(array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA)); |
||
|
0 ignored issues
–
show
|
|||
| 87 | } |
||
| 88 | // Set some language-dependent strings (optional) |
||
| 89 | $lang = XOOPS_ROOT_PATH.'/Frameworks/tcpdf/lang/eng.php'; |
||
| 90 | if (@file_exists($lang)) { |
||
| 91 | require_once $lang; |
||
| 92 | $pdf->setLanguageArray($lang); |
||
| 93 | } |
||
| 94 | // Initialize document |
||
| 95 | $pdf->AliasNbPages(); |
||
| 96 | // Add Page document |
||
| 97 | $pdf->AddPage(); |
||
| 98 | $pdf->writeHTMLCell($w=0, $h=0, $x='', $y='', $content, $border=0, $ln=1, $fill=0, $reseth=true, $align='', $autopadding=true); |
||
| 99 | // Pdf Filename |
||
| 100 | // Output |
||
| 101 | $GLOBALS['xoopsTpl']->assign('pdfoutput', $pdf->Output('testfields.pdf', 'I')); |
||
| 102 | $GLOBALS['xoopsTpl']->display('db:mymodule3_pdf.tpl'); |
||
| 103 |