Code Duplication    Length = 11-20 lines in 4 locations

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

@@ 299-309 (lines=11) @@
296
     * @param int $language_id
297
     * @return int The current type of terms and conditions
298
     */
299
    public static function get_type_of_terms_and_conditions($legal_id, $language_id)
300
    {
301
        $legal_conditions_table = Database::get_main_table(TABLE_MAIN_LEGAL);
302
        $legal_id = intval($legal_id);
303
        $language_id = intval($language_id);
304
        $sql = 'SELECT type FROM '.$legal_conditions_table.'
305
                WHERE id =  "'.$legal_id.'" AND language_id="'.$language_id.'"';
306
        $rs = Database::query($sql);
307
308
        return Database::result($rs, 0, 'type');
309
    }
310
311
    /**
312
     * @param int $userId

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

@@ 364-383 (lines=20) @@
361
     *
362
     * @return array
363
     */
364
    public static function get_list_invitation_of_friends_by_user_id($userId)
365
    {
366
        if (empty($userId)) {
367
            return [];
368
        }
369
370
        $tbl_message = Database::get_main_table(TABLE_MESSAGE);
371
        $sql = 'SELECT user_sender_id, send_date, title, content
372
                FROM '.$tbl_message.'
373
                WHERE
374
                    user_receiver_id = '.intval($userId).' AND
375
                    msg_status = '.MESSAGE_STATUS_INVITATION_PENDING;
376
        $res = Database::query($sql);
377
        $list = array();
378
        while ($row = Database::fetch_array($res, 'ASSOC')) {
379
            $list[] = $row;
380
        }
381
382
        return $list;
383
    }
384
385
    /**
386
     * Get invitation list sent by user

main/inc/lib/sub_language.class.php 1 location

@@ 98-109 (lines=12) @@
95
     * @param int $parent_id The parent id(Language father id)
96
     * @return array All information about language
97
     */
98
    public static function get_all_information_of_language($parent_id)
99
    {
100
        $table = Database::get_main_table(TABLE_MAIN_LANGUAGE);
101
        $sql = 'SELECT * FROM '.$table.' WHERE id = "'.intval($parent_id).'"';
102
        $rs = Database::query($sql);
103
        $all_information = array();
104
        while ($row = Database::fetch_array($rs, 'ASSOC')) {
105
            $all_information = $row;
106
        }
107
108
        return $all_information;
109
    }
110
111
    /**
112
     * Get all information of chamilo file

main/gradebook/lib/GradebookUtils.php 1 location

@@ 1309-1319 (lines=11) @@
1306
     * @param int $id
1307
     * @param float $weight
1308
     */
1309
    public static function updateEvaluationWeight($id, $weight)
1310
    {
1311
        $table_evaluation = Database::get_main_table(TABLE_MAIN_GRADEBOOK_EVALUATION);
1312
        $id = intval($id);
1313
        $evaluation = new Evaluation();
1314
        $evaluation->add_evaluation_log($id);
1315
        $sql = 'UPDATE '.$table_evaluation.'
1316
               SET weight = '."'".Database::escape_string($weight)."'".'
1317
               WHERE id = '.$id;
1318
        Database::query($sql);
1319
    }
1320
1321
    /**
1322
     *