/trunk/includes/classes/OIDplusMenuUtils.class.php |
---|
109,7 → 109,14 |
} |
} |
public static function tree_populate($parent, $goto_path=null) { |
/** |
* @param $parent |
* @param $goto_path |
* @return array |
* @throws OIDplusConfigInitializationException |
* @throws OIDplusException |
*/ |
public static function tree_populate($parent, $goto_path=null): array { |
$children = array(); |
$parentObj = OIDplusObject::parse($parent); |
129,6 → 136,7 |
$res = OIDplus::db()->query("select * from ###objects where parent = ? order by ".OIDplus::db()->natOrder('id'), array($parent)); |
while ($row = $res->fetch_array()) { |
$obj = OIDplusObject::parse($row['id']); |
if (!$obj) continue; // e.g. object-type plugin disabled |
if (!$obj->userHasReadRights()) continue; |
136,7 → 144,7 |
$child['id'] = $row['id']; |
// Determine display name (relative OID) |
$child['text'] = $obj->jsTreeNodeName($parentObj); |
$child['text'] = $parentObj ? $obj->jsTreeNodeName($parentObj) : ''; |
$child['text'] .= empty($row['title']) ? /*' -- <i>'.htmlentities('Title missing').'</i>'*/ '' : ' -- <b>' . htmlentities($row['title']) . '</b>'; |
$is_confidential = false; |
/trunk/includes/classes/OIDplusObject.class.php |
---|
227,7 → 227,7 |
"order by ".OIDplus::db()->natOrder('oChild.id')); |
while ($row = $res->fetch_array()) { |
if (!OIDplus::authUtils()->isRaLoggedIn($row['parent_mail']) && OIDplus::authUtils()->isRaLoggedIn($row['child_mail'])) { |
$x = self::parse($row['id']); // can be FALSE if namespace was disabled |
$x = self::parse($row['id']); // can be NULL if namespace was disabled |
if ($x) $out[] = $x; |
} |
} |
239,7 → 239,7 |
" (oParent.ra_email is null and ".OIDplus::db()->getSlang()->isNullFunction('oChild.ra_email',"''")." = ?) ". |
"order by ".OIDplus::db()->natOrder('oChild.id'), array($ra, $ra, $ra)); |
while ($row = $res->fetch_array()) { |
$x = self::parse($row['id']); // can be FALSE if namespace was disabled |
$x = self::parse($row['id']); // can be NULL if namespace was disabled |
if ($x) $out[] = $x; |
} |
} |
695,7 → 695,9 |
* @return bool |
*/ |
public function equals(OIDplusObject $obj): bool { |
if (!$obj) return false; |
if (!is_object($obj)) $obj = OIDplusObject::parse($obj); |
if (!$obj) return false; |
if (!($obj instanceof $this)) return false; |
$distance = $this->distance($obj); |
/trunk/plugins/viathinksoft/objectTypes/aid/OIDplusAid.class.php |
---|
277,6 → 277,7 |
*/ |
public function distance($to) { |
if (!is_object($to)) $to = OIDplusObject::parse($to); |
if (!$to) return null; |
if (!($to instanceof $this)) return null; |
$a = $to->aid; |
/trunk/plugins/viathinksoft/objectTypes/doi/OIDplusDoi.class.php |
---|
230,6 → 230,7 |
*/ |
public function distance($to) { |
if (!is_object($to)) $to = OIDplusObject::parse($to); |
if (!$to) return null; |
if (!($to instanceof $this)) return null; |
$a = $to->doi; |
/trunk/plugins/viathinksoft/objectTypes/domain/OIDplusDomain.class.php |
---|
206,6 → 206,7 |
*/ |
public function distance($to) { |
if (!is_object($to)) $to = OIDplusObject::parse($to); |
if (!$to) return null; |
if (!($to instanceof $this)) return null; |
$a = $to->domain; |
/trunk/plugins/viathinksoft/objectTypes/gs1/OIDplusGs1.class.php |
---|
289,6 → 289,7 |
*/ |
public function distance($to) { |
if (!is_object($to)) $to = OIDplusObject::parse($to); |
if (!$to) return null; |
if (!($to instanceof $this)) return null; |
// This is pretty tricky, because the whois service should accept GS1 numbers with and without checksum |
/trunk/plugins/viathinksoft/objectTypes/ipv4/OIDplusIpv4.class.php |
---|
247,6 → 247,7 |
*/ |
public function distance($to) { |
if (!is_object($to)) $to = OIDplusObject::parse($to); |
if (!$to) return null; |
if (!($to instanceof $this)) return null; |
$res = ipv4_distance($to->ipv4, $this->ipv4); |
return $res !== false ? $res : null; |
/trunk/plugins/viathinksoft/objectTypes/ipv6/OIDplusIpv6.class.php |
---|
247,6 → 247,7 |
*/ |
public function distance($to) { |
if (!is_object($to)) $to = OIDplusObject::parse($to); |
if (!$to) return null; |
if (!($to instanceof $this)) return null; |
$res = ipv6_distance($to->ipv6, $this->ipv6); |
return $res !== false ? $res : null; |
/trunk/plugins/viathinksoft/objectTypes/java/OIDplusJava.class.php |
---|
211,6 → 211,7 |
*/ |
public function distance($to) { |
if (!is_object($to)) $to = OIDplusObject::parse($to); |
if (!$to) return null; |
if (!($to instanceof $this)) return null; |
$a = $to->java; |
/trunk/plugins/viathinksoft/objectTypes/oid/OIDplusOid.class.php |
---|
369,7 → 369,7 |
while ($row_asn = $res_asn->fetch_array()) { |
$name = $row_asn['name']; |
$standardized = $row_asn['standardized'] ?? false; |
$well_known = $row_asn['well_known']; |
$well_known = $row_asn['well_known'] ?? false; |
$asn_ids[] = new OIDplusOidAsn1Id($name, $standardized, $well_known); |
} |
return $asn_ids; |
385,7 → 385,7 |
while ($row_iri = $res_iri->fetch_array()) { |
$name = $row_iri['name']; |
$longarc = $row_iri['longarc'] ?? false; |
$well_known = $row_iri['well_known']; |
$well_known = $row_iri['well_known'] ?? false; |
$iri_ids[] = new OIDplusOidIri($name, $longarc, $well_known); |
} |
return $iri_ids; |
393,11 → 393,11 |
/** |
* @param OIDplusOid|null $parent |
* @param $separator |
* @param string $separator |
* @return string |
* @throws OIDplusException |
*/ |
public function viewGetArcAsn1s(OIDplusOid $parent=null, $separator = ' | '): string { |
public function viewGetArcAsn1s(OIDplusOid $parent=null, string $separator = ' | '): string { |
$asn_ids = array(); |
if (is_null($parent)) $parent = OIDplusOid::parse(self::root()); |
621,6 → 621,7 |
*/ |
public function distance($to) { |
if (!is_object($to)) $to = OIDplusObject::parse($to); |
if (!$to) return null; |
if (!($to instanceof $this)) return null; |
$res = oid_distance($to->oid, $this->oid); |
return $res !== false ? $res : null; |
/trunk/plugins/viathinksoft/objectTypes/other/OIDplusOther.class.php |
---|
205,6 → 205,7 |
*/ |
public function distance($to) { |
if (!is_object($to)) $to = OIDplusObject::parse($to); |
if (!$to) return null; |
if (!($to instanceof $this)) return null; |
$a = $to->other; |
/trunk/plugins/viathinksoft/objectTypes/php/OIDplusPhp.class.php |
---|
235,6 → 235,7 |
*/ |
public function distance($to) { |
if (!is_object($to)) $to = OIDplusObject::parse($to); |
if (!$to) return null; |
if (!($to instanceof $this)) return null; |
$a = $to->php; |
/trunk/plugins/viathinksoft/publicPages/000_objects/OIDplusPagePublicObjects.class.php |
---|
951,16 → 951,17 |
private static $crudCounter = 0; |
/** |
* @param $parent |
* @return string|void |
* @param string $parent |
* @return string |
* @throws OIDplusConfigInitializationException |
* @throws OIDplusException |
*/ |
protected static function showCrud($parent='oid:') { |
protected static function showCrud(string $parent='oid:'): string { |
$items_total = 0; |
$items_hidden = 0; |
$objParent = OIDplusObject::parse($parent); |
if (!$objParent) return ''; |
$parentNS = $objParent::ns(); |
// http://www.oid-info.com/cgi-bin/display?a=list-by-category&category=Not%20allocating%20identifiers |
995,7 → 996,7 |
$rows = array(); |
while ($row = $result->fetch_object()) { |
$obj = OIDplusObject::parse($row->id); |
$rows[] = array($obj,$row); |
if ($obj) $rows[] = array($obj,$row); |
} |
$enable_weid_presentation = OIDplus::config()->getValue('oid_grid_show_weid'); |
1089,14 → 1090,14 |
$output .= '</tr>'; |
} |
$parent_ra_email = $objParent ? $objParent->getRaMail() : ''; |
$parent_ra_email = $objParent->getRaMail() ; |
// "Create OID" row |
if ($objParent->userHasWriteRights()) { |
$output .= '<tr>'; |
$prefix = is_null($objParent) ? '' : $objParent->crudInsertPrefix(); |
$prefix = $objParent->crudInsertPrefix(); |
$suffix = is_null($objParent) ? '' : $objParent->crudInsertSuffix(); |
$suffix = $objParent->crudInsertSuffix(); |
foreach (OIDplus::getObjectTypePlugins() as $plugin) { |
if (($plugin::getObjectTypeClassName()::ns() == $parentNS) && $plugin->implementsFeature('1.3.6.1.4.1.37476.2.5.2.3.6')) { |
$suffix .= $plugin->gridGeneratorLinks($objParent); /** @phpstan-ignore-line */ |
/trunk/plugins/viathinksoft/publicPages/100_whois/OIDplusPagePublicWhois.class.php |
---|
219,7 → 219,7 |
$text .= '<br><img src="'.OIDplus::webpath(__DIR__,OIDplus::PATH_RELATIVE).'img/page_pictogram.png" height="15" alt=""> <a href="'.OIDplus::webpath(__DIR__,OIDplus::PATH_RELATIVE).'whois/webwhois.php?query='.urlencode($id).'" class="gray_footer_font" target="_blank">'._L('Whois').'</a>'; |
$obj = OIDplusObject::parse($id); |
if ($obj->userHasParentalWriteRights()) { |
if ($obj && $obj->userHasParentalWriteRights()) { |
$text .= '<br><span class="gray_footer_font">'._L('OID-WHOIS Auth Token for displaying full object information: %1 (only applies if the this or superior objects are marked confidential)','<b>'.self::genWhoisAuthToken($id).'</b>').'</span>'; |
$text .= '<br><span class="gray_footer_font">'._L('OID-WHOIS Auth Token for displaying full RA information: %1 (only applies if the RA has set the privacy-flag)','<b>'.self::genWhoisAuthToken('ra:'.$obj->getRaMail()).'</b>').'</span>'; |
} |
/trunk/plugins/viathinksoft/publicPages/200_viathinksoft_freeoid/OIDplusPagePublicFreeOID.class.php |
---|
26,21 → 26,26 |
class OIDplusPagePublicFreeOID extends OIDplusPagePluginPublic { |
/** |
* @param $with_ns |
* @return string |
* @param bool $with_ns |
* @return string|null |
* @throws OIDplusException |
*/ |
private static function getFreeRootOid($with_ns) { |
return ($with_ns ? 'oid:' : '').OIDplus::config()->getValue('freeoid_root_oid'); |
private static function getFreeRootOid(bool $with_ns)/*: ?string*/ { |
if (!in_array('ViaThinkSoft\OIDplus\OIDplusOid',OIDplus::getEnabledObjectTypes())) { |
return null; |
} else { |
$res = ($with_ns ? 'oid:' : '').OIDplus::config()->getValue('freeoid_root_oid'); |
return !empty($res) ? $res : null; |
} |
} |
/** |
* @param $email |
* @param $getId |
* @return bool|mixed|null |
* @param bool $getId |
* @return bool|null |
* @throws OIDplusException |
*/ |
public static function alreadyHasFreeOid($email, $getId = false){ |
public static function alreadyHasFreeOid($email, bool $getId = false)/*: ?bool*/ { |
$res = OIDplus::db()->query("select id from ###objects where ra_email = ? and id like ? order by ".OIDplus::db()->natOrder('id'), array($email, self::getFreeRootOid(true).'.%')); |
while ($row = $res->fetch_array()) { |
return $getId ? $row['id'] : true; |