X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;ds=sidebyside;f=mod%2Fnetwork.php;h=9488cd973a144ee317c253024b2037766a7adc9f;hb=e9638b69801cee3e74a97825f9af3749c9322c53;hp=29b852c07f725c848545335720002792aae74569;hpb=c8f32536ff77193689efe69702f91122f97c1f36;p=friendica.git
diff --git a/mod/network.php b/mod/network.php
index 29b852c07f..9488cd973a 100644
--- a/mod/network.php
+++ b/mod/network.php
@@ -7,26 +7,149 @@ function network_init(&$a) {
return;
}
-
+ $group_id = (($a->argc > 1 && intval($a->argv[1])) ? intval($a->argv[1]) : 0);
+
require_once('include/group.php');
if(! x($a->page,'aside'))
$a->page['aside'] = '';
- $a->page['aside'] .= '
';
+ $search = ((x($_GET,'search')) ? escape_tags($_GET['search']) : '');
+
+ // We need a better way of managing a growing argument list
+
+ // moved into savedsearches()
+ // $srchurl = '/network'
+ // . ((x($_GET,'cid')) ? '?cid=' . $_GET['cid'] : '')
+ // . ((x($_GET,'star')) ? '?star=' . $_GET['star'] : '')
+ // . ((x($_GET,'bmark')) ? '?bmark=' . $_GET['bmark'] : '');
+
+ if(x($_GET,'save')) {
+ $r = q("select * from `search` where `uid` = %d and `term` = '%s' limit 1",
+ intval(local_user()),
+ dbesc($search)
+ );
+ if(! count($r)) {
+ q("insert into `search` ( `uid`,`term` ) values ( %d, '%s') ",
+ intval(local_user()),
+ dbesc($search)
+ );
+ }
+ }
+ if(x($_GET,'remove')) {
+ q("delete from `search` where `uid` = %d and `term` = '%s' limit 1",
+ intval(local_user()),
+ dbesc($search)
+ );
+ }
+
+ // item filter tabs
+ // TODO: fix this logic, reduce duplication
+ $a->page['content'] .= '
';
+
+ $starred_active = '';
+ $new_active = '';
+ $bookmarked_active = '';
+ $all_active = '';
+ $search_active = '';
+
+ if(($a->argc > 1 && $a->argv[1] === 'new')
+ || ($a->argc > 2 && $a->argv[2] === 'new')) {
+ $new_active = 'active';
+ }
+
+ if(x($_GET,'search')) {
+ $search_active = 'active';
+ }
+
+ if(x($_GET,'star')) {
+ $starred_active = 'active';
+ }
+
+ if($_GET['bmark']) {
+ $bookmarked_active = 'active';
+ }
+
+ if (($new_active == '')
+ && ($starred_active == '')
+ && ($bookmarked_active == '')
+ && ($search_active == '')) {
+ $all_active = 'active';
+ }
+
+ // network links moved to content to match other pages
+ // all
+ $a->page['content'] .= '
'
+ . t('All') . '';
+
+ // new
+ $a->page['content'] .= '
'
+ . t('New') . '';
+
+ // starred
+ $a->page['content'] .= '
'
+ . t('Starred') . '';
+
+ // bookmarks
+ $a->page['content'] .= '
'
+ . t('Bookmarks') . '';
+
+ $a->page['content'] .= '
';
+ // --- end item filter tabs
+
+ // search terms header
+ if(x($_GET,'search')) {
+ $a->page['content'] .= '
Search Results For: ' . $search . '
';
+ }
+
+ $a->page['aside'] .= group_side('network','network',true,$group_id);
+
+ // moved to saved searches to have it in the same div
+ //$a->page['aside'] .= search($search,'netsearch-box',$srchurl,true);
+
+ $a->page['aside'] .= saved_searches($search);
+
+}
+
+function saved_searches($search) {
+
+ $srchurl = '/network'
+ . ((x($_GET,'cid')) ? '?cid=' . $_GET['cid'] : '')
+ . ((x($_GET,'star')) ? '?star=' . $_GET['star'] : '')
+ . ((x($_GET,'bmark')) ? '?bmark=' . $_GET['bmark'] : '');
+
+ $o = '';
+
+ $r = q("select `term` from `search` WHERE `uid` = %d",
+ intval(local_user())
+ );
- if(($a->argc > 1 && $a->argv[1] === 'new') || ($a->argc > 2 && $a->argv[2] === 'new'))
- $a->page['aside'] .= '
' . t('Normal View') . '';
- else
- $a->page['aside'] .= '
' . t('New Item View') . '';
+ $o .= '
';
+ $o .= '
' . "\r\n";
+ return $o;
- $a->page['aside'] .= group_side('network','network');
}
function network_content(&$a, $update = 0) {
+ require_once('include/conversation.php');
+
if(! local_user())
return login(false);
@@ -39,6 +162,13 @@ function network_content(&$a, $update = 0) {
$nouveau = false;
require_once('include/acl_selectors.php');
+ $cid = ((x($_GET,'cid')) ? intval($_GET['cid']) : 0);
+ $star = ((x($_GET,'star')) ? intval($_GET['star']) : 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);
+
+
if(($a->argc > 2) && $a->argv[2] === 'new')
$nouveau = true;
@@ -47,84 +177,44 @@ function network_content(&$a, $update = 0) {
$nouveau = true;
else {
$group = intval($a->argv[1]);
- $group_acl = array('allow_gid' => '<' . $group . '>');
+ $def_acl = array('allow_gid' => '<' . $group . '>');
}
}
+ if(x($_GET,'search'))
+ $nouveau = true;
+ if($cid)
+ $def_acl = array('allow_cid' => '<' . intval($cid) . '>');
+
if(! $update) {
if(group) {
if(($t = group_public_members($group)) && (! get_pconfig(local_user(),'system','nowarn_insecure'))) {
- $plural_form = sprintf( tt('%d member', '%d members', $t), $t);
- notice( sprintf( t('Warning: This group contains %s from an insecure network.'), $plural_form ) . EOL);
+ notice( sprintf( tt('Warning: This group contains %s member from an insecure network.',
+ 'Warning: This group contains %s members from an insecure network.',
+ $t), $t ) . EOL);
notice( t('Private messages to this group are at risk of public disclosure.') . EOL);
}
}
- $o .= '';
+ nav_set_selected('network');
$_SESSION['return_url'] = $a->cmd;
- $geotag = (($a->user['allow_location']) ? load_view_file('view/jot_geotag.tpl') : '');
-
- $tpl = load_view_file('view/jot-header.tpl');
-
- $a->page['htmlhead'] .= replace_macros($tpl, array(
- '$baseurl' => $a->get_baseurl(),
- '$geotag' => $geotag,
- '$nickname' => $a->user['nickname'],
- '$linkurl' => t('Please enter a link URL:'),
- '$utubeurl' => t('Please enter a YouTube link:'),
- '$vidurl' => t("Please enter a video\x28.ogg\x29 link/URL:"),
- '$audurl' => t("Please enter an audio\x28.ogg\x29 link/URL:"),
- '$whereareu' => t('Where are you right now?'),
- '$title' => t('Enter a title for this item')
- ));
-
-
- $tpl = load_view_file("view/jot.tpl");
-
- if(($group) || (is_array($a->user) && ((strlen($a->user['allow_cid'])) || (strlen($a->user['allow_gid'])) || (strlen($a->user['deny_cid'])) || (strlen($a->user['deny_gid'])))))
- $lockstate = 'lock';
- else
- $lockstate = 'unlock';
-
$celeb = ((($a->user['page-flags'] == PAGE_SOAPBOX) || ($a->user['page-flags'] == PAGE_COMMUNITY)) ? true : false);
- $jotplugins = '';
- $jotnets = '';
- call_hooks('jot_tool', $jotplugins);
- call_hooks('jot_networks', $jotnets);
-
- $tpl = replace_macros($tpl,array('$jotplugins' => $jotplugins));
-
- $o .= replace_macros($tpl,array(
- '$return_path' => $a->cmd,
- '$action' => 'item',
- '$share' => t('Share'),
- '$upload' => t('Upload photo'),
- '$weblink' => t('Insert web link'),
- '$youtube' => t('Insert YouTube video'),
- '$video' => t('Insert Vorbis [.ogg] video'),
- '$audio' => t('Insert Vorbis [.ogg] audio'),
- '$setloc' => t('Set your location'),
- '$noloc' => t('Clear browser location'),
- '$title' => t('Set title'),
- '$wait' => t('Please wait'),
- '$permset' => t('Permission settings'),
- '$content' => '',
- '$post_id' => '',
- '$baseurl' => $a->get_baseurl(),
- '$defloc' => $a->user['default-location'],
- '$visitor' => 'block',
- '$emailcc' => t('CC: email addresses'),
- '$jotnets' => $jotnets,
- '$emtitle' => t('Example: bob@example.com, mary@example.com'),
- '$lockstate' => $lockstate,
- '$acl' => populate_acl((($group) ? $group_acl : $a->user), $celeb),
- '$bang' => (($group) ? '!' : ''),
- '$profile_uid' => local_user()
- ));
+ $x = array(
+ 'is_owner' => true,
+ 'allow_location' => $a->user['allow_location'],
+ 'default_location' => $a->user['default_location'],
+ 'nickname' => $a->user['nickname'],
+ 'lockstate' => ((($group) || (is_array($a->user) && ((strlen($a->user['allow_cid'])) || (strlen($a->user['allow_gid'])) || (strlen($a->user['deny_cid'])) || (strlen($a->user['deny_gid']))))) ? 'lock' : 'unlock'),
+ 'acl' => populate_acl((($group || $cid) ? $def_acl : $a->user), $celeb),
+ 'bang' => (($group || $cid) ? '!' : ''),
+ 'visitor' => 'block',
+ 'profile_uid' => local_user()
+ );
+ $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
@@ -133,25 +223,39 @@ function network_content(&$a, $update = 0) {
$o .= '