X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=mod%2Fnetwork.php;h=2a3db597e838a5d118adecd337860bbb2b4ae38c;hb=0c24784f5e92e0c8269f255e962312574871f2f0;hp=9ab34ebb053f4ec78e6d222f84e6d85d0e3a0f24;hpb=0f24f3b5057b7b91d564eb6d9c66d76dd3507fc1;p=friendica.git diff --git a/mod/network.php b/mod/network.php index 9ab34ebb05..2a3db597e8 100644 --- a/mod/network.php +++ b/mod/network.php @@ -63,29 +63,38 @@ function saved_searches($search) { $srchurl = '/network' . ((x($_GET,'cid')) ? '?cid=' . $_GET['cid'] : '') . ((x($_GET,'star')) ? '?star=' . $_GET['star'] : '') - . ((x($_GET,'bmark')) ? '?bmark=' . $_GET['bmark'] : ''); + . ((x($_GET,'bmark')) ? '?bmark=' . $_GET['bmark'] : '') + . ((x($_GET,'conv')) ? '?conv=' . $_GET['conv'] : ''); $o = ''; - $r = q("select `term` from `search` WHERE `uid` = %d", + $r = q("select `id`,`term` from `search` WHERE `uid` = %d", intval(local_user()) ); - $o .= '
'; - $o .= '' . "\r\n"; - $o .= search($search,'netsearch-box',$srchurl,true); - + $saved = array(); + if(count($r)) { - $o .= ''; } - $o .= '
'; - - $o .= '
' . "\r\n"; + + $tpl = get_markup_template("saved_searches_aside.tpl"); + $o = replace_macros($tpl, array( + '$title' => t('Saved Searches'), + '$add' => t('add'), + '$searchbox' => search($search,'netsearch-box',$srchurl,true), + '$saved' => $saved, + )); + return $o; } @@ -102,14 +111,15 @@ function network_content(&$a, $update = 0) { // item filter tabs // TODO: fix this logic, reduce duplication - $a->page['content'] .= '
'; + //$a->page['content'] .= '
'; $starred_active = ''; $new_active = ''; $bookmarked_active = ''; $all_active = ''; $search_active = ''; - + $conv_active = ''; + if(($a->argc > 1 && $a->argv[1] === 'new') || ($a->argc > 2 && $a->argv[2] === 'new')) { $new_active = 'active'; @@ -126,13 +136,21 @@ function network_content(&$a, $update = 0) { if($_GET['bmark']) { $bookmarked_active = 'active'; } + + if($_GET['conv']) { + $conv_active = 'active'; + } + if (($new_active == '') && ($starred_active == '') && ($bookmarked_active == '') + && ($conv_active == '') && ($search_active == '')) { $all_active = 'active'; } + + $postord_active = ''; if($all_active && x($_GET,'order') && $_GET['order'] !== 'comment') { @@ -151,10 +169,15 @@ function network_content(&$a, $update = 0) { ), array( 'label' => t('Posted Order'), - 'url'=>$a->get_baseurl() . '/' . str_replace('/new', '', $a->cmd) . '?order=post' . ((x($_GET,'cid')) ? '?cid=' . $_GET['cid'] : ''), + 'url'=>$a->get_baseurl() . '/' . str_replace('/new', '', $a->cmd) . '?order=post' . ((x($_GET,'cid')) ? '&cid=' . $_GET['cid'] : ''), 'sel'=>$postord_active, ), + array( + 'label' => t('Personal'), + 'url' => $a->get_baseurl() . '/' . str_replace('/new', '', $a->cmd) . ((x($_GET,'cid')) ? '/?cid=' . $_GET['cid'] : '') . '&conv=1', + 'sel' => $conv_active, + ), array( 'label' => t('New'), 'url' => $a->get_baseurl() . '/' . str_replace('/new', '', $a->cmd) . '/new' . ((x($_GET,'cid')) ? '/?cid=' . $_GET['cid'] : ''), @@ -191,6 +214,7 @@ function network_content(&$a, $update = 0) { $bmark = ((x($_GET,'bmark')) ? intval($_GET['bmark']) : 0); $order = ((x($_GET,'order')) ? notags($_GET['order']) : 'comment'); $liked = ((x($_GET,'liked')) ? intval($_GET['liked']) : 0); + $conv = ((x($_GET,'conv')) ? intval($_GET['conv']) : 0); if(($a->argc > 2) && $a->argv[2] === 'new') @@ -240,23 +264,6 @@ function network_content(&$a, $update = 0) { $o .= status_editor($a,$x); - // The special div is needed for liveUpdate to kick in for this page. - // We only launch liveUpdate if you are on the front page, you aren't - // filtering by group and also you aren't writing a comment (the last - // criteria is discovered in javascript). - - $o .= '
' . "\r\n"; - $o .= "\r\n"; - } // We aren't going to try and figure out at the item, group, and page @@ -328,15 +335,54 @@ function network_content(&$a, $update = 0) { } } - if((! $group) && (! $cid) && (! $update)) + if((! $group) && (! $cid) && (! $update)) { $o .= get_birthdays(); + $o .= get_events(); + } + + if(! $update) { + // The special div is needed for liveUpdate to kick in for this page. + // We only launch liveUpdate if you aren't filtering in some incompatible + // way and also you aren't writing a comment (discovered in javascript). + + $o .= '
' . "\r\n"; + $o .= "\r\n"; + } $sql_extra2 = (($nouveau) ? '' : " AND `item`.`parent` = `item`.`id` "); - if(x($_GET,'search')) - $sql_extra .= " AND `item`.`body` REGEXP '" . dbesc(escape_tags($_GET['search'])) . "' "; + if(x($_GET,'search')) { + $search = escape_tags($_GET['search']); + $sql_extra .= sprintf(" AND ( `item`.`body` REGEXP '%s' OR `item`.`tag` REGEXP '%s' ) ", + dbesc($search), + dbesc('\\]' . $search . '\\[') + ); + } + + if($conv) { + $myurl = $a->get_baseurl() . '/profile/'. $a->user['nickname']; + $myurl = substr($myurl,strpos($myurl,'://')+3); + $myurl = str_replace(array('www.','.'),array('','\\.'),$myurl); + $diasp_url = str_replace('/profile/','/u/',$myurl); + $sql_extra .= sprintf(" AND `item`.`parent` IN (SELECT distinct(`parent`) from item where ( `author-link` regexp '%s' or `tag` regexp '%s' or tag regexp '%s' )) ", + dbesc($myurl . '$'), + dbesc($myurl . '\\]'), + dbesc($diasp_url . '\\]') + ); + } + + - $r = q("SELECT COUNT(*) AS `total` FROM `item` LEFT JOIN `contact` ON `contact`.`id` = `item`.`contact-id` WHERE `item`.`uid` = %d AND `item`.`visible` = 1 AND `item`.`deleted` = 0