XoopsModules25x /
oledrion
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 | * oledrion |
||
| 14 | * |
||
| 15 | * @copyright {@link https://xoops.org/ XOOPS Project} |
||
| 16 | * @license {@link http://www.fsf.org/copyleft/gpl.html GNU public license} |
||
| 17 | * @author Hervé Thouzard (http://www.herve-thouzard.com/) |
||
| 18 | * |
||
| 19 | * /** |
||
| 20 | * Impression du catalogue au format PDF |
||
| 21 | */ |
||
| 22 | |||
| 23 | use XoopsModules\Oledrion; |
||
| 24 | |||
| 25 | //use tecnickcom\TCPDF; |
||
| 26 | require_once dirname(dirname(__DIR__)) . '/mainfile.php'; |
||
| 27 | require_once XOOPS_ROOT_PATH . '/modules/oledrion/include/common.php'; |
||
| 28 | |||
| 29 | if (!is_file(XOOPS_ROOT_PATH . '/class/libraries/vendor/tecnickcom/tcpdf/tcpdf.php')) { |
||
| 30 | redirect_header(XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/viewtopic.php?topic_id=' . $topic_id, 3, 'TCPDF for Xoops not installed'); |
||
| 31 | } |
||
| 32 | |||
| 33 | error_reporting(0); |
||
| 34 | @$xoopsLogger->activated = false; |
||
| 35 | |||
| 36 | if (1 != Oledrion\Utility::getModuleOption('pdf_catalog')) { |
||
| 37 | die(); |
||
| 38 | } |
||
| 39 | |||
| 40 | require_once XOOPS_ROOT_PATH . '/class/template.php'; |
||
| 41 | $details = \Xmf\Request::getInt('catalogFormat', 0, 'POST'); |
||
| 42 | $Tpl = new \XoopsTpl(); |
||
| 43 | $vatArray = $tbl_categories = []; |
||
| 44 | $vatArray = $vatHandler->getAllVats(new Oledrion\Parameters()); |
||
| 45 | $tbl_categories = $categoryHandler->getAllCategories(new Oledrion\Parameters()); |
||
| 46 | $Tpl->assign('mod_pref', $mod_pref); // module preferences |
||
| 47 | |||
| 48 | $cat_cid = 0; |
||
| 49 | $tbl_tmp = []; |
||
| 50 | $products = []; |
||
| 51 | $products = $productsHandler->getRecentProducts(new Oledrion\Parameters(['start' => 0, 'limit' => 0, 'category' => $cat_cid])); |
||
| 52 | |||
| 53 | if (count($products) > 0) { |
||
| 54 | $helper->loadLanguage('modinfo'); |
||
| 55 | $Tpl->assign('details', $details); |
||
| 56 | $tblAuthors = $tbl_tmp = $tblManufacturersPerProduct = []; |
||
| 57 | $tblAuthors = $productsmanuHandler->getObjects(new \Criteria('pm_product_id', '(' . implode(',', array_keys($products)) . ')', 'IN'), true); |
||
| 58 | foreach ($tblAuthors as $item) { |
||
| 59 | $tbl_tmp[] = $item->getVar('pm_manu_id'); |
||
| 60 | $tblManufacturersPerProduct[$item->getVar('pm_product_id')][] = $item; |
||
| 61 | } |
||
| 62 | $tbl_tmp = array_unique($tbl_tmp); |
||
| 63 | $tblAuthors = $manufacturerHandler->getObjects(new \Criteria('manu_id', '(' . implode(',', $tbl_tmp) . ')', 'IN'), true); |
||
| 64 | foreach ($products as $item) { |
||
| 65 | $tbl_tmp = []; |
||
| 66 | $tbl_tmp = $item->toArray(); |
||
| 67 | $tbl_tmp['product_category'] = isset($tbl_categories[$item->getVar('product_cid')]) ? $tbl_categories[$item->getVar('product_cid')]->toArray() : null; |
||
| 68 | $tbl_tmp['product_price_ttc'] = Oledrion\Utility::getTTC($item->getVar('product_price'), $vatArray[$item->getVar('product_vat_id')]->getVar('vat_rate'), false, 's'); |
||
| 69 | $tbl_tmp['product_discount_price_ttc'] = Oledrion\Utility::getTTC($item->getVar('product_discount_price'), $vatArray[$item->getVar('product_vat_id')]->getVar('vat_rate'), false, 's'); |
||
| 70 | $tbl_join = []; |
||
| 71 | foreach ($tblManufacturersPerProduct[$item->getVar('product_id')] as $author) { |
||
| 72 | $auteur = $tblAuthors[$author->getVar('pm_manu_id')]; |
||
| 73 | $tbl_join[] = $auteur->getVar('manu_commercialname') . ' ' . $auteur->getVar('manu_name'); |
||
| 74 | } |
||
| 75 | if (count($tbl_join) > 0) { |
||
| 76 | $tbl_tmp['product_joined_manufacturers'] = implode(', ', $tbl_join); |
||
| 77 | } |
||
| 78 | $Tpl->append('products', $tbl_tmp); |
||
| 79 | } |
||
| 80 | } |
||
| 81 | |||
| 82 | $content1 = utf8_encode($Tpl->fetch('db:oledrion_pdf_catalog.tpl')); |
||
| 83 | $content2 = ''; |
||
| 84 | if (Oledrion\Utility::getModuleOption('use_price')) { |
||
| 85 | $content2 = utf8_encode($Tpl->fetch('db:oledrion_purchaseorder.tpl')); |
||
| 86 | } |
||
| 87 | |||
| 88 | // **************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************** |
||
| 89 | // **************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************** |
||
| 90 | // **************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************** |
||
| 91 | |||
| 92 | $doc_title = _OLEDRION_CATALOG; |
||
| 93 | $doc_subject = _OLEDRION_CATALOG; |
||
| 94 | $doc_keywords = 'Instant Zero'; |
||
| 95 | |||
| 96 | //require_once OLEDRION_PATH.'pdf/config/lang/'._LANGCODE.'.php'; |
||
| 97 | //require_once OLEDRION_PATH.'pdf/tcpdf.php'; |
||
| 98 | require_once XOOPS_ROOT_PATH . '/class/libraries/vendor/tecnickcom/tcpdf/tcpdf.php'; |
||
| 99 | |||
| 100 | //create new PDF document (document units are set by default to millimeters) |
||
| 101 | $pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true); |
||
|
0 ignored issues
–
show
|
|||
| 102 | |||
| 103 | // set document information |
||
| 104 | $pdf->SetCreator(PDF_CREATOR); |
||
|
0 ignored issues
–
show
|
|||
| 105 | $pdf->SetAuthor(PDF_AUTHOR); |
||
|
0 ignored issues
–
show
|
|||
| 106 | $pdf->SetTitle($doc_title); |
||
| 107 | $pdf->SetSubject($doc_subject); |
||
| 108 | $pdf->SetKeywords($doc_keywords); |
||
| 109 | |||
| 110 | $firstLine = utf8_encode(Oledrion\Utility::getModuleName() . ' - ' . $xoopsConfig['sitename']); |
||
| 111 | $secondLine = OLEDRION_URL . ' - ' . formatTimestamp(time(), 'm'); |
||
| 112 | $pdf->setHeaderData('', '', $firstLine, $secondLine); |
||
| 113 | |||
| 114 | //set margins |
||
| 115 | $pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT); |
||
|
0 ignored issues
–
show
|
|||
| 116 | //set auto page breaks |
||
| 117 | $pdf->SetAutoPageBreak(true, PDF_MARGIN_BOTTOM); |
||
|
0 ignored issues
–
show
|
|||
| 118 | $pdf->setHeaderMargin(PDF_MARGIN_HEADER); |
||
|
0 ignored issues
–
show
|
|||
| 119 | $pdf->setFooterMargin(PDF_MARGIN_FOOTER); |
||
|
0 ignored issues
–
show
|
|||
| 120 | $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); //set image scale factor |
||
|
0 ignored issues
–
show
|
|||
| 121 | |||
| 122 | $pdf->setHeaderFont([PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN]); |
||
|
0 ignored issues
–
show
|
|||
| 123 | $pdf->setFooterFont([PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA]); |
||
|
0 ignored issues
–
show
|
|||
| 124 | |||
| 125 | $pdf->setLanguageArray($l); //set language items |
||
| 126 | |||
| 127 | //initialize document |
||
| 128 | //$pdf->AliasNbPages(); |
||
| 129 | $pdf->AddPage(); |
||
| 130 | $pdf->writeHTML($content1, true, 0); |
||
| 131 | if (Oledrion\Utility::getModuleOption('use_price')) { |
||
| 132 | $pdf->AddPage(); |
||
| 133 | $pdf->writeHTML($content2, true, 0); |
||
| 134 | } |
||
| 135 | $pdf->Output(); |
||
| 136 |
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