]> git.mxchange.org Git - friendica.git/blobdiff - mod/network.php
Merge remote-tracking branch 'friendica/master'
[friendica.git] / mod / network.php
index 9b7c4e6112778dffae3435133b6f26ab5290af26..763b3693f4191a6aee018308d8e6e1f782613ca0 100644 (file)
@@ -71,19 +71,30 @@ function saved_searches($search) {
                intval(local_user())
        );
 
-       $o .= '<div id="saved-search-list" class="widget">';
-       $o .= '<h3 id="search">' . t('Saved Searches') . '</h3>' . "\r\n";
-       $o .= search($search,'netsearch-box',$srchurl,true);
+       $saved = array();
+
+
        
        if(count($r)) {
-               $o .= '<ul id="saved-search-ul">' . "\r\n";
                foreach($r as $rr) {
-                       $o .= '<li class="saved-search-li clear"><a href="network/?f=&remove=1&search=' . $rr['term'] . '" class="icon drophide savedsearchdrop" title="' . t('Remove term') . '" onclick="return confirmDelete();" onmouseover="imgbright(this);" onmouseout="imgdull(this);" ></a> <a href="network/?f&search=' . urlencode($rr['term']) . '" class="savedsearchterm" >' . $rr['term'] . '</a></li>' . "\r\n";
+                       $saved[] = array(
+                               'term'                  => $rr['term'],
+                               'encodedterm'   => urlencode($rr['term']),
+                               'delete'                => t('Remove term'),
+                               'selected'              => ($search==$rr['term']),
+                       );
                }
-               $o .= '</ul>';
        }               
 
-       $o .= '</div>' . "\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;
 
 }
@@ -100,7 +111,7 @@ function network_content(&$a, $update = 0) {
 
        // item filter tabs
        // TODO: fix this logic, reduce duplication
-       $a->page['content'] .= '<div class="tabs-wrapper">';
+       //$a->page['content'] .= '<div class="tabs-wrapper">';
        
        $starred_active = '';
        $new_active = '';
@@ -131,14 +142,28 @@ function network_content(&$a, $update = 0) {
                && ($search_active == '')) {
                        $all_active = 'active';
        }
+       $postord_active = '';
+
+       if($all_active && x($_GET,'order') && $_GET['order'] !== 'comment') {
+               $all_active = '';
+               $postord_active = 'active';
+       }
+                        
+
        
        // tabs
        $tabs = array(
                array(
-                       'label' => t('All'),
+                       'label' => t('Commented Order'),
                        'url'=>$a->get_baseurl() . '/' . str_replace('/new', '', $a->cmd) . ((x($_GET,'cid')) ? '?cid=' . $_GET['cid'] : ''), 
                        'sel'=>$all_active,
                ),
+               array(
+                       'label' => t('Posted Order'),
+                       'url'=>$a->get_baseurl() . '/' . str_replace('/new', '', $a->cmd) . '?order=post' . ((x($_GET,'cid')) ? '&cid=' . $_GET['cid'] : ''), 
+                       'sel'=>$postord_active,
+               ),
+
                array(
                        'label' => t('New'),
                        'url' => $a->get_baseurl() . '/' . str_replace('/new', '', $a->cmd) . '/new' . ((x($_GET,'cid')) ? '/?cid=' . $_GET['cid'] : ''),
@@ -312,15 +337,21 @@ function network_content(&$a, $update = 0) {
                }
        }
 
-       if((! $group) && (! $cid) && (! $update))
+       if((! $group) && (! $cid) && (! $update)) {
                $o .= get_birthdays();
+               $o .= get_events();
+       }
 
        $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 . '\\[')
+               );
+       }
 
-       
        $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