Code Duplication    Length = 11-16 lines in 5 locations

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

@@ 235-245 (lines=11) @@
232
	 * @param int The language id
233
	 * @return int The current type of terms and conditions
234
	 */
235
	public static function get_type_of_terms_and_conditions($legal_id, $language_id)
236
    {
237
		$legal_conditions_table = Database::get_main_table(TABLE_MAIN_LEGAL);
238
		$legal_id = intval($legal_id);
239
		$language_id = intval($language_id);
240
		$sql = 'SELECT type FROM '.$legal_conditions_table.'
241
		        WHERE legal_id="'.$legal_id.'" AND language_id="'.$language_id.'"';
242
		$rs = Database::query($sql);
243
244
		return Database::result($rs,0,'type');
245
	}
246
}
247

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

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

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

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