function hunterslodge_customarmour_run()
{
require_once "lib/sanitize.php";
require_once "lib/names.php";
global $session;
$op = httpget("op");
$free = httpget("free");
page_header("Choose your Custom Armour");
switch ($op) {
case "change":
output("Want to change your Custom Armour? No problem. Enter your desired armour in the box below. You've got 25 characters to play around with.`n(leave this blank to disable custom armour naming and return to default, game-supplied armour names)`n`n");
rawoutput("<form action='runmodule.php?module=hunterslodge_customarmour&op=confirm&free=" . $free . "' method='POST'>");
$armour = get_module_pref("customarmour");
rawoutput("<input id='input' name='newarmour' width='25' maxlength='25' value='" . htmlentities($armour, ENT_COMPAT, getsetting("charset", "ISO-8859-1")) . "'>");
rawoutput("<input type='submit' class='button' value='Preview'>");
rawoutput("</form>");
addnav("", "runmodule.php?module=hunterslodge_customarmour&op=confirm&free=" . $free);
addnav("Cancel");
addnav("Don't set custom armour, just go back to the Lodge", "runmodule.php?module=iitems_hunterslodge&op=start");
break;
case "confirm":
$newarmour = httppost("newarmour");
$sub = httpget("sub");
$newarmour = str_replace("`", "", $newarmour);
$newarmour = comment_sanitize($newarmour);
$newarmour = substr($newarmour, 0, 25);
if ($newarmour) {
output("Your new custom armour is:`n%s`nWould you like to set your new armour now?`n`n", $newarmour);
} else {
output("You've chosen to go back to the default, game-supplied armours. Are you sure that's what you want?`n`n");
}
addnav("Confirm");
addnav("Set custom armour", "runmodule.php?module=hunterslodge_customarmour&op=set&free={$free}&newarmour=" . rawurlencode($newarmour));
addnav("Cancel");
addnav("Don't set custom armour, just go back to the Lodge", "runmodule.php?module=iitems_hunterslodge&op=start");
break;
case "set":
$newarmour = rawurldecode(httpget("newarmour"));
if ($newarmour == "") {
output("Your custom armour name has been removed. The next time you change your armour, you'll return to game-supplied armour names.`n`n");
} else {
output("Your custom armour has been set to %s!`n`n", $newarmour);
$session['user']['armor'] = $newarmour;
}
set_module_pref("customarmour", $newarmour);
if (!$free) {
require_once "modules/iitems/lib/lib.php";
$id = has_item("hunterslodge_customarmour");
delete_item($id);
}
addnav("Return");
addnav("Return to the Lodge", "runmodule.php?module=iitems_hunterslodge&op=start");
break;
}
page_footer();
}
function hunterslodge_customtitle_run()
{
require_once "lib/sanitize.php";
require_once "lib/names.php";
global $session;
$op = httpget("op");
$free = httpget("free");
page_header("Choose your Custom Title");
switch ($op) {
case "change":
output("Ready to change your Title? No problem. Enter your desired Title in the box below. You've got 25 characters to play with, including colour codes.`n`n");
titlechange_form();
addnav("Cancel");
addnav("Don't change colours, just go back to the Lodge", "runmodule.php?module=iitems_hunterslodge&op=start");
break;
case "confirm":
$ntitle = rawurldecode(httppost('newname'));
$ntitle = newline_sanitize($ntitle);
if ($ntitle == "") {
$ntitle = "`0";
}
$ntitle = preg_replace("/[`][cHw]/", "", $ntitle);
$ntitle = sanitize_html($ntitle);
$nname = get_player_basename();
output("`0Your new title will look like this: %s`0`n", $ntitle);
output("`0Your entire name will look like: %s %s`0`n`n", $ntitle, $nname);
output("Do you want to set the new title now?`n`n");
output("`0Try a different title below, if you like.`n`n");
titlechange_form();
addnav("Confirm");
addnav("Set the new Title", "runmodule.php?module=hunterslodge_customtitle&op=set&free={$free}&newname=" . rawurlencode($ntitle));
addnav("Cancel");
addnav("Don't change your Title, just go back to the Lodge", "runmodule.php?module=iitems_hunterslodge&op=start");
break;
case "set":
$ntitle = rawurldecode(httpget('newname'));
$fromname = $session['user']['name'];
$newname = change_player_ctitle($ntitle);
$session['user']['ctitle'] = $ntitle;
$session['user']['name'] = $newname;
output("You are now known as %s!`0`n`n", $session['user']['name']);
if (!$free) {
$id = has_item("hunterslodge_customtitle");
delete_item($id);
}
addnav("Return");
addnav("Return to the Lodge", "runmodule.php?module=iitems_hunterslodge&op=start");
break;
}
page_footer();
}
function clanform()
{
rawoutput("<form action='clan.php?op=new&apply=1' method='POST'>");
addnav("", "clan.php?op=new&apply=1");
output("`b`cNew Clan Application Form`c`b");
output("Clan Name: ");
rawoutput("<input name='clanname' maxlength='50' value=\"" . htmlentities(stripslashes(httppost('clanname')), ENT_COMPAT, getsetting("charset", "ISO-8859-1")) . "\">");
output("`nShort Name: ");
rawoutput("<input name='clanshort' maxlength='5' size='5' value=\"" . htmlentities(stripslashes(httppost('clanshort')), ENT_COMPAT, getsetting("charset", "ISO-8859-1")) . "\">");
output("`nNote, color codes are permitted in neither clan names nor short names.");
output("The clan name is shown on player bios and on clan overview pages while the short name is displayed next to players' names in comment areas and such.`n");
$apply = translate_inline("Apply");
rawoutput("<input type='submit' class='button' value='{$apply}'></form>");
}
function hunterslodge_namedmount_run()
{
require_once "lib/sanitize.php";
require_once "lib/names.php";
global $session;
global $playermount;
$op = httpget("op");
$free = httpget("free");
page_header("Name your Mount");
switch ($op) {
case "change":
output("Want to change your Mount's name? No problem. Enter your desired name in the box below. You've got 25 characters to play around with.`n(leave this blank to disable mount naming)`n`n");
rawoutput("<form action='runmodule.php?module=hunterslodge_namedmount&op=confirm&free=" . $free . "' method='POST'>");
rawoutput("<input id='input' name='newname' width='25' maxlength='25' value='" . htmlentities($race, ENT_COMPAT, getsetting("charset", "ISO-8859-1")) . "'>");
rawoutput("<input type='submit' class='button' value='Preview'>");
rawoutput("</form>");
addnav("", "runmodule.php?module=hunterslodge_namedmount&op=confirm&free=" . $free);
addnav("Cancel");
addnav("Don't set a mount name, just go back to the Lodge", "runmodule.php?module=iitems_hunterslodge&op=start");
break;
case "confirm":
$newname = httppost("newname");
$sub = httpget("sub");
$newname = comment_sanitize($newname);
$newname = substr($newname, 0, 25);
if ($newname) {
output("Your Mount's name is now:`n%s`0 the %s`nWould you like to set your mount's name now?`n`n", $newname, $playermount['mountname']);
} else {
output("You've chosen to go back to having an unnamed Mount. Are you sure that's what you want?`n`n");
}
addnav("Confirm");
addnav("Set mount name", "runmodule.php?module=hunterslodge_namedmount&op=set&free={$free}&newname=" . rawurlencode($newname));
addnav("Cancel");
addnav("Don't set a custom mount name, just go back to the Lodge", "runmodule.php?module=iitems_hunterslodge&op=start");
break;
case "set":
$newname = rawurldecode(httpget("newname"));
output("You now ride %s`0 the %s!`n`n", $newname, $playermount['mountname']);
set_module_pref("mountname", $newname);
if (!$free) {
$id = has_item("hunterslodge_namedmount");
delete_item($id);
}
addnav("Return");
addnav("Return to the Lodge", "runmodule.php?module=iitems_hunterslodge&op=start");
break;
}
page_footer();
}
<?php
$apply = httpget('apply');
if ($apply == 1) {
$ocn = httppost('clanname');
$ocs = httppost('clanshort');
$clanname = stripslashes($ocn);
$clanname = full_sanitize($clanname);
$clanname = preg_replace("'[^[:alpha:] \\'-]'", "", $clanname);
$clanname = addslashes($clanname);
httppostset('clanname', $clanname);
$clanshort = full_sanitize($ocs);
$clanshort = preg_replace("'[^[:alpha:]]'", "", $clanshort);
httppostset('clanshort', $clanshort);
$sql = "SELECT * FROM " . db_prefix("clans") . " WHERE clanname='{$clanname}'";
$result = db_query($sql);
$e = array(translate_inline("%s`7 looks over your form but informs you that your clan name must consist only of letters, spaces, apostrophes, or dashes. Also, your short name can consist only of letters. She hands you a blank form."), translate_inline("%s`7 looks over your form but informs you that you must have at least 5 and no more than 50 characters in your clan's name (and they must consist only of letters, spaces, apostrophes, or dashes), then hands you a blank form."), translate_inline("%s`7 looks over your form but informs you that you must have at least 2 and no more than 5 characters in your clan's short name (and they must all be letters), then hands you a blank form."), translate_inline("%s`7 looks over your form but informs you that the clan name %s is already taken, and hands you a blank form."), translate_inline("%s`7 looks over your form but informs you that the short name %s is already taken, and hands you a blank form."), translate_inline("%s`7 asks for the %s gold to start the clan, but you seem to be unable to produce the fees."), translate_inline("%s`7 asks for the %s gold and %s gems to start the clan, but you seem to be unable to produce the fees."), translate_inline("%s`7 asks for the %s gems to start the clan, but you seem to be unable to produce the fees."), translate_inline("She takes your application, and stamps it \"`\$DENIED`7\"."));
if ($clanname != $ocn || $clanshort != $ocs) {
output_notl($e[0], $registrar);
clanform();
addnav("Return to the Lobby", "clan.php");
} elseif (strlen($clanname) < 5 || strlen($clanname) > 50) {
output_notl($e[1], $registrar);
clanform();
addnav("Return to the Lobby", "clan.php");
} elseif (strlen($clanshort) < 2 || strlen($clanshort) > 5) {
output_notl($e[2], $registrar);
clanform();
addnav("Return to the Lobby", "clan.php");
} elseif (db_num_rows($result) > 0) {
output_notl($e[3], $registrar, stripslashes($clanname));
请发表评论