Code Duplication    Length = 5-5 lines in 4 locations

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

@@ 6402-6406 (lines=5) @@
6399
            $sql .= $limitCondition;
6400
        }
6401
6402
        if ($getCount) {
6403
            $result = Database::query($sql);
6404
            $row = Database::fetch_array($result);
6405
6406
            return $row['total'];
6407
        }
6408
        $result = Database::query($sql);
6409

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

@@ 3581-3585 (lines=5) @@
3578
		            src.session_id IN ($sessionsSQL)
3579
		            $keywordCondition
3580
		        ";
3581
        if ($getCount) {
3582
            $result = Database::query($sql);
3583
            $row = Database::fetch_array($result,'ASSOC');
3584
            return $row['count'];
3585
        }
3586
3587
        if (isset($from) && isset($limit)) {
3588
            $from = intval($from);

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

@@ 4463-4467 (lines=5) @@
4460
        if ($getSql) {
4461
            return $sql;
4462
        }
4463
        if ($getCount) {
4464
            $result = Database::query($sql);
4465
            $row = Database::fetch_array($result);
4466
            return $row['count'];
4467
        }
4468
4469
        $orderBy = null;
4470
        if ($getOnlyUserId == false) {

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";