| Conditions | 6 |
| Paths | 8 |
| Total Lines | 30 |
| Code Lines | 19 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 33 | function cardealer_search($queryarray, $andor, $limit, $offset, $userid) |
||
| 34 | { |
||
| 35 | $sql = 'SELECT custnum, custname FROM ' . $GLOBALS['xoopsDB']->prefix('cardealer_customer') . ' WHERE _online = 1'; |
||
| 36 | |||
| 37 | if (0 !== $userid) { |
||
| 38 | $sql .= ' AND _submitter=' . (int)$userid; |
||
| 39 | } |
||
| 40 | |||
| 41 | if (is_array($queryarray) && $count = count($queryarray)) { |
||
| 42 | $sql .= ' AND (()'; |
||
| 43 | |||
| 44 | for ($i = 1; $i < $count; ++$i) { |
||
| 45 | $sql .= " $andor "; |
||
| 46 | $sql .= '()'; |
||
| 47 | } |
||
| 48 | $sql .= ')'; |
||
| 49 | } |
||
| 50 | |||
| 51 | $sql .= ' ORDER BY custnum DESC'; |
||
| 52 | $result = $GLOBALS['xoopsDB']->query($sql, $limit, $offset); |
||
| 53 | $ret = []; |
||
| 54 | $i = 0; |
||
| 55 | while (false !== ($myrow = $GLOBALS['xoopsDB']->fetchArray($result))) { |
||
| 56 | $ret[$i]['image'] = 'assets/images/icons/32/_search.png'; |
||
| 57 | $ret[$i]['link'] = 'customer.php?custnum=' . $myrow['custnum']; |
||
| 58 | $ret[$i]['title'] = $myrow['custname']; |
||
| 59 | ++$i; |
||
| 60 | } |
||
| 61 | |||
| 62 | return $ret; |
||
| 63 | } |
||
| 64 |