Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 0 additions & 43 deletions Config/Memcache.sample.php

This file was deleted.

4 changes: 4 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
FROM php:7.0-apache
COPY config/php.ini /usr/local/etc/php/
COPY src/ /var/www/html/
RUN chown -R www-data /var/www/html/Config /var/www/html/Temp
82 changes: 82 additions & 0 deletions config/php.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
[PHP]
engine = On
short_open_tag = Off
precision = 14
output_buffering = 4096
zlib.output_compression = Off
implicit_flush = Off
unserialize_callback_func =
serialize_precision = -1
disable_functions =
disable_classes =
zend.enable_gc = On
expose_php = On
max_execution_time = 30
max_input_time = 60
memory_limit = 128M
error_reporting = E_ALL & ~E_DEPRECATED & ~E_STRICT
;display_errors = Off
display_errors = On
display_startup_errors = Off
log_errors = On
log_errors_max_len = 1024
ignore_repeated_errors = Off
ignore_repeated_source = Off
report_memleaks = On
html_errors = Off
error_log = /dev/null
variables_order = "GPCS"
request_order = "GP"
register_argc_argv = Off
auto_globals_jit = On
post_max_size = 8M
auto_prepend_file =
auto_append_file =
default_mimetype = "text/html"
default_charset = "UTF-8"
doc_root =
user_dir =
enable_dl = Off
file_uploads = On
upload_max_filesize = 2M
max_file_uploads = 20
allow_url_fopen = On
allow_url_include = Off
default_socket_timeout = 60
[CLI Server]
cli_server.color = On
[bcmath]
bcmath.scale = 0
[Session]
session.save_handler = files
session.use_strict_mode = 0
session.use_cookies = 1
session.use_only_cookies = 1
session.name = PHPMEMCACHEDADMIN
session.auto_start = 0
session.cookie_lifetime = 0
session.cookie_path = /
session.cookie_domain =
session.cookie_httponly =
session.serialize_handler = php
session.gc_probability = 1
session.gc_divisor = 1000
session.gc_maxlifetime = 1440
session.referer_check =
session.cache_limiter = nocache
session.cache_expire = 180
session.use_trans_sid = 0
session.sid_length = 26
session.trans_sid_tags = "a=href,area=href,frame=src,form="
session.sid_bits_per_character = 5
[Assertion]
zend.assertions = -1
[Tidy]
tidy.clean_output = Off
[soap]
soap.wsdl_cache_enabled=1
soap.wsdl_cache_dir="/tmp"
soap.wsdl_cache_ttl=86400
soap.wsdl_cache_limit = 5
[ldap]
ldap.max_links = -1
23 changes: 23 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
version: '2'
services:
phpmemcachedadmin:
build: .
ports:
- "8000:80"
links:
- memcached
environment:
- MEMCACHED_GROUPS=2
- MEMCACHED_GROUP_0_NAME=docker
- MEMCACHED_GROUP_0_HOST_COUNT=1
- MEMCACHED_GROUP_0_HOST_0=memcached
- MEMCACHED_GROUP_0_PORT_0=11211
- MEMCACHED_GROUP_1_NAME=cluster
- MEMCACHED_GROUP_1_HOST_COUNT=2
- MEMCACHED_GROUP_1_HOST_0=memcached01
- MEMCACHED_GROUP_1_PORT_0=11211
- MEMCACHED_GROUP_1_HOST_1=memcached02
- MEMCACHED_GROUP_1_PORT_1=11211

memcached:
image: memcached:alpine
71 changes: 71 additions & 0 deletions src/Config/Memcache.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
<?php

if (getenv('MEMCACHED_GROUPS')) {
$groups = getenv('MEMCACHED_GROUPS');
$i = 0;
$servers = [];
while ($i < $groups) {
$group_name = getenv('MEMCACHED_GROUP_' . $i . '_NAME');
$hosts = getenv('MEMCACHED_GROUP_' . $i . '_HOST_COUNT');
$j = 0;
$servers[$group_name] = [];
while ($j < $hosts) {
$hostname = getenv('MEMCACHED_GROUP_' . $i . '_HOST_' . $j);
$port = getenv('MEMCACHED_GROUP_' . $i . '_PORT_' . $j);
$servers[$group_name][$hostname . ':' . $port] =
[
'hostname' => $hostname,
'port' => $port,
];
$j++;
}
$i++;
}
} else {
$servers =
[
'Default' =>
[
'127.0.0.1:11211' =>
[
'hostname' => '127.0.0.1',
'port' => '11211',
],
'127.0.0.2:11211' =>
[
'hostname' => '127.0.0.2',
'port' => '11211',
],
'127.0.0.3:11211' =>
[
'hostname' => '127.0.0.1',
'port' => '11211',
],
'127.0.0.4:11211' =>
[
'hostname' => '127.0.0.1',
'port' => '11211',
],
],
];
}

$array = [
'stats_api' => 'Server',
'slabs_api' => 'Server',
'items_api' => 'Server',
'get_api' => 'Server',
'set_api' => 'Server',
'delete_api' => 'Server',
'flush_all_api' => 'Server',
'connection_timeout' => '1',
'max_item_dump' => '100',
'refresh_rate' => 5,
'memory_alert' => '80',
'hit_rate_alert' => '90',
'eviction_alert' => '0',
'file_path' => 'Temp/',
'servers' => $servers,
];

return $array;
96 changes: 96 additions & 0 deletions src/Config/Memcache.sample.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
<?php

if (getenv('MEMCACHED_GROUPS')) {
$groups = getenv('MEMCACHED_GROUPS');
$i = 0;
$servers = [];
while ($i < $groups) {
$group_name = getenv('MEMCACHED_GROUP_' . $i . '_NAME');
$hosts = getenv('MEMCACHED_GROUP_' . $i . '_HOST_COUNT');
$j = 0;
$servers[$group_name] = [];
while ($j < $hosts) {
$hostname = getenv('MEMCACHED_GROUP_' . $i . '_HOST_' . $j);
$port = getenv('MEMCACHED_GROUP_' . $i . '_PORT_' . $j);
$servers[$group_name][$hostname . ':' . $port] =
[
'hostname' => $hostname,
'port' => $port,
];
$j++;
}
$i++;
}
} else {
$servers =
[
'Default' =>
[
'127.0.0.1:11211' =>
[
'hostname' => '127.0.0.1',
'port' => '11211',
],
'127.0.0.2:11211' =>
[
'hostname' => '127.0.0.2',
'port' => '11211',
],
'127.0.0.3:11211' =>
[
'hostname' => '127.0.0.1',
'port' => '11211',
],
'127.0.0.4:11211' =>
[
'hostname' => '127.0.0.1',
'port' => '11211',
],
],
];
}

$array = [
'stats_api' => 'Server',
'slabs_api' => 'Server',
'items_api' => 'Server',
'get_api' => 'Server',
'set_api' => 'Server',
'delete_api' => 'Server',
'flush_all_api' => 'Server',
'connection_timeout' => '1',
'max_item_dump' => '100',
'refresh_rate' => 5,
'memory_alert' => '80',
'hit_rate_alert' => '90',
'eviction_alert' => '0',
'file_path' => 'Temp/',
'servers' => $servers,
];

return $array;
[
'Default' =>
[
'127.0.0.1:11211' =>
[
'hostname' => '127.0.0.1',
'port' => '11211',
],
'127.0.0.2:11211' =>
[
'hostname' => '127.0.0.2',
'port' => '11211',
],
'127.0.0.3:11211' =>
[
'hostname' => '127.0.0.1',
'port' => '11211',
],
'127.0.0.4:11211' =>
[
'hostname' => '127.0.0.1',
'port' => '11211',
],
],
];
16 changes: 13 additions & 3 deletions Library/Bootstrap.php → src/Library/Bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,20 @@
define('ENT_IGNORE', 0);
}


# XSS / User input check
foreach ($_REQUEST as $index => $data) {
$_REQUEST[$index] = htmlentities($data);
function xss_check($request)
{
foreach ($request as $index => $data) {
if (gettype($data) == 'string') {
$request[$index] = htmlentities($data);
} elseif (gettype($data) == 'array') {
$data = xss_check($data);
}
}
return $request;
}
$_REQUEST=xss_check($_REQUEST);

# Autoloader
function __autoload($class)
Expand All @@ -26,4 +36,4 @@ function __autoload($class)
$_ini = Library_Configuration_Loader::singleton();

# Date timezone
date_default_timezone_set('Europe/Paris');
date_default_timezone_set('Europe/Paris');
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions Public/Scripts/script.js → src/Public/Scripts/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ function portOnBlur(object) {
}
}
function hostOrPortOnChange(target) {

nameObject = document.getElementById('name_' + target);
hostObject = document.getElementById('host_' + target);
portObject = document.getElementById('port_' + target);
Expand Down Expand Up @@ -296,4 +296,4 @@ function ajaxDone(target) {
+ req.statusText;
}
}
}
}
2 changes: 1 addition & 1 deletion Public/Styles/Style.css → src/Public/Styles/Style.css
Original file line number Diff line number Diff line change
Expand Up @@ -235,4 +235,4 @@ hr {
background: #b5463f;
color: #fff;
font-weight: bold
}
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.