Issues (964)

Security Analysis    not enabled

This project does not seem to handle request data directly as such no vulnerable execution paths were found.

  File Inclusion
File Inclusion enables an attacker to inject custom files into PHP's file loading mechanism, either explicitly passed to include, or for example via PHP's auto-loading mechanism.
  Regex Injection
Regex Injection enables an attacker to execute arbitrary code in your PHP process.
  SQL Injection
SQL Injection enables an attacker to execute arbitrary SQL code on your database server gaining access to user data, or manipulating user data.
  Response Splitting
Response Splitting can be used to send arbitrary responses.
  File Manipulation
File Manipulation enables an attacker to write custom data to files. This potentially leads to injection of arbitrary code on the server.
  Object Injection
Object Injection enables an attacker to inject an object into PHP code, and can lead to arbitrary code execution, file exposure, or file manipulation attacks.
  File Exposure
File Exposure allows an attacker to gain access to local files that he should not be able to access. These files can for example include database credentials, or other configuration files.
  XML Injection
XML Injection enables an attacker to read files on your local filesystem including configuration files, or can be abused to freeze your web-server process.
  Code Injection
Code Injection enables an attacker to execute arbitrary code on the server.
  Variable Injection
Variable Injection enables an attacker to overwrite program variables with custom data, and can lead to further vulnerabilities.
  XPath Injection
XPath Injection enables an attacker to modify the parts of XML document that are read. If that XML document is for example used for authentication, this can lead to further vulnerabilities similar to SQL Injection.
  Other Vulnerability
This category comprises other attack vectors such as manipulating the PHP runtime, loading custom extensions, freezing the runtime, or similar.
  Command Injection
Command Injection enables an attacker to inject a shell command that is execute with the privileges of the web-server. This can be used to expose sensitive data, or gain access of your server.
  LDAP Injection
LDAP Injection enables an attacker to inject LDAP statements potentially granting permission to run unauthorized queries, or modify content inside the LDAP tree.
  Cross-Site Scripting
Cross-Site Scripting enables an attacker to inject code into the response of a web-request that is viewed by other users. It can for example be used to bypass access controls, or even to take over other users' accounts.
  Header Injection
Unfortunately, the security analysis is currently not available for your project. If you are a non-commercial open-source project, please contact support to gain access.

testdata/mymodule/pdf.php (19 issues)

Labels
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
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. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
The constant PDF_UNIT was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
The constant PDF_PAGE_ORIENTATION was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
The constant PDF_PAGE_FORMAT was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
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
The condition _LANGCODE == 'cn' is always false.
Loading history...
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
The constant PDF_HEADER_LOGO_WIDTH was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
The constant PDF_HEADER_LOGO was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
75
// Set margins
76
$pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP + 10, PDF_MARGIN_RIGHT);
0 ignored issues
show
The constant PDF_MARGIN_LEFT was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
The constant PDF_MARGIN_TOP was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
The constant PDF_MARGIN_RIGHT was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
77
// Set auto page breaks
78
$pdf->SetAutoPageBreak(true, PDF_MARGIN_BOTTOM);
0 ignored issues
show
The constant PDF_MARGIN_BOTTOM was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
79
$pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
0 ignored issues
show
The constant PDF_MARGIN_HEADER was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
80
$pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
0 ignored issues
show
The constant PDF_MARGIN_FOOTER was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
81
$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); //set image scale factor
0 ignored issues
show
The constant PDF_IMAGE_SCALE_RATIO was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
82
if(_LANGCODE == 'cn') {
0 ignored issues
show
The condition _LANGCODE == 'cn' is always false.
Loading history...
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
The constant PDF_FONT_NAME_MAIN was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
The constant PDF_FONT_SIZE_MAIN was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
87
	$pdf->setFooterFont(array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
0 ignored issues
show
The constant PDF_FONT_NAME_DATA was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
The constant PDF_FONT_SIZE_DATA was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
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