From 9d664d3577c0e9807926d5ae1e99dd6da6b27df0 Mon Sep 17 00:00:00 2001
From: SRNT-GG <95472530+SRNT-GG@users.noreply.github.com>
Date: Thu, 15 Jun 2023 20:53:55 +0200
Subject: [PATCH] WIP - Removing unneccessary closing tags to prevent potential
 issues. (#223)

* Part 1

Removing closing tags when no HTML or other output comes after the last PHP codeblock.

* Further removals

* nothing

---------

Co-authored-by: slawkens <slawkens@gmail.com>
---
 admin/includes/functions.php               | 3 ++-
 admin/pages/pages.php                      | 2 --
 admin/pages/statistics.php                 | 1 -
 admin/pages/version.php                    | 1 -
 admin/tools/phpinfo.php                    | 1 -
 install/includes/config.php                | 1 -
 install/steps/2-license.php                | 1 -
 install/steps/4-config.php                 | 1 -
 system/counter.php                         | 1 -
 system/init.php                            | 2 +-
 system/item.php                            | 1 -
 system/libs/data.php                       | 1 -
 system/libs/pot/E_OTS_ErrorCode.php        | 2 --
 system/libs/pot/E_OTS_Generic.php          | 2 --
 system/libs/pot/E_OTS_NotAContainer.php    | 2 --
 system/libs/pot/E_OTS_OTBMError.php        | 2 --
 system/libs/pot/E_OTS_ReadOnly.php         | 2 --
 system/libs/pot/IOTS_Cipher.php            | 2 --
 system/libs/pot/IOTS_DataDisplay.php       | 2 --
 system/libs/pot/IOTS_Display.php           | 2 --
 system/libs/pot/IOTS_GuildAction.php       | 2 --
 system/libs/pot/OTS_Account.php            | 2 --
 system/libs/pot/OTS_AccountBans_List.php   | 2 --
 system/libs/pot/OTS_Admin.php              | 2 --
 system/libs/pot/OTS_Bans_List.php          | 2 --
 system/libs/pot/OTS_Base_DB.php            | 2 --
 system/libs/pot/OTS_BinaryTools.php        | 2 --
 system/libs/pot/OTS_Container.php          | 2 --
 system/libs/pot/OTS_FileLoader.php         | 2 --
 system/libs/pot/OTS_Group.php              | 2 --
 system/libs/pot/OTS_Guild.php              | 2 --
 system/libs/pot/OTS_GuildRanks_List.php    | 2 --
 system/libs/pot/OTS_House.php              | 2 --
 system/libs/pot/OTS_IPBans_List.php        | 2 --
 system/libs/pot/OTS_InfoRespond.php        | 2 --
 system/libs/pot/OTS_ItemsList.php          | 2 --
 system/libs/pot/OTS_MapCoords.php          | 2 --
 system/libs/pot/OTS_MonstersList.php       | 2 --
 system/libs/pot/OTS_Player.php             | 2 --
 system/libs/pot/OTS_PlayerBans_List.php    | 2 --
 system/libs/pot/OTS_Row_DAO.php            | 2 --
 system/libs/pot/OTS_SQLField.php           | 2 --
 system/libs/pot/OTS_ServerInfo.php         | 2 --
 system/libs/pot/OTS_Spell.php              | 2 --
 system/libs/pot/OTS_Toolbox.php            | 2 --
 system/libs/pot/OTS_XTEA.php               | 2 --
 system/libs/rfc6238.php                    | 1 -
 system/libs/validator.php                  | 1 -
 system/locale/de/admin.php                 | 1 -
 system/locale/de/main.php                  | 3 +--
 system/locale/en/install.php               | 1 -
 system/locale/pl/admin.php                 | 1 -
 system/locale/pl/main.php                  | 2 +-
 system/locale/pt_br/install.php            | 1 -
 system/locale/sv/admin.php                 | 1 -
 system/locale/sv/main.php                  | 1 -
 system/migrations/11.php                   | 1 -
 system/migrations/13.php                   | 3 +--
 system/migrations/15.php                   | 1 -
 system/migrations/17.php                   | 1 -
 system/migrations/19.php                   | 3 +--
 system/migrations/2.php                    | 1 -
 system/migrations/20.php                   | 1 -
 system/migrations/4.php                    | 3 +--
 system/migrations/6.php                    | 3 +--
 system/migrations/8.php                    | 3 +--
 system/pages/account/change_email.php      | 1 -
 system/pages/account/change_name.php       | 2 --
 system/pages/account/change_sex.php        | 2 --
 system/pages/account/lost.php              | 1 -
 system/pages/bugtracker.php                | 1 -
 system/pages/faq.php                       | 1 -
 system/pages/forum/edit_post.php           | 2 --
 system/pages/forum/new_thread.php          | 2 --
 system/pages/gallery.php                   | 1 -
 system/pages/guilds/change_description.php | 2 --
 system/pages/guilds/change_motd.php        | 2 --
 system/pages/guilds/cleanup_players.php    | 1 -
 system/pages/guilds/delete_by_admin.php    | 2 --
 system/pages/guilds/delete_rank.php        | 2 --
 system/pages/guilds/leave.php              | 2 --
 system/pages/guilds/pass_leadership.php    | 2 --
 system/pages/polls.php                     | 1 -
 system/pages/server_info.php               | 3 ---
 system/pages/team.php                      | 1 -
 templates/tibiacom/index.php               | 1 -
 tools/news_preview.php                     | 2 --
 tools/signature/gesior.php                 | 3 +--
 tools/signature/mango.php                  | 1 -
 89 files changed, 11 insertions(+), 144 deletions(-)

diff --git a/admin/includes/functions.php b/admin/includes/functions.php
index ab604f76..620272f5 100644
--- a/admin/includes/functions.php
+++ b/admin/includes/functions.php
@@ -1 +1,2 @@
-<?php
// nothing yet here
?>
\ No newline at end of file
+<?php
+// nothing yet here
\ No newline at end of file
diff --git a/admin/pages/pages.php b/admin/pages/pages.php
index 19821a8e..7f030e47 100644
--- a/admin/pages/pages.php
+++ b/admin/pages/pages.php
@@ -258,5 +258,3 @@ class Pages
 		return !count($errors);
 	}
 }
-
-?>
diff --git a/admin/pages/statistics.php b/admin/pages/statistics.php
index 17d8118f..b740c217 100644
--- a/admin/pages/statistics.php
+++ b/admin/pages/statistics.php
@@ -36,4 +36,3 @@ $twig->display('admin.statistics.html.twig', array(
 	'account_type' => (USE_ACCOUNT_NAME ? 'name' : 'number'),
 	'points' => $points
 ));
-?>
\ No newline at end of file
diff --git a/admin/pages/version.php b/admin/pages/version.php
index e643e728..64f673c8 100644
--- a/admin/pages/version.php
+++ b/admin/pages/version.php
@@ -47,4 +47,3 @@ function version_revert($version)
 	$release = $version;
 	return $major . '.' . $minor . '.' . $release;
 }*/
-?>
diff --git a/admin/tools/phpinfo.php b/admin/tools/phpinfo.php
index 96a9aad9..cd043279 100644
--- a/admin/tools/phpinfo.php
+++ b/admin/tools/phpinfo.php
@@ -13,4 +13,3 @@ if(!function_exists('phpinfo'))
 	die('phpinfo() disabled on this web server.');
 
 phpinfo();
-?>
diff --git a/install/includes/config.php b/install/includes/config.php
index 380fff7d..5d9ae07a 100644
--- a/install/includes/config.php
+++ b/install/includes/config.php
@@ -38,4 +38,3 @@ if(!isset($error) || !$error) {
 		$error = true;
 	}
 }
-?>
\ No newline at end of file
diff --git a/install/steps/2-license.php b/install/steps/2-license.php
index e84ce0e6..4976dd70 100644
--- a/install/steps/2-license.php
+++ b/install/steps/2-license.php
@@ -5,4 +5,3 @@ $twig->display('install.license.html.twig', array(
 	'license' => file_get_contents(BASE . 'LICENSE'),
 	'buttons' => next_buttons()
 ));
-?>
diff --git a/install/steps/4-config.php b/install/steps/4-config.php
index b1555201..325b97f1 100644
--- a/install/steps/4-config.php
+++ b/install/steps/4-config.php
@@ -18,4 +18,3 @@ $twig->display('install.config.html.twig', array(
 	'errors' => isset($errors) ? $errors : null,
 	'buttons' => next_buttons()
 ));
-?>
\ No newline at end of file
diff --git a/system/counter.php b/system/counter.php
index ada05903..63905ba2 100644
--- a/system/counter.php
+++ b/system/counter.php
@@ -51,4 +51,3 @@ else
 		updateDatabaseConfig('views_counter', $views_counter); // update counter
 	}
 }
-?>
diff --git a/system/init.php b/system/init.php
index 056bbd40..2815f791 100644
--- a/system/init.php
+++ b/system/init.php
@@ -122,7 +122,7 @@ if(!isset($foundValue)) {
 $config['data_path'] = $foundValue;
 unset($foundValue);
 
-// new config values for compability
+// new config values for compatibility
 if(!isset($config['highscores_ids_hidden']) || count($config['highscores_ids_hidden']) == 0) {
 	$config['highscores_ids_hidden'] = array(0);
 }
diff --git a/system/item.php b/system/item.php
index 4d213360..66d4bfc5 100644
--- a/system/item.php
+++ b/system/item.php
@@ -58,4 +58,3 @@ function outputItem($id = 100, $count = 1)
 	$file_name = Items_Images::$outputDir . $file_name . '.gif';
 	readfile($file_name);
 }
-?>
diff --git a/system/libs/data.php b/system/libs/data.php
index 64d93f78..af667448 100644
--- a/system/libs/data.php
+++ b/system/libs/data.php
@@ -41,4 +41,3 @@ class Data
 		return $db->update($this->table, $data, $where);
 	}
 }
-?>
diff --git a/system/libs/pot/E_OTS_ErrorCode.php b/system/libs/pot/E_OTS_ErrorCode.php
index f5bbd2fc..451e5a07 100644
--- a/system/libs/pot/E_OTS_ErrorCode.php
+++ b/system/libs/pot/E_OTS_ErrorCode.php
@@ -32,5 +32,3 @@ class E_OTS_ErrorCode extends Exception
 }
 
 /**#@-*/
-
-?>
diff --git a/system/libs/pot/E_OTS_Generic.php b/system/libs/pot/E_OTS_Generic.php
index 3ca0a914..7a95d675 100644
--- a/system/libs/pot/E_OTS_Generic.php
+++ b/system/libs/pot/E_OTS_Generic.php
@@ -36,5 +36,3 @@ class E_OTS_Generic extends E_OTS_ErrorCode
 }
 
 /**#@-*/
-
-?>
diff --git a/system/libs/pot/E_OTS_NotAContainer.php b/system/libs/pot/E_OTS_NotAContainer.php
index 3a8d224b..8285691f 100644
--- a/system/libs/pot/E_OTS_NotAContainer.php
+++ b/system/libs/pot/E_OTS_NotAContainer.php
@@ -22,5 +22,3 @@ class E_OTS_NotAContainer extends Exception
 }
 
 /**#@-*/
-
-?>
diff --git a/system/libs/pot/E_OTS_OTBMError.php b/system/libs/pot/E_OTS_OTBMError.php
index d84d740c..9ab1228d 100644
--- a/system/libs/pot/E_OTS_OTBMError.php
+++ b/system/libs/pot/E_OTS_OTBMError.php
@@ -32,5 +32,3 @@ class E_OTS_OTBMError extends E_OTS_ErrorCode
 }
 
 /**#@-*/
-
-?>
diff --git a/system/libs/pot/E_OTS_ReadOnly.php b/system/libs/pot/E_OTS_ReadOnly.php
index 003d12af..5fb3b39b 100644
--- a/system/libs/pot/E_OTS_ReadOnly.php
+++ b/system/libs/pot/E_OTS_ReadOnly.php
@@ -22,5 +22,3 @@ class E_OTS_ReadOnly extends Exception
 }
 
 /**#@-*/
-
-?>
diff --git a/system/libs/pot/IOTS_Cipher.php b/system/libs/pot/IOTS_Cipher.php
index 82044cc8..542b4abb 100644
--- a/system/libs/pot/IOTS_Cipher.php
+++ b/system/libs/pot/IOTS_Cipher.php
@@ -37,5 +37,3 @@ interface IOTS_Cipher
 }
 
 /**#@-*/
-
-?>
diff --git a/system/libs/pot/IOTS_DataDisplay.php b/system/libs/pot/IOTS_DataDisplay.php
index 7c5abc2c..359dc1a6 100644
--- a/system/libs/pot/IOTS_DataDisplay.php
+++ b/system/libs/pot/IOTS_DataDisplay.php
@@ -89,5 +89,3 @@ interface IOTS_DataDisplay
 }
 
 /**#@-*/
-
-?>
diff --git a/system/libs/pot/IOTS_Display.php b/system/libs/pot/IOTS_Display.php
index cb2d8e90..3b75d537 100644
--- a/system/libs/pot/IOTS_Display.php
+++ b/system/libs/pot/IOTS_Display.php
@@ -96,5 +96,3 @@ interface IOTS_Display
 }
 
 /**#@-*/
-
-?>
diff --git a/system/libs/pot/IOTS_GuildAction.php b/system/libs/pot/IOTS_GuildAction.php
index 7ed97f94..680025cd 100644
--- a/system/libs/pot/IOTS_GuildAction.php
+++ b/system/libs/pot/IOTS_GuildAction.php
@@ -67,5 +67,3 @@ interface IOTS_GuildAction
 }
 
 /**#@-*/
-
-?>
diff --git a/system/libs/pot/OTS_Account.php b/system/libs/pot/OTS_Account.php
index d5b42961..9a6b39a7 100644
--- a/system/libs/pot/OTS_Account.php
+++ b/system/libs/pot/OTS_Account.php
@@ -1198,5 +1198,3 @@ class OTS_Account extends OTS_Row_DAO implements IteratorAggregate, Countable
 }
 
 /**#@-*/
-
-?>
diff --git a/system/libs/pot/OTS_AccountBans_List.php b/system/libs/pot/OTS_AccountBans_List.php
index f3687409..fdd2f923 100644
--- a/system/libs/pot/OTS_AccountBans_List.php
+++ b/system/libs/pot/OTS_AccountBans_List.php
@@ -34,5 +34,3 @@ class OTS_AccountBans_List extends OTS_Bans_List
         $this->setFilter($filter);
     }
 }
-
-?>
diff --git a/system/libs/pot/OTS_Admin.php b/system/libs/pot/OTS_Admin.php
index 3507e10d..7530d6ef 100644
--- a/system/libs/pot/OTS_Admin.php
+++ b/system/libs/pot/OTS_Admin.php
@@ -735,5 +735,3 @@ class OTS_Admin
 }
 
 /**#@-*/
-
-?>
diff --git a/system/libs/pot/OTS_Bans_List.php b/system/libs/pot/OTS_Bans_List.php
index 5f58788e..8eb59df6 100644
--- a/system/libs/pot/OTS_Bans_List.php
+++ b/system/libs/pot/OTS_Bans_List.php
@@ -100,5 +100,3 @@ class OTS_Bans_List extends OTS_Base_List
         }
     }
 }
-
-?>
diff --git a/system/libs/pot/OTS_Base_DB.php b/system/libs/pot/OTS_Base_DB.php
index f97745b4..21d6f756 100644
--- a/system/libs/pot/OTS_Base_DB.php
+++ b/system/libs/pot/OTS_Base_DB.php
@@ -265,5 +265,3 @@ abstract class OTS_Base_DB extends PDO implements IOTS_DB
 }
 
 /**#@-*/
-
-?>
diff --git a/system/libs/pot/OTS_BinaryTools.php b/system/libs/pot/OTS_BinaryTools.php
index 7e6a86e5..84fbf54c 100644
--- a/system/libs/pot/OTS_BinaryTools.php
+++ b/system/libs/pot/OTS_BinaryTools.php
@@ -146,5 +146,3 @@ class OTS_BinaryTools
 }
 
 /**#@-*/
-
-?>
diff --git a/system/libs/pot/OTS_Container.php b/system/libs/pot/OTS_Container.php
index 7b93570f..ff910401 100644
--- a/system/libs/pot/OTS_Container.php
+++ b/system/libs/pot/OTS_Container.php
@@ -149,5 +149,3 @@ class OTS_Container extends OTS_Item implements IteratorAggregate
 }
 
 /**#@-*/
-
-?>
diff --git a/system/libs/pot/OTS_FileLoader.php b/system/libs/pot/OTS_FileLoader.php
index 8f86712e..77f184f3 100644
--- a/system/libs/pot/OTS_FileLoader.php
+++ b/system/libs/pot/OTS_FileLoader.php
@@ -357,5 +357,3 @@ class OTS_FileLoader
 }
 
 /**#@-*/
-
-?>
diff --git a/system/libs/pot/OTS_Group.php b/system/libs/pot/OTS_Group.php
index 19f770f1..d094d365 100644
--- a/system/libs/pot/OTS_Group.php
+++ b/system/libs/pot/OTS_Group.php
@@ -671,5 +671,3 @@ class OTS_Group extends OTS_Row_DAO implements IteratorAggregate, Countable
 }
 
 /**#@-*/
-
-?>
diff --git a/system/libs/pot/OTS_Guild.php b/system/libs/pot/OTS_Guild.php
index 98dd47cf..bab363a8 100644
--- a/system/libs/pot/OTS_Guild.php
+++ b/system/libs/pot/OTS_Guild.php
@@ -837,5 +837,3 @@ class OTS_Guild extends OTS_Row_DAO implements IteratorAggregate, Countable
 }
 
 /**#@-*/
-
-?>
diff --git a/system/libs/pot/OTS_GuildRanks_List.php b/system/libs/pot/OTS_GuildRanks_List.php
index f2f9e57e..aec6114a 100644
--- a/system/libs/pot/OTS_GuildRanks_List.php
+++ b/system/libs/pot/OTS_GuildRanks_List.php
@@ -72,5 +72,3 @@ class OTS_GuildRanks_List extends OTS_Base_List
 }
 
 /**#@-*/
-
-?>
diff --git a/system/libs/pot/OTS_House.php b/system/libs/pot/OTS_House.php
index e6aca322..12a8f1cb 100644
--- a/system/libs/pot/OTS_House.php
+++ b/system/libs/pot/OTS_House.php
@@ -529,5 +529,3 @@ class OTS_House extends OTS_Row_DAO
 }
 
 /**#@-*/
-
-?>
diff --git a/system/libs/pot/OTS_IPBans_List.php b/system/libs/pot/OTS_IPBans_List.php
index dd614e9a..1fdfc0ce 100644
--- a/system/libs/pot/OTS_IPBans_List.php
+++ b/system/libs/pot/OTS_IPBans_List.php
@@ -34,5 +34,3 @@ class OTS_IPBans_List extends OTS_Bans_List
         $this->setFilter($filter);
     }
 }
-
-?>
diff --git a/system/libs/pot/OTS_InfoRespond.php b/system/libs/pot/OTS_InfoRespond.php
index f64fca05..6e452371 100644
--- a/system/libs/pot/OTS_InfoRespond.php
+++ b/system/libs/pot/OTS_InfoRespond.php
@@ -387,5 +387,3 @@ class OTS_InfoRespond extends DOMDocument
 }
 
 /**#@-*/
-
-?>
diff --git a/system/libs/pot/OTS_ItemsList.php b/system/libs/pot/OTS_ItemsList.php
index 1865117a..30465a9d 100644
--- a/system/libs/pot/OTS_ItemsList.php
+++ b/system/libs/pot/OTS_ItemsList.php
@@ -676,5 +676,3 @@ class OTS_ItemsList extends OTS_FileLoader implements IteratorAggregate, Countab
 }
 
 /**#@-*/
-
-?>
diff --git a/system/libs/pot/OTS_MapCoords.php b/system/libs/pot/OTS_MapCoords.php
index dfe1a1cd..738b0bea 100644
--- a/system/libs/pot/OTS_MapCoords.php
+++ b/system/libs/pot/OTS_MapCoords.php
@@ -130,5 +130,3 @@ class OTS_MapCoords
 }
 
 /**#@-*/
-
-?>
diff --git a/system/libs/pot/OTS_MonstersList.php b/system/libs/pot/OTS_MonstersList.php
index fb51a085..f7d1b2da 100644
--- a/system/libs/pot/OTS_MonstersList.php
+++ b/system/libs/pot/OTS_MonstersList.php
@@ -299,5 +299,3 @@ class OTS_MonstersList implements Iterator, Countable, ArrayAccess
 }
 
 /**#@-*/
-
-?>
diff --git a/system/libs/pot/OTS_Player.php b/system/libs/pot/OTS_Player.php
index 2143c12e..7fd96fec 100644
--- a/system/libs/pot/OTS_Player.php
+++ b/system/libs/pot/OTS_Player.php
@@ -3627,5 +3627,3 @@ class OTS_Player extends OTS_Row_DAO
 }
 
 /**#@-*/
-
-?>
diff --git a/system/libs/pot/OTS_PlayerBans_List.php b/system/libs/pot/OTS_PlayerBans_List.php
index 7e06c7ca..f9826f78 100644
--- a/system/libs/pot/OTS_PlayerBans_List.php
+++ b/system/libs/pot/OTS_PlayerBans_List.php
@@ -34,5 +34,3 @@ class OTS_PlayerBans_List extends OTS_Bans_List
         $this->setFilter($filter);
     }
 }
-
-?>
diff --git a/system/libs/pot/OTS_Row_DAO.php b/system/libs/pot/OTS_Row_DAO.php
index c1a09858..2a0a100c 100644
--- a/system/libs/pot/OTS_Row_DAO.php
+++ b/system/libs/pot/OTS_Row_DAO.php
@@ -75,5 +75,3 @@ abstract class OTS_Row_DAO extends OTS_Base_DAO
 }
 
 /**#@-*/
-
-?>
diff --git a/system/libs/pot/OTS_SQLField.php b/system/libs/pot/OTS_SQLField.php
index 2f7ac74e..ba2bb55c 100644
--- a/system/libs/pot/OTS_SQLField.php
+++ b/system/libs/pot/OTS_SQLField.php
@@ -121,5 +121,3 @@ class OTS_SQLField
 }
 
 /**#@-*/
-
-?>
diff --git a/system/libs/pot/OTS_ServerInfo.php b/system/libs/pot/OTS_ServerInfo.php
index eb153c93..fd06749e 100644
--- a/system/libs/pot/OTS_ServerInfo.php
+++ b/system/libs/pot/OTS_ServerInfo.php
@@ -227,5 +227,3 @@ class OTS_ServerInfo
 }
 
 /**#@-*/
-
-?>
diff --git a/system/libs/pot/OTS_Spell.php b/system/libs/pot/OTS_Spell.php
index 0ec51bdf..419ee292 100644
--- a/system/libs/pot/OTS_Spell.php
+++ b/system/libs/pot/OTS_Spell.php
@@ -482,5 +482,3 @@ class OTS_Spell
 }
 
 /**#@-*/
-
-?>
diff --git a/system/libs/pot/OTS_Toolbox.php b/system/libs/pot/OTS_Toolbox.php
index 4d22d0dd..980e5cb5 100644
--- a/system/libs/pot/OTS_Toolbox.php
+++ b/system/libs/pot/OTS_Toolbox.php
@@ -113,5 +113,3 @@ class OTS_Toolbox
 }
 
 /**#@-*/
-
-?>
diff --git a/system/libs/pot/OTS_XTEA.php b/system/libs/pot/OTS_XTEA.php
index 96ee7553..ff5a1095 100644
--- a/system/libs/pot/OTS_XTEA.php
+++ b/system/libs/pot/OTS_XTEA.php
@@ -151,5 +151,3 @@ class OTS_XTEA implements IOTS_Cipher
 }
 
 /**#@-*/
-
-?>
diff --git a/system/libs/rfc6238.php b/system/libs/rfc6238.php
index 579f08f2..5effedd3 100644
--- a/system/libs/rfc6238.php
+++ b/system/libs/rfc6238.php
@@ -282,4 +282,3 @@ class TokenAuth6238 {
 		return $result;
 	}
 }
-?>
diff --git a/system/libs/validator.php b/system/libs/validator.php
index 38db7068..91f71c24 100644
--- a/system/libs/validator.php
+++ b/system/libs/validator.php
@@ -451,4 +451,3 @@ class Validator
 		return self::$lastError;
 	}
 }
-?>
diff --git a/system/locale/de/admin.php b/system/locale/de/admin.php
index 8a128216..dae5fdee 100644
--- a/system/locale/de/admin.php
+++ b/system/locale/de/admin.php
@@ -6,4 +6,3 @@
  * @author Slawkens <slawkens@gmail.com>
  */
 $locale['title'] = 'MyAAC Admin';
-?>
diff --git a/system/locale/de/main.php b/system/locale/de/main.php
index 3f9b2479..e4482572 100644
--- a/system/locale/de/main.php
+++ b/system/locale/de/main.php
@@ -11,5 +11,4 @@ $locale['encoding'] = 'utf-8';
 $locale['direction']= 'ltr';
 
 $locale['error404'] = 'Diese Seite konnte nicht gefunden werden.';
-$locale['news'] = 'Neuesten Nachrichten';
-?>
\ No newline at end of file
+$locale['news'] = 'Neuesten Nachrichten';
\ No newline at end of file
diff --git a/system/locale/en/install.php b/system/locale/en/install.php
index f856dcbf..3de85896 100644
--- a/system/locale/en/install.php
+++ b/system/locale/en/install.php
@@ -131,4 +131,3 @@ $locale['step_finish_title'] = 'Installation finished!';
 $locale['step_finish_desc'] = 'Congratulations! <b>MyAAC</b> is ready to use!<br/>You can now login to $ADMIN_PANEL$, or visit $HOMEPAGE$.<br/><br/>
 <span style="color: red">Please delete install/ directory.</span><br/><br/>
 Post bugs and suggestions at $LINK$, thanks!';
-?>
diff --git a/system/locale/pl/admin.php b/system/locale/pl/admin.php
index 91adfc60..8431b438 100644
--- a/system/locale/pl/admin.php
+++ b/system/locale/pl/admin.php
@@ -6,4 +6,3 @@
  * @author Slawkens <slawkens@gmail.com>
  */
 $locale['title'] = 'MyAAC Admin';
-?>
diff --git a/system/locale/pl/main.php b/system/locale/pl/main.php
index 200bba22..b86b331f 100644
--- a/system/locale/pl/main.php
+++ b/system/locale/pl/main.php
@@ -12,4 +12,4 @@ $locale['direction']= 'ltr';
 
 $locale['error404'] = 'Strona nie została odnaleziona.';
 $locale['news'] = 'Ostatnie newsy';
-$locale['loaded_in_ms'] = 'w $TIME$ ms';
\ No newline at end of file
+$locale['loaded_in_ms'] = 'w $TIME$ ms';
diff --git a/system/locale/pt_br/install.php b/system/locale/pt_br/install.php
index e47faede..3a9ca9cc 100644
--- a/system/locale/pt_br/install.php
+++ b/system/locale/pt_br/install.php
@@ -118,4 +118,3 @@ $locale['step_finish'] = 'Finalizar';
 $locale['step_finish_title'] = 'Instalação terminada!';
 $locale['step_finish_desc'] = 'Parabéns! <b>MyAAC</b> está pronto para uso!<br/>Agora você pode fazer login em $ADMIN_PANEL$ ou visitar $HOMEPAGE$.<br/><br/>
 <span style = "color: red">Por favor remova a pasta install/.</span><br/><br/>Postar bugs e sugestões em $LINK$, obrigado!';
-?>
diff --git a/system/locale/sv/admin.php b/system/locale/sv/admin.php
index 69f4f20a..8fa07f74 100644
--- a/system/locale/sv/admin.php
+++ b/system/locale/sv/admin.php
@@ -6,4 +6,3 @@
  * @author Sizaro <sizaro@live.se>
  */
 $locale['title'] = 'MyAAC Admin';
-?>
diff --git a/system/locale/sv/main.php b/system/locale/sv/main.php
index fc714190..83f6bb84 100644
--- a/system/locale/sv/main.php
+++ b/system/locale/sv/main.php
@@ -12,4 +12,3 @@ $locale['direction']= 'ltr';
 
 $locale['error404'] = 'Sidan kunde inte hittas.';
 $locale['news'] = 'Senaste nyheterna';
-?>
\ No newline at end of file
diff --git a/system/migrations/11.php b/system/migrations/11.php
index dc335577..845f9e67 100644
--- a/system/migrations/11.php
+++ b/system/migrations/11.php
@@ -17,4 +17,3 @@
 			'thumb' => str_replace('/screenshots/', '/gallery/', $item['thumb']),
 		), array('id' => $item['id']));
 	}
-?>
diff --git a/system/migrations/13.php b/system/migrations/13.php
index 71d3735c..4eee77f3 100644
--- a/system/migrations/13.php
+++ b/system/migrations/13.php
@@ -1,4 +1,3 @@
 <?php
 	if($db->hasColumn(TABLE_PREFIX . 'spells', 'spell'))
-		$db->query("ALTER TABLE `" . TABLE_PREFIX . "spells` DROP COLUMN `spell`;");
-?>
\ No newline at end of file
+		$db->query("ALTER TABLE `" . TABLE_PREFIX . "spells` DROP COLUMN `spell`;");
\ No newline at end of file
diff --git a/system/migrations/15.php b/system/migrations/15.php
index 28996d8a..971587ec 100644
--- a/system/migrations/15.php
+++ b/system/migrations/15.php
@@ -8,4 +8,3 @@ if(!$db->hasColumn(TABLE_PREFIX . 'forum_boards', 'guild')) {
 if(!$db->hasColumn(TABLE_PREFIX . 'forum_boards', 'access')) {
 	$db->query("ALTER TABLE `" . TABLE_PREFIX . "forum_boards` ADD `access` TINYINT(1) NOT NULL DEFAULT 0 AFTER `guild`;");
 }
-?>
\ No newline at end of file
diff --git a/system/migrations/17.php b/system/migrations/17.php
index e4b1667c..220bc90b 100644
--- a/system/migrations/17.php
+++ b/system/migrations/17.php
@@ -86,4 +86,3 @@ INSERT INTO `myaac_menu` (`template`, `name`, `link`, `category`, `ordering`) VA
 INSERT INTO `myaac_menu` (`template`, `name`, `link`, `category`, `ordering`) VALUES ('tibiacom', 'Shop History', 'gifts/history', 6, 2);
 	");
 }
-?>
\ No newline at end of file
diff --git a/system/migrations/19.php b/system/migrations/19.php
index 50baa271..81c818d2 100644
--- a/system/migrations/19.php
+++ b/system/migrations/19.php
@@ -1,3 +1,2 @@
 <?php
-// this migration has been removed, but file kept for compability
-?>
\ No newline at end of file
+// this migration has been removed, but file kept for compatibility
diff --git a/system/migrations/2.php b/system/migrations/2.php
index db5fd70f..90d9a610 100644
--- a/system/migrations/2.php
+++ b/system/migrations/2.php
@@ -3,4 +3,3 @@
 	$db->query("ALTER TABLE `" . TABLE_PREFIX . "movies` MODIFY `title` VARCHAR(100) NOT NULL DEFAULT '';");
 	$db->query("ALTER TABLE `" . TABLE_PREFIX . "news` MODIFY `title` VARCHAR(100) NOT NULL DEFAULT '';");
 	$db->query("ALTER TABLE `" . TABLE_PREFIX . "news` MODIFY `body` TEXT NOT NULL DEFAULT '';");
-?>
diff --git a/system/migrations/20.php b/system/migrations/20.php
index 0533b540..d0012fde 100644
--- a/system/migrations/20.php
+++ b/system/migrations/20.php
@@ -45,4 +45,3 @@ function databaseMigration20(&$content = '') {
 	file_put_contents($config_file, $content, FILE_APPEND);
 	return true;
 }
-?>
\ No newline at end of file
diff --git a/system/migrations/4.php b/system/migrations/4.php
index 80bbc4a0..db17feb1 100644
--- a/system/migrations/4.php
+++ b/system/migrations/4.php
@@ -1,4 +1,3 @@
 <?php
 	if(!$db->hasColumn(TABLE_PREFIX . 'monsters', 'id'))
-		$db->query("ALTER TABLE `" . TABLE_PREFIX . "monsters` ADD `id` int(11) NOT NULL AUTO_INCREMENT primary key FIRST;");
-?>
\ No newline at end of file
+		$db->query("ALTER TABLE `" . TABLE_PREFIX . "monsters` ADD `id` int(11) NOT NULL AUTO_INCREMENT primary key FIRST;");
\ No newline at end of file
diff --git a/system/migrations/6.php b/system/migrations/6.php
index ed5329d0..e287d55a 100644
--- a/system/migrations/6.php
+++ b/system/migrations/6.php
@@ -1,4 +1,3 @@
 <?php
 	if(!$db->hasColumn(TABLE_PREFIX . 'hooks', 'enabled'))
-		$db->query("ALTER TABLE `" . TABLE_PREFIX . "hooks` ADD `enabled` INT(1) NOT NULL DEFAULT 1;");
-?>
\ No newline at end of file
+		$db->query("ALTER TABLE `" . TABLE_PREFIX . "hooks` ADD `enabled` INT(1) NOT NULL DEFAULT 1;");
\ No newline at end of file
diff --git a/system/migrations/8.php b/system/migrations/8.php
index a04331a8..4785e23b 100644
--- a/system/migrations/8.php
+++ b/system/migrations/8.php
@@ -14,5 +14,4 @@
 		
 		foreach($boards as $id => $board)
 			$db->query('UPDATE `' . TABLE_PREFIX . 'forum_boards` SET `ordering` = ' . $id . ' WHERE `name` = ' . $db->quote($board));
-	}
-?>
\ No newline at end of file
+	}
\ No newline at end of file
diff --git a/system/pages/account/change_email.php b/system/pages/account/change_email.php
index 2368a284..3bc8edd7 100644
--- a/system/pages/account/change_email.php
+++ b/system/pages/account/change_email.php
@@ -166,4 +166,3 @@ if(isset($_POST['emailchangecancel']) && $_POST['emailchangecancel'] == 1) {
 		'custom_buttons' => $custom_buttons
 	));
 }
-?>
diff --git a/system/pages/account/change_name.php b/system/pages/account/change_name.php
index ab7bd326..448e730c 100644
--- a/system/pages/account/change_name.php
+++ b/system/pages/account/change_name.php
@@ -112,5 +112,3 @@ else
 		));
 	}
 }
-
-?>
diff --git a/system/pages/account/change_sex.php b/system/pages/account/change_sex.php
index c67ac608..868cf24f 100644
--- a/system/pages/account/change_sex.php
+++ b/system/pages/account/change_sex.php
@@ -91,5 +91,3 @@ else
 		));
 	}
 }
-
-?>
diff --git a/system/pages/account/lost.php b/system/pages/account/lost.php
index a474540c..3ea0957e 100644
--- a/system/pages/account/lost.php
+++ b/system/pages/account/lost.php
@@ -546,4 +546,3 @@ elseif($action == 'setnewpassword')
 				' . $twig->render('buttons.submit.html.twig') . '</div>
 				</TD></TR></FORM></TABLE></TABLE>';
 }
-?>
diff --git a/system/pages/bugtracker.php b/system/pages/bugtracker.php
index a7cffcf0..ac37becd 100644
--- a/system/pages/bugtracker.php
+++ b/system/pages/bugtracker.php
@@ -339,4 +339,3 @@ $showed = $post = $reply = false;
     {
         echo '<br><br><a href="?subtopic=bugtracker&control=true">[ADMIN PANEL]</a>';
     }
-?>
diff --git a/system/pages/faq.php b/system/pages/faq.php
index f30e7914..5d71aa3c 100644
--- a/system/pages/faq.php
+++ b/system/pages/faq.php
@@ -185,4 +185,3 @@ class FAQ
 		return !count($errors);
 	}
 }
-?>
diff --git a/system/pages/forum/edit_post.php b/system/pages/forum/edit_post.php
index 45fd675b..d3f95c45 100644
--- a/system/pages/forum/edit_post.php
+++ b/system/pages/forum/edit_post.php
@@ -114,5 +114,3 @@ if(Forum::canPost($account_logged))
 }
 else
 	echo "<br/>Your account is banned, deleted or you don't have any player with level " . $config['forum_level_required'] . " on your account. You can't post.";
-
-?>
diff --git a/system/pages/forum/new_thread.php b/system/pages/forum/new_thread.php
index 4db06c63..c3b688ad 100644
--- a/system/pages/forum/new_thread.php
+++ b/system/pages/forum/new_thread.php
@@ -103,5 +103,3 @@ if(Forum::canPost($account_logged))
 }
 else
 	echo 'Your account is banned, deleted or you don\'t have any player with level '.$config['forum_level_required'].' on your account. You can\'t post.';
-
-?>
diff --git a/system/pages/gallery.php b/system/pages/gallery.php
index c893ce90..b6e2b07f 100644
--- a/system/pages/gallery.php
+++ b/system/pages/gallery.php
@@ -312,4 +312,3 @@ class Gallery
 		return !count($errors);
 	}
 }
-?>
diff --git a/system/pages/guilds/change_description.php b/system/pages/guilds/change_description.php
index b4e787ee..9f6fc0dc 100644
--- a/system/pages/guilds/change_description.php
+++ b/system/pages/guilds/change_description.php
@@ -72,5 +72,3 @@ if(!empty($errors)) {
 		'action' => '?subtopic=guilds'
 	));
 }
-
-?>
diff --git a/system/pages/guilds/change_motd.php b/system/pages/guilds/change_motd.php
index c777548d..84581485 100644
--- a/system/pages/guilds/change_motd.php
+++ b/system/pages/guilds/change_motd.php
@@ -75,5 +75,3 @@ if(!empty($errors)) {
 		'action' => '?subtopic=guilds'
 	));
 }
-
-?>
diff --git a/system/pages/guilds/cleanup_players.php b/system/pages/guilds/cleanup_players.php
index 30b1e8af..61b1ce49 100644
--- a/system/pages/guilds/cleanup_players.php
+++ b/system/pages/guilds/cleanup_players.php
@@ -68,4 +68,3 @@ else
 	echo "0 players found.";
 
 $twig->display('guilds.back_button.html.twig');
-?>
diff --git a/system/pages/guilds/delete_by_admin.php b/system/pages/guilds/delete_by_admin.php
index 3e083c8a..7da54aea 100644
--- a/system/pages/guilds/delete_by_admin.php
+++ b/system/pages/guilds/delete_by_admin.php
@@ -66,5 +66,3 @@ if(!empty($errors)) {
 		'action' => '?subtopic=guilds'
 	));
 }
-
-?>
diff --git a/system/pages/guilds/delete_rank.php b/system/pages/guilds/delete_rank.php
index 6a8f642c..48eeba4d 100644
--- a/system/pages/guilds/delete_rank.php
+++ b/system/pages/guilds/delete_rank.php
@@ -125,5 +125,3 @@ if(!empty($guild_errors)) {
 		'action' => '?subtopic=guilds'
 	));
 }
-
-?>
diff --git a/system/pages/guilds/leave.php b/system/pages/guilds/leave.php
index 892deb89..9a11595d 100644
--- a/system/pages/guilds/leave.php
+++ b/system/pages/guilds/leave.php
@@ -114,5 +114,3 @@ else
 		));
 	}
 }
-
-?>
\ No newline at end of file
diff --git a/system/pages/guilds/pass_leadership.php b/system/pages/guilds/pass_leadership.php
index 462ac9ec..d5f0ed20 100644
--- a/system/pages/guilds/pass_leadership.php
+++ b/system/pages/guilds/pass_leadership.php
@@ -117,5 +117,3 @@ if(!empty($guild_errors)) {
 
 	echo '<br/><div style="text-align:center"><form action="?subtopic=guilds" method="post">' . $twig->render('buttons.back.html.twig') . '</form></div>';
 }
-
-?>
diff --git a/system/pages/polls.php b/system/pages/polls.php
index c31b61cb..dcc781c2 100644
--- a/system/pages/polls.php
+++ b/system/pages/polls.php
@@ -369,4 +369,3 @@ function getColorByPercent($percent)
         echo 'This poll doesn\'t exist.<br>';
         echo '<div class=\'hr1\'></div><a href="?subtopic='.$link.'"><span style="font-size: 13px"><b>Go to list of  polls</b></span></a>';
     }
-?>
diff --git a/system/pages/server_info.php b/system/pages/server_info.php
index 7c2a519e..b750c3ee 100644
--- a/system/pages/server_info.php
+++ b/system/pages/server_info.php
@@ -108,6 +108,3 @@ $twig->display('serverinfo.html.twig', array(
     'finalBanishmentLength' => isset($config['lua']['final_banishment_length']) ? eval('return (' . $config['lua']['final_banishment_length'] . ') / (24 * 60 * 60);') : null,
     'ipBanishmentLength' => isset($config['lua']['ip_banishment_length']) ? eval('return (' . $config['lua']['ip_banishment_length'] . ') / (24 * 60 * 60);') : null,
 ));
-?>
-
-
diff --git a/system/pages/team.php b/system/pages/team.php
index 2e410e12..fbc0df99 100644
--- a/system/pages/team.php
+++ b/system/pages/team.php
@@ -74,4 +74,3 @@ foreach($groupList as $id => $group)
 $twig->display('team.html.twig', array(
 	'groupmember' => $groupMember
 ));
-?>
\ No newline at end of file
diff --git a/templates/tibiacom/index.php b/templates/tibiacom/index.php
index 989a05ca..539453c9 100644
--- a/templates/tibiacom/index.php
+++ b/templates/tibiacom/index.php
@@ -459,4 +459,3 @@ function logo_monster()
 	global $config;
 	return str_replace(" ", "", trim(strtolower($config['logo_monster'])));
 }
-?>
diff --git a/tools/news_preview.php b/tools/news_preview.php
index 7fa1e125..a1709e81 100644
--- a/tools/news_preview.php
+++ b/tools/news_preview.php
@@ -112,5 +112,3 @@ function error_($desc) {
 	));
 	exit();
 }
-
-?>
\ No newline at end of file
diff --git a/tools/signature/gesior.php b/tools/signature/gesior.php
index d3b4edce..a9b88a25 100644
--- a/tools/signature/gesior.php
+++ b/tools/signature/gesior.php
@@ -12,7 +12,7 @@
 	$vocation = 'Unknown vocation';
 	if(isset($config['vocations'][$player->getVocation()]))
 		$vocation = $config['vocations'][$player->getVocation()];
-	
+
 	imagettftext($image , $fontsize, 0, 20, 52, $color, $font, 'Level:');
 	imagettftext($image , $fontsize, 0, 70, 52, $color, $font, $player->getLevel() . ' ' . $vocation);
 
@@ -26,4 +26,3 @@
 	imagettftext($image , $fontsize, 0, 100, 95, $color, $font, (($player->getLastLogin() > 0) ? date("j F Y, g:i a", $player->getLastLogin()) : 'Never logged in.'));
 	imagepng($image, SIGNATURES_CACHE . $player->getID() . '.png');
 	imagedestroy($image);
-?>
\ No newline at end of file
diff --git a/tools/signature/mango.php b/tools/signature/mango.php
index acdf37b3..f00f7f18 100644
--- a/tools/signature/mango.php
+++ b/tools/signature/mango.php
@@ -168,4 +168,3 @@
 	}
 
 	$MadGD->save($player->getID());
-?>