aboutsummaryrefslogtreecommitdiffstats
path: root/include/socgraph.php
diff options
context:
space:
mode:
authorMicMee <michael@meer.name>2013-01-23 04:55:09 -0800
committerMicMee <michael@meer.name>2013-01-23 04:55:09 -0800
commit9996d5ee9b7196774cb1d95334507c20f1883428 (patch)
tree4c10561076f16d9f18b7b5943bc1930814c6d52c /include/socgraph.php
parentfca354aa463e84b67fe62e4067905e8f363c0e80 (diff)
parent0b18dd15c5377da121f0fb781c0530ca0d328eb9 (diff)
downloadvolse-hubzilla-9996d5ee9b7196774cb1d95334507c20f1883428.tar.gz
volse-hubzilla-9996d5ee9b7196774cb1d95334507c20f1883428.tar.bz2
volse-hubzilla-9996d5ee9b7196774cb1d95334507c20f1883428.zip
Merge pull request #1 from friendica/master
get changes
Diffstat (limited to 'include/socgraph.php')
-rw-r--r--include/socgraph.php77
1 files changed, 39 insertions, 38 deletions
diff --git a/include/socgraph.php b/include/socgraph.php
index aa5a24e89..081927dcc 100644
--- a/include/socgraph.php
+++ b/include/socgraph.php
@@ -23,12 +23,11 @@ function poco_load($xchan = null,$url = null) {
$a = get_app();
if($xchan && ! $url) {
- $r = q("select xchan_connurl from xchan where xchan_hash = %d limit 1",
- intval($xchan)
+ $r = q("select xchan_connurl from xchan where xchan_hash = '%s' limit 1",
+ dbesc($xchan)
);
if($r) {
$url = $r[0]['xchan_connurl'];
- $uid = $r[0]['abook_channel'];
}
}
@@ -109,24 +108,25 @@ function poco_load($xchan = null,$url = null) {
}
- $r = q("select * from xlink where xlink_xchan = '%s' and xlink_link = '%s' limit 1",
- dbesc($xchan),
- dbesc($hash)
- );
- if(! $r) {
- q("insert into xlink ( xlink_xchan, xlink_link, xlink_updated ) values ( '%s', '%s', '%s' ) ",
+ if($xchan) {
+ $r = q("select * from xlink where xlink_xchan = '%s' and xlink_link = '%s' limit 1",
dbesc($xchan),
- dbesc($hash),
- dbesc(datetime_convert())
- );
- }
- else {
- q("update xlink set xlink_updated = '%s' where xlink_id = %d limit 1",
- dbesc(datetime_convert()),
- intval($r[0]['xlink_id'])
+ dbesc($hash)
);
+ if(! $r) {
+ q("insert into xlink ( xlink_xchan, xlink_link, xlink_updated ) values ( '%s', '%s', '%s' ) ",
+ dbesc($xchan),
+ dbesc($hash),
+ dbesc(datetime_convert())
+ );
+ }
+ else {
+ q("update xlink set xlink_updated = '%s' where xlink_id = %d limit 1",
+ dbesc(datetime_convert()),
+ intval($r[0]['xlink_id'])
+ );
+ }
}
-
}
logger("poco_load: loaded $total entries",LOGGER_DEBUG);
@@ -295,37 +295,38 @@ function suggestion_query($uid, $start = 0, $limit = 80) {
function update_suggestions() {
+// FIXME
+return;
$a = get_app();
$done = array();
- poco_load(0,0,0,$a->get_baseurl() . '/poco');
+ // fix this to get a json list from an upstream directory
+// poco_load(0,0,0,$a->get_baseurl() . '/poco');
- $done[] = $a->get_baseurl() . '/poco';
+// $done[] = $a->get_baseurl() . '/poco';
- if(strlen(get_config('system','directory_submit_url'))) {
- $x = fetch_url('http://dir.friendica.com/pubsites');
- if($x) {
- $j = json_decode($x);
- if($j->entries) {
- foreach($j->entries as $entry) {
- $url = $entry->url . '/poco';
- if(! in_array($url,$done))
- poco_load(0,0,0,$entry->url . '/poco');
- }
- }
- }
- }
+// if(strlen(get_config('system','directory_submit_url'))) {
+// $x = fetch_url('http://dir.friendica.com/pubsites');
+// if($x) {
+// $j = json_decode($x);
+// if($j->entries) {
+// foreach($j->entries as $entry) {
+// $url = $entry->url . '/poco';
+// if(! in_array($url,$done))
+// poco_load(0,0,0,$entry->url . '/poco');
+// }
+// }
+// }
+// }
- $r = q("select distinct(poco) as poco from contact where network = '%s'",
- dbesc(NETWORK_DFRN)
- );
+ $r = q("select distinct(xchan_connurl) as poco from xchan where xchan_network = 'zot'");
- if(count($r)) {
+ if($r) {
foreach($r as $rr) {
$base = substr($rr['poco'],0,strrpos($rr['poco'],'/'));
if(! in_array($base,$done))
- poco_load(0,0,0,$base);
+ poco_load('',$base);
}
}
}