diff options
author | friendica <info@friendica.com> | 2013-10-01 19:54:22 -0700 |
---|---|---|
committer | friendica <info@friendica.com> | 2013-10-01 19:54:22 -0700 |
commit | f3d351621d8f098524ccbfcad82863beafab5393 (patch) | |
tree | 269fe7b03b7bc9b8f0ab7aab5a98be30137fc4d9 /mod/network.php | |
parent | 1f965f1b701ab3850e0914e4333ff23b82274109 (diff) | |
download | volse-hubzilla-f3d351621d8f098524ccbfcad82863beafab5393.tar.gz volse-hubzilla-f3d351621d8f098524ccbfcad82863beafab5393.tar.bz2 volse-hubzilla-f3d351621d8f098524ccbfcad82863beafab5393.zip |
Saved searches on the matrix/network page just got a lot more interesting. Hint: it's all about autocomplete
Diffstat (limited to 'mod/network.php')
-rw-r--r-- | mod/network.php | 29 |
1 files changed, 26 insertions, 3 deletions
diff --git a/mod/network.php b/mod/network.php index 72391497b..81b38a5ae 100644 --- a/mod/network.php +++ b/mod/network.php @@ -64,7 +64,6 @@ function network_init(&$a) { } } - $group_id = ((x($_GET,'gid')) ? intval($_GET['gid']) : 0); require_once('include/group.php'); require_once('include/contact_widgets.php'); @@ -74,8 +73,10 @@ function network_init(&$a) { $a->page['aside'] = ''; $search = ((x($_GET,'search')) ? $_GET['search'] : ''); + - if(x($_GET,'save')) { + + if(x($_GET,'save') && $search) { $r = q("select * from `term` where `uid` = %d and `type` = %d and `term` = '%s' limit 1", intval(local_user()), intval(TERM_SAVEDSEARCH), @@ -104,6 +105,28 @@ function network_init(&$a) { $a->page['aside'] .= saved_searches($search); $a->page['aside'] .= fileas_widget($a->get_baseurl(true) . '/network',(x($_GET, 'file') ? $_GET['file'] : '')); + + if($search) { + if(strpos($search,'@') === 0) { + $r = q("select abook_id from abook left join xchan on abook_xchan = xchan_hash where xchan_name = '%s' and abook_channel = %d limit 1", + dbesc(substr($search,1)), + intval(local_user()) + ); + if($r) { + $_GET['cid'] = $r[0]['abook_id']; + $search = $_GET['search'] = ''; + } + } + elseif(strpos($search,'#') === 0) { + $search = $_GET['search'] = substr($search,1); + } + } + + $group_id = ((x($_GET,'gid')) ? intval($_GET['gid']) : 0); + + + + } function saved_searches($search) { @@ -149,7 +172,7 @@ function saved_searches($search) { $o = replace_macros($tpl, array( '$title' => t('Saved Searches'), '$add' => t('add'), - '$searchbox' => search($search,'netsearch-box',$srchurl,true), + '$searchbox' => search('','netsearch-box',$srchurl,true), '$saved' => $saved, )); |