Issues (807)

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.

mpedigree.php (1 issue)

Labels
Severity
1
<?php
2
/*
3
 You may not change or alter any portion of this comment or credits of
4
 supporting developers from this source code or any supporting source code
5
 which is considered copyrighted (c) material of the original comment or credit
6
 authors.
7
8
 This program is distributed in the hope that it will be useful, but
9
 WITHOUT ANY WARRANTY; without even the implied warranty of
10
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
11
 */
12
13
/**
14
 * Module: Pedigree
15
 *
16
 * @package   XoopsModules\Pedigree
17
 * @author    XOOPS Module Development Team
18
 * @copyright Copyright (c) 2001-2019 {@link https://xoops.org XOOPS Project}
19
 * @license   https://www.gnu.org/licenses/gpl-2.0.html GNU Public License
20
 */
21
22
use Xmf\Request;
23
use XoopsModules\Pedigree\{
24
    Helper
25
};
26
/** @var Helper $helper */
27
28
//require_once  \dirname(__DIR__, 2) . '/mainfile.php';
29
require_once __DIR__ . '/header.php';
30
31
32
$helper = Helper::getInstance();
33
34
$moduleDirName = basename(__DIR__);
35
$helper->loadLanguage('main');
36
37
// Include any common code for this module.
38
require_once XOOPS_ROOT_PATH . '/modules/' . $moduleDirName . '/include/common.php';
39
40
$GLOBALS['xoopsOption']['template_main'] = 'pedigree_mpedigree.tpl';
41
42
require $GLOBALS['xoops']->path('/header.php');
43
44
//get module configuration
45
/** @var \XoopsModuleHandler $moduleHandler */
46
$moduleHandler = xoops_getHandler('module');
47
$module        = $moduleHandler->getByDirname($moduleDirName);
48
/** @var \XoopsConfigHandler $configHandler */
49
$configHandler = xoops_getHandler('config');
50
$moduleConfig  = $configHandler->getConfigsByCat(0, $module->getVar('mid'));
51
52
//always start with Anika
53
$pedId = Request::getInt('pedid', 0, 'GET');
54
//$pedId = $_GET['pedid'];
55
//draw pedigree
56
57
$sql = '
58
SELECT d.id as d_id,
59
d.pname as d_pname,
60
d.roft as d_roft,
61
f.id as f_id,
62
f.pname as f_pname,
63
m.id as m_id,
64
m.pname as m_pname,
65
ff.id as ff_id,
66
ff.pname as ff_pname,
67
mf.id as mf_id,
68
mf.pname as mf_pname,
69
fm.id as fm_id,
70
fm.pname as fm_pname,
71
mm.id as mm_id,
72
mm.pname as mm_pname,
73
fff.id as fff_id,
74
fff.pname as fff_pname,
75
ffm.id as ffm_id,
76
ffm.pname as ffm_pname,
77
fmf.id as fmf_id,
78
fmf.pname as fmf_pname,
79
fmm.id as fmm_id,
80
fmm.pname as fmm_pname,
81
mmf.id as mmf_id,
82
mmf.pname as mmf_pname,
83
mff.id as mff_id,
84
mff.pname as mff_pname,
85
mfm.id as mfm_id,
86
mfm.pname as mfm_pname,
87
mmm.id as mmm_id,
88
mmm.pname as mmm_pname,
89
ffff.id as ffff_id,
90
ffff.pname as ffff_pname,
91
ffmf.id as ffmf_id,
92
ffmf.pname as ffmf_pname,
93
fmff.id as fmff_id,
94
fmff.pname as fmff_pname,
95
fmmf.id as fmmf_id,
96
fmmf.pname as fmmf_pname,
97
mmff.id as mmff_id,
98
mmff.pname as mmff_pname,
99
mfff.id as mfff_id,
100
mfff.pname as mfff_pname,
101
mfmf.id as mfmf_id,
102
mfmf.pname as mfmf_pname,
103
mmmf.id as mmmf_id,
104
mmmf.pname as mmmf_pname,
105
fffm.id as fffm_id,
106
fffm.pname as fffm_pname,
107
ffmm.id as ffmm_id,
108
ffmm.pname as ffmm_pname,
109
fmfm.id as fmfm_id,
110
fmfm.pname as fmfm_pname,
111
fmmm.id as fmmm_id,
112
fmmm.pname as fmmm_pname,
113
mmfm.id as mmfm_id,
114
mmfm.pname as mmfm_pname,
115
mffm.id as mffm_id,
116
mffm.pname as mffm_pname,
117
mfmm.id as mfmm_id,
118
mfmm.pname as mfmm_pname,
119
mmmm.id as mmmm_id,
120
mmmm.pname as mmmm_pname
121
    FROM ' . $GLOBALS['xoopsDB']->prefix('pedigree_registry') . ' d
122
LEFT JOIN ' . $GLOBALS['xoopsDB']->prefix('pedigree_registry') . ' f ON d.father = f.id
123
LEFT JOIN ' . $GLOBALS['xoopsDB']->prefix('pedigree_registry') . ' m ON d.mother = m.id
124
LEFT JOIN ' . $GLOBALS['xoopsDB']->prefix('pedigree_registry') . ' ff ON f.father = ff.id
125
LEFT JOIN ' . $GLOBALS['xoopsDB']->prefix('pedigree_registry') . ' fff ON ff.father = fff.id
126
LEFT JOIN ' . $GLOBALS['xoopsDB']->prefix('pedigree_registry') . ' ffm ON ff.mother = ffm.id
127
LEFT JOIN ' . $GLOBALS['xoopsDB']->prefix('pedigree_registry') . ' mf ON m.father = mf.id
128
LEFT JOIN ' . $GLOBALS['xoopsDB']->prefix('pedigree_registry') . ' mff ON mf.father = mff.id
129
LEFT JOIN ' . $GLOBALS['xoopsDB']->prefix('pedigree_registry') . ' mfm ON mf.mother = mfm.id
130
LEFT JOIN ' . $GLOBALS['xoopsDB']->prefix('pedigree_registry') . ' fm ON f.mother = fm.id
131
LEFT JOIN ' . $GLOBALS['xoopsDB']->prefix('pedigree_registry') . ' fmf ON fm.father = fmf.id
132
LEFT JOIN ' . $GLOBALS['xoopsDB']->prefix('pedigree_registry') . ' fmm ON fm.mother = fmm.id
133
LEFT JOIN ' . $GLOBALS['xoopsDB']->prefix('pedigree_registry') . ' mm ON m.mother = mm.id
134
LEFT JOIN ' . $GLOBALS['xoopsDB']->prefix('pedigree_registry') . ' mmf ON mm.father = mmf.id
135
LEFT JOIN ' . $GLOBALS['xoopsDB']->prefix('pedigree_registry') . ' mmm ON mm.mother = mmm.id
136
LEFT JOIN ' . $GLOBALS['xoopsDB']->prefix('pedigree_registry') . ' ffff ON fff.father = ffff.id
137
LEFT JOIN ' . $GLOBALS['xoopsDB']->prefix('pedigree_registry') . ' ffmf ON ffm.father = ffmf.id
138
LEFT JOIN ' . $GLOBALS['xoopsDB']->prefix('pedigree_registry') . ' fmff ON fmf.father = fmff.id
139
LEFT JOIN ' . $GLOBALS['xoopsDB']->prefix('pedigree_registry') . ' fmmf ON fmm.father = fmmf.id
140
LEFT JOIN ' . $GLOBALS['xoopsDB']->prefix('pedigree_registry') . ' mmff ON mmf.father = mmff.id
141
LEFT JOIN ' . $GLOBALS['xoopsDB']->prefix('pedigree_registry') . ' mfff ON mff.father = mfff.id
142
LEFT JOIN ' . $GLOBALS['xoopsDB']->prefix('pedigree_registry') . ' mfmf ON mfm.father = mfmf.id
143
LEFT JOIN ' . $GLOBALS['xoopsDB']->prefix('pedigree_registry') . ' mmmf ON mmm.father = mmmf.id
144
LEFT JOIN ' . $GLOBALS['xoopsDB']->prefix('pedigree_registry') . ' fffm ON fff.mother = fffm.id
145
LEFT JOIN ' . $GLOBALS['xoopsDB']->prefix('pedigree_registry') . ' ffmm ON ffm.mother = ffmm.id
146
LEFT JOIN ' . $GLOBALS['xoopsDB']->prefix('pedigree_registry') . ' fmfm ON fmf.mother = fmfm.id
147
LEFT JOIN ' . $GLOBALS['xoopsDB']->prefix('pedigree_registry') . ' fmmm ON fmm.mother = fmmm.id
148
LEFT JOIN ' . $GLOBALS['xoopsDB']->prefix('pedigree_registry') . ' mmfm ON mmf.mother = mmfm.id
149
LEFT JOIN ' . $GLOBALS['xoopsDB']->prefix('pedigree_registry') . ' mffm ON mff.mother = mffm.id
150
LEFT JOIN ' . $GLOBALS['xoopsDB']->prefix('pedigree_registry') . ' mfmm ON mfm.mother = mfmm.id
151
LEFT JOIN ' . $GLOBALS['xoopsDB']->prefix('pedigree_registry') . ' mmmm ON mmm.mother = mmmm.id
152
WHERE d.id=' . $pedId;
153
154
$result = $GLOBALS['xoopsDB']->query($sql);
155
156
while (false !== ($row = $GLOBALS['xoopsDB']->fetchArray($result))) {
157
    //crete array to count frequency (to select colour)
158
    count_item($freq, $row['d_id']);
159
    count_item($freq, $row['f_id']);
160
    count_item($freq, $row['m_id']);
161
    count_item($freq, $row['ff_id']);
162
    count_item($freq, $row['fm_id']);
163
    count_item($freq, $row['mf_id']);
164
    count_item($freq, $row['mm_id']);
165
    count_item($freq, $row['fff_id']);
166
    count_item($freq, $row['ffm_id']);
167
    count_item($freq, $row['fmf_id']);
168
    count_item($freq, $row['fmm_id']);
169
    count_item($freq, $row['mff_id']);
170
    count_item($freq, $row['mfm_id']);
171
    count_item($freq, $row['mmf_id']);
172
    count_item($freq, $row['mmm_id']);
173
    count_item($freq, $row['ffff_id']);
174
    count_item($freq, $row['ffmf_id']);
175
    count_item($freq, $row['fmff_id']);
176
    count_item($freq, $row['fmmf_id']);
177
    count_item($freq, $row['mfff_id']);
178
    count_item($freq, $row['mfmf_id']);
179
    count_item($freq, $row['mmff_id']);
180
    count_item($freq, $row['mmmf_id']);
181
    count_item($freq, $row['fffm_id']);
182
    count_item($freq, $row['ffmm_id']);
183
    count_item($freq, $row['fmfm_id']);
184
    count_item($freq, $row['fmmm_id']);
185
    count_item($freq, $row['mffm_id']);
186
    count_item($freq, $row['mfmm_id']);
187
    count_item($freq, $row['mmfm_id']);
188
    count_item($freq, $row['mmmm_id']);
189
190
    //create array for dog (and all parents)
191
    //selected dog
192
    $d['d']['name'] = stripslashes($row['d_pname']);
193
    $d['d']['id']   = $row['d_id'];
194
    $d['d']['roft'] = $row['d_roft'];
195
    $d['d']['col']  = 'transparant';
196
    //father
197
    $d['f']['name'] = stripslashes($row['f_pname']);
198
    $d['f']['id']   = $row['f_id'];
199
    $d['f']['col']  = crcolour('f', $freq[$row['f_id']]);
200
    //mother
201
    $d['m']['name'] = stripslashes($row['m_pname']);
202
    $d['m']['id']   = $row['m_id'];
203
    $d['m']['col']  = crcolour('m', $freq[$row['m_id']]);
204
    //grandparents
205
    //father father
206
    $d['ff']['name'] = stripslashes($row['ff_pname']);
207
    $d['ff']['id']   = $row['ff_id'];
208
    $d['ff']['col']  = crcolour('f', $freq[$row['ff_id']]);
209
    //father mother
210
    $d['fm']['name'] = stripslashes($row['fm_pname']);
211
    $d['fm']['id']   = $row['fm_id'];
212
    $d['fm']['col']  = crcolour('m', $freq[$row['fm_id']]);
213
    //mother father
214
    $d['mf']['name'] = stripslashes($row['mf_pname']);
215
    $d['mf']['id']   = $row['mf_id'];
216
    $d['mf']['col']  = crcolour('f', $freq[$row['mf_id']]);
217
    //mother mother
218
    $d['mm']['name'] = stripslashes($row['mm_pname']);
219
    $d['mm']['id']   = $row['mm_id'];
220
    $d['mm']['col']  = crcolour('m', $freq[$row['mm_id']]);
221
    //great-grandparents
222
    //father father father
223
    $d['fff']['name'] = stripslashes($row['fff_pname']);
224
    $d['fff']['id']   = $row['fff_id'];
225
    $d['fff']['col']  = crcolour('f', $freq[$row['fff_id']]);
226
    //father father mother
227
    $d['ffm']['name'] = stripslashes($row['ffm_pname']);
228
    $d['ffm']['id']   = $row['ffm_id'];
229
    $d['ffm']['col']  = crcolour('m', $freq[$row['ffm_id']]);
230
    //father mother father
231
    $d['fmf']['name'] = stripslashes($row['fmf_pname']);
232
    $d['fmf']['id']   = $row['fmf_id'];
233
    $d['fmf']['col']  = crcolour('f', $freq[$row['fmf_id']]);
234
    //father mother mother
235
    $d['fmm']['name'] = stripslashes($row['fmm_pname']);
236
    $d['fmm']['id']   = $row['fmm_id'];
237
    $d['fmm']['col']  = crcolour('m', $freq[$row['fmm_id']]);
238
    //mother father father
239
    $d['mff']['name'] = stripslashes($row['mff_pname']);
240
    $d['mff']['id']   = $row['mff_id'];
241
    $d['mff']['col']  = crcolour('f', $freq[$row['mff_id']]);
242
    //mother father mother
243
    $d['mfm']['name'] = stripslashes($row['mfm_pname']);
244
    $d['mfm']['id']   = $row['mfm_id'];
245
    $d['mfm']['col']  = crcolour('m', $freq[$row['mfm_id']]);
246
    //mother mother father
247
    $d['mmf']['name'] = stripslashes($row['mmf_pname']);
248
    $d['mmf']['id']   = $row['mmf_id'];
249
    $d['mmf']['col']  = crcolour('f', $freq[$row['mmf_id']]);
250
    //mother mother mother
251
    $d['mmm']['name'] = stripslashes($row['mmm_pname']);
252
    $d['mmm']['id']   = $row['mmm_id'];
253
    $d['mmm']['col']  = crcolour('m', $freq[$row['mmm_id']]);
254
    //great-great-grandparents (fathers)
255
    //father father father
256
    $d['ffff']['name'] = stripslashes($row['ffff_pname']);
257
    $d['ffff']['id']   = $row['ffff_id'];
258
    $d['ffff']['col']  = crcolour('f', $freq[$row['ffff_id']]);
259
    //father father mother
260
    $d['ffmf']['name'] = stripslashes($row['ffmf_pname']);
261
    $d['ffmf']['id']   = $row['ffmf_id'];
262
    $d['ffmf']['col']  = crcolour('f', $freq[$row['ffmf_id']]);
263
    //father mother father
264
    $d['fmff']['name'] = stripslashes($row['fmff_pname']);
265
    $d['fmff']['id']   = $row['fmff_id'];
266
    $d['fmff']['col']  = crcolour('f', $freq[$row['fmff_id']]);
267
    //father mother mother
268
    $d['fmmf']['name'] = stripslashes($row['fmmf_pname']);
269
    $d['fmmf']['id']   = $row['fmmf_id'];
270
    $d['fmmf']['col']  = crcolour('f', $freq[$row['fmmf_id']]);
271
    //mother father father
272
    $d['mfff']['name'] = stripslashes($row['mfff_pname']);
273
    $d['mfff']['id']   = $row['mfff_id'];
274
    $d['mfff']['col']  = crcolour('f', $freq[$row['mfff_id']]);
275
    //mother father mother
276
    $d['mfmf']['name'] = stripslashes($row['mfmf_pname']);
277
    $d['mfmf']['id']   = $row['mfmf_id'];
278
    $d['mfmf']['col']  = crcolour('f', $freq[$row['mfmf_id']]);
279
    //mother mother father
280
    $d['mmff']['name'] = stripslashes($row['mmff_pname']);
281
    $d['mmff']['id']   = $row['mmff_id'];
282
    $d['mmff']['col']  = crcolour('f', $freq[$row['mmff_id']]);
283
    //mother mother mother
284
    $d['mmmf']['name'] = stripslashes($row['mmmf_pname']);
285
    $d['mmmf']['id']   = $row['mmmf_id'];
286
    $d['mmmf']['col']  = crcolour('f', $freq[$row['mmmf_id']]);
287
    //great-great-grandparents (mothers)
288
    //father father father
289
    $d['fffm']['name'] = stripslashes($row['fffm_pname']);
290
    $d['fffm']['id']   = $row['fffm_id'];
291
    $d['fffm']['col']  = crcolour('m', $freq[$row['fffm_id']]);
292
    //father father mother
293
    $d['ffmm']['name'] = stripslashes($row['ffmm_pname']);
294
    $d['ffmm']['id']   = $row['ffmm_id'];
295
    $d['ffmm']['col']  = crcolour('m', $freq[$row['ffmm_id']]);
296
    //father mother father
297
    $d['fmfm']['name'] = stripslashes($row['fmfm_pname']);
298
    $d['fmfm']['id']   = $row['fmfm_id'];
299
    $d['fmfm']['col']  = crcolour('m', $freq[$row['fmfm_id']]);
300
    //father mother mother
301
    $d['fmmm']['name'] = stripslashes($row['fmmm_pname']);
302
    $d['fmmm']['id']   = $row['fmmm_id'];
303
    $d['fmmm']['col']  = crcolour('m', $freq[$row['fmmm_id']]);
304
    //mother father father
305
    $d['mffm']['name'] = stripslashes($row['mffm_pname']);
306
    $d['mffm']['id']   = $row['mffm_id'];
307
    $d['mffm']['col']  = crcolour('m', $freq[$row['mffm_id']]);
308
    //mother father mother
309
    $d['mfmm']['name'] = stripslashes($row['mfmm_pname']);
310
    $d['mfmm']['id']   = $row['mfmm_id'];
311
    $d['mfmm']['col']  = crcolour('m', $freq[$row['mfmm_id']]);
312
    //mother mother father
313
    $d['mmfm']['name'] = stripslashes($row['mmfm_pname']);
314
    $d['mmfm']['id']   = $row['mmfm_id'];
315
    $d['mmfm']['col']  = crcolour('m', $freq[$row['mmfm_id']]);
316
    //mother mother mother
317
    $d['mmmm']['name'] = stripslashes($row['mmmm_pname']);
318
    $d['mmmm']['id']   = $row['mmmm_id'];
319
    $d['mmmm']['col']  = crcolour('m', $freq[$row['mmmm_id']]);
320
}
321
322
//add data to smarty template
323
$GLOBALS['xoopsTpl']->assign('xoops_pagetitle', $d['d']['name'] . ' -- mega pedigree');
324
//assign dog(s)
325
$GLOBALS['xoopsTpl']->assign('d', $d);
326
$GLOBALS['xoopsTpl']->assign('male', "<img src=\"" . PEDIGREE_IMAGE_URL . "/male.gif\">");
0 ignored issues
show
The constant PEDIGREE_IMAGE_URL was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
327
$GLOBALS['xoopsTpl']->assign('female', "<img src=\"" . PEDIGREE_IMAGE_URL . "/female.gif\">");
328
//assign extra display options
329
$GLOBALS['xoopsTpl']->assign('unknown', 'Unknown');
330
$GLOBALS['xoopsTpl']->assign('f2', strtr(_MA_PEDIGREE_MPED_F2, ['[animalType]' => $helper->getConfig('animalType')]));
331
$GLOBALS['xoopsTpl']->assign('f3', strtr(_MA_PEDIGREE_MPED_F3, ['[animalType]' => $helper->getConfig('animalType')]));
332
$GLOBALS['xoopsTpl']->assign('f4', strtr(_MA_PEDIGREE_MPED_F4, ['[animalType]' => $helper->getConfig('animalType')]));
333
$GLOBALS['xoopsTpl']->assign('m2', strtr(_MA_PEDIGREE_MPED_M2, ['[animalType]' => $helper->getConfig('animalType')]));
334
$GLOBALS['xoopsTpl']->assign('m3', strtr(_MA_PEDIGREE_MPED_M3, ['[animalType]' => $helper->getConfig('animalType')]));
335
$GLOBALS['xoopsTpl']->assign('m4', strtr(_MA_PEDIGREE_MPED_M4, ['[animalType]' => $helper->getConfig('animalType')]));
336
337
/**
338
 * @param string $gender m|f
339
 * @param int    $item
340
 *
341
 * @return string
342
 * @todo move this to ./include directory
343
 */
344
function crcolour($gender, $item)
345
{
346
    switch ($item) {
347
        case '1':
348
        default:
349
            $col = 'transparent';
350
            break;
351
        case '2':
352
            $col = ('f' === $gender) ? '#C8C8FF' : '#FFC8C8';
353
            break;
354
        case '3':
355
            $col = ('f' === $gender) ? '#6464FF' : '#FF6464';
356
            break;
357
        case '4':
358
            $col = ('f' === $gender) ? '#0000FF' : '#FF0000';
359
            break;
360
    }
361
    /*
362
    if ('1' == $item) {
363
        $col = 'transparant';
364
    } elseif ('2' == $item && 'f' === $sex) {
365
        $col = '#C8C8FF';
366
    } elseif (3 == $item && 'f' === $sex) {
367
        $col = '#6464FF';
368
    } elseif ('4' == $item && 'f' === $sex) {
369
        $col = '#0000FF';
370
    } elseif ('2' == $item && 'm' === $sex) {
371
        $col = '#FFC8C8';
372
    } elseif ('3' == $item && 'm' === $sex) {
373
        $col = '#FF6464';
374
    } elseif ('4' == $item && 'm' === $sex) {
375
        $col = '#FF0000';
376
    } else {
377
        $col = 'transparant';
378
    }
379
    */
380
381
    return $col;
382
}
383
384
/**
385
 * @param     $freq
386
 * @param     $item
387
 * @param int $inc
388
 *
389
 * @return bool
390
 */
391
function count_item(&$freq, $item, $inc = 1)
392
{
393
    if (!is_array($freq)) {
394
        $freq = [];
395
    }
396
    $freq[$item] = (isset($freq[$item]) ? ($freq[$item] += $inc) : $inc);
397
398
    return true;
399
}
400