-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathziling_header.php
More file actions
76 lines (62 loc) · 2.71 KB
/
ziling_header.php
File metadata and controls
76 lines (62 loc) · 2.71 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
<?php
// ------------------------------------------------------------------------- //
// Ziling Universal Chinese Language Encoding Conversion Tool //
// Version: 2.00 //
// General Framework //
// <http://www.wjue.org> //
// ------------------------------------------------------------------------- //
// Author: Wang Jue (alias wjue) //
// Purpose: GB-BIG5 automatic conversion //
// email: wjue@wjue.org //
// URL: http://www.wjue.org //
// http://www.guanxiCRM.com //
// ------------------------------------------------------------------------- //
// This program is free software; you can redistribute it and/or modify //
// it under the terms of the GNU General Public License as published by //
// the Free Software Foundation; either version 2 of the License, or //
// (at your option) any later version. //
// //
// This program 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. //
//
/**
* Begin ziling_header.php
*
* You should include this code prior to ANY html output of your script
*
* usage: require __DIR__ . '/ziling_header.php';
*/
// put here the absolute path dir of where you install Ziling, ex: '/www'
define('ZILING_ROOT', 'c:\\www\\wjueorg\\ziling');
// this is the default encoding of your website
// that is to say your native documents are in this encoding.
// In Continental China this is generally gb2312
// In Taiwan and Hong Kong this is probably big5
define('_DEFAULT_CHARSET', 'big5');
/**
* You need not change anything after this line
*/
$acceptedEncodingSet = ['big5', 'gb2312'];
require_once ZILING_ROOT . '/ziling_includes/readlanguage.php';
$_ziling_buffer_started = false;
global $c_lang, $HTTP_COOKIE_VARS;
if (isset($c_lang)) {
$c_lang = mb_strtolower($c_lang);
if (in_array($c_lang, $acceptedEncodingSet, true)) {
setcookie('clang', mb_strtolower($c_lang), time() + 3600, '/');
}
} else {
$c_lang = mb_strtolower($HTTP_COOKIE_VARS['clang'] ?? ReadLanguage());
}
if (!$c_lang or !in_array($c_lang, $acceptedEncodingSet, true)) {
$c_lang = mb_strtolower(_DEFAULT_CHARSET);
}
if (!headers_sent()) {
header('Content-Type:text/html; charset=' . $c_lang);
}
if (_DEFAULT_CHARSET != $c_lang) {
ob_start();
$_ziling_buffer_started = true;
}