Code Duplication    Length = 5-5 lines in 4 locations

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

@@ 6157-6161 (lines=5) @@
6154
            $sql .= $limitCondition;
6155
        }
6156
6157
        if ($getCount) {
6158
            $result = Database::query($sql);
6159
            $row = Database::fetch_array($result);
6160
            return $row['total'];
6161
        }
6162
        $result = Database::query($sql);
6163
6164
        $html = null;

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

@@ 3473-3477 (lines=5) @@
3470
		            src.session_id IN ($sessionsSQL)
3471
		            $keywordCondition
3472
		        ";
3473
        if ($getCount) {
3474
            $result = Database::query($sql);
3475
            $row = Database::fetch_array($result,'ASSOC');
3476
            return $row['count'];
3477
        }
3478
3479
        if (isset($from) && isset($limit)) {
3480
            $from = intval($from);

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

@@ 4368-4372 (lines=5) @@
4365
        if ($getSql) {
4366
            return $sql;
4367
        }
4368
        if ($getCount) {
4369
            $result = Database::query($sql);
4370
            $row = Database::fetch_array($result);
4371
            return $row['count'];
4372
        }
4373
4374
        $orderBy = null;
4375
        if ($getOnlyUserId == false) {

main/work/work.lib.php 1 location

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