2 Commits
v2 ... 1.6

Author SHA1 Message Date
Znote
26c486ef27 Tagging Znote AAC as version 1.6 2021-07-22 17:57:09 +02:00
Znote
ddd54a932e Better guild validations, Fix #457 2021-07-22 17:30:49 +02:00
7 changed files with 41 additions and 21 deletions

View File

@@ -13,8 +13,6 @@ We use github to distribute our versions, stable are tagged as releases, while d
* [Stable](https://github.com/Znote/ZnoteAAC/releases)
* [Development](https://github.com/Znote/ZnoteAAC/archive/master.zip)
**NOTE:** Development version supports TFS 1.3, but you can expect bugs to occur.
### Compatible OT distributions
Znote AAC primarily aims to be compatible with [Forgotten Server](https://github.com/otland/forgottenserver)
Forgotten Server is commonly known as TFS (The Forgotten Server) and Znote AAC supports these versions:

View File

@@ -1,9 +1,9 @@
<?php
// Verify the PHP version, gives tutorial if fail.
if (version_compare(phpversion(), '5.3.3', '<')) die('PHP 5.3.3 or higher is required');
if (version_compare(phpversion(), '5.6', '<')) die('PHP version 5.6 or higher is required.');
if (!isset($filepath)) $filepath = '../';
$version = '1.5_SVN';
$version = '1.6';
session_start();
ob_start();
require_once $filepath.'config.php';

View File

@@ -1,6 +1,6 @@
<?php
$time = time();
if (!isset($version)) $version = '1.5_SVN';
if (!isset($version)) $version = '1.6';
if (!function_exists("elapsedTime")) {
function elapsedTime($l_start = false, $l_time = false) {

View File

@@ -1,6 +1,6 @@
-- Start of Znote AAC database schema
SET @znote_version = '1.5_SVN';
SET @znote_version = '1.6';
CREATE TABLE IF NOT EXISTS `znote` (
`id` int NOT NULL AUTO_INCREMENT,

View File

@@ -457,7 +457,7 @@ function get_guild_rank_data($gid) {
// Creates a guild, where cid is the owner of the guild, and name is the name of guild.
function create_guild($cid, $name) {
$cid = (int)$cid;
$name = sanitize($name);
$name = trim(preg_replace('/\s\s+/', ' ', str_replace("\n", " ", sanitize($name))));
$time = time();
// Create the guild

View File

@@ -15,7 +15,7 @@ function elapsedTime($l_start = false, $l_time = false) {
}
$time = time();
$version = '1.5_SVN';
$version = '1.6';
$aacQueries = 0;
$accQueriesData = array();

View File

@@ -351,13 +351,25 @@ if (user_logged_in() === true) {
// Uninvite and joinguild is also used for visitors who reject their invitation.
if (!empty($_POST['uninvite'])) {
//
// Is this action being triggered by a vice leader+, or the invited player?
$u_player = (int)$_POST['uninvite'];
$u_player = user_character_name($u_player);
$u_player = (int)user_character_account_id($u_player);
if (in_array($highest_access, array(2,3)) || $u_player === $session_user_id) {
guild_remove_invitation($_POST['uninvite'], $gid);
header('Location: guilds.php?name='. $_GET['name']);
exit();
}
}
if (!empty($_POST['joinguild'])) {
$joining_player_id = (int)$_POST['joinguild'];
$join_account = (int)user_character_account_id(user_character_name($joining_player_id));
if ($join_account !== $session_user_id) {
echo '<font color="red" size="4">Join guild request sent from wrong account.</font>';
include 'layout/overall/footer.php';
exit();
}
// Join a guild
if ($inv_data !== false) foreach ($inv_data as $inv) {
if ((int)$inv['player_id'] == $joining_player_id) {
@@ -383,6 +395,14 @@ if (user_logged_in() === true) {
if (!empty($_POST['leave_guild'])) {
$name = sanitize($_POST['leave_guild']);
$cidd = user_character_id($name);
$leave_account = (int)user_character_account_id($name);
if ($leave_account !== $session_user_id) {
echo '<font color="red" size="4">Leave guild request sent from wrong account.</font>';
include 'layout/overall/footer.php';
exit();
}
// If character is offline
if ($config['ServerEngine'] !== 'TFS_10') $chardata = user_character_data($cidd, 'online');
else $chardata['online'] = (user_is_online_10($cidd)) ? 1 : 0;
@@ -482,9 +502,8 @@ if ($highest_access >= 2) {
}
if (!empty($_POST['disband'])) {
//
$gidd = (int)$_POST['disband'];
$members = get_guild_players($gidd);
// $gidd = (int)$_POST['disband'];
$members = get_guild_players($gid);
$online = false;
// First figure out if anyone are online.
@@ -534,8 +553,8 @@ if ($highest_access >= 2) {
}
if (!empty($_POST['change_ranks'])) {
$c_gid = (int)$_POST['change_ranks'];
$c_ranks = get_guild_rank_data($c_gid);
//$c_gid = (int)$_POST['change_ranks'];
$c_ranks = get_guild_rank_data($gid);
$rank_data = array();
$rank_ids = array();
@@ -560,11 +579,14 @@ if ($highest_access >= 2) {
$name = sanitize($_POST['remove_member']);
$cid = user_character_id($name);
$p_guild = get_player_guild_data($cid);
if ($p_guild['guild_id'] == $gid) {
if ($config['ServerEngine'] !== 'TFS_10') guild_remove_member($cid);
else guild_remove_member_10($cid);
header('Location: guilds.php?name='. $_GET['name']);
exit();
}
}
if (!empty($_POST['forumGuildId'])) {
if ($config['forum']['guildboard'] === true) {