| Conditions | 6 |
| Paths | 8 |
| Total Lines | 28 |
| Code Lines | 20 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 2 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 15 | function countdown_search($queryarray, $andor, $limit, $offset, $userid) |
||
| 16 | { |
||
| 17 | $sql = 'SELECT * FROM ' . $GLOBALS['xoopsDB']->prefix('countdown_events') . ' '; |
||
| 18 | if (0 != $userid) { |
||
| 19 | $sql .= " WHERE event_uid='$userid'"; |
||
| 20 | } |
||
| 21 | // because count() returns 1 even if a supplied variable |
||
| 22 | // is not an array, we must check if $querryarray is really an array |
||
| 23 | if (is_array($queryarray) && $count = count($queryarray)) { |
||
| 24 | $sql .= " WHERE ((event_name LIKE '%{$queryarray[0]}%')"; |
||
| 25 | for ($i = 1; $i < $count; $i++) { |
||
| 26 | $sql .= " $andor "; |
||
| 27 | $sql .= "(event_name LIKE '%{$queryarray[$i]}%')"; |
||
| 28 | } |
||
| 29 | $sql .= ') '; |
||
| 30 | } |
||
| 31 | $sql .= ' ORDER BY event_name ASC'; |
||
| 32 | $result = $GLOBALS['xoopsDB']->query($sql, (int)$limit, (int)$offset); |
||
| 33 | $ret = []; |
||
| 34 | $i = 0; |
||
| 35 | while (false !== ($myrow = $GLOBALS['xoopsDB']->fetchArray($result))) { |
||
| 36 | $ret[$i]['link'] = '' . XOOPS_URL . "/modules/countdown/event.php?op=view&id=" . $myrow['event_id'] . ''; |
||
| 37 | $ret[$i]['title'] = '' . htmlspecialchars($myrow['event_name'], ENT_QUOTES | ENT_HTML5) . ''; |
||
| 38 | $ret[$i]['time'] = '' . strtotime($myrow['event_date']) . ''; |
||
| 39 | $ret[$i]['uid'] = '' . $myrow['event_uid'] . ''; |
||
| 40 | $i++; |
||
| 41 | } |
||
| 42 | return $ret; |
||
| 43 | } |
||
| 44 |