Rev 1459 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1459 | Rev 1466 | ||
---|---|---|---|
Line 440... | Line 440... | ||
440 | $vid_pid = substr($rest, 0, 4) . ':' . substr($rest, 4);; |
440 | $vid_pid = substr($rest, 0, 4) . ':' . substr($rest, 4);; |
441 | $ids[] = new OIDplusAltId('pci-vendor-product-id', $vid_pid, _L('PCI-SIG (pcisig.com)VendorID/ProductID')); |
441 | $ids[] = new OIDplusAltId('pci-vendor-product-id', $vid_pid, _L('PCI-SIG (pcisig.com)VendorID/ProductID')); |
442 | } |
442 | } |
443 | } |
443 | } |
444 | 444 | ||
445 | // (VTS F4) D-U-N-S number + PIX |
445 | // (VTS F4 01) D-U-N-S number + PIX |
446 | // Resolve only if there is no PIX |
446 | // Resolve only if there is no PIX |
447 | if (str_starts_with($aid,'D276000186F4')) { |
447 | if (str_starts_with($aid,'D276000186F401')) { |
448 | $rest = substr($aid,strlen('D276000186F4')); |
448 | $rest = substr($aid,strlen('D276000186F401')); |
449 | $p = strpos($rest,'F'); |
449 | $p = strpos($rest,'F'); |
450 | if ($p !== false) { |
450 | if ($p !== false) { |
451 | $duns = substr($rest,0,$p); |
451 | $duns = substr($rest,0,$p); |
452 | $pix = substr($rest,$p+1); |
452 | $pix = substr($rest,$p+1); |
453 | } else { |
453 | } else { |
Line 491... | Line 491... | ||
491 | $ids[] = new OIDplusAltId('oid', $oid, _L('Object Identifier (OID)')); |
491 | $ids[] = new OIDplusAltId('oid', $oid, _L('Object Identifier (OID)')); |
492 | } |
492 | } |
493 | } |
493 | } |
494 | } |
494 | } |
495 | 495 | ||
- | 496 | // (VTS F7 01) ISNI + PIX |
|
- | 497 | // Resolve only if there is no PIX |
|
- | 498 | if (str_starts_with($aid,'D276000186F701')) { |
|
- | 499 | $rest = substr($aid,strlen('D276000186F701')); |
|
- | 500 | if (strlen($rest) >= 14) { |
|
- | 501 | $isni_bin = substr($rest,0,14); |
|
- | 502 | $pix = substr($rest,15); |
|
- | 503 | if (($pix === '') && preg_match('/^[A-F0-9]+$/',$isni_bin,$m)) { |
|
- | 504 | // Example: "2386F26FC0FFFF" => "9999-9999-9999-9999" |
|
- | 505 | $isni = rtrim(chunk_split(str_pad(self::base_convert_bigint($isni_bin,16,10),16,'0',STR_PAD_LEFT),4,'-'),'-'); |
|
- | 506 | $ids[] = new OIDplusAltId('isni', $isni, _L('International Standard Name Identifier (ISNI)')); |
|
- | 507 | } |
|
- | 508 | } |
|
- | 509 | } |
|
- | 510 | ||
- | 511 | ||
496 | // The case E8... (Standard OID 1.0) doesn't need to be addressed here, because it is already shown in the AID decoder (and it is ambiguous since DER and PIX are mixed) |
512 | // The case E8... (Standard OID 1.0) doesn't need to be addressed here, because it is already shown in the AID decoder (and it is ambiguous since DER and PIX are mixed) |
497 | // TODO: If it has no pix, then resolve it !!! but how do we know if there is a PIX or a part ID ? |
513 | // TODO: If it has no pix, then resolve it !!! but how do we know if there is a PIX or a part ID ? |
498 | 514 | ||
499 | return $ids; |
515 | return $ids; |
500 | } |
516 | } |
501 | 517 | ||
502 | /** |
518 | /** |
- | 519 | * @param string $numstring |
|
- | 520 | * @param int $frombase |
|
- | 521 | * @param int $tobase |
|
- | 522 | * @return string |
|
- | 523 | */ |
|
- | 524 | protected static function base_convert_bigint(string $numstring, int $frombase, int $tobase): string { |
|
- | 525 | // TODO: put this (used here and in OID WeidConverter) to functions.inc.php ? |
|
- | 526 | ||
- | 527 | $frombase_str = ''; |
|
- | 528 | for ($i=0; $i<$frombase; $i++) { |
|
- | 529 | $frombase_str .= strtoupper(base_convert((string)$i, 10, 36)); |
|
- | 530 | } |
|
- | 531 | ||
- | 532 | $tobase_str = ''; |
|
- | 533 | for ($i=0; $i<$tobase; $i++) { |
|
- | 534 | $tobase_str .= strtoupper(base_convert((string)$i, 10, 36)); |
|
- | 535 | } |
|
- | 536 | ||
- | 537 | $length = strlen($numstring); |
|
- | 538 | $result = ''; |
|
- | 539 | $number = array(); |
|
- | 540 | for ($i = 0; $i < $length; $i++) { |
|
- | 541 | $number[$i] = stripos($frombase_str, $numstring[$i]); |
|
- | 542 | } |
|
- | 543 | do { // Loop until whole number is converted |
|
- | 544 | $divide = 0; |
|
- | 545 | $newlen = 0; |
|
- | 546 | for ($i = 0; $i < $length; $i++) { // Perform division manually (which is why this works with big numbers) |
|
- | 547 | $divide = $divide * $frombase + $number[$i]; |
|
- | 548 | if ($divide >= $tobase) { |
|
- | 549 | $number[$newlen++] = (int)($divide / $tobase); |
|
- | 550 | $divide = $divide % $tobase; |
|
- | 551 | } else if ($newlen > 0) { |
|
- | 552 | $number[$newlen++] = 0; |
|
- | 553 | } |
|
- | 554 | } |
|
- | 555 | $length = $newlen; |
|
- | 556 | $result = $tobase_str[$divide] . $result; // Divide is basically $numstring % $tobase (i.e. the new character) |
|
- | 557 | } |
|
- | 558 | while ($newlen != 0); |
|
- | 559 | ||
- | 560 | return $result; |
|
- | 561 | } |
|
- | 562 | ||
- | 563 | /** |
|
503 | * @return string |
564 | * @return string |
504 | */ |
565 | */ |
505 | public function getDirectoryName(): string { |
566 | public function getDirectoryName(): string { |
506 | if ($this->isRoot()) return $this->ns(); |
567 | if ($this->isRoot()) return $this->ns(); |
507 | return $this->ns().'_'.$this->nodeId(false); // safe, because there are only AIDs |
568 | return $this->ns().'_'.$this->nodeId(false); // safe, because there are only AIDs |