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

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