]> git.mxchange.org Git - friendica.git/blob - include/fcontact.php
Attachments: Better handling of preview pictures
[friendica.git] / include / fcontact.php
1 <?php
2
3
4
5 function fcontact_store($url,$name,$photo) {
6
7         $nurl = str_replace(array('https:','//www.'), array('http:','//'), $url);
8
9         $r = q("SELECT `id` FROM `fcontact` WHERE `url` = '%s' LIMIT 1",
10                 dbesc($nurl)
11         );
12
13         if(count($r))
14                 return $r[0]['id'];
15
16         $r = q("INSERT INTO `fcontact` ( `url`, `name`, `photo` ) VALUES ( '%s', '%s', '%s' ) ",
17                 dbesc($nurl),
18                 dbesc($name),
19                 dbesc($photo)
20         );
21
22         if($r) {
23                 $r = q("SELECT `id` FROM `fcontact` WHERE `url` = '%s' LIMIT 1",
24                         dbesc($nurl)
25                 );
26                 if(count($r))
27                         return $r[0]['id'];
28         }
29
30         return 0;
31 }
32
33 function ffinder_store($uid,$cid,$fid) {
34         $r = q("INSERT INTO `ffinder` ( `uid`, `cid`, `fid` ) VALUES ( %d, %d, %d ) ",
35                 intval($uid),
36                 intval($cid),
37                 intval($fid)
38         );
39         return $r;
40 }
41