diff --git a/bans.php b/bans.php index e866553..6c33a4c 100644 --- a/bans.php +++ b/bans.php @@ -44,7 +44,7 @@ $banlist = $cacheutils->getValue();
@@ -68,14 +68,14 @@ function getBanlist() { $user = censorIP((string)$ban['ip']); if (!empty($ban['lastnickname'])) - $user = (string)$ban['lastnickname']; + $user = htmlentities((string)$ban['lastnickname']); if (empty($user)) $user = "Unknown"; - $reason = $ban['reason']; - $invokername = (string)$ban['invokername']; + $reason = htmlentities((string)$ban['reason']); + $invokername = htmlentities((string)$ban['invokername']); $duration = $ban['duration']; $createdepoch = $ban['created']; $expiresepoch = $ban['created'] + $duration; diff --git a/include/adminlist.php b/include/adminlist.php index 9f1ba5d..ebf2faf 100644 --- a/include/adminlist.php +++ b/include/adminlist.php @@ -38,10 +38,10 @@ function getAdminList() { $groupicon = getGroupIcon($tsAdmin, $group); if ($groupicon) { - $icon = ' '; + $icon = ' '; } } elseif (in_array($group["iconid"], $localIcons)) { - $icon = ' '; + $icon = ' '; } } @@ -63,11 +63,11 @@ function getAdminList() { if($user["client_type"]) continue; if (!$user) { - $offlineClients[] = '' . $userInfo['client_nickname'] . '' . translate($lang["adminlist"]["status"]["offline"]) . '
'; + $offlineClients[] = '' . htmlentities($userInfo['client_nickname']) . '' . translate($lang["adminlist"]["status"]["offline"]) . '
'; continue; } - $onlineClients[] = '' . '' . $user . '' . ($user['client_away'] ? '' . translate($lang["adminlist"]["status"]["away"]) . '' : '' . translate($lang["adminlist"]["status"]["online"]) . '') . '
'; + $onlineClients[] = '' . '' . htmlentities($user) . '' . ($user['client_away'] ? '' . translate($lang["adminlist"]["status"]["away"]) . '' : '' . translate($lang["adminlist"]["status"]["online"]) . '') . '
'; } foreach (array_merge($onlineClients, $offlineClients) as $str) diff --git a/include/cacheutils.class.php b/include/cacheutils.class.php index 3051a91..690f0bc 100644 --- a/include/cacheutils.class.php +++ b/include/cacheutils.class.php @@ -7,11 +7,15 @@ use phpFastCache\Util\Languages; class CacheUtils { + private $devMode; private $cacheInstance; private $cacheItem; private $key; - function __construct($key) { + public function __construct($key) { + // If devMode is set, the cache will be invalidated immediately + $this->devMode = defined("DEV_MODE") || getenv("DEV_MODE") || file_exists(__DIR__ . "/dev_mode"); + if(!is_string($key)) throw new InvalidArgumentException("Key must be a string"); @@ -39,12 +43,15 @@ class CacheUtils { } public function setValue($value, $expireTime) { + if($this->devMode) + $expireTime = 1; + $this->cacheItem = $this->cacheItem->set($value)->expiresAfter($expireTime); $this->cacheInstance->save($this->cacheItem); } public function isExpired() { - return !$this->cacheItem->isHit(); + return $this->devMode || !$this->cacheItem->isHit(); } public function remove() { diff --git a/include/footer.php b/include/footer.php index 3d8c5cc..87c7f71 100644 --- a/include/footer.php +++ b/include/footer.php @@ -12,7 +12,7 @@- ts-website v 1.4.4.3 — © Wruczek 2016 - 2017 + ts-website v 1.4.5 — © Wruczek 2016 - 2017
diff --git a/include/modulecheck.php b/include/modulecheck.php index d885e08..fee32a0 100644 --- a/include/modulecheck.php +++ b/include/modulecheck.php @@ -89,7 +89,7 @@ function showError($title, $text) { ?>