Subversion Repositories oidplus

Compare Revisions

Regard whitespace Rev 1467 → Rev 1468

/trunk/changelog.json.php
3,6 → 3,16
"dummy": "<?php die('For security reasons, this file can only be accessed locally (without PHP).'.base64_decode('IgogICAgfQpdCg==')); /* @phpstan-ignore-line */ ?>"
},
{
"version": "2.0.1.19",
"date": "2024-03-07 01:05:00 +0100",
"author": "Daniel Marschall (ViaThinkSoft)",
"changes": [
"Application Identifier (AID): VTS F4 02 (Ringgold) introduced.",
"Application Identifier (AID): VTS F4 03 (DOI) introduced.",
"Application Identifier (AID): VTS F7 01 (ISNI) changed definition."
]
},
{
"version": "2.0.1.18",
"date": "2024-03-07 02:05:00 +0100",
"author": "Daniel Marschall (ViaThinkSoft)",
/trunk/plugins/viathinksoft/adminPages/902_systemfile_check/checksums.json
Cannot display: file marked as a binary type.
svn:mime-type = application/json
/trunk/plugins/viathinksoft/language/dede/messages.xml
5350,6 → 5350,14
</message>
<message>
<source><![CDATA[
Open Researcher and Contributor ID (ORCID)
]]></source>
<target><![CDATA[
Open Researcher and Contributor ID (ORCID)
]]></target>
</message>
<message>
<source><![CDATA[
Open in new window
]]></source>
<target><![CDATA[
6798,6 → 6806,14
</message>
<message>
<source><![CDATA[
Ringgold ID
]]></source>
<target><![CDATA[
Ringgold ID
]]></target>
</message>
<message>
<source><![CDATA[
Root OID %1
]]></source>
<target><![CDATA[
8518,6 → 8534,14
</message>
<message>
<source><![CDATA[
Unknown ISNI compatible identifier
]]></source>
<target><![CDATA[
Unbekannter ISNI Kompatibler Bezeichner
]]></target>
</message>
<message>
<source><![CDATA[
Unknown SQL slang "%1"
]]></source>
<target><![CDATA[
/trunk/plugins/viathinksoft/objectTypes/aid/OIDplusAid.class.php
455,10 → 455,46
$pix = '';
}
if (($pix === '') && preg_match('/^[0-9]+$/',$duns,$m)) {
$duns = substr($duns,0,2).'-'.substr($duns,2,3).'-'.substr($duns,5);
$ids[] = new OIDplusAltId('duns', $duns, _L('Data Universal Numbering System (D-U-N-S)'));
}
}
 
// (VTS F4 02) Ringgold ID + PIX
// Resolve only if there is no PIX
if (str_starts_with($aid,'D276000186F402')) {
$rest = substr($aid,strlen('D276000186F402'));
$p = strpos($rest,'F');
if ($p !== false) {
$number = substr($rest,0,$p);
$pix = substr($rest,$p+1);
} else {
$number = $rest;
$pix = '';
}
if (($pix === '') && preg_match('/^[0-9]+$/',$number,$m)) {
$ids[] = new OIDplusAltId('rin', $number, _L('Ringgold ID'));
}
}
 
// (VTS F4 03) DOI + PIX
// Resolve only if there is no PIX
if (str_starts_with($aid,'D276000186F403')) {
$rest = substr($aid,strlen('D276000186F403'));
$p = strpos($rest,'F');
if ($p !== false) {
$number = substr($rest,0,$p);
$pix = substr($rest,$p+1);
} else {
$number = $rest;
$pix = '';
}
if (($pix === '') && preg_match('/^[0-9]+$/',$number,$m)) {
$doi = "10.$number";
$ids[] = new OIDplusAltId('doi', $doi, _L('Digital Object Identifier (DOI)'));
}
}
 
// (VTS F5) GS1 number + PIX
// Resolve only if there is no PIX
if (str_starts_with($aid,'D276000186F5')) {
493,20 → 529,30
}
}
 
// (VTS F7 01) ISNI + PIX
// (VTS F7 01 X) ISNI compatible + PIX
// Resolve only if there is no PIX
if (str_starts_with($aid,'D276000186F701')) {
$rest = substr($aid,strlen('D276000186F701'));
if (strlen($rest) >= 14) {
$isni_bin = substr($rest,0,14);
$pix = substr($rest,15);
$isni_subtype = substr($aid,strlen('D276000186F701'),1);
$rest = substr($aid,strlen('D276000186F701')+1);
if (strlen($rest) >= 13) {
$isni_bin = substr($rest,0,13);
$pix = substr($rest,14);
if (($pix === '') && preg_match('/^[A-F0-9]+$/',$isni_bin,$m)) {
// Example: "2386F26FC0FFFF" => "9999-9999-9999-9999"
$isni = rtrim(chunk_split(str_pad(self::base_convert_bigint($isni_bin,16,10),16,'0',STR_PAD_LEFT),4,'-'),'-');
// Example: "38D7EA4C67FFF" => "999999999999999"
$isni_no_checksum = self::base_convert_bigint($isni_bin,16,10);
$isni_dec = $isni_no_checksum . self::generateIsniCheckdigit($isni_no_checksum);
// Now format to "9999-9999-9999-9999"
$isni = rtrim(chunk_split(str_pad($isni_dec,16,'0',STR_PAD_LEFT),4,'-'),'-');
if ($isni_subtype == '1') {
$ids[] = new OIDplusAltId('isni', $isni, _L('International Standard Name Identifier (ISNI)'));
} else if ($isni_subtype == '2') {
$ids[] = new OIDplusAltId('orcid', $isni, _L('Open Researcher and Contributor ID (ORCID)'));
} else {
$ids[] = new OIDplusAltId('???', $isni, _L('Unknown ISNI compatible identifier'));
}
}
}
}
 
 
// 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)
516,6 → 562,23
}
 
/**
* Generates check digit as per ISO 7064 11,2.
*
*/
private static function generateIsniCheckdigit(string $baseDigits) {
$total = 0;
for ($i = 0; $i < strlen($baseDigits); $i++) {
$digit = (int)$baseDigits[$i];
$total = ($total + $digit) * 2;
}
$remainder = $total % 11;
$result = (12 - $remainder) % 11;
return $result == 10 ? "X" : $result;
}
//assert(generateIsniCheckdigit('000000010929605') == '3');
//asserr(generateIsniCheckdigit('000000012281955') == 'X');
 
/**
* @param string $numstring
* @param int $frombase
* @param int $tobase