diff options
author | Friendika <info@friendika.com> | 2011-03-13 22:07:56 -0700 |
---|---|---|
committer | Friendika <info@friendika.com> | 2011-03-13 22:07:56 -0700 |
commit | f2734681e537031926a1e9c142403048b420deee (patch) | |
tree | 8095b48164de9b9f2184a2f4aa8105c13c0ee05d /include/fcontact.php | |
parent | 79a6b70a26bdfc8e02b94ecef3d20559590eacc7 (diff) | |
download | volse-hubzilla-f2734681e537031926a1e9c142403048b420deee.tar.gz volse-hubzilla-f2734681e537031926a1e9c142403048b420deee.tar.bz2 volse-hubzilla-f2734681e537031926a1e9c142403048b420deee.zip |
friend finder support functions
Diffstat (limited to 'include/fcontact.php')
-rw-r--r-- | include/fcontact.php | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/include/fcontact.php b/include/fcontact.php new file mode 100644 index 000000000..8821a985f --- /dev/null +++ b/include/fcontact.php @@ -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; +} + |