/usr/share/xcache/admin/common.php is in php5-xcache 1.3.2-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 | <?php
function xcache_validateFileName($name)
{
return preg_match('!^[a-zA-Z0-9._-]+$!', $name);
}
function get_language_file_ex($name, $l, $s)
{
static $lmap = array(
'zh' => 'zh-simplified',
'zh-hk' => 'zh-traditional',
'zh-tw' => 'zh-traditional',
);
static $smap = array(
'gbk' => 'gb2312',
'gb18030' => 'gb2312',
);
if (isset($lmap[$l])) {
$l = $lmap[$l];
}
$file = "$name-$l-$s.lang.php";
if (xcache_validateFileName($file) && file_exists($file)) {
return $file;
}
if (isset($smap[$s])) {
$s = $smap[$s];
$file = "$name-$l-$s.lang.php";
if (xcache_validateFileName($file) && file_exists($file)) {
return $file;
}
}
$file = "$name-$l.lang.php";
if (xcache_validateFileName($file) && file_exists($file)) {
return $file;
}
return null;
}
function get_language_file($name)
{
global $charset, $lang;
$s = strtolower($charset);
if (isset($lang)) {
$l = strtolower($lang);
$file = get_language_file_ex($name, $l, $s);
if (!isset($file)) {
$l = strtok($l, ':-');
$file = get_language_file_ex($name, $l, $s);
}
}
else if (!empty($_SERVER['HTTP_ACCEPT_LANGUAGE'])) {
foreach (explode(',', str_replace(' ', '', $_SERVER['HTTP_ACCEPT_LANGUAGE'])) as $l) {
$l = strtok($l, ':;');
$file = get_language_file_ex($name, $l, $s);
if (isset($file)) {
$lang = $l;
break;
}
if (strpos($l, '-') !== false) {
$ll = strtok($l, ':-');
$file = get_language_file_ex($name, $ll, $s);
if (isset($file)) {
$lang = $l;
break;
}
}
}
}
return isset($file) ? $file : "$name-en.lang.php";
}
function _T($str)
{
if (isset($GLOBALS['strings'][$str])) {
return $GLOBALS['strings'][$str];
}
if (!empty($GLOBALS['show_todo_strings'])) {
return '<span style="color:red">' . htmlspecialchars($str) . '</span>';
}
return $str;
}
function stripaddslashes_array($value, $mqs = false)
{
if (is_array($value)) {
foreach($value as $k => $v) {
$value[$k] = stripaddslashes_array($v, $mqs);
}
}
else if(is_string($value)) {
$value = $mqs ? str_replace('\'\'', '\'', $value) : stripslashes($value);
}
return $value;
}
error_reporting(E_ALL);
ini_set('display_errors', 'On');
define('REQUEST_TIME', time());
if (function_exists('get_magic_quotes_gpc') && @get_magic_quotes_gpc()) {
$mqs = (bool) ini_get('magic_quotes_sybase');
$_GET = stripaddslashes_array($_GET, $mqs);
$_POST = stripaddslashes_array($_POST, $mqs);
$_REQUEST = stripaddslashes_array($_REQUEST, $mqs);
}
ini_set('magic_quotes_runtime', '0');
$charset = "UTF-8";
if (file_exists("./config.php")) {
include("./config.php");
}
include(get_language_file("common"));
if (!isset($lang)) {
$lang = 'en-us';
}
if (!isset($usage_graph_width) && !isset($free_graph_width)) {
$usage_graph_width = 120;
}
$graph_width = isset($free_graph_width) ? $free_graph_width : $usage_graph_width;
?>
|