diff options
author | Habeas Codice <habeascodice@federated.social> | 2015-01-28 17:40:39 -0800 |
---|---|---|
committer | Habeas Codice <habeascodice@federated.social> | 2015-01-28 17:40:39 -0800 |
commit | d59bd31a682a58e0d34a66e06ce8f504189f98d5 (patch) | |
tree | 3a34b706f63f8f41bb76c5a049f3bc356d8c265f /mod/search.php | |
parent | 1a537888333afb052e9eb4954091fd163f5b78d1 (diff) | |
parent | 54fd8b21db2d8f3841cf590f88611a1d4f44ce48 (diff) | |
download | volse-hubzilla-d59bd31a682a58e0d34a66e06ce8f504189f98d5.tar.gz volse-hubzilla-d59bd31a682a58e0d34a66e06ce8f504189f98d5.tar.bz2 volse-hubzilla-d59bd31a682a58e0d34a66e06ce8f504189f98d5.zip |
Merge branch 'master' of https://github.com/friendica/red
Diffstat (limited to 'mod/search.php')
-rw-r--r-- | mod/search.php | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/mod/search.php b/mod/search.php index 2ea6ad86f..5b15b0593 100644 --- a/mod/search.php +++ b/mod/search.php @@ -21,6 +21,10 @@ function search_content(&$a,$update = 0, $load = false) { require_once('include/conversation.php'); require_once('include/items.php'); + $format = (($_REQUEST['format']) ? $_REQUEST['format'] : ''); + if($format !== '') { + $update = $load = 1; + } $observer = $a->get_observer(); $observer_hash = (($observer) ? $observer['xchan_hash'] : ''); @@ -179,6 +183,19 @@ function search_content(&$a,$update = 0, $load = false) { $items = array(); } + + if($format == 'json') { + $result = array(); + require_once('include/conversation.php'); + foreach($items as $item) { + $item['html'] = bbcode($item['body']); + $x = encode_item($item); + $x['html'] = prepare_text($item['body'],$item['mimetype']); + $result[] = $x; + } + json_return_and_die(array('success' => true,'messages' => $result)); + } + if($tag) $o .= '<h2>Items tagged with: ' . htmlspecialchars($search, ENT_COMPAT,'UTF-8') . '</h2>'; else |