Code Duplication    Length = 11-16 lines in 5 locations

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

@@ 271-281 (lines=11) @@
268
	 * @param int $language_id
269
	 * @return int The current type of terms and conditions
270
	 */
271
	public static function get_type_of_terms_and_conditions($legal_id, $language_id)
272
    {
273
		$legal_conditions_table = Database::get_main_table(TABLE_MAIN_LEGAL);
274
		$legal_id = intval($legal_id);
275
		$language_id = intval($language_id);
276
		$sql = 'SELECT type FROM '.$legal_conditions_table.'
277
		        WHERE id =  "'.$legal_id.'" AND language_id="'.$language_id.'"';
278
		$rs = Database::query($sql);
279
280
		return Database::result($rs,0,'type');
281
	}
282
283
    /**
284
     * @param int $userId

main/inc/lib/social.lib.php 2 locations

@@ 272-287 (lines=16) @@
269
     * @param int user id
270
     * @return array
271
     */
272
    public static function get_list_invitation_of_friends_by_user_id($user_id)
273
    {
274
        $tbl_message = Database::get_main_table(TABLE_MESSAGE);
275
        $sql = 'SELECT user_sender_id, send_date, title, content
276
                FROM '.$tbl_message.'
277
                WHERE
278
                    user_receiver_id = '.intval($user_id).' AND
279
                    msg_status = '.MESSAGE_STATUS_INVITATION_PENDING;
280
        $res = Database::query($sql);
281
        $list_friend_invitation = array();
282
        while ($row = Database::fetch_array($res, 'ASSOC')) {
283
            $list_friend_invitation[] = $row;
284
        }
285
286
        return $list_friend_invitation;
287
    }
288
289
    /**
290
     * Get invitation list sent by user
@@ 295-310 (lines=16) @@
292
     * @param int user id
293
     * @return array()
294
     */
295
    public static function get_list_invitation_sent_by_user_id($user_id)
296
    {
297
        $list_friend_invitation = array();
298
        $tbl_message = Database::get_main_table(TABLE_MESSAGE);
299
        $sql = 'SELECT user_receiver_id, send_date,title,content
300
                FROM '.$tbl_message.'
301
                WHERE
302
                    user_sender_id = '.intval($user_id).' AND
303
                    msg_status = '.MESSAGE_STATUS_INVITATION_PENDING;
304
        $res = Database::query($sql);
305
        while ($row = Database::fetch_array($res, 'ASSOC')) {
306
            $list_friend_invitation[$row['user_receiver_id']] = $row;
307
        }
308
309
        return $list_friend_invitation;
310
    }
311
312
    /**
313
     * Accepts invitation

main/inc/lib/sub_language.class.php 2 locations

@@ 75-89 (lines=15) @@
72
     * @param Integer The sub language id
73
     * @return array All information about sub-language
74
     */
75
    public static function get_all_information_of_sub_language($parent_id, $sub_language_id)
76
    {
77
        $table = Database :: get_main_table(TABLE_MAIN_LANGUAGE);
78
        $sql = 'SELECT * FROM ' . $table . '
79
                WHERE
80
                    parent_id= ' . intval($parent_id).' AND
81
                    id= ' . intval($sub_language_id) . '';
82
        $rs = Database::query($sql);
83
        $all_information = array();
84
        while ($row = Database::fetch_array($rs, 'ASSOC')) {
85
            $all_information = $row;
86
        }
87
88
        return $all_information;
89
    }
90
91
    /**
92
     * Get all information of language
@@ 96-107 (lines=12) @@
93
     * @param Integer The parent id(Language father id)
94
     * @return array All information about language
95
     */
96
    public static function get_all_information_of_language($parent_id)
97
    {
98
        $table = Database :: get_main_table(TABLE_MAIN_LANGUAGE);
99
        $sql = 'SELECT * FROM ' . $table . ' WHERE id = "' . intval($parent_id) . '"';
100
        $rs = Database::query($sql);
101
        $all_information = array();
102
        while ($row = Database::fetch_array($rs, 'ASSOC')) {
103
            $all_information = $row;
104
        }
105
106
        return $all_information;
107
    }
108
109
    /**
110
     * Get all information of chamilo file