Rev 1130 | Rev 1138 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1130 | Rev 1131 | ||
---|---|---|---|
Line 21... | Line 21... | ||
21 | 21 | ||
22 | // phpcs:disable PSR1.Files.SideEffects |
22 | // phpcs:disable PSR1.Files.SideEffects |
23 | \defined('INSIDE_OIDPLUS') or die; |
23 | \defined('INSIDE_OIDPLUS') or die; |
24 | // phpcs:enable PSR1.Files.SideEffects |
24 | // phpcs:enable PSR1.Files.SideEffects |
25 | 25 | ||
26 | class OIDplusPagePublicAttachments extends OIDplusPagePluginPublic { |
26 | class OIDplusPagePublicAttachments extends OIDplusPagePluginPublic |
- | 27 | implements INTF_OID_1_3_6_1_4_1_37476_2_5_2_3_2, /* modifyContent */ |
|
- | 28 | INTF_OID_1_3_6_1_4_1_37476_2_5_2_3_3, /* beforeObject*, afterObject* */ |
|
- | 29 | INTF_OID_1_3_6_1_4_1_37476_2_5_2_3_4 /* whois*Attributes */ |
|
- | 30 | { |
|
27 | 31 | ||
28 | /** |
32 | /** |
29 | * |
33 | * |
30 | */ |
34 | */ |
31 | const DIR_UNLOCK_FILE = 'oidplus_upload.dir'; |
35 | const DIR_UNLOCK_FILE = 'oidplus_upload.dir'; |
Line 420... | Line 424... | ||
420 | $factor = floor((strlen("$bytes") - 1) / 3); |
424 | $factor = floor((strlen("$bytes") - 1) / 3); |
421 | return sprintf("%.{$decimals}f", $bytes / pow(1024, $factor)) . ' ' . @$size[$factor]; |
425 | return sprintf("%.{$decimals}f", $bytes / pow(1024, $factor)) . ' ' . @$size[$factor]; |
422 | } |
426 | } |
423 | 427 | ||
424 | /** |
428 | /** |
425 | * @param string $id |
- | |
426 | * @return bool |
- | |
427 | */ |
- | |
428 | public function implementsFeature(string $id): bool { |
- | |
429 | if (strtolower($id) == '1.3.6.1.4.1.37476.2.5.2.3.2') return true; // modifyContent |
- | |
430 | if (strtolower($id) == '1.3.6.1.4.1.37476.2.5.2.3.3') return true; // beforeObject*, afterObject* |
- | |
431 | if (strtolower($id) == '1.3.6.1.4.1.37476.2.5.2.3.4') return true; // whois*Attributes |
- | |
432 | return false; |
- | |
433 | } |
- | |
434 | - | ||
435 | /** |
- | |
436 | * Implements interface 1.3.6.1.4.1.37476.2.5.2.3.2 |
429 | * Implements interface INTF_OID_1_3_6_1_4_1_37476_2_5_2_3_2 |
437 | * @param string $id |
430 | * @param string $id |
438 | * @param string $title |
431 | * @param string $title |
439 | * @param string $icon |
432 | * @param string $icon |
440 | * @param string $text |
433 | * @param string $text |
441 | * @return void |
434 | * @return void |
Line 517... | Line 510... | ||
517 | '</div>'; |
510 | '</div>'; |
518 | if ($doshow) $text .= $output; |
511 | if ($doshow) $text .= $output; |
519 | } |
512 | } |
520 | 513 | ||
521 | /** |
514 | /** |
522 | * Implements interface 1.3.6.1.4.1.37476.2.5.2.3.3 |
515 | * Implements interface INTF_OID_1_3_6_1_4_1_37476_2_5_2_3_3 |
523 | * @param string $id |
516 | * @param string $id |
524 | * @return void |
517 | * @return void |
525 | */ |
518 | */ |
526 | public function beforeObjectDelete(string $id) {} |
519 | public function beforeObjectDelete(string $id) {} |
527 | 520 | ||
528 | /** |
521 | /** |
529 | * Delete the attachment folder including all files in it (note: Subfolders are not possible) |
- | |
530 | * Implements interface 1.3.6.1.4.1.37476.2.5.2.3.3 |
522 | * Implements interface INTF_OID_1_3_6_1_4_1_37476_2_5_2_3_3 |
531 | * @param string $id |
523 | * @param string $id |
532 | * @return void |
524 | * @return void |
533 | * @throws OIDplusException |
525 | * @throws OIDplusException |
534 | */ |
526 | */ |
535 | public function afterObjectDelete(string $id) { |
527 | public function afterObjectDelete(string $id) { |
- | 528 | // Delete the attachment folder including all files in it (note: Subfolders are not possible) |
|
536 | $uploaddir = self::getUploadDir($id); |
529 | $uploaddir = self::getUploadDir($id); |
537 | if ($uploaddir != '') { |
530 | if ($uploaddir != '') { |
538 | $ary = @glob($uploaddir . DIRECTORY_SEPARATOR . '*'); |
531 | $ary = @glob($uploaddir . DIRECTORY_SEPARATOR . '*'); |
539 | if ($ary) foreach ($ary as $a) @unlink($a); |
532 | if ($ary) foreach ($ary as $a) @unlink($a); |
540 | @rmdir($uploaddir); |
533 | @rmdir($uploaddir); |
Line 543... | Line 536... | ||
543 | } |
536 | } |
544 | } |
537 | } |
545 | } |
538 | } |
546 | 539 | ||
547 | /** |
540 | /** |
548 | * Implements interface 1.3.6.1.4.1.37476.2.5.2.3.3 |
541 | * Implements interface INTF_OID_1_3_6_1_4_1_37476_2_5_2_3_3 |
549 | * @param string $id |
542 | * @param string $id |
550 | * @param array $params |
543 | * @param array $params |
551 | * @return void |
544 | * @return void |
552 | */ |
545 | */ |
553 | public function beforeObjectUpdateSuperior(string $id, array &$params) {} |
546 | public function beforeObjectUpdateSuperior(string $id, array &$params) {} |
554 | 547 | ||
555 | /** |
548 | /** |
556 | * Implements interface 1.3.6.1.4.1.37476.2.5.2.3.3 |
549 | * Implements interface INTF_OID_1_3_6_1_4_1_37476_2_5_2_3_3 |
557 | * @param string $id |
550 | * @param string $id |
558 | * @param array $params |
551 | * @param array $params |
559 | * @return void |
552 | * @return void |
560 | */ |
553 | */ |
561 | public function afterObjectUpdateSuperior(string $id, array &$params) {} |
554 | public function afterObjectUpdateSuperior(string $id, array &$params) {} |
562 | 555 | ||
563 | /** |
556 | /** |
564 | * Implements interface 1.3.6.1.4.1.37476.2.5.2.3.3 |
557 | * Implements interface INTF_OID_1_3_6_1_4_1_37476_2_5_2_3_3 |
565 | * @param string $id |
558 | * @param string $id |
566 | * @param array $params |
559 | * @param array $params |
567 | * @return void |
560 | * @return void |
568 | */ |
561 | */ |
569 | public function beforeObjectUpdateSelf(string $id, array &$params) {} |
562 | public function beforeObjectUpdateSelf(string $id, array &$params) {} |
570 | 563 | ||
571 | /** |
564 | /** |
572 | * Implements interface 1.3.6.1.4.1.37476.2.5.2.3.3 |
565 | * Implements interface INTF_OID_1_3_6_1_4_1_37476_2_5_2_3_3 |
573 | * @param string $id |
566 | * @param string $id |
574 | * @param array $params |
567 | * @param array $params |
575 | * @return void |
568 | * @return void |
576 | */ |
569 | */ |
577 | public function afterObjectUpdateSelf(string $id, array &$params) {} |
570 | public function afterObjectUpdateSelf(string $id, array &$params) {} |
578 | 571 | ||
579 | /** |
572 | /** |
580 | * Implements interface 1.3.6.1.4.1.37476.2.5.2.3.3 |
573 | * Implements interface INTF_OID_1_3_6_1_4_1_37476_2_5_2_3_3 |
581 | * @param string $id |
574 | * @param string $id |
582 | * @param array $params |
575 | * @param array $params |
583 | * @return void |
576 | * @return void |
584 | */ |
577 | */ |
585 | public function beforeObjectInsert(string $id, array &$params) {} |
578 | public function beforeObjectInsert(string $id, array &$params) {} |
586 | 579 | ||
587 | /** |
580 | /** |
588 | * Implements interface 1.3.6.1.4.1.37476.2.5.2.3.3 |
581 | * Implements interface INTF_OID_1_3_6_1_4_1_37476_2_5_2_3_3 |
589 | * @param string $id |
582 | * @param string $id |
590 | * @param array $params |
583 | * @param array $params |
591 | * @return void |
584 | * @return void |
592 | */ |
585 | */ |
593 | public function afterObjectInsert(string $id, array &$params) {} |
586 | public function afterObjectInsert(string $id, array &$params) {} |
Line 599... | Line 592... | ||
599 | public function tree_search(string $request) { |
592 | public function tree_search(string $request) { |
600 | return false; |
593 | return false; |
601 | } |
594 | } |
602 | 595 | ||
603 | /** |
596 | /** |
604 | * Implements interface 1.3.6.1.4.1.37476.2.5.2.3.4 |
597 | * Implements interface INTF_OID_1_3_6_1_4_1_37476_2_5_2_3_4 |
605 | * @param string $id |
598 | * @param string $id |
606 | * @param array $out |
599 | * @param array $out |
607 | * @return void |
600 | * @return void |
608 | * @throws OIDplusException |
601 | * @throws OIDplusException |
609 | */ |
602 | */ |
Line 634... | Line 627... | ||
634 | } |
627 | } |
635 | 628 | ||
636 | } |
629 | } |
637 | 630 | ||
638 | /** |
631 | /** |
639 | * Implements interface 1.3.6.1.4.1.37476.2.5.2.3.4 |
632 | * Implements interface INTF_OID_1_3_6_1_4_1_37476_2_5_2_3_4 |
640 | * @param string $email |
633 | * @param string $email |
641 | * @param array $out |
634 | * @param array $out |
642 | * @return void |
635 | * @return void |
643 | */ |
636 | */ |
644 | public function whoisRaAttributes(string $email, array &$out) {} |
637 | public function whoisRaAttributes(string $email, array &$out) {} |