Rev 24 | Rev 27 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 24 | Rev 26 | ||
---|---|---|---|
Line 1... | Line 1... | ||
1 | <?php |
1 | <?php |
2 | 2 | ||
3 | /* |
3 | /* |
4 | * OID-Info.com API for PHP |
4 | * OID-Info.com API for PHP |
5 | * Copyright 2019-2021 Daniel Marschall, ViaThinkSoft |
5 | * Copyright 2019-2021 Daniel Marschall, ViaThinkSoft |
6 | * Version 2021-11-24 |
6 | * Version 2021-12-08 |
7 | * |
7 | * |
8 | * Licensed under the Apache License, Version 2.0 (the "License"); |
8 | * Licensed under the Apache License, Version 2.0 (the "License"); |
9 | * you may not use this file except in compliance with the License. |
9 | * you may not use this file except in compliance with the License. |
10 | * You may obtain a copy of the License at |
10 | * You may obtain a copy of the License at |
11 | * |
11 | * |
Line 506... | Line 506... | ||
506 | if (!isset($params['auto_extract_url'])) $params['auto_extract_url'] = ''; |
506 | if (!isset($params['auto_extract_url'])) $params['auto_extract_url'] = ''; |
507 | if (!isset($params['always_output_comment'])) $params['always_output_comment'] = false; // Also output comment if there was an error (e.g. OID already existing) |
507 | if (!isset($params['always_output_comment'])) $params['always_output_comment'] = false; // Also output comment if there was an error (e.g. OID already existing) |
508 | if (!isset($params['creation_allowed_check'])) $params['creation_allowed_check'] = true; |
508 | if (!isset($params['creation_allowed_check'])) $params['creation_allowed_check'] = true; |
509 | if (!isset($params['tolerant_htmlentities'])) $params['tolerant_htmlentities'] = true; |
509 | if (!isset($params['tolerant_htmlentities'])) $params['tolerant_htmlentities'] = true; |
510 | if (!isset($params['ignore_xhtml_light'])) $params['ignore_xhtml_light'] = false; |
510 | if (!isset($params['ignore_xhtml_light'])) $params['ignore_xhtml_light'] = false; |
- | 511 | if (!isset($params['show_errors'])) $params['show_errors'] = true; |
|
511 | 512 | ||
512 | return $params; |
513 | return $params; |
513 | } |
514 | } |
514 | public function createXMLEntry($oid, $elements, $params, $comment='') { |
515 | public function createXMLEntry($oid, $elements, $params, $comment='') { |
515 | $params = $this->init_params($params); |
516 | $params = $this->init_params($params); |
Line 532... | Line 533... | ||
532 | } |
533 | } |
533 | 534 | ||
534 | $bak_oid = $oid; |
535 | $bak_oid = $oid; |
535 | $oid = self::trySanitizeOID($oid); |
536 | $oid = self::trySanitizeOID($oid); |
536 | if ($oid === false) { |
537 | if ($oid === false) { |
537 | fwrite(STDOUT/*STDERR*/,"<!-- ERROR: Ignored '$bak_oid', because it is not a valid OID -->\n"); |
538 | if ($params['show_errors']) fwrite(STDOUT/*STDERR*/,"<!-- ERROR: Ignored '$bak_oid', because it is not a valid OID -->\n"); |
538 | return $err; |
539 | return $err; |
539 | } |
540 | } |
540 | 541 | ||
541 | if ($params['creation_allowed_check']) { |
542 | if ($params['creation_allowed_check']) { |
542 | if (!$this->oidMayCreate($oid, $params['do_online_check'], $params['do_simpleping_check'], $params['do_illegality_check'])) { |
543 | if (!$this->oidMayCreate($oid, $params['do_online_check'], $params['do_simpleping_check'], $params['do_illegality_check'])) { |
543 | fwrite(STDOUT/*STDERR*/,"<!-- ERROR: Creation of $oid disallowed -->\n"); |
544 | if ($params['show_errors']) fwrite(STDOUT/*STDERR*/,"<!-- ERROR: Creation of $oid disallowed -->\n"); |
544 | return $err; |
545 | return $err; |
545 | } |
546 | } |
546 | } else { |
547 | } else { |
547 | if ($params['do_illegality_check'] && ($this->illegalOid($oid))) { |
548 | if ($params['do_illegality_check'] && ($this->illegalOid($oid))) { |
548 | fwrite(STDOUT/*STDERR*/,"<!-- ERROR: Creation of $oid disallowed -->\n"); |
549 | if ($params['show_errors']) fwrite(STDOUT/*STDERR*/,"<!-- ERROR: Creation of $oid disallowed -->\n"); |
549 | return $err; |
550 | return $err; |
550 | } |
551 | } |
551 | } |
552 | } |
552 | 553 | ||
- | 554 | if (!isset($elements['description'])) $elements['description'] = ''; |
|
- | 555 | if (!isset($elements['information'])) $elements['information'] = ''; |
|
- | 556 | ||
553 | $elements['description'] = $this->correctDesc($elements['description'], $params, self::OIDINFO_CORRECT_DESC_DISALLOW_ENDING_DOT, true); |
557 | $elements['description'] = $this->correctDesc($elements['description'], $params, self::OIDINFO_CORRECT_DESC_DISALLOW_ENDING_DOT, true); |
554 | $elements['information'] = $this->correctDesc($elements['information'], $params, self::OIDINFO_CORRECT_DESC_ENFORCE_ENDING_DOT, true); |
558 | $elements['information'] = $this->correctDesc($elements['information'], $params, self::OIDINFO_CORRECT_DESC_ENFORCE_ENDING_DOT, true); |
555 | 559 | ||
556 | // Request by O.D. 26 August 2019 |
560 | // Request by O.D. 26 August 2019 |
557 | $elements['description'] = trim($elements['description']); |
561 | $elements['description'] = trim($elements['description']); |