Rev 953 | Rev 955 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 953 | Rev 954 | ||
---|---|---|---|
Line 463... | Line 463... | ||
463 | 463 | ||
464 | private function tryObject($id, &$out) { |
464 | private function tryObject($id, &$out) { |
465 | $parent = null; |
465 | $parent = null; |
466 | $res = null; |
466 | $res = null; |
467 | $row = null; |
467 | $row = null; |
468 | $matches_any_registered_type = false; |
- | |
469 | foreach (OIDplus::getEnabledObjectTypes() as $ot) { |
- | |
470 | try { |
- | |
471 | $obj = OIDplusObject::parse($id); |
468 | $obj = OIDplusObject::parse($id); |
472 | } catch (Exception $e) { |
- | |
473 | $obj = null; |
- | |
474 | } |
- | |
475 | if (!is_null($obj)) { |
469 | if (is_null($obj)) return false; |
476 | $matches_any_registered_type = true; |
- | |
477 | if ($obj->isRoot()) { |
470 | if ($obj->isRoot()) { |
478 | $obj->getContentPage($out['title'], $out['text'], $out['icon']); |
471 | $obj->getContentPage($out['title'], $out['text'], $out['icon']); |
479 | $parent = null; // $obj->getParent(); |
472 | $parent = null; // $obj->getParent(); |
480 | break; |
- | |
481 | } else { |
473 | } else { |
482 | $res = OIDplus::db()->query("select * from ###objects where id = ?", array($obj->nodeId())); |
474 | $res = OIDplus::db()->query("select * from ###objects where id = ?", array($obj->nodeId())); |
483 | if (!$res->any()) { |
475 | if (!$res->any()) { |
484 | return false; |
476 | return false; |
485 | } else { |
477 | } else { |
486 | $row = $res->fetch_array(); // will be used further down the code |
478 | $row = $res->fetch_array(); // will be used further down the code |
487 | $obj->getContentPage($out['title'], $out['text'], $out['icon']); |
479 | $obj->getContentPage($out['title'], $out['text'], $out['icon']); |
488 | if (empty($out['title'])) $out['title'] = explode(':',$obj->nodeId(),2)[1]; |
480 | if (empty($out['title'])) $out['title'] = explode(':',$obj->nodeId(),2)[1]; |
489 | $parent = $obj->getParent(); |
481 | $parent = $obj->getParent(); |
490 | break; |
- | |
491 | } |
482 | } |
492 | } |
483 | } |
493 | } |
- | |
494 | } |
- | |
495 | if (!$matches_any_registered_type) return false; |
- | |
496 | return array($parent, $res, $row); |
484 | return array($parent, $res, $row); |
497 | } |
485 | } |
498 | 486 | ||
499 | private static function getAlternativesForQuery($id) { |
487 | private static function getAlternativesForQuery($id) { |
500 | // e.g. used for "Reverse Alt Id" |
488 | // e.g. used for "Reverse Alt Id" |
Line 724... | Line 712... | ||
724 | 'id' => $ot::root(), |
712 | 'id' => $ot::root(), |
725 | 'icon' => $icon, |
713 | 'icon' => $icon, |
726 | 'text' => $ot::objectTypeTitle() |
714 | 'text' => $ot::objectTypeTitle() |
727 | ); |
715 | ); |
728 | 716 | ||
729 | try { |
- | |
730 | $tmp = OIDplusObject::parse($req_goto); |
717 | $tmp = OIDplusObject::parse($req_goto); |
731 | } catch (Exception $e) { |
- | |
732 | $tmp = null; |
- | |
733 | } |
- | |
734 | if (!is_null($tmp) && ($ot == get_class($tmp))) { |
718 | if (!is_null($tmp) && ($ot == get_class($tmp))) { |
735 | // TODO: Instead of just having 3 levels (parent, this and children), it would be better if we'd had a full tree of all parents |
719 | // TODO: Instead of just having 3 levels (parent, this and children), it would be better if we'd had a full tree of all parents |
736 | // on the other hand, for giving search engines content, this is good enough |
720 | // on the other hand, for giving search engines content, this is good enough |
737 | if (empty($parent)) { |
721 | if (empty($parent)) { |
738 | $res = OIDplus::db()->query("select * from ###objects where " . |
722 | $res = OIDplus::db()->query("select * from ###objects where " . |