aboutsummaryrefslogtreecommitdiffstats
path: root/mod
diff options
context:
space:
mode:
Diffstat (limited to 'mod')
-rw-r--r--mod/channel.php21
-rw-r--r--mod/display.php13
-rw-r--r--mod/home.php17
-rw-r--r--mod/network.php5
-rw-r--r--mod/search.php4
5 files changed, 53 insertions, 7 deletions
diff --git a/mod/channel.php b/mod/channel.php
index 9df400cbe..3fc4a9269 100644
--- a/mod/channel.php
+++ b/mod/channel.php
@@ -50,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'] : '');
@@ -151,10 +156,19 @@ function channel_content(&$a, $update = 0, $load = false) {
$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.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 like '%s' and uid = %d AND item_restrict = 0
- AND (item_flags & %d) > 0 AND item_unseen = 1 $sql_extra limit 1",
+ AND (item_flags & %d) > 0 $simple_update $sql_extra limit 1",
dbesc($mid . '%'),
intval($a->profile['profile_uid']),
intval(ITEM_WALL)
@@ -163,7 +177,7 @@ function channel_content(&$a, $update = 0, $load = false) {
$r = q("SELECT distinct parent AS `item_id`, created from item
left join abook on ( item.owner_xchan = abook.abook_xchan $abook_uids )
WHERE uid = %d AND item_restrict = 0
- AND (item_flags & %d) > 0 AND item_unseen = 1
+ AND (item_flags & %d) > 0 $simple_update
AND ((abook.abook_flags & %d) = 0 or abook.abook_flags is null)
$sql_extra
ORDER BY created DESC",
@@ -254,6 +268,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,
diff --git a/mod/display.php b/mod/display.php
index d4a1acc5d..b5daea2de 100644
--- a/mod/display.php
+++ b/mod/display.php
@@ -5,6 +5,10 @@ function display_content(&$a, $update = 0, $load = false) {
// logger("mod-display: update = $update load = $load");
+ if($load)
+ $_SESSION['loadtime'] = datetime_convert();
+
+
if(intval(get_config('system','block_public')) && (! local_channel()) && (! remote_channel())) {
notice( t('Public access denied.') . EOL);
return;
@@ -105,6 +109,15 @@ function display_content(&$a, $update = 0, $load = false) {
}
+ $simple_update = (($update) ? " AND item_unseen = 1 " : '');
+
+ if($update && $_SESSION['loadtime'])
+ $simple_update .= " and item.changed > '" . datetime_convert('UTC','UTC',$_SESSION['loadtime']) . "' ";
+ if($load)
+ $simple_update = '';
+
+
+
if((! $update) && (! $load)) {
diff --git a/mod/home.php b/mod/home.php
index 6d5c7db25..c449a0561 100644
--- a/mod/home.php
+++ b/mod/home.php
@@ -7,6 +7,7 @@ require_once('include/conversation.php');
function home_init(&$a) {
$ret = array();
+
call_hooks('home_init',$ret);
$splash = ((argc() > 1 && argv(1) === 'splash') ? true : false);
@@ -35,6 +36,10 @@ function home_content(&$a, $update = 0, $load = false) {
$o = '';
+
+ if($load)
+ $_SESSION['loadtime'] = datetime_convert();
+
if(x($_SESSION,'theme'))
unset($_SESSION['theme']);
if(x($_SESSION,'mobile_theme'))
@@ -192,8 +197,6 @@ function home_content(&$a, $update = 0, $load = false) {
if($load) {
- $_SESSION['loadtime'] = datetime_convert();
-
// Fetch a page full of parent items for this page
$r = q("SELECT distinct item.id AS item_id, $ordering FROM item
@@ -208,7 +211,17 @@ function home_content(&$a, $update = 0, $load = false) {
}
+ elseif($update) {
+ $r = q("SELECT distinct item.id AS item_id, $ordering FROM item
+ left join abook on item.author_xchan = abook.abook_xchan
+ WHERE true $uids AND item.item_restrict = 0
+ AND item.parent = item.id $simple_update
+ and ((abook.abook_flags & %d) = 0 or abook.abook_flags is null)
+ $sql_extra3 $sql_extra $sql_nets",
+ intval(ABOOK_FLAG_BLOCKED)
+ );
+ }
// Then fetch all the children of the parents that are on this page
$parents_str = '';
$update_unseen = '';
diff --git a/mod/network.php b/mod/network.php
index 7f8d39044..ecbeb4085 100644
--- a/mod/network.php
+++ b/mod/network.php
@@ -27,12 +27,13 @@ function network_init(&$a) {
function network_content(&$a, $update = 0, $load = false) {
-
if(! local_channel()) {
$_SESSION['return_url'] = $a->query_string;
return login(false);
}
+ if($load)
+ $_SESSION['loadtime'] = datetime_convert();
$arr = array('query' => $a->query_string);
@@ -416,8 +417,6 @@ function network_content(&$a, $update = 0, $load = false) {
if($load) {
- $_SESSION['loadtime'] = datetime_convert();
-
// Fetch a page full of parent items for this page
$r = q("SELECT distinct item.id AS item_id, $ordering FROM item
diff --git a/mod/search.php b/mod/search.php
index 02b250bbe..4d66086f8 100644
--- a/mod/search.php
+++ b/mod/search.php
@@ -14,6 +14,10 @@ function search_content(&$a,$update = 0, $load = false) {
return;
}
}
+
+ if($load)
+ $_SESSION['loadtime'] = datetime_convert();
+
nav_set_selected('search');
require_once("include/bbcode.php");