aboutsummaryrefslogtreecommitdiffstats
path: root/include/network.php
diff options
context:
space:
mode:
authorFriendika <info@friendika.com>2011-09-20 01:49:08 -0700
committerFriendika <info@friendika.com>2011-09-20 01:49:08 -0700
commit9edf15d3ef0548a35862fab37eee1fd310705285 (patch)
treed8c6e34b8e83116d1c9151b58ca63d24845923cb /include/network.php
parent8a11cec61a87600273f1349e3d112e7fc1e65486 (diff)
downloadvolse-hubzilla-9edf15d3ef0548a35862fab37eee1fd310705285.tar.gz
volse-hubzilla-9edf15d3ef0548a35862fab37eee1fd310705285.tar.bz2
volse-hubzilla-9edf15d3ef0548a35862fab37eee1fd310705285.zip
structures for batch mode (Diaspora/zot)
Diffstat (limited to 'include/network.php')
-rw-r--r--include/network.php73
1 files changed, 54 insertions, 19 deletions
diff --git a/include/network.php b/include/network.php
index deb257ff3..ec99d1e0d 100644
--- a/include/network.php
+++ b/include/network.php
@@ -701,24 +701,59 @@ function parse_xml_string($s,$strict = true) {
return $x;
}}
-function add_fcontact($arr) {
-
- $r = q("insert into fcontact ( `url`,`name`,`photo`,`request`,`nick`,`addr`,
- `notify`,`poll`,`confirm`,`network`,`alias`,`pubkey`,`updated` )
- values('%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s')",
- dbesc($arr['url']),
- dbesc($arr['name']),
- dbesc($arr['photo']),
- dbesc($arr['request']),
- dbesc($arr['nick']),
- dbesc($arr['addr']),
- dbesc($arr['notify']),
- dbesc($arr['poll']),
- dbesc($arr['confirm']),
- dbesc($arr['network']),
- dbesc($arr['alias']),
- dbesc($arr['pubkey']),
- dbesc(datetime_convert())
- );
+function add_fcontact($arr,$update = false) {
+
+ if($update) {
+ $r = q("UPDATE `fcontact` SET
+ `name` = '%s',
+ `photo` = '%s',
+ `request` = '%s',
+ `nick` = '%s',
+ `addr` = '%s',
+ `batch` = '%s',
+ `notify` = '%s',
+ `poll` = '%s',
+ `confirm` = '%s',
+ `alias` = '%s',
+ `pubkey` = '%s',
+ `updated` = '%s'
+ WHERE `url` = '%s' AND `network` = '%s' LIMIT 1",
+ dbesc($arr['name']),
+ dbesc($arr['photo']),
+ dbesc($arr['request']),
+ dbesc($arr['nick']),
+ dbesc($arr['addr']),
+ dbesc($arr['batch']),
+ dbesc($arr['notify']),
+ dbesc($arr['poll']),
+ dbesc($arr['confirm']),
+ dbesc($arr['network']),
+ dbesc($arr['alias']),
+ dbesc($arr['pubkey']),
+ dbesc(datetime_convert()),
+ dbesc($arr['url']),
+ dbesc($arr['network'])
+ );
+ }
+ else {
+ $r = q("insert into fcontact ( `url`,`name`,`photo`,`request`,`nick`,`addr`,
+ `batch`, `notify`,`poll`,`confirm`,`network`,`alias`,`pubkey`,`updated` )
+ values('%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s')",
+ dbesc($arr['url']),
+ dbesc($arr['name']),
+ dbesc($arr['photo']),
+ dbesc($arr['request']),
+ dbesc($arr['nick']),
+ dbesc($arr['addr']),
+ dbesc($arr['batch']),
+ dbesc($arr['notify']),
+ dbesc($arr['poll']),
+ dbesc($arr['confirm']),
+ dbesc($arr['network']),
+ dbesc($arr['alias']),
+ dbesc($arr['pubkey']),
+ dbesc(datetime_convert())
+ );
+ }
return $r;
}