Enables Uberspace users to administrate some functions via a very simple web panel
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

lang.php 1.7KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. <?php
  2. /***********************************************************************
  3. * Copyright (C) 2016 Max Mehl <mail [at] mehl [dot] mx>
  4. ************************************************************************
  5. *
  6. * This program is free software: you can redistribute it and/or modify
  7. * it under the terms of the GNU Affero General Public License as
  8. * published by the Free Software Foundation, either version 3 of the
  9. * License, or (at your option) any later version.
  10. *
  11. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU Affero General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU Affero General Public
  17. * License along with this program. If not, see
  18. * <http://www.gnu.org/licenses/>.
  19. *
  20. ************************************************************************
  21. *
  22. * This file detects the sessions language setting or the one which we
  23. * set in a cookie.
  24. *
  25. ***********************************************************************/
  26. ?>
  27. <?php
  28. session_start();
  29. header('Cache-control: private'); // IE 6 FIX
  30. if(isSet($_GET['lang']))
  31. {
  32. $lang = $_GET['lang'];
  33. // register the session and set the cookie
  34. $_SESSION['lang'] = $lang;
  35. setcookie("lang", $lang, time() + (3600 * 24 * 30));
  36. }
  37. else if(isSet($_SESSION['lang']))
  38. {
  39. $lang = $_SESSION['lang'];
  40. }
  41. else if(isSet($_COOKIE['lang']))
  42. {
  43. $lang = $_COOKIE['lang'];
  44. }
  45. else
  46. {
  47. $lang = 'en';
  48. }
  49. switch ($lang) {
  50. case 'en':
  51. $lang_file = 'lang.en.php';
  52. break;
  53. case 'de':
  54. $lang_file = 'lang.de.php';
  55. break;
  56. default:
  57. $lang_file = 'lang.en.php';
  58. }
  59. include_once 'lang/'.$lang_file;
  60. ?>