Fix PHP Notices
This commit is contained in:
parent
9031423278
commit
15563be5cc
|
@ -11,22 +11,38 @@ function attribute_contains($attr,$s) {
|
||||||
}}
|
}}
|
||||||
|
|
||||||
|
|
||||||
if(! function_exists('noscrape_dfrn')) {
|
if (!function_exists('noscrape_dfrn')) {
|
||||||
function noscrape_dfrn($url) {
|
|
||||||
|
function noscrape_dfrn($url)
|
||||||
|
{
|
||||||
$submit_noscrape_start = microtime(true);
|
$submit_noscrape_start = microtime(true);
|
||||||
$data = fetch_url($url);
|
$data = fetch_url($url);
|
||||||
$submit_noscrape_request_end = microtime(true);
|
$submit_noscrape_request_end = microtime(true);
|
||||||
if(empty($data)) return false;
|
if (empty($data)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
$parms = json_decode($data, true);
|
$parms = json_decode($data, true);
|
||||||
if(!$parms || !count($parms)) return false;
|
if (!$parms || !count($parms)) {
|
||||||
$parms['tags'] = implode(' ', (array)$parms['tags']);
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isset($parms['tags'])) {
|
||||||
|
$parms['tags'] = implode(' ', (array) $parms['tags']);
|
||||||
|
} else {
|
||||||
|
$parms['tags'] = '';
|
||||||
|
}
|
||||||
|
|
||||||
$submit_noscrape_end = microtime(true);
|
$submit_noscrape_end = microtime(true);
|
||||||
$parms['_timings'] = array(
|
$parms['_timings'] = array(
|
||||||
'fetch' => round(($submit_noscrape_request_end - $submit_noscrape_start) * 1000),
|
'fetch' => round(($submit_noscrape_request_end - $submit_noscrape_start) * 1000),
|
||||||
'scrape' => round(($submit_noscrape_end - $submit_noscrape_request_end) * 1000)
|
'scrape' => round(($submit_noscrape_end - $submit_noscrape_request_end) * 1000)
|
||||||
);
|
);
|
||||||
|
|
||||||
return $parms;
|
return $parms;
|
||||||
}}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
if(! function_exists('scrape_dfrn')) {
|
if(! function_exists('scrape_dfrn')) {
|
||||||
function scrape_dfrn($url, $max_nodes=3500) {
|
function scrape_dfrn($url, $max_nodes=3500) {
|
||||||
|
|
|
@ -131,11 +131,11 @@ function run_submit($url)
|
||||||
`updated` = '%s'
|
`updated` = '%s'
|
||||||
WHERE `id` = %d LIMIT 1",
|
WHERE `id` = %d LIMIT 1",
|
||||||
$params['fn'],
|
$params['fn'],
|
||||||
$params['pdesc'],
|
isset($params['pdesc']) ? $params['pdesc'] : '',
|
||||||
$params['locality'],
|
isset($params['locality']) ? $params['locality'] : '',
|
||||||
$params['region'],
|
isset($params['region']) ? $params['region'] : '',
|
||||||
$params['postal-code'],
|
isset($params['postal-code']) ? $params['postal-code'] : '',
|
||||||
$params['country-name'],
|
isset($params['country-name']) ? $params['country-name'] : '',
|
||||||
dbesc($url),
|
dbesc($url),
|
||||||
dbesc($nurl),
|
dbesc($nurl),
|
||||||
intval($params['comm']),
|
intval($params['comm']),
|
||||||
|
|
|
@ -18,12 +18,9 @@ function photo_init(App $a)
|
||||||
$profile_id = str_replace('.jpg', '', $photo);
|
$profile_id = str_replace('.jpg', '', $photo);
|
||||||
|
|
||||||
$r = q('SELECT * FROM `photo` WHERE `profile-id` = %d LIMIT 1', intval($profile_id));
|
$r = q('SELECT * FROM `photo` WHERE `profile-id` = %d LIMIT 1', intval($profile_id));
|
||||||
|
|
||||||
if (count($r)) {
|
if (count($r)) {
|
||||||
$data = $r[0]['data'];
|
$data = $r[0]['data'];
|
||||||
}
|
} else {
|
||||||
|
|
||||||
if (x($data) === false || (!strlen($data))) {
|
|
||||||
$data = file_get_contents('images/default-profile-sm.jpg');
|
$data = file_get_contents('images/default-profile-sm.jpg');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue