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

@@ 558-572 (lines=15) @@
555
     * @param string $file Path to the XML-file
556
     * @return array All user information read from the file
557
     */
558
    public static function parse_xml_data($file)
559
    {
560
        global $current_tag;
561
        global $current_value;
562
        global $user;
563
        global $users;
564
        $users = array();
565
        $parser = xml_parser_create();
566
        xml_set_element_handler($parser, 'element_start', 'element_end');
567
        xml_set_character_data_handler($parser, "character_data");
568
        xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, false);
569
        xml_parse($parser, file_get_contents($file));
570
        xml_parser_free($parser);
571
        return $users;
572
    }
573
574
    /**
575
     * register user info about certificate