-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathuser.php
More file actions
executable file
·287 lines (261 loc) · 9.72 KB
/
Copy pathuser.php
File metadata and controls
executable file
·287 lines (261 loc) · 9.72 KB
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
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
<?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");
Translator::tlschema("user");
SuAccess::check_su_access(SU_EDIT_USERS);
$op = Http::httpget('op');
$userid=Http::httpget("userid");
if ($op == "lasthit") {
// Try and keep user editor and captcha from breaking each other.
$_POST['i_am_a_hack'] = 'true';
}
PageParts::page_header("User Editor");
$sort = Http::httpget('sort');
$petition=Http::httpget("returnpetition");
$returnpetition="";
if ($petition != "") $returnpetition = "&returnpetition=$petition";
$gentime = 0;
$gentimecount = 0;
$order = "acctid";
if ($sort!="") $order = "$sort";
$display = 0;
$query = Http::httppost('q');
if ($query === false) $query = Http::httpget('q');
if ($op=="search" || $op== ""){
require_once("lib/lookup_user.php");
list($searchresult, $err) = lookup_user($query, $order);
$op = "";
if ($err) {
OutputClass::output($err);
} else {
$display = 1;
}
}
$m = Http::httpget("module");
if ($m) $m = "&module=$m&subop=module";
OutputClass::rawoutput("<form action='user.php?op=search$m' method='POST'>");
OutputClass::output("Search by any field below: ");
OutputClass::rawoutput("<input name='q' id='q'>");
$se = Translator::translate_inline("Search");
OutputClass::rawoutput("<input type='submit' class='button' value='$se'>");
OutputClass::rawoutput("</form>");
OutputClass::rawoutput("<script language='JavaScript'>document.getElementById('q').focus();</script>");
OutputClass::addnav("","user.php?op=search$m");
require_once("lib/superusernav.php");
SuperUserNavClass::superusernav();
OutputClass::addnav("Bans");
OutputClass::addnav("Add a ban","user.php?op=setupban");
OutputClass::addnav("List/Remove bans","user.php?op=removeban");
// This doesn't seem to be used, so I'm going to comment it out now
//$msg = Http::httpget('msg');
//if ($msg>"") {
// OutputClass::output("Message: %s`n", $msg);
//}
// Collect a list of the mounts
$mounts="0," . Translator::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']}: ".SanitizeClass::color_sanitize($row['mountname']);
}
$specialties = array(""=>Translator::translate_inline("Undecided"));
$specialties = Modules::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 = Modules::modulehook("clanranks", array("ranks"=>$ranks, "clanid"=>NULL, "userid"=>$userid));
$ranks = $ranks['ranks'];
$rankstring = "";
foreach($ranks as $rankid => $rankname) {
if ($rankstring != "") $rankstring .= ",";
$rankstring .= $rankid.",".SanitizeClass::sanitize($rankname);
}
$userinfo = array(
"Account info,title",
"acctid"=>"User id,viewonly",
"login"=>"Login",
"newpassword"=>"New Password",
"emailaddress"=>"Email Address",
"locked"=>"Account Locked,bool",
"banoverride"=>"Override Bans for this account,bool",
"referer"=>"ID of player who referred this player," .
(($session['user']['superuser'] & SU_EDIT_DONATIONS) ? "int" : "viewonly"),
"refererawarded"=>"Has the referring player been awarded points,viewonly",
"Basic user info,title",
"name"=>"Character Name (Do NOT include ANY title information)",
"title"=>"Dragonkill Title (prepended to name if Custom Title unset)" . (Settings::getsetting("edittitles",1) ? "" : ",hidden"),
"ctitle"=>"Custom Title (prepended to name if set)",
"sex"=>"Sex,enum,0,Male,1,Female",
"age"=>"Days since level 1,int",
"dragonkills"=>"How many times has slain the dragon,int",
"dragonage"=>"How old when last killed dragon,int",
"bestdragonage"=>"Youngest days when killed dragon,int",
"pk"=>"Has user attacked in pvp?,bool",
"bio"=>"Bio",
"Stats,title",
"level"=>"Level,int",
"race"=>"Race",
"experience"=>"Experience,int",
"hitpoints"=>"Current Hitpoints,int",
"maxhitpoints"=>"Max Hitpoints,int",
"turns"=>"Turns left,int",
"playerfights"=>"Playerfights left,int",
"attack"=>"Attack (includes weapon damage),int",
"defense"=>"Defense (includes armor defense),int",
"spirits"=>"Spirits (display only),enum,-6,Resurrected,-2,Very Low,-1,Low,0,Normal,1,High,2,Very High",
"resurrections"=>"Resurrections,int",
"location"=>"Where is the user currently",
"Specialty,title",
"specialty"=>"Specialty,enumpretrans,". $enum,
"Grave Fights,title",
"deathpower"=>array("Favor with %s`0,int", Settings::getsetting("deathoverlord", '`$Ramius')),
"gravefights"=>"Grave fights left,int",
"soulpoints"=>"Soulpoints (HP while dead),int",
"Gear,title",
"gems"=>"Gems,int",
"gold"=>"Gold in hand,int",
"goldinbank"=>"Gold in bank,int",
"transferredtoday"=>"Number of transfers today,int",
"amountouttoday"=>"Total value of transfers from player today,int",
"weapon"=>"Weapon Name",
"weapondmg"=>"Damage of weapon,int",
"weaponvalue"=>"Purchase cost of weapon,int",
"armor"=>"Armor Name",
"armordef"=>"Armor defense,int",
"armorvalue"=>"Purchase cost of armor,int",
"Special,title",
"charm"=>"Charm,int",
"seendragon"=>"Saw dragon today,bool",
"seenmaster"=>"Seen master,bool",
"hashorse"=>"Mount,enumpretrans,".$mounts,
"fedmount"=>"Fed mount today,bool",
"boughtroomtoday"=>"Bought a room today,bool",
"marriedto"=>"Is married to the player with AcctID," .
(($session['user']['superuser'] & SU_MEGAUSER) ? "int" : "viewonly"),
"Clan Info,title",
"clanid"=>"Clan,enumpretrans,0,".Translator::translate_inline("None"),
"clanrank"=>"Clan Rank,enum,$rankstring",
"clanjoindate"=>"Clan Join Date",
"Superuser Flags,title",
"superuser"=>"Superuser Permissions".
"<br/><i>For the most part you can only set flags that you yourself possess;".
"<br/>if you try to set one that you don't have; it won't stick.</i>,".
"bitfield,".
($session['user']['superuser'] | SU_ANYONE_CAN_SET |
($session['user']['superuser']&SU_MEGAUSER ? 0xFFFFFFFF : 0)).",".
SU_MEGAUSER. ",MEGA USER (enable all permissions)* <i>(this applies to any future flags as well)</i>".
"<br/><br/><b>Editors</b>,".
SU_EDIT_CONFIG. ",Edit Game Configurations*,".
SU_EDIT_USERS. ",Edit Users*,".
SU_EDIT_MOUNTS. ",Edit Mounts,".
SU_EDIT_CREATURES. ",Edit Creatures & Taunts,".
SU_EDIT_EQUIPMENT. ",Edit Armor & Weapons,".
SU_EDIT_RIDDLES. ",Edit Riddles,".
SU_MANAGE_MODULES. ",Manage Modules".
"<br/><br/><b>Customer Service</b>,".
SU_IS_GAMEMASTER. ",Can post comments as gamemaster,".
SU_EDIT_PETITIONS. ",Handle Petitions,".
SU_EDIT_COMMENTS. ",Moderate Comments,".
SU_MODERATE_CLANS. ",Moderate Clan Commentary,".
SU_AUDIT_MODERATION.",Audit Moderated Comments,".
SU_OVERRIDE_YOM_WARNING.",Do NOT display YOM warning for this person,".
SU_POST_MOTD. ",Post MoTD's".
"<br/><br/><b>Donations</b>,".
SU_EDIT_DONATIONS. ",Manage Donations*,".
SU_EDIT_PAYLOG. ",Manage Payment Log".
"<br/><br/><b>Game Development</b>,".
SU_INFINITE_DAYS. ",Infinite Days*,".
SU_DEVELOPER. ",Game Developer* (super powers),".
SU_IS_TRANSLATOR. ",Enable Translation Tool,".
SU_DEBUG_OUTPUT. ",OutputClass::debug OutputClass::output,".
SU_SHOW_PHPNOTICE. ",See PHP Notices in OutputClass::debug OutputClass::output,".
SU_RAW_SQL. ",Execute Raw SQL*,".
SU_VIEW_SOURCE. ",View source code,".
SU_GIVE_GROTTO. ",Grotto access (only if not granted implicitly in another permission),".
SU_NEVER_EXPIRE. ",Account never expires".
"<br/><br/>* Granting any of these options will hide the user from the HoF",
"Misc Info,title",
"regdate"=>"Registered on,viewonly",
"beta"=>"Willing to participate in beta,bool",
"laston"=>"Last On (local time),viewonly",
"lasthit"=>"Last New Day (time is in GMT not local),viewonly",
"lastmotd"=>"Last MOTD date (local time),viewonly",
"lastip"=>"Last IP,viewonly",
"uniqueid"=>"Unique ID,viewonly",
"gentime"=>"Sum of page gen times,viewonly",
"gentimecount"=>"Page hits,viewonly",
"allowednavs"=>"Allowed Navs,viewonly",
"dragonpoints"=>"Dragon points spent,viewonly",
"bufflist"=>"Buff List,viewonly",
"prefs"=>"Preferences,viewonly",
"donationconfig"=>"Donation buys,viewonly",
"Battle Info,title",
"companions"=>"List of companions,viewonly",
"badguy"=>"Last Badguy,viewonly"
);
$sql = "SELECT clanid,clanname,clanshort FROM " . db_prefix("clans") ." ORDER BY clanshort";
$result = db_query($sql);
while ($row=db_fetch_assoc($result)){
$userinfo['clanid'].=",{$row['clanid']},<{$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 "debuglog":
require("lib/user/user_debuglog.php");
break;
case "":
require("lib/user/user_.php");
break;
}
PageParts::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);
}
?>