Code Duplication    Length = 5-5 lines in 4 locations

main/work/work.lib.php 1 location

@@ 1788-1792 (lines=5) @@
1785
    $direction = in_array(strtolower($direction), array('desc', 'asc')) ? $direction : 'desc';
1786
    $column = Database::escape_string($column);
1787
1788
    if ($getCount) {
1789
        $result = Database::query($sql);
1790
        $result = Database::fetch_array($result);
1791
        return $result['count'];
1792
    }
1793
1794
    $sql .= " ORDER BY $column $direction";
1795
    $sql .= " LIMIT $start, $limit";

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

@@ 4479-4483 (lines=5) @@
4476
        if ($getSql) {
4477
            return $sql;
4478
        }
4479
        if ($getCount) {
4480
            $result = Database::query($sql);
4481
            $row = Database::fetch_array($result);
4482
            return $row['count'];
4483
        }
4484
4485
        $orderBy = null;
4486
        if ($getOnlyUserId == false) {

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

@@ 6472-6476 (lines=5) @@
6469
            $sql .= $limitCondition;
6470
        }
6471
6472
        if ($getCount) {
6473
            $result = Database::query($sql);
6474
            $row = Database::fetch_array($result);
6475
6476
            return $row['total'];
6477
        }
6478
        $result = Database::query($sql);
6479

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

@@ 3722-3726 (lines=5) @@
3719
		            src.session_id IN ($sessionsSQL)
3720
		            $keywordCondition
3721
		        ";
3722
        if ($getCount) {
3723
            $result = Database::query($sql);
3724
            $row = Database::fetch_array($result, 'ASSOC');
3725
            return $row['count'];
3726
        }
3727
3728
        if (isset($from) && isset($limit)) {
3729
            $from = intval($from);