Subversion Repositories oidinfo_api

Compare Revisions

Regard whitespace Rev 12 → Rev 13

/trunk/oid_utils.inc.phps
3,7 → 3,7
/*
* OID-Utilities for PHP
* Copyright 2011-2020 Daniel Marschall, ViaThinkSoft
* Version 2020-06-11
* Version 2020-09-12
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
42,6 → 42,7
function oid_valid_dotnotation($oid, $allow_leading_zeroes=true, $allow_leading_dot=false, $min_len=0) {
$regex = oid_validation_regex($allow_leading_zeroes, $allow_leading_dot, $min_len);
 
$m = array();
return preg_match($regex, $oid, $m) ? true : false;
}
 
154,6 → 155,7
function parse_oids($text, $min_len=2, $allow_leading_zeroes=false, $leading_dot_policy=OID_DOT_OPTIONAL, $requires_whitespace_delimiters=true) {
$regex = oid_detection_regex($min_len, $allow_leading_zeroes, $leading_dot_policy, $requires_whitespace_delimiters);
 
$matches = array();
preg_match_all($regex, $text, $matches);
return $matches[1];
}
271,7 → 273,6
* @param $output_with_leading_dot (bool)<br />
* true: The array will be normalized to OIDs with a leading dot.
* false: The array will be normalized to OIDs without a leading dot. (default)
* @return Nothing
**/
function oidSort(&$ary, $output_with_leading_dot=false) {
$out = array();
577,6 → 578,7
function iri_arc_valid($arc, $allow_numeric=true) {
if ($arc == '') return false;
 
$m = array();
if ($allow_numeric && preg_match('@^(\\d+)$@', $arc, $m)) return true; # numeric arc
 
// Question: Should we strip RTL/LTR characters?
809,6 → 811,7
$standardized = asn1_get_standardized_array();
 
// 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
 
832,6 → 835,7
// -> invalid stuff will be recognized, e.g. a "(1)" without an identifier in front of it
$ary = explode('.', $asn);
foreach ($ary as $a) {
$m = array();
if (!preg_match('@^(0|([1-9]\\d*))$@', $a, $m)) return false;
}
 
/trunk/oidinfo_api.inc.phps
2,8 → 2,8
 
/*
* OID-Info.com API for PHP
* Copyright 2019 Daniel Marschall, ViaThinkSoft
* Version 2019-11-06
* Copyright 2019-2020 Daniel Marschall, ViaThinkSoft
* Version 2020-09-12
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
313,6 → 313,7
// TODO: what do we do if there are more XHTML errors (e.g. additional open tags) which would make the XML invalid?
 
// "Trim" <br/>
$count = 0;
do { $desc = preg_replace('@^\s*<\s*br\s*/{0,1}\s*>@isU', '', $desc, -1, $count); } while ($count > 0); // left trim
do { $desc = preg_replace('@<\s*br\s*/{0,1}\s*>\s*$@isU', '', $desc, -1, $count); } while ($count > 0); // right trim
 
543,6 → 544,7
 
// Request by O.D. 26 August 2019
$elements['description'] = trim($elements['description']);
$m = array();
if (preg_match('@^[a-z]@', $elements['description'], $m)) {
$ending_dot_policy = self::OIDINFO_CORRECT_DESC_DISALLOW_ENDING_DOT; // for description
if (($ending_dot_policy != self::OIDINFO_CORRECT_DESC_ENFORCE_ENDING_DOT) && (strpos($elements['description'], ' ') === false)) { // <-- added by DM
923,7 → 925,7
}
 
$one_null = false;
foreach ($this->simplePingProviders as $addr => $obj) {
foreach ($this->simplePingProviders as /*$addr =>*/ $obj) {
$res = $obj->queryOID($oid);
if ($res) return true;
if ($res !== false) $one_null = true;
969,7 → 971,7
}
$filemtime = filemtime($this->csvfile);
if ($filemtime != $this->filemtime) {
$this->lines = file($csvfile);
$this->lines = file($this->csvfile);
$this->filemtime = $filemtime;
}
}
/trunk/uuid_utils.inc.phps
3,7 → 3,7
/*
* UUID utils for PHP
* Copyright 2011-2020 Daniel Marschall, ViaThinkSoft
* Version 2020-02-28
* Version 2020-09-12
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
365,6 → 365,7
 
# On Debian: aptitude install uuid-runtime
$out = array();
$ec = -1;
exec('uuidgen -t', $out, $ec);
if ($ec == 0) return $out[0];
 
427,6 → 428,7
 
# On Debian: aptitude install uuid-runtime
$out = array();
$ec = -1;
exec('uuidgen -r', $out, $ec);
if ($ec == 0) return $out[0];