hotspot_lang_conversion.php 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  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. require_once __DIR__.'/../inc/global.inc.php';
  11. $hotspot_lang_file = api_get_path(SYS_LANG_PATH);
  12. if (isset($_GET['lang'])) {
  13. //$search = array('../','\\0','\\');
  14. $lang = urldecode($_GET['lang']);
  15. if (preg_match('/^[a-zA-Z0-9\._-]+$/', $lang)) {
  16. //$lang = str_replace($search,$replace,urldecode($_GET['lang']));
  17. if (file_exists($hotspot_lang_file.$lang.'/hotspot.inc.php')) {
  18. $hotspot_lang_file .= $lang.'/hotspot.inc.php';
  19. } else {
  20. $hotspot_lang_file .= 'english/hotspot.inc.php';
  21. }
  22. } else {
  23. $hotspot_lang_file .= 'english/hotspot.inc.php';
  24. }
  25. } else {
  26. $hotspot_lang_file .= 'english/hotspot.inc.php';
  27. }
  28. $file = file($hotspot_lang_file);
  29. $temp = array();
  30. foreach ($file as $value) {
  31. $explode = explode('=', $value);
  32. if (count($explode) > 1) {
  33. $explode[0] = trim($explode[0]);
  34. $explode[0] = '&'.substr($explode[0], 1, strlen($explode[0]));
  35. $explode[1] = trim($explode[1]);
  36. $explode[1] = substr($explode[1], 0, strlen($explode[1]) - 1);
  37. $explode[1] = str_replace('"', '', $explode[1]);
  38. $temp[] = $explode[0].'='.$explode[1];
  39. }
  40. }
  41. foreach ($temp as $value) {
  42. echo $value.' ';
  43. }