mirror of
https://github.com/LBRYFoundation/pool.git
synced 2025-09-30 07:10:35 +00:00
Add function arraySafeVal to prevent php errors
This commit is contained in:
parent
c636bde7b2
commit
76bcb9d058
2 changed files with 10 additions and 5 deletions
|
@ -56,11 +56,9 @@ function BackendCoinsUpdate()
|
||||||
else
|
else
|
||||||
$difficulty = $remote->getdifficulty();
|
$difficulty = $remote->getdifficulty();
|
||||||
|
|
||||||
if(is_array($difficulty))
|
if(is_array($difficulty)) {
|
||||||
{
|
$coin->difficulty = arraySafeVal($difficulty,'proof-of-work');
|
||||||
$coin->difficulty = $difficulty['proof-of-work'];
|
$coin->difficulty_pos = arraySafeVal($difficulty,'proof-of-stake');
|
||||||
if(isset($difficulty['proof-of-stake']))
|
|
||||||
$coin->difficulty_pos = $difficulty['proof-of-stake'];
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
$coin->difficulty = $difficulty;
|
$coin->difficulty = $difficulty;
|
||||||
|
|
|
@ -5,6 +5,13 @@ function controller()
|
||||||
return app()->getController();
|
return app()->getController();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function arraySafeVal($arr,$p,$default=NULL)
|
||||||
|
{
|
||||||
|
if (isset($arr[$p]))
|
||||||
|
return $arr[$p];
|
||||||
|
return $default;
|
||||||
|
}
|
||||||
|
|
||||||
function getparam($p)
|
function getparam($p)
|
||||||
{
|
{
|
||||||
return isset($_REQUEST[$p])? $_REQUEST[$p]: '';
|
return isset($_REQUEST[$p])? $_REQUEST[$p]: '';
|
||||||
|
|
Loading…
Add table
Reference in a new issue