Code Duplication    Length = 12-21 lines in 2 locations

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

@@ 1830-1850 (lines=21) @@
1827
    }
1828
1829
    // Search the filepath of all detected <a href> tags
1830
    if (sizeof($tag_list) > 0) {
1831
        $file_path_list = array();
1832
        $href_list = array();
1833
1834
        foreach ($tag_list as & $this_tag) {
1835
            /* Match case insensitive, the stuff between the two ~ :
1836
                a href = <exactly one quote><one or more non-quotes><exactly one ">
1837
                e.g. a href="www.google.be", A HREF =   "info.html"
1838
                to match ["] escape the " or else PHP interprets it
1839
                [\"]{1} --> matches exactly one "
1840
                +	1 or more (like * is 0 or more)
1841
                [\s]* matches whitespace
1842
                $matches contains captured subpatterns
1843
                the only one here is ([^\"]+) --> matches[1]
1844
            */
1845
            if (preg_match("~a href[\s]*=[\s]*[\"]{1}([^\"]+)[\"]{1}~i", $this_tag, $matches)) {
1846
                $file_path_list[] = $matches[1]; // older
1847
                $href_list[] = $matches[0]; // to also add target="_self"
1848
            }
1849
        }
1850
    }
1851
1852
    // Replace the original hyperlinks by the correct ones
1853
    for ($count = 0; $count < sizeof($href_list); $count++) {
@@ 1934-1945 (lines=12) @@
1931
1932
    // Search the filepath of parameter $param_name in all detected tags
1933
1934
    if (sizeof($tag_list) > 0) {
1935
        $file_path_list = array();
1936
        $href_list = array();
1937
1938
        foreach ($tag_list as & $this_tag) {
1939
            //Display::display_normal_message(htmlentities($this_tag)); //debug
1940
            if ( preg_match("~".$param_name."[\s]*=[\s]*[\"]{1}([^\"]+)[\"]{1}~i", $this_tag, $matches)) {
1941
                $file_path_list[] = $matches[1]; // older
1942
                $href_list[] = $matches[0]; // to also add target="_self"
1943
            }
1944
        }
1945
    }
1946
1947
    // Replace the original tags by the correct ones
1948