Code Duplication    Length = 10-18 lines in 8 locations

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

@@ 24-40 (lines=17) @@
21
	 *
22
	 * @return String Blog Title
23
	 */
24
	public static function get_blog_title ($blog_id)
25
	{
26
	    $course_id = api_get_course_int_id();
27
28
		if (is_numeric($blog_id)) {
29
			$tbl_blogs = Database::get_course_table(TABLE_BLOGS);
30
31
			$sql = "SELECT blog_name
32
					FROM " . $tbl_blogs . "
33
					WHERE c_id = $course_id AND blog_id = " . intval($blog_id);
34
35
			$result = Database::query($sql);
36
			$blog = Database::fetch_array($result);
37
38
			return stripslashes($blog['blog_name']);
39
		}
40
	}
41
42
43
	/**
@@ 51-61 (lines=11) @@
48
	 *
49
	 * @return String Blog description
50
	 */
51
	public static function get_blog_subtitle($blog_id)
52
	{
53
		$tbl_blogs = Database::get_course_table(TABLE_BLOGS);
54
	  	$course_id = api_get_course_int_id();
55
		$sql = "SELECT blog_subtitle FROM $tbl_blogs
56
				WHERE c_id = $course_id AND blog_id ='".intval($blog_id)."'";
57
		$result = Database::query($sql);
58
		$blog = Database::fetch_array($result);
59
60
		return stripslashes($blog['blog_subtitle']);
61
	}
62
63
	/**
64
	 * Get the users of a blog

main/work/work.lib.php 1 location

@@ 4340-4356 (lines=17) @@
4337
 * @param int $item_id
4338
 * @param array $course_info
4339
 */
4340
function makeInvisible($item_id, $course_info)
4341
{
4342
    $work_table = Database :: get_course_table(TABLE_STUDENT_PUBLICATION);
4343
    $item_id = intval($item_id);
4344
    $course_id = $course_info['real_id'];
4345
    $sql = "UPDATE  " . $work_table . "
4346
            SET accepted = 0
4347
            WHERE c_id = $course_id AND id = '" . $item_id . "'";
4348
    Database::query($sql);
4349
    api_item_property_update(
4350
        $course_info,
4351
        'work',
4352
        $item_id,
4353
        'invisible',
4354
        api_get_user_id()
4355
    );
4356
}
4357
4358
/**
4359
 * @param int $item_id

main/group/group_space.php 1 location

@@ 382-398 (lines=17) @@
379
 * @author Patrick Cool <[email protected]>, Ghent University, Belgium
380
 * @version April 2008
381
 */
382
function get_number_of_group_users()
383
{
384
    global $current_group;
385
    $course_id = api_get_course_int_id();
386
387
    // Database table definition
388
    $table = Database :: get_course_table(TABLE_GROUP_USER);
389
390
    // Query
391
    $sql = "SELECT count(iid) AS number_of_users
392
            FROM ".$table."
393
            WHERE c_id = $course_id AND group_id='".intval($current_group['id'])."'";
394
    $result = Database::query($sql);
395
    $return = Database::fetch_array($result, 'ASSOC');
396
397
    return $return['number_of_users'];
398
}
399
400
/**
401
 * Get the details of the users in a group

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

@@ 4212-4221 (lines=10) @@
4209
    return $return;
4210
}
4211
4212
function api_get_language_info($language_id) {
4213
    $tbl_admin_languages = Database :: get_main_table(TABLE_MAIN_LANGUAGE);
4214
    $sql = 'SELECT * FROM '.$tbl_admin_languages.' WHERE id = "'.intval($language_id).'"';
4215
    $rs = Database::query($sql);
4216
    $language_info = array();
4217
    if (Database::num_rows($rs)) {
4218
        $language_info = Database::fetch_array($rs,'ASSOC');
4219
    }
4220
    return $language_info;
4221
}
4222
4223
/**
4224
 * Returns the name of the visual (CSS) theme to be applied on the current page.

main/survey/survey.lib.php 1 location

@@ 3651-3668 (lines=18) @@
3648
     * @author Patrick Cool <[email protected]>, Ghent University
3649
     * @version January 2007
3650
     */
3651
    public static function get_number_of_survey_invitations()
3652
    {
3653
        $course_id = api_get_course_int_id();
3654
3655
        // Database table definition
3656
        $table_survey_invitation = Database :: get_course_table(TABLE_SURVEY_INVITATION);
3657
3658
        $sql = "SELECT count(user) AS total
3659
		        FROM $table_survey_invitation
3660
		        WHERE
3661
                    c_id = $course_id AND
3662
                    survey_id='".intval($_GET['survey_id'])."' AND
3663
                    session_id='".api_get_session_id()."' ";
3664
        $res = Database::query($sql);
3665
        $row = Database::fetch_array($res,'ASSOC');
3666
3667
        return $row['total'];
3668
    }
3669
3670
    /**
3671
     * Save the invitation mail

main/inc/lib/TicketManager.php 1 location

@@ 1560-1574 (lines=15) @@
1557
     * @param int $ticket_id
1558
     * @param int $user_id
1559
     */
1560
    public static function send_alert($ticket_id, $user_id)
1561
    {
1562
        $table_support_tickets = Database::get_main_table(TABLE_TICKET_TICKET);
1563
        $now = api_get_utc_datetime();
1564
1565
        $ticket_id = intval($ticket_id);
1566
        $user_id = intval($user_id);
1567
1568
        $sql = "UPDATE $table_support_tickets SET
1569
                  priority_id = '".self::PRIORITY_HIGH."',
1570
                  sys_lastedit_user_id ='$user_id',
1571
                  sys_lastedit_datetime ='$now'
1572
                WHERE ticket_id = '$ticket_id'";
1573
        Database::query($sql);
1574
    }
1575
1576
    /**
1577
     * @param $ticket_id

main/forum/forumfunction.inc.php 1 location

@@ 5391-5401 (lines=11) @@
5388
 * @author Christian Fasanando
5389
 * @author Julio Montoya <[email protected]> Adding security
5390
 */
5391
function get_name_thread_by_id($thread_id)
5392
{
5393
    $t_forum_thread = Database::get_course_table(TABLE_FORUM_THREAD);
5394
    $course_id = api_get_course_int_id();
5395
    $sql = "SELECT thread_title FROM ".$t_forum_thread."
5396
            WHERE c_id = $course_id AND thread_id = '".intval($thread_id)."' ";
5397
    $result = Database::query($sql);
5398
    $row = Database::fetch_array($result);
5399
5400
    return $row[0];
5401
}
5402
5403
/**
5404
 * This function gets all the post written by an user