| @@ 2127-2166 (lines=40) @@ | ||
| 2124 | $topten = []; |
|
| 2125 | $data = []; |
|
| 2126 | ||
| 2127 | if ($result) { |
|
| 2128 | while ($row = $this->_config->getDb()->fetchObject($result)) { |
|
| 2129 | if ($this->groupSupport) { |
|
| 2130 | if (!in_array($row->user_id, array(-1, $this->user)) || !in_array($row->group_id, $this->groups)) { |
|
| 2131 | continue; |
|
| 2132 | } |
|
| 2133 | } else { |
|
| 2134 | if (!in_array($row->user_id, array(-1, $this->user))) { |
|
| 2135 | continue; |
|
| 2136 | } |
|
| 2137 | } |
|
| 2138 | ||
| 2139 | $data['visits'] = (int)$row->visits; |
|
| 2140 | $data['question'] = PMF_Filter::filterVar($row->question, FILTER_SANITIZE_STRING); |
|
| 2141 | $data['date'] = $row->updated; |
|
| 2142 | $data['last_visit'] = $row->last_visit; |
|
| 2143 | ||
| 2144 | $title = $row->question; |
|
| 2145 | $url = sprintf( |
|
| 2146 | '%sindex.php?%saction=artikel&cat=%d&id=%d&artlang=%s', |
|
| 2147 | $this->_config->getDefaultUrl(), |
|
| 2148 | $sids, |
|
| 2149 | $row->category_id, |
|
| 2150 | $row->id, |
|
| 2151 | $row->lang |
|
| 2152 | ); |
|
| 2153 | $oLink = new PMF_Link($url, $this->_config); |
|
| 2154 | $oLink->itemTitle = $row->question; |
|
| 2155 | $oLink->tooltip = $title; |
|
| 2156 | $data['url'] = $oLink->toString(); |
|
| 2157 | ||
| 2158 | $topten[$row->id] = $data; |
|
| 2159 | ||
| 2160 | if (count($topten) === $count) { |
|
| 2161 | break; |
|
| 2162 | } |
|
| 2163 | } |
|
| 2164 | ||
| 2165 | array_multisort($topten, SORT_DESC); |
|
| 2166 | } |
|
| 2167 | ||
| 2168 | return $topten; |
|
| 2169 | } |
|
| @@ 2236-2273 (lines=38) @@ | ||
| 2233 | $latest = []; |
|
| 2234 | $data = []; |
|
| 2235 | ||
| 2236 | if ($result) { |
|
| 2237 | while (($row = $this->_config->getDb()->fetchObject($result))) { |
|
| 2238 | if ($this->groupSupport) { |
|
| 2239 | if (!in_array($row->user_id, array(-1, $this->user)) || !in_array($row->group_id, $this->groups)) { |
|
| 2240 | continue; |
|
| 2241 | } |
|
| 2242 | } else { |
|
| 2243 | if (!in_array($row->user_id, array(-1, $this->user))) { |
|
| 2244 | continue; |
|
| 2245 | } |
|
| 2246 | } |
|
| 2247 | ||
| 2248 | $data['date'] = $row->updated; |
|
| 2249 | $data['question'] = PMF_Filter::filterVar($row->question, FILTER_SANITIZE_STRING); |
|
| 2250 | $data['answer'] = $row->content; |
|
| 2251 | $data['visits'] = $row->visits; |
|
| 2252 | ||
| 2253 | $title = $row->question; |
|
| 2254 | $url = sprintf( |
|
| 2255 | '%sindex.php?%saction=artikel&cat=%d&id=%d&artlang=%s', |
|
| 2256 | $this->_config->getDefaultUrl(), |
|
| 2257 | $sids, |
|
| 2258 | $row->category_id, |
|
| 2259 | $row->id, |
|
| 2260 | $row->lang |
|
| 2261 | ); |
|
| 2262 | $oLink = new PMF_Link($url, $this->_config); |
|
| 2263 | $oLink->itemTitle = $title; |
|
| 2264 | $oLink->tooltip = $title; |
|
| 2265 | $data['url'] = $oLink->toString(); |
|
| 2266 | ||
| 2267 | $latest[$row->id] = $data; |
|
| 2268 | ||
| 2269 | if (count($latest) === $count) { |
|
| 2270 | break; |
|
| 2271 | } |
|
| 2272 | } |
|
| 2273 | } |
|
| 2274 | ||
| 2275 | return $latest; |
|
| 2276 | } |
|