hotspot_lang_conversion.php 1.3 KB

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