Code Duplication    Length = 17-23 lines in 3 locations

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

@@ 419-435 (lines=17) @@
416
     * @param string $full_text The full post text
417
     * @param int $blog_id The internal ID of the blog in which the post is located
418
     */
419
    public static function editPost($post_id, $title, $full_text, $blog_id)
420
    {
421
        $tbl_blogs_posts = Database::get_course_table(TABLE_BLOGS_POSTS);
422
        $course_id = api_get_course_int_id();
423
        $title = Database::escape_string($title);
424
        $full_text = Database::escape_string($full_text);
425
        $post_id = intval($post_id);
426
        $blog_id = intval($blog_id);
427
428
        // Create the post
429
        $sql = "UPDATE $tbl_blogs_posts SET
430
                title = '$title',
431
                full_text = '$full_text'
432
                WHERE c_id = $course_id AND post_id = $post_id AND blog_id = $blog_id
433
                LIMIT 1";
434
        Database::query($sql);
435
    }
436
437
    /**
438
     * Deletes an article and its comments

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

@@ 5501-5523 (lines=23) @@
5498
     * @param string $endDate
5499
     * @return array
5500
     */
5501
    public static function getCourseAccessPerCourseAndSession(
5502
        $courseId,
5503
        $sessionId,
5504
        $startDate,
5505
        $endDate
5506
    ) {
5507
        $table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_COURSE_ACCESS);
5508
        $courseId = intval($courseId);
5509
        $sessionId = intval($sessionId);
5510
        $startDate = Database::escape_string($startDate);
5511
        $endDate = Database::escape_string($endDate);
5512
5513
        $sql = "SELECT * FROM $table
5514
                WHERE
5515
                    c_id = $courseId AND
5516
                    session_id = $sessionId AND
5517
                    login_course_date BETWEEN '$startDate' AND '$endDate'
5518
                ";
5519
5520
        $result = Database::query($sql);
5521
5522
        return Database::store_result($result);
5523
    }
5524
5525
    /**
5526
     * Get login information from the track_e_course_access table, for any

main/survey/surveyUtil.class.php 1 location

@@ 2220-2238 (lines=19) @@
2217
     * @param string $surveyCode
2218
     * @return int
2219
     */
2220
    public static function invitationExists($courseId, $sessionId, $groupId, $surveyCode)
2221
    {
2222
        $table = Database::get_course_table(TABLE_SURVEY_INVITATION);
2223
        $courseId = intval($courseId);
2224
        $sessionId = intval($sessionId);
2225
        $groupId = intval($groupId);
2226
        $surveyCode = Database::escape_string($surveyCode);
2227
2228
        $sql = "SELECT survey_invitation_id FROM $table
2229
                WHERE
2230
                    c_id = $courseId AND
2231
                    session_id = $sessionId AND
2232
                    group_id = $groupId AND
2233
                    survey_code = '$surveyCode'
2234
                ";
2235
        $result = Database::query($sql);
2236
2237
        return Database::num_rows($result);
2238
    }
2239
2240
    /**
2241
     * Send the invitation by mail.