Browse Source

additional checks for array

fixes #47
pull/64/head
Aaron Parecki 8 years ago
parent
commit
ccc8284c7b
No known key found for this signature in database GPG Key ID: 276C2817346D6056
1 changed files with 3 additions and 3 deletions
  1. +3
    -3
      lib/helpers.php

+ 3
- 3
lib/helpers.php View File

@ -240,7 +240,7 @@ function get_micropub_config(&$user, $query=[]) {
$targets = []; $targets = [];
$r = micropub_get($user->micropub_endpoint, $query, $user->micropub_access_token); $r = micropub_get($user->micropub_endpoint, $query, $user->micropub_access_token);
if($r['data'] && array_key_exists('syndicate-to', $r['data'])) {
if($r['data'] && is_array($r['data']) && array_key_exists('syndicate-to', $r['data'])) {
if(is_array($r['data']['syndicate-to'])) { if(is_array($r['data']['syndicate-to'])) {
$data = $r['data']['syndicate-to']; $data = $r['data']['syndicate-to'];
} else { } else {
@ -248,13 +248,13 @@ function get_micropub_config(&$user, $query=[]) {
} }
foreach($data as $t) { foreach($data as $t) {
if(array_key_exists('service', $t) && array_key_exists('photo', $t['service'])) {
if(is_array($t) && array_key_exists('service', $t) && array_key_exists('photo', $t['service'])) {
$icon = $t['service']['photo']; $icon = $t['service']['photo'];
} else { } else {
$icon = false; $icon = false;
} }
if(array_key_exists('uid', $t) && array_key_exists('name', $t)) {
if(is_array($t) && array_key_exists('uid', $t) && array_key_exists('name', $t)) {
$targets[] = [ $targets[] = [
'target' => $t['name'], 'target' => $t['name'],
'uid' => $t['uid'], 'uid' => $t['uid'],

Loading…
Cancel
Save