aboutsummaryrefslogtreecommitdiffstats
path: root/include/socgraph.php
diff options
context:
space:
mode:
Diffstat (limited to 'include/socgraph.php')
-rw-r--r--include/socgraph.php53
1 files changed, 17 insertions, 36 deletions
diff --git a/include/socgraph.php b/include/socgraph.php
index 3b135267d..d8e2e1958 100644
--- a/include/socgraph.php
+++ b/include/socgraph.php
@@ -3,7 +3,7 @@
require_once('include/dir_fns.php');
require_once('include/zot.php');
-/*
+/**
* poco_load
*
* xchan is your connection
@@ -21,13 +21,10 @@ require_once('include/zot.php');
* the given uid, cid to the global contact entry. There can be many uid/cid combinations
* pointing to the same global contact id.
*
+ * @param string $xchan
+ * @param string $url
*/
-
-
-
-
-function poco_load($xchan = '',$url = null) {
- $a = get_app();
+function poco_load($xchan = '', $url = null) {
if($xchan && ! $url) {
$r = q("select xchan_connurl from xchan where xchan_hash = '%s' limit 1",
@@ -43,7 +40,6 @@ function poco_load($xchan = '',$url = null) {
return;
}
-
$url = $url . '?f=&fields=displayName,hash,urls,photos,rating' ;
logger('poco_load: ' . $url, LOGGER_DEBUG);
@@ -148,7 +144,7 @@ function poco_load($xchan = '',$url = null) {
logger('poco_load: missing data');
continue;
}
-
+
$x = q("select xchan_hash from xchan where xchan_hash = '%s' limit 1",
dbesc($hash)
);
@@ -182,7 +178,7 @@ function poco_load($xchan = '',$url = null) {
continue;
}
}
-
+
$total ++;
@@ -192,19 +188,15 @@ function poco_load($xchan = '',$url = null) {
);
if(! $r) {
- q("insert into xlink ( xlink_xchan, xlink_link, xlink_rating, xlink_rating_text, xlink_updated, xlink_static ) values ( '%s', '%s', %d, '%s', '%s', 0 ) ",
+ q("insert into xlink ( xlink_xchan, xlink_link, xlink_updated, xlink_static ) values ( '%s', '%s', '%s', 0 ) ",
dbesc($xchan),
dbesc($hash),
- intval($rating),
- dbesc($rating_text),
dbesc(datetime_convert())
);
}
else {
- q("update xlink set xlink_updated = '%s', xlink_rating = %d, xlink_rating_text = '%s' where xlink_id = %d",
+ q("update xlink set xlink_updated = '%s' where xlink_id = %d",
dbesc(datetime_convert()),
- intval($rating),
- dbesc($rating_text),
intval($r[0]['xlink_id'])
);
}
@@ -216,7 +208,6 @@ function poco_load($xchan = '',$url = null) {
db_utcnow(), db_quoteinterval('2 DAY')
);
-
}
@@ -253,7 +244,6 @@ function common_friends($uid,$xchan,$start = 0,$limit=100000000,$shuffle = false
);
return $r;
-
}
@@ -269,8 +259,8 @@ function count_common_friends_zcid($uid,$zcid) {
if(count($r))
return $r[0]['total'];
- return 0;
+ return 0;
}
function common_friends_zcid($uid,$zcid,$start = 0, $limit = 9999,$shuffle = false) {
@@ -292,7 +282,6 @@ function common_friends_zcid($uid,$zcid,$start = 0, $limit = 9999,$shuffle = fal
);
return $r;
-
}
@@ -307,8 +296,8 @@ function count_all_friends($uid,$cid) {
if(count($r))
return $r[0]['total'];
- return 0;
+ return 0;
}
@@ -377,9 +366,7 @@ function suggestion_query($uid, $myxchan, $start = 0, $limit = 80) {
function update_suggestions() {
- $a = get_app();
-
- $dirmode = get_config('system','directory_mode');
+ $dirmode = get_config('system', 'directory_mode');
if($dirmode === false)
$dirmode = DIRECTORY_MODE_NORMAL;
@@ -393,8 +380,6 @@ function update_suggestions() {
if(! $url)
return;
-
-
$ret = z_fetch_url($url);
if($ret['success']) {
@@ -407,7 +392,6 @@ function update_suggestions() {
db_utcnow(), db_quoteinterval('7 DAY')
);
-
$j = json_decode($ret['body'],true);
if($j && $j['success']) {
foreach($j['entries'] as $host) {
@@ -441,7 +425,6 @@ function poco($a,$extended = false) {
$system_mode = true;
}
-
$format = (($_REQUEST['format']) ? $_REQUEST['format'] : 'json');
$justme = false;
@@ -456,7 +439,7 @@ function poco($a,$extended = false) {
}
if(argc() > 4 && intval(argv(4)) && $justme == false)
$cid = intval(argv(4));
-
+
if(! $system_mode) {
$r = q("SELECT channel_id from channel where channel_address = '%s' limit 1",
@@ -506,8 +489,8 @@ function poco($a,$extended = false) {
$startIndex = intval($_GET['startIndex']);
if(! $startIndex)
$startIndex = 0;
- $itemsPerPage = ((x($_GET,'count') && intval($_GET['count'])) ? intval($_GET['count']) : $totalResults);
+ $itemsPerPage = ((x($_GET,'count') && intval($_GET['count'])) ? intval($_GET['count']) : $totalResults);
if($system_mode) {
$r = q("SELECT abook.*, xchan.* from abook left join xchan on abook_xchan = xchan_hash where ( abook_flags & " . ABOOK_FLAG_SELF .
@@ -515,8 +498,7 @@ function poco($a,$extended = false) {
intval($itemsPerPage),
intval($startIndex)
);
- }
- else {
+ } else {
$r = q("SELECT abook.*, xchan.* from abook left join xchan on abook_xchan = xchan_hash where abook_channel = %d
$sql_extra LIMIT %d OFFSET %d",
intval($channel_id),
@@ -544,8 +526,7 @@ function poco($a,$extended = false) {
}
}
- $ret['entry'] = array();
-
+ $ret['entry'] = array();
$fields_ret = array(
'id' => false,
@@ -559,10 +540,10 @@ function poco($a,$extended = false) {
'rating' => false
);
- if((! x($_GET,'fields')) || ($_GET['fields'] === '@all'))
+ if((! x($_GET,'fields')) || ($_GET['fields'] === '@all')) {
foreach($fields_ret as $k => $v)
$fields_ret[$k] = true;
- else {
+ } else {
$fields_req = explode(',',$_GET['fields']);
foreach($fields_req as $f)
$fields_ret[trim($f)] = true;