diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/conversation.php | 20 | ||||
-rw-r--r-- | include/security.php | 18 |
2 files changed, 31 insertions, 7 deletions
diff --git a/include/conversation.php b/include/conversation.php index 1ade8ed3a..e2dfccac9 100644 --- a/include/conversation.php +++ b/include/conversation.php @@ -1595,8 +1595,17 @@ function profile_tabs($a, $is_owner = false, $nickname = null){ if (is_null($nickname)) $nickname = $channel['channel_address']; + $uid = (($a->profile['profile_uid']) ? $a->profile['profile_uid'] : local_channel()); + if($uid == local_channel()) { + $cal_link = '/events'; + } + else { + $cal_link = '/cal/' . $nickname; + } + + if (get_pconfig($uid, 'system', 'noprofiletabs')) return; @@ -1644,6 +1653,17 @@ function profile_tabs($a, $is_owner = false, $nickname = null){ ); } + if($p['view_stream']) { + $tabs[] = array( + 'label' => t('Events'), + 'url' => $a->get_baseurl() . $cal_link, + 'sel' => ((argv(0) == 'cal' || argv(0) == 'events') ? 'active' : ''), + 'title' => t('Events'), + 'id' => 'event-tab', + ); + } + + if ($p['chat']) { require_once('include/chat.php'); $has_chats = chatroom_list_count($uid); diff --git a/include/security.php b/include/security.php index ee94dba82..215cc92cb 100644 --- a/include/security.php +++ b/include/security.php @@ -148,7 +148,7 @@ function change_channel($change_channel) { * @return string additional SQL where statement */ -function permissions_sql($owner_id, $remote_observer = null) { +function permissions_sql($owner_id, $remote_observer = null, $table = '') { $local_channel = local_channel(); @@ -158,10 +158,14 @@ function permissions_sql($owner_id, $remote_observer = null) { * default permissions - anonymous user */ - $sql = " AND allow_cid = '' - AND allow_gid = '' - AND deny_cid = '' - AND deny_gid = '' + if($table) + $table .= '.'; + + + $sql = " AND {$table}allow_cid = '' + AND {$table}allow_gid = '' + AND {$table}deny_cid = '' + AND {$table}deny_gid = '' "; /** @@ -193,8 +197,8 @@ function permissions_sql($owner_id, $remote_observer = null) { } $regexop = db_getfunc('REGEXP'); $sql = sprintf( - " AND ( NOT (deny_cid like '%s' OR deny_gid $regexop '%s') - AND ( allow_cid like '%s' OR allow_gid $regexop '%s' OR ( allow_cid = '' AND allow_gid = '') ) + " AND ( NOT ({$table}deny_cid like '%s' OR {$table}deny_gid $regexop '%s') + AND ( {$table}allow_cid like '%s' OR {$table}allow_gid $regexop '%s' OR ( {$table}allow_cid = '' AND {$table}allow_gid = '') ) ) ", dbesc(protect_sprintf( '%<' . $observer . '>%')), |