Code Duplication    Length = 15-16 lines in 2 locations

main/admin/skills_import.php 1 location

@@ 143-158 (lines=16) @@
140
 * @param string $file Path to the XML-file
141
 * @return array All userinformation read from the file
142
 */
143
function parse_xml_data($file)
144
{
145
    global $current_tag;
146
    global $current_value;
147
    global $skill;
148
    global $skills;
149
    $skills = array();
150
    $parser = xml_parser_create('UTF-8');
151
    xml_set_element_handler($parser, 'element_start', 'element_end');
152
    xml_set_character_data_handler($parser, 'character_data');
153
    xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, false);
154
    xml_parse($parser, api_utf8_encode_xml(file_get_contents($file)));
155
    xml_parser_free($parser);
156
157
	return $skills;
158
}
159
160
$this_section = SECTION_PLATFORM_ADMIN;
161
api_protect_admin_script(true);

main/gradebook/lib/GradebookUtils.php 1 location

@@ 607-621 (lines=15) @@
604
     * @param string $file Path to the XML-file
605
     * @return array All user information read from the file
606
     */
607
    public static function parse_xml_data($file)
608
    {
609
        global $current_tag;
610
        global $current_value;
611
        global $user;
612
        global $users;
613
        $users = array();
614
        $parser = xml_parser_create();
615
        xml_set_element_handler($parser, 'element_start', 'element_end');
616
        xml_set_character_data_handler($parser, "character_data");
617
        xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, false);
618
        xml_parse($parser, file_get_contents($file));
619
        xml_parser_free($parser);
620
        return $users;
621
    }
622
623
    /**
624
     * register user info about certificate