add loadtime search to channel and fix it for home. display and search need further investigation
This commit is contained in:
parent
85dd08427c
commit
a2e3ca6fd8
@ -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;
|
||||
}
|
||||
|
@ -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,
|
||||
|
@ -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)) {
|
||||
|
||||
|
||||
|
17
mod/home.php
17
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 = '';
|
||||
|
@ -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
|
||||
|
@ -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");
|
||||
|
@ -1 +1 @@
|
||||
2015-03-20.977
|
||||
2015-03-21.978
|
||||
|
Reference in New Issue
Block a user