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
    }

plugin/vchamilo/lib/Virtual.php 1 location

@@ 1309-1314 (lines=6) @@
1306
    public static function getInstance($id)
1307
    {
1308
        $vhost = new stdClass();
1309
        if ($id) {
1310
            $id = (int) $id;
1311
            $sql = "SELECT * FROM vchamilo WHERE id = $id";
1312
            $result = Database::query($sql);
1313
            $vhost =  (object) Database::fetch_array($result, 'ASSOC');
1314
        }
1315
1316
        return $vhost;
1317
    }

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

@@ 5402-5410 (lines=9) @@
5399
                ) as t1
5400
                ";
5401
5402
        if ($getCount) {
5403
            $result = Database::query($sql);
5404
            $count = 0;
5405
            if (Database::num_rows($result)) {
5406
                $rows = Database::fetch_array($result);
5407
                $count = $rows['count'];
5408
            }
5409
            return $count;
5410
        }
5411
5412
        if (!empty($column) && !empty($direction)) {
5413
            $column = str_replace('u.', '', $column);

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

@@ 3491-3500 (lines=10) @@
3488
3489
        $conditionsToString = implode('AND ', $conditions);
3490
3491
        if (empty($courseCode)) {
3492
            $sql = "SELECT count(poster_id) as count
3493
                    FROM $tbl_forum_post post 
3494
                    INNER JOIN $tbl_forum forum
3495
                    ON (forum.forum_id = post.forum_id AND forum.c_id = post.c_id)
3496
                    WHERE $conditionsToString";
3497
3498
            $rs = Database::query($sql);
3499
            $row = Database::fetch_array($rs, 'ASSOC');
3500
            return $row['count'];
3501
        }
3502
3503
        require_once api_get_path(SYS_CODE_PATH).'forum/forumconfig.inc.php';