* In the second case, also some other information are taken into account form the DBpedia data: * Canonical name, year of death, gender and so on. * * In the third case, nothing from DBpedia is used at all. * * After checking DB pedia, the XML parser function is called and the result is put out. */ include '../fillform.php'; /* http://www.onlamp.com/pub/a/php/2006/03/16/autofill-forms.html?page=1 */ include_once "arc2/ARC2.php"; /* https://github.com/semsol/arc2 */ check_input(); set_article_ending_by_detecting_type_of_seminar(); check_input_with_DB_pedia_data(); $parsing_results = access_xml_for_title_and_text(); $output_string = prepare_output($parsing_results); output($output_string); function check_input() { if ($_GET['keyword'] == NULL) { $output_string = '<div class="error">'; $output_string .= 'Bitte Schlagwort eingeben.'; $output_string .= '</div>'; output($output_string); } } function set_article_ending_by_detecting_type_of_seminar() { $kind_of_seminar_safe = replace_dangerous_chars($_GET['kind_of_seminar']); switch ($kind_of_seminar_safe) { case 'Übung':
$encodes = array(); // url $url_encode = urlencode($query); if ($url_encode != $query) { $encodes["URL Encoded"] = $url_encode; } // HTML /*$html_encode = ''; $table = get_html_translation_table(HTML_ENTITIES); for ($i = 0, $l = sizeof($chars); $i < $l; $i++) { $html_encode .= $table[$chars[$i]] ? $table[$chars[$i]] : $chars[$i]; } $html_encode = htmlentities($html_encode, ENT_QUOTES, 'UTF-8', false);*/ $html_encode = htmlentities($query, ENT_QUOTES, 'UTF-8'); if ($html_encode != $query) { $encodes["HTML Encoded"] = $html_encode; } // base64 $base64_encode = base64_encode($query); if ($base64_encode != $query) { $encodes["base64 Encoded"] = $base64_encode; } $encodes = prepare_output($encodes); foreach ($encodes as $key => $value) { $w->result($key, $value, $value, $key, 'icon.png', 'yes'); } if (count($w->results()) == 0) { $w->result('encode', $query, 'Nothing useful resulted', 'The encoded strings were the same as your query', 'icon.png', 'yes'); } echo $w->toxml(); // ****************
$decodes = array(); // url $url_decode = urldecode($query); if ($url_decode != $query) { $decodes["URL Decoded"] = $url_decode; } // unicode $unicode_decode = preg_replace_callback('/\\\\u([0-9a-f]{4})/i', 'replace_unicode_escape_sequence', $query); if ($unicode_decode != $query) { $decodes["Unicode Decoded"] = $unicode_decode; } // HTML $html_decode = html_entity_decode($query, ENT_QUOTES, 'UTF-8'); if ($html_decode != $query) { $decodes["HTML Decoded"] = $html_decode; } // base64 $base64_decode = base64_decode($query, true); if ($base64_decode && $base64_decode != $query) { $decodes["base64 Decoded"] = $base64_decode; } //$dencodes["UTF-8 Decoded"] = utf8_decode($query); $decodes = prepare_output($decodes); foreach ($decodes as $key => $value) { $w->result($key, $value, $value, $key, 'icon.png', 'yes'); } if (count($w->results()) == 0) { $w->result('decode', $query, 'Nothing useful resulted', 'The decoded strings were the same as your query', 'icon.png', 'yes'); } echo $w->toxml(); // ****************