Rev 971 | Rev 976 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 971 | Rev 975 | ||
---|---|---|---|
Line 112... | Line 112... | ||
112 | 112 | ||
113 | if (!$obj) { |
113 | if (!$obj) { |
114 | // Object type not known or invalid syntax of $query |
114 | // Object type not known or invalid syntax of $query |
115 | $out[] = $this->_oidip_attr('result', 'Not found'); // DO NOT TRANSLATE! |
115 | $out[] = $this->_oidip_attr('result', 'Not found'); // DO NOT TRANSLATE! |
116 | $continue = false; |
116 | $continue = false; |
117 | $res = null; |
- | |
118 | } else { |
117 | } else { |
119 | 118 | ||
120 | $query = $obj->nodeId(); // normalize |
119 | $query = $obj->nodeId(); // normalize |
121 | 120 | ||
122 | $obj = null; |
121 | $obj = null; |
Line 157... | Line 156... | ||
157 | } else { |
156 | } else { |
158 | // getParent() will find the parent which DOES exist in the DB. |
157 | // getParent() will find the parent which DOES exist in the DB. |
159 | // It does not need to be the direct parent (like ->one_up() does) |
158 | // It does not need to be the direct parent (like ->one_up() does) |
160 | $obj = OIDplusObject::parse($query)->getParent(); // For objects, we assume that they are parents of each other |
159 | $obj = OIDplusObject::parse($query)->getParent(); // For objects, we assume that they are parents of each other |
161 | if ($obj) { |
160 | if ($obj) { |
162 | $res = OIDplus::db()->query("select * from ###objects where id = ?", array($obj->nodeId())); |
- | |
163 | $distance = $obj->distance($query); |
161 | $distance = $obj->distance($query); |
164 | assert($res->any()); |
162 | assert(OIDplusObject::findFitting($query)); |
165 | 163 | ||
166 | $query = $obj->nodeId(); |
164 | $query = $obj->nodeId(); |
167 | } |
165 | } |
168 | 166 | ||
169 | if ($distance > 0) { |
167 | if ($distance > 0) { |
Line 173... | Line 171... | ||
173 | $continue = true; |
171 | $continue = true; |
174 | 172 | ||
175 | break; |
173 | break; |
176 | } |
174 | } |
177 | } |
175 | } |
178 | $res = OIDplus::db()->query("select * from ###objects where id = ?", array($query)); |
- | |
179 | 176 | ||
180 | if ((substr($query,0,4) === 'oid:') && (!$obj)) { |
177 | if ((substr($query,0,4) === 'oid:') && (!$obj)) { |
181 | $query = $init_query; |
178 | $query = $init_query; |
182 | $distance = 0; |
179 | $distance = 0; |
183 | while (true) { |
180 | while (true) { |
- | 181 | // Checks if there is any identifier (so it is a well-known OID) |
|
184 | $res = OIDplus::db()->query("select * from ###asn1id where oid = ? union select * from ###iri where oid = ?", array($query, $query)); |
182 | $res_test = OIDplus::db()->query("select * from ###asn1id where oid = ? union select * from ###iri where oid = ?", array($query, $query)); |
185 | if ($res->any()) { |
183 | if ($res_test->any()) { |
186 | $obj = OIDplusObject::parse($query); |
184 | $obj = OIDplusObject::parse($query); |
187 | $res = null; |
- | |
188 | if ($distance > 0) { |
185 | if ($distance > 0) { |
189 | $out[] = $this->_oidip_attr('result', 'Not found; superior object found'); // DO NOT TRANSLATE! |
186 | $out[] = $this->_oidip_attr('result', 'Not found; superior object found'); // DO NOT TRANSLATE! |
190 | $out[] = $this->_oidip_attr('distance', $distance); // DO NOT TRANSLATE |
187 | $out[] = $this->_oidip_attr('distance', $distance); // DO NOT TRANSLATE |
191 | } else { |
188 | } else { |
192 | $out[] = $this->_oidip_attr('result', 'Found'); // DO NOT TRANSLATE! |
189 | $out[] = $this->_oidip_attr('result', 'Found'); // DO NOT TRANSLATE! |
Line 226... | Line 223... | ||
226 | $out[] = $this->_oidip_attr('status', 'Information available'); // DO NOT TRANSLATE! |
223 | $out[] = $this->_oidip_attr('status', 'Information available'); // DO NOT TRANSLATE! |
227 | } |
224 | } |
228 | 225 | ||
229 | // $this->_oidip_attr('lang', ...); // not implemented (since we don't know the language of the texts written by the page operator) |
226 | // $this->_oidip_attr('lang', ...); // not implemented (since we don't know the language of the texts written by the page operator) |
230 | 227 | ||
231 | $row = $res ? $res->fetch_object() : null; |
- | |
232 | - | ||
233 | if (!is_null($row)) { |
228 | if ($obj) { |
234 | $out[] = $this->_oidip_attr('name', $row->title); // DO NOT TRANSLATE! |
229 | $out[] = $this->_oidip_attr('name', $obj->getTitle()); // DO NOT TRANSLATE! |
235 | 230 | ||
236 | $cont = $row->description; |
231 | $cont = $obj->getDescription(); |
237 | $cont = preg_replace('@<a[^>]+href\s*=\s*["\']([^\'"]+)["\'][^>]*>(.+)<\s*/\s*a\s*>@ismU', '\2 (\1)', $cont); |
232 | $cont = preg_replace('@<a[^>]+href\s*=\s*["\']([^\'"]+)["\'][^>]*>(.+)<\s*/\s*a\s*>@ismU', '\2 (\1)', $cont); |
238 | $cont = preg_replace('@<br.*>@', "\n", $cont); |
233 | $cont = preg_replace('@<br.*>@', "\n", $cont); |
239 | $cont = preg_replace('@\\n+@', "\n", $cont); |
234 | $cont = preg_replace('@\\n+@', "\n", $cont); |
240 | $out[] = $this->_oidip_attr('description', trim(html_entity_decode(strip_tags($cont)))); // DO NOT TRANSLATE! |
235 | $out[] = $this->_oidip_attr('description', trim(html_entity_decode(strip_tags($cont)))); // DO NOT TRANSLATE! |
241 | } |
236 | } |
Line 253... | Line 248... | ||
253 | 248 | ||
254 | if (substr($query,0,4) === 'oid:') { |
249 | if (substr($query,0,4) === 'oid:') { |
255 | $out[] = $this->_oidip_attr('asn1-notation', $obj->getAsn1Notation(false)); // DO NOT TRANSLATE! |
250 | $out[] = $this->_oidip_attr('asn1-notation', $obj->getAsn1Notation(false)); // DO NOT TRANSLATE! |
256 | $out[] = $this->_oidip_attr('iri-notation', $obj->getIriNotation(false)); // DO NOT TRANSLATE! |
251 | $out[] = $this->_oidip_attr('iri-notation', $obj->getIriNotation(false)); // DO NOT TRANSLATE! |
257 | 252 | ||
258 | $res2 = OIDplus::db()->query("select * from ###asn1id where oid = ?", array($obj->nodeId())); |
253 | $res_asn = OIDplus::db()->query("select * from ###asn1id where oid = ?", array($obj->nodeId())); |
259 | while ($row2 = $res2->fetch_object()) { |
254 | while ($row_asn = $res_asn->fetch_object()) { |
260 | $out[] = $this->_oidip_attr('identifier', $row2->name); // DO NOT TRANSLATE! |
255 | $out[] = $this->_oidip_attr('identifier', $row_asn->name); // DO NOT TRANSLATE! |
261 | } |
256 | } |
262 | 257 | ||
263 | $res2 = OIDplus::db()->query("select * from ###asn1id where standardized = ? and oid = ?", array(true, $obj->nodeId())); |
258 | $res_asn = OIDplus::db()->query("select * from ###asn1id where standardized = ? and oid = ?", array(true, $obj->nodeId())); |
264 | while ($row2 = $res2->fetch_object()) { |
259 | while ($row_asn = $res_asn->fetch_object()) { |
265 | $out[] = $this->_oidip_attr('standardized-id', $row2->name); // DO NOT TRANSLATE! |
260 | $out[] = $this->_oidip_attr('standardized-id', $row_asn->name); // DO NOT TRANSLATE! |
266 | } |
261 | } |
267 | 262 | ||
268 | $res2 = OIDplus::db()->query("select * from ###iri where oid = ?", array($obj->nodeId())); |
263 | $res_iri = OIDplus::db()->query("select * from ###iri where oid = ?", array($obj->nodeId())); |
269 | while ($row2 = $res2->fetch_object()) { |
264 | while ($row_iri = $res_iri->fetch_object()) { |
270 | $out[] = $this->_oidip_attr('unicode-label', $row2->name); // DO NOT TRANSLATE! |
265 | $out[] = $this->_oidip_attr('unicode-label', $row_iri->name); // DO NOT TRANSLATE! |
271 | } |
266 | } |
272 | 267 | ||
273 | $res2 = OIDplus::db()->query("select * from ###iri where longarc = ? and oid = ?", array(true, $obj->nodeId())); |
268 | $res_iri = OIDplus::db()->query("select * from ###iri where longarc = ? and oid = ?", array(true, $obj->nodeId())); |
274 | while ($row2 = $res2->fetch_object()) { |
269 | while ($row_iri = $res_iri->fetch_object()) { |
275 | $out[] = $this->_oidip_attr('long-arc', $row2->name); // DO NOT TRANSLATE! |
270 | $out[] = $this->_oidip_attr('long-arc', $row_iri->name); // DO NOT TRANSLATE! |
276 | } |
271 | } |
277 | } |
272 | } |
278 | 273 | ||
279 | // $this->_oidip_attr('oidip-service', ...); Not used. |
274 | // $this->_oidip_attr('oidip-service', ...); Not used. |
280 | 275 | ||
Line 301... | Line 296... | ||
301 | if ($this->allowObjectView($objTest, $authTokens)) { |
296 | if ($this->allowObjectView($objTest, $authTokens)) { |
302 | $out[] = $this->_oidip_attr('parent', $sParent.$this->show_asn1_appendix($sParent)); // DO NOT TRANSLATE! |
297 | $out[] = $this->_oidip_attr('parent', $sParent.$this->show_asn1_appendix($sParent)); // DO NOT TRANSLATE! |
303 | } else { |
298 | } else { |
304 | $out[] = $this->_oidip_attr('parent', $sParent); // DO NOT TRANSLATE! |
299 | $out[] = $this->_oidip_attr('parent', $sParent); // DO NOT TRANSLATE! |
305 | } |
300 | } |
306 | } else if (!is_null($row) && !empty($row->parent) && (!$this->is_root($row->parent))) { |
301 | } else { |
307 | $sParent = $row->parent; |
302 | $sParent = $obj->getParent(); |
- | 303 | if ($obj && !empty($sParent) && (!$this->is_root($sParent))) { |
|
308 | $out[] = $this->_oidip_attr('parent', $row->parent); // DO NOT TRANSLATE! |
304 | $out[] = $this->_oidip_attr('parent', $sParent); // DO NOT TRANSLATE! |
- | 305 | } |
|
309 | } |
306 | } |
310 | 307 | ||
311 | $res2 = OIDplus::db()->query("select * from ###objects where parent = ? order by ".OIDplus::db()->natOrder('id'), array($obj->nodeId())); |
308 | $res_children = OIDplus::db()->query("select * from ###objects where parent = ? order by ".OIDplus::db()->natOrder('id'), array($obj->nodeId())); |
312 | while ($row2 = $res2->fetch_object()) { |
309 | while ($row_children = $res_children->fetch_object()) { |
313 | $objTest = OIDplusObject::parse($row2->id); |
310 | $objTest = OIDplusObject::parse($row_children->id); |
314 | if ($this->allowObjectView($objTest, $authTokens)) { |
311 | if ($this->allowObjectView($objTest, $authTokens)) { |
315 | $out[] = $this->_oidip_attr('subordinate', $row2->id.$this->show_asn1_appendix($row2->id)); // DO NOT TRANSLATE! |
312 | $out[] = $this->_oidip_attr('subordinate', $row_children->id.$this->show_asn1_appendix($row_children->id)); // DO NOT TRANSLATE! |
316 | } else { |
313 | } else { |
317 | $out[] = $this->_oidip_attr('subordinate', $row2->id); // DO NOT TRANSLATE! |
314 | $out[] = $this->_oidip_attr('subordinate', $row_children->id); // DO NOT TRANSLATE! |
318 | } |
315 | } |
319 | } |
316 | } |
320 | 317 | ||
321 | if (!is_null($row)) { |
318 | if ($obj) { |
322 | if ($row->created) $out[] = $this->_oidip_attr('created', date('Y-m-d H:i:s', strtotime($row->created))); // DO NOT TRANSLATE! |
319 | if ($tim = $obj->getCreatedTime()) $out[] = $this->_oidip_attr('created', date('Y-m-d H:i:s', strtotime($tim))); // DO NOT TRANSLATE! |
323 | if ($row->updated) $out[] = $this->_oidip_attr('updated', date('Y-m-d H:i:s', strtotime($row->updated))); // DO NOT TRANSLATE! |
320 | if ($tim = $obj->getUpdatedTime()) $out[] = $this->_oidip_attr('updated', date('Y-m-d H:i:s', strtotime($tim))); // DO NOT TRANSLATE! |
324 | } |
321 | } |
325 | 322 | ||
326 | $out[] = ''; |
323 | $out[] = ''; |
327 | 324 | ||
328 | // ATTENTION: THE ORDER IS IMPORTANT FOR THE XML VALIDATION! |
325 | // ATTENTION: THE ORDER IS IMPORTANT FOR THE XML VALIDATION! |
329 | // The order of the RFC is the same as in the XSD |
326 | // The order of the RFC is the same as in the XSD |
330 | $res2 = OIDplus::db()->query("select * from ###ra where email = ?", array(is_null($row) ? '' : $row->ra_email)); |
327 | $res_ra = OIDplus::db()->query("select * from ###ra where email = ?", array($obj ? $obj->getRaMail() : '')); |
331 | if ($row2 = $res2->fetch_object()) { |
328 | if ($row_ra = $res_ra->fetch_object()) { |
332 | $out[] = $this->_oidip_attr('ra', (!empty($row2->ra_name) ? $row2->ra_name : (!empty($row2->email) ? $row2->email : /*_L*/('Unknown')))); // DO NOT TRANSLATE! |
329 | $out[] = $this->_oidip_attr('ra', (!empty($row_ra->ra_name) ? $row_ra->ra_name : (!empty($row_ra->email) ? $row_ra->email : /*_L*/('Unknown')))); // DO NOT TRANSLATE! |
333 | 330 | ||
334 | if (!$this->allowRAView($row2, $authTokens)) { |
331 | if (!$this->allowRAView($row_ra, $authTokens)) { |
335 | $out[] = $this->_oidip_attr('ra-status', 'Information partially available'); // DO NOT TRANSLATE! |
332 | $out[] = $this->_oidip_attr('ra-status', 'Information partially available'); // DO NOT TRANSLATE! |
336 | } else { |
333 | } else { |
337 | $out[] = $this->_oidip_attr('ra-status', 'Information available'); // DO NOT TRANSLATE! |
334 | $out[] = $this->_oidip_attr('ra-status', 'Information available'); // DO NOT TRANSLATE! |
338 | } |
335 | } |
339 | 336 | ||
340 | // $this->_oidip_attr('ra-lang', ...); // not implemented (since we don't know the language of the texts written by the page operator) |
337 | // $this->_oidip_attr('ra-lang', ...); // not implemented (since we don't know the language of the texts written by the page operator) |
341 | 338 | ||
342 | $tmp = array(); |
339 | $tmp = array(); |
343 | if (!empty($row2->office)) $tmp[] = $row2->office; |
340 | if (!empty($row_ra->office)) $tmp[] = $row_ra->office; |
344 | if (!empty($row2->organization)) $tmp[] = $row2->organization; |
341 | if (!empty($row_ra->organization)) $tmp[] = $row_ra->organization; |
345 | $tmp = implode(', ', $tmp); |
342 | $tmp = implode(', ', $tmp); |
346 | 343 | ||
347 | $out[] = $this->_oidip_attr('ra-contact-name', $row2->personal_name.(!empty($tmp) ? " ($tmp)" : '')); // DO NOT TRANSLATE! |
344 | $out[] = $this->_oidip_attr('ra-contact-name', $row_ra->personal_name.(!empty($tmp) ? " ($tmp)" : '')); // DO NOT TRANSLATE! |
348 | if (!$this->allowRAView($row2, $authTokens)) { |
345 | if (!$this->allowRAView($row_ra, $authTokens)) { |
349 | if (!empty($row2->street) || !empty($row2->zip_town) || !empty($row2->country)) { |
346 | if (!empty($row_ra->street) || !empty($row_ra->zip_town) || !empty($row_ra->country)) { |
350 | $out[] = $this->_oidip_attr('ra-address', /*_L*/('(redacted)')); // DO NOT TRANSLATE! |
347 | $out[] = $this->_oidip_attr('ra-address', /*_L*/('(redacted)')); // DO NOT TRANSLATE! |
351 | } |
348 | } |
352 | $out[] = $this->_oidip_attr('ra-phone', (!empty($row2->phone) ? /*_L*/('(redacted)') : '')); // DO NOT TRANSLATE! |
349 | $out[] = $this->_oidip_attr('ra-phone', (!empty($row_ra->phone) ? /*_L*/('(redacted)') : '')); // DO NOT TRANSLATE! |
353 | $out[] = $this->_oidip_attr('ra-mobile', (!empty($row2->mobile) ? /*_L*/('(redacted)') : '')); // DO NOT TRANSLATE! |
350 | $out[] = $this->_oidip_attr('ra-mobile', (!empty($row_ra->mobile) ? /*_L*/('(redacted)') : '')); // DO NOT TRANSLATE! |
354 | $out[] = $this->_oidip_attr('ra-fax', (!empty($row2->fax) ? /*_L*/('(redacted)') : '')); // DO NOT TRANSLATE! |
351 | $out[] = $this->_oidip_attr('ra-fax', (!empty($row_ra->fax) ? /*_L*/('(redacted)') : '')); // DO NOT TRANSLATE! |
355 | } else { |
352 | } else { |
356 | $address = array(); |
353 | $address = array(); |
357 | if (!empty($row2->street)) $address[] = $row2->street; // DO NOT TRANSLATE! |
354 | if (!empty($row_ra->street)) $address[] = $row_ra->street; // DO NOT TRANSLATE! |
358 | if (!empty($row2->zip_town)) $address[] = $row2->zip_town; // DO NOT TRANSLATE! |
355 | if (!empty($row_ra->zip_town)) $address[] = $row_ra->zip_town; // DO NOT TRANSLATE! |
359 | if (!empty($row2->country)) $address[] = $row2->country; // DO NOT TRANSLATE! |
356 | if (!empty($row_ra->country)) $address[] = $row_ra->country; // DO NOT TRANSLATE! |
360 | if (count($address) > 0) $out[] = $this->_oidip_attr('ra-address', implode("\n",$address)); |
357 | if (count($address) > 0) $out[] = $this->_oidip_attr('ra-address', implode("\n",$address)); |
361 | $out[] = $this->_oidip_attr('ra-phone', $row2->phone); // DO NOT TRANSLATE! |
358 | $out[] = $this->_oidip_attr('ra-phone', $row_ra->phone); // DO NOT TRANSLATE! |
362 | $out[] = $this->_oidip_attr('ra-mobile', $row2->mobile); // DO NOT TRANSLATE! |
359 | $out[] = $this->_oidip_attr('ra-mobile', $row_ra->mobile); // DO NOT TRANSLATE! |
363 | $out[] = $this->_oidip_attr('ra-fax', $row2->fax); // DO NOT TRANSLATE! |
360 | $out[] = $this->_oidip_attr('ra-fax', $row_ra->fax); // DO NOT TRANSLATE! |
364 | } |
361 | } |
365 | $out[] = $this->_oidip_attr('ra-email', $row->ra_email); // DO NOT TRANSLATE! |
362 | $out[] = $this->_oidip_attr('ra-email', $obj->getRaMail()); // DO NOT TRANSLATE! |
366 | 363 | ||
367 | // $this->_oidip_attr('ra-url', ...); Not used. |
364 | // $this->_oidip_attr('ra-url', ...); Not used. |
368 | 365 | ||
369 | $ra = new OIDplusRA($row->ra_email); |
366 | $ra = new OIDplusRA($obj->getRaMail()); |
370 | if ($ra->implementsFeature('1.3.6.1.4.1.37476.2.5.2.3.4')) { |
367 | if ($ra->implementsFeature('1.3.6.1.4.1.37476.2.5.2.3.4')) { |
371 | $ra->whoisRaAttributes($row->ra_email, $out); /** @phpstan-ignore-line */ |
368 | $ra->whoisRaAttributes($obj->getRaMail(), $out); /** @phpstan-ignore-line */ |
372 | } |
369 | } |
373 | 370 | ||
374 | foreach (OIDplus::getPagePlugins() as $plugin) { |
371 | foreach (OIDplus::getPagePlugins() as $plugin) { |
375 | if ($plugin->implementsFeature('1.3.6.1.4.1.37476.2.5.2.3.4')) { |
372 | if ($plugin->implementsFeature('1.3.6.1.4.1.37476.2.5.2.3.4')) { |
376 | $plugin->whoisRaAttributes($row->ra_email, $out); |
373 | $plugin->whoisRaAttributes($obj->getRaMail(), $out); |
377 | } |
374 | } |
378 | } |
375 | } |
379 | 376 | ||
380 | // yes, we use row2->privacy() instead of $this->allowRAView(), becuase $this->allowRAView=true if auth token is given; and we want to inform the person that they content they are viewing is confidential! |
377 | // yes, we use row_ra->privacy() instead of $this->allowRAView(), becuase $this->allowRAView=true if auth token is given; and we want to inform the person that they content they are viewing is confidential! |
381 | if ($row2->privacy) { |
378 | if ($row_ra->privacy) { |
382 | $out[] = $this->_oidip_attr('ra-attribute', 'confidential'); // DO NOT TRANSLATE! |
379 | $out[] = $this->_oidip_attr('ra-attribute', 'confidential'); // DO NOT TRANSLATE! |
383 | } |
380 | } |
384 | 381 | ||
385 | if ($row2->registered) $out[] = $this->_oidip_attr('ra-created', date('Y-m-d H:i:s', strtotime($row2->registered))); // DO NOT TRANSLATE! |
382 | if ($row_ra->registered) $out[] = $this->_oidip_attr('ra-created', date('Y-m-d H:i:s', strtotime($row_ra->registered))); // DO NOT TRANSLATE! |
386 | if ($row2->updated) $out[] = $this->_oidip_attr('ra-updated', date('Y-m-d H:i:s', strtotime($row2->updated))); // DO NOT TRANSLATE! |
383 | if ($row_ra->updated) $out[] = $this->_oidip_attr('ra-updated', date('Y-m-d H:i:s', strtotime($row_ra->updated))); // DO NOT TRANSLATE! |
387 | } else { |
384 | } else { |
388 | $out[] = $this->_oidip_attr('ra', (!is_null($row) && !empty($row->ra_email) ? $row->ra_email : /*_L*/('Unknown'))); // DO NOT TRANSLATE! |
385 | $out[] = $this->_oidip_attr('ra', ($obj && !empty($obj->getRaMail()) ? $obj->getRaMail() : /*_L*/('Unknown'))); // DO NOT TRANSLATE! |
389 | if (!is_null($row)) { |
386 | if ($obj) { |
390 | foreach (OIDplus::getPagePlugins() as $plugin) { |
387 | foreach (OIDplus::getPagePlugins() as $plugin) { |
391 | if ($plugin->implementsFeature('1.3.6.1.4.1.37476.2.5.2.3.4')) { |
388 | if ($plugin->implementsFeature('1.3.6.1.4.1.37476.2.5.2.3.4')) { |
392 | $plugin->whoisRaAttributes($row->ra_email, $out); |
389 | $plugin->whoisRaAttributes($obj->getRaMail(), $out); |
393 | } |
390 | } |
394 | } |
391 | } |
395 | } |
392 | } |
396 | $out[] = $this->_oidip_attr('ra-status', 'Information unavailable'); // DO NOT TRANSLATE! |
393 | $out[] = $this->_oidip_attr('ra-status', 'Information unavailable'); // DO NOT TRANSLATE! |
397 | } |
394 | } |
Line 624... | Line 621... | ||
624 | } |
621 | } |
625 | 622 | ||
626 | protected function show_asn1_appendix($id) { |
623 | protected function show_asn1_appendix($id) { |
627 | if (substr($id,0,4) === 'oid:') { |
624 | if (substr($id,0,4) === 'oid:') { |
628 | $appendix_asn1ids = array(); |
625 | $appendix_asn1ids = array(); |
629 | $res3 = OIDplus::db()->query("select * from ###asn1id where oid = ?", array($id)); |
626 | $res_asn = OIDplus::db()->query("select * from ###asn1id where oid = ?", array($id)); |
630 | while ($row3 = $res3->fetch_object()) { |
627 | while ($row_asn = $res_asn->fetch_object()) { |
631 | $appendix_asn1ids[] = $row3->name; |
628 | $appendix_asn1ids[] = $row_asn->name; |
632 | } |
629 | } |
633 | 630 | ||
634 | $appendix = implode(', ', $appendix_asn1ids); |
631 | $appendix = implode(', ', $appendix_asn1ids); |
635 | if (!empty($appendix)) $appendix = " ($appendix)"; |
632 | if (!empty($appendix)) $appendix = " ($appendix)"; |
636 | } else { |
633 | } else { |
Line 655... | Line 652... | ||
655 | $authToken = trim(OIDplus::config()->getValue('whois_auth_token')); |
652 | $authToken = trim(OIDplus::config()->getValue('whois_auth_token')); |
656 | if (empty($authToken)) $authToken = false; |
653 | if (empty($authToken)) $authToken = false; |
657 | if ($authToken && in_array($authToken, $authTokens)) return true; |
654 | if ($authToken && in_array($authToken, $authTokens)) return true; |
658 | 655 | ||
659 | // Per-OID auth tokens |
656 | // Per-OID auth tokens |
- | 657 | ||
660 | $curid = $obj->nodeId(); |
658 | $curid = $obj->nodeId(); |
661 | while (($res = OIDplus::db()->query("select parent, confidential from ###objects where id = ?", array($curid)))->any()) { |
659 | while ($test_obj = OIDplusObject::findFitting($curid)) { |
662 | $row = $res->fetch_array(); |
- | |
663 | // Example: You have an auth Token for 2.999.1.2.3 |
660 | // Example: You have an auth Token for 2.999.1.2.3 |
664 | // This allows you to view 2.999.1.2.3 and all of its children, |
661 | // This allows you to view 2.999.1.2.3 and all of its children, |
665 | // as long as they are not confidential (then you need their auth token). |
662 | // as long as they are not confidential (then you need their auth token). |
666 | // 2, 2.999, 2.999.1 and 2.999.1.2 are visible, |
663 | // 2, 2.999, 2.999.1 and 2.999.1.2 are visible, |
667 | // (because their existence is now obvious). |
664 | // (because their existence is now obvious). |
668 | if ($row['confidential'] && !$this->authTokenAccepted($curid, $authTokens)) return false; |
665 | if ($test_obj->isConfidential() && !$this->authTokenAccepted($curid, $authTokens)) return false; |
669 | $curid = $row['parent']; |
666 | $curid = $test_obj->getParent(); |
670 | } |
667 | } |
671 | 668 | ||
672 | // Allow |
669 | // Allow |
673 | return true; |
670 | return true; |
674 | } |
671 | } |
675 | 672 | ||
676 | protected function allowRAView($row, $authTokens) { |
673 | protected function allowRAView($row_ra, $authTokens) { |
677 | // Master auth token (TODO: Have an object-master-token and a ra-master-token?) |
674 | // Master auth token (TODO: Have an object-master-token and a ra-master-token?) |
678 | $authToken = trim(OIDplus::config()->getValue('whois_auth_token')); |
675 | $authToken = trim(OIDplus::config()->getValue('whois_auth_token')); |
679 | if (empty($authToken)) $authToken = false; |
676 | if (empty($authToken)) $authToken = false; |
680 | if ($authToken && in_array($authToken, $authTokens)) return true; |
677 | if ($authToken && in_array($authToken, $authTokens)) return true; |
681 | 678 | ||
682 | // Per-RA auth tokens |
679 | // Per-RA auth tokens |
683 | if ($row->privacy && !$this->authTokenAccepted('ra:'.$row->ra_name, $authTokens)) return false; |
680 | if ($row_ra->privacy && !$this->authTokenAccepted('ra:'.$row_ra->ra_name, $authTokens)) return false; |
684 | 681 | ||
685 | // Allow |
682 | // Allow |
686 | return true; |
683 | return true; |
687 | } |
684 | } |
688 | 685 |