diff options
Diffstat (limited to 'mod/channel.php')
-rw-r--r-- | mod/channel.php | 34 |
1 files changed, 30 insertions, 4 deletions
diff --git a/mod/channel.php b/mod/channel.php index 7c98ac899..5f825fe37 100644 --- a/mod/channel.php +++ b/mod/channel.php @@ -36,6 +36,11 @@ function channel_init(&$a) { $a->page['htmlhead'] .= '<link rel="alternate" type="application/atom+xml" href="' . $a->get_baseurl() . '/feed/' . $which .'" />' . "\r\n" ; + +// Not yet ready for prime time +// $a->page['htmlhead'] .= '<link rel="openid.server" href="' . $a->get_baseurl() . '/id/' . $which .'?f=" />' . "\r\n" ; +// $a->page['htmlhead'] .= '<link rel="openid.delegate" href="' . $a->get_baseurl() . '/channel/' . $which .'" />' . "\r\n" ; + // Run profile_load() here to make sure the theme is set before // we start loading content @@ -45,6 +50,11 @@ function channel_init(&$a) { function channel_content(&$a, $update = 0, $load = false) { + + if($load) + $_SESSION['loadtime'] = datetime_convert(); + + $category = $datequery = $datequery2 = ''; $mid = ((x($_REQUEST,'mid')) ? $_REQUEST['mid'] : ''); @@ -144,16 +154,25 @@ function channel_content(&$a, $update = 0, $load = false) { $page_mode = 'client'; + $abook_uids = " and abook.abook_channel = " . intval($a->profile['profile_uid']) . " "; + + $simple_update = (($update) ? " AND item_unseen = 1 " : ''); + + if($update && $_SESSION['loadtime']) + $simple_update = " AND (( item_unseen = 1 AND item.changed > '" . datetime_convert('UTC','UTC',$_SESSION['loadtime']) . "' ) OR item.changed > '" . datetime_convert('UTC','UTC',$_SESSION['loadtime']) . "' ) "; + if($load) + $simple_update = ''; + if(($update) && (! $load)) { if ($mid) { - $r = q("SELECT parent AS item_id from item where mid = '%s' and uid = %d AND item_restrict = 0 + $r = q("SELECT parent AS item_id from item where mid like '%s' and uid = %d AND item_restrict = 0 AND item_wall = 1 AND item_unseen = 1 $sql_extra limit 1", - dbesc($mid), + dbesc($mid . '%'), intval($a->profile['profile_uid']) ); } else { $r = q("SELECT distinct parent AS `item_id`, created from item - left join abook on item.author_xchan = abook.abook_xchan + left join abook on ( item.owner_xchan = abook.abook_xchan $abook_uids ) WHERE uid = %d AND item_restrict = 0 AND item_wall = 1 AND item_unseen = 1 AND ((abook.abook_flags & %d) = 0 or abook.abook_flags is null) @@ -162,6 +181,7 @@ function channel_content(&$a, $update = 0, $load = false) { intval($a->profile['profile_uid']), intval(ABOOK_FLAG_BLOCKED) ); + $_SESSION['loadtime'] = datetime_convert(); } } @@ -242,6 +262,9 @@ function channel_content(&$a, $update = 0, $load = false) { } + + + if((! $update) && (! $load)) { // This is ugly, but we can't pass the profile_uid through the session to the ajax updater, @@ -322,8 +345,11 @@ function channel_content(&$a, $update = 0, $load = false) { $o .= conversation($a,$items,'channel',$update,'traditional'); } - if((! $update) || ($_COOKIE['jsAvailable'] != 1)) + if((! $update) || ($_COOKIE['jsAvailable'] != 1)) { $o .= alt_pager($a,count($items)); + if ($mid && $items[0]['title']) + $a->page['title'] = $items[0]['title'] . " - " . $a->page['title']; + } if($mid) $o .= '<div id="content-complete"></div>'; |