Passed
Push — master ( b847d6...d6d54c )
by Michael
09:34 queued 05:00
created

pedigree2.php (1 issue)

Severity
1
<?php
2
// -------------------------------------------------------------------------
3
4
//require_once  dirname(dirname(__DIR__)) . '/mainfile.php';
5
require_once __DIR__ . '/header.php';
6
7
$moduleDirName = basename(__DIR__);
8
xoops_loadLanguage('main', $moduleDirName);
9
10
// Include any common code for this module.
11
require_once XOOPS_ROOT_PATH . '/modules/' . $moduleDirName . '/include/common.php';
12
13
// Get all HTTP post or get parameters into global variables that are prefixed with "param_"
14
//import_request_variables("gp", "param_");
15
extract($_GET, EXTR_PREFIX_ALL, 'param');
16
extract($_POST, EXTR_PREFIX_ALL, 'param');
17
18
// This page uses smarty templates. Set "$xoopsOption['template_main']" before including header
19
$GLOBALS['xoopsOption']['template_main'] = 'pedigree_pedigree.tpl';
20
21
include $GLOBALS['xoops']->path('/header.php');
22
23
//always start with Anika
24
if (!$pedid) {
25
    $pedid = '3';
26
}
27
//draw pedigree
28
pedigree_main($pedid);
0 ignored issues
show
The call to pedigree_main() has too many arguments starting with $pedid. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

28
/** @scrutinizer ignore-call */ 
29
pedigree_main($pedid);

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress. Please note the @ignore annotation hint above.

Loading history...
29
30
//comments and footer
31
include XOOPS_ROOT_PATH . '/footer.php';
32
33
//
34
// Displays the "Main" tab of the module
35
//
36
/**
37
 * @param $ID
38
 */
39
function pedigree_main($ID)
40
{
41
    global $xoopsTpl;
42
    global $xoopsModuleConfig;
43
44
    if (isset($_POST['detail'])) {
45
        $detail = trim($_POST['detail']);
46
    }
47
48
    $queryString = '
49
    SELECT d.id as d_id,
50
    d.naam as d_naam,
51
    d.id_owner as d_id_owner,
52
    d.id_breeder as d_id_breeder,
53
    d.roft as d_roft,
54
    d.kleur as d_kleur,
55
    d.mother as d_mother,
56
    d.father as d_father,
57
    d.geboortedatum as d_geboortedatum,
58
    d.overleden as d_overleden,
59
    d.boek as d_boek,
60
    d.nhsb as d_nhsb,
61
    d.foto as d_foto,
62
    d.overig as d_overig,
63
    d.hd as d_hd,
64
    f.id as f_id,
65
    f.naam as f_naam,
66
    f.mother as f_mother,
67
    f.father as f_father,
68
    f.foto as f_foto,
69
    f.hd as f_hd,
70
    m.id as m_id,
71
    m.naam as m_naam,
72
    m.mother as m_mother,
73
    m.father as m_father,
74
    m.foto as m_foto,
75
    m.hd as m_hd,
76
    ff.id as ff_id,
77
    ff.naam as ff_naam,
78
    ff.roft as ff_roft,
79
    ff.mother as ff_mother,
80
    ff.father as ff_father,
81
    ff.foto as ff_foto,
82
    ff.hd as ff_hd,
83
    mf.id as mf_id,
84
    mf.naam as mf_naam,
85
    mf.mother as mf_mother,
86
    mf.father as mf_father,
87
    mf.nhsb as mf_nhsb,
88
    mf.foto as mf_foto,
89
    mf.hd as mf_hd,
90
    fm.id as fm_id,
91
    fm.naam as fm_naam,
92
    fm.mother as fm_mother,
93
    fm.father as fm_father,
94
    fm.nhsb as fm_nhsb,
95
    fm.foto as fm_foto,
96
    fm.hd as fm_hd,
97
    mm.id as mm_id,
98
    mm.naam as mm_naam,
99
    mm.kleur as mm_kleur,
100
    mm.mother as mm_mother,
101
    mm.father as mm_father,
102
    mm.nhsb as mm_nhsb,
103
    mm.foto as mm_foto,
104
    mm.hd as mm_hd,
105
    fff.id as fff_id,
106
    fff.naam as fff_naam,
107
    fff.kleur as fff_kleur,
108
    fff.nhsb as fff_nhsb,
109
    fff.foto as fff_foto,
110
    fff.hd as fff_hd,
111
    ffm.id as ffm_id,
112
    ffm.naam as ffm_naam,
113
    ffm.kleur as ffm_kleur,
114
    ffm.nhsb as ffm_nhsb,
115
    ffm.foto as ffm_foto,
116
    ffm.hd as ffm_hd,
117
    fmf.id as fmf_id,
118
    fmf.naam as fmf_naam,
119
    fmf.kleur as fmf_kleur,
120
    fmf.nhsb as fmf_nhsb,
121
    fmf.foto as fmf_foto,
122
    fmf.hd as fmf_hd,
123
    fmm.id as fmm_id,
124
    fmm.naam as fmm_naam,
125
    fmm.kleur as fmm_kleur,
126
    fmm.nhsb as fmm_nhsb,
127
    fmm.foto as fmm_foto,
128
    fmm.hd as fmm_hd,
129
    mmf.id as mmf_id,
130
    mmf.naam as mmf_naam,
131
    mmf.kleur as mmf_kleur,
132
    mmf.nhsb as mmf_nhsb,
133
    mmf.foto as mmf_foto,
134
    mmf.hd as mmf_hd,
135
    mff.id as mff_id,
136
    mff.naam as mff_naam,
137
    mff.kleur as mff_kleur,
138
    mff.nhsb as mff_nhsb,
139
    mff.foto as mff_foto,
140
    mff.hd as mff_hd,
141
    mfm.id as mfm_id,
142
    mfm.naam as mfm_naam,
143
    mfm.kleur as mfm_kleur,
144
    mfm.nhsb as mfm_nhsb,
145
    mfm.foto as mfm_foto,
146
    mfm.hd as mfm_hd,
147
    mmm.id as mmm_id,
148
    mmm.naam as mmm_naam,
149
    mmm.kleur as mmm_kleur,
150
    mmm.nhsb as mmm_nhsb,
151
    mmm.foto as mmm_foto,
152
    mmm.hd as mmm_hd
153
    FROM ' . $GLOBALS['xoopsDB']->prefix('pedigree_tree') . " d
154
    LEFT JOIN xoops_pedigree f ON d.father = f.id
155
    LEFT JOIN xoops_pedigree m ON d.mother = m.id
156
    LEFT JOIN xoops_pedigree ff ON f.father = ff.id
157
    LEFT JOIN xoops_pedigree fff ON ff.father = fff.id
158
    LEFT JOIN xoops_pedigree ffm ON ff.mother = ffm.id
159
    LEFT JOIN xoops_pedigree mf ON m.father = mf.id
160
    LEFT JOIN xoops_pedigree mff ON mf.father = mff.id
161
    LEFT JOIN xoops_pedigree mfm ON mf.mother = mfm.id
162
    LEFT JOIN xoops_pedigree fm ON f.mother = fm.id
163
    LEFT JOIN xoops_pedigree fmf ON fm.father = fmf.id
164
    LEFT JOIN xoops_pedigree fmm ON fm.mother = fmm.id
165
    LEFT JOIN xoops_pedigree mm ON m.mother = mm.id
166
    LEFT JOIN xoops_pedigree mmf ON mm.father = mmf.id
167
    LEFT JOIN xoops_pedigree mmm ON mm.mother = mmm.id
168
    where d.id=$ID";
169
170
    $result = $GLOBALS['xoopsDB']->query($queryString);
171
172
    //get module configuration
173
    /** @var XoopsModuleHandler $moduleHandler */
174
    $moduleHandler = xoops_getHandler('module');
175
    $module        = $moduleHandler->getByDirname($moduleDirName);
176
    $configHandler = xoops_getHandler('config');
177
    $moduleConfig  = $configHandler->getConfigsByCat(0, $module->getVar('mid'));
178
179
    $pic = $moduleConfig['pics'];
180
    $hd  = $moduleConfig['hd'];
181
    while (false !== ($row = $GLOBALS['xoopsDB']->fetchArray($result))) {
182
        //create array for dog (and all parents)
183
        //selected dog
184
        $d['d']['name']   = stripslashes($row['d_naam']);
185
        $d['d']['id']     = $row['d_id'];
186
        $d['d']['roft']   = $row['d_roft'];
187
        $d['d']['nhsb']   = $row['d_nhsb'];
188
        $d['d']['colour'] = $row['d_kleur'];
189
        if (1 == $pic) {
190
            $d['d']['photo'] = $row['d_foto'];
191
        }
192
        if (1 == $hd) {
193
            $d['d']['hd'] = hd($row['d_hd']);
194
        }
195
        //father
196
        $d['f']['name'] = stripslashes($row['f_naam']);
197
        $d['f']['id']   = $row['f_id'];
198
        if (1 == $pic) {
199
            $d['f']['photo'] = $row['f_foto'];
200
        }
201
        if (1 == $hd) {
202
            $d['f']['hd'] = hd($row['f_hd']);
203
        }
204
        //mother
205
        $d['m']['name'] = stripslashes($row['m_naam']);
206
        $d['m']['id']   = $row['m_id'];
207
        if (1 == $pic) {
208
            $d['m']['photo'] = $row['m_foto'];
209
        }
210
        if (1 == $hd) {
211
            $d['m']['hd'] = hd($row['m_hd']);
212
        }
213
        //grandparents
214
        //father father
215
        $d['ff']['name'] = stripslashes($row['ff_naam']);
216
        $d['ff']['id']   = $row['ff_id'];
217
        if (1 == $pic) {
218
            $d['ff']['photo'] = $row['ff_foto'];
219
        }
220
        if (1 == $hd) {
221
            $d['ff']['hd'] = hd($row['ff_hd']);
222
        }
223
        //father mother
224
        $d['fm']['name'] = stripslashes($row['fm_naam']);
225
        $d['fm']['id']   = $row['fm_id'];
226
        if (1 == $pic) {
227
            $d['fm']['photo'] = $row['fm_foto'];
228
        }
229
        if (1 == $hd) {
230
            $d['fm']['hd'] = hd($row['fm_hd']);
231
        }
232
        //mother father
233
        $d['mf']['name'] = stripslashes($row['mf_naam']);
234
        $d['mf']['id']   = $row['mf_id'];
235
        if (1 == $pic) {
236
            $d['mf']['photo'] = $row['mf_foto'];
237
        }
238
        if (1 == $hd) {
239
            $d['mf']['hd'] = hd($row['mf_hd']);
240
        }
241
        //mother mother
242
        $d['mm']['name'] = stripslashes($row['mm_naam']);
243
        $d['mm']['id']   = $row['mm_id'];
244
        if (1 == $pic) {
245
            $d['mm']['photo'] = $row['mm_foto'];
246
        }
247
        if (1 == $hd) {
248
            $d['mm']['hd'] = hd($row['mm_hd']);
249
        }
250
        //great-grandparents
251
        //father father father
252
        $d['fff']['name'] = stripslashes($row['fff_naam']);
253
        $d['fff']['id']   = $row['fff_id'];
254
        if (1 == $pic) {
255
            $d['fff']['photo'] = $row['fff_foto'];
256
        }
257
        if (1 == $hd) {
258
            $d['fff']['hd'] = hd($row['fff_hd']);
259
        }
260
        //father father mother
261
        $d['ffm']['name'] = stripslashes($row['ffm_naam']);
262
        $d['ffm']['id']   = $row['ffm_id'];
263
        if (1 == $pic) {
264
            $d['ffm']['photo'] = $row['ffm_foto'];
265
        }
266
        if (1 == $hd) {
267
            $d['ffm']['hd'] = hd($row['ffm_hd']);
268
        }
269
        //father mother father
270
        $d['fmf']['name'] = stripslashes($row['fmf_naam']);
271
        $d['fmf']['id']   = $row['fmf_id'];
272
        if (1 == $pic) {
273
            $d['fmf']['photo'] = $row['fmf_foto'];
274
        }
275
        if (1 == $hd) {
276
            $d['fmf']['hd'] = hd($row['fmf_hd']);
277
        }
278
        //father mother mother
279
        $d['fmm']['name'] = stripslashes($row['fmm_naam']);
280
        $d['fmm']['id']   = $row['fmm_id'];
281
        if (1 == $pic) {
282
            $d['fmm']['photo'] = $row['fmm_foto'];
283
        }
284
        if (1 == $hd) {
285
            $d['fmm']['hd'] = hd($row['fmm_hd']);
286
        }
287
        //mother father father
288
        $d['mff']['name'] = stripslashes($row['mff_naam']);
289
        $d['mff']['id']   = $row['mff_id'];
290
        if (1 == $pic) {
291
            $d['mff']['photo'] = $row['mff_foto'];
292
        }
293
        if (1 == $hd) {
294
            $d['mff']['hd'] = hd($row['mff_hd']);
295
        }
296
        //mother father mother
297
        $d['mfm']['name'] = stripslashes($row['mfm_naam']);
298
        $d['mfm']['id']   = $row['mfm_id'];
299
        if (1 == $pic) {
300
            $d['mfm']['photo'] = $row['mfm_foto'];
301
        }
302
        if (1 == $hd) {
303
            $d['mfm']['hd'] = hd($row['mfm_hd']);
304
        }
305
        //mother mother father
306
        $d['mmf']['name'] = stripslashes($row['mmf_naam']);
307
        $d['mmf']['id']   = $row['mmf_id'];
308
        if (1 == $pic) {
309
            $d['mmf']['photo'] = $row['mmf_foto'];
310
        }
311
        if (1 == $hd) {
312
            $d['mmf']['hd'] = hd($row['mmf_hd']);
313
        }
314
        //mother mother mother
315
        $d['mmm']['name'] = stripslashes($row['mmm_naam']);
316
        $d['mmm']['id']   = $row['mmm_id'];
317
        if (1 == $pic) {
318
            $d['mmm']['photo'] = $row['mmm_foto'];
319
        }
320
        if (1 == $hd) {
321
            $d['mmm']['hd'] = hd($row['mmm_hd']);
322
        }
323
    }
324
325
    //add data to smarty template
326
    $xoopsTpl->assign('page_title', stripslashes($row['d_naam']));
327
    //assign dog
328
    $xoopsTpl->assign('d', $d);
329
    //assign config options
330
    $ov = $moduleConfig['overview'];
331
    $xoopsTpl->assign('overview', $ov);
332
    $sign = $moduleConfig['gender'];
333
    if (1 == $sign) {
334
        $xoopsTpl->assign('male', '<img src="assets/images/male.gif">');
335
        $xoopsTpl->assign('female', '<img src="assets/images/female.gif">');
336
    }
337
    $addit = $moduleConfig['adinfo'];
338
    if (1 == $addit) {
339
        $xoopsTpl->assign('addinfo', '1');
340
    }
341
    $xoopsTpl->assign('pics', $pic);
342
    //assign extra display options
343
    $xoopsTpl->assign('unknown', 'Unknown');
344
    $xoopsTpl->assign('SD', _MA_PEDIGREE_SD);
345
    $xoopsTpl->assign('PA', _MA_PEDIGREE_PA);
346
    $xoopsTpl->assign('GP', _MA_PEDIGREE_GP);
347
    $xoopsTpl->assign('GGP', _MA_PEDIGREE_GGP);
348
}
349