bug fixes
This commit is contained in:
parent
6f782914ca
commit
edb4504a5c
|
@ -37,10 +37,10 @@ $userrow = dorow(doquery("SELECT * FROM <<users>> WHERE id='".$acctrow["activech
|
|||
if ($userrow != false) { $userrow = array_map("stripslashes", $userrow); }
|
||||
|
||||
// World row.
|
||||
$worldrow = dorow(doquery("SELECT * FROM <<worlds>> WHERE id='".$userrow["world"]."' LIMIT 1"));
|
||||
$worldrow = dorow(doquery("SELECT * FROM <<worlds>> WHERE id='".($userrow["world"] ?? 1)."' LIMIT 1"));
|
||||
|
||||
// Town row.
|
||||
if ($userrow["currentaction"] == "In Town") {
|
||||
if (isset($userrow["currentaction"]) && $userrow["currentaction"] == "In Town") {
|
||||
$townrow = dorow(doquery("SELECT * FROM <<towns>> WHERE world='".$userrow["world"]."' AND longitude='".$userrow["longitude"]."' AND latitude='".$userrow["latitude"]."' LIMIT 1"));
|
||||
} else {
|
||||
$townrow = false;
|
||||
|
@ -62,4 +62,4 @@ $fightrow = array(
|
|||
"track"=>"",
|
||||
"message"=>"");
|
||||
|
||||
?>
|
||||
?>
|
||||
|
|
2
lib.php
2
lib.php
|
@ -216,7 +216,7 @@ function display($title, $content, $panels = true) { // Finalize page and output
|
|||
$row = array();
|
||||
$row["gamename"] = $controlrow["gamename"];
|
||||
$row["pagetitle"] = $title;
|
||||
$row["background"] = "background" . $userrow["world"];
|
||||
$row["background"] = (isset($userrow['world'])) ? "background" . $userrow["world"] : "background";
|
||||
$row["version"] = $version;
|
||||
$row["content"] = $content;
|
||||
$row["moddedby"] = $controlrow["moddedby"];
|
||||
|
|
134
panels.php
134
panels.php
|
@ -15,42 +15,42 @@
|
|||
// (see our website for that).
|
||||
|
||||
function panelleft() {
|
||||
|
||||
|
||||
global $controlrow, $userrow, $acctrow, $townrow, $worldrow;
|
||||
$row = array();
|
||||
|
||||
|
||||
// Action handling.
|
||||
if ($userrow["currentaction"] == "In Town") {
|
||||
if ($userrow["currentaction"] == "In Town") {
|
||||
$row["action"] = "In Town:";
|
||||
$row["townname"] = $townrow["name"];
|
||||
} else {
|
||||
$row["action"] = $userrow["currentaction"];
|
||||
} else {
|
||||
$row["action"] = $userrow["currentaction"];
|
||||
$row["townname"] = "";
|
||||
}
|
||||
|
||||
|
||||
// World handling.
|
||||
$row["worldname"] = $worldrow["name"];
|
||||
|
||||
|
||||
// Location handling.
|
||||
if ($userrow["latitude"] < 0) {
|
||||
$row["latitude"] = ($userrow["latitude"] * -1) . "S";
|
||||
} else {
|
||||
if ($userrow["latitude"] < 0) {
|
||||
$row["latitude"] = ($userrow["latitude"] * -1) . "S";
|
||||
} else {
|
||||
$row["latitude"] = $userrow["latitude"] . "N";
|
||||
}
|
||||
|
||||
if ($userrow["longitude"] < 0) {
|
||||
$row["longitude"] = ($userrow["longitude"] * -1) . "W";
|
||||
} else {
|
||||
|
||||
if ($userrow["longitude"] < 0) {
|
||||
$row["longitude"] = ($userrow["longitude"] * -1) . "W";
|
||||
} else {
|
||||
$row["longitude"] = $userrow["longitude"] . "E";
|
||||
}
|
||||
|
||||
|
||||
// Minimap option.
|
||||
if ($acctrow["minimap"] == 0) {
|
||||
|
||||
if ($acctrow["minimap"] == 0) {
|
||||
|
||||
$row["minimap"] = "<a href=\"javascript:void(0)\" onClick=\"Javascript:window.open('index.php?do=showmap','','width=550,height=550,toolbar=no, location=no,directories=no,status=yes,menubar=no,scrollbars=no,copyhistory=yes, resizable=yes');\">View Map</a><br /><br />";
|
||||
|
||||
|
||||
} else {
|
||||
|
||||
|
||||
$row["minimap"] = <<<THEVERYENDOFYOU
|
||||
<div style="border: solid 1px black; width: 106px; height: 106px; padding: 0px; margin: 0px 0px 5px 0px;">
|
||||
<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="106" height="106" id="mapmini" align="middle">
|
||||
|
@ -59,12 +59,12 @@ $row["minimap"] = <<<THEVERYENDOFYOU
|
|||
</object>
|
||||
</div>
|
||||
THEVERYENDOFYOU;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
// Travel To handling.
|
||||
$row["travelto"] = "";
|
||||
|
||||
|
||||
// First we build the query string.
|
||||
$townstring = "(";
|
||||
$townslist = explode(",",$userrow["townslist"]);
|
||||
|
@ -73,32 +73,32 @@ THEVERYENDOFYOU;
|
|||
}
|
||||
$townstring = rtrim($townstring, " OR ");
|
||||
$townstring .= ") AND world='".$userrow["world"]."'";
|
||||
|
||||
|
||||
// Then we do the query.
|
||||
$traveltoquery = dorow(doquery("SELECT id,name FROM <<towns>> WHERE $townstring ORDER BY id"), "id");
|
||||
|
||||
|
||||
// Finally we build the link list.
|
||||
foreach ($traveltoquery as $a => $b) {
|
||||
$row["travelto"] .= "<a href=\"index.php?do=travel:".$b["id"]."\">".$b["name"]."</a><br />\n";
|
||||
}
|
||||
|
||||
|
||||
// And then we're done with this panel.
|
||||
return parsetemplate(gettemplate("panels_left"), $row);
|
||||
|
||||
|
||||
}
|
||||
|
||||
function panelright() {
|
||||
|
||||
|
||||
global $controlrow;
|
||||
$row["babblebox"] = "";
|
||||
$row["whosonline"] = "";
|
||||
|
||||
|
||||
// Babblebox.
|
||||
if ($controlrow["showshout"] == 1) {
|
||||
$row["babblebox"] = "<div class=\"big\"><b>Babblebox</b></div>";
|
||||
$row["babblebox"] .= "<iframe src=\"index.php?do=babblebox\" name=\"sbox\" width=\"100%\" height=\"200\" frameborder=\"0\" id=\"bbox\">Your browser does not support inline frames! The Babble Box will not be available until you upgrade to a newer <a href=\"http://www.mozilla.org\" target=\"_new\">browser</a>.</iframe><br /><br />";
|
||||
}
|
||||
|
||||
|
||||
// Who's Online.
|
||||
if ($controlrow["showonline"] == 1) {
|
||||
$row["whosonline"] = "<div class=\"big\"><b>Who's Online</b></div>";
|
||||
|
@ -106,61 +106,65 @@ function panelright() {
|
|||
$number = count($users);
|
||||
$row["whosonline"] .= "There are <b>$number</b> user(s) online within the last 10 minutes: ";
|
||||
foreach ($users as $a => $b) {
|
||||
if ($b["guild"] != 0) {
|
||||
if ($b["guild"] != 0) {
|
||||
$charname = "[<span style=\"color: ".$b["tagcolor"].";\">".$b["guildtag"]."</span>]<span style=\"color: ".$b["namecolor"].";\">".$b["charname"]."</span>";
|
||||
} else {
|
||||
} else {
|
||||
$charname = $b["charname"];
|
||||
}
|
||||
$row["whosonline"] .= "<a href=\"users.php?do=profile&uid=".$b["id"]."\">$charname</a>, ";
|
||||
}
|
||||
$row["whosonline"] = rtrim($row["whosonline"], ", ");
|
||||
}
|
||||
|
||||
|
||||
// And then we're done with this panel.
|
||||
return parsetemplate(gettemplate("panels_right"), $row);
|
||||
|
||||
|
||||
}
|
||||
|
||||
function paneltop($loggedin = true) {
|
||||
|
||||
|
||||
global $acctrow, $userrow;
|
||||
if ($loggedin == true || isset($acctrow)) {
|
||||
|
||||
if ($userrow == false) { $userrow["charname"] = "No Characters Yet"; $userrow["guild"] = 0; }
|
||||
|
||||
if (empty($userrow) || !isset($userrow) || $userrow === false) {
|
||||
$userrow = [];
|
||||
$userrow["charname"] = "No Characters Yet";
|
||||
$userrow["guild"] = 0;
|
||||
}
|
||||
//if ($acctrow["authlevel"] == 255) { $admin = " (<a href=\"admin/index.php\">Admin</a>)"; } else { $admin = ""; }
|
||||
$admin = "";
|
||||
if ($userrow["guild"] != 0) {
|
||||
if ($userrow["guild"] != 0) {
|
||||
$charname = "[<span style=\"color: ".$userrow["tagcolor"].";\">".$userrow["guildtag"]."</span>]<span style=\"color: ".$userrow["namecolor"].";\">".$userrow["charname"]."</span>";
|
||||
} else {
|
||||
} else {
|
||||
$charname = $userrow["charname"];
|
||||
}
|
||||
$top = "<div class=\"big\">\n<center><b>$charname</b>$admin<br />\n";
|
||||
$top .= "[ <a href=\"login.php?do=logout\">Log Out</a> | <a href=\"users.php?do=settings\">Account</a> | <a href=\"users.php?do=characters\">Characters</a> | <a href=\"help.php\">Help</a> ]\n";
|
||||
$top .= "</center></div>\n";
|
||||
|
||||
|
||||
} else {
|
||||
|
||||
|
||||
$top = "<div class=\"big\">\n<center><b>Not Logged In</b><br />\n";
|
||||
$top .= "[ <a href=\"login.php?do=login\">Log In</a> | <a href=\"users.php?do=register\">Register</a> | <a href=\"help.php\">Help</a> ]\n";
|
||||
$top .= "</center></div>\n";
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
return $top;
|
||||
|
||||
|
||||
}
|
||||
|
||||
function panelbottom() {
|
||||
|
||||
|
||||
global $userrow, $spells;
|
||||
$row = array();
|
||||
|
||||
|
||||
if ($userrow["charpicture"] != "") {
|
||||
$row["charpicture"] = $userrow["charpicture"];
|
||||
} else {
|
||||
$row["charpicture"] = "images/users/nopicture.gif";
|
||||
}
|
||||
|
||||
|
||||
// Do quickspell stuff.
|
||||
$quickhealid = 0;
|
||||
$quickhealvalue = 0;
|
||||
|
@ -168,20 +172,20 @@ function panelbottom() {
|
|||
for ($i=1; $i<11; $i++) {
|
||||
if ($userrow["spell".$i."id"] != 0) {
|
||||
if ($spells[$userrow["spell".$i."id"]]["fname"] == "heal") {
|
||||
if ($spells[$userrow["spell".$i."id"]]["value"] > $quickhealvalue) {
|
||||
$quickhealvalue = $spells[$userrow["spell".$i."id"]]["value"];
|
||||
$quickhealid = $spells[$userrow["spell".$i."id"]]["id"];
|
||||
if ($spells[$userrow["spell".$i."id"]]["value"] > $quickhealvalue) {
|
||||
$quickhealvalue = $spells[$userrow["spell".$i."id"]]["value"];
|
||||
$quickhealid = $spells[$userrow["spell".$i."id"]]["id"];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($quickhealid != 0) {
|
||||
if ($quickhealid != 0) {
|
||||
$row["quickheal"] = "<a href=\"index.php?do=quickheal&id=$quickhealid\" class=\"red\">(Heal)</a>";
|
||||
} else {
|
||||
$row["quickheal"] = "";
|
||||
}
|
||||
|
||||
|
||||
// Do the rest of it.
|
||||
$row["level"] = $userrow["level"];
|
||||
if ($userrow["levelup"] > 0) { $row["levelup"] = "<a href=\"users.php?do=levelup\" class=\"red\">(".$userrow["levelup"]." LP)</a>"; } else { $row["levelup"] = ""; }
|
||||
|
@ -195,26 +199,26 @@ function panelbottom() {
|
|||
$row["hpbar"] = statusbars("hp", $userrow["currenthp"], $userrow["maxhp"]);
|
||||
$row["mpbar"] = statusbars("mp", $userrow["currentmp"], $userrow["maxmp"]);
|
||||
$row["tpbar"] = statusbars("tp", $userrow["currenttp"], $userrow["maxtp"]);
|
||||
|
||||
|
||||
|
||||
|
||||
return parsetemplate(gettemplate("panels_bottom"),$row);
|
||||
|
||||
|
||||
}
|
||||
|
||||
function panelmiddle() {
|
||||
|
||||
|
||||
global $userrow, $townrow, $worldrow;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
return gettemplate("panels_middle");
|
||||
|
||||
|
||||
}
|
||||
|
||||
function statusbars($stat, $current, $max) {
|
||||
|
||||
|
||||
$row = array();
|
||||
switch ($stat) {
|
||||
switch ($stat) {
|
||||
case "hp":
|
||||
$row["bigname"] = "Hit Points";
|
||||
$row["littlename"] = "HP";
|
||||
|
@ -232,16 +236,16 @@ function statusbars($stat, $current, $max) {
|
|||
$row["littlename"] = "Exp";
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
$row["width"] = ceil(($current / $max) * 100);
|
||||
if ($row["width"] >= 66) { $row["color"] = "green"; }
|
||||
if ($row["width"] < 66 && $row["width"] >= 33) { $row["color"] = "yellow"; }
|
||||
if ($row["width"] < 33) { $row["color"] = "red"; }
|
||||
|
||||
|
||||
$row["current"] = $current;
|
||||
$row["max"] = $max;
|
||||
return parsetemplate(gettemplate("statusbars"),$row);
|
||||
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
?>
|
||||
|
|
|
@ -358,6 +358,7 @@ function charnew() {
|
|||
$characternamequery = doquery("SELECT charname FROM <<users>> WHERE charname='$charname' LIMIT 1");
|
||||
if (mysql_num_rows($characternamequery) > 0) { $errors++; $errorlist .= "Character Name already taken - unique Character Name required.<br />"; }
|
||||
|
||||
|
||||
// Upload new charpicture, if required.
|
||||
if ($_FILES["intavatar"]["error"] != 4) {
|
||||
|
||||
|
@ -377,7 +378,9 @@ function charnew() {
|
|||
if (!move_uploaded_file($_FILES["intavatar"]["tmp_name"], $uploadfile)) { die("Unable to upload avatar."); }
|
||||
$newcharpicture = $controlrow["avatarurl"] . $acctrow["username"] . $randomext . $type;
|
||||
|
||||
}
|
||||
} else {
|
||||
$newcharpicture = $controlrow["avatarurl"] . "nopicture.gif";
|
||||
}
|
||||
|
||||
// Process everything else important.
|
||||
if (!is_numeric($charclass)) { $errors++; $errorlist .= "Invalid character class.<br />"; }
|
||||
|
|
Loading…
Reference in New Issue
Block a user