hotspot_lang_conversion.php 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. <?php //$id:$
  2. /* For licensing terms, see /dokeos_license.txt */
  3. //error_log(__FILE__);
  4. /**
  5. * Hotspot languae conversion
  6. * @package dokeos.exercise
  7. * @author
  8. * @version $Id: admin.php 10680 2007-01-11 21:26:23Z pcool $
  9. */
  10. include_once('../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. } else {
  22. $hotspot_lang_file .= 'english/hotspot.inc.php';
  23. }
  24. } else {
  25. $hotspot_lang_file .= 'english/hotspot.inc.php';
  26. }
  27. $file = file($hotspot_lang_file);
  28. $temp = array();
  29. foreach($file as $value)
  30. {
  31. $explode = explode('=', $value);
  32. if(count($explode) > 1)
  33. {
  34. $explode[0] = trim($explode[0]);
  35. $explode[0] = '&' . substr($explode[0], 1, strlen($explode[0]));
  36. $explode[1] = trim($explode[1]);
  37. $explode[1] = substr($explode[1], 0, strlen($explode[1]) - 1);
  38. $explode[1] = str_replace('"', '', $explode[1]);
  39. $temp[] = $explode[0] . '=' . $explode[1];
  40. }
  41. }
  42. foreach($temp as $value)
  43. {
  44. echo $value . ' ';
  45. }
  46. ?>