Code Duplication    Length = 14-14 lines in 2 locations

class/Admin.php 2 locations

@@ 223-236 (lines=14) @@
220
            $result = $GLOBALS['xoopsDB']->queryF($sql);
221
            $count  = $GLOBALS['xoopsDB']->getRowsNum($result);
222
            $i      = 1;
223
            if ($count >= $i) {
224
                while (false !== ($row = $GLOBALS['xoopsDB']->fetchArray($result))) {
225
                    $array['counter'][$i] = $i;
226
                    $array['img'][$i]     = "<img height='10px' width='10px' " . "style='margin:0px 5px;' src = '../assets/images/like.png'>";
227
                    if ($array['counter'][$i] > 3) {
228
                        $array['img'][$i] = '';
229
                    }
230
                    $array['cnt'][$i]  = $row['cnt'];
231
                    $array['user'][$i] = $GLOBALS['xoopsUser']->getUnameFromId($row['owner']);
232
                    ++$i;
233
                }
234
            } else {
235
                $array = [];
236
            }
237
        } else {
238
            $sql    = 'SELECT owner, COUNT(*) AS cnt FROM ' . $GLOBALS['xoopsDB']->prefix('smallworld_vote') . " WHERE down='1' GROUP BY owner ORDER BY cnt DESC LIMIT " . Constants::USER_LIMIT;
239
            $result = $GLOBALS['xoopsDB']->queryF($sql);
@@ 242-255 (lines=14) @@
239
            $result = $GLOBALS['xoopsDB']->queryF($sql);
240
            $count  = $GLOBALS['xoopsDB']->getRowsNum($result);
241
            $i      = 1;
242
            if (0 != $count) {
243
                while (false !== ($row = $GLOBALS['xoopsDB']->fetchArray($result))) {
244
                    $array['counter'][$i] = $i;
245
                    $array['img'][$i]     = "<img height='10px' width='10px' " . "style='margin:0px 5px;' src = '../assets/images/dislike.png'>";
246
                    if ($array['counter'][$i] > 3) {
247
                        $array['img'][$i] = '';
248
                    }
249
                    $array['cnt'][$i]  = $row['cnt'];
250
                    $array['user'][$i] = $GLOBALS['xoopsUser']->getUnameFromId($row['owner']);
251
                    ++$i;
252
                }
253
            } else {
254
                $array = [];
255
            }
256
        }
257
258
        return $array;