hotspot_lang_conversion.php 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. <?php
  2. /* For licensing terms, see /license.txt */
  3. /**
  4. * Hotspot language conversion.
  5. *
  6. * @package chamilo.exercise
  7. *
  8. * @author
  9. *
  10. * @deprecated ?
  11. *
  12. * @version $Id: admin.php 10680 2007-01-11 21:26:23Z pcool $
  13. */
  14. require_once __DIR__.'/../inc/global.inc.php';
  15. $hotspot_lang_file = api_get_path(SYS_LANG_PATH);
  16. if (isset($_GET['lang'])) {
  17. //$search = array('../','\\0','\\');
  18. $lang = urldecode($_GET['lang']);
  19. if (preg_match('/^[a-zA-Z0-9\._-]+$/', $lang)) {
  20. //$lang = str_replace($search,$replace,urldecode($_GET['lang']));
  21. if (file_exists($hotspot_lang_file.$lang.'/hotspot.inc.php')) {
  22. $hotspot_lang_file .= $lang.'/hotspot.inc.php';
  23. } else {
  24. $hotspot_lang_file .= 'english/hotspot.inc.php';
  25. }
  26. } else {
  27. $hotspot_lang_file .= 'english/hotspot.inc.php';
  28. }
  29. } else {
  30. $hotspot_lang_file .= 'english/hotspot.inc.php';
  31. }
  32. $file = file($hotspot_lang_file);
  33. $temp = [];
  34. foreach ($file as $value) {
  35. $explode = explode('=', $value);
  36. if (count($explode) > 1) {
  37. $explode[0] = trim($explode[0]);
  38. $explode[0] = '&'.substr($explode[0], 1, strlen($explode[0]));
  39. $explode[1] = trim($explode[1]);
  40. $explode[1] = substr($explode[1], 0, strlen($explode[1]) - 1);
  41. $explode[1] = str_replace('"', '', $explode[1]);
  42. $temp[] = $explode[0].'='.$explode[1];
  43. }
  44. }
  45. foreach ($temp as $value) {
  46. echo $value.' ';
  47. }