break; } // den rechtesten Teil des Sprachcodes abschneiden array_pop($lang_code); } } // die gefundene Sprache zurückgeben return $current_lang; } $lang_pages_parts = explode(';', $data['type_addition']); foreach ($lang_pages_parts as $lang_pages) { $lang_parts = explode(',', $lang_pages); $allowed_langs[] = trim($lang_parts[0]); $lang_pages_array[trim($lang_parts[0])] = trim($lang_parts[1]); } $lang = lang_getfrombrowser($allowed_langs, $allowed_langs[0], null, false); if (isset($cache) && $cache->doCaching) { $cache->cacheId = PAGE; $cache_content = "<?php\ndefine('BASE_URL', '" . BASE_URL . "');\n\$data['type_addition']='" . $data['type_addition'] . "';\ninclude('" . BASE_PATH . "cms/includes/page_types/language_redirect.php');\n?>"; $cache->createChacheFile($cache_content); } header($_SERVER['SERVER_PROTOCOL'] . ' 303 See Other'); header('Location: ' . BASE_URL . $lang_pages_array[$lang]); ?> <!DOCTYPE html> <html> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8"> <meta http-equiv="refresh" content="0; <?php echo BASE_URL . $lang_pages_array[$lang]; ?>
* the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * enviroCar is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with enviroCar. If not, see <http://www.gnu.org/licenses/>. */ //First: Get language from Browser: require_once 'httplanguage/httplanguage.php'; //get language from accept-language header $allowed_langs = array('de', 'en'); $lang = lang_getfrombrowser($allowed_langs, 'en', null, false); //Second: Look if BrowserChoice has been overridden By User input, but validate the input! if (isset($_GET['lang'])) { if ($_GET['lang'] != "" && in_array(strtolower($_GET['lang']), $allowed_langs)) { $lang = $_GET['lang']; //if input is valid if (!isset($_SESSION)) { session_start(); } // register the session and set the cookie $_SESSION['lang'] = $lang; } } else { if (isset($_SESSION['lang'])) { $lang = $_SESSION['lang']; }