1) { q("DELETE FROM `photo` WHERE `profile-id` = %d LIMIT 1", intval($r[0]['id']) ); q("DELETE FROM `profile` WHERE `id` = %d LIMIT 1", intval($r[0]['id']) ); } } if($parms['tags']) { $arr = explode(' ', $parms['tags']); if(count($arr)) { foreach($arr as $t) { $t = strip_tags(trim($t)); $t = substr($t,0,254); if(strlen($t)) { $r = q("SELECT `id` FROM `tag` WHERE `term` = '%s' and `nurl` = '%s' LIMIT 1", dbesc($t), dbesc($nurl) ); if(! count($r)) { $r = q("INSERT INTO `tag` (`term`, `nurl`) VALUES ('%s', '%s') ", dbesc($t), dbesc($nurl) ); } } } } } require_once("Photo.php"); $photo_failure = false; $img_str = fetch_url($photo,true); $img = new Photo($img_str); if($img) { $img->scaleImageSquare(80); $r = $img->store($profile_id); } if($profile_id) { $r = q("UPDATE `profile` SET `photo` = '%s' WHERE `id` = %d LIMIT 1", dbesc($a->get_baseurl() . '/photo/' . $profile_id . '.jpg'), intval($profile_id) ); } else{ nuke_record($url); return false; } return true; } function nuke_record($url) { $nurl = str_replace(array('https:','//www.'), array('http:','//'), $url); $r = q("SELECT `id` FROM `profile` WHERE ( `homepage` = '%s' OR `nurl` = '%s' ) ", dbesc($url), dbesc($nurl) ); if(count($r)) { foreach($r as $rr) { q("DELETE FROM `photo` WHERE `profile-id` = %d LIMIT 1", intval($rr['id']) ); q("DELETE FROM `profile` WHERE `id` = %d LIMIT 1", intval($rr['id']) ); } } return; }