Skip to content

Commit

Permalink
Merge pull request #2676 from smiba/development-patch-1
Browse files Browse the repository at this point in the history
Expend CSRF token expiry & Est. Diff for constantly changing coins
  • Loading branch information
TheSerapher committed Feb 21, 2018
2 parents ae337b4 + f0f4e00 commit 6c0d9a1
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 12 deletions.
4 changes: 2 additions & 2 deletions cronjobs/tables_cleanup.php
Expand Up @@ -59,7 +59,7 @@
} }
$log->logInfo(sprintf($strLogMask, 'cleanupTokens', $affected, number_format(microtime(true) - $start, 3), $status, $message)); $log->logInfo(sprintf($strLogMask, 'cleanupTokens', $affected, number_format(microtime(true) - $start, 3), $status, $message));


// Clenaup shares archive // Cleanup shares archive
$start = microtime(true); $start = microtime(true);
$status = 'OK'; $status = 'OK';
$message = ''; $message = '';
Expand All @@ -73,7 +73,7 @@
} }
$log->logInfo(sprintf($strLogMask, 'purgeArchive', $affected, number_format(microtime(true) - $start, 3), $status, $message)); $log->logInfo(sprintf($strLogMask, 'purgeArchive', $affected, number_format(microtime(true) - $start, 3), $status, $message));


// Clenaup shares archive // Cleanup shares archive
$start = microtime(true); $start = microtime(true);
$status = 'OK'; $status = 'OK';
$message = ''; $message = '';
Expand Down
17 changes: 10 additions & 7 deletions include/classes/csrftoken.class.php
Expand Up @@ -16,19 +16,22 @@ public function getBasic($user, $type) {
} }


/** /**
* 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 $user user or IP/host address
* @param string $type page name or other unique per-page identifier * @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) { public function checkAdditional($user, $type) {
$date = date('m/d/y/H/i'); $date = date('m/d/y/H/i');
$d = explode('/', $date); $d = explode('/', $date);
// minute may have rolled over $hashes = array();
$seed1 = $this->buildSeed($user.$type, $d[0], $d[1], $d[2], $d[3], ($d[4]-1)); for ($x = 1; $x < 16; $x++){
// hour may have rolled over for ($y = 4;$d[$y]-- == 0;$y--);
$seed2 = $this->buildSeed($user.$type, $d[0], $d[1], $d[2], ($d[3]-1), 59); if ($d[4] < 0) { $d[4] = 59; }
return array($this->getHash($seed1), $this->getHash($seed2)); $hashes[$x-1] = $this->getHash($this->buildSeed($user.$type, $d[0], $d[1], $d[2], $d[3], $d[4]));
}
return $hashes;
} }


/** /**
Expand Down
Expand Up @@ -70,7 +70,7 @@
<p class="h5" id="b-nextdiff">{if $GLOBAL.nethashrate > 0}{$NETWORK.EstNextDifficulty|number_format:"8"}{else}n/a{/if}</p> <p class="h5" id="b-nextdiff">{if $GLOBAL.nethashrate > 0}{$NETWORK.EstNextDifficulty|number_format:"8"}{else}n/a{/if}</p>
</div> </div>
<div class="circle-tile-number text-faded"> <div class="circle-tile-number text-faded">
<p class="h6">Est Next Difficulty{if $GLOBAL.nethashrate > 0}<br/>Change in {$NETWORK.BlocksUntilDiffChange} Blocks{else}No Estimates{/if}</p> <p class="h6">Est. Next Difficulty{if $GLOBAL.config.coindiffchangetarget > 1}{if $GLOBAL.nethashrate > 0}<br/>Change in {$NETWORK.BlocksUntilDiffChange} Blocks{else}No Estimates{/if}{/if}</p>
</div> </div>
</div> </div>
</div> </div>
Expand Down
Expand Up @@ -130,7 +130,7 @@
<p id="b-nextdiff" class="h5">{if $GLOBAL.nethashrate > 0}{$NETWORK.EstNextDifficulty|number_format:"8"}{else}n/a{/if}</p> <p id="b-nextdiff" class="h5">{if $GLOBAL.nethashrate > 0}{$NETWORK.EstNextDifficulty|number_format:"8"}{else}n/a{/if}</p>
</div> </div>
<div class="circle-tile-number text-faded"> <div class="circle-tile-number text-faded">
<p class="h6">Est Next Difficulty{if $GLOBAL.nethashrate > 0}<br/>Change in {$NETWORK.BlocksUntilDiffChange} Blocks{else}No Estimates{/if}</p> <p class="h6">Est. Next Difficulty{if $GLOBAL.config.coindiffchangetarget > 1}{if $GLOBAL.nethashrate > 0}<br/>Change in {$NETWORK.BlocksUntilDiffChange} Blocks{else}No Estimates{/if}{/if}</p>
</div> </div>
</div> </div>
</div> </div>
Expand Down
Expand Up @@ -70,7 +70,7 @@
<p class="h5" id="b-nextdiff">{if $GLOBAL.nethashrate > 0}{$NETWORK.EstNextDifficulty|number_format:"8"}{else}n/a{/if}</p> <p class="h5" id="b-nextdiff">{if $GLOBAL.nethashrate > 0}{$NETWORK.EstNextDifficulty|number_format:"8"}{else}n/a{/if}</p>
</div> </div>
<div class="circle-tile-number text-faded"> <div class="circle-tile-number text-faded">
<p class="h6">Est Next Difficulty{if $GLOBAL.nethashrate > 0}<br/>Change in {$NETWORK.BlocksUntilDiffChange} Blocks{else}No Estimates{/if}</p> <p class="h6">Est. Next Difficulty{if $GLOBAL.config.coindiffchangetarget > 1}{if $GLOBAL.nethashrate > 0}<br/>Change in {$NETWORK.BlocksUntilDiffChange} Blocks{else}No Estimates{/if}{/if}</p>
</div> </div>
</div> </div>
</div> </div>
Expand Down

0 comments on commit 6c0d9a1

Please sign in to comment.