2011-03-14 06:07:56 +01:00
|
|
|
<?php
|
|
|
|
|
2017-11-08 04:57:46 +01:00
|
|
|
use Friendica\Database\DBM;
|
2011-03-14 06:07:56 +01:00
|
|
|
|
|
|
|
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)
|
|
|
|
);
|
|
|
|
|
2017-11-08 04:57:46 +01:00
|
|
|
if (DBM::is_result($r))
|
2011-03-14 06:07:56 +01:00
|
|
|
return $r[0]['id'];
|
|
|
|
|
2017-08-10 01:02:57 +02:00
|
|
|
$r = dba::insert('fcontact', array('url' => $nurl, 'name' => $name, 'photo' => $photo));
|
2011-03-14 06:07:56 +01:00
|
|
|
|
2017-11-08 04:57:46 +01:00
|
|
|
if (DBM::is_result($r)) {
|
2011-03-14 06:07:56 +01:00
|
|
|
$r = q("SELECT `id` FROM `fcontact` WHERE `url` = '%s' LIMIT 1",
|
|
|
|
dbesc($nurl)
|
|
|
|
);
|
2017-11-08 04:57:46 +01:00
|
|
|
if (DBM::is_result($r))
|
2011-03-14 06:07:56 +01:00
|
|
|
return $r[0]['id'];
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
function ffinder_store($uid,$cid,$fid) {
|
2017-08-10 01:02:57 +02:00
|
|
|
$r = dba::insert('ffinder', array('uid' => $uid, 'cid' => $cid, 'fid' => $fid));
|
2011-03-14 06:07:56 +01:00
|
|
|
return $r;
|
|
|
|
}
|
|
|
|
|