Skip to content

Commit

Permalink
refactor: page generation time considers real time
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
martinambrus committed Nov 18, 2017
1 parent fffedc4 commit 997c143
Show file tree
Hide file tree
Showing 23 changed files with 48 additions and 24 deletions.
2 changes: 2 additions & 0 deletions Templates/menu.tpl
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?php
include_once("GameEngine/Generator.php");
$start_timer = $generator->pageLoadTimeStart();

/** --------------------------------------------------- **\
| ********* DO NOT REMOVE THIS COPYRIGHT NOTICE ********* |
Expand Down
4 changes: 3 additions & 1 deletion a2b.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
<?php
include_once("GameEngine/Generator.php");
$start_timer = $generator->pageLoadTimeStart();

#################################################################################
## -= YOU MAY NOT REMOVE OR CHANGE THIS NOTICE =- ##
## --------------------------------------------------------------------------- ##
Expand All @@ -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'])) {
Expand Down
3 changes: 2 additions & 1 deletion a2b2.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?php
include_once("GameEngine/Generator.php");
$start_timer = $generator->pageLoadTimeStart();

#################################################################################
## -= YOU MAY NOT REMOVE OR CHANGE THIS NOTICE =- ##
Expand All @@ -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']);
Expand Down
4 changes: 3 additions & 1 deletion allianz.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
<?php
include_once("GameEngine/Generator.php");
$start_timer = $generator->pageLoadTimeStart();

//fix by ronix
use App\Utils\AccessLogger;

Expand All @@ -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'];
Expand Down
3 changes: 2 additions & 1 deletion banned.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?php
include_once("GameEngine/Generator.php");
$start_timer = $generator->pageLoadTimeStart();

#################################################################################
## -= YOU MAY NOT REMOVE OR CHANGE THIS NOTICE =- ##
Expand All @@ -14,7 +16,6 @@
include_once("GameEngine/Village.php");
AccessLogger::logRequest();

$start_timer = $generator->pageLoadTimeStart();
if($session->access == BANNED){
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
Expand Down
3 changes: 2 additions & 1 deletion berichte.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?php
include_once("GameEngine/Generator.php");
$start_timer = $generator->pageLoadTimeStart();

#################################################################################
## -= YOU MAY NOT REMOVE OR CHANGE THIS NOTICE =- ##
Expand All @@ -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'])) {
Expand Down
4 changes: 2 additions & 2 deletions create_account.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?php
include_once("GameEngine/Generator.php");
$start_timer = $generator->pageLoadTimeStart();

#################################################################################
## -= YOU MAY NOT REMOVE OR CHANGE THIS NOTICE =- ##
Expand Down Expand Up @@ -45,8 +47,6 @@
die("Access Denied: You are not Admin!");
}else{

$start_timer = $generator->pageLoadTimeStart();

?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
Expand Down
2 changes: 2 additions & 0 deletions crop_finder.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?php
include_once("GameEngine/Generator.php");
$start_timer = $generator->pageLoadTimeStart();

/*-------------------------------------------------------*\
| ********* DO NOT REMOVE THIS COPYRIGHT NOTICE ********* |
Expand Down
3 changes: 2 additions & 1 deletion dorf1.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?php
include_once("GameEngine/Generator.php");
$start_timer = $generator->pageLoadTimeStart();

#################################################################################
## -= YOU MAY NOT REMOVE OR CHANGE THIS NOTICE =- ##
Expand All @@ -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';
}
Expand Down
3 changes: 2 additions & 1 deletion dorf2.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?php
include_once("GameEngine/Generator.php");
$start_timer = $generator->pageLoadTimeStart();

#################################################################################
## -= YOU MAY NOT REMOVE OR CHANGE THIS NOTICE =- ##
Expand All @@ -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);
Expand Down
3 changes: 2 additions & 1 deletion dorf3.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?php
include_once("GameEngine/Generator.php");
$start_timer = $generator->pageLoadTimeStart();

#################################################################################
## -= YOU MAY NOT REMOVE OR CHANGE THIS NOTICE =- ##
Expand All @@ -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);
Expand Down
3 changes: 2 additions & 1 deletion karte.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?php
include_once("GameEngine/Generator.php");
$start_timer = $generator->pageLoadTimeStart();

#################################################################################
## -= YOU MAY NOT REMOVE OR CHANGE THIS NOTICE =- ##
Expand All @@ -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'])){
Expand Down
3 changes: 2 additions & 1 deletion logout.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?php
include_once("GameEngine/Generator.php");
$start_timer = $generator->pageLoadTimeStart();

#################################################################################
## -= YOU MAY NOT REMOVE OR CHANGE THIS NOTICE =- ##
Expand All @@ -16,7 +18,6 @@
include("GameEngine/Account.php");
AccessLogger::logRequest();

$start_timer = $generator->pageLoadTimeStart();
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
Expand Down
3 changes: 2 additions & 1 deletion nachrichten.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?php
include_once("GameEngine/Generator.php");
$start_timer = $generator->pageLoadTimeStart();

#################################################################################
## -= YOU MAY NOT REMOVE OR CHANGE THIS NOTICE =- ##
Expand All @@ -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();
Expand Down
3 changes: 2 additions & 1 deletion packages.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?php
include_once("GameEngine/Generator.php");
$start_timer = $generator->pageLoadTimeStart();

#################################################################################
## -= YOU MAY NOT REMOVE OR CHANGE THIS NOTICE =- ##
Expand All @@ -14,7 +16,6 @@
include_once("GameEngine/Village.php");
AccessLogger::logRequest();

$start_timer = $generator->pageLoadTimeStart();
$id = $_GET['id'];
if($session->access != BANNED){
?>
Expand Down
3 changes: 2 additions & 1 deletion plus.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?php
include_once("GameEngine/Generator.php");
$start_timer = $generator->pageLoadTimeStart();

#################################################################################
## -= YOU MAY NOT REMOVE OR CHANGE THIS NOTICE =- ##
Expand All @@ -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']);
Expand Down
3 changes: 2 additions & 1 deletion plus1.php
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
<?php
include_once("GameEngine/Generator.php");
$start_timer = $generator->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']);
Expand Down
3 changes: 2 additions & 1 deletion rules.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?php
include_once("GameEngine/Generator.php");
$start_timer = $generator->pageLoadTimeStart();

#################################################################################
## -= YOU MAY NOT REMOVE OR CHANGE THIS NOTICE =- ##
Expand All @@ -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']);
Expand Down
3 changes: 2 additions & 1 deletion spieler.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?php
include_once("GameEngine/Generator.php");
$start_timer = $generator->pageLoadTimeStart();

#################################################################################
## -= YOU MAY NOT REMOVE OR CHANGE THIS NOTICE =- ##
Expand All @@ -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'])) {
Expand Down
3 changes: 2 additions & 1 deletion support.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?php
include_once("GameEngine/Generator.php");
$start_timer = $generator->pageLoadTimeStart();

#################################################################################
## -= YOU MAY NOT REMOVE OR CHANGE THIS NOTICE =- ##
Expand All @@ -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']);
Expand Down
4 changes: 2 additions & 2 deletions version.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?php
include_once("GameEngine/Generator.php");
$start_timer = $generator->pageLoadTimeStart();

#################################################################################
## -= YOU MAY NOT REMOVE OR CHANGE THIS NOTICE =- ##
Expand All @@ -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']);
Expand Down
4 changes: 2 additions & 2 deletions warsim.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?php
include_once("GameEngine/Generator.php");
$start_timer = $generator->pageLoadTimeStart();

#################################################################################
## -= YOU MAY NOT REMOVE OR CHANGE THIS NOTICE =- ##
Expand All @@ -10,13 +12,11 @@
## ##
#################################################################################


use App\Utils\AccessLogger;

include_once("GameEngine/Village.php");
AccessLogger::logRequest();

$start_timer = $generator->pageLoadTimeStart();
$battle->procSim($_POST);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
Expand Down
3 changes: 2 additions & 1 deletion winner.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?php
include_once("GameEngine/Generator.php");
$start_timer = $generator->pageLoadTimeStart();

#################################################################################
## -= YOU MAY NOT REMOVE OR CHANGE THIS NOTICE =- ##
Expand Down Expand Up @@ -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']);
Expand Down

0 comments on commit 997c143

Please sign in to comment.