diff options
-rw-r--r-- | include/identity.php | 16 | ||||
-rw-r--r-- | mod/p.php | 52 | ||||
-rw-r--r-- | version.inc | 2 |
3 files changed, 69 insertions, 1 deletions
diff --git a/include/identity.php b/include/identity.php index eaeb9f07f..d26eced2c 100644 --- a/include/identity.php +++ b/include/identity.php @@ -518,10 +518,26 @@ function identity_basic_export($channel_id, $items = false) { $ret['photo'] = array('type' => $r[0]['type'], 'data' => base64url_encode($r[0]['data'])); } + $r = q("select * from obj where obj_channel = %d", + intval($channel_id) + ); + + if($r) + $ret['obj'] = $r; + + if(! $items) return $ret; + $r = q("select likes.*, item.mid from likes left join item on likes.iid = item.id where likes.channel_id = %d", + intval($channel_id) + ); + + if($r) + $ret['likes'] = $r; + + $r = q("select item_id.*, item.mid from item_id left join item on item_id.iid = item.id where item_id.uid = %d", intval($channel_id) ); diff --git a/mod/p.php b/mod/p.php new file mode 100644 index 000000000..227f9e24a --- /dev/null +++ b/mod/p.php @@ -0,0 +1,52 @@ +<?php /** @file */ + +require_once('include/bb2diaspora.php'); + +// used in Diaspora communications to provide a server copy of a sent post in XML format. + +function p_init(&$a) { + + if(argc() < 2) + http_status_exit(401); + + $mid = str_replace('.xml','',argv(1)); + + $r = q("select * from item where mid = '%s' and (item_flags & %d) and item_private = 0 limit 1", + dbesc($mid), + intval(ITEM_WALL) + ); + + + if((! $r) || (! perm_is_allowed($r[0]['uid'],'','view_stream'))) + http_status_exit(404); + + + $c = q("select * from channel where channel_id = %d limit 1", + intval($r[0]['uid']) + ); + + if(! $c) + http_status_exit(404); + + $myaddr = $c[0]['channel_address'] . '@' . $a->get_hostname(); + + $item = $r[0]; + + $title = $item['title']; + $body = bb2diaspora_itembody($item); + $created = datetime_convert('UTC','UTC',$item['created'],'Y-m-d H:i:s \U\T\C'); + + $tpl = get_markup_template('diaspora_post.tpl'); + $msg = replace_macros($tpl, array( + '$body' => xmlify($body), + '$guid' => $item['mid'], + '$handle' => xmlify($myaddr), + '$public' => 'true', + '$created' => $created, + '$provider' => (($item['app']) ? $item['app'] : 'redmatrix') + )); + + header('Content-type: text/xml'); + echo $msg; + killme(); +}
\ No newline at end of file diff --git a/version.inc b/version.inc index a87b5d9bf..0947c89cf 100644 --- a/version.inc +++ b/version.inc @@ -1 +1 @@ -2014-09-26.810 +2014-09-27.811 |