Code Duplication    Length = 7-8 lines in 3 locations

main/survey/fillsurvey.php 1 location

@@ 614-621 (lines=8) @@
611
                    WHERE c_id = $course_id AND survey_id = '".intval($survey_invitation['survey_id'])."'
612
                    ORDER BY sort ASC";
613
            $result = Database::query($sql);
614
            while ($row = Database::fetch_array($result, 'ASSOC')) {
615
                if ($row['type'] == 'pagebreak') {
616
                    $counter++;
617
                } else {
618
                    // ids from question of the current survey
619
                    $paged_questions[$counter][] = $row['question_id'];
620
                }
621
            }
622
            $_SESSION['paged_questions'] = $paged_questions;
623
        } else {
624
            $paged_questions = $_SESSION['paged_questions'];

main/survey/preview.php 1 location

@@ 134-140 (lines=7) @@
131
		$result = Database::query($sql);
132
        $questions_exists = true;
133
        if (Database::num_rows($result)) {
134
    		while ($row = Database::fetch_array($result)) {
135
    			if ($row['type'] == 'pagebreak') {
136
    				$counter++;
137
    			} else {
138
    				$paged_questions[$counter][] = $row['question_id'];
139
    			}
140
    		}
141
        } else {
142
            $questions_exists = false;
143
        }

main/forum/forumfunction.inc.php 1 location

@@ 1882-1888 (lines=7) @@
1879
    $result = Database::query($sql);
1880
    $list = array();
1881
    $alreadyAdded = array();
1882
    while ($row = Database::fetch_array($result, 'ASSOC')) {
1883
        if (in_array($row['thread_id'], $alreadyAdded)) {
1884
            continue;
1885
        }
1886
        $list[] = $row;
1887
        $alreadyAdded[] = $row['thread_id'];
1888
    }
1889
1890
    return $list;
1891
}