-
Notifications
You must be signed in to change notification settings - Fork 0
/
tredit.php
154 lines (141 loc) · 4.04 KB
/
tredit.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
152
153
154
<?php
include('tr.php');
$TR = new tinyRegistry;
$MESSAGES = new tinyRegistry;
$MESSAGES->open('__messages');
if(isset($_REQUEST['addmessage'])){$MESSAGES->push(microtime(true), sqlite_escape_string(stripslashes($_REQUEST['addmessage'])));}
if(isset($_GET['REGDROP'])){
$MESSAGES->push(microtime(true), 'Drop Registry '.stripslashes($_GET['REGDROP']));
$TR->registrydrop(sqlite_escape_string(stripslashes($_GET['REGDROP'])));
if(stripslashes($_GET['REGDROP']) == '__messages'){
$MESSAGES = null; $MESSAGES = new tinyRegistry;
$MESSAGES->open('__messages');
$MESSAGES->push(microtime(true), 'Messages Cleared.');
$_GET['REG'] = '__messages';
}
}
if(isset($_GET['REG'])){
$MESSAGES->push(microtime(true), 'Open Registry '.stripslashes($_GET['REG']));
$TR->open(sqlite_escape_string(stripslashes($_GET['REG'])));
}
if(isset($_POST['RPUSHKEY'])){
$TR->push(stripslashes($_POST['RPUSHKEY']), stripslashes($_POST['RPUSHVAL']));
$MESSAGES->push(microtime(true), 'Registry ['.stripslashes($_GET['REG']).'] push: '.stripslashes($_POST['RPUSHKEY']).','.stripslashes($_POST['RPUSHVAL']));
}
if(isset($_GET['DEL'])){
$TR->pull(false, stripslashes($_GET['DEL']));
$MESSAGES->push(microtime(true), 'Delete '.stripslashes($_GET['DEL']).' from registry ['.stripslashes($_GET['REG']).']');
}
?>
<!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>
<title>TINY REGISTRY EDITOR</title>
<style>
body{
font-size: 11pt;
font-family: monospace;
}
a{
text-decoration: none;
color: #006;
}
a:hover{
color: #800;
}
input{
background-color: transparent;
border: none;
border-bottom: 1pt solid black;
font-family: monospace;
}
input[type="submit"]{
border: none;
}
input:focus{
outline: none;
}
form{
border: 1pt dashed black;
margin: 0;
padding: 2pt;
width: 100%;
}
.leftcol{
display: block;
float: left;
width: 25%;
margin-right: 2%;
}
.rightcol{
display: block;
float: left;
width: 70%;
padding-left: 2%;
border-left: 2px solid black;
min-height: 400px;
}
.regentries{
width: 100%;
border-collapse: collapse;
border: 1pt solid black;
}
.regentries td{
border: 1pt solid black;
padding: 2pt;
}
</style>
</head>
<body>
<div class="leftcol">
<strong>Registries</strong>
<form action="?" method="GET" style="text-align: center;">
<input name="REG" style="width: 80%;"/>
<input type="hidden" name="addmessage" value="Submitted registry form." />
<input type="submit" value="+" />
</form>
<dl>
<dt>SEL?|DEL| NAME</dt>
<?php
$registries = $TR->registrylist();
foreach($registries as $registry){
if(stripslashes($_GET['REG']) == $registry['name']){$selchar = '→';}else{$selchar = ' ';}
echo('<dt>['.$selchar.'] | <a href="?REGDROP='.$registry['name'].'">×</a>
| <a href="?REG='.$registry['name'].'">'.$registry['name'].'</a></dt>
');
}
?>
</dl>
</div>
<div class="rightcol">
<strong>Registry Entries</strong><br/>
<form action="?REG=<?php echo(stripslashes($_GET['REG'])); ?>" method="POST" style="text-align: center; width: 99.4%; margin-bottom: 6pt;">
K: <input name="RPUSHKEY" style="width: 25%;"/>
V: <input name="RPUSHVAL" style="width: 57%;"/>
<input type="hidden" name="addmessage" value="Adding new Registry Entry to <?php echo($_GET['REG']); ?>" />
<input type="submit" value="+" />
</form>
<table class="regentries">
<tr style="background-color: #ddd;"><td style="width: 5%;">ID</td><td style="width: 30%;">KEY</td><td>VALUE</td><td style="width: 1em;"></td></tr>
<?php
if(!isset($_GET['REG'])){
echo('NO REGISTRY SELECTED.');
}else{
echo($TR->pull("<tr><td>%i%</td><td>%k%</td><td>%v%</td><td style=\"text-align: center;\"><a href=\"?REG={$_GET['REG']}&DEL=%i%\">×</a></td></tr>"));
}
/*
$TR->open('test1');
$TR->push('key1', 'value1',false);
$TR->push('key2', 'value1',true);
$TR->push('lastedit', time(), true);
print_r($TR->pull('%i% ; %k% ; %v% <br/>'));
$TR->push('key2', 'value2');
$TR->pull(false, '3');
print_r($TR->pull('%i% ; %k% ; %v% <br/>'));
*/
?>
</table>
</div>
</body>
</html>