From 1c53b2efb7b21c48cdcf1de8a7d765161543f281 Mon Sep 17 00:00:00 2001 From: smiba Date: Wed, 21 Feb 2018 14:27:49 +0100 Subject: [PATCH 1/3] For coins with constant difficulty change MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Do not show in x amount of blocks, if the coin’s difficulty changes on every block --- templates/bootstrap/dashboard/round_statistics/pplns/round.tpl | 2 +- templates/bootstrap/dashboard/round_statistics/pps/round.tpl | 2 +- templates/bootstrap/dashboard/round_statistics/prop/round.tpl | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/templates/bootstrap/dashboard/round_statistics/pplns/round.tpl b/templates/bootstrap/dashboard/round_statistics/pplns/round.tpl index 234e31ce..dfa26040 100644 --- a/templates/bootstrap/dashboard/round_statistics/pplns/round.tpl +++ b/templates/bootstrap/dashboard/round_statistics/pplns/round.tpl @@ -70,7 +70,7 @@

{if $GLOBAL.nethashrate > 0}{$NETWORK.EstNextDifficulty|number_format:"8"}{else}n/a{/if}

-

Est Next Difficulty{if $GLOBAL.nethashrate > 0}
Change in {$NETWORK.BlocksUntilDiffChange} Blocks{else}No Estimates{/if}

+

Est. Next Difficulty{if $GLOBAL.config.coindiffchangetarget > 1}{if $GLOBAL.nethashrate > 0}
Change in {$NETWORK.BlocksUntilDiffChange} Blocks{else}No Estimates{/if}{/if}

diff --git a/templates/bootstrap/dashboard/round_statistics/pps/round.tpl b/templates/bootstrap/dashboard/round_statistics/pps/round.tpl index 7fc95e6c..7ed86472 100644 --- a/templates/bootstrap/dashboard/round_statistics/pps/round.tpl +++ b/templates/bootstrap/dashboard/round_statistics/pps/round.tpl @@ -130,7 +130,7 @@

{if $GLOBAL.nethashrate > 0}{$NETWORK.EstNextDifficulty|number_format:"8"}{else}n/a{/if}

-

Est Next Difficulty{if $GLOBAL.nethashrate > 0}
Change in {$NETWORK.BlocksUntilDiffChange} Blocks{else}No Estimates{/if}

+

Est. Next Difficulty{if $GLOBAL.config.coindiffchangetarget > 1}{if $GLOBAL.nethashrate > 0}
Change in {$NETWORK.BlocksUntilDiffChange} Blocks{else}No Estimates{/if}{/if}

diff --git a/templates/bootstrap/dashboard/round_statistics/prop/round.tpl b/templates/bootstrap/dashboard/round_statistics/prop/round.tpl index 1fe67f59..8ea54a2e 100644 --- a/templates/bootstrap/dashboard/round_statistics/prop/round.tpl +++ b/templates/bootstrap/dashboard/round_statistics/prop/round.tpl @@ -70,7 +70,7 @@

{if $GLOBAL.nethashrate > 0}{$NETWORK.EstNextDifficulty|number_format:"8"}{else}n/a{/if}

-

Est Next Difficulty{if $GLOBAL.nethashrate > 0}
Change in {$NETWORK.BlocksUntilDiffChange} Blocks{else}No Estimates{/if}

+

Est. Next Difficulty{if $GLOBAL.config.coindiffchangetarget > 1}{if $GLOBAL.nethashrate > 0}
Change in {$NETWORK.BlocksUntilDiffChange} Blocks{else}No Estimates{/if}{/if}

From 85ef9d521caf53cae64bff13c8e3afd2c3313040 Mon Sep 17 00:00:00 2001 From: smiba Date: Wed, 21 Feb 2018 14:31:58 +0100 Subject: [PATCH 2/3] Expend CSRF token expiry time Change it to 15 minutes, 2 minutes is not enough. --- include/classes/csrftoken.class.php | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/include/classes/csrftoken.class.php b/include/classes/csrftoken.class.php index 373a1210..130b4280 100644 --- a/include/classes/csrftoken.class.php +++ b/include/classes/csrftoken.class.php @@ -16,19 +16,22 @@ class CSRFToken Extends Base { } /** - * Returns +1 min and +1 hour rollovers hashes + * Returns +1 min up to +15 min rollovers hashes * @param string $user user or IP/host address * @param string $type page name or other unique per-page identifier - * @return array 1min and 1hour hashes + * @return array 1 minute ago up to 15 minute ago hashes */ + public function checkAdditional($user, $type) { $date = date('m/d/y/H/i'); $d = explode('/', $date); - // minute may have rolled over - $seed1 = $this->buildSeed($user.$type, $d[0], $d[1], $d[2], $d[3], ($d[4]-1)); - // hour may have rolled over - $seed2 = $this->buildSeed($user.$type, $d[0], $d[1], $d[2], ($d[3]-1), 59); - return array($this->getHash($seed1), $this->getHash($seed2)); + $hashes = array(); + for ($x = 1; $x < 16; $x++){ + for ($y = 4;$d[$y]-- == 0;$y--); + if ($d[4] < 0) { $d[4] = 59; } + $hashes[$x-1] = $this->getHash($this->buildSeed($user.$type, $d[0], $d[1], $d[2], $d[3], $d[4])); + } + return $hashes; } /** From f0f4e005a0d7563c009f931f65447c1e4dc77a15 Mon Sep 17 00:00:00 2001 From: smiba Date: Wed, 21 Feb 2018 14:32:06 +0100 Subject: [PATCH 3/3] Minor spelling correction --- cronjobs/tables_cleanup.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cronjobs/tables_cleanup.php b/cronjobs/tables_cleanup.php index b47918ae..c2f42780 100755 --- a/cronjobs/tables_cleanup.php +++ b/cronjobs/tables_cleanup.php @@ -59,7 +59,7 @@ if ($oToken->cleanupTokens()) { } $log->logInfo(sprintf($strLogMask, 'cleanupTokens', $affected, number_format(microtime(true) - $start, 3), $status, $message)); -// Clenaup shares archive +// Cleanup shares archive $start = microtime(true); $status = 'OK'; $message = ''; @@ -73,7 +73,7 @@ if ($affected === false) { } $log->logInfo(sprintf($strLogMask, 'purgeArchive', $affected, number_format(microtime(true) - $start, 3), $status, $message)); -// Clenaup shares archive +// Cleanup shares archive $start = microtime(true); $status = 'OK'; $message = '';