/trunk/oid_utils.inc.phps |
---|
20,7 → 20,7 |
// All functions in this library are compatible with leading zeroes (not recommended) and leading dots |
// TODO: change some function names, so that they have a uniform naming schema, and rename "oid identifier" into "asn.1 alphanumeric identifier" |
// TODO: change some function names, so that they have a uniform naming schema, and rename "oid identifier" into "ASN.1 alphanumeric identifier" |
// oid_id_is_valid() => asn1_alpha_id_valid() |
define('OID_DOT_FORBIDDEN', 0); |
341,7 → 341,7 |
function sanitizeOID($oid, $leading_dot=false) { |
if ($leading_dot) $leading_dot = substr($oid,0,1) == '.'; |
// We are using a cache, since this function is used very often by OID+ |
// We are using a cache, since this function is used very often by OIDplus |
global $oid_sanitize_cache; |
$v = ($leading_dot ? 'T' : 'F').$oid; |
if (isset($oid_sanitize_cache[$v])) return $oid_sanitize_cache[$v]; |
813,7 → 813,7 |
// Clean up |
$count = -1; |
$asn = preg_replace('@^\\{(.+)\\}$@', '\\1', $asn, -1, $count); |
if ($count == 0) return false; // { and } are required. The asn.1 path will NOT be trimmed by this function |
if ($count == 0) return false; // { and } are required. The ASN.1 path will NOT be trimmed by this function |
// If identifier is set, apply it (no check if it overrides a standardized identifier) |
$asn = preg_replace('|\s*([a-z][a-zA-Z0-9-]*)\s*\((\d+)\)|', ' \\2', $asn); |
/trunk/oidinfo_api.inc.phps |
---|
606,7 → 606,7 |
$elements['iri'] = array($elements['iri']); |
} |
foreach ($elements['iri'] as &$iri) { |
// Numeric-only nicht erlauben. Das wäre ja nur in einem IRI-Pfad gültig, aber nicht als einzelner Identifier |
// Do not allow Numeric-only. It would only be valid in an IRI path, but not in a single identifier |
if (!iri_arc_valid($iri, false)) $iri = null; |
} |
} |
988,7 → 988,7 |
protected $connected = false; |
protected $socket = null; |
const SPP_MAX_CONNECTION_ATTEMPTS = 3; // TODO: Auslagern in OIDInfoAPI Klasse...? |
const SPP_MAX_CONNECTION_ATTEMPTS = 3; // TODO: Put into an OIDInfoAPI class...? |
const DEFAULT_PORT = 49500; |
1000,7 → 1000,7 |
$service_port = isset($ary[1]) ? $ary[1] : self::DEFAULT_PORT; |
$address = @gethostbyname($host); |
if ($address === false) { |
echo "gethostbyname() failed.\n"; // TODO: exceptions? (Auch alle "echos" darunter) |
echo "gethostbyname() failed.\n"; // TODO: exceptions? (also all "echos" below) |
return false; |
} |
$this->socket = @socket_create(AF_INET, SOCK_STREAM, SOL_TCP); |
/trunk/xml_utils.inc.phps |
---|
3,7 → 3,7 |
/* |
* XML Encoding Utilities |
* Copyright 2011-2020 Daniel Marschall, ViaThinkSoft |
* Version 1.7.1 |
* Version 1.7.2 (2020-12-06) |
* |
* Licensed under the Apache License, Version 2.0 (the "License"); |
* you may not use this file except in compliance with the License. |
33,7 → 33,7 |
} |
// get rid of existing entities else double-escape |
// DM 24.08.2016 Auskommentiert wegen oid+ xml export |
// DM 24.08.2016 Removed because of OIDplus 1.0 XML export |
// $str = html_entity_decode(stripslashes($str),ENT_QUOTES,'UTF-8'); |
$ar = preg_split('/(?<!^)(?!$)/u', $str); // return array of every multi-byte character |
55,7 → 55,7 |
if ($c == '=') $c = '='; |
if ($c == '"') $c = '"'; |
if ($c == ''') $c = '\''; |
if ($c == '&') $c = '&'; // DM 24.08.2016 Re-Aktiviert wegen oid+ xml export |
if ($c == '&') $c = '&'; // DM 24.08.2016 Re-added because OIDplus 1.0 XML export |
} |
if (!$encode_linebreaks) { |
141,6 → 141,10 |
} |
function html_named_to_numeric_entities($str) { |
if (!mb_detect_encoding($str, 'UTF-8', true)) $str = utf8_encode($str); |
return mb_htmlentities(decodeNamedEntities($str)); |
} |
if (!function_exists('decodeNamedEntities')) { |
function decodeNamedEntities($string) { |
// https://stackoverflow.com/questions/20406599/how-to-encode-for-entity-igrave-not-defined-error-in-xml-feed |
184,7 → 188,3 |
}, $string); |
} |
} |
if (!mb_detect_encoding($str, 'UTF-8', true)) $str = utf8_encode($str); |
return mb_htmlentities(decodeNamedEntities($str)); |
} |