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
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
|
<?php /* $Id: index.php,v 1.1.1.1 2002/10/28 19:13:50 pbaecher Exp $ */ /* ThWboard - PHP/MySQL Bulletin Board System ============================================== (c) 2000, 2001 by Paul Baecher <paul@thewall.de> Felix Gonschorek <funner@thewall.de>
download the latest version: http://www.thwboard.de
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
==============================================
*/
include "common.inc.php";
$t = 1;
if( $action == "logout" ) { session_destroy(); header("Location: index.php"); exit; }
tb_header();
/* * ========================================== * <root> * ========================================== */ if( $action == "" ) { // try to determine version $current_version = ''; // kein check mit cvs versionen if( !file_exists('CVS') && ($fp = @fopen('http://www.thwboard.de/current_version.p'.'h'.'p3', 'r')) ) // make sure the release script does not replace the .php3 with .php33 { $current_version = fread($fp, 32); fclose($fp); }
print '<b>ThWboard - Administrative Center</b><br><br>';
print 'Welcome to the administrative center of your ThWboard.<br>Please keep in mind that thwboard is still <u>beta software</u> and may sometimes not work as expected.<br>';
print '<br><br><br>Visit the <a href="http://www.thwboard.de">ThWboard-Page</a> for new versions and updates.<br> ThWboard is copyright 2002 by Paul Baecher & Felix Gonschorek.<br><br>';
print '<font color="darkblue">ThWboard version information</font><font size="1"><br>'; print 'Your version: <b>'.$config['version'].'</b><br>'; if( $current_version ) { print 'Latest stable version available: <b>'.$current_version.'</b> [ <a href="http://www.thwboard.de/">Info ..</a> ]<br>'; if( $current_version != $config['version'] ) { print '<font color="darkred">Your version might be outdated.</font><br>'; } } print '</font><br>';
print ' <font color="darkblue">System version information</font><font size="1"><br> PHP: <b>'.phpversion().'</b><br> MySQL: <b>'.mysql_get_server_info().'</b><br> </font><br> ';
$loadavg = @file('/proc/loadavg'); if( $loadavg ) { $load = explode(' ', $loadavg[0]); print ' <font color="darkblue">Average system load</font><font size="1"><br> Last minute: <b>'.$load[0].'</b><br> Last 5 minutes: <b>'.$load[1].'</b><br> Last 15 minutes: <b>'.$load[2].'</b><br> </font> '; }
print '<br><br>Last 50 Admin-actions:<br><table width="100%" border="0" cellspacing="0" cellpadding="3"> <tr> <td><b>Date/Time</b></td> <td><b>Logtype</b></td> <td><b>Username</b></td> <td><b>User IP</b></td> <td><b>Scriptname</b></td> <td><b>Action</b></td> <td><b>Misc Notes</b></td> </tr>'; $result = query( "SELECT logtype, logtime, loguser, logip, logaction, logscript, lognotes FROM ".$pref."adminlog ORDER BY logtime DESC limit 50" ); while( $adminlog = mysql_fetch_array($result) ) { print "<tr> <td>".date('d.m.Y - H:i', $adminlog[logtime])."</td> <td>$adminlog[logtype]</td> <td>$adminlog[loguser]</td> <td>$adminlog[logip]</td> <td>$adminlog[logscript]</td> <td>$adminlog[logaction]</td> <td>$adminlog[lognotes]</td> </tr>"; } print '</table>'; }
/* * ========================================== * Settings * ========================================== */ elseif( $action == "EditSettings" ) { print '<b>Forum Settings</b><br><br>'; print ' <form method="post" action="index.php"> <table width="100%" border="0" cellspacing="0" cellpadding="4">';
// key/val $a_registry = array(); $r_registry = query("SELECT keyname, keyvalue, keytype, keydescription, keydetails, keygroupid, keydisplayorder FROM $pref"."registry ORDER BY keydisplayorder ASC"); //print(mysql_num_rows($r_registry)); while( $registry = mysql_fetch_array($r_registry) ) { $a_registry[$registry['keygroupid']][] = $registry; }
// groups $i = 0; $r_registrygroup = query("SELECT keygroupname, keygroupid, keygroupdisplayorder FROM $pref"."registrygroup ORDER BY keygroupdisplayorder ASC"); //print(mysql_num_rows($r_registrygroup)); while( $registrygroup = mysql_fetch_array($r_registrygroup) ) { print ' <tr> <td colspan="2" bgcolor="#999999"> <font size="2" color="white"><b>'.$registrygroup['keygroupname'].'</b></font> </td> </tr>'; while( list(, $registry) = @each($a_registry[$registrygroup['keygroupid']]) ) { if( $registry['keygroupid'] == 0 ) // 0 -> hide continue; print ' <tr> <td'.($i % 2 == 0 ? ' bgcolor="#eeeeee"' : '').' valign="top" width="50%"><b>'.$registry['keydescription'].'</b>'; if( $registry['keydetails'] ) { print '<font size="1"><br>'.$registry['keydetails'].'</font>'; } print '</td>'; print' <td'.($i % 2 == 0 ? ' bgcolor="#eeeeee"' : '').' valign="top" width="50%">';
switch( $registry['keytype'] ) { case 'boolean': print ' <input type="radio" name="Xconfig['.$registry['keyname'].']" value="1"' . ( $registry['keyvalue'] ? " checked" : "" ) . '> Yes <input type="radio" name="Xconfig['.$registry['keyname'].']" value="0"' . ( !$registry['keyvalue'] ? " checked" : "" ) . '> No'; break; case 'integer': print '<input class="tbinput" type="text" size="6" name="Xconfig['.$registry['keyname'].']" value="'.intval($registry['keyvalue']).'">'; break; case 'array': print '<textarea class="tbinput" cols="60" rows="8" name="Xconfig['.$registry['keyname'].']">'.htmlspecialchars($registry['keyvalue']).'</textarea>'; break; case 'string': print '<input type="text" class="tbinput" name="Xconfig['.$registry['keyname'].']" value="'.htmlspecialchars($registry['keyvalue']).'">'; break; } print ' </td> </tr>'; $i++; } } print '</table> <br> <center> <input type="hidden" name="session" value="'.$session.'"> <input type="hidden" name="action" value="WriteSettings"> <input type="submit" name="update_settings" value="Save settings"> </center> </form>'; }
/* * ========================================== * WriteSettings * ========================================== */ elseif( $action == "WriteSettings" ) { //var_dump($Xconfig); while( list($key, $value) = each($Xconfig) ) { query("UPDATE $pref"."registry SET keyvalue='".addslashes($value)."' WHERE keyname='".$key."'"); } print '<b>Settings saved</b><br> <br> Settings have been saved.'; }
tb_footer(); ?>
|