diff options
author | Friendika <info@friendika.com> | 2011-04-19 20:50:02 -0700 |
---|---|---|
committer | Friendika <info@friendika.com> | 2011-04-19 20:50:02 -0700 |
commit | d874a55178cce01195b23296bbae6365807dc300 (patch) | |
tree | 9360b27c28d33dae9a3d5dd5b263408d2576d00c /mod | |
parent | 29a48de5e29841f46791d42d6e329898688914fe (diff) | |
download | volse-hubzilla-d874a55178cce01195b23296bbae6365807dc300.tar.gz volse-hubzilla-d874a55178cce01195b23296bbae6365807dc300.tar.bz2 volse-hubzilla-d874a55178cce01195b23296bbae6365807dc300.zip |
per contact network page (link in photo menu)
Diffstat (limited to 'mod')
-rw-r--r-- | mod/network.php | 36 |
1 files changed, 29 insertions, 7 deletions
diff --git a/mod/network.php b/mod/network.php index 9061dff0f..9d5fb5b84 100644 --- a/mod/network.php +++ b/mod/network.php @@ -15,9 +15,9 @@ function network_init(&$a) { $a->page['aside'] .= '<div id="network-new-link">'; if(($a->argc > 1 && $a->argv[1] === 'new') || ($a->argc > 2 && $a->argv[2] === 'new')) - $a->page['aside'] .= '<a href="' . $a->get_baseurl() . '/' . str_replace('/new', '', $a->cmd) . '">' . t('Normal View') . '</a>'; + $a->page['aside'] .= '<a href="' . $a->get_baseurl() . '/' . str_replace('/new', '', $a->cmd) . ((x($_GET,'cid')) ? '/?cid=' . $_GET['cid'] : '') . '">' . t('Normal View') . '</a>'; else - $a->page['aside'] .= '<a href="' . $a->get_baseurl() . '/' . $a->cmd . '/new' . '">' . t('New Item View') . '</a>'; + $a->page['aside'] .= '<a href="' . $a->get_baseurl() . '/' . $a->cmd . '/new' . ((x($_GET,'cid')) ? '/?cid=' . $_GET['cid'] : '') . '">' . t('New Item View') . '</a>'; $a->page['aside'] .= '</div>'; @@ -41,6 +41,8 @@ function network_content(&$a, $update = 0) { $nouveau = false; require_once('include/acl_selectors.php'); + $cid = ((x($_GET['cid'])) ? intval($_GET['cid']) : 0); + if(($a->argc > 2) && $a->argv[2] === 'new') $nouveau = true; @@ -49,10 +51,13 @@ 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($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'))) { @@ -146,8 +151,8 @@ function network_content(&$a, $update = 0) { '$jotnets' => $jotnets, '$emtitle' => t('Example: bob@example.com, mary@example.com'), '$lockstate' => $lockstate, - '$acl' => populate_acl((($group) ? $group_acl : $a->user), $celeb), - '$bang' => (($group) ? '!' : ''), + '$acl' => populate_acl((($group || $cid) ? $def_acl : $a->user), $celeb), + '$bang' => (($group || $cid) ? '!' : ''), '$profile_uid' => local_user() )); @@ -160,6 +165,7 @@ function network_content(&$a, $update = 0) { $o .= '<div id="live-network"></div>' . "\r\n"; $o .= "<script> var profile_uid = " . $_SESSION['uid'] . "; var netargs = '" . substr($a->cmd,8) + . ((x($_GET,'cid')) ? '/?cid=' . $_GET['cid'] : '') . "'; var profile_page = " . $a->pager['page'] . "; </script>\r\n"; } @@ -189,7 +195,7 @@ function network_content(&$a, $update = 0) { killme(); notice( t('No such group') . EOL ); goaway($a->get_baseurl() . '/network'); - return; // NOTREACHED + // NOTREACHED } $contacts = expand_groups(array($group)); @@ -204,8 +210,24 @@ function network_content(&$a, $update = 0) { $sql_extra = " AND `item`.`parent` IN ( SELECT `parent` FROM `item` WHERE `id` = `parent` AND `contact-id` IN ( $contact_str )) "; $o = '<h2>' . t('Group: ') . $r[0]['name'] . '</h2>' . $o; } + elseif($cid) { + + $r = q("SELECT `id`,`name` FROM `contact` WHERE `id` = %d + AND `blocked` = 0 AND `pending` = 0 LIMIT 1", + intval($cid) + ); + if(count($r)) { + $sql_extra = " AND `item`.`parent` IN ( SELECT `parent` FROM `item` WHERE `id` = `parent` AND `contact-id` IN ( " . intval($cid) . " )) "; + $o = '<h2>' . t('Contact: ') . $r[0]['name'] . '</h2>' . $o; + } + else { + notice( t('Invalid contact.') . EOL); + goaway($a->get_baseurl() . '/network'); + // NOTREACHED + } + } - if((! $group) && (! $update)) + if((! $group) && (! $cid) && (! $update)) $o .= get_birthdays(); |