diff --git a/.gitignore b/.gitignore index daf3eea..5c46148 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,5 @@ config.inc.php *.phar vendor +tags +cscope* diff --git a/css/index.css b/css/index.css index 6fa6dda..00ed86c 100644 --- a/css/index.css +++ b/css/index.css @@ -9,6 +9,9 @@ padding-left: 1em; border-right: 1px solid #000; overflow: hidden; } +#filter_input_form { +width: 24em; +} #sidebar a, #sidebar a:visited { color: #000; diff --git a/delete.php b/delete.php index ec7e20e..63b437c 100644 --- a/delete.php +++ b/delete.php @@ -46,7 +46,7 @@ } - die('?view&s='.$server['id'].'&key='.urlencode($_GET['key'])); + die('?view&s='.$server['id'].'&key='.$_GET['key']); } @@ -57,7 +57,7 @@ $redis->del($key); } - die('?&s='.$server['id']); + die(substr($_SERVER['HTTP_REFERER'], strpos($_SERVER['HTTP_REFERER'], '?') )); } ?> diff --git a/edit.php b/edit.php index 357a368..fbda5e4 100644 --- a/edit.php +++ b/edit.php @@ -88,7 +88,7 @@ ?> -> +>

-> +>

diff --git a/export.php b/export.php index 69c15c4..351c7da 100644 --- a/export.php +++ b/export.php @@ -7,7 +7,7 @@ // Export to redis-cli commands function export_redis($key) { - global $redis; + global $redis, $server; $type = $redis->type($key); @@ -123,7 +123,7 @@ function export_json($key) { if (isset($_GET['key'])) { echo json_encode(export_json($_GET['key'])); } else { // All keys - $keys = $redis->keys('*'); + $keys = $server['debug'] == true ? $redis->keys('*') : array(); $vals = array(); foreach ($keys as $key) { @@ -140,7 +140,7 @@ function export_json($key) { if (isset($_GET['key'])) { export_redis($_GET['key']); } else { // All keys - $keys = $redis->keys('*'); + $keys = $server['debug'] == true ? $redis->keys('*') : array(); foreach ($keys as $key) { export_redis($key); diff --git a/flush.php b/flush.php index 4e74489..427d5b0 100644 --- a/flush.php +++ b/flush.php @@ -8,6 +8,10 @@ require_once 'includes/common.inc.php'; +if ($server['debug'] == true) { + $redis->flushdb(); +else { + die ("Forbidden operation!"); +} -$redis->flushdb(); diff --git a/includes/config.sample.inc.php b/includes/config.sample.inc.php index 4fc63d7..a175137 100644 --- a/includes/config.sample.inc.php +++ b/includes/config.sample.inc.php @@ -8,7 +8,8 @@ 'host' => '127.0.0.1', 'port' => 6379, 'filter' => '*', - + //Slow queries such as `keys` are allowed only in debug mode. If you are operate an online redis, please set it to false. + 'debug' => true, // Optional Redis authentication. //'auth' => 'redispasswordhere' // Warning: The password is sent in plain-text to the Redis server. ), diff --git a/index.php b/index.php index b768ecb..6c0ce8e 100644 --- a/index.php +++ b/index.php @@ -4,7 +4,13 @@ if($redis) { - $keys = $redis->keys($server['filter']); + if ($server['debug'] == true) { + $keys = $redis->keys($server['filter']); + } else { + $keys = strlen($server['filter']) > 1 + ? array(substr($server['filter'], 0, -1)) + : array(); + } sort($keys); @@ -17,7 +23,9 @@ continue; } - $key = explode($server['seperator'], $key); + $key = $server['debug'] == true + ? explode($server['seperator'], $key) + : array($key); // $d will be a reference to the current namespace. $d = &$namespaces; @@ -83,7 +91,7 @@ function print_namespace($item, $name, $fullkey, $islast) { ?> > - () + ()

  •  () - [X] + [X]