Completed
Branch master (923121)
by Michael
05:29 queued 02:40
created

classifiedstree::getFirstChildId()   B

Complexity

Conditions 5
Paths 6

Size

Total Lines 20
Code Lines 12

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 20
rs 8.8571
cc 5
eloc 12
nc 6
nop 1
1
<?php
2
/*
3
-------------------------------------------------------------------------
4
                     ADSLIGHT 2 : Module for Xoops
5
6
        Redesigned and ameliorate By Luc Bizet user at www.frxoops.org
7
        Started with the Classifieds module and made MANY changes
8
        Website : http://www.luc-bizet.fr
9
        Contact : [email protected]
10
-------------------------------------------------------------------------
11
             Original credits below Version History
12
##########################################################################
13
#                    Classified Module for Xoops                         #
14
#  By John Mordo user jlm69 at www.xoops.org and www.jlmzone.com         #
15
#      Started with the MyAds module and made MANY changes               #
16
##########################################################################
17
 Original Author: Pascal Le Boustouller
18
 Author Website : [email protected]
19
 Licence Type   : GPL
20
-------------------------------------------------------------------------
21
*/
22
23
/**
24
 * Class ClassifiedsTree
25
 */
26
class classifiedstree
0 ignored issues
show
Coding Style Compatibility introduced by
PSR1 recommends that each class must be in a namespace of at least one level to avoid collisions.

You can fix this by adding a namespace to your class:

namespace YourVendor;

class YourClass { }

When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.

Loading history...
27
{
28
    public $table;
29
    public $id;
30
    public $pid;
31
    public $order;
32
    public $title;
33
    public $db;
34
35
    /**
36
     * @param $table_name
37
     * @param $id_name
38
     * @param $pid_name
39
     */
40
    public function __construct($table_name, $id_name, $pid_name)
41
    {
42
        $this->db    = XoopsDatabaseFactory::getDatabaseConnection();
43
        $this->table = $table_name;
44
        $this->id    = $id_name;
45
        $this->pid   = $pid_name;
46
    }
47
48
    /**
49
     * @param        $sel_id
50
     * @param string $order
51
     *
52
     * @return array
53
     */
54
    public function getFirstChild($sel_id, $order = '')
55
    {
56
        $arr = array();
57
        $sql = 'SELECT SQL_CACHE * FROM ' . $this->table . ' WHERE ' . $this->pid . '=' . $sel_id . '';
58
59
        $categories = adslight_MygetItemIds('adslight_view');
60
        if (is_array($categories) && count($categories) > 0) {
61
            $sql .= ' AND ' . $this->pid . ' IN (' . implode(',', $categories) . ') ';
62
        }
63
64
        if ($order != '') {
65
            $sql .= " ORDER BY $order";
66
        }
67
68
        $result = $this->db->query($sql);
69
        $count  = $this->db->getRowsNum($result);
70
        if ($count == 0) {
71
            return $arr;
72
        }
73
        while ($myrow = $this->db->fetchArray($result)) {
74
            array_push($arr, $myrow);
75
        }
76
77
        return $arr;
78
    }
79
80
    /**
81
     * @param $sel_id
82
     *
83
     * @return array
84
     */
85
    public function getFirstChildId($sel_id)
86
    {
87
        $idarray = array();
88
        $result  = $this->db->query('SELECT SQL_CACHE ' . $this->id . ' FROM ' . $this->table . ' WHERE ' . $this->pid . '=' . $this->db->escape($sel_id) . '');
89
90
        $categories = adslight_MygetItemIds('adslight_view');
91
        if (is_array($categories) && count($categories) > 0) {
92
            $result .= ' AND ' . $this->pid . ' IN (' . implode(',', $categories) . ') ';
93
        }
94
95
        $count = $this->db->getRowsNum($result);
96
        if ($count == 0) {
97
            return $idarray;
98
        }
99
        while (list($id) = $this->db->fetchRow($result)) {
100
            array_push($idarray, $id);
101
        }
102
103
        return $idarray;
104
    }
105
106
    /**
107
     * @param        $sel_id
108
     * @param string $order
109
     * @param array  $idarray
110
     *
111
     * @return array
112
     */
113 View Code Duplication
    public function getAllChildId($sel_id, $order = '', $idarray = array())
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
114
    {
115
        $sql = 'SELECT SQL_CACHE ' . $this->id . ' FROM ' . $this->table . ' WHERE ' . $this->pid . '=' . $this->db->escape($sel_id) . '';
116
117
        $categories = adslight_MygetItemIds('adslight_view');
118
        if (is_array($categories) && count($categories) > 0) {
119
            $sql .= ' AND ' . $this->pid . ' IN (' . implode(',', $categories) . ') ';
120
        }
121
122
        if ($order != '') {
123
            $sql .= " ORDER BY {$order}";
124
        }
125
        $result = $this->db->query($sql);
126
        $count  = $this->db->getRowsNum($result);
127
        if ($count == 0) {
128
            return $idarray;
129
        }
130
        while (list($r_id) = $this->db->fetchRow($result)) {
131
            array_push($idarray, $r_id);
132
            $idarray = $this->getAllChildId($r_id, $order, $idarray);
133
        }
134
135
        return $idarray;
136
    }
137
138
    /**
139
     * @param        $sel_id
140
     * @param string $order
141
     * @param array  $idarray
142
     *
143
     * @return array
144
     */
145 View Code Duplication
    public function getAllParentId($sel_id, $order = '', $idarray = array())
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
146
    {
147
        $sql = 'SELECT ' . $this->pid . ' FROM ' . $this->table . ' WHERE ' . $this->id . '=' . $this->db->escape($sel_id) . '';
148
149
        $categories = adslight_MygetItemIds('adslight_view');
150
        if (is_array($categories) && count($categories) > 0) {
151
            $sql .= ' AND ' . $this->pid . ' IN (' . implode(',', $categories) . ') ';
152
        }
153
154
        if ($order != '') {
155
            $sql .= " ORDER BY {$order}";
156
        }
157
        $result = $this->db->query($sql);
158
        list($r_id) = $this->db->fetchRow($result);
159
        if ($r_id == 0) {
160
            return $idarray;
161
        }
162
        array_push($idarray, $r_id);
163
        $idarray = $this->getAllParentId($r_id, $order, $idarray);
164
165
        return $idarray;
166
    }
167
168
    /**
169
     * @param        $sel_id
170
     * @param        $title
171
     * @param string $path
172
     *
173
     * @return string
174
     */
175
    public function getPathFromId($sel_id, $title, $path = '')
176
    {
177
        $result = $this->db->query('SELECT ' . $this->pid . ', ' . $title . ' FROM ' . $this->table . ' WHERE ' . $this->id . '=' . $this->db->escape($sel_id) . '');
178
179
        $categories = adslight_MygetItemIds('adslight_view');
180
        if (is_array($categories) && count($categories) > 0) {
181
            $result .= ' AND cid IN (' . implode(',', $categories) . ') ';
182
        }
183
184
        if ($this->db->getRowsNum($result) == 0) {
185
            return $path;
186
        }
187
        list($parentid, $name) = $this->db->fetchRow($result);
188
        $myts = MyTextSanitizer::getInstance();
189
        $name = $myts->htmlSpecialChars($name);
190
        $path = '/' . $name . $path . '';
191
        if ($parentid == 0) {
192
            return $path;
193
        }
194
        $path = $this->getPathFromId($parentid, $title, $path);
195
196
        return $path;
197
    }
198
199
    /**
200
     * @param        $title
201
     * @param string $order
202
     * @param int    $preset_id
203
     * @param int    $none
204
     * @param string $sel_name
205
     * @param string $onchange
206
     */
207
    public function makeMySelBox($title, $order = '', $preset_id = 0, $none = 0, $sel_name = '', $onchange = '')
208
    {
209
        if ($sel_name == '') {
210
            $sel_name = $this->id;
211
        }
212
        $myts = MyTextSanitizer::getInstance();
213
        echo '<select name="' . $sel_name . '"';
214
        if ($onchange != '') {
215
            echo ' onchange="' . $onchange . '"';
216
        }
217
        echo '>';
218
219
        $sql        = 'SELECT SQL_CACHE cid, title FROM ' . $this->table . ' WHERE pid=0';
220
        $categories = adslight_MygetItemIds('adslight_submit');
221
222
        if (is_array($categories) && count($categories) > 0) {
223
            $sql .= ' AND cid IN (' . implode(',', $categories) . ') ';
224
        }
225
        if ($order != '') {
226
            $sql .= " ORDER BY $order";
227
        }
228
229
        $result = $this->db->query($sql);
230
        if ($none) {
231
            echo '<option value="0">----</option>';
232
        }
233
        while (list($catid, $name) = $this->db->fetchRow($result)) {
234
            $sel = '';
235
            if ($catid == $preset_id) {
236
                $sel = ' selected="selected"';
237
            }
238
            echo '<option value=' . $catid . '' . $sel . '>' . $name . '</option>';
239
            $sel = '';
240
            $arr = $this->getChildTreeArray($catid, $order);
241
            foreach ($arr as $option) {
242
                $option['prefix'] = str_replace('.', '--', $option['prefix']);
243
                $catpath          = $option['prefix'] . '&nbsp;' . $myts->displayTarea($option[$title]);
244
                if ($option['cid'] == $preset_id) {
245
                    $sel = ' selected="selected"';
246
                }
247
                echo '<option value="' . $option['cid'] . '"' . $sel . '>' . $catpath . '</option>';
248
                $sel = '';
249
            }
250
        }
251
        echo '</select>';
252
    }
253
254
    /**
255
     * @param        $sel_id
256
     * @param        $title
257
     * @param        $funcURL
258
     * @param string $path
259
     *
260
     * @return string
261
     */
262
    public function getNicePathFromId($sel_id, $title, $funcURL, $path = '')
263
    {
264
        $sql    = 'SELECT SQL_CACHE ' . $this->pid . ', ' . $title . ' FROM ' . $this->table . ' WHERE ' . $this->id . '=' . $this->db->escape($sel_id) . '';
265
        $result = $this->db->query($sql);
266
        if ($this->db->getRowsNum($result) == 0) {
267
            return $path;
268
        }
269
        list($parentid, $name) = $this->db->fetchRow($result);
270
        $myts = MyTextSanitizer::getInstance();
271
        $name = $myts->htmlSpecialChars($name);
272
273
        $arrow = '<img src="' . XOOPS_URL . '/modules/adslight/assets/images/arrow.gif" alt="&raquo;" />';
274
275
        $path = '&nbsp;&nbsp;' .
276
                $arrow .
277
                '&nbsp;&nbsp;<a title="' .
278
                _ADSLIGHT_ANNONCES .
279
                ' ' .
280
                $name .
281
                '" href="' .
282
                $funcURL .
283
                '' .
284
                $this->id .
285
                '=' .
286
                $this->db->escape($sel_id) .
287
                '">' .
288
                $name .
289
                '</a>' .
290
                $path .
291
                '';
292
293
        if ($parentid == 0) {
294
            return $path;
295
        }
296
        $path = $this->getNicePathFromId($parentid, $title, $funcURL, $path);
297
298
        return $path;
299
    }
300
301
    /**
302
     * @param        $sel_id
303
     * @param string $path
304
     *
305
     * @return string
306
     */
307
    public function getIdPathFromId($sel_id, $path = '')
308
    {
309
        $result = $this->db->query('SELECT SQL_CACHE ' . $this->pid . ' FROM ' . $this->table . ' WHERE ' . $this->id . '=' . $this->db->escape($sel_id) . '');
310
        if ($this->db->getRowsNum($result) == 0) {
311
            return $path;
312
        }
313
        list($parentid) = $this->db->fetchRow($result);
314
        $path = '/' . $sel_id . $path . '';
315
        if ($parentid == 0) {
316
            return $path;
317
        }
318
        $path = $this->getIdPathFromId($parentid, $path);
319
320
        return $path;
321
    }
322
323
    /**
324
     * @param int    $sel_id
325
     * @param string $order
326
     * @param array  $parray
327
     *
328
     * @return array
329
     */
330 View Code Duplication
    public function getAllChild($sel_id = 0, $order = '', $parray = array())
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
331
    {
332
        $sql = 'SELECT SQL_CACHE * FROM ' . $this->table . ' WHERE ' . $this->pid . '=' . $this->db->escape($sel_id) . '';
333
334
        $categories = adslight_MygetItemIds('adslight_view');
335
        if (is_array($categories) && count($categories) > 0) {
336
            $sql .= ' AND ' . $this->pid . ' IN (' . implode(',', $categories) . ') ';
337
        }
338
339
        if ($order != '') {
340
            $sql .= " ORDER BY {$order}";
341
        }
342
343
        $result = $this->db->query($sql);
344
        $count  = $this->db->getRowsNum($result);
345
        if ($count == 0) {
346
            return $parray;
347
        }
348
        while ($row = $this->db->fetchArray($result)) {
349
            array_push($parray, $row);
350
            $parray = $this->getAllChild($row[$this->id], $order, $parray);
351
        }
352
353
        return $parray;
354
    }
355
356
    /**
357
     * @param int    $sel_id
358
     * @param string $order
359
     * @param array  $parray
360
     * @param string $r_prefix
361
     *
362
     * @return array
363
     */
364
    public function getChildTreeArray($sel_id = 0, $order = '', $parray = array(), $r_prefix = '')
365
    {
366
        global $moduleDirName;
1 ignored issue
show
Compatibility Best Practice introduced by
Use of global functionality is not recommended; it makes your code harder to test, and less reusable.

Instead of relying on global state, we recommend one of these alternatives:

1. Pass all data via parameters

function myFunction($a, $b) {
    // Do something
}

2. Create a class that maintains your state

class MyClass {
    private $a;
    private $b;

    public function __construct($a, $b) {
        $this->a = $a;
        $this->b = $b;
    }

    public function myFunction() {
        // Do something
    }
}
Loading history...
367
368
        $sql = 'SELECT SQL_CACHE * FROM ' . $this->table . ' WHERE ' . $this->pid . '=' . $this->db->escape($sel_id) . '';
369
370
        $categories = adslight_MygetItemIds('adslight_view');
371
        if (is_array($categories) && count($categories) > 0) {
372
            $sql .= ' AND cid IN (' . implode(',', $categories) . ') ';
373
        }
374
375
        if ($order != '') {
376
            $sql .= " ORDER BY {$order}";
377
        }
378
        $result = $this->db->query($sql);
379
        $count  = $this->db->getRowsNum($result);
380
        if ($count == 0) {
381
            return $parray;
382
        }
383 View Code Duplication
        while ($row = $this->db->fetchArray($result)) {
1 ignored issue
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
384
            $row['prefix'] = $r_prefix . '.';
385
            array_push($parray, $row);
386
            $parray = $this->getChildTreeArray($row[$this->id], $order, $parray, $row['prefix']);
387
        }
388
389
        return $parray;
390
    }
391
392
    /**
393
     * @param        $title
394
     * @param string $order
395
     * @param int    $preset_id
396
     * @param int    $none
397
     * @param string $sel_name
398
     * @param string $onchange
399
     */
400
    public function makeAdSelBox($title, $order = '', $preset_id = 0, $none = 0, $sel_name = '', $onchange = '')
401
    {
402
        global $xoopsModuleConfig, $myts, $xoopsDB, $pathIcon16;
1 ignored issue
show
Compatibility Best Practice introduced by
Use of global functionality is not recommended; it makes your code harder to test, and less reusable.

Instead of relying on global state, we recommend one of these alternatives:

1. Pass all data via parameters

function myFunction($a, $b) {
    // Do something
}

2. Create a class that maintains your state

class MyClass {
    private $a;
    private $b;

    public function __construct($a, $b) {
        $this->a = $a;
        $this->b = $b;
    }

    public function myFunction() {
        // Do something
    }
}
Loading history...
403
        require XOOPS_ROOT_PATH . '/modules/adslight/include/gtickets.php';
404
405
        if ($sel_name == '') {
406
            $sel_name = $this->id;
0 ignored issues
show
Unused Code introduced by
$sel_name is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
407
        }
408
409
        $sql = 'select ' . $this->id . ', ' . $title . ', ordre FROM ' . $this->table . ' WHERE ' . $this->pid . '=0';
410
        if ($order != '') {
411
            $sql .= " ORDER BY {$order}";
412
        }
413
        $result = $xoopsDB->query($sql);
414
        while (list($catid, $name, $ordre) = $xoopsDB->fetchRow($result)) {
415
            echo '<table width="100%" border="0" class="outer"><tr>
416
                <th align="left">';
417
            if ($xoopsModuleConfig['adslight_csortorder'] === 'ordre') {
418
                echo '(' . $ordre . ')';
419
            }
420
            echo '&nbsp;&nbsp;' .
421
                 $name .
422
                 '&nbsp;&nbsp;</th>
423
                <th align="center" width="10%"><a href="category.php?op=AdsNewCat&amp;cid=' .
424
                 addslashes($catid) .
425
                 '"><img src="' .
426
                 $pathIcon16 .
427
                 '/add.png' .
428
                 '" border=0 width=18 height=18 alt="' .
429
                 _AM_ADSLIGHT_ADDSUBCAT .
430
                 '" title="' .
431
                 _AM_ADSLIGHT_ADDSUBCAT .
432
                 '"></a></th>
433
                <th align="center" width="10%"><a href="category.php?op=AdsModCat&amp;cid=' .
434
                 addslashes($catid) .
435
                 '"><img src="' .
436
                 $pathIcon16 .
437
                 '/edit.png' .
438
                 '" border=0 width=18 height=18 alt="' .
439
                 _AM_ADSLIGHT_MODIFSUBCAT .
440
                 '" title ="' .
441
                 _AM_ADSLIGHT_MODIFSUBCAT .
442
                 '"></a></th>
443
                <th align="center" width="10%"><a href="category.php?op=AdsDelCat&amp;cid=' .
444
                 addslashes($catid) .
445
                 '"><img src="' .
446
                 $pathIcon16 .
447
                 '/delete.png' .
448
                 '" border=0 width=18 height=18 alt="' .
449
                 _AM_ADSLIGHT_DELSUBCAT .
450
                 '" title="' .
451
                 _AM_ADSLIGHT_DELSUBCAT .
452
                 '"></a></th>
453
                </tr>';
454
455
            $arr   = $this->getChildTreeMapArray($catid, $order);
456
            $class = 'odd';
457
            foreach ($arr as $option) {
458
                echo '<tr class="' . $class . '"><td>';
459
460
                $option['prefix'] = str_replace('.', ' &nbsp;&nbsp;-&nbsp;', $option['prefix']);
461
                $catpath          = $option['prefix'] . '&nbsp;&nbsp;' . $myts->htmlSpecialChars($option[$title]);
462
                $ordreS           = $option['ordre'];
463
                if ($xoopsModuleConfig['adslight_csortorder'] === 'ordre') {
464
                    echo '(' . $ordreS . ')';
465
                }
466
                echo '' .
467
                     $catpath .
468
                     '</a></td>
469
                    <td align="center"><a href="category.php?op=AdsNewCat&amp;cid=' .
470
                     $option[$this->id] .
471
                     '"><img src="' .
472
                     $pathIcon16 .
473
                     '/add.png' .
474
                     '" border=0 width=18 height=18 alt="' .
475
                     _AM_ADSLIGHT_ADDSUBCAT .
476
                     '"title="' .
477
                     _AM_ADSLIGHT_ADDSUBCAT .
478
                     '"></a></td>
479
                    <td align="center"><a href="category.php?op=AdsModCat&amp;cid=' .
480
                     $option[$this->id] .
481
                     '"><img src="' .
482
                     $pathIcon16 .
483
                     '/edit.png' .
484
                     '" border=0 width=18 height=18 alt="' .
485
                     _AM_ADSLIGHT_MODIFSUBCAT .
486
                     '" title ="' .
487
                     _AM_ADSLIGHT_MODIFSUBCAT .
488
                     '"></a></td>
489
                    <td align="center"><a href="category.php?op=AdsDelCat&amp;cid=' .
490
                     $option[$this->id] .
491
                     '"><img src="' .
492
                     $pathIcon16 .
493
                     '/delete.png' .
494
                     '" border=0 width=18 height=18 alt="' .
495
                     _AM_ADSLIGHT_DELSUBCAT .
496
                     '" title="' .
497
                     _AM_ADSLIGHT_DELSUBCAT .
498
                     '"></a></td>';
499
500
                $class = ($class === 'even') ? 'odd' : 'even';
501
            }
502
            echo '</td></tr></table><br>';
503
        }
504
    }
505
506
    /**
507
     * @param int    $sel_id
508
     * @param string $order
509
     * @param array  $parray
510
     * @param string $r_prefix
511
     *
512
     * @return array
513
     */
514
    public function getChildTreeMapArray($sel_id = 0, $order = '', $parray = array(), $r_prefix = '')
515
    {
516
        global $xoopsDB;
1 ignored issue
show
Compatibility Best Practice introduced by
Use of global functionality is not recommended; it makes your code harder to test, and less reusable.

Instead of relying on global state, we recommend one of these alternatives:

1. Pass all data via parameters

function myFunction($a, $b) {
    // Do something
}

2. Create a class that maintains your state

class MyClass {
    private $a;
    private $b;

    public function __construct($a, $b) {
        $this->a = $a;
        $this->b = $b;
    }

    public function myFunction() {
        // Do something
    }
}
Loading history...
517
        $sql = 'select SQL_CACHE * FROM ' . $this->table . ' WHERE ' . $this->pid . '=' . $xoopsDB->escape($sel_id) . '';
518
519
        $categories = adslight_MygetItemIds('adslight_view');
520
        if (is_array($categories) && count($categories) > 0) {
521
            $sql .= ' AND ' . $this->pid . ' IN (' . implode(',', $categories) . ') ';
522
        }
523
524
        if ($order != '') {
525
            $sql .= " ORDER BY {$order}";
526
        }
527
        $result = $xoopsDB->query($sql);
528
        $count  = $xoopsDB->getRowsNum($result);
529
        if ($count == 0) {
530
            return $parray;
531
        }
532 View Code Duplication
        while ($row = $xoopsDB->fetchArray($result)) {
1 ignored issue
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
533
            $row['prefix'] = $r_prefix . '.';
534
            array_push($parray, $row);
535
            $parray = $this->getChildTreeMapArray($row[$this->id], $order, $parray, $row['prefix']);
536
        }
537
538
        return $parray;
539
    }
540
541
    /**
542
     * @return array
543
     */
544
    public function getCategoryList()
545
    {
546
        $result = $this->db->query('SELECT SQL_CACHE cid, pid, title FROM ' . $this->table);
547
        $ret    = array();
548
        $myts   = MyTextSanitizer::getInstance();
549
        while ($myrow = $this->db->fetchArray($result)) {
550
            $ret[$myrow['cid']] = array('title' => $myts->htmlspecialchars($myrow['title']), 'pid' => $myrow['pid']);
551
        }
552
553
        return $ret;
554
    }
555
}
556