Code Duplication    Length = 10-13 lines in 3 locations

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

@@ 6500-6512 (lines=13) @@
6497
                $sql = "SELECT thematic_id FROM $table_tool
6498
                        WHERE c_id = $course_id AND id = $ref";
6499
                $rs_thematic  = Database::query($sql);
6500
                if (Database::num_rows($rs_thematic)) {
6501
                    $row_thematic = Database::fetch_array($rs_thematic);
6502
                    $thematic_id = $row_thematic['thematic_id'];
6503
6504
                    $sql = "SELECT session.id, session.name, user.username
6505
                            FROM $tbl_thematic t, $table_session session, $table_user user
6506
                            WHERE
6507
                              t.c_id = $course_id AND
6508
                              t.session_id = session.id AND
6509
                              session.id_coach = user.user_id AND
6510
                              t.id = $thematic_id";
6511
                    $recorset = Database::query($sql);
6512
                }
6513
            } else {
6514
                $sql = "SELECT session.id, session.name, user.username
6515
                          FROM $table_tool tool, $table_session session, $table_user user

main/lp/learnpath.class.php 2 locations

@@ 7493-7502 (lines=10) @@
7490
7491
        if ($id != 0 && is_array($extra_info)) {
7492
            $item_title = stripslashes($extra_info['title']);
7493
        } elseif (is_numeric($extra_info)) {
7494
            $sql = "SELECT thread_title as title FROM $tbl_forum
7495
                    WHERE c_id = $course_id AND thread_id = ".$extra_info;
7496
7497
            $result = Database::query($sql);
7498
            $row = Database::fetch_array($result);
7499
7500
            $item_title = $row['title'];
7501
            $item_description = '';
7502
        } else {
7503
            $item_title = '';
7504
            $item_description = '';
7505
        }
@@ 8551-8561 (lines=11) @@
8548
        if ($id != 0 && is_array($extra_info)) {
8549
            $item_title = stripslashes($extra_info['title']);
8550
            $item_description = stripslashes($extra_info['description']);
8551
        } elseif (is_numeric($extra_info)) {
8552
            $extra_info = intval($extra_info);
8553
            $sql = "SELECT title, description
8554
                    FROM $tbl_publication
8555
                    WHERE c_id = $course_id AND id = ".$extra_info;
8556
8557
            $result = Database::query($sql);
8558
            $row = Database::fetch_array($result);
8559
8560
            $item_title = $row['title'];
8561
        } else {
8562
            $item_title = get_lang('Student_publication');
8563
        }
8564