diff options
Diffstat (limited to 'mod/channel.php')
-rw-r--r-- | mod/channel.php | 57 |
1 files changed, 35 insertions, 22 deletions
diff --git a/mod/channel.php b/mod/channel.php index 0a49b41eb..5a66f5e07 100644 --- a/mod/channel.php +++ b/mod/channel.php @@ -2,11 +2,18 @@ function channel_init(&$a) { + $which = null; if(argc() > 1) $which = argv(1); - else { - notice( t('Requested profile is not available.') . EOL ); - $a->error = 404; + if(! $which) { + if(local_user()) { + $channel = $a->get_channel(); + if($channel && $channel['channel_address']) + $which = $channel['channel_address']; + } + } + if(! $which) { + notice( t('You must be logged in to see this page.') . EOL ); return; } @@ -47,6 +54,9 @@ function channel_aside(&$a) { $a->set_widget('archive',posted_date_widget($a->get_baseurl(true) . '/channel/' . $a->profile['channel_address'],$a->profile['profile_uid'],true)); $a->set_widget('categories',categories_widget($a->get_baseurl(true) . '/channel/' . $a->profile['channel_address'],$cat)); } + if(feature_enabled($a->profile['profile_uid'],'tagadelic')) + $a->set_widget('tagcloud',tagblock('search',$a->profile['profile_uid'],50,$a->profile['channel_hash'],ITEM_WALL)); + } @@ -54,17 +64,18 @@ function channel_content(&$a, $update = 0, $load = false) { $category = $datequery = $datequery2 = ''; - if(argc() > 2) { - for($x = 2; $x < argc(); $x ++) { - if(is_a_date_arg(argv($x))) { - if($datequery) - $datequery2 = escape_tags(argv($x)); - else - $datequery = escape_tags(argv($x)); - } - } - } - + // if(argc() > 2) { + // for($x = 2; $x < argc(); $x ++) { + // if(is_a_date_arg(argv($x))) { + // if($datequery) + // $datequery2 = escape_tags(argv($x)); + // else + // $datequery = escape_tags(argv($x)); + // } + // } + // } + $datequery = ((x($_GET,'dend') && is_a_date_arg($_GET['dend'])) ? notags($_GET['dend']) : ''); + $datequery2 = ((x($_GET,'dbegin') && is_a_date_arg($_GET['dbegin'])) ? notags($_GET['dbegin']) : ''); if(get_config('system','block_public') && (! get_account_id()) && (! remote_user())) { return login(); @@ -80,6 +91,8 @@ function channel_content(&$a, $update = 0, $load = false) { require_once('include/permissions.php'); + $category = ((x($_REQUEST,'cat')) ? $_REQUEST['cat'] : ''); + $groups = array(); $o = ''; @@ -118,12 +131,12 @@ function channel_content(&$a, $update = 0, $load = false) { $x = array( 'is_owner' => $is_owner, -// FIXME - 'allow_location' => ((($is_owner || $observer) && $a->profile['allow_location']) ? true : false), - 'default_location' => (($is_owner) ? $a->profile['default_location'] : ''), + 'allow_location' => ((($is_owner || $observer) && (intval(get_pconfig($a->profile['profile_uid'],'system','use_browser_location')))) ? true : false), + 'default_location' => (($is_owner) ? $a->profile['channel_location'] : ''), 'nickname' => $a->profile['channel_address'], 'lockstate' => (((strlen($a->profile['channel_allow_cid'])) || (strlen($a->profile['channel_allow_gid'])) || (strlen($a->profile['channel_deny_cid'])) || (strlen($a->profile['channel_deny_gid']))) ? 'lock' : 'unlock'), 'acl' => (($is_owner) ? populate_acl($channel, false) : ''), + 'showacl' => (($is_owner) ? 'yes' : ''), 'bang' => '', 'visitor' => (($is_owner || $observer) ? 'block' : 'none'), 'profile_uid' => $a->profile['profile_uid'] @@ -161,8 +174,9 @@ function channel_content(&$a, $update = 0, $load = false) { } else { + if(x($category)) { - $sql_extra .= protect_sprintf(file_tag_file_query('item',$category,'category')); + $sql_extra .= protect_sprintf(term_query('item', $category, TERM_CATEGORY)); } if($datequery) { @@ -172,9 +186,8 @@ function channel_content(&$a, $update = 0, $load = false) { $sql_extra2 .= protect_sprintf(sprintf(" AND item.created >= '%s' ", dbesc(datetime_convert(date_default_timezone_get(),'',$datequery2)))); } - - $a->set_pager_itemspage(40); - + $itemspage = get_pconfig(local_user(),'system','itemspage'); + $a->set_pager_itemspage(((intval($itemspage)) ? $itemspage : 20)); $pager_sql = sprintf(" LIMIT %d, %d ",intval($a->pager['start']), intval($a->pager['itemspage'])); if($load) { @@ -247,7 +260,7 @@ function channel_content(&$a, $update = 0, $load = false) { '$order' => '', '$file' => '', '$cats' => (($category) ? $category : ''), - '$uri' => '', + '$mid' => '', '$dend' => $datequery, '$dbegin' => $datequery2 )); |