mirror of
https://github.com/LBRYFoundation/pool.git
synced 2025-09-24 20:30:34 +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
|
||||
$difficulty = $remote->getdifficulty();
|
||||
|
||||
if(is_array($difficulty))
|
||||
{
|
||||
$coin->difficulty = $difficulty['proof-of-work'];
|
||||
if(isset($difficulty['proof-of-stake']))
|
||||
$coin->difficulty_pos = $difficulty['proof-of-stake'];
|
||||
if(is_array($difficulty)) {
|
||||
$coin->difficulty = arraySafeVal($difficulty,'proof-of-work');
|
||||
$coin->difficulty_pos = arraySafeVal($difficulty,'proof-of-stake');
|
||||
}
|
||||
else
|
||||
$coin->difficulty = $difficulty;
|
||||
|
|
|
@ -5,6 +5,13 @@ function controller()
|
|||
return app()->getController();
|
||||
}
|
||||
|
||||
function arraySafeVal($arr,$p,$default=NULL)
|
||||
{
|
||||
if (isset($arr[$p]))
|
||||
return $arr[$p];
|
||||
return $default;
|
||||
}
|
||||
|
||||
function getparam($p)
|
||||
{
|
||||
return isset($_REQUEST[$p])? $_REQUEST[$p]: '';
|
||||
|
|
Loading…
Add table
Reference in a new issue