Subversion Repositories oidplus

Rev

Rev 1127 | Rev 1137 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1127 Rev 1130
Line 22... Line 22...
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
abstract class OIDplusObject extends OIDplusBaseClass {
26
abstract class OIDplusObject extends OIDplusBaseClass {
-
 
27
 
-
 
28
        /**
-
 
29
         *
-
 
30
         */
27
        const UUID_NAMEBASED_NS_OidPlusMisc = 'ad1654e6-7e15-11e4-9ef6-78e3b5fc7f22';
31
        const UUID_NAMEBASED_NS_OidPlusMisc = 'ad1654e6-7e15-11e4-9ef6-78e3b5fc7f22';
28
 
32
 
29
        /**
33
        /**
30
         * Please overwrite this function!
34
         * Please overwrite this function!
31
         * @param string $node_id
35
         * @param string $node_id
Line 467... Line 471...
467
                // if (count($dirs) == 0) return null; // default icon (folder)
471
                // if (count($dirs) == 0) return null; // default icon (folder)
468
                // $dir = substr($dirs[0], strlen(OIDplus::localpath()));
472
                // $dir = substr($dirs[0], strlen(OIDplus::localpath()));
469
                $reflection = new \ReflectionClass($this);
473
                $reflection = new \ReflectionClass($this);
470
                $dir = dirname($reflection->getFilename());
474
                $dir = dirname($reflection->getFilename());
471
                $dir = substr($dir, strlen(OIDplus::localpath()));
475
                $dir = substr($dir, strlen(OIDplus::localpath()));
-
 
476
                $dir = str_replace('\\', '/', $dir);
472
 
477
 
473
                if ($this->isRoot()) {
478
                if ($this->isRoot()) {
474
                        $icon = $dir . '/' . $this::treeIconFilename('root');
479
                        $icon = $dir . '/' . $this::treeIconFilename('root');
475
                } else {
480
                } else {
476
                        // We use $this:: instead of self:: , because we want to call the overridden methods
481
                        // We use $this:: instead of self:: , because we want to call the overridden methods
Line 666... Line 671...
666
        /**
671
        /**
667
         * @param OIDplusRA|string|null $ra
672
         * @param OIDplusRA|string|null $ra
668
         * @return bool
673
         * @return bool
669
         * @throws OIDplusException
674
         * @throws OIDplusException
670
         */
675
         */
671
        public function userHasParentalWriteRights($ra=null) {
676
        public function userHasParentalWriteRights($ra=null): bool {
672
                if ($ra instanceof OIDplusRA) $ra = $ra->raEmail();
677
                if ($ra instanceof OIDplusRA) $ra = $ra->raEmail();
673
 
678
 
674
                if (!$ra) {
679
                if (!$ra) {
675
                        if (OIDplus::authUtils()->isAdminLoggedIn()) return true;
680
                        if (OIDplus::authUtils()->isAdminLoggedIn()) return true;
676
                }
681
                }
Line 703... Line 708...
703
        public function distance($to)/*: ?int*/ {
708
        public function distance($to)/*: ?int*/ {
704
                return null; // not implemented
709
                return null; // not implemented
705
        }
710
        }
706
 
711
 
707
        /**
712
        /**
708
         * @param OIDplusObject $obj
713
         * @param OIDplusObject|string $obj
709
         * @return bool
714
         * @return bool
710
         */
715
         */
711
        public function equals(OIDplusObject $obj): bool {
716
        public function equals($obj): bool {
712
                if (!$obj) return false;
717
                if (!$obj) return false;
713
                if (!is_object($obj)) $obj = OIDplusObject::parse($obj);
718
                if (!is_object($obj)) $obj = OIDplusObject::parse($obj);
714
                if (!$obj) return false;
719
                if (!$obj) return false;
715
                if (!($obj instanceof $this)) return false;
720
                if (!($obj instanceof $this)) return false;
716
 
721