aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs/Module/Network.php
diff options
context:
space:
mode:
Diffstat (limited to 'Zotlabs/Module/Network.php')
-rw-r--r--Zotlabs/Module/Network.php66
1 files changed, 27 insertions, 39 deletions
diff --git a/Zotlabs/Module/Network.php b/Zotlabs/Module/Network.php
index 77a08585b..792f92418 100644
--- a/Zotlabs/Module/Network.php
+++ b/Zotlabs/Module/Network.php
@@ -1,6 +1,8 @@
<?php
namespace Zotlabs\Module;
+use App;
+
require_once('include/items.php');
require_once('include/group.php');
require_once('include/contact_widgets.php');
@@ -25,8 +27,8 @@ class Network extends \Zotlabs\Web\Controller {
goaway('network' . '?f=&' . $network_options);
}
- $channel = \App::get_channel();
- \App::$profile_uid = local_channel();
+ $channel = App::get_channel();
+ App::$profile_uid = local_channel();
head_set_icon($channel['xchan_photo_s']);
}
@@ -34,7 +36,7 @@ class Network extends \Zotlabs\Web\Controller {
function get($update = 0, $load = false) {
if(! local_channel()) {
- $_SESSION['return_url'] = \App::$query_string;
+ $_SESSION['return_url'] = App::$query_string;
return login(false);
}
@@ -44,11 +46,11 @@ class Network extends \Zotlabs\Web\Controller {
$_SESSION['loadtime'] = datetime_convert();
}
- $arr = array('query' => \App::$query_string);
+ $arr = array('query' => App::$query_string);
call_hooks('network_content_init', $arr);
- $channel = \App::get_channel();
+ $channel = App::get_channel();
$item_normal = item_normal();
$item_normal_update = item_normal_update();
@@ -82,20 +84,9 @@ class Network extends \Zotlabs\Web\Controller {
$search = (($_GET['search']) ? $_GET['search'] : '');
if($search) {
- $_GET['netsearch'] = escape_tags($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_channel())
- );
- if($r) {
- $_GET['cid'] = $r[0]['abook_id'];
- $search = $_GET['search'] = '';
- }
- }
- elseif(strpos($search,'#') === 0) {
+ if(strpos($search,'#') === 0) {
$hashtags = substr($search,1);
- $search = $_GET['search'] = '';
+ $search = '';
}
}
@@ -106,7 +97,7 @@ class Network extends \Zotlabs\Web\Controller {
// filter by collection (e.g. group)
if($gid) {
- $r = q("SELECT * FROM groups WHERE id = %d AND uid = %d LIMIT 1",
+ $r = q("SELECT * FROM pgrp WHERE id = %d AND uid = %d LIMIT 1",
intval($gid),
intval(local_channel())
);
@@ -141,7 +132,7 @@ class Network extends \Zotlabs\Web\Controller {
$deftag = '';
- if(x($_GET,'search') || $file || (!$pf && $cid))
+ if(x($_GET,'search') || $file || (!$pf && $cid) || $hashtags || $verb || $category)
$nouveau = true;
if($cid) {
@@ -165,17 +156,15 @@ class Network extends \Zotlabs\Web\Controller {
}
if(! $update) {
- $tabs = ''; //network_tabs();
- $o .= $tabs;
// search terms header
- if($search) {
+ if($search || $hashtags) {
$o .= replace_macros(get_markup_template("section_title.tpl"),array(
- '$title' => t('Search Results For:') . ' ' . htmlspecialchars($search, ENT_COMPAT,'UTF-8')
+ '$title' => t('Search Results For:') . ' ' . (($search) ? htmlspecialchars($search, ENT_COMPAT,'UTF-8') : '#' . htmlspecialchars($hashtags, ENT_COMPAT,'UTF-8'))
));
}
- nav_set_selected('Grid');
+ nav_set_selected('Network');
$channel_acl = array(
'allow_cid' => $channel['channel_allow_cid'],
@@ -207,7 +196,7 @@ class Network extends \Zotlabs\Web\Controller {
$x['pretext'] = $deftag;
- $status_editor = status_editor($a,$x);
+ $status_editor = status_editor($a,$x,false,'Network');
$o .= $status_editor;
$static = channel_manual_conv_update(local_channel());
@@ -254,8 +243,7 @@ class Network extends \Zotlabs\Web\Controller {
));
}
- $o = $tabs;
- $o .= $title;
+ $o = $title;
$o .= $status_editor;
}
@@ -281,8 +269,7 @@ class Network extends \Zotlabs\Web\Controller {
'$title' => '<a href="' . zid($cid_r[0]['xchan_url']) . '" ><img src="' . zid($cid_r[0]['xchan_photo_s']) . '" alt="' . urlencode($cid_r[0]['xchan_name']) . '" /></a> <a href="' . zid($cid_r[0]['xchan_url']) . '" >' . $cid_r[0]['xchan_name'] . '</a>'
));
- $o = $tabs;
- $o .= $title;
+ $o = $title;
$o .= $status_editor;
}
elseif($xchan) {
@@ -295,8 +282,8 @@ class Network extends \Zotlabs\Web\Controller {
$title = replace_macros(get_markup_template("section_title.tpl"),array(
'$title' => '<a href="' . zid($r[0]['xchan_url']) . '" ><img src="' . zid($r[0]['xchan_photo_s']) . '" alt="' . urlencode($r[0]['xchan_name']) . '" /></a> <a href="' . zid($r[0]['xchan_url']) . '" >' . $r[0]['xchan_name'] . '</a>'
));
- $o = $tabs;
- $o .= $title;
+
+ $o = $title;
$o .= $status_editor;
}
@@ -326,10 +313,10 @@ class Network extends \Zotlabs\Web\Controller {
$o .= '<div id="live-network"></div>' . "\r\n";
$o .= "<script> var profile_uid = " . local_channel()
- . "; var profile_page = " . \App::$pager['page']
+ . "; var profile_page = " . App::$pager['page']
. "; divmore_height = " . intval($maxheight) . "; </script>\r\n";
- \App::$page['htmlhead'] .= replace_macros(get_markup_template("build_query.tpl"),array(
+ App::$page['htmlhead'] .= replace_macros(get_markup_template("build_query.tpl"),array(
'$baseurl' => z_root(),
'$pgtype' => 'network',
'$uid' => ((local_channel()) ? local_channel() : '0'),
@@ -346,7 +333,7 @@ class Network extends \Zotlabs\Web\Controller {
'$wall' => '0',
'$static' => $static,
'$list' => ((x($_REQUEST,'list')) ? intval($_REQUEST['list']) : 0),
- '$page' => ((\App::$pager['page'] != 1) ? \App::$pager['page'] : 1),
+ '$page' => ((App::$pager['page'] != 1) ? App::$pager['page'] : 1),
'$search' => (($search) ? $search : ''),
'$xchan' => $xchan,
'$order' => $order,
@@ -380,7 +367,8 @@ class Network extends \Zotlabs\Web\Controller {
$sql_extra .= term_query('item',substr($search,1),TERM_HASHTAG,TERM_COMMUNITYTAG);
}
else {
- $sql_extra .= sprintf(" AND item.body like '%s' ",
+ $sql_extra .= sprintf(" AND (item.body like '%s' OR item.title like '%s') ",
+ dbesc(protect_sprintf('%' . $search . '%')),
dbesc(protect_sprintf('%' . $search . '%'))
);
}
@@ -417,8 +405,8 @@ class Network extends \Zotlabs\Web\Controller {
}
else {
$itemspage = get_pconfig(local_channel(),'system','itemspage');
- \App::set_pager_itemspage(((intval($itemspage)) ? $itemspage : 20));
- $pager_sql = sprintf(" LIMIT %d OFFSET %d ", intval(\App::$pager['itemspage']), intval(\App::$pager['start']));
+ App::set_pager_itemspage(((intval($itemspage)) ? $itemspage : 20));
+ $pager_sql = sprintf(" LIMIT %d OFFSET %d ", intval(App::$pager['itemspage']), intval(App::$pager['start']));
}
// cmin and cmax are both -1 when the affinity tool is disabled
@@ -449,7 +437,7 @@ class Network extends \Zotlabs\Web\Controller {
$abook_uids = " and abook.abook_channel = " . local_channel() . " ";
$uids = " and item.uid = " . local_channel() . " ";
- if(get_pconfig(local_channel(),'system','network_list_mode'))
+ if(feature_enabled(local_channel(), 'network_list_mode'))
$page_mode = 'list';
else
$page_mode = 'client';