-
Notifications
You must be signed in to change notification settings - Fork 24
/
Copy pathdisplay.functions.php
151 lines (132 loc) · 4.47 KB
/
display.functions.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
<?php
/*
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2012 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.0 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
| http://www.php.net/license/3_0.txt. |
| If you did not receive a copy of the PHP license and are unable to |
| obtain it through the world-wide-web, please send a note to |
| [email protected] so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
| Initial author: Harun Yayli <harunyayli at gmail.com> |
| Modifications by: Artur Ejsmont http://artur.ejsmont.org |
| Till Klampaeckel <[email protected]> |
+----------------------------------------------------------------------+
*/
if (!isset($VERSION)) {
echo "Not allowed.";
exit(1);
}
// create graphics
//
function graphics_avail() {
return extension_loaded('gd');
}
function bsize($s) {
foreach (array('','K','M','G') as $i => $k) {
if ($s < 1024) break;
$s/=1024;
}
return sprintf("%5.1f %sBytes",$s,$k);
}
/**
* create menu entry
*
* @return string
*/
function menu_entry($ob,$title) {
$PHP_SELF = getUrl();
if ($ob==$_GET['op']){
return "<li class=\"active\"><a href=\"{$PHP_SELF}&op={$ob}\">{$title}</a></li>";
}
return "<li><a href=\"{$PHP_SELF}&op={$ob}\">{$title}</a></li>";
}
/**
* Print the header when we run stand-alone.
*
* @return void
*/
function getHeader()
{
$jq_core = JQ_CORE;
$jq_ts = JQ_TABLESORT;
$base_url = BASE_URL;
$PHP_SELF = getUrl();
$header = <<<EOT
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-us">
<head><title>MEMCACHE INFO</title>
<link rel="stylesheet" href="{$base_url}js/style.css" type="text/css" />
<link rel="stylesheet" href="{$base_url}js/vtip/css/vtip.css" type="text/css" />
<link href="bootstrap/css/bootstrap.min.css" rel="stylesheet" media="screen">
<script type="text/javascript" src="{$jq_core}"></script>
<script type="text/javascript" src="{$jq_ts}"></script>
<script type="text/javascript" src="{$base_url}js/vtip/vtip-min.js"></script>
<script src="bootstrap/js/bootstrap.min.js"></script>
<script type="text/javascript">
function must_confirm(txt, link){
if( confirm(txt) == true ){
document.location.href = link;
return true;
}else{
return false;
}
}
$(document).ready(function(){
$.tablesorter.defaults.widgets = ['zebra'];
$('#slabStats').tablesorter( {sortList: [[0,0], [1,0]]} );
});
/* console.debug(123); */
</script>
</head>
<body>
<div class="container">
<div class="navbar navbar-fixed-top">
<div class="navbar-inner">
<div class="container">
<a class="brand" href="{$PHP_SELF}">Memcache stats v0.X</a>
EOT;
$PHP_SELF = getUrl();
$header .= '<ul class="nav pull-right">';
if ($_GET['op'] !=4 ){
$header .= <<<EOB
<li><a href="$PHP_SELF&op={$_GET['op']}"><span class="text-info"><span class="icon icon-repeat"> </span> Refresh Stats</span> </a></li>
EOB;
} else {
$header .= <<<EOB
<li><a href="$PHP_SELF&op=2">Back</a></li>
EOB;
}
$header .= menu_entry(1,'View Host Stats').
menu_entry(2,'Variables').
menu_entry(8,'Slabs');
$header .= <<<EOT
</ul>
</div>
</div>
</div>
EOT;
return $header;
}
function getFooter(){
$footer = '
<ul class="nav nav-tabs">
<li><a href="http://github.com/lagged/memcache.php">Github</a></li>
<li><a href="http://artur.ejsmont.org">Arthur Ejsmont</a></li>
<li><a href="http://livebookmark.net/journal/2008/05/21/memcachephp-stats-like-apcphp/">Original memcache.php website</a></li>
</ul>
</div>
</body>
</html>
';
return $footer;
}
function getMenu(){
echo <<<EOB
EOB;
}