refactor: move htdocs, bin, lib for easier installation
git-svn-id: svn://svn.lighttpd.net/xcache/trunk@1053 c26eb9a1-5813-0410-bd6c-c2e55f420ca73.0
parent
07c4675cb0
commit
d7303c3387
@ -1,152 +0,0 @@
|
||||
<?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 $config;
|
||||
$s = strtolower($config['charset']);
|
||||
if (!empty($config['lang'])) {
|
||||
$l = strtolower($config['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)) {
|
||||
$config['lang'] = $l;
|
||||
break;
|
||||
}
|
||||
if (strpos($l, '-') !== false) {
|
||||
$ll = strtok($l, ':-');
|
||||
$file = get_language_file_ex($name, $ll, $s);
|
||||
if (isset($file)) {
|
||||
$config['lang'] = $l;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return isset($file) ? $file : "$name-en.lang.php";
|
||||
}
|
||||
|
||||
function _($str)
|
||||
{
|
||||
if (isset($GLOBALS['strings'][$str])) {
|
||||
return $GLOBALS['strings'][$str];
|
||||
}
|
||||
if (!empty($GLOBALS['config']['show_todo_strings'])) {
|
||||
return '<span style="color:red">' . htmlspecialchars($str) . '</span>|';
|
||||
}
|
||||
return $str;
|
||||
}
|
||||
|
||||
function __($str)
|
||||
{
|
||||
return _($str);
|
||||
}
|
||||
|
||||
function N_($str)
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
||||
function ob_filter_path_nicer_default($list_html)
|
||||
{
|
||||
$sep = DIRECTORY_SEPARATOR;
|
||||
$docRoot = $_SERVER['DOCUMENT_ROOT'];
|
||||
if ($sep != '/') {
|
||||
$docRoot = str_replace('/', $sep, $docRoot);
|
||||
}
|
||||
$list_html = str_replace(">$docRoot", ">{DOCROOT}" . (substr($docRoot, -1) == $sep ? $sep : ""), $list_html);
|
||||
$xcachedir = realpath(dirname(__FILE__) . "$sep..$sep");
|
||||
$list_html = str_replace(">$xcachedir$sep", ">{XCache}$sep", $list_html);
|
||||
if ($sep == '/') {
|
||||
$list_html = str_replace(">/home/", ">{H}/", $list_html);
|
||||
}
|
||||
return $list_html;
|
||||
}
|
||||
|
||||
|
||||
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);
|
||||
unset($mqs);
|
||||
}
|
||||
ini_set('magic_quotes_runtime', '0');
|
||||
|
||||
$config = array();
|
||||
include("./config.default.php");
|
||||
if (file_exists("./config.php")) {
|
||||
include("./config.php");
|
||||
}
|
||||
|
||||
include(get_language_file("common"));
|
||||
if (empty($config['lang'])) {
|
||||
$config['lang'] = 'en-us';
|
||||
}
|
||||
|
||||
header("Cache-Control: no-cache, must-revalidate");
|
||||
header("Expires: Sat, 26 Jul 1997 05:00:00 GMT");
|
||||
|
||||
?>
|
@ -1,9 +0,0 @@
|
||||
<div class="footnote">
|
||||
<?php echo <<<EOS
|
||||
PHP {$php_version} Powered By: XCache {$xcache_version}, {$xcache_modules}
|
||||
EOS;
|
||||
?>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
@ -1,17 +0,0 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<?php
|
||||
echo <<<HEAD
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=$config[charset]" />
|
||||
<meta http-equiv="Content-Language" content="$config[lang]" />
|
||||
<script type="text/javascript" src="tablesort.js" charset="$config[charset]"></script>
|
||||
HEAD;
|
||||
?>
|
||||
|
||||
<link rel="stylesheet" type="text/css" href="xcache.css" />
|
||||
<title><?php echo sprintf(_("XCache %s Administration"), $xcache_version); ?></title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<h1><?php echo sprintf(_("XCache %s Administration"), $xcache_version); ?></h1>
|
@ -1,3 +1,3 @@
|
||||
<?php
|
||||
|
||||
include("xcache.php");
|
||||
include("cacher.php");
|
||||
|
@ -0,0 +1,4 @@
|
||||
<?php
|
||||
|
||||
$strings = array();
|
||||
|
@ -0,0 +1,250 @@
|
||||
<?php
|
||||
|
||||
class Cycle
|
||||
{
|
||||
var $values;
|
||||
var $i;
|
||||
var $count;
|
||||
|
||||
function Cycle($v)
|
||||
{
|
||||
$this->values = func_get_args();
|
||||
$this->i = -1;
|
||||
$this->count = count($this->values);
|
||||
}
|
||||
|
||||
function next()
|
||||
{
|
||||
$this->i = ($this->i + 1) % $this->count;
|
||||
return $this->values[$this->i];
|
||||
}
|
||||
|
||||
function cur()
|
||||
{
|
||||
return $this->values[$this->i];
|
||||
}
|
||||
|
||||
function reset()
|
||||
{
|
||||
$this->i = -1;
|
||||
}
|
||||
}
|
||||
|
||||
function switcher($name, $options)
|
||||
{
|
||||
$n = isset($_GET[$name]) ? $_GET[$name] : null;
|
||||
$html = array();
|
||||
foreach ($options as $k => $v) {
|
||||
$html[] = sprintf('<a href="?%s=%s"%s>%s</a>', $name, $k, $k == $n ? ' class="active"' : '', $v);
|
||||
}
|
||||
return implode('', $html);
|
||||
}
|
||||
|
||||
function moduleswitcher()
|
||||
{
|
||||
global $module, $modules;
|
||||
$html = array();
|
||||
foreach ($modules as $k => $v) {
|
||||
$html[] = sprintf('<a href="../%s/"%s>%s</a>', $k, $k == $module ? ' class="active"' : '', $v);
|
||||
}
|
||||
return implode('', $html);
|
||||
}
|
||||
|
||||
function th($name, $attrs = null)
|
||||
{
|
||||
$translated = __($name);
|
||||
if ($translated == $name) {
|
||||
$translated = "$name|$name";
|
||||
}
|
||||
list($text, $title) = explode('|', $translated, 2);
|
||||
return sprintf('%s<th%s id="%s" title="%s"><a href="javascript:" onclick="resort(this); return false">%s</a></th>%s'
|
||||
, "\t"
|
||||
, $attrs ? " $attrs" : ""
|
||||
, $name, htmlspecialchars(trim($title)), trim($text)
|
||||
, "\n");
|
||||
}
|
||||
|
||||
function xcache_validateFileName($name)
|
||||
{
|
||||
return preg_match('!^[a-zA-Z0-9._-]+$!', $name);
|
||||
}
|
||||
|
||||
function get_language_file_ex($name, $lang)
|
||||
{
|
||||
static $langMap = array(
|
||||
'zh' => 'zh-simplified',
|
||||
'zh-hk' => 'zh-traditional',
|
||||
'zh-tw' => 'zh-traditional',
|
||||
);
|
||||
|
||||
if (isset($langMap[$lang])) {
|
||||
$lang = $langMap[$lang];
|
||||
}
|
||||
$file = "$name-$lang.lang.php";
|
||||
if (xcache_validateFileName($file) && file_exists($file)) {
|
||||
return $file;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
function get_language_file($name)
|
||||
{
|
||||
global $config;
|
||||
if (!empty($config['lang'])) {
|
||||
$lang = strtolower($config['lang']);
|
||||
$file = get_language_file_ex($name, $lang);
|
||||
if (!isset($file)) {
|
||||
$lang = strtok($lang, ':-');
|
||||
$file = get_language_file_ex($name, $lang);
|
||||
}
|
||||
}
|
||||
else if (!empty($_SERVER['HTTP_ACCEPT_LANGUAGE'])) {
|
||||
foreach (explode(',', str_replace(' ', '', $_SERVER['HTTP_ACCEPT_LANGUAGE'])) as $lang) {
|
||||
$lang = strtok($lang, ':;');
|
||||
$file = get_language_file_ex($name, $lang);
|
||||
if (isset($file)) {
|
||||
$config['lang'] = $lang;
|
||||
break;
|
||||
}
|
||||
if (strpos($lang, '-') !== false) {
|
||||
$file = get_language_file_ex($name, strtok($lang, ':-'));
|
||||
if (isset($file)) {
|
||||
$config['lang'] = $lang;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return isset($file) ? $file : "$name-en.lang.php";
|
||||
}
|
||||
|
||||
function _($str)
|
||||
{
|
||||
if (isset($GLOBALS['strings'][$str])) {
|
||||
return $GLOBALS['strings'][$str];
|
||||
}
|
||||
if (!empty($GLOBALS['config']['show_todo_strings'])) {
|
||||
return '<span style="color:red">' . htmlspecialchars($str) . '</span>|';
|
||||
}
|
||||
return $str;
|
||||
}
|
||||
|
||||
function __($str)
|
||||
{
|
||||
return _($str);
|
||||
}
|
||||
|
||||
function N_($str)
|
||||
{
|
||||
return $str;
|
||||
}
|
||||
|
||||
function number_formats($a, $keys)
|
||||
{
|
||||
foreach ($keys as $k) {
|
||||
$a[$k] = number_format($a[$k]);
|
||||
}
|
||||
return $a;
|
||||
}
|
||||
|
||||
function size($size)
|
||||
{
|
||||
$size = (int) $size;
|
||||
if ($size < 1024)
|
||||
return number_format($size, 2) . ' b';
|
||||
|
||||
if ($size < 1048576)
|
||||
return number_format($size / 1024, 2) . ' K';
|
||||
|
||||
return number_format($size / 1048576, 2) . ' M';
|
||||
}
|
||||
|
||||
function age($time)
|
||||
{
|
||||
if (!$time) return '';
|
||||
$delta = REQUEST_TIME - $time;
|
||||
|
||||
if ($delta < 0) {
|
||||
$delta = -$delta;
|
||||
}
|
||||
|
||||
static $seconds = array(1, 60, 3600, 86400, 604800, 2678400, 31536000);
|
||||
static $name = array('s', 'm', 'h', 'd', 'w', 'M', 'Y');
|
||||
|
||||
for ($i = 6; $i >= 0; $i --) {
|
||||
if ($delta >= $seconds[$i]) {
|
||||
$ret = (int) ($delta / $seconds[$i]);
|
||||
return $ret . ' ' . $name[$i];
|
||||
}
|
||||
}
|
||||
|
||||
return '0 s';
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
function ob_filter_path_nicer_default($list_html)
|
||||
{
|
||||
$sep = DIRECTORY_SEPARATOR;
|
||||
$docRoot = $_SERVER['DOCUMENT_ROOT'];
|
||||
if ($sep != '/') {
|
||||
$docRoot = str_replace('/', $sep, $docRoot);
|
||||
}
|
||||
$list_html = str_replace(">$docRoot", ">{DOCROOT}" . (substr($docRoot, -1) == $sep ? $sep : ""), $list_html);
|
||||
$xcachedir = realpath(dirname(__FILE__) . "$sep..$sep");
|
||||
$list_html = str_replace(">$xcachedir$sep", ">{XCache}$sep", $list_html);
|
||||
if ($sep == '/') {
|
||||
$list_html = str_replace(">/home/", ">{H}/", $list_html);
|
||||
}
|
||||
return $list_html;
|
||||
}
|
||||
|
||||
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);
|
||||
unset($mqs);
|
||||
}
|
||||
ini_set('magic_quotes_runtime', '0');
|
||||
|
||||
$config = array();
|
||||
if (file_exists("./config.default.php")) {
|
||||
include("./config.default.php");
|
||||
}
|
||||
include("../config.default.php");
|
||||
if (file_exists("../config.php")) {
|
||||
include("../config.php");
|
||||
}
|
||||
if (file_exists("./config.php")) {
|
||||
include("./config.php");
|
||||
}
|
||||
|
||||
include(get_language_file("common"));
|
||||
|
||||
$modules = array();
|
||||
if (file_exists("../cacher/index.php")) {
|
||||
$modules["cacher"] = _("Cacher");
|
||||
}
|
||||
if (file_exists("../coverager/index.php")) {
|
||||
$modules["coverager"] = _("Coverager");
|
||||
}
|
||||
header("Cache-Control: no-cache, must-revalidate");
|
||||
header("Expires: Sat, 26 Jul 1997 05:00:00 GMT");
|
||||
|
||||
?>
|
@ -0,0 +1,13 @@
|
||||
<div class="footnote">
|
||||
PHP <?php
|
||||
echo phpversion();
|
||||
?> Powered By: XCache <?php
|
||||
echo defined('XCACHE_VERSION') ? XCACHE_VERSION : '';
|
||||
?>, <?php
|
||||
echo defined('XCACHE_MODULES') ? XCACHE_MODULES : '';
|
||||
?>
|
||||
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,15 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo $GLOBALS['config']['charset']; ?>" />
|
||||
<meta http-equiv="Content-Language" content="<?php echo $GLOBALS['config']['charset']; ?>" />
|
||||
<script type="text/javascript" src="tablesort.js"></script>
|
||||
|
||||
<link rel="stylesheet" type="text/css" href="../common/common.css" />
|
||||
<link rel="stylesheet" type="text/css" href="<?php echo $GLOBALS['module']; ?>.css" />
|
||||
<title><?php echo $title = sprintf("XCache %s", $xcache_version = defined('XCACHE_VERSION') ? XCACHE_VERSION : '') . " - " . ucfirst($GLOBALS['module']); ?></title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<h1><?php echo $title; ?></h1>
|
||||
<div class="switcher"><?php echo moduleswitcher(); ?></div>
|
@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
// [default config]
|
||||
// DO NOT rename/delete/modify this file which will be overwritten when upgrade
|
||||
// See config.example.php instead
|
||||
|
||||
// detected by browser
|
||||
// $config['lang'] = 'en-us';
|
||||
|
||||
$config['charset'] = "UTF-8";
|
||||
|
||||
// translators only
|
||||
$config['show_todo_strings'] = false;
|
||||
|
||||
// this ob filter function is applied for the list with paths, not the whole page
|
||||
$config['path_nicer'] = 'ob_filter_path_nicer_default';
|
||||
|
@ -0,0 +1,65 @@
|
||||
<?php
|
||||
|
||||
// DO NOT rename/delete/modify example file which will be overwritten when upgrade
|
||||
// How To Custom Config:
|
||||
// 1. copy config.example.php config.php; edit config.php
|
||||
// 2. upgrading your config.php when config.example.php were upgraded
|
||||
|
||||
// leave this setting unset to auto detect using browser request header
|
||||
// $config['lang'] = 'en-us';
|
||||
|
||||
$config['charset'] = "UTF-8";
|
||||
|
||||
// enable this for translators only
|
||||
$config['show_todo_strings'] = false;
|
||||
|
||||
// this ob filter is applied for the cache list, not the whole page
|
||||
function custom_ob_filter_path_nicer($list_html)
|
||||
{
|
||||
$list_html = ob_filter_path_nicer_default($list_html); // this function is from common.php
|
||||
return $list_html;
|
||||
}
|
||||
$config['path_nicer'] = 'custom_ob_filter_path_nicer';
|
||||
|
||||
// "XCache Cacher" http auth for is enforced for security reason
|
||||
// if http auth is disabled, any vhost user who can upload *.php will see all variable data cached in XCache
|
||||
|
||||
/*// but if you have your own login/permission system, you can integerate it using the following example
|
||||
// {{{ login example
|
||||
// this is an example only, it's won't work for you without your implemention.
|
||||
|
||||
function check_admin_and_by_pass_xcache_http_auth()
|
||||
{
|
||||
require("/path/to/user-login-and-permission-lib.php");
|
||||
session_start();
|
||||
|
||||
if (user_logined()) {
|
||||
user_load_permissions();
|
||||
if (user_is_admin()) {
|
||||
// user is trusted after permission checks above.
|
||||
// tell XCache about it (the only secure way to by pass XCache http auth)
|
||||
$_SERVER["PHP_AUTH_USER"] = "moo";
|
||||
$_SERVER["PHP_AUTH_PW"] = "your-xcache-password-before-md5";
|
||||
}
|
||||
else {
|
||||
die("Permission denied");
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (!ask_the_user_to_login()) {
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
check_admin_and_by_pass_xcache_http_auth();
|
||||
*/
|
||||
// }}}
|
||||
|
||||
/* by pass XCache http auth
|
||||
$_SERVER["PHP_AUTH_USER"] = "moo";
|
||||
$_SERVER["PHP_AUTH_PW"] = "your-xcache-password-before-md5";
|
||||
*/
|
||||
|
@ -1,25 +0,0 @@
|
||||
<?php
|
||||
|
||||
$strings = array(
|
||||
'root'
|
||||
=> '开始',
|
||||
'Directory'
|
||||
=> '目录',
|
||||
'File'
|
||||
=> '文件',
|
||||
'Percent'
|
||||
=> '覆盖率',
|
||||
'Hits'
|
||||
=> '命中',
|
||||
'Lines'
|
||||
=> '行数',
|
||||
'TODO'
|
||||
=> '闲置文件',
|
||||
'XCache PHP Code Coverage Viewer'
|
||||
=> 'XCache PHP 代码覆盖查看器',
|
||||
'module'
|
||||
=> '模块',
|
||||
''
|
||||
=> '',
|
||||
);
|
||||
|
@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
// DO NOT rename/delete/modify example file which will be overwritten when upgrade
|
||||
// How To Custom Config:
|
||||
// 1. copy config.example.php config.php; edit config.php
|
||||
// 2. upgrading your config.php when config.example.php were upgraded
|
||||
// XCache will load
|
||||
// 1. ../config.default.php
|
||||
// 2. ./config.default.php
|
||||
// 3. ../config.php
|
||||
// 4. ./config.php
|
||||
|
||||
// $config['include_paths = array("/www/my-php-project/");
|
||||
// $config['exclude_paths = array("/www/my-php-project/tmp/");
|
||||
$config['syntax_higlight'] = true;
|
||||
$config['use_cache'] = false;
|
||||
//// $config['datadir'] is default to ini_get("xcache.coveragedump_directory")
|
||||
// $config['datadir'] = '';
|
||||
|
@ -1,59 +0,0 @@
|
||||
<?php
|
||||
|
||||
// this is an example only
|
||||
// write your own config and name it as config.php
|
||||
|
||||
// detected by browser
|
||||
// $lang = 'en-us';
|
||||
|
||||
$charset = "UTF-8";
|
||||
|
||||
// developers only
|
||||
$show_todo_strings = false;
|
||||
|
||||
// $include_paths = array("/www/my-php-project/");
|
||||
// $exclude_paths = array("/www/my-php-project/tmp/");
|
||||
$syntaxhiglight = true;
|
||||
$usecache = false;
|
||||
//// $datadir is default to ini_get("xcache.coveragedump_directory")
|
||||
// $datadir = '';
|
||||
|
||||
function ob_filter_path_nicer($o)
|
||||
{
|
||||
$sep = DIRECTORY_SEPARATOR;
|
||||
$o = str_replace($_SERVER['DOCUMENT_ROOT'], "{DOCROOT}" . (substr($d, -1) == $sep ? $sep : ""), $o);
|
||||
$xcachedir = realpath(dirname(__FILE__) . "$sep..$sep");
|
||||
$o = str_replace($xcachedir . $sep, "{XCache}$sep", $o);
|
||||
if ($sep == '/') {
|
||||
$o = str_replace("/home/", "{H}/", $o);
|
||||
}
|
||||
return $o;
|
||||
}
|
||||
|
||||
// implement your auth here if needed
|
||||
// {{{ home made login example
|
||||
// this is an example only, it's won't work for you without your implemention.
|
||||
function check_admin_auth()
|
||||
{
|
||||
require("/path/to/user-login-and-permission-lib.php");
|
||||
session_start();
|
||||
|
||||
if (!user_logined()) {
|
||||
if (!ask_the_user_to_login()) {
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
user_load_permissions();
|
||||
if (!user_is_admin()) {
|
||||
die("Permission denied");
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// uncomment:
|
||||
// check_admin_auth()
|
||||
// }}}
|
||||
|
||||
?>
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
$strings = array(
|
||||
$strings += array(
|
||||
'root'
|
||||
=> '开始',
|
||||
'Directory'
|
Loading…
Reference in New Issue