| | 68 | if (!empty($name)) { |
| | 69 | $sql .= ' AND c.name = \'' . POD::escapeString($name) . '\''; |
| | 70 | $postfix .= '&name=' . rawurlencode($name); |
| | 71 | } |
| | 72 | if (!empty($ip)) { |
| | 73 | $sql .= ' AND c.ip = \'' . POD::escapeString($ip) . '\''; |
| | 74 | $postfix .= '&ip=' . rawurlencode($ip); |
| | 75 | } |
| | 76 | if (!empty($search)) { |
| | 77 | $search = escapeSearchString($search); |
| | 78 | $sql .= " AND (c.name LIKE '%$search%' OR c.homepage LIKE '%$search%' OR c.comment LIKE '%$search%')"; |
| | 79 | $postfix .= '&search=' . rawurlencode($search); |
| | 80 | } |
| | 81 | |
| | 82 | $sql .= ' ORDER BY c.written DESC'; |
| | 83 | list($comments, $paging) = fetchWithPaging($sql, $page, $count); |
| | 84 | if (strlen($postfix) > 0) { |
| | 85 | $postfix .= '&withSearch=on'; |
| | 86 | $paging['postfix'] .= $postfix; |
| | 87 | } |
| | 88 | |
| | 89 | return array($comments, $paging); |
| | 90 | } |
| | 91 | |
| | 92 | function getGuestbookWithPagingForOwner($blogid, $name, $ip, $search, $page, $count) { |
| | 93 | global $database; |
| | 94 | |
| | 95 | $postfix = ''; |
| | 96 | |
| | 97 | $sql = "SELECT c.*, c2.name parentName |
| | 98 | FROM {$database['prefix']}Comments c |
| | 99 | LEFT JOIN {$database['prefix']}Comments c2 ON c.parent = c2.id AND c.blogid = c2.blogid |
| | 100 | WHERE c.blogid = $blogid AND c.entry = 0 AND c.isFiltered = 0"; |