Archived
1
0
This repository has been archived on 2020-12-10. You can view files and clone it, but cannot push or open issues or pull requests.
old/application/controllers/Lang.php

30 lines
831 B
PHP
Raw Normal View History

2018-10-16 16:28:42 +00:00
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class Lang extends MY_Controller
{
public function __construct()
{
parent::__construct();
$this->load->helper('url');
$this->load->helper('cookie');
}
function change($lang = "en")
{
if (isset($_GET['r']) && !empty($_GET['r'])) {
$url = urldecode(base64_decode($_GET['r']));
} else {
$url = base_url();
}
if (in_array($lang, ['de', 'en', 'fr'])) {
$this->session->set_userdata('site_lang', $lang);
setcookie('language', $lang, time() + 7776000, '/');
} else {
$this->session->set_userdata('site_lang', 'en');
setcookie('language', 'en', time() + 7776000, '/');
}
redirect($url);
}
}