mirror of
https://github.com/friendica/friendica
synced 2024-11-10 02:22:55 +00:00
friend finder support functions
This commit is contained in:
parent
79a6b70a26
commit
f2734681e5
1 changed files with 41 additions and 0 deletions
41
include/fcontact.php
Normal file
41
include/fcontact.php
Normal file
|
@ -0,0 +1,41 @@
|
|||
<?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)
|
||||
);
|
||||
|
||||
if(count($r))
|
||||
return $r[0]['id'];
|
||||
|
||||
$r = q("INSERT INTO `fcontact` ( `url`, `name`, `photo` ) VALUES ( '%s', '%s', '%s' ) ",
|
||||
dbesc($nurl),
|
||||
dbesc($name),
|
||||
dbesc($photo)
|
||||
);
|
||||
|
||||
if($r) {
|
||||
$r = q("SELECT `id` FROM `fcontact` WHERE `url` = '%s' LIMIT 1",
|
||||
dbesc($nurl)
|
||||
);
|
||||
if(count($r))
|
||||
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;
|
||||
}
|
||||
|
Loading…
Reference in a new issue