Issues (1844)

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.

class/Reports/StaffInfoReport.php (1 issue)

Severity
1
<?php declare(strict_types=1);
2
3
namespace XoopsModules\Xhelp\Reports;
4
5
/*
6
 * You may not change or alter any portion of this comment or credits
7
 * of supporting developers from this source code or any supporting source code
8
 * which is considered copyrighted (c) material of the original comment or credit authors.
9
 *
10
 * This program is distributed in the hope that it will be useful,
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13
 */
14
15
/**
16
 * @copyright    {@link https://xoops.org/ XOOPS Project}
17
 * @license      {@link https://www.gnu.org/licenses/gpl-2.0.html GNU GPL 2 or later}
18
 * @author       Brian Wahoff <[email protected]>
19
 * @author       Eric Juden <[email protected]>
20
 * @author       XOOPS Development Team
21
 */
22
23
use XoopsModules\Xhelp;
24
use Amenadiel\JpGraph\Plot;
25
use Amenadiel\JpGraph\Graph;
26
27
//require_once \XHELP_JPGRAPH_PATH . '/jpgraph.php';
28
//require_once \XHELP_JPGRAPH_PATH . '/jpgraph_bar.php';
29
// require_once XHELP_CLASS_PATH . '/report.php';
30
Xhelp\Utility::includeReportLangFile('reports/staffInfo');
31
32
global $xoopsDB;
33
34
/**
35
 * class StaffInfoReport
36
 */
37
class StaffInfoReport extends Xhelp\Reports\Report
38
{
39
    /**
40
     * Xhelp\StaffInfoReport constructor.
41
     */
42
    public function __construct()
43
    {
44
        $this->initVar('results', \XOBJ_DTYPE_ARRAY, null, false);
45
        $this->initVar('hasResults', \XOBJ_DTYPE_INT, 0, false);
46
        $this->initVar('hasGraph', \XOBJ_DTYPE_INT, 1, false);
47
        /*
48
         if (PHP_VERSION >= 5) {      // Problems with JPGRAPH and php5 using bar graphs - Don't display for php5
49
         $this->setVar('hasGraph', 0);
50
         } else {
51
         $this->setVar('hasGraph', 1);
52
         }
53
         */
54
    }
55
56
    public $name       = 'staffInfoReport';
57
    public $meta       = [
58
        'name'        => \_XHELP_STAFF_INFO_NAME,
59
        'author'      => 'Eric Juden',
60
        'authorEmail' => '[email protected]',
61
        'description' => \_XHELP_STAFF_INFO_DESC,
62
        'version'     => '1.0',
63
        'dbFields'    => [
64
            'name'             => 'Name',
65
            'ticketsResponded' => 'Tickets Responded',
66
            'callsClosed'      => 'Calls Closed',
67
            'avgResponseTime'  => 'Average Response Time (in Minutes)',
68
        ],
69
    ];
70
    public $parameters = [];
71
    /*
72
     function generateReport()
73
     {
74
     if ($this->getVar('hasResults') == 0) {
75
     $this->setResults();
76
     }
77
     $aResults = $this->getVar('results');
78
79
     if (empty($aResults)) {       // If no records found
80
     $myReport = $this->generateReportNoData();
81
82
     return $myReport;
83
     }
84
85
     // Print graph
86
     $myReport = '';
87
     $myReport .= "<div id='xhelp_graph'>";
88
     $myReport .= "<img src='".XHELP_BASE_URL."/report.php?op=graph&name=staffInfo' align='center' width='500' height='300'>";
89
     $myReport .= "</div>";
90
91
     // Display report
92
     $myReport .= "<br>";
93
     $myReport .= "<div id='xhelp_report'>";
94
     $myReport .= "<table>";
95
     $myReport .= "<tr>";
96
     $dbFields = $this->meta['dbFields'];
97
     foreach ($dbFields as $dbField=>$field) {
98
     $myReport .= "<th>".$field."</th>";
99
     }
100
     $myReport .= "</tr>";
101
102
     foreach ($aResults as $result) {
103
     $myReport .= "<tr class='even'>";
104
     foreach ($dbFields as $dbField=>$field) {
105
     $myReport .= "<td>". $result[$dbField] ."</td>";
106
     }
107
     $myReport .= "</tr>";
108
     }
109
     $myReport .= "</table>";
110
     $myReport .= "</div>";
111
112
     return $myReport;
113
     }
114
     */
115
116
    /**
117
     * @return bool
118
     */
119
    public function generateGraph(): bool
120
    {
121
        if (0 == $this->getVar('hasGraph')) {
122
            return false;
123
        }
124
125
        if (0 == $this->getVar('hasResults')) {
126
            $this->setResults();
127
        }
128
        $aResults = $this->getVar('results');
129
130
        $graph = new Graph\Graph(500, 300);
131
        $graph->title->Set($this->meta['name']);
132
        $graph->setScale('textint');
133
        $graph->yaxis->scale->SetGrace(30);
134
135
        //$graph->ygrid->Show(true,true);
136
        $graph->ygrid->SetColor('gray', '[email protected]');
137
138
        // Setup graph colors
139
        $graph->SetMarginColor('white');
140
141
        $i    = 0;
0 ignored issues
show
The assignment to $i is dead and can be removed.
Loading history...
142
        $data = [];
143
        foreach ($aResults as $result) {
144
            $data[0][] = $result['name'];
145
            $data[1][] = $result['ticketsResponded'];
146
            $data[2][] = $result['callsClosed'];
147
            $data[3][] = $result['avgResponseTime'];
148
        }
149
150
        $datazero = [0, 0, 0, 0];
151
152
        // Create the "dummy" 0 bplot
153
        $bplotzero = new Plot\BarPlot($datazero);
154
155
        // Set names as x-axis label
156
        $graph->xaxis->SetTickLabels($data[0]);
157
158
        // Create the "Y" axis group
159
        foreach ($data as $d) {
160
            $ybplot1 = new Plot\BarPlot($d);
161
            $ybplot1->value->Show();
162
            $ybplot = new Plot\GroupBarPlot([$ybplot1, $bplotzero]);
163
164
            $graph->Add($ybplot);
165
        }
166
167
        // Set graph background image
168
        $graph->SetBackgroundImage(\XHELP_IMAGE_PATH . '/graph_bg.jpg', BGIMG_FILLFRAME);
169
170
        $graph->Stroke();
171
        return true;
172
    }
173
174
    /**
175
     * @return bool
176
     */
177
    public function setResults(): bool
178
    {
179
        global $xoopsDB;
180
        $sSQL = \sprintf(
181
            'SELECT DISTINCT s.ticketsResponded, s.callsClosed, s.email, u.name, s.responseTime / s.ticketsResponded / 60 AS avgResponseTime FROM `%s` s, %s u, %s t WHERE (s.uid = u.uid) AND (s.uid = t.ownership) AND (s.uid = t.closedBy) %s',
182
            $xoopsDB->prefix('xhelp_staff'),
183
            $xoopsDB->prefix('users'),
184
            $xoopsDB->prefix('xhelp_tickets'),
185
            $this->extraWhere
186
        );
187
188
        $result   = $xoopsDB->query($sSQL);
189
        $aResults = $this->arrayFromData($result);
190
191
        $this->setVar('results', \serialize($aResults));
192
        $this->setVar('hasResults', 1);
193
194
        return true;
195
    }
196
197
    /**
198
     * @return void
199
     */
200
    //    public function getParams()
201
    //    {
202
    //    }
203
}
204