aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2015-03-21 16:46:28 -0700
committerfriendica <info@friendica.com>2015-03-21 16:46:28 -0700
commita2e3ca6fd8ba8c0630de089d772fdd668b84428b (patch)
tree66396776eb293108450c98f2ec1047cafda0fcb5
parent85dd08427c6067554762854c584eae0ca90fea43 (diff)
downloadvolse-hubzilla-a2e3ca6fd8ba8c0630de089d772fdd668b84428b.tar.gz
volse-hubzilla-a2e3ca6fd8ba8c0630de089d772fdd668b84428b.tar.bz2
volse-hubzilla-a2e3ca6fd8ba8c0630de089d772fdd668b84428b.zip
add loadtime search to channel and fix it for home. display and search need further investigation
-rw-r--r--include/text.php3
-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
-rw-r--r--version.inc2
7 files changed, 55 insertions, 10 deletions
diff --git a/include/text.php b/include/text.php
index 54d8b2ad7..86da3ee42 100644
--- a/include/text.php
+++ b/include/text.php
@@ -2370,8 +2370,7 @@ function linkify_tags($a, &$body, $uid) {
if($fullnametagged)
continue;
- // @FIXME which $profile_uid? It's not set anywhere.
- $success = handle_tag($a, $body, $access_tag, $str_tags, ($uid) ? $uid : $profile_uid , $tag);
+ $success = handle_tag($a, $body, $access_tag, $str_tags, ($uid) ? $uid : $a->profile_uid , $tag);
$results[] = array('success' => $success, 'access_tag' => $access_tag);
if($success['replaced']) $tagged[] = $tag;
}
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");
diff --git a/version.inc b/version.inc
index 9e48ee8b9..35d00274e 100644
--- a/version.inc
+++ b/version.inc
@@ -1 +1 @@
-2015-03-20.977
+2015-03-21.978