hotspot_lang_conversion.php 1.3 KB

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