-
Notifications
You must be signed in to change notification settings - Fork 9
/
user.php
184 lines (167 loc) · 5.08 KB
/
user.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
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
<?php
//addnews ready
// mail ready
require_once("common.php");
require_once("lib/showform.php");
require_once("lib/datetime.php");
require_once("lib/http.php");
require_once("lib/sanitize.php");
require_once("lib/names.php");
tlschema("user");
check_su_access(SU_EDIT_USERS);
$op = httpget('op');
$userid=httpget("userid");
if ($op == "lasthit") {
// Try and keep user editor and captcha from breaking each other.
$_POST['i_am_a_hack'] = 'true';
}
page_header("User Editor");
$sort = httpget('sort');
$petition=httpget("returnpetition");
$returnpetition="";
if ($petition != "") $returnpetition = "&returnpetition=$petition";
$gentime = 0;
$gentimecount = 0;
$order = "acctid";
if ($sort!="") $order = "$sort";
$display = 0;
$query = httppost('q');
if ($query === false) $query = httpget('q');
if (!$query && $sort) $query = "%";
if ($op=="search" || $op== ""){
require_once("lib/lookup_user.php");
list($searchresult, $err) = lookup_user($query, $order);
$op = "";
if ($err) {
output($err);
} else {
if ($searchresult) $display = 1;
}
}
$m = httpget("module");
if ($m) $m = "&module=$m&subop=module";
rawoutput("<form action='user.php?op=search$m' method='POST'>");
output("Search by any field below: ");
rawoutput("<input name='q' id='q'>");
$se = translate_inline("Search");
rawoutput("<input type='submit' class='button' value='$se'>");
rawoutput("</form>");
rawoutput("<script language='JavaScript'>document.getElementById('q').focus();</script>");
addnav("","user.php?op=search$m");
require_once("lib/superusernav.php");
superusernav();
addnav("Bans");
addnav("Add a ban","bans.php?op=setupban");
addnav("List/Remove bans","bans.php?op=removeban");
addnav("Search for banned user","bans.php?op=searchban");
// This doesn't seem to be used, so I'm going to comment it out now
//$msg = httpget('msg');
//if ($msg>"") {
// output("Message: %s`n", $msg);
//}
// Collect a list of the mounts
$mounts="0," . translate_inline("None");
$sql = "SELECT mountid,mountname,mountcategory FROM " . db_prefix("mounts") . " ORDER BY mountcategory";
$result = db_query($sql);
while ($row = db_fetch_assoc($result)){
$mounts.=",{$row['mountid']},{$row['mountcategory']}: ".color_sanitize($row['mountname']);
}
$specialties = array(""=>translate_inline("Undecided"));
$specialties = modulehook("specialtynames", $specialties);
$enum = "";
foreach ($specialties as $key=>$name) {
if ($enum) $enum .= ",";
$enum .= "$key,$name";
}
//Inserted for v1.1.0 Dragonprime Edition to extend clan possibilities
$ranks = array(CLAN_APPLICANT=>"`!Applicant`0",CLAN_MEMBER=>"`#Member`0",CLAN_OFFICER=>"`^Officer`0",CLAN_LEADER=>"`&Leader`0", CLAN_FOUNDER=>"`\$Founder");
$ranks = modulehook("clanranks", array("ranks"=>$ranks, "clanid"=>NULL, "userid"=>$userid));
$ranks = $ranks['ranks'];
$rankstring = "";
foreach($ranks as $rankid => $rankname) {
if ($rankstring != "") $rankstring .= ",";
$rankstring .= $rankid.",".sanitize($rankname);
}
$races = modulehook("racenames");
//all races here expect such ones no module covers, so we add the users race first.
if ($op=='edit' || $op=='save') {
//add the race
$sql="SELECT race FROM ".db_prefix('accounts')." WHERE acctid=$userid LIMIT 1;";
$result = db_query($sql);
$row=db_fetch_assoc($result);
$racesenum=",".translate_inline("Undecided","race").",";
foreach ($races as $race) {
$racesenum.=$race.",".$race.",";
}
if (!in_array($row['race'],$races)) {
/* if ($row['race']=='') {
//ok, we have a resetted race here
$racesenum.=$row['race'].",".translate_inline("Undecided","race").",";
} else {*/
$racesenum.=$row['race'].",".$row['race'].",";
// }
}
$racesenum=substr($racesenum,0,strlen($racesenum)-1);
//later on: enumpretrans, because races are already translated in a way...
}
require("lib/data/user_account.php");
$sql = "SELECT clanid,clanname,clanshort FROM " . db_prefix("clans") ." ORDER BY clanshort";
$result = db_query($sql);
while ($row=db_fetch_assoc($result)){
//ok, we had nuts here wo made clan names with commas - so I replace them with ; ...
$userinfo['clanid'].=",{$row['clanid']},".str_replace(",",";","<{$row['clanshort']}> {$row['clanname']}");
}
switch ($op) {
case "lasthit":
require("lib/user/user_lasthit.php");
break;
case "savemodule":
require("lib/user/user_savemodule.php");
break;
case "special":
require("lib/user/user_special.php");
break;
case "save":
require("lib/user/user_save.php");
break;
}
switch($op) {
case "edit":
require("lib/user/user_edit.php");
break;
case "setupban":
require("lib/user/user_setupban.php");
break;
case "del":
require("lib/user/user_del.php");
break;
case "saveban":
require("lib/user/user_saveban.php");
break;
case "delban":
require("lib/user/user_delban.php");
break;
case "removeban":
require("lib/user/user_removeban.php");
break;
case "searchban":
require("lib/user/user_searchban.php");
break;
case "debuglog":
require("lib/user/user_debuglog.php");
break;
case "":
require("lib/user/user_.php");
break;
}
page_footer();
function show_bitfield($val){
$out = "";
$v = 1;
for ($i=0; $i < 32; $i++){
$out.= (int)$val & (int)$v?"1":"0";
$v *= 2;
}
return($out);
}
?>