Code Duplication    Length = 7-7 lines in 3 locations

index.php 1 location

@@ 101-107 (lines=7) @@
98
                                WHERE login_user_id = '".$_user['user_id']."'
99
                                ORDER BY login_date DESC LIMIT 1";
100
        $result_last_login = Database::query($sql_last_login);
101
        if (!$result_last_login) {
102
            if (Database::num_rows($result_last_login) > 0) {
103
                $user_last_login_datetime = Database::fetch_array($result_last_login);
104
                $user_last_login_datetime = $user_last_login_datetime[0];
105
                Session::write('user_last_login_datetime',$user_last_login_datetime);
106
            }
107
        }
108
        //Event::event_login();
109
    }
110
    // End login -- if ($_POST['submitAuth'])

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

@@ 2364-2370 (lines=7) @@
2361
		$result = Database::query($sql);
2362
2363
		// We will create an array of days on which there are posts.
2364
		if( Database::num_rows($result) > 0) {
2365
			while($blog_post = Database::fetch_array($result)) {
2366
				// If the day of this post is not yet in the array, add it.
2367
				if (!in_array($blog_post['post_day'], $posts))
2368
					$posts[] = $blog_post['post_day'];
2369
			}
2370
		}
2371
2372
		// Get tasks for this month
2373
		if ($_user['user_id']) {

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

@@ 796-802 (lines=7) @@
793
                $group_table = Database::get_course_table(TABLE_GROUP);
794
                $sql = "SELECT * FROM $group_table WHERE c_id = " . $_course['real_id'] . " AND id = '$group_id'";
795
                $result = Database::query($sql);
796
                if (Database::num_rows($result) > 0) { // This group has recorded status related to this course
797
                    $gpData = Database::fetch_array($result);
798
                    $_gid = $gpData ['id'];
799
                    Session::write('_gid', $_gid);
800
                } else {
801
                    Session::erase('_gid');
802
                }
803
            } elseif (isset($_SESSION['_gid']) or isset($_gid)) { // Keys missing => not anymore in the group - course relation
804
                Session::erase('_gid');
805
            }