2011-03-14 01:07:56 -04:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function fcontact_store($url,$name,$photo) {
|
|
|
|
|
|
|
|
$nurl = str_replace(array('https:','//www.'), array('http:','//'), $url);
|
|
|
|
|
|
|
|
$r = q("SELECT `id` FROM `fcontact` WHERE `url` = '%s' LIMIT 1",
|
|
|
|
dbesc($nurl)
|
|
|
|
);
|
|
|
|
|
2016-12-13 04:44:13 -05:00
|
|
|
if(dbm::is_result($r))
|
2011-03-14 01:07:56 -04:00
|
|
|
return $r[0]['id'];
|
|
|
|
|
|
|
|
$r = q("INSERT INTO `fcontact` ( `url`, `name`, `photo` ) VALUES ( '%s', '%s', '%s' ) ",
|
|
|
|
dbesc($nurl),
|
|
|
|
dbesc($name),
|
|
|
|
dbesc($photo)
|
|
|
|
);
|
|
|
|
|
2016-12-13 04:44:13 -05:00
|
|
|
if(dbm::is_result($r)) {
|
2011-03-14 01:07:56 -04:00
|
|
|
$r = q("SELECT `id` FROM `fcontact` WHERE `url` = '%s' LIMIT 1",
|
|
|
|
dbesc($nurl)
|
|
|
|
);
|
2016-12-13 04:44:13 -05:00
|
|
|
if(dbm::is_result($r))
|
2011-03-14 01:07:56 -04:00
|
|
|
return $r[0]['id'];
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
function ffinder_store($uid,$cid,$fid) {
|
|
|
|
$r = q("INSERT INTO `ffinder` ( `uid`, `cid`, `fid` ) VALUES ( %d, %d, %d ) ",
|
|
|
|
intval($uid),
|
|
|
|
intval($cid),
|
|
|
|
intval($fid)
|
|
|
|
);
|
|
|
|
return $r;
|
|
|
|
}
|
|
|
|
|