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

@@ 627-641 (lines=15) @@
624
     * @param string $file Path to the XML-file
625
     * @return array All user information read from the file
626
     */
627
    public static function parse_xml_data($file)
628
    {
629
        global $current_tag;
630
        global $current_value;
631
        global $user;
632
        global $users;
633
        $users = array();
634
        $parser = xml_parser_create();
635
        xml_set_element_handler($parser, 'element_start', 'element_end');
636
        xml_set_character_data_handler($parser, "character_data");
637
        xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, false);
638
        xml_parse($parser, file_get_contents($file));
639
        xml_parser_free($parser);
640
        return $users;
641
    }
642
643
    /**
644
     * register user info about certificate