forked from science-ation/science-ation
Resolved errors and warnings on Committee page. Changed get_value_from_array() helper function to do so.
This commit is contained in:
parent
4c698b29e1
commit
c0cf9df126
@ -53,30 +53,32 @@
|
||||
|
||||
$uid = $r2->users_uid;
|
||||
$u = user_load_by_uid($uid);
|
||||
|
||||
|
||||
$output=$config['committee_publiclayout'];
|
||||
|
||||
$name=$r2->firstname.' '.$r2->lastname;
|
||||
$output=str_replace("name",$u['name'],$output);
|
||||
$name=get_value_from_array($r2, 'firstname').' '.$r2->lastname;
|
||||
|
||||
$output=str_replace("name",get_value_from_array($u, 'name', ''),$output);
|
||||
$output=str_replace("title",$r2->title,$output);
|
||||
|
||||
//make sure we do emailprivate before email so we dont match the wrong thing
|
||||
if($u['emailprivate'] && $u['displayemail']=='yes') {
|
||||
if((get_value_from_array($u, 'emailprivate')) && get_value_from_array($u, 'displayemail')=='yes') {
|
||||
list($b,$a)=explode("@",$u['emailprivate']);
|
||||
$output=str_replace("emailprivate","<script language=\"javascript\" type=\"text/javascript\">em('$b','$a')</script>",$output);
|
||||
} else
|
||||
$output=str_replace("emailprivate","",$output);
|
||||
|
||||
if($u['email'] && $u['displayemail']=='yes') {
|
||||
if(get_value_from_array($u, 'email') && get_value_from_array($u, 'displayemail')=='yes') {
|
||||
list($b,$a)=explode("@",$u['email']);
|
||||
$output=str_replace("email","<script language=\"javascript\" type=\"text/javascript\">em('$b','$a')</script>",$output);
|
||||
} else
|
||||
$output=str_replace("email","",$output);
|
||||
|
||||
$output=str_replace("phonehome",$u['phonehome'],$output);
|
||||
$output=str_replace("phonework",$u['phonework'],$output);
|
||||
$output=str_replace("phonecell",$u['phonecell'],$output);
|
||||
$output=str_replace("fax",$u['fax'],$output);
|
||||
$output=str_replace("phonehome",get_value_from_array($u, 'phonehome', ''),$output);
|
||||
$output=str_replace("phonework",get_value_from_array($u, 'phonework', ''),$output);
|
||||
$output=str_replace("phonecell",get_value_from_array($u, 'phonecell', ''),$output);
|
||||
$output=str_replace("fax",get_value_from_array($u, 'fax', ''),$output);
|
||||
|
||||
echo $output;
|
||||
|
||||
|
@ -5,9 +5,13 @@ function get_value_from_session(string $key, mixed $default = null) : mixed
|
||||
return isset($_SESSION[$key]) ? $_SESSION[$key] : $default;
|
||||
}
|
||||
|
||||
function get_value_from_array(array $ar, string $key, mixed $default = null) : mixed
|
||||
{
|
||||
return isset($ar[$key]) ? $ar[$key] : $default;
|
||||
function get_value_from_array(mixed $ar, string $key, mixed $default = null) : mixed
|
||||
{
|
||||
if(is_array($ar))
|
||||
{return isset($ar[$key]) ? $ar[$key] : $default;}
|
||||
else{
|
||||
return $default;
|
||||
}
|
||||
}
|
||||
|
||||
function get_value_from_2d_array(array $ar, string $key1, string $key2, mixed $default = null) : mixed
|
||||
@ -22,14 +26,17 @@ function get_value(mixed $var) : mixed
|
||||
|
||||
|
||||
function get_value_or_default(mixed $var, mixed $default = null) : mixed {
|
||||
return isset($var) ? $var : $default;
|
||||
return $var && isset($var) ? $var : $default;
|
||||
}
|
||||
|
||||
function get_value_property_or_default(mixed $var, mixed $property, mixed $default = null) : mixed {
|
||||
|
||||
return $var && property_exists($var, $property) ? $var->$property : $default;
|
||||
return $var ? $var->$property : $default;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
function show_pdo_errors_if_any($pdo)
|
||||
{// Check for errors after the query execution
|
||||
$errorInfo = $pdo->errorInfo();
|
||||
|
Loading…
x
Reference in New Issue
Block a user