diff --git a/system/functions.php b/system/functions.php
index acacd30e..0d26f89c 100644
--- a/system/functions.php
+++ b/system/functions.php
@@ -823,11 +823,11 @@ function getWorldName($id)
*
* @param string $to Recipient email address.
* @param string $subject Subject of the message.
- * @param string $body Message body in html format.
+ * @param string $body Message body in HTML format.
* @param string $altBody Alternative message body, plain text.
* @return bool PHPMailer status returned (success/failure).
*/
-function _mail($to, $subject, $body, $altBody = '', $add_html_tags = true)
+function _mail(string $to, string $subject, string $body, string $altBody = ''): bool
{
/** @var PHPMailer $mailer */
global $mailer, $config;
@@ -841,15 +841,6 @@ function _mail($to, $subject, $body, $altBody = '', $add_html_tags = true)
$mailer->clearAllRecipients();
}
- $signature_html = '';
- if(isset($config['mail_signature']['html']))
- $signature_html = $config['mail_signature']['html'];
-
- if($add_html_tags && isset($body[0]))
- $tmp_body = '
' . $body . '
' . $signature_html . '';
- else
- $tmp_body = $body . '
' . $signature_html;
-
if($config['smtp_enabled'])
{
$mailer->isSMTP();
@@ -864,6 +855,12 @@ function _mail($to, $subject, $body, $altBody = '', $add_html_tags = true)
$mailer->isMail();
}
+ if(isset($config['mail_signature']['html'])) {
+ $signature_html = $config['mail_signature']['html'];
+ }
+
+ $tmp_body = $body . '
' . $signature_html;
+
$mailer->isHTML(isset($body[0]) > 0);
$mailer->From = $config['mail_address'];
$mailer->Sender = $config['mail_address'];
@@ -1338,6 +1335,43 @@ function getDatabasePages($withHidden = false): array
return $ret;
}
+function getStatusUptimeReadable(int $uptime): string
+{
+ $fullMinute = 60;
+ $fullHour = (60 * $fullMinute);
+ $fullDay = (24 * $fullHour);
+ $fullMonth = (30 * $fullDay);
+ $fullYear = (365 * $fullDay);
+
+ // years
+ $years = floor($uptime / $fullYear);
+ $y = ($years > 1 ? "$years years, " : ($years == 1 ? 'year, ' : ''));
+
+ $uptime -= $years * $fullYear;
+
+ // months
+ $months = floor($uptime / $fullMonth);
+ $m = ($months > 1 ? "$months months, " : ($months == 1 ? 'month, ' : ''));
+
+ $uptime -= $months * $fullMonth;
+
+ // days
+ $days = floor($uptime / $fullDay);
+ $d = ($days > 1 ? "$days days, " : ($days == 1 ? 'day, ' : ''));
+
+ $uptime -= $days * $fullDay;
+
+ // hours
+ $hours = floor($uptime / $fullHour);
+
+ $uptime -= $hours * $fullHour;
+
+ // minutes
+ $min = floor($uptime / $fullMinute);
+
+ return "{$y}{$m}{$d}{$hours}h {$min}m";
+}
+
// validator functions
require_once LIBS . 'validator.php';
require_once SYSTEM . 'compat/base.php';
diff --git a/system/libs/pot/OTS_ServerInfo.php b/system/libs/pot/OTS_ServerInfo.php
index 591443e9..1f01d028 100644
--- a/system/libs/pot/OTS_ServerInfo.php
+++ b/system/libs/pot/OTS_ServerInfo.php
@@ -92,6 +92,8 @@ class OTS_ServerInfo
return new OTS_Buffer($data);
}
+ log_append('status-error.log', "Cannot connect to {$this->server}:{$this->port} - Error code: $error, message: $message");
+
return false;
}
diff --git a/system/pages/forum/edit_post.php b/system/pages/forum/edit_post.php
index 4b7976aa..bbc00699 100644
--- a/system/pages/forum/edit_post.php
+++ b/system/pages/forum/edit_post.php
@@ -24,7 +24,7 @@ if(Forum::canPost($account_logged))
{
$first_post = $db->query("SELECT `" . FORUM_TABLE_PREFIX . "forum`.`author_guid`, `" . FORUM_TABLE_PREFIX . "forum`.`author_aid`, `" . FORUM_TABLE_PREFIX . "forum`.`first_post`, `" . FORUM_TABLE_PREFIX . "forum`.`post_topic`, `" . FORUM_TABLE_PREFIX . "forum`.`post_text`, `" . FORUM_TABLE_PREFIX . "forum`.`post_smile`, `" . FORUM_TABLE_PREFIX . "forum`.`id`, `" . FORUM_TABLE_PREFIX . "forum`.`section` FROM `" . FORUM_TABLE_PREFIX . "forum` WHERE `" . FORUM_TABLE_PREFIX . "forum`.`id` = ".(int) $thread['first_post']." LIMIT 1")->fetch();
echo 'Boards >> '.$sections[$thread['section']]['name'].' >> '.htmlspecialchars($first_post['post_topic']).' >> Edit post';
- if(Forum::hasAccess($thread['section'] && ($account_logged->getId() == $thread['author_aid'] || Forum::isModerator())))
+ if(Forum::hasAccess($thread['section']) && ($account_logged->getId() == $thread['author_aid'] || Forum::isModerator()))
{
$char_id = $post_topic = $text = $smile = $html = null;
$players_from_account = $db->query("SELECT `players`.`name`, `players`.`id` FROM `players` WHERE `players`.`account_id` = ".(int) $account_logged->getId())->fetchAll();
diff --git a/system/status.php b/system/status.php
index e3fcaf5a..08304cf8 100644
--- a/system/status.php
+++ b/system/status.php
@@ -143,13 +143,7 @@ function updateStatus() {
}
$uptime = $status['uptime'] = $serverStatus->getUptime();
- $m = date('m', $uptime);
- $m = $m > 1 ? "$m months, " : ($m == 1 ? 'month, ' : '');
- $d = date('d', $uptime);
- $d = $d > 1 ? "$d days, " : ($d == 1 ? 'day, ' : '');
- $h = date('H', $uptime);
- $min = date('i', $uptime);
- $status['uptimeReadable'] = "{$m}{$d}{$h}h {$min}m";
+ $status['uptimeReadable'] = getStatusUptimeReadable($uptime);
$status['monsters'] = $serverStatus->getMonstersCount();
$status['motd'] = $serverStatus->getMOTD();
diff --git a/system/templates/account.management.html.twig b/system/templates/account.management.html.twig
index 65919558..8f399b23 100644
--- a/system/templates/account.management.html.twig
+++ b/system/templates/account.management.html.twig
@@ -109,7 +109,7 @@
| Last Login: |
- {{ "now"|date("j F Y, G:i:s") }} |
+ {{ account_logged.getCustomField('web_lastlogin')|date("j F Y, G:i:s") }} |
{% autoescape false %}
@@ -173,7 +173,7 @@
{% set i = i + 1 %}
|
- {{ player.getName() }}
+ {{ player.getName() }}{% if player.isDeleted() %} [ DELETED ] {% endif %}
|
{{ player.getLevel() }} |
{{ player.getVocationName() }} |
diff --git a/templates/tibiacom/account.management.html.twig b/templates/tibiacom/account.management.html.twig
index 1a851bf0..deb53dc5 100644
--- a/templates/tibiacom/account.management.html.twig
+++ b/templates/tibiacom/account.management.html.twig
@@ -161,7 +161,7 @@
| Last Login: |
- {{ "now"|date("j F Y, G:i:s") }} |
+ {{ account_logged.getCustomField('web_lastlogin')|date("j F Y, G:i:s") }} |
{% autoescape false %}
diff --git a/tools/signature/index.php b/tools/signature/index.php
index e3e33303..b272824d 100644
--- a/tools/signature/index.php
+++ b/tools/signature/index.php
@@ -33,14 +33,14 @@
if(!isset($_REQUEST['name']))
die('Please enter name as get or post parameter.');
- $name = stripslashes(ucwords(strtolower(trim($_REQUEST['name']))));
$player = new OTS_Player();
- $player->find($name);
+ $player->find($_REQUEST['name']);
if(!$player->isLoaded())
{
- header('Content-type: image/png');
- readfile(SIGNATURES_IMAGES.'nocharacter.png');
+ //header('Content-type: image/png');
+ //readfile(SIGNATURES_IMAGES.'nocharacter.png');
+ http_response_code(404);
exit;
}