link.ajax.php 893 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. <?php
  2. /* For licensing terms, see /license.txt */
  3. /**
  4. * Responses to AJAX calls.
  5. */
  6. require_once __DIR__.'/../global.inc.php';
  7. api_protect_course_script(true);
  8. $action = $_REQUEST['a'];
  9. switch ($action) {
  10. case 'check_url':
  11. if (api_is_allowed_to_edit(null, true)) {
  12. $url = $_REQUEST['url'];
  13. $result = \Link::checkUrl($url);
  14. if ($result) {
  15. echo Display::return_icon(
  16. 'check-circle.png',
  17. get_lang('Ok'),
  18. null,
  19. ICON_SIZE_TINY
  20. );
  21. } else {
  22. echo Display::return_icon(
  23. 'closed-circle.png',
  24. get_lang('Wrong'),
  25. null,
  26. ICON_SIZE_TINY
  27. );
  28. }
  29. }
  30. break;
  31. default:
  32. echo '';
  33. }
  34. exit;