Code Duplication    Length = 20-20 lines in 2 locations

main/wiki/wiki.inc.php 2 locations

@@ 2770-2789 (lines=20) @@
2767
                WHERE c_id = $course_id AND ".$groupfilter.$condition_session."";
2768
        $allpages = Database::query($sql);
2769
2770
        while ($row = Database::fetch_array($allpages)) {
2771
            $total_words = $total_words + self::word_count($row['content']);
2772
            $total_links = $total_links + substr_count($row['content'], "href=");
2773
            $total_links_anchors = $total_links_anchors + substr_count($row['content'], 'href="#');
2774
            $total_links_mail = $total_links_mail + substr_count($row['content'], 'href="mailto');
2775
            $total_links_ftp = $total_links_ftp + substr_count($row['content'], 'href="ftp');
2776
            $total_links_irc = $total_links_irc + substr_count($row['content'], 'href="irc');
2777
            $total_links_news = $total_links_news + substr_count($row['content'], 'href="news');
2778
            $total_wlinks = $total_wlinks + substr_count($row['content'], "[[");
2779
            $total_images = $total_images + substr_count($row['content'], "<img");
2780
            $clean_total_flash = preg_replace('/player.swf/', ' ', $row['content']);
2781
            $total_flash = $total_flash + substr_count($clean_total_flash, '.swf"');
2782
            //.swf" end quotes prevent insert swf through flvplayer (is not counted)
2783
            $total_mp3 = $total_mp3 + substr_count($row['content'], ".mp3");
2784
            $total_flv_p = $total_flv_p + substr_count($row['content'], ".flv");
2785
            $total_flv = $total_flv_p / 5;
2786
            $total_youtube = $total_youtube + substr_count($row['content'], "http://www.youtube.com");
2787
            $total_multimedia = $total_multimedia + substr_count($row['content'], "video/x-msvideo");
2788
            $total_tables = $total_tables + substr_count($row['content'], "<table");
2789
        }
2790
2791
        // Check only last version of all pages (current page)
2792
        $sql = ' SELECT *, COUNT(*) AS TOTAL_PAGES, SUM(hits) AS TOTAL_VISITS_LV
@@ 2837-2856 (lines=20) @@
2834
                )';
2835
        $allpages = Database::query($sql);
2836
2837
        while ($row = Database::fetch_array($allpages)) {
2838
            $total_words_lv = $total_words_lv + self::word_count($row['content']);
2839
            $total_links_lv = $total_links_lv + substr_count($row['content'], "href=");
2840
            $total_links_anchors_lv = $total_links_anchors_lv + substr_count($row['content'], 'href="#');
2841
            $total_links_mail_lv = $total_links_mail_lv + substr_count($row['content'], 'href="mailto');
2842
            $total_links_ftp_lv = $total_links_ftp_lv + substr_count($row['content'], 'href="ftp');
2843
            $total_links_irc_lv = $total_links_irc_lv + substr_count($row['content'], 'href="irc');
2844
            $total_links_news_lv = $total_links_news_lv + substr_count($row['content'], 'href="news');
2845
            $total_wlinks_lv = $total_wlinks_lv + substr_count($row['content'], "[[");
2846
            $total_images_lv = $total_images_lv + substr_count($row['content'], "<img");
2847
            $clean_total_flash_lv = preg_replace('/player.swf/', ' ', $row['content']);
2848
            $total_flash_lv = $total_flash_lv + substr_count($clean_total_flash_lv, '.swf"');
2849
            //.swf" end quotes prevent insert swf through flvplayer (is not counted)
2850
            $total_mp3_lv = $total_mp3_lv + substr_count($row['content'], ".mp3");
2851
            $total_flv_p_lv = $total_flv_p_lv + substr_count($row['content'], ".flv");
2852
            $total_flv_lv = $total_flv_p_lv / 5;
2853
            $total_youtube_lv = $total_youtube_lv + substr_count($row['content'], "http://www.youtube.com");
2854
            $total_multimedia_lv = $total_multimedia_lv + substr_count($row['content'], "video/x-msvideo");
2855
            $total_tables_lv = $total_tables_lv + substr_count($row['content'], "<table");
2856
        }
2857
2858
        //Total pages edited at this time
2859
        $total_editing_now = 0;