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 module for xoops |
||
| 14 | * |
||
| 15 | * @copyright 2020 XOOPS Project (https://xooops.org) |
||
| 16 | * @license GPL 2.0 or later |
||
| 17 | * @package mymodule |
||
| 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\Mymodule; |
||
| 25 | use XoopsModules\Mymodule\Constants; |
||
| 26 | |||
| 27 | require __DIR__ . '/header.php'; |
||
| 28 | $artId = Request::getInt('art_id'); |
||
| 29 | if(file_exists($tcpdf = XOOPS_ROOT_PATH.'/Frameworks/tcpdf/tcpdf.php')) { |
||
| 30 | require_once $tcpdf; |
||
| 31 | } else { |
||
| 32 | redirect_header('articles.php', 2, _MA_MYMODULE_NO_PDF_LIBRARY); |
||
| 33 | } |
||
| 34 | // Get Instance of Handler |
||
| 35 | $articlesHandler = $helper->getHandler('articles'); |
||
| 36 | $articles = $this->getVar('art_id'); |
||
| 37 | |||
| 38 | $pdfData['title'] = strip_tags($pdfContent->getVar('art_title')); |
||
| 39 | $pdfData['content'] = strip_tags($pdfContent->getVar('art_descr')); |
||
| 40 | $pdfData['date'] = formatTimeStamp($pdfContent->getVar('art_created'), 's'); |
||
| 41 | $pdfData['author'] = \XoopsUser::getUnameFromId($pdfContent->getVar('art_submitter')); |
||
| 42 | |||
| 43 | // Get Config |
||
| 44 | $pdfData['creator'] = $GLOBALS['xoopsConfig']['xoops_sitename']; |
||
| 45 | $pdfData['subject'] = $GLOBALS['xoopsConfig']['slogan']; |
||
| 46 | $pdfData['keywords'] = $GLOBALS['xoopsConfig']['keywords']; |
||
| 47 | // Defines |
||
| 48 | define('MYMODULE_CREATOR', $pdfData['creator']); |
||
| 49 | define('MYMODULE_AUTHOR', $pdfData['author']); |
||
| 50 | define('MYMODULE_HEADER_TITLE', $pdfData['title']); |
||
| 51 | define('MYMODULE_HEADER_STRING', $pdfData['subject']); |
||
| 52 | define('MYMODULE_HEADER_LOGO', 'logo.gif'); |
||
| 53 | define('MYMODULE_IMAGES_PATH', XOOPS_ROOT_PATH.'/images/'); |
||
| 54 | $myts = MyTextSanitizer::getInstance(); |
||
| 55 | $content = ''; |
||
| 56 | $content .= $myts->undoHtmlSpecialChars($pdfData['content']); |
||
| 57 | $content = $myts->displayTarea($content); |
||
| 58 | $pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, _CHARSET, false); |
||
|
0 ignored issues
–
show
|
|||
| 59 | $title = $myts->undoHtmlSpecialChars($pdfData['title']); |
||
| 60 | $keywords = $myts->undoHtmlSpecialChars($pdfData['keywords']); |
||
| 61 | $pdfData['fontsize'] = 12; |
||
| 62 | // For schinese |
||
| 63 | if(_LANGCODE == 'cn') { |
||
|
0 ignored issues
–
show
|
|||
| 64 | $pdf->SetFont('gbsn00lp', '', $pdfData['fontsize']); |
||
| 65 | } else { |
||
| 66 | $pdf->SetFont($pdfData['fontname'], '', $pdfData['fontsize']); |
||
| 67 | } |
||
| 68 | // Set document information |
||
| 69 | $pdf->SetCreator($pdfData['creator']); |
||
| 70 | $pdf->SetAuthor($pdfData['author']); |
||
| 71 | $pdf->SetTitle($title); |
||
| 72 | $pdf->SetKeywords($keywords); |
||
| 73 | // Set default header data |
||
| 74 | $pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, MYMODULE_HEADER_TITLE, MYMODULE_HEADER_STRING); |
||
|
0 ignored issues
–
show
|
|||
| 75 | // Set margins |
||
| 76 | $pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP + 10, PDF_MARGIN_RIGHT); |
||
|
0 ignored issues
–
show
|
|||
| 77 | // Set auto page breaks |
||
| 78 | $pdf->SetAutoPageBreak(true, PDF_MARGIN_BOTTOM); |
||
|
0 ignored issues
–
show
|
|||
| 79 | $pdf->SetHeaderMargin(PDF_MARGIN_HEADER); |
||
|
0 ignored issues
–
show
|
|||
| 80 | $pdf->SetFooterMargin(PDF_MARGIN_FOOTER); |
||
|
0 ignored issues
–
show
|
|||
| 81 | $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); //set image scale factor |
||
|
0 ignored issues
–
show
|
|||
| 82 | if(_LANGCODE == 'cn') { |
||
|
0 ignored issues
–
show
|
|||
| 83 | $pdf->setHeaderFont(array('gbsn00lp', '', $pdfData['fontsize'])); |
||
| 84 | $pdf->setFooterFont(array('gbsn00lp', '', $pdfData['fontsize'])); |
||
| 85 | } else { |
||
| 86 | $pdf->setHeaderFont(array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); |
||
|
0 ignored issues
–
show
|
|||
| 87 | $pdf->setFooterFont(array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA)); |
||
|
0 ignored issues
–
show
|
|||
| 88 | } |
||
| 89 | // Set some language-dependent strings (optional) |
||
| 90 | if(@file_exists($lang = XOOPS_ROOT_PATH.'/Frameworks/tcpdf/lang/eng.php')) { |
||
| 91 | require_once $lang . '/.php'; |
||
| 92 | $pdf->setLanguageArray($l); |
||
| 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('articles.pdf', 'I')); |
||
| 102 | $GLOBALS['xoopsTpl']->display('db:mymodule_pdf.tpl'); |
||
| 103 |
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.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths