Browse Source

fixed #86, enhancement in admin page, remove/edit variable

git-svn-id: svn://svn.lighttpd.net/xcache/trunk@371 c26eb9a1-5813-0410-bd6c-c2e55f420ca7
3.0
Xuefer 14 years ago
parent
commit
13dd6aa832
  1. 1
      NEWS
  2. 8
      admin/common-zh-simplified-utf-8.lang.php
  3. 8
      admin/common-zh-traditional-utf-8.lang.php
  4. 25
      admin/edit.php
  5. 13
      admin/edit.tpl.php
  6. 9
      admin/footer.tpl.php
  7. 17
      admin/header.tpl.php
  8. 2
      admin/xcache.css
  9. 9
      admin/xcache.php
  10. 48
      admin/xcache.tpl.php

1
NEWS

@ -1,6 +1,7 @@
2.0.0 2007-?-?
== NEWS ==
== ChangeLog ==
* #86: remove/edit variable in admin page
* fixed #56: xcache_set segfaults when xcache.var_size=0
========

8
admin/common-zh-simplified-utf-8.lang.php

@ -96,10 +96,10 @@ $strings = array(
=> '位置',
'Module Info'
=> '模块信息',
''
=> '',
''
=> '',
'Remove Selected'
=> '删除所选',
'Editing Variable %s'
=> '正在编辑变量 %s',
''
=> '',
);

8
admin/common-zh-traditional-utf-8.lang.php

@ -96,10 +96,10 @@ $strings = array(
=> '位置',
'Module Info'
=> '組元訊息',
''
=> '',
''
=> '',
'Remove Selected'
=> '移除所选',
'Editing Variable %s'
=> '正在编辑变量 %s',
''
=> '',
);

25
admin/edit.php

@ -0,0 +1,25 @@
<?php
include("./common.php");
if (!isset($_GET['name'])) {
die("missing name");
}
$name = $_GET['name'];
// trigger auth
$vcnt = xcache_count(XC_TYPE_VAR);
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
xcache_set($name, $_POST['value']);
header("Location: xcache.php?type=" . XC_TYPE_VAR);
exit;
}
$value = xcache_get($name);
$xcache_version = XCACHE_VERSION;
$xcache_modules = XCACHE_MODULES;
include("edit.tpl.php");
?>

13
admin/edit.tpl.php

@ -0,0 +1,13 @@
<?php include("header.tpl.php"); ?>
<?php
$h_name = htmlspecialchars($name);
$h_value = htmlspecialchars($value);
?>
<form method="post" action="">
<fieldset>
<legend><?php echo sprintf(_T("Editing Variable %s"), $h_name); ?></legend>
<textarea name="value" style="width: 100%; height: 200px; overflow-y: auto"><?php echo $h_value; ?></textarea><br>
<input type="submit">
</fieldset>
</form>
<?php include("footer.tpl.php"); ?>

9
admin/footer.tpl.php

@ -0,0 +1,9 @@
<div class="footnote">
<?php echo <<<EOS
Powered By: XCache {$xcache_version}, {$xcache_modules}
EOS;
?>
</div>
</body>
</html>

17
admin/header.tpl.php

@ -0,0 +1,17 @@
<!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=$charset" />
<meta http-equiv="Content-Language" content="$lang" />
<script type="text/javascript" src="tablesort.js" charset="$charset"></script>
HEAD;
?>
<link rel="stylesheet" type="text/css" href="xcache.css" />
<title><?php echo sprintf(_T("XCache %s Administration"), $xcache_version); ?></title>
</head>
<body>
<h1><?php echo sprintf(_T("XCache %s Administration"), $xcache_version); ?></h1>

2
admin/xcache.css

@ -22,7 +22,7 @@ form {margin: 0; padding: 0}
.percent { border: 1px solid black; width: 80%; height: 20px; }
.percent div { font-size: 1px; line-height: 1px; width: 100%;}
.percent .pavail { background: blue; }
.switcher, h1 { text-align: center; display: block; }
.switcher, h1, h2 { text-align: center; display: block; }
.switcher * { color: blue; }
.switcher a.active { font-weight: bold; font-size: 130%; color: black; }
#help { display: block; float: right; }

9
admin/xcache.php

@ -100,6 +100,15 @@ if (!extension_loaded('XCache')) {
$pcnt = xcache_count(XC_TYPE_PHP);
$vcnt = xcache_count(XC_TYPE_VAR);
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
$remove = @ $_POST['remove'];
if ($remove && is_array($remove)) {
foreach ($remove as $name) {
xcache_unset($name);
}
}
}
$moduleinfo = null;
$type_none = -1;
if (!isset($_GET['type'])) {

48
admin/xcache.tpl.php

@ -1,20 +1,4 @@
<!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=$charset" />
<meta http-equiv="Content-Language" content="$lang" />
<script type="text/javascript" src="tablesort.js" charset="$charset"></script>
HEAD;
?>
<link rel="stylesheet" type="text/css" href="xcache.css" />
<title><?php echo sprintf(_T("XCache %s Administration"), $xcache_version); ?></title>
</head>
<body>
<h1><?php echo sprintf(_T("XCache %s Administration"), $xcache_version); ?></h1>
<?php include("header.tpl.php"); ?>
<a href="help.php" target="_blank" id="help"><?php echo _T("Help") ?> &raquo;</a>
<span class="switcher"><?php echo switcher("type", $types); ?></span>
<?php
@ -142,7 +126,9 @@ if ($cachelist) {
<caption>", _T("{$cachelist['type_name']} $listname"), "</caption>";
?>
<form action="" method="post">
<table cellspacing="0" cellpadding="4" class="cycles entrys" width="100%">
<col />
<col />
<col />
<col align="right" />
@ -166,6 +152,9 @@ if ($cachelist) {
<tr ", $a->next(), ">";
?>
<?php if (!$isphp) { ?>
<th width="20">R</th>
<?php } ?>
<th><a href="javascript:" onclick="resort(this); return false"><?php echo _T('Cache'); ?></a></th>
<th><a href="javascript:" onclick="resort(this); return false"><?php echo _T('entry'); ?></a></th>
<th><a href="javascript:" onclick="resort(this); return false"><?php echo _T('Hits'); ?></a></th>
@ -209,9 +198,20 @@ if ($cachelist) {
$dtime = age($entry['dtime']);
}
if (!$isphp) {
echo <<<ENTRY
<td><input type="checkbox" name="remove[]" value="{$name}"/></td>
ENTRY;
$uname = urlencode($entry['name']);
$namelink = "<a href=\"edit.php?name=$uname\">$name</a>";
}
else {
$namelink = $name;
}
echo <<<ENTRY
<td>{$entry['cache_name']} {$i}</td>
<td>{$name}</td>
<td>{$namelink}</td>
<td int="{$entry['hits']}">{$entry['hits']}</td>
<td int="{$entry['refcount']}">{$entry['refcount']}</td>
<td int="{$entry['size']}">{$size}</td>
@ -247,6 +247,8 @@ ENTRY;
?>
</table>
<input type="submit" value="<?php echo _T("Remove Selected"); ?>">
</form>
<?php
}
if (function_exists("ob_filter_path_nicer")) {
@ -261,12 +263,4 @@ if ($moduleinfo) {
HTML;
}
?>
<div class="footnote">
<?php echo <<<EOS
Powered By: XCache {$xcache_version}, {$xcache_modules}
EOS;
?>
</div>
</body>
</html>
<?php include("footer.tpl.php"); ?>
Loading…
Cancel
Save