Subversion Repositories oidplus

Rev

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

Rev 821 Rev 843
Line 508... Line 508...
508
 
508
 
509
                if (!is_null($obj)) {
509
                if (!is_null($obj)) {
510
                        $handled = true;
510
                        $handled = true;
511
 
511
 
512
                        if (!$obj->userHasReadRights()) {
512
                        if (!$obj->userHasReadRights()) {
-
 
513
                                if (isset($_SERVER['SCRIPT_FILENAME']) && (strtolower(basename($_SERVER['SCRIPT_FILENAME'])) !== 'ajax.php')) { // don't send HTTP error codes in ajax.php, because we want a page and not a JavaScript alert box, when someone enters an invalid OID in the GoTo-Box
-
 
514
                                        http_response_code(403);
-
 
515
                                }
513
                                $out['title'] = _L('Access denied');
516
                                $out['title'] = _L('Access denied');
514
                                $out['icon'] = 'img/error.png';
517
                                $out['icon'] = 'img/error.png';
515
                                $out['text'] = '<p>'._L('Please <a %1>log in</a> to receive information about this object.',OIDplus::gui()->link('oidplus:login')).'</p>';
518
                                $out['text'] = '<p>'._L('Please <a %1>log in</a> to receive information about this object.',OIDplus::gui()->link('oidplus:login')).'</p>';
516
                                return;
519
                                return;
517
                        }
520
                        }
Line 528... Line 531...
528
                                                $parent = null; // $obj->getParent();
531
                                                $parent = null; // $obj->getParent();
529
                                                break;
532
                                                break;
530
                                        } else {
533
                                        } else {
531
                                                $res = OIDplus::db()->query("select * from ###objects where id = ?", array($obj->nodeId()));
534
                                                $res = OIDplus::db()->query("select * from ###objects where id = ?", array($obj->nodeId()));
532
                                                if (!$res->any()) {
535
                                                if (!$res->any()) {
-
 
536
                                                        if (isset($_SERVER['SCRIPT_FILENAME']) && (strtolower(basename($_SERVER['SCRIPT_FILENAME'])) !== 'ajax.php')) { // don't send HTTP error codes in ajax.php, because we want a page and not a JavaScript alert box, when someone enters an invalid OID in the GoTo-Box
533
                                                        http_response_code(404);
537
                                                                http_response_code(404);
-
 
538
                                                        }
534
                                                        $out['title'] = _L('Object not found');
539
                                                        $out['title'] = _L('Object not found');
535
                                                        $out['icon'] = 'img/error.png';
540
                                                        $out['icon'] = 'img/error.png';
536
                                                        $out['text'] = _L('The object %1 was not found in this database.','<code>'.htmlentities($id).'</code>');
541
                                                        $out['text'] = _L('The object %1 was not found in this database.','<code>'.htmlentities($id).'</code>');
537
                                                        return;
542
                                                        return;
538
                                                } else {
543
                                                } else {
Line 544... Line 549...
544
                                                }
549
                                                }
545
                                        }
550
                                        }
546
                                }
551
                                }
547
                        }
552
                        }
548
                        if (!$matches_any_registered_type) {
553
                        if (!$matches_any_registered_type) {
-
 
554
                                if (isset($_SERVER['SCRIPT_FILENAME']) && (strtolower(basename($_SERVER['SCRIPT_FILENAME'])) !== 'ajax.php')) { // don't send HTTP error codes in ajax.php, because we want a page and not a JavaScript alert box, when someone enters an invalid OID in the GoTo-Box
549
                                http_response_code(404);
555
                                        http_response_code(404);
-
 
556
                                }
550
                                $out['title'] = _L('Object not found');
557
                                $out['title'] = _L('Object not found');
551
                                $out['icon'] = 'img/error.png';
558
                                $out['icon'] = 'img/error.png';
552
                                $out['text'] = _L('The object %1 was not found in this database.','<code>'.htmlentities($id).'</code>');
559
                                $out['text'] = _L('The object %1 was not found in this database.','<code>'.htmlentities($id).'</code>');
553
                                return;
560
                                return;
554
                        }
561
                        }