Code Duplication    Length = 6-13 lines in 4 locations

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

@@ 1260-1272 (lines=13) @@
1257
        $TBL_COURSE = Database::get_main_table(TABLE_MAIN_COURSE);
1258
        $exe_id = intval($exe_id);
1259
        $result = array();
1260
        if (!empty($exe_id)) {
1261
            $sql = " SELECT q.*, tee.*
1262
                FROM $TBL_EXERCICES as q
1263
                INNER JOIN $TBL_TRACK_EXERCICES as tee
1264
                ON q.id = tee.exe_exo_id
1265
                INNER JOIN $TBL_COURSE c
1266
                ON c.id = tee.c_id
1267
                WHERE tee.exe_id = $exe_id
1268
                AND q.c_id = c.id";
1269
1270
            $res_fb_type = Database::query($sql);
1271
            $result = Database::fetch_array($res_fb_type, 'ASSOC');
1272
        }
1273
1274
        return $result;
1275
    }

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

@@ 3482-3491 (lines=10) @@
3479
3480
        $conditionsToString = implode('AND ', $conditions);
3481
3482
        if (empty($courseCode)) {
3483
            $sql = "SELECT count(poster_id) as count
3484
                    FROM $tbl_forum_post post 
3485
                    INNER JOIN $tbl_forum forum
3486
                    ON (forum.forum_id = post.forum_id AND forum.c_id = post.c_id)
3487
                    WHERE $conditionsToString";
3488
3489
            $rs = Database::query($sql);
3490
            $row = Database::fetch_array($rs, 'ASSOC');
3491
            return $row['count'];
3492
        }
3493
3494
        require_once api_get_path(SYS_CODE_PATH).'forum/forumconfig.inc.php';

plugin/vchamilo/lib/Virtual.php 1 location

@@ 1300-1305 (lines=6) @@
1297
    public static function getInstance($id)
1298
    {
1299
        $vhost = new stdClass();
1300
        if ($id) {
1301
            $id = (int) $id;
1302
            $sql = "SELECT * FROM vchamilo WHERE id = $id";
1303
            $result = Database::query($sql);
1304
            $vhost =  (object) Database::fetch_array($result, 'ASSOC');
1305
        }
1306
1307
        return $vhost;
1308
    }

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

@@ 5383-5391 (lines=9) @@
5380
                ) as t1
5381
                ";
5382
5383
        if ($getCount) {
5384
            $result = Database::query($sql);
5385
            $count = 0;
5386
            if (Database::num_rows($result)) {
5387
                $rows = Database::fetch_array($result);
5388
                $count = $rows['count'];
5389
            }
5390
            return $count;
5391
        }
5392
5393
        if (!empty($column) && !empty($direction)) {
5394
            $column = str_replace('u.', '', $column);