Code Duplication    Length = 5-5 lines in 4 locations

main/inc/lib/usermanager.lib.php 1 location

@@ 4373-4377 (lines=5) @@
4370
        if ($getSql) {
4371
            return $sql;
4372
        }
4373
        if ($getCount) {
4374
            $result = Database::query($sql);
4375
            $row = Database::fetch_array($result);
4376
            return $row['count'];
4377
        }
4378
4379
        $orderBy = null;
4380
        if ($getOnlyUserId == false) {

main/work/work.lib.php 1 location

@@ 1713-1717 (lines=5) @@
1710
    $direction = in_array(strtolower($direction), array('desc', 'asc')) ? $direction : 'desc';
1711
    $column = Database::escape_string($column);
1712
1713
    if ($getCount) {
1714
        $result = Database::query($sql);
1715
        $result = Database::fetch_array($result);
1716
        return $result['count'];
1717
    }
1718
1719
    $sql .= " ORDER BY $column $direction";
1720
    $sql .= " LIMIT $start, $limit";

main/inc/lib/sessionmanager.lib.php 1 location

@@ 3495-3499 (lines=5) @@
3492
		            src.session_id IN ($sessionsSQL)
3493
		            $keywordCondition
3494
		        ";
3495
        if ($getCount) {
3496
            $result = Database::query($sql);
3497
            $row = Database::fetch_array($result,'ASSOC');
3498
            return $row['count'];
3499
        }
3500
3501
        if (isset($from) && isset($limit)) {
3502
            $from = intval($from);

main/inc/lib/course.lib.php 1 location

@@ 6221-6225 (lines=5) @@
6218
            $sql .= $limitCondition;
6219
        }
6220
6221
        if ($getCount) {
6222
            $result = Database::query($sql);
6223
            $row = Database::fetch_array($result);
6224
            return $row['total'];
6225
        }
6226
        $result = Database::query($sql);
6227
6228
        $html = null;