Rev 328 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 328 | Rev 360 | ||
---|---|---|---|
Line 35... | Line 35... | ||
35 | // Parameters: id |
35 | // Parameters: id |
36 | // Outputs: Text |
36 | // Outputs: Text |
37 | if ($actionID == 'Delete') { |
37 | if ($actionID == 'Delete') { |
38 | $id = $params['id']; |
38 | $id = $params['id']; |
39 | $obj = OIDplusObject::parse($id); |
39 | $obj = OIDplusObject::parse($id); |
40 | if ($obj === null) throw new OIDplusException("DELETE action failed because object '$id' cannot be parsed!"); |
40 | if ($obj === null) throw new OIDplusException(_L('%1 action failed because object "%2" cannot be parsed!','DELETE',$id)); |
41 | 41 | ||
42 | if (OIDplus::db()->query("select id from ###objects where id = ?", array($id))->num_rows() == 0) { |
42 | if (OIDplus::db()->query("select id from ###objects where id = ?", array($id))->num_rows() == 0) { |
43 | throw new OIDplusException("Object '$id' does not exist"); |
43 | throw new OIDplusException(_L('Object %1 does not exist',$id)); |
44 | } |
44 | } |
45 | 45 | ||
46 | // Check if permitted |
46 | // Check if permitted |
47 | if (!$obj->userHasParentalWriteRights()) throw new OIDplusException('Authentication error. Please log in as the superior RA to delete this OID.'); |
47 | if (!$obj->userHasParentalWriteRights()) throw new OIDplusException(_L('Authentication error. Please log in as the superior RA to delete this OID.')); |
48 | 48 | ||
49 | foreach (OIDplus::getPagePlugins() as $plugin) { |
49 | foreach (OIDplus::getPagePlugins() as $plugin) { |
50 | if ($plugin->implementsFeature('1.3.6.1.4.1.37476.2.5.2.3.3')) { |
50 | if ($plugin->implementsFeature('1.3.6.1.4.1.37476.2.5.2.3.3')) { |
51 | $plugin->beforeObjectDelete($id); |
51 | $plugin->beforeObjectDelete($id); |
52 | } |
52 | } |
Line 95... | Line 95... | ||
95 | // Parameters: id, ra_email, comment, iris, asn1ids, confidential |
95 | // Parameters: id, ra_email, comment, iris, asn1ids, confidential |
96 | // Outputs: Text |
96 | // Outputs: Text |
97 | else if ($actionID == 'Update') { |
97 | else if ($actionID == 'Update') { |
98 | $id = $params['id']; |
98 | $id = $params['id']; |
99 | $obj = OIDplusObject::parse($id); |
99 | $obj = OIDplusObject::parse($id); |
100 | if ($obj === null) throw new OIDplusException("UPDATE action failed because object '$id' cannot be parsed!"); |
100 | if ($obj === null) throw new OIDplusException(_L('%1 action failed because object "%2" cannot be parsed!','UPDATE',$id)); |
101 | 101 | ||
102 | if (OIDplus::db()->query("select id from ###objects where id = ?", array($id))->num_rows() == 0) { |
102 | if (OIDplus::db()->query("select id from ###objects where id = ?", array($id))->num_rows() == 0) { |
103 | throw new OIDplusException("Object '$id' does not exist"); |
103 | throw new OIDplusException(_L('Object %1 does not exist',$id)); |
104 | } |
104 | } |
105 | 105 | ||
106 | // Check if permitted |
106 | // Check if permitted |
107 | if (!$obj->userHasParentalWriteRights()) throw new OIDplusException('Authentication error. Please log in as the superior RA to update this OID.'); |
107 | if (!$obj->userHasParentalWriteRights()) throw new OIDplusException(_L('Authentication error. Please log in as the superior RA to update this OID.')); |
108 | 108 | ||
109 | foreach (OIDplus::getPagePlugins() as $plugin) { |
109 | foreach (OIDplus::getPagePlugins() as $plugin) { |
110 | if ($plugin->implementsFeature('1.3.6.1.4.1.37476.2.5.2.3.3')) { |
110 | if ($plugin->implementsFeature('1.3.6.1.4.1.37476.2.5.2.3.3')) { |
111 | $plugin->beforeObjectUpdateSuperior($id, $params); |
111 | $plugin->beforeObjectUpdateSuperior($id, $params); |
112 | } |
112 | } |
113 | } |
113 | } |
114 | 114 | ||
115 | // Validate RA email address |
115 | // Validate RA email address |
116 | $new_ra = $params['ra_email']; |
116 | $new_ra = $params['ra_email']; |
117 | if (!empty($new_ra) && !OIDplus::mailUtils()->validMailAddress($new_ra)) { |
117 | if (!empty($new_ra) && !OIDplus::mailUtils()->validMailAddress($new_ra)) { |
118 | throw new OIDplusException('Invalid RA email address'); |
118 | throw new OIDplusException(_L('Invalid RA email address')); |
119 | } |
119 | } |
120 | 120 | ||
121 | // First, do a simulation for ASN.1 IDs and IRIs to check if there are any problems (then an Exception will be thrown) |
121 | // First, do a simulation for ASN.1 IDs and IRIs to check if there are any problems (then an Exception will be thrown) |
122 | if ($obj::ns() == 'oid') { |
122 | if ($obj::ns() == 'oid') { |
123 | $ids = ($params['iris'] == '') ? array() : explode(',',$params['iris']); |
123 | $ids = ($params['iris'] == '') ? array() : explode(',',$params['iris']); |
Line 191... | Line 191... | ||
191 | // Parameters: id, title, description |
191 | // Parameters: id, title, description |
192 | // Outputs: Text |
192 | // Outputs: Text |
193 | else if ($actionID == 'Update2') { |
193 | else if ($actionID == 'Update2') { |
194 | $id = $params['id']; |
194 | $id = $params['id']; |
195 | $obj = OIDplusObject::parse($id); |
195 | $obj = OIDplusObject::parse($id); |
196 | if ($obj === null) throw new OIDplusException("UPDATE2 action failed because object '$id' cannot be parsed!"); |
196 | if ($obj === null) throw new OIDplusException(_L('%1 action failed because object "%2" cannot be parsed!','UPDATE2',$id)); |
197 | 197 | ||
198 | if (OIDplus::db()->query("select id from ###objects where id = ?", array($id))->num_rows() == 0) { |
198 | if (OIDplus::db()->query("select id from ###objects where id = ?", array($id))->num_rows() == 0) { |
199 | throw new OIDplusException("Object '$id' does not exist"); |
199 | throw new OIDplusException(_L('Object %1 does not exist',$id)); |
200 | } |
200 | } |
201 | 201 | ||
202 | // Check if allowed |
202 | // Check if allowed |
203 | if (!$obj->userHasWriteRights()) throw new OIDplusException('Authentication error. Please log in as the RA to update this OID.'); |
203 | if (!$obj->userHasWriteRights()) throw new OIDplusException(_L('Authentication error. Please log in as the RA to update this OID.')); |
204 | 204 | ||
205 | foreach (OIDplus::getPagePlugins() as $plugin) { |
205 | foreach (OIDplus::getPagePlugins() as $plugin) { |
206 | if ($plugin->implementsFeature('1.3.6.1.4.1.37476.2.5.2.3.3')) { |
206 | if ($plugin->implementsFeature('1.3.6.1.4.1.37476.2.5.2.3.3')) { |
207 | $plugin->beforeObjectUpdateSelf($id, $params); |
207 | $plugin->beforeObjectUpdateSelf($id, $params); |
208 | } |
208 | } |
Line 228... | Line 228... | ||
228 | else if ($actionID == 'Insert') { |
228 | else if ($actionID == 'Insert') { |
229 | // Validated are: ID, ra email, asn1 ids, iri ids |
229 | // Validated are: ID, ra email, asn1 ids, iri ids |
230 | 230 | ||
231 | // Check if you have write rights on the parent (to create a new object) |
231 | // Check if you have write rights on the parent (to create a new object) |
232 | $objParent = OIDplusObject::parse($params['parent']); |
232 | $objParent = OIDplusObject::parse($params['parent']); |
233 | if ($objParent === null) throw new OIDplusException("INSERT action failed because parent object '".$params['parent']."' cannot be parsed!"); |
233 | if ($objParent === null) throw new OIDplusException(_L('%1 action failed because parent object "%2" cannot be parsed!','INSERT',$params['parent'])); |
234 | 234 | ||
235 | if (!$objParent::root() && (OIDplus::db()->query("select id from ###objects where id = ?", array($objParent->nodeId()))->num_rows() == 0)) { |
235 | if (!$objParent::root() && (OIDplus::db()->query("select id from ###objects where id = ?", array($objParent->nodeId()))->num_rows() == 0)) { |
236 | throw new OIDplusException("Parent object '".($objParent->nodeId())."' does not exist"); |
236 | throw new OIDplusException(_L('Parent object %1 does not exist','".($objParent->nodeId())."')); |
237 | } |
237 | } |
238 | 238 | ||
239 | if (!$objParent->userHasWriteRights()) throw new OIDplusException('Authentication error. Please log in as the correct RA to insert an OID at this arc.'); |
239 | if (!$objParent->userHasWriteRights()) throw new OIDplusException(_L('Authentication error. Please log in as the correct RA to insert an OID at this arc.')); |
240 | 240 | ||
241 | // Check if the ID is valid |
241 | // Check if the ID is valid |
242 | if ($params['id'] == '') throw new OIDplusException('ID may not be empty'); |
242 | if ($params['id'] == '') throw new OIDplusException(_L('ID may not be empty')); |
243 | 243 | ||
244 | // Determine absolute OID name |
244 | // Determine absolute OID name |
245 | // Note: At addString() and parse(), the syntax of the ID will be checked |
245 | // Note: At addString() and parse(), the syntax of the ID will be checked |
246 | $id = $objParent->addString($params['id']); |
246 | $id = $objParent->addString($params['id']); |
247 | 247 | ||
248 | // Check, if the OID exists |
248 | // Check, if the OID exists |
249 | $test = OIDplus::db()->query("select id from ###objects where id = ?", array($id)); |
249 | $test = OIDplus::db()->query("select id from ###objects where id = ?", array($id)); |
250 | if ($test->num_rows() >= 1) { |
250 | if ($test->num_rows() >= 1) { |
251 | throw new OIDplusException("Object $id already exists!"); |
251 | throw new OIDplusException(_L('Object %1 already exists!',$id)); |
252 | } |
252 | } |
253 | 253 | ||
254 | $obj = OIDplusObject::parse($id); |
254 | $obj = OIDplusObject::parse($id); |
255 | if ($obj === null) throw new OIDplusException("INSERT action failed because object '$id' cannot be parsed!"); |
255 | if ($obj === null) throw new OIDplusException(_L('%1 action failed because object "%2" cannot be parsed!','INSERT',$id)); |
256 | 256 | ||
257 | foreach (OIDplus::getPagePlugins() as $plugin) { |
257 | foreach (OIDplus::getPagePlugins() as $plugin) { |
258 | if ($plugin->implementsFeature('1.3.6.1.4.1.37476.2.5.2.3.3')) { |
258 | if ($plugin->implementsFeature('1.3.6.1.4.1.37476.2.5.2.3.3')) { |
259 | $plugin->beforeObjectInsert($id, $params); |
259 | $plugin->beforeObjectInsert($id, $params); |
260 | } |
260 | } |
Line 273... | Line 273... | ||
273 | 273 | ||
274 | // Apply superior RA change |
274 | // Apply superior RA change |
275 | $parent = $params['parent']; |
275 | $parent = $params['parent']; |
276 | $ra_email = $params['ra_email']; |
276 | $ra_email = $params['ra_email']; |
277 | if (!empty($ra_email) && !OIDplus::mailUtils()->validMailAddress($ra_email)) { |
277 | if (!empty($ra_email) && !OIDplus::mailUtils()->validMailAddress($ra_email)) { |
278 | throw new OIDplusException('Invalid RA email address'); |
278 | throw new OIDplusException(_L('Invalid RA email address')); |
279 | } |
279 | } |
280 | 280 | ||
281 | OIDplus::logger()->log("[INFO]OID($parent)+[INFO]OID($id)+[?INFO/!OK]OIDRA($parent)?/[?INFO/!OK]A?", "Object '$id' created, ".(empty($ra_email) ? "without defined RA" : "given to RA '$ra_email'")).", superior object is '$parent'"; |
281 | OIDplus::logger()->log("[INFO]OID($parent)+[INFO]OID($id)+[?INFO/!OK]OIDRA($parent)?/[?INFO/!OK]A?", "Object '$id' created, ".(empty($ra_email) ? "without defined RA" : "given to RA '$ra_email'")).", superior object is '$parent'"; |
282 | if (!empty($ra_email)) { |
282 | if (!empty($ra_email)) { |
283 | OIDplus::logger()->log("[INFO]RA($ra_email)!", "Gained ownership of newly created object '$id'"); |
283 | OIDplus::logger()->log("[INFO]RA($ra_email)!", "Gained ownership of newly created object '$id'"); |
Line 287... | Line 287... | ||
287 | $comment = $params['comment']; |
287 | $comment = $params['comment']; |
288 | $title = ''; |
288 | $title = ''; |
289 | $description = ''; |
289 | $description = ''; |
290 | 290 | ||
291 | if (strlen($id) > OIDplus::baseConfig()->getValue('LIMITS_MAX_ID_LENGTH')) { |
291 | if (strlen($id) > OIDplus::baseConfig()->getValue('LIMITS_MAX_ID_LENGTH')) { |
- | 292 | $maxlen = OIDplus::baseConfig()->getValue('LIMITS_MAX_ID_LENGTH'); |
|
292 | throw new OIDplusException("The identifier '$id' is too long (max allowed length: ".OIDplus::baseConfig()->getValue('LIMITS_MAX_ID_LENGTH').")"); |
293 | throw new OIDplusException(_L('The identifier %1 is too long (max allowed length: %2)',$id,$maxlen)); |
293 | } |
294 | } |
294 | 295 | ||
295 | OIDplus::db()->query("INSERT INTO ###objects (id, parent, ra_email, confidential, comment, created, title, description) VALUES (?, ?, ?, ?, ?, ".OIDplus::db()->sqlDate().", ?, ?)", array($id, $parent, $ra_email, $confidential, $comment, $title, $description)); |
296 | OIDplus::db()->query("INSERT INTO ###objects (id, parent, ra_email, confidential, comment, created, title, description) VALUES (?, ?, ?, ?, ?, ".OIDplus::db()->sqlDate().", ?, ?)", array($id, $parent, $ra_email, $confidential, $comment, $title, $description)); |
296 | 297 | ||
297 | // Set ASN.1 IDs und IRIs |
298 | // Set ASN.1 IDs und IRIs |
Line 319... | Line 320... | ||
319 | } |
320 | } |
320 | } |
321 | } |
321 | 322 | ||
322 | return array("status" => $status); |
323 | return array("status" => $status); |
323 | } else { |
324 | } else { |
324 | throw new OIDplusException("Unknown action ID"); |
325 | throw new OIDplusException(_L('Unknown action ID')); |
325 | } |
326 | } |
326 | } |
327 | } |
327 | 328 | ||
328 | public function init($html=true) { |
329 | public function init($html=true) { |
329 | } |
330 | } |
Line 333... | Line 334... | ||
333 | $handled = true; |
334 | $handled = true; |
334 | 335 | ||
335 | $out['title'] = OIDplus::config()->getValue('system_title'); |
336 | $out['title'] = OIDplus::config()->getValue('system_title'); |
336 | $out['icon'] = OIDplus::webpath(__DIR__).'system_big.png'; |
337 | $out['icon'] = OIDplus::webpath(__DIR__).'system_big.png'; |
337 | 338 | ||
- | 339 | if (file_exists(OIDplus::basePath() . '/userdata/welcome/welcome$'.OIDplus::getCurrentLang().'.html')) { |
|
- | 340 | $out['text'] = file_get_contents(OIDplus::basePath() . '/userdata/welcome/welcome$'.OIDplus::getCurrentLang().'.html'); |
|
338 | if (file_exists(OIDplus::basePath() . '/userdata/welcome/welcome.html')) { |
341 | } else if (file_exists(OIDplus::basePath() . '/userdata/welcome/welcome.html')) { |
339 | $out['text'] = file_get_contents(OIDplus::basePath() . '/userdata/welcome/welcome.html'); |
342 | $out['text'] = file_get_contents(OIDplus::basePath() . '/userdata/welcome/welcome.html'); |
340 | } else if (file_exists(__DIR__ . '/welcome.local.html')) { |
343 | } else if (file_exists(__DIR__ . '/welcome.local.html')) { |
- | 344 | $out['text'] = file_get_contents(__DIR__ . '/welcome.local.html'); // Backwards compatibility. Do not use! |
|
- | 345 | } else if (file_exists(__DIR__ . '/welcome$'.OIDplus::getCurrentLang().'.html')) { |
|
341 | $out['text'] = file_get_contents(__DIR__ . '/welcome.local.html'); |
346 | $out['text'] = file_get_contents(__DIR__ . '/welcome$'.OIDplus::getCurrentLang().'.html'); |
342 | } else if (file_exists(__DIR__ . '/welcome.html')) { |
347 | } else if (file_exists(__DIR__ . '/welcome.html')) { |
343 | $out['text'] = file_get_contents(__DIR__ . '/welcome.html'); |
348 | $out['text'] = file_get_contents(__DIR__ . '/welcome.html'); |
344 | } else { |
349 | } else { |
345 | $out['text'] = ''; |
350 | $out['text'] = ''; |
346 | } |
351 | } |
347 | 352 | ||
- | 353 | // make sure the program works even if the user provided HTML is not UTF-8 |
|
- | 354 | $out['text'] = iconv(mb_detect_encoding($out['text'], mb_detect_order(), true), 'UTF-8', $out['text']); |
|
- | 355 | ||
348 | if (strpos($out['text'], '%%OBJECT_TYPE_LIST%%') !== false) { |
356 | if (strpos($out['text'], '%%OBJECT_TYPE_LIST%%') !== false) { |
349 | $tmp = '<ul>'; |
357 | $tmp = '<ul>'; |
350 | foreach (OIDplus::getEnabledObjectTypes() as $ot) { |
358 | foreach (OIDplus::getEnabledObjectTypes() as $ot) { |
351 | $tmp .= '<li><a '.OIDplus::gui()->link($ot::root()).'>'.htmlentities($ot::objectTypeTitle()).'</a></li>'; |
359 | $tmp .= '<li><a '.OIDplus::gui()->link($ot::root()).'>'.htmlentities($ot::objectTypeTitle()).'</a></li>'; |
352 | } |
360 | } |
Line 365... | Line 373... | ||
365 | 373 | ||
366 | if (!is_null($obj)) { |
374 | if (!is_null($obj)) { |
367 | $handled = true; |
375 | $handled = true; |
368 | 376 | ||
369 | if (!$obj->userHasReadRights()) { |
377 | if (!$obj->userHasReadRights()) { |
370 | $out['title'] = 'Access denied'; |
378 | $out['title'] = _L('Access denied'); |
371 | $out['icon'] = 'img/error_big.png'; |
379 | $out['icon'] = 'img/error_big.png'; |
372 | $out['text'] = '<p>Please <a '.OIDplus::gui()->link('oidplus:login').'>log in</a> to receive information about this object.</p>'; |
380 | $out['text'] = '<p>'._L('Please <a %1>log in</a> to receive information about this object.',OIDplus::gui()->link('oidplus:login')).'</p>'; |
373 | return; |
381 | return; |
374 | } |
382 | } |
375 | 383 | ||
376 | $parent = null; |
384 | $parent = null; |
377 | $res = null; |
385 | $res = null; |
Line 386... | Line 394... | ||
386 | break; |
394 | break; |
387 | } else { |
395 | } else { |
388 | $res = OIDplus::db()->query("select * from ###objects where id = ?", array($obj->nodeId())); |
396 | $res = OIDplus::db()->query("select * from ###objects where id = ?", array($obj->nodeId())); |
389 | if ($res->num_rows() == 0) { |
397 | if ($res->num_rows() == 0) { |
390 | http_response_code(404); |
398 | http_response_code(404); |
391 | $out['title'] = 'Object not found'; |
399 | $out['title'] = _L('Object not found'); |
392 | $out['icon'] = 'img/error_big.png'; |
400 | $out['icon'] = 'img/error_big.png'; |
393 | $out['text'] = 'The object <code>'.htmlentities($id).'</code> was not found in this database.'; |
401 | $out['text'] = _L('The object %1 was not found in this database.','<code>'.htmlentities($id).'</code>'); |
394 | return; |
402 | return; |
395 | } else { |
403 | } else { |
396 | $row = $res->fetch_array(); // will be used further down the code |
404 | $row = $res->fetch_array(); // will be used further down the code |
397 | $obj->getContentPage($out['title'], $out['text'], $out['icon']); |
405 | $obj->getContentPage($out['title'], $out['text'], $out['icon']); |
398 | if (empty($out['title'])) $out['title'] = explode(':',$id,2)[1]; |
406 | if (empty($out['title'])) $out['title'] = explode(':',$id,2)[1]; |
Line 402... | Line 410... | ||
402 | } |
410 | } |
403 | } |
411 | } |
404 | } |
412 | } |
405 | if (!$matches_any_registered_type) { |
413 | if (!$matches_any_registered_type) { |
406 | http_response_code(404); |
414 | http_response_code(404); |
407 | $out['title'] = 'Object not found'; |
415 | $out['title'] = _L('Object not found'); |
408 | $out['icon'] = 'img/error_big.png'; |
416 | $out['icon'] = 'img/error_big.png'; |
409 | $out['text'] = 'The object <code>'.htmlentities($id).'</code> was not found in this database.'; |
417 | $out['text'] = _L('The object %1 was not found in this database.','<code>'.htmlentities($id).'</code>'); |
410 | return; |
418 | return; |
411 | } |
419 | } |
412 | 420 | ||
413 | // --- |
421 | // --- |
414 | 422 | ||
415 | if ($parent) { |
423 | if ($parent) { |
416 | if ($parent->isRoot()) { |
424 | if ($parent->isRoot()) { |
417 | 425 | ||
418 | $parent_link_text = $parent->objectTypeTitle(); |
426 | $parent_link_text = $parent->objectTypeTitle(); |
419 | $out['text'] = '<p><a '.OIDplus::gui()->link($parent->root()).'><img src="img/arrow_back.png" width="16"> Parent node: '.htmlentities($parent_link_text).'</a></p>' . $out['text']; |
427 | $out['text'] = '<p><a '.OIDplus::gui()->link($parent->root()).'><img src="img/arrow_back.png" width="16"> '._L('Parent node: %1',htmlentities($parent_link_text)).'</a></p>' . $out['text']; |
420 | 428 | ||
421 | } else { |
429 | } else { |
422 | $res_ = OIDplus::db()->query("select * from ###objects where id = ?", array($parent->nodeId())); |
430 | $res_ = OIDplus::db()->query("select * from ###objects where id = ?", array($parent->nodeId())); |
423 | if ($res_->num_rows() > 0) { |
431 | if ($res_->num_rows() > 0) { |
424 | $row_ = $res_->fetch_array(); |
432 | $row_ = $res_->fetch_array(); |
Line 433... | Line 441... | ||
433 | } |
441 | } |
434 | } |
442 | } |
435 | 443 | ||
436 | $parent_link_text = empty($parent_title) ? explode(':',$parent->nodeId())[1] : $parent_title.' ('.explode(':',$parent->nodeId())[1].')'; |
444 | $parent_link_text = empty($parent_title) ? explode(':',$parent->nodeId())[1] : $parent_title.' ('.explode(':',$parent->nodeId())[1].')'; |
437 | 445 | ||
438 | $out['text'] = '<p><a '.OIDplus::gui()->link($parent->nodeId()).'><img src="img/arrow_back.png" width="16"> Parent node: '.htmlentities($parent_link_text).'</a></p>' . $out['text']; |
446 | $out['text'] = '<p><a '.OIDplus::gui()->link($parent->nodeId()).'><img src="img/arrow_back.png" width="16"> '._L('Parent node: %1',htmlentities($parent_link_text)).'</a></p>' . $out['text']; |
439 | } else { |
447 | } else { |
440 | $out['text'] = ''; |
448 | $out['text'] = ''; |
441 | } |
449 | } |
442 | } |
450 | } |
443 | } else { |
451 | } else { |
444 | $parent_link_text = 'Go back to front page'; |
452 | $parent_link_text = _L('Go back to front page'); |
445 | $out['text'] = '<p><a '.OIDplus::gui()->link('oidplus:system').'><img src="img/arrow_back.png" width="16"> '.htmlentities($parent_link_text).'</a></p>' . $out['text']; |
453 | $out['text'] = '<p><a '.OIDplus::gui()->link('oidplus:system').'><img src="img/arrow_back.png" width="16"> '.htmlentities($parent_link_text).'</a></p>' . $out['text']; |
446 | } |
454 | } |
447 | 455 | ||
448 | // --- |
456 | // --- |
449 | 457 | ||
450 | if (!is_null($row) && isset($row['description'])) { |
458 | if (!is_null($row) && isset($row['description'])) { |
451 | if (empty($row['description'])) { |
459 | if (empty($row['description'])) { |
452 | if (empty($row['title'])) { |
460 | if (empty($row['title'])) { |
453 | $desc = '<p><i>No description for this object available</i></p>'; |
461 | $desc = '<p><i>'._L('No description for this object available').'</i></p>'; |
454 | } else { |
462 | } else { |
455 | $desc = $row['title']; |
463 | $desc = $row['title']; |
456 | } |
464 | } |
457 | } else { |
465 | } else { |
458 | $desc = self::objDescription($row['description']); |
466 | $desc = self::objDescription($row['description']); |
459 | } |
467 | } |
460 | 468 | ||
461 | if ($obj->userHasWriteRights()) { |
469 | if ($obj->userHasWriteRights()) { |
462 | $rand = ++self::$crudCounter; |
470 | $rand = ++self::$crudCounter; |
463 | $desc = '<noscript><p><b>You need to enable JavaScript to edit title or description of this object.</b></p>'.$desc.'</noscript>'; |
471 | $desc = '<noscript><p><b>'._L('You need to enable JavaScript to edit title or description of this object.').'</b></p>'.$desc.'</noscript>'; |
464 | $desc .= '<div class="container box" style="display:none" id="descbox_'.$rand.'">'; |
472 | $desc .= '<div class="container box" style="display:none" id="descbox_'.$rand.'">'; |
465 | $desc .= 'Title: <input type="text" name="title" id="titleedit" value="'.htmlentities($row['title']).'"><br><br>Description:<br>'; |
473 | $desc .= _L('Title').': <input type="text" name="title" id="titleedit" value="'.htmlentities($row['title']).'"><br><br>'._L('Description').':<br>'; |
466 | $desc .= self::showMCE('description', $row['description']); |
474 | $desc .= self::showMCE('description', $row['description']); |
467 | $desc .= '<button type="button" name="update_desc" id="update_desc" class="btn btn-success btn-xs update" onclick="updateDesc()">Update description</button>'; |
475 | $desc .= '<button type="button" name="update_desc" id="update_desc" class="btn btn-success btn-xs update" onclick="updateDesc()">'._L('Update description').'</button>'; |
468 | $desc .= '</div>'; |
476 | $desc .= '</div>'; |
469 | $desc .= '<script>document.getElementById("descbox_'.$rand.'").style.display = "block";</script>'; |
477 | $desc .= '<script>document.getElementById("descbox_'.$rand.'").style.display = "block";</script>'; |
470 | } |
478 | } |
471 | } else { |
479 | } else { |
472 | $desc = ''; |
480 | $desc = ''; |
Line 481... | Line 489... | ||
481 | if (strpos($out['text'], '%%RA_INFO%%') !== false) |
489 | if (strpos($out['text'], '%%RA_INFO%%') !== false) |
482 | $out['text'] = str_replace('%%RA_INFO%%', OIDplusPagePublicRaInfo::showRaInfo($row['ra_email']), $out['text']); |
490 | $out['text'] = str_replace('%%RA_INFO%%', OIDplusPagePublicRaInfo::showRaInfo($row['ra_email']), $out['text']); |
483 | 491 | ||
484 | $alt_ids = $obj->getAltIds(); |
492 | $alt_ids = $obj->getAltIds(); |
485 | if (count($alt_ids) > 0) { |
493 | if (count($alt_ids) > 0) { |
486 | $out['text'] .= "<h2>Alternative Identifiers</h2>"; |
494 | $out['text'] .= '<h2>'._L('Alternative Identifiers').'</h2>'; |
487 | foreach ($alt_ids as $alt_id) { |
495 | foreach ($alt_ids as $alt_id) { |
488 | $ns = $alt_id->getNamespace(); |
496 | $ns = $alt_id->getNamespace(); |
489 | $aid = $alt_id->getId(); |
497 | $aid = $alt_id->getId(); |
490 | $aiddesc = $alt_id->getDescription(); |
498 | $aiddesc = $alt_id->getDescription(); |
491 | $out['text'] .= "$aiddesc <code>$ns:$aid</code><br>"; |
499 | $out['text'] .= "$aiddesc <code>$ns:$aid</code><br>"; |
Line 501... | Line 509... | ||
501 | } |
509 | } |
502 | 510 | ||
503 | private function publicSitemap_rec($json, &$out) { |
511 | private function publicSitemap_rec($json, &$out) { |
504 | foreach ($json as $x) { |
512 | foreach ($json as $x) { |
505 | if (isset($x['id']) && $x['id']) { |
513 | if (isset($x['id']) && $x['id']) { |
506 | $out[] = OIDplus::getSystemUrl().'?goto='.urlencode($x['id']); |
514 | $out[] = $x['id']; |
507 | } |
515 | } |
508 | if (isset($x['children'])) { |
516 | if (isset($x['children'])) { |
509 | $this->publicSitemap_rec($x['children'], $out); |
517 | $this->publicSitemap_rec($x['children'], $out); |
510 | } |
518 | } |
511 | } |
519 | } |
Line 517... | Line 525... | ||
517 | $this->publicSitemap_rec($json, $out); |
525 | $this->publicSitemap_rec($json, $out); |
518 | } |
526 | } |
519 | 527 | ||
520 | public function tree(&$json, $ra_email=null, $nonjs=false, $req_goto='') { |
528 | public function tree(&$json, $ra_email=null, $nonjs=false, $req_goto='') { |
521 | if ($nonjs) { |
529 | if ($nonjs) { |
522 | $json[] = array('id' => 'oidplus:system', 'icon' => OIDplus::webpath(__DIR__).'system.png', 'text' => 'System'); |
530 | $json[] = array('id' => 'oidplus:system', 'icon' => OIDplus::webpath(__DIR__).'system.png', 'text' => _L('System')); |
523 | 531 | ||
524 | $parent = ''; |
532 | $parent = ''; |
525 | $res = OIDplus::db()->query("select parent from ###objects where id = ?", array($req_goto)); |
533 | $res = OIDplus::db()->query("select parent from ###objects where id = ?", array($req_goto)); |
526 | while ($row = $res->fetch_object()) { |
534 | while ($row = $res->fetch_object()) { |
527 | $parent = $row->parent; |
535 | $parent = $row->parent; |
Line 613... | Line 621... | ||
613 | $objTypesChildren[] = $child; |
621 | $objTypesChildren[] = $child; |
614 | } |
622 | } |
615 | 623 | ||
616 | $json[] = array( |
624 | $json[] = array( |
617 | 'id' => "oidplus:system", |
625 | 'id' => "oidplus:system", |
618 | 'text' => "Objects", |
626 | 'text' => _L('Objects'), |
619 | 'state' => array( |
627 | 'state' => array( |
620 | "opened" => true, |
628 | "opened" => true, |
621 | // "selected" => true) // "selected" ist buggy: 1) Das select-Event wird beim Laden nicht gefeuert 2) Die direkt untergeordneten Knoten lassen sich nicht öffnen (laden für ewig) |
629 | // "selected" => true) // "selected" ist buggy: 1) Das select-Event wird beim Laden nicht gefeuert 2) Die direkt untergeordneten Knoten lassen sich nicht öffnen (laden für ewig) |
622 | ), |
630 | ), |
623 | 'icon' => OIDplus::webpath(__DIR__).'system.png', |
631 | 'icon' => OIDplus::webpath(__DIR__).'system.png', |
Line 675... | Line 683... | ||
675 | 683 | ||
676 | $output = ''; |
684 | $output = ''; |
677 | $output .= '<div class="container box"><div id="suboid_table" class="table-responsive">'; |
685 | $output .= '<div class="container box"><div id="suboid_table" class="table-responsive">'; |
678 | $output .= '<table class="table table-bordered table-striped">'; |
686 | $output .= '<table class="table table-bordered table-striped">'; |
679 | $output .= ' <tr>'; |
687 | $output .= ' <tr>'; |
680 | $output .= ' <th>ID'.(($parentNS == 'gs1') ? ' (without check digit)' : '').'</th>'; |
688 | $output .= ' <th>'._L('ID').(($parentNS == 'gs1') ? ' '._L('(without check digit)') : '').'</th>'; |
681 | if ($parentNS == 'oid') { |
689 | if ($parentNS == 'oid') { |
682 | if ($one_weid_available) $output .= ' <th>WEID</th>'; |
690 | if ($one_weid_available) $output .= ' <th>'._L('WEID').'</th>'; |
683 | $output .= ' <th>ASN.1 IDs (comma sep.)</th>'; |
691 | $output .= ' <th>'._L('ASN.1 IDs (comma sep.)').'</th>'; |
684 | $output .= ' <th>IRI IDs (comma sep.)</th>'; |
692 | $output .= ' <th>'._L('IRI IDs (comma sep.)').'</th>'; |
685 | } |
693 | } |
686 | $output .= ' <th>RA</th>'; |
694 | $output .= ' <th>'._L('RA').'</th>'; |
687 | $output .= ' <th>Comment</th>'; |
695 | $output .= ' <th>'._L('Comment').'</th>'; |
688 | if ($objParent->userHasWriteRights()) { |
696 | if ($objParent->userHasWriteRights()) { |
689 | $output .= ' <th>Hide</th>'; |
697 | $output .= ' <th>'._L('Hide').'</th>'; |
690 | $output .= ' <th>Update</th>'; |
698 | $output .= ' <th>'._L('Update').'</th>'; |
691 | $output .= ' <th>Delete</th>'; |
699 | $output .= ' <th>'._L('Delete').'</th>'; |
692 | } |
700 | } |
693 | $output .= ' <th>Created</th>'; |
701 | $output .= ' <th>'._L('Created').'</th>'; |
694 | $output .= ' <th>Updated</th>'; |
702 | $output .= ' <th>'._L('Updated').'</th>'; |
695 | $output .= ' </tr>'; |
703 | $output .= ' </tr>'; |
696 | 704 | ||
697 | foreach ($rows as list($obj,$row)) { |
705 | foreach ($rows as list($obj,$row)) { |
698 | $items_total++; |
706 | $items_total++; |
699 | if (!$obj->userHasReadRights()) { |
707 | if (!$obj->userHasReadRights()) { |
Line 724... | Line 732... | ||
724 | if ($parentNS == 'oid') { |
732 | if ($parentNS == 'oid') { |
725 | if ($one_weid_available) { |
733 | if ($one_weid_available) { |
726 | if ($obj->isWeid(false)) { |
734 | if ($obj->isWeid(false)) { |
727 | $output .= ' <td>'.$obj->weidArc().'</td>'; |
735 | $output .= ' <td>'.$obj->weidArc().'</td>'; |
728 | } else { |
736 | } else { |
729 | $output .= ' <td>n/a</td>'; |
737 | $output .= ' <td>'._L('n/a').'</td>'; |
730 | } |
738 | } |
731 | } |
739 | } |
732 | $output .= ' <td><input type="text" id="asn1ids_'.$row->id.'" value="'.implode(', ', $asn1ids).'"></td>'; |
740 | $output .= ' <td><input type="text" id="asn1ids_'.$row->id.'" value="'.implode(', ', $asn1ids).'"></td>'; |
733 | $output .= ' <td><input type="text" id="iris_'.$row->id.'" value="'.implode(', ', $iris).'"></td>'; |
741 | $output .= ' <td><input type="text" id="iris_'.$row->id.'" value="'.implode(', ', $iris).'"></td>'; |
734 | } |
742 | } |
735 | $output .= ' <td><input type="text" id="ra_email_'.$row->id.'" value="'.htmlentities($row->ra_email).'"></td>'; |
743 | $output .= ' <td><input type="text" id="ra_email_'.$row->id.'" value="'.htmlentities($row->ra_email).'"></td>'; |
736 | $output .= ' <td><input type="text" id="comment_'.$row->id.'" value="'.htmlentities($row->comment).'"></td>'; |
744 | $output .= ' <td><input type="text" id="comment_'.$row->id.'" value="'.htmlentities($row->comment).'"></td>'; |
737 | $output .= ' <td><input type="checkbox" id="hide_'.$row->id.'" '.($row->confidential ? 'checked' : '').'></td>'; |
745 | $output .= ' <td><input type="checkbox" id="hide_'.$row->id.'" '.($row->confidential ? 'checked' : '').'></td>'; |
738 | $output .= ' <td><button type="button" name="update_'.$row->id.'" id="update_'.$row->id.'" class="btn btn-success btn-xs update" onclick="crudActionUpdate('.js_escape($row->id).', '.js_escape($parent).')">Update</button></td>'; |
746 | $output .= ' <td><button type="button" name="update_'.$row->id.'" id="update_'.$row->id.'" class="btn btn-success btn-xs update" onclick="crudActionUpdate('.js_escape($row->id).', '.js_escape($parent).')">'._L('Update').'</button></td>'; |
739 | $output .= ' <td><button type="button" name="delete_'.$row->id.'" id="delete_'.$row->id.'" class="btn btn-danger btn-xs delete" onclick="crudActionDelete('.js_escape($row->id).', '.js_escape($parent).')">Delete</button></td>'; |
747 | $output .= ' <td><button type="button" name="delete_'.$row->id.'" id="delete_'.$row->id.'" class="btn btn-danger btn-xs delete" onclick="crudActionDelete('.js_escape($row->id).', '.js_escape($parent).')">'._L('Delete').'</button></td>'; |
740 | $output .= ' <td>'.$date_created.'</td>'; |
748 | $output .= ' <td>'.$date_created.'</td>'; |
741 | $output .= ' <td>'.$date_updated.'</td>'; |
749 | $output .= ' <td>'.$date_updated.'</td>'; |
742 | } else { |
750 | } else { |
743 | if ($asn1ids == '') $asn1ids = '<i>(none)</i>'; |
751 | if ($asn1ids == '') $asn1ids = '<i>'._L('(none)').'</i>'; |
744 | if ($iris == '') $iris = '<i>(none)</i>'; |
752 | if ($iris == '') $iris = '<i>'._L('(none)').'</i>'; |
745 | if ($parentNS == 'oid') { |
753 | if ($parentNS == 'oid') { |
746 | if ($one_weid_available) { |
754 | if ($one_weid_available) { |
747 | if ($obj->isWeid(false)) { |
755 | if ($obj->isWeid(false)) { |
748 | $output .= ' <td>'.$obj->weidArc().'</td>'; |
756 | $output .= ' <td>'.$obj->weidArc().'</td>'; |
749 | } else { |
757 | } else { |
750 | $output .= ' <td>n/a</td>'; |
758 | $output .= ' <td>'._L('n/a').'</td>'; |
751 | } |
759 | } |
752 | } |
760 | } |
753 | $asn1ids_ext = array(); |
761 | $asn1ids_ext = array(); |
754 | foreach ($asn1ids as $asn1id) { |
762 | foreach ($asn1ids as $asn1id) { |
755 | $asn1ids_ext[] = '<a href="?goto='.urlencode($row->id).'" onclick="openAndSelectNode('.js_escape($row->id).', '.js_escape($parent).'); return false;">'.$asn1id.'</a>'; |
763 | $asn1ids_ext[] = '<a href="?goto='.urlencode($row->id).'" onclick="openAndSelectNode('.js_escape($row->id).', '.js_escape($parent).'); return false;">'.$asn1id.'</a>'; |
Line 785... | Line 793... | ||
785 | if ($parentNS == 'oid') $output .= ' <td><input type="text" id="asn1ids" value=""></td>'; |
793 | if ($parentNS == 'oid') $output .= ' <td><input type="text" id="asn1ids" value=""></td>'; |
786 | if ($parentNS == 'oid') $output .= ' <td><input type="text" id="iris" value=""></td>'; |
794 | if ($parentNS == 'oid') $output .= ' <td><input type="text" id="iris" value=""></td>'; |
787 | $output .= ' <td><input type="text" id="ra_email" value="'.htmlentities($parent_ra_email).'"></td>'; |
795 | $output .= ' <td><input type="text" id="ra_email" value="'.htmlentities($parent_ra_email).'"></td>'; |
788 | $output .= ' <td><input type="text" id="comment" value=""></td>'; |
796 | $output .= ' <td><input type="text" id="comment" value=""></td>'; |
789 | $output .= ' <td><input type="checkbox" id="hide"></td>'; |
797 | $output .= ' <td><input type="checkbox" id="hide"></td>'; |
790 | $output .= ' <td><button type="button" name="insert" id="insert" class="btn btn-success btn-xs update" onclick="crudActionInsert('.js_escape($parent).')">Insert</button></td>'; |
798 | $output .= ' <td><button type="button" name="insert" id="insert" class="btn btn-success btn-xs update" onclick="crudActionInsert('.js_escape($parent).')">'._L('Insert').'</button></td>'; |
791 | $output .= ' <td></td>'; |
799 | $output .= ' <td></td>'; |
792 | $output .= ' <td></td>'; |
800 | $output .= ' <td></td>'; |
793 | $output .= ' <td></td>'; |
801 | $output .= ' <td></td>'; |
794 | $output .= '</tr>'; |
802 | $output .= '</tr>'; |
795 | } else { |
803 | } else { |
796 | if ($items_total-$items_hidden == 0) { |
804 | if ($items_total-$items_hidden == 0) { |
797 | $cols = ($parentNS == 'oid') ? 7 : 5; |
805 | $cols = ($parentNS == 'oid') ? 7 : 5; |
798 | if ($one_weid_available) $cols++; |
806 | if ($one_weid_available) $cols++; |
799 | $output .= '<tr><td colspan="'.$cols.'">No items available</td></tr>'; |
807 | $output .= '<tr><td colspan="'.$cols.'">'._L('No items available').'</td></tr>'; |
800 | } |
808 | } |
801 | } |
809 | } |
802 | 810 | ||
803 | $output .= '</table>'; |
811 | $output .= '</table>'; |
804 | $output .= '</div></div>'; |
812 | $output .= '</div></div>'; |
805 | 813 | ||
806 | if ($items_hidden == 1) { |
814 | if ($items_hidden == 1) { |
807 | $output .= '<p>'.$items_hidden.' item is hidden. Please <a '.OIDplus::gui()->link('oidplus:login').'>log in</a> to see it.</p>'; |
815 | $output .= '<p>'._L('One item is hidden. Please <a %1>log in</a> to see it.',$items_hidden,OIDplus::gui()->link('oidplus:login')).'</p>'; |
808 | } else if ($items_hidden > 1) { |
816 | } else if ($items_hidden > 1) { |
809 | $output .= '<p>'.$items_hidden.' items are hidden. Please <a '.OIDplus::gui()->link('oidplus:login').'>log in</a> to see them.</p>'; |
817 | $output .= '<p>'._L('%1 items are hidden. Please <a %2>log in</a> to see them.',$items_hidden,OIDplus::gui()->link('oidplus:login')).'</p>'; |
810 | } |
818 | } |
811 | 819 | ||
812 | return $output; |
820 | return $output; |
813 | } |
821 | } |
814 | 822 | ||
Line 870... | Line 878... | ||
870 | } |
878 | } |
871 | 879 | ||
872 | public function oobeEntry($step, $do_edits, &$errors_happened)/*: void*/ { |
880 | public function oobeEntry($step, $do_edits, &$errors_happened)/*: void*/ { |
873 | // Interface 1.3.6.1.4.1.37476.2.5.2.3.1 |
881 | // Interface 1.3.6.1.4.1.37476.2.5.2.3.1 |
874 | 882 | ||
875 | echo "<p><u>Step $step: Enable/Disable object type plugins</u></p>"; |
883 | echo '<p><u>'._L('Step %1: Enable/Disable object type plugins',$step).'</u></p>'; |
876 | echo '<p>Which object types do you want to manage using OIDplus?</p>'; |
884 | echo '<p>'._L('Which object types do you want to manage using OIDplus?').'</p>'; |
877 | 885 | ||
878 | $enabled_ary = array(); |
886 | $enabled_ary = array(); |
879 | 887 | ||
880 | foreach (OIDplus::getEnabledObjectTypes() as $ot) { |
888 | foreach (OIDplus::getEnabledObjectTypes() as $ot) { |
881 | echo '<input type="checkbox" name="enable_ot_'.$ot::ns().'" id="enable_ot_'.$ot::ns().'"'; |
889 | echo '<input type="checkbox" name="enable_ot_'.$ot::ns().'" id="enable_ot_'.$ot::ns().'"'; |