mirror of
https://github.com/Znote/ZnoteAAC.git
synced 2025-06-03 19:34:31 +02:00
Compare commits
25 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
dbc1e14ea7 | ||
![]() |
70a39d4cc7 | ||
![]() |
001b12e762 | ||
![]() |
9947d441b4 | ||
![]() |
a67b03ba38 | ||
![]() |
cdaac6e974 | ||
![]() |
78d35bb441 | ||
![]() |
a531a18fad | ||
![]() |
6d402cef28 | ||
![]() |
4fb06fb4e5 | ||
![]() |
74890c1ea6 | ||
![]() |
88a13e6d10 | ||
![]() |
47bbee9acf | ||
![]() |
0f4c67d37f | ||
![]() |
52956f8dab | ||
![]() |
f64d190e54 | ||
![]() |
d5a11cbc76 | ||
![]() |
7a9047da80 | ||
![]() |
6be17886b3 | ||
![]() |
3622ad173b | ||
![]() |
bb814f6eae | ||
![]() |
ec55497c5a | ||
![]() |
563fa3a62b | ||
![]() |
541b95f926 | ||
![]() |
32e5b6278e |
@ -25,23 +25,23 @@ end
|
|||||||
|
|
||||||
-- SQL Query to execute: --
|
-- SQL Query to execute: --
|
||||||
--[[
|
--[[
|
||||||
ALTER TABLE `znote_players` ADD `exphist_lastexp` BIGINT UNSIGNED NOT NULL DEFAULT '0',
|
ALTER TABLE `znote_players` ADD `exphist_lastexp` BIGINT NOT NULL DEFAULT '0',
|
||||||
ADD `exphist1` BIGINT UNSIGNED NOT NULL DEFAULT '0',
|
ADD `exphist1` BIGINT NOT NULL DEFAULT '0',
|
||||||
ADD `exphist2` BIGINT UNSIGNED NOT NULL DEFAULT '0',
|
ADD `exphist2` BIGINT NOT NULL DEFAULT '0',
|
||||||
ADD `exphist3` BIGINT UNSIGNED NOT NULL DEFAULT '0',
|
ADD `exphist3` BIGINT NOT NULL DEFAULT '0',
|
||||||
ADD `exphist4` BIGINT UNSIGNED NOT NULL DEFAULT '0',
|
ADD `exphist4` BIGINT NOT NULL DEFAULT '0',
|
||||||
ADD `exphist5` BIGINT UNSIGNED NOT NULL DEFAULT '0',
|
ADD `exphist5` BIGINT NOT NULL DEFAULT '0',
|
||||||
ADD `exphist6` BIGINT UNSIGNED NOT NULL DEFAULT '0',
|
ADD `exphist6` BIGINT NOT NULL DEFAULT '0',
|
||||||
ADD `exphist7` BIGINT UNSIGNED NOT NULL DEFAULT '0',
|
ADD `exphist7` BIGINT NOT NULL DEFAULT '0',
|
||||||
ADD `onlinetimetoday` BIGINT NOT NULL DEFAULT '0',
|
ADD `onlinetimetoday` MEDIUMINT UNSIGNED NOT NULL DEFAULT '0',
|
||||||
ADD `onlinetime1` BIGINT NOT NULL DEFAULT '0',
|
ADD `onlinetime1` MEDIUMINT UNSIGNED NOT NULL DEFAULT '0',
|
||||||
ADD `onlinetime2` BIGINT NOT NULL DEFAULT '0',
|
ADD `onlinetime2` MEDIUMINT UNSIGNED NOT NULL DEFAULT '0',
|
||||||
ADD `onlinetime3` BIGINT NOT NULL DEFAULT '0',
|
ADD `onlinetime3` MEDIUMINT UNSIGNED NOT NULL DEFAULT '0',
|
||||||
ADD `onlinetime4` BIGINT NOT NULL DEFAULT '0',
|
ADD `onlinetime4` MEDIUMINT UNSIGNED NOT NULL DEFAULT '0',
|
||||||
ADD `onlinetime5` BIGINT NOT NULL DEFAULT '0',
|
ADD `onlinetime5` MEDIUMINT UNSIGNED NOT NULL DEFAULT '0',
|
||||||
ADD `onlinetime6` BIGINT NOT NULL DEFAULT '0',
|
ADD `onlinetime6` MEDIUMINT UNSIGNED NOT NULL DEFAULT '0',
|
||||||
ADD `onlinetime7` BIGINT NOT NULL DEFAULT '0',
|
ADD `onlinetime7` MEDIUMINT UNSIGNED NOT NULL DEFAULT '0',
|
||||||
ADD `onlinetimeall` BIGINT NOT NULL DEFAULT '0';
|
ADD `onlinetimeall` INT UNSIGNED NOT NULL DEFAULT '0';
|
||||||
]]--
|
]]--
|
||||||
|
|
||||||
-- after that execute: --
|
-- after that execute: --
|
||||||
|
@ -25,23 +25,23 @@ end
|
|||||||
|
|
||||||
-- SQL Query to execute: --
|
-- SQL Query to execute: --
|
||||||
--[[
|
--[[
|
||||||
ALTER TABLE `znote_players` ADD `exphist_lastexp` BIGINT UNSIGNED NOT NULL DEFAULT '0',
|
ALTER TABLE `znote_players` ADD `exphist_lastexp` BIGINT NOT NULL DEFAULT '0',
|
||||||
ADD `exphist1` BIGINT UNSIGNED NOT NULL DEFAULT '0',
|
ADD `exphist1` BIGINT NOT NULL DEFAULT '0',
|
||||||
ADD `exphist2` BIGINT UNSIGNED NOT NULL DEFAULT '0',
|
ADD `exphist2` BIGINT NOT NULL DEFAULT '0',
|
||||||
ADD `exphist3` BIGINT UNSIGNED NOT NULL DEFAULT '0',
|
ADD `exphist3` BIGINT NOT NULL DEFAULT '0',
|
||||||
ADD `exphist4` BIGINT UNSIGNED NOT NULL DEFAULT '0',
|
ADD `exphist4` BIGINT NOT NULL DEFAULT '0',
|
||||||
ADD `exphist5` BIGINT UNSIGNED NOT NULL DEFAULT '0',
|
ADD `exphist5` BIGINT NOT NULL DEFAULT '0',
|
||||||
ADD `exphist6` BIGINT UNSIGNED NOT NULL DEFAULT '0',
|
ADD `exphist6` BIGINT NOT NULL DEFAULT '0',
|
||||||
ADD `exphist7` BIGINT UNSIGNED NOT NULL DEFAULT '0',
|
ADD `exphist7` BIGINT NOT NULL DEFAULT '0',
|
||||||
ADD `onlinetimetoday` BIGINT NOT NULL DEFAULT '0',
|
ADD `onlinetimetoday` MEDIUMINT UNSIGNED NOT NULL DEFAULT '0',
|
||||||
ADD `onlinetime1` BIGINT NOT NULL DEFAULT '0',
|
ADD `onlinetime1` MEDIUMINT UNSIGNED NOT NULL DEFAULT '0',
|
||||||
ADD `onlinetime2` BIGINT NOT NULL DEFAULT '0',
|
ADD `onlinetime2` MEDIUMINT UNSIGNED NOT NULL DEFAULT '0',
|
||||||
ADD `onlinetime3` BIGINT NOT NULL DEFAULT '0',
|
ADD `onlinetime3` MEDIUMINT UNSIGNED NOT NULL DEFAULT '0',
|
||||||
ADD `onlinetime4` BIGINT NOT NULL DEFAULT '0',
|
ADD `onlinetime4` MEDIUMINT UNSIGNED NOT NULL DEFAULT '0',
|
||||||
ADD `onlinetime5` BIGINT NOT NULL DEFAULT '0',
|
ADD `onlinetime5` MEDIUMINT UNSIGNED NOT NULL DEFAULT '0',
|
||||||
ADD `onlinetime6` BIGINT NOT NULL DEFAULT '0',
|
ADD `onlinetime6` MEDIUMINT UNSIGNED NOT NULL DEFAULT '0',
|
||||||
ADD `onlinetime7` BIGINT NOT NULL DEFAULT '0',
|
ADD `onlinetime7` MEDIUMINT UNSIGNED NOT NULL DEFAULT '0',
|
||||||
ADD `onlinetimeall` BIGINT NOT NULL DEFAULT '0';
|
ADD `onlinetimeall` INT UNSIGNED NOT NULL DEFAULT '0';
|
||||||
]]--
|
]]--
|
||||||
|
|
||||||
-- after that execute: --
|
-- after that execute: --
|
||||||
|
22
README.md
22
README.md
@ -13,13 +13,6 @@ We use github to distribute our versions, stable are tagged as releases, while d
|
|||||||
* [Stable](https://github.com/Znote/ZnoteAAC/releases)
|
* [Stable](https://github.com/Znote/ZnoteAAC/releases)
|
||||||
* [Development](https://github.com/Znote/ZnoteAAC/archive/master.zip)
|
* [Development](https://github.com/Znote/ZnoteAAC/archive/master.zip)
|
||||||
|
|
||||||
### 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:
|
|
||||||
* TFS 0.2.13+ (Since initial release)
|
|
||||||
* TFS 0.3.6+ (Since Znote AAC 1.2)
|
|
||||||
* TFS 1.2+ (Since Znote AAC 1.5)
|
|
||||||
|
|
||||||
### Requirements
|
### Requirements
|
||||||
* PHP Version 5.6 or higher. Mostly tested on 5.6 and 7.4. Most web stacks ships with this as default these days.
|
* PHP Version 5.6 or higher. Mostly tested on 5.6 and 7.4. Most web stacks ships with this as default these days.
|
||||||
|
|
||||||
@ -27,6 +20,7 @@ Forgotten Server is commonly known as TFS (The Forgotten Server) and Znote AAC s
|
|||||||
* For email registration verification and account recovery: [PHPMailer](https://github.com/PHPMailer/PHPMailer/releases) Version 6.x, extracted and renamed to just "PHPMailer" in Znote AAC directory.
|
* For email registration verification and account recovery: [PHPMailer](https://github.com/PHPMailer/PHPMailer/releases) Version 6.x, extracted and renamed to just "PHPMailer" in Znote AAC directory.
|
||||||
* PHP extension curl for PHPMailer, paypal and google reCaptcha services.
|
* PHP extension curl for PHPMailer, paypal and google reCaptcha services.
|
||||||
* PHP extension openssl for google reCaptcha services.
|
* PHP extension openssl for google reCaptcha services.
|
||||||
|
* PHP extension gd for guild logos.
|
||||||
|
|
||||||
### Installation instructions
|
### Installation instructions
|
||||||
|
|
||||||
@ -54,11 +48,15 @@ This will show you the rest of the instructions as well as the mysql schema.
|
|||||||
Znote AAC is very rich feature wise, here is an attempt at summarizing what we offer.
|
Znote AAC is very rich feature wise, here is an attempt at summarizing what we offer.
|
||||||
|
|
||||||
#### Server distribution compatibility:
|
#### Server distribution compatibility:
|
||||||
- OTHire
|
- [Znote AAC 1.6](https://github.com/Znote/ZnoteAAC/releases/tag/1.6)
|
||||||
- TFS 0.2
|
- OTHire
|
||||||
- TFS 0.3/4
|
- TFS 0.2
|
||||||
- TFS 1.x
|
- TFS 0.3/4
|
||||||
- Distributions based on these (such as OTX).
|
- TFS 1.3
|
||||||
|
- Distributions based on these (such as OTX).
|
||||||
|
- Znote AAC 2.0 [v2 dev branch](https://github.com/Znote/ZnoteAAC/tree/v2)
|
||||||
|
- TFS 1.4
|
||||||
|
- OTservBR-Global
|
||||||
|
|
||||||
#### General
|
#### General
|
||||||
- Server wide latest death list
|
- Server wide latest death list
|
||||||
|
@ -54,6 +54,7 @@ if (user_logged_in()) {
|
|||||||
<h1>Changelog</h1>
|
<h1>Changelog</h1>
|
||||||
<?php
|
<?php
|
||||||
$cache = new Cache('engine/cache/changelog');
|
$cache = new Cache('engine/cache/changelog');
|
||||||
|
$cache->useMemory(false);
|
||||||
if ($updateCache === true) {
|
if ($updateCache === true) {
|
||||||
$changelogs = mysql_select_multi("SELECT `id`, `text`, `time`, `report_id`, `status` FROM `znote_changelog` ORDER BY `id` DESC;");
|
$changelogs = mysql_select_multi("SELECT `id`, `text`, `time`, `report_id`, `status` FROM `znote_changelog` ORDER BY `id` DESC;");
|
||||||
|
|
||||||
|
@ -87,6 +87,13 @@ if (isset($_GET['name']) === true && empty($_GET['name']) === false) {
|
|||||||
<td>Position</td>
|
<td>Position</td>
|
||||||
<td><?php echo group_id_to_name($profile_data['group_id']); ?></td>
|
<td><?php echo group_id_to_name($profile_data['group_id']); ?></td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<?php endif;
|
||||||
|
// pending deletion?
|
||||||
|
$deletion_time = mysql_select_single("SELECT `time` FROM `znote_deleted_characters` WHERE `character_name`='{$name}' AND `done` = '0' LIMIT 1;");
|
||||||
|
if ($deletion_time !== false): ?>
|
||||||
|
<tr>
|
||||||
|
<td colspan="2" style="color: red;">Flagged for deletion by owner after <?php echo $deletion_time['time']; ?>.</td>
|
||||||
|
</tr>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
<!-- Player male / female -->
|
<!-- Player male / female -->
|
||||||
<tr>
|
<tr>
|
||||||
|
14
config.php
14
config.php
@ -537,6 +537,7 @@
|
|||||||
// Minimum allowed letters in character name. Ex: 4 letters: "Kare".
|
// Minimum allowed letters in character name. Ex: 4 letters: "Kare".
|
||||||
$config['minL'] = 3;
|
$config['minL'] = 3;
|
||||||
// Maximum allowed letters in character name. Ex: 20 letters: "Bobkareolesofiesberg"
|
// Maximum allowed letters in character name. Ex: 20 letters: "Bobkareolesofiesberg"
|
||||||
|
// Pre QT clients (lower than version 11) support only 20 letters max, while newer clients support up to 25
|
||||||
$config['maxL'] = 20;
|
$config['maxL'] = 20;
|
||||||
// Maximum allowed words in character name. Ex: 2 words = "Bob Kare", 3 words: "Bob Arne Kare" as maximum char name words.
|
// Maximum allowed words in character name. Ex: 2 words = "Bob Kare", 3 words: "Bob Arne Kare" as maximum char name words.
|
||||||
$config['maxW'] = 3;
|
$config['maxW'] = 3;
|
||||||
@ -657,9 +658,18 @@
|
|||||||
'port' => 7172,
|
'port' => 7172,
|
||||||
'name' => 'Forgotten' // Must be identical to config.lua (OT config file) server name.
|
'name' => 'Forgotten' // Must be identical to config.lua (OT config file) server name.
|
||||||
);
|
);
|
||||||
|
// Unlock all protocol 12 client features? Free premium in config.lua? Then set this to true.
|
||||||
|
$config['freePremium'] = true;
|
||||||
|
|
||||||
// How often do you want highscores to update?
|
// How often do you want highscores (cache) to update?
|
||||||
$config['cache_lifespan'] = 5; // 60 * 15; // 15 minutes.
|
$config['cache'] = array(
|
||||||
|
// If you have two instances installed on same server, make each instance prefix unique
|
||||||
|
'prefix' => 'znote_',
|
||||||
|
// 60 * 15; // 15 minutes.
|
||||||
|
'lifespan' => 5,
|
||||||
|
// Store cache in memory/RAM? Requires PHP extension APCu
|
||||||
|
'memory' => true
|
||||||
|
);
|
||||||
|
|
||||||
// WARNING! Account names written here will have admin access to web page!
|
// WARNING! Account names written here will have admin access to web page!
|
||||||
$config['page_admin_access'] = array(
|
$config['page_admin_access'] = array(
|
||||||
|
@ -67,7 +67,7 @@ if (empty($_POST) === false) {
|
|||||||
}
|
}
|
||||||
// Char count
|
// Char count
|
||||||
$char_count = user_character_list_count($session_user_id);
|
$char_count = user_character_list_count($session_user_id);
|
||||||
if ($char_count >= $config['max_characters']) {
|
if ($char_count >= $config['max_characters'] && !is_admin($user_data)) {
|
||||||
$errors[] = 'Your account is not allowed to have more than '. $config['max_characters'] .' characters.';
|
$errors[] = 'Your account is not allowed to have more than '. $config['max_characters'] .' characters.';
|
||||||
}
|
}
|
||||||
if (validate_ip(getIP()) === false && $config['validate_IP'] === true) {
|
if (validate_ip(getIP()) === false && $config['validate_IP'] === true) {
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -7,9 +7,8 @@ if (!function_exists("elapsedTime")) {
|
|||||||
if ($l_start === false) global $l_start;
|
if ($l_start === false) global $l_start;
|
||||||
if ($l_time === false) global $l_time;
|
if ($l_time === false) global $l_time;
|
||||||
|
|
||||||
$l_time = explode(' ', microtime());
|
$l_time = microtime(true);
|
||||||
$l_finish = $l_time[1] + $l_time[0];
|
return round(($l_time - $l_start), 4);
|
||||||
return round(($l_finish - $l_start), 4);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,11 +1,8 @@
|
|||||||
<footer>
|
<footer>
|
||||||
© Znote AAC.
|
© Znote AAC.
|
||||||
<?php
|
<?php
|
||||||
$time = microtime();
|
$finish = microtime(true);
|
||||||
$time = explode(' ', $time);
|
|
||||||
$time = $time[1] + $time[0];
|
|
||||||
$finish = $time;
|
|
||||||
$total_time = round(($finish - $start), 4);
|
$total_time = round(($finish - $start), 4);
|
||||||
echo 'Server date and clock is: '. getClock(false, true) .' Page generated in '. $total_time .' seconds. ';
|
echo 'Server date and clock is: '. getClock(false, true) .' Page generated in '. $total_time .' seconds. ';
|
||||||
?>
|
?>
|
||||||
</footer>
|
</footer>
|
||||||
|
@ -1,122 +1,167 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
class Cache
|
class Cache
|
||||||
{
|
{
|
||||||
protected $_file = false;
|
protected $_file = false;
|
||||||
protected $_lifespan = 0;
|
protected $_lifespan = 0;
|
||||||
protected $_content;
|
protected $_content;
|
||||||
|
protected $_memory = false;
|
||||||
|
protected $_canMemory = false;
|
||||||
|
|
||||||
const EXT = '.cache.php';
|
const EXT = '.cache.php';
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $file
|
* @param string $file
|
||||||
* @access public
|
* @access public
|
||||||
* @return void
|
* @return void
|
||||||
**/
|
**/
|
||||||
public function __construct($file) {
|
public function __construct($file) {
|
||||||
$this->_file = $file . self::EXT;
|
$cfg = config('cache');
|
||||||
$this->setExpiration(config('cache_lifespan'));
|
|
||||||
|
$this->setExpiration($cfg['lifespan']);
|
||||||
|
if (function_exists('apcu_fetch')) {
|
||||||
|
$this->_canMemory = true;
|
||||||
|
$this->_memory = $cfg['memory'];
|
||||||
}
|
}
|
||||||
|
$this->_file = $file . self::EXT;
|
||||||
|
|
||||||
|
if (!$this->_memory && $cfg['memory']) die("
|
||||||
|
<p><strong>Configuration error!</strong>
|
||||||
|
<br>Cannot save cache to memory, but it is configured to do so.
|
||||||
|
<br>You need to enable PHP extension APCu to enable memory cache.
|
||||||
|
<br>Install it or set \$config['cache']['memory'] to false!
|
||||||
|
<br><strong>Ubuntu install:</strong> sudo apt install php-apcu</p>
|
||||||
|
");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the cache expiration limit (IMPORTANT NOTE: seconds, NOT ms!).
|
* Sets the cache expiration limit (IMPORTANT NOTE: seconds, NOT ms!).
|
||||||
*
|
*
|
||||||
* @param integer $span
|
* @param integer $span
|
||||||
* @access public
|
* @access public
|
||||||
* @return void
|
* @return void
|
||||||
**/
|
**/
|
||||||
public function setExpiration($span) {
|
public function setExpiration($span) {
|
||||||
$this->_lifespan = $span;
|
$this->_lifespan = $span;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the content you'd like to cache.
|
* Enable or disable memory RAM storage.
|
||||||
*
|
*
|
||||||
* @param mixed $content
|
* @param bool $bool
|
||||||
* @access public
|
* @access public
|
||||||
* @return void
|
* @return bool $status
|
||||||
**/
|
**/
|
||||||
public function setContent($content) {
|
public function useMemory($bool) {
|
||||||
switch (strtolower(gettype($content))) {
|
if ($bool and $this->_canMemory) {
|
||||||
case 'array':
|
$this->_memory = true;
|
||||||
$this->_content = json_encode($content);
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
$this->_content = $content;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Validates whether it is time to refresh the cache data or not.
|
|
||||||
*
|
|
||||||
* @access public
|
|
||||||
* @return boolean
|
|
||||||
**/
|
|
||||||
public function hasExpired() {
|
|
||||||
if (is_file($this->_file) && time() < filemtime($this->_file) + $this->_lifespan) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
$this->_memory = false;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns remaining time before scoreboard will update itself.
|
/**
|
||||||
*
|
* Set the content you'd like to cache.
|
||||||
* @access public
|
*
|
||||||
* @return integer
|
* @param mixed $content
|
||||||
**/
|
* @access public
|
||||||
public function remainingTime() {
|
* @return void
|
||||||
$remaining = 0;
|
**/
|
||||||
if (!$this->hasExpired()) {
|
public function setContent($content) {
|
||||||
$remaining = (filemtime($this->_file) + $this->_lifespan) - time();
|
$this->_content = (!$this->_memory && strtolower(gettype($content)) == 'array') ? json_encode($content) : $content;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Validates whether it is time to refresh the cache data or not.
|
||||||
|
*
|
||||||
|
* @access public
|
||||||
|
* @return boolean
|
||||||
|
**/
|
||||||
|
public function hasExpired() {
|
||||||
|
if ($this->_memory) {
|
||||||
|
return !apcu_exists($this->_file);
|
||||||
|
}
|
||||||
|
if (is_file($this->_file) && time() < filemtime($this->_file) + $this->_lifespan) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns remaining time before scoreboard will update itself.
|
||||||
|
*
|
||||||
|
* @access public
|
||||||
|
* @return integer
|
||||||
|
**/
|
||||||
|
public function remainingTime() {
|
||||||
|
$remaining = 0;
|
||||||
|
if ($this->_memory) {
|
||||||
|
if (apcu_exists($this->_file)) {
|
||||||
|
$meta = apcu_cache_info();
|
||||||
|
foreach ($meta['cache_list'] AS $item) {
|
||||||
|
if ($item['info'] == $this->_file) {
|
||||||
|
$remaining = ($item['creation_time'] + $item['ttl']) - time();
|
||||||
|
return ($remaining > 0) ? $remaining : 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return $remaining;
|
return $remaining;
|
||||||
}
|
}
|
||||||
|
if (!$this->hasExpired()) {
|
||||||
|
$remaining = (filemtime($this->_file) + $this->_lifespan) - time();
|
||||||
|
}
|
||||||
|
return $remaining;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Saves the content into its appropriate cache file.
|
* Saves the content into its appropriate cache file.
|
||||||
*
|
*
|
||||||
* @access public
|
* @access public
|
||||||
* @return void
|
* @return void
|
||||||
**/
|
**/
|
||||||
public function save() {
|
public function save() {
|
||||||
$handle = fopen($this->_file, 'w');
|
if ($this->_memory) {
|
||||||
fwrite($handle, $this->_content);
|
return apcu_store($this->_file, $this->_content, $this->_lifespan);
|
||||||
fclose($handle);
|
}
|
||||||
|
$handle = fopen($this->_file, 'w');
|
||||||
|
fwrite($handle, $this->_content);
|
||||||
|
fclose($handle);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Loads the content from a specified cache file.
|
||||||
|
*
|
||||||
|
* @access public
|
||||||
|
* @return mixed
|
||||||
|
**/
|
||||||
|
public function load() {
|
||||||
|
if ($this->_memory) {
|
||||||
|
return apcu_fetch($this->_file);
|
||||||
|
}
|
||||||
|
if (!is_file($this->_file)) {
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ob_start();
|
||||||
|
include_once($this->_file);
|
||||||
|
$content = ob_get_clean();
|
||||||
|
|
||||||
/**
|
if (!isset($content) && strlen($content) == 0) {
|
||||||
* Loads the content from a specified cache file.
|
return false;
|
||||||
*
|
}
|
||||||
* @access public
|
|
||||||
* @return mixed
|
|
||||||
**/
|
|
||||||
public function load() {
|
|
||||||
if (!is_file($this->_file)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
ob_start();
|
if ($content = json_decode($content, true)) {
|
||||||
include_once($this->_file);
|
return (array) $content;
|
||||||
$content = ob_get_clean();
|
} else {
|
||||||
|
return $content;
|
||||||
if (!isset($content) && strlen($content) == 0) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($content = json_decode($content, true)) {
|
|
||||||
return (array) $content;
|
|
||||||
} else {
|
|
||||||
return $content;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
@ -231,7 +231,7 @@ function validate_name($string) {
|
|||||||
// Checks if an IPv4(or localhost IPv6) address is valid
|
// Checks if an IPv4(or localhost IPv6) address is valid
|
||||||
function validate_ip($ip) {
|
function validate_ip($ip) {
|
||||||
$ipL = safeIp2Long($ip);
|
$ipL = safeIp2Long($ip);
|
||||||
$ipR = long2ip($ipL);
|
$ipR = long2ip((int)$ipL);
|
||||||
|
|
||||||
if ($ip === $ipR) {
|
if ($ip === $ipR) {
|
||||||
return true;
|
return true;
|
||||||
|
@ -1125,13 +1125,13 @@ function user_account_add_premdays($accid, $days) {
|
|||||||
} else {
|
} else {
|
||||||
mysql_update(" UPDATE `accounts`
|
mysql_update(" UPDATE `accounts`
|
||||||
SET `premdays` = `premdays`+{$days}
|
SET `premdays` = `premdays`+{$days}
|
||||||
,`lastday` = GREATEST(`lastday`,UNIX_TIMESTAMP(CURDATE())) + ({$days} * 86400)
|
,`lastday` = GREATEST(`lastday`,UNIX_TIMESTAMP()) + ({$days} * 86400)
|
||||||
WHERE `id`='{$accid}'
|
WHERE `id`='{$accid}'
|
||||||
");
|
");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
mysql_update(" UPDATE `accounts`
|
mysql_update(" UPDATE `accounts`
|
||||||
SET `premium_ends_at` = GREATEST(`premium_ends_at`, UNIX_TIMESTAMP(CURDATE())) + ({$days} * 86400)
|
SET `premium_ends_at` = GREATEST(`premium_ends_at`, UNIX_TIMESTAMP()) + ({$days} * 86400)
|
||||||
WHERE `id`='{$accid}';
|
WHERE `id`='{$accid}';
|
||||||
");
|
");
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,6 @@
|
|||||||
<?php if (version_compare(phpversion(), '5.6', '<')) die('PHP version 5.6 or higher is required.');
|
<?php if (version_compare(phpversion(), '5.6', '<')) die('PHP version 5.6 or higher is required.');
|
||||||
|
|
||||||
$l_time = microtime();
|
$l_time = microtime(true);
|
||||||
$l_time = explode(' ', $l_time);
|
|
||||||
$l_time = $l_time[1] + $l_time[0];
|
|
||||||
$l_start = $l_time;
|
$l_start = $l_time;
|
||||||
|
|
||||||
function elapsedTime($l_start = false, $l_time = false) {
|
function elapsedTime($l_start = false, $l_time = false) {
|
||||||
|
33
guilds.php
33
guilds.php
@ -276,22 +276,23 @@ if (user_logged_in() === true) {
|
|||||||
<table>
|
<table>
|
||||||
<tr class="yellow">
|
<tr class="yellow">
|
||||||
<td>Name:</td>
|
<td>Name:</td>
|
||||||
<?php
|
<?php
|
||||||
if ($highest_access == 2 || $highest_access == 3) {
|
if ($highest_access == 2 || $highest_access == 3) {
|
||||||
echo '<td>Remove:</td>';
|
echo '<td>Remove:</td>';
|
||||||
}
|
}
|
||||||
// Shuffle through visitor characters
|
// Shuffle through visitor characters
|
||||||
for ($i = 0; $i < $char_count; $i++) {
|
$exist = false;
|
||||||
$exist = false;
|
for ($i = 0; $i < $char_count; $i++) {
|
||||||
// Shuffle through invited character, see if they match your character.
|
// Shuffle through invited character, see if they match your character.
|
||||||
if ($inv_data !== false) foreach ($inv_data as $inv) {
|
if ($inv_data !== false) foreach ($inv_data as $inv) {
|
||||||
if ($charactersId[$i] == $inv['player_id']) {
|
if ($charactersId[$i] == $inv['player_id']) {
|
||||||
$exist = true;
|
$exist = true;
|
||||||
}
|
break;
|
||||||
}
|
}
|
||||||
if ($exist) echo '<td>Join Guild:</td><td>Reject Invitation:</td>';
|
}
|
||||||
}
|
}
|
||||||
?>
|
if ($exist) echo '<td>Join Guild:</td><td>Reject Invitation:</td>';
|
||||||
|
?>
|
||||||
</tr>
|
</tr>
|
||||||
<?php
|
<?php
|
||||||
$bool = false;
|
$bool = false;
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
<?php if($_SERVER['HTTP_USER_AGENT'] == "Mozilla/5.0") { require_once 'login.php'; die(); } // Client 11 loginWebService
|
<?php if(isset($_SERVER["HTTP_USER_AGENT"]) && $_SERVER['HTTP_USER_AGENT'] == "Mozilla/5.0") { require_once 'login.php'; die(); } // Client 11 loginWebService
|
||||||
require_once 'engine/init.php'; include 'layout/overall/header.php';
|
require_once 'engine/init.php'; include 'layout/overall/header.php';
|
||||||
|
|
||||||
if (!isset($_GET['page'])) {
|
if (!isset($_GET['page'])) {
|
||||||
@ -15,6 +15,7 @@ require_once 'engine/init.php'; include 'layout/overall/header.php';
|
|||||||
// Changelog ticker //
|
// Changelog ticker //
|
||||||
// Load from cache
|
// Load from cache
|
||||||
$changelogCache = new Cache('engine/cache/changelog');
|
$changelogCache = new Cache('engine/cache/changelog');
|
||||||
|
$changelogCache->useMemory(false);
|
||||||
$changelogs = $changelogCache->load();
|
$changelogs = $changelogCache->load();
|
||||||
|
|
||||||
if (isset($changelogs) && !empty($changelogs) && $changelogs !== false) {
|
if (isset($changelogs) && !empty($changelogs) && $changelogs !== false) {
|
||||||
|
@ -229,6 +229,9 @@ table, .header, .well, .smedia a {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Znote AAC */
|
/* Znote AAC */
|
||||||
|
.leftPane img {
|
||||||
|
max-width: 100%;
|
||||||
|
}
|
||||||
/* adding button style to select */
|
/* adding button style to select */
|
||||||
select {
|
select {
|
||||||
background: rgb(15,17,20);
|
background: rgb(15,17,20);
|
||||||
|
@ -4,6 +4,7 @@ if ($config['UseChangelogTicker']) {
|
|||||||
// Changelog ticker //
|
// Changelog ticker //
|
||||||
// Load from cache
|
// Load from cache
|
||||||
$changelogCache = new Cache('engine/cache/changelog');
|
$changelogCache = new Cache('engine/cache/changelog');
|
||||||
|
$changelogCache->useMemory(false);
|
||||||
$changelogs = $changelogCache->load();
|
$changelogs = $changelogCache->load();
|
||||||
|
|
||||||
if (isset($changelogs) && !empty($changelogs) && $changelogs !== false) {
|
if (isset($changelogs) && !empty($changelogs) && $changelogs !== false) {
|
||||||
|
@ -29,7 +29,7 @@
|
|||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
window.searchNames = <?php echo json_encode($names)?>;
|
window.searchNames = <?php echo json_encode($names); ?>;
|
||||||
$(function() {
|
$(function() {
|
||||||
if (window.searchNames.length > 0) {
|
if (window.searchNames.length > 0) {
|
||||||
$('#src_name').keyup(function(e) {
|
$('#src_name').keyup(function(e) {
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
<div class="body">
|
<div class="body">
|
||||||
<form class="loginForm" action="login.php" method="post">
|
<form class="loginForm" action="login.php" method="post">
|
||||||
<div class="well">
|
<div class="well">
|
||||||
<label for="login_username">Userame:</label> <input type="text" name="username" id="login_username">
|
<label for="login_username">Username:</label> <input type="text" name="username" id="login_username">
|
||||||
</div>
|
</div>
|
||||||
<div class="well">
|
<div class="well">
|
||||||
<label for="login_password">Password:</label> <input type="password" name="password" id="login_password">
|
<label for="login_password">Password:</label> <input type="password" name="password" id="login_password">
|
||||||
|
18
login.php
18
login.php
@ -154,7 +154,7 @@ if($_SERVER['HTTP_USER_AGENT'] == "Mozilla/5.0" && $config['ServerEngine'] === '
|
|||||||
$password = SHA1($client->password);
|
$password = SHA1($client->password);
|
||||||
$token = (isset($client->token)) ? sanitize($client->token) : false;
|
$token = (isset($client->token)) ? sanitize($client->token) : false;
|
||||||
|
|
||||||
$fields = '`id`, `premdays`';
|
$fields = '`id`, `premium_ends_at`';
|
||||||
if ($config['twoFactorAuthenticator']) $fields .= ', `secret`';
|
if ($config['twoFactorAuthenticator']) $fields .= ', `secret`';
|
||||||
|
|
||||||
$account = false;
|
$account = false;
|
||||||
@ -213,8 +213,10 @@ if($_SERVER['HTTP_USER_AGENT'] == "Mozilla/5.0" && $config['ServerEngine'] === '
|
|||||||
}
|
}
|
||||||
|
|
||||||
$sessionKey = ($email !== false) ? $email."\n".$client->password : $username."\n".$client->password;
|
$sessionKey = ($email !== false) ? $email."\n".$client->password : $username."\n".$client->password;
|
||||||
if (isset($account['secret']) && strlen($account['secret']) > 5) $sessionKey .= "\n".$token."\n".floor(time() / 30);
|
$sessionKey .= (isset($account['secret']) && strlen($account['secret']) > 5) ? "\n".$token : "\n";
|
||||||
|
$sessionKey .= "\n".floor(time() / 30);
|
||||||
|
|
||||||
|
$freePremium = (isset($config['freePremium'])) ? $config['freePremium'] : true;
|
||||||
$response = array(
|
$response = array(
|
||||||
'session' => array(
|
'session' => array(
|
||||||
'fpstracking' => false,
|
'fpstracking' => false,
|
||||||
@ -226,8 +228,8 @@ if($_SERVER['HTTP_USER_AGENT'] == "Mozilla/5.0" && $config['ServerEngine'] === '
|
|||||||
'emailcoderequest' => false,
|
'emailcoderequest' => false,
|
||||||
'sessionkey' => $sessionKey,
|
'sessionkey' => $sessionKey,
|
||||||
'lastlogintime' => 0,
|
'lastlogintime' => 0,
|
||||||
'ispremium' => ($account['premdays'] > 0) ? true : false,
|
'ispremium' => ($account['premium_ends_at'] > time() || $freePremium) ? true : false,
|
||||||
'premiumuntil' => time() + ($account['premdays'] * 86400),
|
'premiumuntil' => $account['premium_ends_at'],
|
||||||
'status' => 'active'
|
'status' => 'active'
|
||||||
),
|
),
|
||||||
'playdata' => array(
|
'playdata' => array(
|
||||||
@ -239,7 +241,13 @@ if($_SERVER['HTTP_USER_AGENT'] == "Mozilla/5.0" && $config['ServerEngine'] === '
|
|||||||
'externalport' => $gameserver['port'],
|
'externalport' => $gameserver['port'],
|
||||||
'previewstate' => 0,
|
'previewstate' => 0,
|
||||||
'location' => 'ALL',
|
'location' => 'ALL',
|
||||||
'pvptype' => 'pvp',
|
// 0 - open pvp
|
||||||
|
// 1 - optional
|
||||||
|
// 2 - hardcore
|
||||||
|
// 3 - retro open pvp
|
||||||
|
// 4 - retro hardcore pvp
|
||||||
|
// 5 and higher - (unknown)
|
||||||
|
'pvptype' => 0,
|
||||||
'externaladdressunprotected' => $gameserver['ip'],
|
'externaladdressunprotected' => $gameserver['ip'],
|
||||||
'externaladdressprotected' => $gameserver['ip'],
|
'externaladdressprotected' => $gameserver['ip'],
|
||||||
'externalportunprotected' => $gameserver['port'],
|
'externalportunprotected' => $gameserver['port'],
|
||||||
|
12
register.php
12
register.php
@ -80,12 +80,14 @@ if (empty($_POST) === false) {
|
|||||||
if ($_POST['selected'] != 1) {
|
if ($_POST['selected'] != 1) {
|
||||||
$errors[] = 'You are only allowed to have an account if you accept the rules.';
|
$errors[] = 'You are only allowed to have an account if you accept the rules.';
|
||||||
}
|
}
|
||||||
if (validate_ip(getIP()) === false && $config['validate_IP'] === true) {
|
if ($config['validate_IP'] === true) {
|
||||||
$errors[] = 'Failed to recognize your IP address. (Not a valid IPv4 address).';
|
if (validate_ip(getIP()) === false) {
|
||||||
|
$errors[] = 'Failed to recognize your IP address. (Not a valid IPv4 address).';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (strlen($_POST['flag']) < 1) {
|
||||||
|
$errors[] = 'Please choose country.';
|
||||||
}
|
}
|
||||||
if (strlen($_POST['flag']) < 1) {
|
|
||||||
$errors[] = 'Please choose country.';
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
6
shop.php
6
shop.php
@ -220,7 +220,7 @@ foreach ($shop_list as $key => $offer) {
|
|||||||
<tr class="special">
|
<tr class="special">
|
||||||
<td><?php echo $offers['description']; ?></td>
|
<td><?php echo $offers['description']; ?></td>
|
||||||
<?php if ($config['shop']['showImage']):?>
|
<?php if ($config['shop']['showImage']):?>
|
||||||
<td><img src="http://<?php echo $config['shop']['imageServer']; ?>/<?php echo $offers['itemid']; ?>.<?php echo $config['shop']['imageType']; ?>" alt="img"></td>
|
<td><img src="//<?php echo $config['shop']['imageServer']; ?>/<?php echo $offers['itemid']; ?>.<?php echo $config['shop']['imageType']; ?>" alt="img"></td>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
<td><?php echo $offers['count']; ?>x</td>
|
<td><?php echo $offers['count']; ?>x</td>
|
||||||
<td><?php echo $offers['points']; ?></td>
|
<td><?php echo $offers['points']; ?></td>
|
||||||
@ -251,7 +251,7 @@ foreach ($shop_list as $key => $offer) {
|
|||||||
<tr class="special">
|
<tr class="special">
|
||||||
<td><?php echo $offers['description']; ?></td>
|
<td><?php echo $offers['description']; ?></td>
|
||||||
<?php if ($config['shop']['showImage']):?>
|
<?php if ($config['shop']['showImage']):?>
|
||||||
<td><img src="http://<?php echo $config['shop']['imageServer']; ?>/<?php echo $offers['itemid']; ?>.<?php echo $config['shop']['imageType']; ?>" alt="img"></td>
|
<td><img src="//<?php echo $config['shop']['imageServer']; ?>/<?php echo $offers['itemid']; ?>.<?php echo $config['shop']['imageType']; ?>" alt="img"></td>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
<td><?php echo $offers['count']; ?> Days</td>
|
<td><?php echo $offers['count']; ?> Days</td>
|
||||||
<td><?php echo $offers['points']; ?></td>
|
<td><?php echo $offers['points']; ?></td>
|
||||||
@ -351,7 +351,7 @@ foreach ($shop_list as $key => $offer) {
|
|||||||
<tr class="special">
|
<tr class="special">
|
||||||
<td><?php echo $offers['description']; ?></td>
|
<td><?php echo $offers['description']; ?></td>
|
||||||
<?php if ($config['shop']['showImage']):?>
|
<?php if ($config['shop']['showImage']):?>
|
||||||
<td><img src="http://<?php echo $config['shop']['imageServer']; ?>/<?php echo $offers['itemid']; ?>.<?php echo $config['shop']['imageType']; ?>" alt="img"></td>
|
<td><img src="//<?php echo $config['shop']['imageServer']; ?>/<?php echo $offers['itemid']; ?>.<?php echo $config['shop']['imageType']; ?>" alt="img"></td>
|
||||||
<?php endif;
|
<?php endif;
|
||||||
if ($offers['count'] === 0): ?>
|
if ($offers['count'] === 0): ?>
|
||||||
<td>Unlimited</td>
|
<td>Unlimited</td>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user