mirror of
https://github.com/Znote/ZnoteAAC.git
synced 2025-04-29 18:59:21 +02:00
Minor fixes
This commit is contained in:
parent
5b22fe4b18
commit
b51c168555
@ -58,7 +58,7 @@ if (isset($_GET['name']) === true && empty($_GET['name']) === false) {
|
|||||||
if ($config['Ach'] == true) {
|
if ($config['Ach'] == true) {
|
||||||
foreach ($achievementPoints as $achievement) {
|
foreach ($achievementPoints as $achievement) {
|
||||||
if ($achievement > 0) //if player doesn't have any achievement points it won't echo the line below.
|
if ($achievement > 0) //if player doesn't have any achievement points it won't echo the line below.
|
||||||
echo '<tr><td>Achievement Points</td><td>' .$achievement. ' </td></tr>';
|
echo '<li>Achievement Points: ' .$achievement. '</li>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
@ -109,41 +109,42 @@ if (isset($_GET['name']) === true && empty($_GET['name']) === false) {
|
|||||||
</li>
|
</li>
|
||||||
<li><font class="profile_font" name="profile_font_created">Created: <?php echo getClock($profile_znote_data['created'], true); ?></font></li>
|
<li><font class="profile_font" name="profile_font_created">Created: <?php echo getClock($profile_znote_data['created'], true); ?></font></li>
|
||||||
<li><font class="profile_font" name="profile_font_comment">Comment:</font> <br><textarea name="profile_comment_textarea" cols="70" rows="10" readonly="readonly" class="span12"><?php echo $profile_znote_data['comment']; ?></textarea></li>
|
<li><font class="profile_font" name="profile_font_comment">Comment:</font> <br><textarea name="profile_comment_textarea" cols="70" rows="10" readonly="readonly" class="span12"><?php echo $profile_znote_data['comment']; ?></textarea></li>
|
||||||
<!-- Achievements start -->
|
<!-- Achievements start -->
|
||||||
<?php if ($config['Ach'] == true) { ?>
|
<?php if ($config['Ach']) { ?>
|
||||||
<h3 class="header-ok">Achievements</h3>
|
<h3 class="header-ok">Achievements</h3>
|
||||||
<div id="accordion">
|
<div id="accordion">
|
||||||
<h3>Show/hide player achievements</h3>
|
<h3>Show/hide player achievements</h3>
|
||||||
<div>
|
<div>
|
||||||
<table class="table table-striped table-bordered">
|
<table class="table table-striped table-bordered">
|
||||||
<tbody>
|
<tbody>
|
||||||
<style>
|
<style>
|
||||||
#secondD {
|
#secondD {
|
||||||
margin-left:0px;
|
margin-left:0px;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
<?php
|
<?php
|
||||||
foreach ($config['achievements'] as $key => $achiv) {
|
foreach ($config['achievements'] as $key => $achiv) {
|
||||||
$uery = mysql_select_single("SELECT `player_id`, `value`, `key` FROM `player_storage` WHERE `player_id`='$user_id' AND `key`='$key' LIMIT 1;");
|
$uery = mysql_select_single("SELECT `player_id`, `value`, `key` FROM `player_storage` WHERE `player_id`='$user_id' AND `key`='$key' LIMIT 1;");
|
||||||
foreach ($uery as $luery)
|
if (!empty($uery) || $uery !== false) {
|
||||||
if (($luery) == $key)
|
foreach ($uery as $luery) {
|
||||||
{
|
if ($luery == $key) {
|
||||||
if (!array_key_exists(($achiv), $config['achievements'])) {
|
if (!array_key_exists($key, $achiv)) {
|
||||||
echo '<tr><td width="17%">' .$achiv[0]. '</td><td>' .$achiv[1]. '</td>';
|
echo '<tr><td width="17%">' .$achiv[0]. '</td><td>' .$achiv[1]. '</td>';
|
||||||
if ($achiv['secret'] == true) {
|
if (!isset($achiv['secret'])) {
|
||||||
echo '<td><img id="secondD" src="http://img04.imgland.net/PuMz0mVqSG.gif"></td>';
|
echo '<td><img id="secondD" src="http://img04.imgland.net/PuMz0mVqSG.gif"></td>';
|
||||||
echo '<td>'. $achiv['points'] .'</td>';
|
}
|
||||||
} else {
|
echo '<td>'. $achiv['points'] .'</td>';
|
||||||
echo '<td></td><td>'. $achiv['points'] .'</td>';
|
echo '<tr>';
|
||||||
}
|
}
|
||||||
echo '<tr>';
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</div></div>
|
</div>
|
||||||
|
</div>
|
||||||
<br>
|
<br>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
<!-- Achievements end -->
|
<!-- Achievements end -->
|
||||||
|
@ -28,7 +28,7 @@ if (empty($_POST) === false) {
|
|||||||
$errors[] = 'Your name may only contain a-z, A-Z and spaces.';
|
$errors[] = 'Your name may only contain a-z, A-Z and spaces.';
|
||||||
}
|
}
|
||||||
if (strlen($_POST['name']) < $config['minL'] || strlen($_POST['name']) > $config['maxL']) {
|
if (strlen($_POST['name']) < $config['minL'] || strlen($_POST['name']) > $config['maxL']) {
|
||||||
$errors[] = 'Your character name must be between 4 - 20 characters long.';
|
$errors[] = 'Your character name must be between ' . $config['minL'] . ' - ' . $config['maxL'] . ' characters long.';
|
||||||
}
|
}
|
||||||
// name restriction
|
// name restriction
|
||||||
$resname = explode(" ", $_POST['name']);
|
$resname = explode(" ", $_POST['name']);
|
||||||
|
116
myaccount.php
116
myaccount.php
@ -37,6 +37,7 @@ if (!empty($_POST['selected_character'])) {
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
// end
|
// end
|
||||||
|
|
||||||
// Hide character
|
// Hide character
|
||||||
case 'toggle_hide':
|
case 'toggle_hide':
|
||||||
$hide = (user_character_hide($char_name) == 1 ? 0 : 1);
|
$hide = (user_character_hide($char_name) == 1 ? 0 : 1);
|
||||||
@ -45,6 +46,7 @@ if (!empty($_POST['selected_character'])) {
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
// end
|
// end
|
||||||
|
|
||||||
// DELETE character
|
// DELETE character
|
||||||
case 'delete_character':
|
case 'delete_character':
|
||||||
if (user_character_account_id($char_name) === $session_user_id) {
|
if (user_character_account_id($char_name) === $session_user_id) {
|
||||||
@ -66,62 +68,76 @@ if (!empty($_POST['selected_character'])) {
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
// end
|
// end
|
||||||
|
|
||||||
// CHANGE character name
|
// CHANGE character name
|
||||||
case 'change_name':
|
case 'change_name':
|
||||||
$oldname = $char_name;
|
$oldname = $char_name;
|
||||||
$newname = getValue($_POST['newName']);
|
$newname = isset($_POST['newName']) ? getValue($_POST['newName']) : '';
|
||||||
|
|
||||||
// Check if user is online
|
|
||||||
$player = false;
|
$player = false;
|
||||||
if ($config['TFSVersion'] === 'TFS_10') {
|
if ($config['TFSVersion'] === 'TFS_10') {
|
||||||
$player = mysql_select_single("SELECT `id`, `account_id` FROM `players` WHERE `name` = '$oldname'");
|
$player = mysql_select_single("SELECT `id`, `account_id` FROM `players` WHERE `name` = '$oldname'");
|
||||||
$player['online'] = (user_is_online_10($player['id'])) ? 1 : 0;
|
$player['online'] = (user_is_online_10($player['id'])) ? 1 : 0;
|
||||||
} else $player = mysql_select_single("SELECT `id`, `account_id`, `online` FROM `players` WHERE `name` = '$oldname'");
|
} else $player = mysql_select_single("SELECT `id`, `account_id`, `online` FROM `players` WHERE `name` = '$oldname'");
|
||||||
|
|
||||||
|
// Check if user is online
|
||||||
|
if ($player['online'] == 1) {
|
||||||
|
$errors[] = 'Character must be offline first.';
|
||||||
|
}
|
||||||
|
|
||||||
// Check if player has bough ticket
|
// Check if player has bough ticket
|
||||||
$order = mysql_select_single("SELECT `id`, `account_id` FROM `znote_shop_orders` WHERE `type`='4' LIMIT 1;");
|
$accountId = $player['account_id'];
|
||||||
if ($order !== false) {
|
$order = mysql_select_single("SELECT `id`, `account_id` FROM `znote_shop_orders` WHERE `type`='4' AND `account_id` = '$accountId' LIMIT 1;");
|
||||||
// Check if player and account matches
|
if ($order === false) {
|
||||||
if ($session_user_id == $player['account_id'] && $session_user_id == $order['account_id']) {
|
$errors[] = 'Did not find any name change tickets, buy them in our <a href="shop.php">shop!</a>';
|
||||||
// Check if new name is not occupied
|
}
|
||||||
$exist = mysql_select_single("SELECT `id` FROM `players` WHERE `name`='$newname';");
|
|
||||||
if (!$exist) {
|
// Check if player and account matches
|
||||||
// Check if new name follow rules
|
if ($session_user_id != $accountId || $session_user_id != $order['account_id']) {
|
||||||
$newname = validate_name($newname);
|
$errors[] = 'Failed to sync your account. :|';
|
||||||
if ($newname !== false) {
|
}
|
||||||
$error = false;
|
|
||||||
// name restriction
|
$newname = validate_name($newname);
|
||||||
$resname = explode(" ", $_POST['name']);
|
if ($newname === false) {
|
||||||
foreach($resname as $res) {
|
$errors[] = 'Your name can not contain more than 2 words.';
|
||||||
if(in_array(strtolower($res), $config['invalidNameTags'])) {
|
} else {
|
||||||
$error = true;
|
if (empty($newname)) {
|
||||||
}
|
$errors[] = 'Please enter a name!';
|
||||||
else if(strlen($res) == 1) {
|
} else if (user_character_exist($newname) !== false) {
|
||||||
$error = true;
|
$errors[] = 'Sorry, that character name already exist.';
|
||||||
}
|
} else if (!preg_match("/^[a-zA-Z_ ]+$/", $newname)) {
|
||||||
}
|
$errors[] = 'Your name may only contain a-z, A-Z and spaces.';
|
||||||
// Check name for illegal characters.
|
} else if (strlen($newname) < $config['minL'] || strlen($newname) > $config['maxL']) {
|
||||||
function checkNewNameForIllegal($name) {
|
$errors[] = 'Your character name must be between ' . $config['minL'] . ' - ' . $config['maxL'] . ' characters long.';
|
||||||
if (preg_match('#^[\0-9åäö&()+%/*$€é,.\'"-]*$#i', $name)) {
|
} else if (!ctype_upper($newname{0})) {
|
||||||
return true;
|
$errors[] = 'The first letter of a name has to be a capital letter!';
|
||||||
}
|
}
|
||||||
return false;
|
|
||||||
}
|
// name restriction
|
||||||
if (checkNewNameForIllegal($newname)) {
|
$resname = explode(" ", $_POST['newName']);
|
||||||
$error = true;
|
foreach($resname as $res) {
|
||||||
echo 'This name contains illegal characters.';
|
if(in_array(strtolower($res), $config['invalidNameTags'])) {
|
||||||
}
|
$errors[] = 'Your username contains a restricted word.';
|
||||||
if ($error === false) {
|
} else if(strlen($res) == 1) {
|
||||||
// Change the name!
|
$errors[] = 'Too short words in your name.';
|
||||||
mysql_update("UPDATE `players` SET `name`='$newname' WHERE `id`='".$player['id']."' LIMIT 1;");
|
}
|
||||||
mysql_delete("DELETE FROM `znote_shop_orders` WHERE `id`='".$order['id']."' LIMIT 1;");
|
}
|
||||||
}
|
}
|
||||||
} else echo 'Name validation failed, use another name.';
|
|
||||||
} else echo 'The character name you wish to change to already exist.';
|
if (!empty($newname) && empty($errors)) {
|
||||||
} else echo 'Failed to sync your account. :|';
|
echo 'You have successfully changed your character name to ' . $newname . '.';
|
||||||
} else echo 'Did not find any name change tickets, buy them in our <a href="shop.php">shop!</a>';
|
mysql_update("UPDATE `players` SET `name`='$newname' WHERE `id`='".$player['id']."' LIMIT 1;");
|
||||||
|
mysql_delete("DELETE FROM `znote_shop_orders` WHERE `id`='".$order['id']."' LIMIT 1;");
|
||||||
|
|
||||||
|
} else if (!empty($errors)) {
|
||||||
|
echo '<font color="red"><b>';
|
||||||
|
echo output_errors($errors);
|
||||||
|
echo '</b></font>';
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
// end
|
// end
|
||||||
|
|
||||||
// Change character sex
|
// Change character sex
|
||||||
case 'change_gender':
|
case 'change_gender':
|
||||||
if (user_character_account_id($char_name) === $session_user_id) {
|
if (user_character_account_id($char_name) === $session_user_id) {
|
||||||
@ -129,9 +145,8 @@ if (!empty($_POST['selected_character'])) {
|
|||||||
$account_id = user_character_account_id($char_name);
|
$account_id = user_character_account_id($char_name);
|
||||||
|
|
||||||
if ($config['TFSVersion'] == 'TFS_10') {
|
if ($config['TFSVersion'] == 'TFS_10') {
|
||||||
$chr_data = user_is_online_10($char_id);
|
$chr_data['online'] = user_is_online_10($char_id) ? 1 : 0;
|
||||||
} else $chr_data = user_character_data($char_id, 'online');
|
} else $chr_data = user_character_data($char_id, 'online');
|
||||||
|
|
||||||
if ($chr_data['online'] != 1) {
|
if ($chr_data['online'] != 1) {
|
||||||
// Verify that we are not messing around with data
|
// Verify that we are not messing around with data
|
||||||
if ($account_id != $user_data['id']) die("wtf? Something went wrong, try relogging.");
|
if ($account_id != $user_data['id']) die("wtf? Something went wrong, try relogging.");
|
||||||
@ -171,6 +186,7 @@ if (!empty($_POST['selected_character'])) {
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
// end
|
// end
|
||||||
|
|
||||||
// Change character comment PAGE1:
|
// Change character comment PAGE1:
|
||||||
case 'change_comment':
|
case 'change_comment':
|
||||||
$render_page = false; // Regular "myaccount" page should not render
|
$render_page = false; // Regular "myaccount" page should not render
|
||||||
@ -247,9 +263,9 @@ if ($render_page) {
|
|||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
</table>
|
</table>
|
||||||
<table class="table">
|
<!-- FORMS TO EDIT CHARACTER-->
|
||||||
<!-- FORMS TO EDIT CHARACTER-->
|
<form action="" method="post">
|
||||||
<form action="" method="post">
|
<table class="table">
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<select id="selected_character" name="selected_character" class="form-control">
|
<select id="selected_character" name="selected_character" class="form-control">
|
||||||
@ -282,8 +298,8 @@ if ($render_page) {
|
|||||||
<input id="submit_button" type="submit" value="Submit" class="btn btn-primary btn-block"></input>
|
<input id="submit_button" type="submit" value="Submit" class="btn btn-primary btn-block"></input>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</form>
|
</table>
|
||||||
</table>
|
</form>
|
||||||
<?php
|
<?php
|
||||||
} else {
|
} else {
|
||||||
echo 'You don\'t have any characters. Why don\'t you <a href="createcharacter.php">create one</a>?';
|
echo 'You don\'t have any characters. Why don\'t you <a href="createcharacter.php">create one</a>?';
|
||||||
|
Loading…
x
Reference in New Issue
Block a user