forked from NB-Core/lotgd
-
Notifications
You must be signed in to change notification settings - Fork 0
/
bio.php
188 lines (164 loc) · 6.08 KB
/
bio.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
185
186
187
188
<?php
// addnews ready
// translator ready
// mail ready
/**
* \file bio.php
* This file holds the code for the user bio view. It features hooks to let modules add code and hence descriptions. The user can set a bio description in his preferences.
* @see village.php
* @see prefs.php
*/
require_once("common.php");
require_once("lib/sanitize.php");
tlschema("bio");
checkday();
$ret = httpget('ret');
if ($ret==""){
$return = "/list.php";
}else{
$return = cmd_sanitize($ret);
}
$char = httpget('char');
//Legacy support
if (is_numeric($char)){
$where = "acctid = $char";
} else {
$where = "login = '$char'";
}
$sql = "SELECT login, name, level, sex, title, specialty, hashorse, acctid, resurrections, bio, dragonkills, race, clanname, clanshort, clanrank, ".db_prefix("accounts").".clanid, laston, loggedin FROM " . db_prefix("accounts") . " LEFT JOIN " . db_prefix("clans") . " ON " . db_prefix("accounts") . ".clanid = " . db_prefix("clans") . ".clanid WHERE $where";
$result = db_query($sql);
if ($target = db_fetch_assoc($result)) {
$target['login'] = rawurlencode($target['login']);
$id = $target['acctid'];
$target['return_link']=$return;
page_header("Character Biography: %s", full_sanitize($target['name']));
tlschema("nav");
addnav("Return");
tlschema();
if ($session['user']['superuser'] & SU_EDIT_USERS){
addnav("Superuser");
addnav("Edit User","user.php?op=edit&userid=$id");
}
modulehook("biotop", $target);
output("`^Biography for %s`^.",$target['name']);
$write = translate_inline("Write Mail");
if ($session['user']['loggedin'])
rawoutput("<a href=\"mail.php?op=write&to={$target['login']}\" target=\"_blank\" onClick=\"".popup("mail.php?op=write&to={$target['login']}").";return false;\"><img src='images/newscroll.GIF' width='16' height='16' alt='$write' border='0'></a>");
output_notl("`n`n");
if ($target['clanname']>"" && getsetting("allowclans",false)){
$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"=>$target['clanid']));
tlschema("clans"); //just to be in the right schema
array_push($ranks['ranks'],"`\$Founder");
$ranks = translate_inline($ranks['ranks']);
tlschema();
output("`@%s`2 is a %s`2 to `%%s`2`n", $target['name'], str_replace(array("`c","`i"),"",$ranks[$target['clanrank']]), str_replace(array("`c","`i"),"",$target['clanname']));
}
output("`^Title: `@%s`n",$target['title']);
output("`^Level: `@%s`n",$target['level']);
$loggedin = false;
if ($target['loggedin'] &&
(date("U") - strtotime($target['laston']) <
getsetting("LOGINTIMEOUT", 900))) {
$loggedin = true;
}
$status = translate_inline($loggedin?"`#Online`0":"`\$Offline`0");
output("`^Status: %s`n",$status);
output("`^Resurrections: `@%s`n",$target['resurrections']);
$race = $target['race'];
if (!$race) $race = RACE_UNKNOWN;
$race = translate_inline($race,"race","race");
output("`^Race: `@%s`n",$race);
$genders = array("Male","Female");
$genders = translate_inline($genders);
output("`^Gender: `@%s`n",$genders[$target['sex']]);
$specialties = modulehook("specialtynames",
array(""=>translate_inline("Unspecified")));
if (isset($specialties[$target['specialty']])) {
output("`^Specialty: `@%s`n",$specialties[$target['specialty']]);
}
$sql = "SELECT * FROM " . db_prefix("mounts") . " WHERE mountid='{$target['hashorse']}'";
$result = db_query_cached($sql, "mountdata-{$target['hashorse']}", 3600);
$mount = db_fetch_assoc($result);
$mount['acctid']=$target['acctid'];
$mount = modulehook("bio-mount",$mount);
$none = translate_inline("`iNone`i");
if (!isset($mount['mountname']) || $mount['mountname']=="")
$mount['mountname'] = $none;
output("`^Creature: `@%s`0`n",$mount['mountname']);
modulehook("biostat", $target);
if ($target['dragonkills']>0)
output("`^Dragon Kills: `@%s`n",$target['dragonkills']);
if ($target['bio']>"")
output("`^Bio: `@`n%s`n",soap($target['bio']));
modulehook("bioinfo", $target);
output("`n`^Recent accomplishments (and defeats) of %s`^",$target['name']);
$result = db_query("SELECT * FROM " . db_prefix("news") . " WHERE accountid={$target['acctid']} ORDER BY newsdate DESC,newsid ASC LIMIT 100");
$odate="";
tlschema("news");
while ($row = db_fetch_assoc($result)) {
tlschema($row['tlschema']);
if ($row['arguments'] > "") {
$arguments = array();
$base_arguments = unserialize($row['arguments']);
array_push($arguments, $row['newstext']);
while(list($key, $val) = each($base_arguments)) {
array_push($arguments, $val);
}
$news = call_user_func_array("sprintf_translate", $arguments);
rawoutput(tlbutton_clear());
} else {
$news = translate_inline($row['newstext']);
rawoutput(tlbutton_clear());
}
tlschema();
if ($odate!=$row['newsdate']){
output_notl("`n`b`@%s`0`b`n",
date("D, M d", strtotime($row['newsdate'])));
$odate=$row['newsdate'];
}
output_notl("`@".sanitize_mb($news)."`0`n");
}
tlschema();
if ($ret==""){
$return = substr($return,strrpos($return,"/")+1);
tlschema("nav");
addnav("Return");
addnav("Return to the warrior list",$return);
tlschema();
}else{
$return = substr($return,strrpos($return,"/")+1);
tlschema("nav");
addnav("Return");
if ($return=="list.php") {
addnav("Return to the warrior list",$return);
} else {
addnav("Return whence you came",$return);
}
tlschema();
}
modulehook("bioend", $target);
page_footer();
} else {
page_header("Character has been deleted");
output("This character is already deleted.");
if ($ret==""){
$return = substr($return,strrpos($return,"/")+1);
tlschema("nav");
addnav("Return");
addnav("Return to the warrior list",$return);
tlschema();
}else{
$return = substr($return,strrpos($return,"/")+1);
tlschema("nav");
addnav("Return");
if ($return=="list.php") {
addnav("Return to the warrior list",$return);
} else {
addnav("Return whence you came",$return);
}
tlschema();
}
page_footer();
}
?>