Exemplo n.º 1
0
// cache class
//include ROOT_PATH.'/config/class.cache.php';
if ($config['db_username'] != '' && $config['db_name'] != '') {
    // เรียกใช้งานฐานข้อมูล
    $db = new sql($config['db_server'], $config['db_username'], $config['db_password'], $config['db_name']);
    // เริ่มต้นจับเวลาการประมวลผล
    $time = $db->timer_start();
    //$cache = new cmsCache(DATA_PATH.'cache/', $config['index_page_cache'], $ftp);
}
// language
$language = isset($_GET['lang']) ? $_GET['lang'] : (isset($_SESSION[PREFIX]['language']) ? $_SESSION[PREFIX]['language'] : $_COOKIE['language']);
//ตั้งภาษาตามประเทศที่มี
$user_locale = 'th';
//strtolower($cms->visitor_country());
if ($user_locale == $config['web_lang'][0] || $user_locale == $config['web_lang'][1]) {
    $first_lng = $user_locale;
    //strtolower($cms->visitor_country());
} else {
    $first_lng = 'th';
}
$language = $_COOKIE['language'] ? $language : $first_lng;
setcookie('language', $language, time() + 3600 * 24 * 365);
$_SESSION[PREFIX]['language'] = $language;
// ภาษาที่เลือก
define('LANGUAGE', $language);
define('LNG', LANGUAGE);
include ROOT_PATH . '/config/language/dic.php';
// member login
if ($cms->isAdmin() || $cms->isMember()) {
    $user = $_SESSION[PREFIX]['login'];
}