Rev 330 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 330 | Rev 360 | ||
---|---|---|---|
Line 21... | Line 21... | ||
21 | 21 | ||
22 | public function init($html=true) { |
22 | public function init($html=true) { |
23 | OIDplus::config()->prepareConfigKey('whois_auth_token', 'OID-over-WHOIS authentication token to display confidential data', '', OIDplusConfig::PROTECTION_EDITABLE, function($value) { |
23 | OIDplus::config()->prepareConfigKey('whois_auth_token', 'OID-over-WHOIS authentication token to display confidential data', '', OIDplusConfig::PROTECTION_EDITABLE, function($value) { |
24 | $test_value = preg_replace('@[0-9a-zA-Z]*@', '', $value); |
24 | $test_value = preg_replace('@[0-9a-zA-Z]*@', '', $value); |
25 | if ($test_value != '') { |
25 | if ($test_value != '') { |
26 | throw new OIDplusException("Only characters and numbers are allowed as authentication token."); |
26 | throw new OIDplusException(_L('Only characters and numbers are allowed as authentication token.')); |
27 | } |
27 | } |
28 | }); |
28 | }); |
29 | OIDplus::config()->prepareConfigKey('webwhois_output_format_spacer', 'WebWHOIS: Spacer', 2, OIDplusConfig::PROTECTION_EDITABLE, function($value) { |
29 | OIDplus::config()->prepareConfigKey('webwhois_output_format_spacer', 'WebWHOIS: Spacer', '2', OIDplusConfig::PROTECTION_EDITABLE, function($value) { |
30 | if (!is_numeric($value) || ($value < 0)) { |
30 | if (!is_numeric($value) || ($value < 0)) { |
31 | throw new OIDplusException("Please enter a valid value."); |
31 | throw new OIDplusException(_L('Please enter a valid value.')); |
32 | } |
32 | } |
33 | }); |
33 | }); |
34 | OIDplus::config()->prepareConfigKey('webwhois_output_format_max_line_length', 'WebWHOIS: Max line length', 80, OIDplusConfig::PROTECTION_EDITABLE, function($value) { |
34 | OIDplus::config()->prepareConfigKey('webwhois_output_format_max_line_length', 'WebWHOIS: Max line length', '80', OIDplusConfig::PROTECTION_EDITABLE, function($value) { |
35 | if (!is_numeric($value) || ($value < 0)) { |
35 | if (!is_numeric($value) || ($value < 0)) { |
36 | throw new OIDplusException("Please enter a valid value."); |
36 | throw new OIDplusException(_L('Please enter a valid value.')); |
37 | } |
37 | } |
38 | }); |
38 | }); |
39 | } |
39 | } |
40 | 40 | ||
41 | private function getExampleId() { |
41 | private function getExampleId() { |
Line 60... | Line 60... | ||
60 | if (explode('$',$id)[0] == 'oidplus:whois') { |
60 | if (explode('$',$id)[0] == 'oidplus:whois') { |
61 | $handled = true; |
61 | $handled = true; |
62 | 62 | ||
63 | $example = $this->getExampleId(); |
63 | $example = $this->getExampleId(); |
64 | 64 | ||
65 | $out['title'] = 'Web WHOIS'; |
65 | $out['title'] = _L('Web WHOIS'); |
66 | $out['icon'] = file_exists(__DIR__.'/icon_big.png') ? OIDplus::webpath(__DIR__).'icon_big.png' : ''; |
66 | $out['icon'] = file_exists(__DIR__.'/icon_big.png') ? OIDplus::webpath(__DIR__).'icon_big.png' : ''; |
67 | 67 | ||
68 | $out['text'] = ''; |
68 | $out['text'] = ''; |
69 | $out['text'] .= '<p>With the web based whois service, you can query object information in a machine readable format.</p>'; |
69 | $out['text'] .= '<p>'._L('With the web based whois service, you can query object information in a machine-readable format.').'</p>'; |
70 | - | ||
71 | - | ||
72 | - | ||
73 | - | ||
74 | - | ||
75 | 70 | ||
76 | $out['text'] .= '<form action="'.OIDplus::webpath(__DIR__).'whois/webwhois.php" method="GET">'; |
71 | $out['text'] .= '<form action="'.OIDplus::webpath(__DIR__).'whois/webwhois.php" method="GET">'; |
77 | $out['text'] .= '<br>Output format:<br><fieldset>'; |
72 | $out['text'] .= '<br>'._L('Output format').':<br><fieldset>'; |
78 | $out['text'] .= ' <input type="radio" id="txt" name="format" value="txt" checked>'; |
73 | $out['text'] .= ' <input type="radio" id="txt" name="format" value="txt" checked>'; |
79 | $out['text'] .= ' <label for="txt"> Text format (RFC draft: <a href="'.OIDplus::webpath(__DIR__).'whois/rfc/draft-viathinksoft-oidwhois-00.txt">TXT</a> | <a href="'.OIDplus::webpath(__DIR__).'whois/rfc/draft-viathinksoft-oidwhois-00.nroff">NROFF</a>)</label><br>'; |
74 | $out['text'] .= ' <label for="txt"> '._L('Text format (RFC draft: %1)','<a href="'.OIDplus::webpath(__DIR__).'whois/rfc/draft-viathinksoft-oidwhois-00.txt">'._L('TXT').'</a> | <a href="'.OIDplus::webpath(__DIR__).'whois/rfc/draft-viathinksoft-oidwhois-00.nroff">'._L('NROFF').'</a>').'</label><br>'; |
80 | $out['text'] .= ' <input type="radio" id="json" name="format" value="json">'; |
75 | $out['text'] .= ' <input type="radio" id="json" name="format" value="json">'; |
81 | $out['text'] .= ' <label for="json"> JSON (<a href="'.OIDplus::webpath(__DIR__).'whois/json_schema.json">Schema</a>)</label><br>'; |
76 | $out['text'] .= ' <label for="json"> '._L('JSON').' (<a href="'.OIDplus::webpath(__DIR__).'whois/json_schema.json">'._L('Schema').'</a>)</label><br>'; |
82 | $out['text'] .= ' <input type="radio" id="xml" name="format" value="xml">'; |
77 | $out['text'] .= ' <input type="radio" id="xml" name="format" value="xml">'; |
83 | $out['text'] .= ' <label for="xml"> XML (<a href="'.OIDplus::webpath(__DIR__).'whois/xml_schema.xsd">Schema</a>)</label><br>'; |
78 | $out['text'] .= ' <label for="xml"> '._L('XML').' (<a href="'.OIDplus::webpath(__DIR__).'whois/xml_schema.xsd">'._L('Schema').'</a>)</label><br>'; |
84 | $out['text'] .= '</fieldset><br>'; |
79 | $out['text'] .= '</fieldset><br>'; |
85 | $out['text'] .= ' <!--<label class="padding_label">-->Query:<!--</label>--> <input type="text" name="query" value="'.htmlentities($example).'" style="width:250px">'; |
80 | $out['text'] .= ' <!--<label class="padding_label">-->'._L('Query').':<!--</label>--> <input type="text" name="query" value="'.htmlentities($example).'" style="width:250px">'; |
86 | $out['text'] .= ' <input type="submit" value="Query">'; |
81 | $out['text'] .= ' <input type="submit" value="'._L('Query').'">'; |
87 | $out['text'] .= '</form>'; |
82 | $out['text'] .= '</form>'; |
88 | } |
83 | } |
89 | } |
84 | } |
90 | 85 | ||
91 | public function publicSitemap(&$out) { |
86 | public function publicSitemap(&$out) { |
92 | $out[] = OIDplus::getSystemUrl().'?goto='.urlencode('oidplus:whois'); |
87 | $out[] = 'oidplus:whois'; |
93 | } |
88 | } |
94 | 89 | ||
95 | public function tree(&$json, $ra_email=null, $nonjs=false, $req_goto='') { |
90 | public function tree(&$json, $ra_email=null, $nonjs=false, $req_goto='') { |
96 | if (file_exists(__DIR__.'/treeicon.png')) { |
91 | if (file_exists(__DIR__.'/treeicon.png')) { |
97 | $tree_icon = OIDplus::webpath(__DIR__).'treeicon.png'; |
92 | $tree_icon = OIDplus::webpath(__DIR__).'treeicon.png'; |
Line 100... | Line 95... | ||
100 | } |
95 | } |
101 | 96 | ||
102 | $json[] = array( |
97 | $json[] = array( |
103 | 'id' => 'oidplus:whois', |
98 | 'id' => 'oidplus:whois', |
104 | 'icon' => $tree_icon, |
99 | 'icon' => $tree_icon, |
105 | 'text' => 'Web WHOIS' |
100 | 'text' => _L('Web WHOIS') |
106 | ); |
101 | ); |
107 | 102 | ||
108 | return true; |
103 | return true; |
109 | } |
104 | } |
110 | 105 | ||
Line 114... | Line 109... | ||
114 | } |
109 | } |
115 | 110 | ||
116 | public function modifyContent($id, &$title, &$icon, &$text) { |
111 | public function modifyContent($id, &$title, &$icon, &$text) { |
117 | // Interface 1.3.6.1.4.1.37476.2.5.2.3.2 |
112 | // Interface 1.3.6.1.4.1.37476.2.5.2.3.2 |
118 | 113 | ||
119 | $text .= '<br><img src="'.OIDplus::webpath(__DIR__).'page_pictogram.png" height="15" alt=""> <a href="'.OIDplus::webpath(__DIR__).'whois/webwhois.php?query='.urlencode($id).'" class="gray_footer_font">Whois</a>'; |
114 | $text .= '<br><img src="'.OIDplus::webpath(__DIR__).'page_pictogram.png" height="15" alt=""> <a href="'.OIDplus::webpath(__DIR__).'whois/webwhois.php?query='.urlencode($id).'" class="gray_footer_font">'._L('Whois').'</a>'; |
120 | } |
115 | } |
121 | 116 | ||
122 | public function tree_search($request) { |
117 | public function tree_search($request) { |
123 | return false; |
118 | return false; |
124 | } |
119 | } |