Subversion Repositories oidinfo_api

Compare Revisions

No changes between revisions

Regard whitespace Rev 26 → Rev 27

/trunk/oid_utils.inc.phps
2,8 → 2,8
 
/*
* OID-Utilities for PHP
* Copyright 2011-2021 Daniel Marschall, ViaThinkSoft
* Version 2021-09-23
* Copyright 2011-2022 Daniel Marschall, ViaThinkSoft
* Version 2022-01-07
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
333,14 → 333,15
* @version 2015-08-17
* @param string $oid<br/>
* An OID in dot notation.
* @param boolean $leading_dot<br/>
* @param mixed $leading_dot<br/>
* true: The OID is valid, if it contains a leading dot.<br/>
* false (default): The OID is valid, if it does not contain a leading dot.
* 'auto: Allow both
* @return string|false The OID without leading dots, or <code>false</code> if the OID is syntactically wrong.
**/
$oid_sanitize_cache = array();
function sanitizeOID($oid, $leading_dot=false) {
static $oid_sanitize_cache = array();
 
if ($leading_dot) $leading_dot = substr($oid,0,1) == '.';
 
// We are using a cache, since this function is used very often by OIDplus
362,7 → 363,7
continue;
}
 
if (!ctype_digit($a)) return false; // does contain something other than digits
if (!preg_match('@^(\\d+)$@', $a, $m)) return false; // does contain something other than digits
 
// strike leading zeroes
$a = preg_replace("@^0+@", '', $a);
/trunk/oidinfo_api.inc.phps
397,6 → 397,9
$desc = preg_replace("@ OID$@i", '', $desc);
$desc = preg_replace("@ OID Namespace$@i", '', $desc);
$desc = preg_replace("@^OID for @i", '', $desc);
$desc = preg_replace("@OID root$@i", '', $desc);
$desc = preg_replace("@Object Identifier$@i", '', $desc);
$desc = preg_replace("@^The @i", '', $desc);
 
$desc = rtrim($desc);
if ($ending_dot_policy == self::OIDINFO_CORRECT_DESC_ENFORCE_ENDING_DOT) {
405,6 → 408,9
$desc = preg_replace('@\\.$@', '', $desc);
}
 
// Required for XML importer of oid-info.com (E-Mail 09.12.2021)
$desc = str_replace('&amp;', '&amp;amp;', $desc);
 
return $desc;
}
 
/trunk/oidinfo_test.phps
34,6 → 34,6
assert($oa->illegalOID('2.25.340282366920938463463374607431768211455') === false);
assert($oa->illegalOID('2.25.340282366920938463463374607431768211456') === true);
 
assert($oa->strictCheckSyntax('0', false, true) === true);
assert($oa->strictCheckSyntax('1', false, true) === true);
assert($oa->strictCheckSyntax('(requesting)', false, true) === false);
assert($oa->strictCheckSyntax('0') === true);
assert($oa->strictCheckSyntax('1') === true);
assert($oa->strictCheckSyntax('(requesting)') === false);
/trunk/phpstan.neon.dist
0,0 → 1,13
parameters:
level: 5
fileExtensions:
- php
- phps
paths:
- .
excludePaths:
analyseAndScan:
- .phpstan.tmp
tmpDir: .phpstan.tmp
ignoreErrors:
- '#Call to function assert\(\) with false will always evaluate to false\.#'
/trunk/uuid_utils.inc.phps
2,8 → 2,8
 
/*
* UUID utils for PHP
* Copyright 2011 - 2021 Daniel Marschall, ViaThinkSoft
* Version 2021-05-21
* Copyright 2011 - 2022 Daniel Marschall, ViaThinkSoft
* Version 2022-01-06
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
162,7 → 162,7
 
if (function_exists('decode_mac')) {
echo "\nIn case that this Node ID is a MAC address, here is the interpretation of that MAC address:\n";
echo decode_mac($nodeid); /** @phpstan-ignore-line */
echo decode_mac($nodeid);
}
 
break;
220,7 → 220,7
 
if (function_exists('decode_mac')) {
echo "\nIn case that this Node ID is a MAC address, here is the interpretation of that MAC address:\n";
echo decode_mac($nodeid); /** @phpstan-ignore-line */
echo decode_mac($nodeid);
}
 
break;
293,7 → 293,7
function oid_to_uuid($oid) {
if (!is_uuid_oid($oid)) return false;
 
if ($oid[0] == '.') {
if (substr($oid,0,1) == '.') {
$oid = substr($oid, 1);
}
$ary = explode('.', $oid);
313,7 → 313,7
}
 
function is_uuid_oid($oid, $only_allow_root=false) {
if ($oid[0] == '.') $oid = substr($oid, 1); // remove leading dot
if (substr($oid,0,1) == '.') $oid = substr($oid, 1); // remove leading dot
 
$ary = explode('.', $oid);
 
485,7 → 485,8
}
} else {
// Linux
foreach (glob('/sys/class/net/'.'*'.'/address') as $x) {
$addresses = @glob('/sys/class/net/'.'*'.'/address');
foreach ($addresses as $x) {
if (!strstr($x,'/lo/')) {
$detected_mac = trim(file_get_contents($x));
return $detected_mac;
/trunk/.
Property changes:
Added: svn:ignore
+.phpstan.tmp
+