mirror of
https://github.com/Znote/ZnoteAAC.git
synced 2025-04-29 18:59:21 +02:00
When uploading guild images, it will give you an error message if it fails.
Guild motd will display on guild page, and the leader can also update it. Fixed two bugs with name change in shop. (sync error and name validation) Fixed some warnings. My account now shows how many days you have of premium account.
This commit is contained in:
parent
459e5118f5
commit
a6babfe0e3
13
config.php
13
config.php
@ -4,9 +4,9 @@
|
||||
// TFS 0.3 = TFS_03 (If ur using 0.3.6, set $config['salt'] to false)!
|
||||
// TFS 0.4 = TFS_03
|
||||
// TFS 1.0 = TFS_10 (Under developement)
|
||||
$config['TFSVersion'] = 'TFS_03';
|
||||
$config['TFSVersion'] = 'TFS_10';
|
||||
// As far as I know, OTX is based on TFS_03, so make sure TFS version is configured TFS_03
|
||||
$config['CustomVersion'] = 'OTX'; // Not using OTX? Replace 'OTX' with: false
|
||||
$config['CustomVersion'] = false;
|
||||
|
||||
$config['site_title'] = 'Znote AAC';
|
||||
$config['site_title_context'] = 'Because open communities are good communities. :3';
|
||||
@ -20,13 +20,13 @@
|
||||
// ------------------------ \\
|
||||
|
||||
// phpmyadmin username for OT server: (DONT USE "root" if ur hosting to public.).
|
||||
$config['sqlUser'] = 'otx03';
|
||||
$config['sqlUser'] = 'tfs10';
|
||||
|
||||
// phpmyadmin password for OT server:
|
||||
$config['sqlPassword'] = 'otx03';
|
||||
$config['sqlPassword'] = 'tfs10';
|
||||
|
||||
// The database name to connect to. (This is usually same as username).
|
||||
$config['sqlDatabase'] = 'otx03';
|
||||
$config['sqlDatabase'] = 'tfs10';
|
||||
|
||||
// Hostname is usually localhost or 127.0.0.1.
|
||||
$config['sqlHost'] = 'localhost';
|
||||
@ -335,7 +335,7 @@
|
||||
$config['page_admin_access'] = array(
|
||||
//'otland0',
|
||||
//'otland1',
|
||||
//'znote'
|
||||
'znote'
|
||||
);
|
||||
|
||||
// Built-in FORUM
|
||||
@ -380,6 +380,7 @@
|
||||
$config['zeotss'] = array(
|
||||
'enabled' => false,
|
||||
'visitors' => true,
|
||||
'debug' => false,
|
||||
'server' => "http://zeotss.znote.eu/"
|
||||
);
|
||||
// Don't touch this unless you know what you are doing. (modifying this(key value) also requires modifications in OT files /XML/commands.xml).
|
||||
|
@ -460,7 +460,7 @@ function check_image($image) {
|
||||
if ($path_info['extension'] === 'gif') {
|
||||
|
||||
// Resize image
|
||||
$img = resize_imagex($image_data, 150, 150);
|
||||
$img = resize_imagex($image_data, 100, 100);
|
||||
|
||||
if ($img) {
|
||||
|
||||
@ -470,25 +470,25 @@ function check_image($image) {
|
||||
|
||||
} else {
|
||||
|
||||
header('Location: guilds.php?name='. $_GET['name']);
|
||||
header('Location: guilds.php?error=Only gif images accepted, you uploaded:['.$path_info['extension'].'].&name='. $_GET['name']);
|
||||
exit();
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
header('Location: guilds.php?name='. $_GET['name']);
|
||||
header('Location: guilds.php?error=Only gif images accepted, you uploaded:['.$check['mime'].'].&name='. $_GET['name']);
|
||||
exit();
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
header('Location: guilds.php?name='. $_GET['name']);
|
||||
header('Location: guilds.php?error=Uploaded image is invalid.&name='. $_GET['name']);
|
||||
exit();
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
header('Location: guilds.php?name='. $_GET['name']);
|
||||
header('Location: guilds.php?error=Only gif images are accepted, you uploaded:['.$image_data['type'].'].&name='. $_GET['name']);
|
||||
exit();
|
||||
}
|
||||
}
|
||||
|
@ -490,6 +490,12 @@ function get_guild_id($name) {
|
||||
return ($data !== false) ? $data['id'] : false;
|
||||
}
|
||||
|
||||
// Returns guild data from name
|
||||
function get_guild_data($name) {
|
||||
$name = sanitize($name);
|
||||
return mysql_select_single("SELECT `id`, `name`, `ownerid`, `creationdata`, `motd` FROM `guilds` WHERE `name`='$name' LIMIT 1;");
|
||||
}
|
||||
|
||||
// Get complete list of guilds
|
||||
function get_guilds_list() {
|
||||
return mysql_select_multi("SELECT `id`, `name`, `creationdata` FROM `guilds` ORDER BY `name`;");
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 2.8 KiB |
@ -33,7 +33,7 @@ Token::generate();
|
||||
|
||||
if (user_logged_in() === true) {
|
||||
$session_user_id = $_SESSION['user_id'];
|
||||
$user_data = user_data($session_user_id, 'id', 'name', 'password', 'email');
|
||||
$user_data = user_data($session_user_id, 'id', 'name', 'password', 'email', 'premdays');
|
||||
$user_znote_data = user_znote_account_data($session_user_id, 'ip', 'created', 'points', 'cooldown');
|
||||
}
|
||||
|
||||
|
30
guilds.php
30
guilds.php
@ -25,7 +25,10 @@ if (empty($_GET['name'])) {
|
||||
|
||||
<h1>Guild List:</h1>
|
||||
<?php
|
||||
$guilds = mysql_select_multi("SELECT `id`, `name`, `creationdata`, (SELECT COUNT('guild_id') FROM `guild_membership` WHERE `guild_id`=`id`) AS `total` FROM `guilds` ORDER BY `name`;");
|
||||
//data_dump($guild, false, "guild data");
|
||||
if ($config['TFSVersion'] != 'TFS_10') $guilds = mysql_select_multi("SELECT `t`.`id`, `t`.`name`, `t`.`creationdata`, (SELECT count(p.rank_id) FROM players AS p LEFT JOIN guild_ranks AS gr ON gr.id = p.rank_id WHERE gr.guild_id =`t`.`id`) AS `total` FROM `guilds` as `t` ORDER BY `t`.`name`;");
|
||||
else $guilds = mysql_select_multi("SELECT `id`, `name`, `creationdata`, (SELECT COUNT('guild_id') FROM `guild_membership` WHERE `guild_id`=`id`) AS `total` FROM `guilds` ORDER BY `name`;");
|
||||
|
||||
if ($guilds !== false) {
|
||||
?>
|
||||
<table id="guildsTable" class="table table-striped table-hover">
|
||||
@ -124,7 +127,8 @@ if (user_logged_in() === true) {
|
||||
|
||||
<?php
|
||||
} else { // GUILD OVERVIEW
|
||||
$gid = get_guild_id($_GET['name']);
|
||||
$guild = get_guild_data($_GET['name']);
|
||||
$gid = $guild['id'];
|
||||
if ($gid === false) {
|
||||
header('Location: guilds.php');
|
||||
exit();
|
||||
@ -169,6 +173,7 @@ if (user_logged_in() === true) {
|
||||
?>
|
||||
|
||||
<div id="guildTitleDiv">
|
||||
<?php echo (isset($_GET['error'])) ? "<font size='5' color='red'>".sanitize($_GET['error'])."</font><br><br>" : ""; ?>
|
||||
<?php if ($config['use_guild_logos']): ?>
|
||||
<div id="guildImageDiv" style="float: left; margin-right: 10px;">
|
||||
<img style="max-width: 100px; max-height: 100px;" src="<?php logo_exists(sanitize($_GET['name'])); ?>"></img>
|
||||
@ -176,7 +181,7 @@ if (user_logged_in() === true) {
|
||||
<?php endif; ?>
|
||||
<div id="guildDescription">
|
||||
<h1>Guild: <?php echo sanitize($_GET['name']); ?></h1>
|
||||
<p>Motive of the Guild</p>
|
||||
<p><?php echo $guild['motd']; ?></p>
|
||||
</div>
|
||||
</div>
|
||||
<table id="guildViewTable" class="table table-striped">
|
||||
@ -382,6 +387,13 @@ if ($highest_access >= 2) {
|
||||
} else echo '<font color="red" size="4">That character is already invited(or a member) on this guild.</font>';
|
||||
} else echo '<font color="red" size="4">That character name does not exist.</font>';
|
||||
}
|
||||
// Guild Message (motd)
|
||||
if (!empty($_POST['motd'])) {
|
||||
$motd = sanitize($_POST['motd']);
|
||||
mysql_update("UPDATE `guilds` SET `motd`='$motd' WHERE `id`='$gid' LIMIT 1;");
|
||||
header('Location: guilds.php?name='. $_GET['name']);
|
||||
exit();
|
||||
}
|
||||
|
||||
if (!empty($_POST['disband'])) {
|
||||
//
|
||||
@ -561,7 +573,7 @@ if ($highest_access >= 2) {
|
||||
<!-- form to upload guild logo -->
|
||||
<form action="" method="post" enctype="multipart/form-data">
|
||||
<ul>
|
||||
<li>Upload guild logo:<br>
|
||||
<li>Upload guild logo [.gif images only, 100x100px size]:<br>
|
||||
<input type="file" name="file" id="file" accept="image/gif">
|
||||
<input type="submit" name="submit" value="Upload guild logo">
|
||||
</li>
|
||||
@ -587,6 +599,16 @@ if ($highest_access >= 2) {
|
||||
</li>
|
||||
</ul>
|
||||
</form>
|
||||
<!-- Guild message of the day motd -->
|
||||
<form action="" method="post">
|
||||
<ul>
|
||||
<li>Change guild message:</li>
|
||||
<li>
|
||||
<textarea name="motd" placeholder="Guild Message" cols="50" rows="3"><?php echo $guild['motd']; ?></textarea><br>
|
||||
<input type="submit" value="Update guild message">
|
||||
</li>
|
||||
</ul>
|
||||
</form>
|
||||
<?php if ($members > 1) { ?>
|
||||
<!-- FORMS TO PROMOTE CHARACTER-->
|
||||
<form action="" method="post">
|
||||
|
@ -76,8 +76,9 @@ if (!empty($_POST['change_name'])) {
|
||||
} else $player = mysql_select_single("SELECT `id`, `account_id`, `online` FROM `players` WHERE `name` = '$oldname'");
|
||||
|
||||
// Check if player has bough ticket
|
||||
$order = mysql_select_single("SELECT `id`, `account_id` FROM `znote_shop_orders` WHERE `type`='4' LIMIT 1;");
|
||||
$order = mysql_select_single("SELECT `id`, `account_id` FROM `znote_shop_orders` WHERE `type`='4' AND `account_id`='".$player['account_id']."' LIMIT 1;");
|
||||
if ($order !== false) {
|
||||
//data_dump($order, array($player['account_id'], $session_user_id), "data");
|
||||
// Check if player and account matches
|
||||
if ($session_user_id == $player['account_id'] && $session_user_id == $order['account_id']) {
|
||||
// Check if new name is not occupied
|
||||
@ -88,7 +89,7 @@ if (!empty($_POST['change_name'])) {
|
||||
if ($newname !== false) {
|
||||
$error = false;
|
||||
// name restriction
|
||||
$resname = explode(" ", $_POST['name']);
|
||||
$resname = explode(" ", $newname);
|
||||
foreach($resname as $res) {
|
||||
if(in_array(strtolower($res), $config['invalidNameTags'])) {
|
||||
$error = true;
|
||||
@ -217,10 +218,11 @@ if (!empty($_POST['selected_comment'])) {
|
||||
?>
|
||||
<div id="myaccount">
|
||||
<h1>My account</h1>
|
||||
<p>Welcome to your account page, <?php echo $user_data['name']; ?></p>
|
||||
|
||||
<p>Welcome to your account page, <?php echo $user_data['name']; ?><br>
|
||||
You have <?php echo $user_data['premdays']; ?> days remaining premium account.</p>
|
||||
<h2>Character List: <?php echo $char_count; ?> characters.</h2>
|
||||
<?php
|
||||
//data_dump($user_data, false, "data");
|
||||
// Echo character list!
|
||||
$char_array = user_character_list($user_data['id']);
|
||||
// Design and present the list
|
||||
@ -382,7 +384,7 @@ if ($config['zeotss']['enabled'] && $config['zeotss']['visitors']) {
|
||||
$post_string = "longip=".ip2long($_SERVER['REMOTE_ADDR'])."®ister=1";
|
||||
curl_setopt($curl_connection, CURLOPT_POSTFIELDS, $post_string);
|
||||
$result = curl_exec($curl_connection);
|
||||
data_dump(false, array($result), "CURL DATA");
|
||||
if ($config['zeotss']['debug']) data_dump(false, array($result), "CURL DATA");
|
||||
curl_close($curl_connection);
|
||||
|
||||
// Check if site is registered on ZEOTSS and can use its utilities:
|
||||
|
Loading…
x
Reference in New Issue
Block a user