From 997c14363481657070a3526ae9ed16e1f38e0081 Mon Sep 17 00:00:00 2001 From: Martin Ambrus Date: Sat, 18 Nov 2017 18:48:48 +0100 Subject: [PATCH] refactor: page generation time considers real time Because in environments with $_SERVER["REQUEST_TIME_FLOAT"] unavailable the time actually only started after Village.php got loaded (which was AFTER Automation.php kicked in and everything was already DB-loaded), the start timer was moved more towards the top of each template. --- Templates/menu.tpl | 2 ++ a2b.php | 4 +++- a2b2.php | 3 ++- allianz.php | 4 +++- banned.php | 3 ++- berichte.php | 3 ++- create_account.php | 4 ++-- crop_finder.php | 2 ++ dorf1.php | 3 ++- dorf2.php | 3 ++- dorf3.php | 3 ++- karte.php | 3 ++- logout.php | 3 ++- nachrichten.php | 3 ++- packages.php | 3 ++- plus.php | 3 ++- plus1.php | 3 ++- rules.php | 3 ++- spieler.php | 3 ++- support.php | 3 ++- version.php | 4 ++-- warsim.php | 4 ++-- winner.php | 3 ++- 23 files changed, 48 insertions(+), 24 deletions(-) diff --git a/Templates/menu.tpl b/Templates/menu.tpl index 303fafbf..1b2055d1 100644 --- a/Templates/menu.tpl +++ b/Templates/menu.tpl @@ -1,4 +1,6 @@ pageLoadTimeStart(); /** --------------------------------------------------- **\ | ********* DO NOT REMOVE THIS COPYRIGHT NOTICE ********* | diff --git a/a2b.php b/a2b.php index fd0dcbfd..9a833b81 100644 --- a/a2b.php +++ b/a2b.php @@ -1,4 +1,7 @@ pageLoadTimeStart(); + ################################################################################# ## -= YOU MAY NOT REMOVE OR CHANGE THIS NOTICE =- ## ## --------------------------------------------------------------------------- ## @@ -14,7 +17,6 @@ include_once("GameEngine/Village.php"); AccessLogger::logRequest(); -$start_timer = $generator->pageLoadTimeStart(); if(isset($_GET['newdid'])) { $_SESSION['wid'] = $_GET['newdid']; if(isset($_GET['w'])) { diff --git a/a2b2.php b/a2b2.php index 845f11b6..4f4da176 100644 --- a/a2b2.php +++ b/a2b2.php @@ -1,4 +1,6 @@ pageLoadTimeStart(); ################################################################################# ## -= YOU MAY NOT REMOVE OR CHANGE THIS NOTICE =- ## @@ -16,7 +18,6 @@ AccessLogger::logRequest(); $amount = $_SESSION['amount']; -$start_timer = $generator->pageLoadTimeStart(); if(isset($_GET['newdid'])) { $_SESSION['wid'] = $_GET['newdid']; header("Location: ".$_SERVER['PHP_SELF']); diff --git a/allianz.php b/allianz.php index f4338a1e..d00ba1fa 100644 --- a/allianz.php +++ b/allianz.php @@ -1,4 +1,7 @@ pageLoadTimeStart(); + //fix by ronix use App\Utils\AccessLogger; @@ -7,7 +10,6 @@ include_once("GameEngine/Chat.php"); AccessLogger::logRequest(); -$start_timer = $generator->pageLoadTimeStart(); $alliance->procAlliance($_GET); if(isset($_GET['newdid'])) { $_SESSION['wid'] = $_GET['newdid']; diff --git a/banned.php b/banned.php index 451adf4b..7ec31782 100644 --- a/banned.php +++ b/banned.php @@ -1,4 +1,6 @@ pageLoadTimeStart(); ################################################################################# ## -= YOU MAY NOT REMOVE OR CHANGE THIS NOTICE =- ## @@ -14,7 +16,6 @@ include_once("GameEngine/Village.php"); AccessLogger::logRequest(); -$start_timer = $generator->pageLoadTimeStart(); if($session->access == BANNED){ ?> diff --git a/berichte.php b/berichte.php index 18cd19bc..46fcf6a5 100644 --- a/berichte.php +++ b/berichte.php @@ -1,4 +1,6 @@ pageLoadTimeStart(); ################################################################################# ## -= YOU MAY NOT REMOVE OR CHANGE THIS NOTICE =- ## @@ -15,7 +17,6 @@ include_once("GameEngine/Village.php"); AccessLogger::logRequest(); -$start_timer = $generator->pageLoadTimeStart(); $message->noticeType($_GET); $message->procNotice($_POST); if(isset($_GET['newdid'])) { diff --git a/create_account.php b/create_account.php index 506348ac..ec94b1b2 100644 --- a/create_account.php +++ b/create_account.php @@ -1,4 +1,6 @@ pageLoadTimeStart(); ################################################################################# ## -= YOU MAY NOT REMOVE OR CHANGE THIS NOTICE =- ## @@ -45,8 +47,6 @@ die("Access Denied: You are not Admin!"); }else{ -$start_timer = $generator->pageLoadTimeStart(); - ?> diff --git a/crop_finder.php b/crop_finder.php index aa435b30..e3a4fbc0 100644 --- a/crop_finder.php +++ b/crop_finder.php @@ -1,4 +1,6 @@ pageLoadTimeStart(); /*-------------------------------------------------------*\ | ********* DO NOT REMOVE THIS COPYRIGHT NOTICE ********* | diff --git a/dorf1.php b/dorf1.php index 6e84874e..c292b8a3 100644 --- a/dorf1.php +++ b/dorf1.php @@ -1,4 +1,6 @@ pageLoadTimeStart(); ################################################################################# ## -= YOU MAY NOT REMOVE OR CHANGE THIS NOTICE =- ## @@ -14,7 +16,6 @@ include_once("GameEngine/Village.php"); AccessLogger::logRequest(); -$start_timer = $generator->pageLoadTimeStart(); if(isset($_GET['ok'])){ $database->updateUserField($session->uid,'ok','0','1'); $_SESSION['ok'] = '0'; } diff --git a/dorf2.php b/dorf2.php index cf9c80be..99f9d3df 100644 --- a/dorf2.php +++ b/dorf2.php @@ -1,4 +1,6 @@ pageLoadTimeStart(); ################################################################################# ## -= YOU MAY NOT REMOVE OR CHANGE THIS NOTICE =- ## @@ -14,7 +16,6 @@ include_once("GameEngine/Village.php"); AccessLogger::logRequest(); -$start_timer = $generator->pageLoadTimeStart(); if(isset($_GET['newdid'])) { $_SESSION['wid'] = $_GET['newdid']; $database->query("UPDATE ".TB_PREFIX."users SET village_select=".$database->escape((int) $_GET['newdid'])." WHERE id=".$session->uid); diff --git a/dorf3.php b/dorf3.php index c0793fd3..f84b3d44 100644 --- a/dorf3.php +++ b/dorf3.php @@ -1,4 +1,6 @@ pageLoadTimeStart(); ################################################################################# ## -= YOU MAY NOT REMOVE OR CHANGE THIS NOTICE =- ## @@ -16,7 +18,6 @@ include_once("GameEngine/Village.php"); AccessLogger::logRequest(); -$start_timer = $generator->pageLoadTimeStart(); if(isset($_GET['newdid'])) { $_SESSION['wid'] = $_GET['newdid']; $database->query("UPDATE ".TB_PREFIX."users SET village_select=".$database->escape((int) $_GET['newdid'])." WHERE id=".$session->uid); diff --git a/karte.php b/karte.php index 700c8c99..6d63ec5e 100644 --- a/karte.php +++ b/karte.php @@ -1,4 +1,6 @@ pageLoadTimeStart(); ################################################################################# ## -= YOU MAY NOT REMOVE OR CHANGE THIS NOTICE =- ## @@ -16,7 +18,6 @@ include_once("GameEngine/Village.php"); AccessLogger::logRequest(); -$start_timer = $generator->pageLoadTimeStart(); if(isset($_GET['newdid'])) { $_SESSION['wid'] = $_GET['newdid']; if(isset($_GET['d']) && isset($_GET['c'])){ diff --git a/logout.php b/logout.php index 446017e5..688331f4 100644 --- a/logout.php +++ b/logout.php @@ -1,4 +1,6 @@ pageLoadTimeStart(); ################################################################################# ## -= YOU MAY NOT REMOVE OR CHANGE THIS NOTICE =- ## @@ -16,7 +18,6 @@ include("GameEngine/Account.php"); AccessLogger::logRequest(); -$start_timer = $generator->pageLoadTimeStart(); ?> diff --git a/nachrichten.php b/nachrichten.php index 7c4b65a2..9b0fb3d0 100644 --- a/nachrichten.php +++ b/nachrichten.php @@ -1,4 +1,6 @@ pageLoadTimeStart(); ################################################################################# ## -= YOU MAY NOT REMOVE OR CHANGE THIS NOTICE =- ## @@ -16,7 +18,6 @@ include_once( "GameEngine/Village.php" ); AccessLogger::logRequest(); -$start_timer = $generator->pageLoadTimeStart(); $message->procMessage( $_POST ); if ( isset( $_GET['t'] ) && $_GET['t'] == 1 ) { $automation->isWinner(); diff --git a/packages.php b/packages.php index 6ed82e70..c19c7d25 100644 --- a/packages.php +++ b/packages.php @@ -1,4 +1,6 @@ pageLoadTimeStart(); ################################################################################# ## -= YOU MAY NOT REMOVE OR CHANGE THIS NOTICE =- ## @@ -14,7 +16,6 @@ include_once("GameEngine/Village.php"); AccessLogger::logRequest(); -$start_timer = $generator->pageLoadTimeStart(); $id = $_GET['id']; if($session->access != BANNED){ ?> diff --git a/plus.php b/plus.php index 5f20e8ff..4e363056 100644 --- a/plus.php +++ b/plus.php @@ -1,4 +1,6 @@ pageLoadTimeStart(); ################################################################################# ## -= YOU MAY NOT REMOVE OR CHANGE THIS NOTICE =- ## @@ -16,7 +18,6 @@ include_once("GameEngine/Village.php"); AccessLogger::logRequest(); -$start_timer = $generator->pageLoadTimeStart(); if(isset($_GET['newdid'])) { $_SESSION['wid'] = $_GET['newdid']; header("Location: ".$_SERVER['PHP_SELF']); diff --git a/plus1.php b/plus1.php index 5c06e636..52e871bd 100644 --- a/plus1.php +++ b/plus1.php @@ -1,11 +1,12 @@ pageLoadTimeStart(); use App\Utils\AccessLogger; include_once("GameEngine/Village.php"); AccessLogger::logRequest(); -$start_timer = $generator->pageLoadTimeStart(); if(isset($_GET['newdid'])) { $_SESSION['wid'] = $_GET['newdid']; header("Location: ".$_SERVER['PHP_SELF']); diff --git a/rules.php b/rules.php index 641b2661..badbcd7a 100644 --- a/rules.php +++ b/rules.php @@ -1,4 +1,6 @@ pageLoadTimeStart(); ################################################################################# ## -= YOU MAY NOT REMOVE OR CHANGE THIS NOTICE =- ## @@ -16,7 +18,6 @@ include_once("GameEngine/Village.php"); AccessLogger::logRequest(); -$start_timer = $generator->pageLoadTimeStart(); if(isset($_GET['newdid'])) { $_SESSION['wid'] = $_GET['newdid']; header("Location: ".$_SERVER['PHP_SELF']); diff --git a/spieler.php b/spieler.php index 91de6ad8..b74b6e35 100644 --- a/spieler.php +++ b/spieler.php @@ -1,4 +1,6 @@ pageLoadTimeStart(); ################################################################################# ## -= YOU MAY NOT REMOVE OR CHANGE THIS NOTICE =- ## @@ -15,7 +17,6 @@ include_once("GameEngine/Village.php"); AccessLogger::logRequest(); -$start_timer = $generator->pageLoadTimeStart(); $profile->procProfile($_POST); $profile->procSpecial($_GET); if(isset($_GET['newdid'])) { diff --git a/support.php b/support.php index ae074a65..8a6db41e 100644 --- a/support.php +++ b/support.php @@ -1,4 +1,6 @@ pageLoadTimeStart(); ################################################################################# ## -= YOU MAY NOT REMOVE OR CHANGE THIS NOTICE =- ## @@ -15,7 +17,6 @@ AccessLogger::logRequest(); $amount = $_SESSION['amount']; -$start_timer = $generator->pageLoadTimeStart(); if(isset($_GET['newdid'])) { $_SESSION['wid'] = $_GET['newdid']; header("Location: ".$_SERVER['PHP_SELF']); diff --git a/version.php b/version.php index 216cbc98..052caa9e 100644 --- a/version.php +++ b/version.php @@ -1,4 +1,6 @@ pageLoadTimeStart(); ################################################################################# ## -= YOU MAY NOT REMOVE OR CHANGE THIS NOTICE =- ## @@ -10,14 +12,12 @@ ## ## ################################################################################# - use App\Utils\AccessLogger; include_once("GameEngine/Village.php"); AccessLogger::logRequest(); $amount = $_SESSION['amount']; -$start_timer = $generator->pageLoadTimeStart(); if(isset($_GET['newdid'])) { $_SESSION['wid'] = $_GET['newdid']; header("Location: ".$_SERVER['PHP_SELF']); diff --git a/warsim.php b/warsim.php index 02e2bc72..fad9e330 100644 --- a/warsim.php +++ b/warsim.php @@ -1,4 +1,6 @@ pageLoadTimeStart(); ################################################################################# ## -= YOU MAY NOT REMOVE OR CHANGE THIS NOTICE =- ## @@ -10,13 +12,11 @@ ## ## ################################################################################# - use App\Utils\AccessLogger; include_once("GameEngine/Village.php"); AccessLogger::logRequest(); -$start_timer = $generator->pageLoadTimeStart(); $battle->procSim($_POST); ?> diff --git a/winner.php b/winner.php index 6eb6c4a7..c16f3e95 100644 --- a/winner.php +++ b/winner.php @@ -1,4 +1,6 @@ pageLoadTimeStart(); ################################################################################# ## -= YOU MAY NOT REMOVE OR CHANGE THIS NOTICE =- ## @@ -31,7 +33,6 @@ function mysqli_result($res, $row, $field=0) { include_once("GameEngine/Village.php"); AccessLogger::logRequest(); -$start_timer = $generator->pageLoadTimeStart(); if(isset($_GET['newdid'])) { $_SESSION['wid'] = $_GET['newdid']; header("Location: ".$_SERVER['PHP_SELF']);