merged [371] from trunk->1.2: remove/edit variable data in admin page
git-svn-id: svn://svn.lighttpd.net/xcache/branches/1.2@373 c26eb9a1-5813-0410-bd6c-c2e55f420ca7
This commit is contained in:
parent
37af97bed9
commit
0339491d77
1
NEWS
1
NEWS
|
@ -5,6 +5,7 @@
|
|||
* new: xcache.admin.enable_auth = On
|
||||
|
||||
== ChangeLog ==
|
||||
* #86: remove/edit variable in admin page
|
||||
* fixed #56: xcache_set segfaults when xcache.var_size=0
|
||||
|
||||
========
|
||||
|
|
|
@ -92,10 +92,10 @@ $strings = array(
|
|||
=> '位置',
|
||||
'Module Info'
|
||||
=> '模块信息',
|
||||
''
|
||||
=> '',
|
||||
''
|
||||
=> '',
|
||||
'Remove Selected'
|
||||
=> '删除所选',
|
||||
'Editing Variable %s'
|
||||
=> '正在编辑变量 %s',
|
||||
''
|
||||
=> '',
|
||||
);
|
||||
|
|
|
@ -92,10 +92,10 @@ $strings = array(
|
|||
=> '位置',
|
||||
'Module Info'
|
||||
=> '組元訊息',
|
||||
''
|
||||
=> '',
|
||||
''
|
||||
=> '',
|
||||
'Remove Selected'
|
||||
=> '移除所选',
|
||||
'Editing Variable %s'
|
||||
=> '正在编辑变量 %s',
|
||||
''
|
||||
=> '',
|
||||
);
|
||||
|
|
|
@ -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");
|
||||
|
||||
?>
|
|
@ -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"); ?>
|
|
@ -0,0 +1,9 @@
|
|||
<div class="footnote">
|
||||
<?php echo <<<EOS
|
||||
Powered By: XCache {$xcache_version}, {$xcache_modules}
|
||||
EOS;
|
||||
?>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
|
@ -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>
|
|
@ -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; }
|
||||
|
|
|
@ -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'])) {
|
||||
|
|
|
@ -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") ?> »</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" />
|
||||
|
@ -165,6 +151,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>
|
||||
|
@ -205,9 +194,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>
|
||||
|
@ -241,6 +241,8 @@ ENTRY;
|
|||
?>
|
||||
|
||||
</table>
|
||||
<input type="submit" value="<?php echo _T("Remove Selected"); ?>">
|
||||
</form>
|
||||
<?php
|
||||
}
|
||||
if (function_exists("ob_filter_path_nicer")) {
|
||||
|
@ -255,12 +257,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…
Reference in New Issue