diff options
-rw-r--r-- | include/attach.php | 2 | ||||
-rw-r--r-- | include/sharedwithme.php | 32 | ||||
-rw-r--r-- | include/text.php | 3 | ||||
-rw-r--r-- | mod/channel.php | 21 | ||||
-rw-r--r-- | mod/display.php | 13 | ||||
-rw-r--r-- | mod/home.php | 17 | ||||
-rwxr-xr-x | mod/like.php | 5 | ||||
-rw-r--r-- | mod/network.php | 22 | ||||
-rw-r--r-- | mod/search.php | 4 | ||||
-rw-r--r-- | mod/sharedwithme.php | 30 | ||||
-rw-r--r-- | version.inc | 2 | ||||
-rwxr-xr-x | view/tpl/jot.tpl | 2 | ||||
-rw-r--r-- | view/tpl/section_title.tpl | 5 |
13 files changed, 115 insertions, 43 deletions
diff --git a/include/attach.php b/include/attach.php index 04fd25ace..1daa42aef 100644 --- a/include/attach.php +++ b/include/attach.php @@ -1078,7 +1078,7 @@ function file_activity($channel_id, $object, $allow_cid, $allow_gid, $deny_cid, $arr['deny_cid'] = perms2str($u_arr_deny_cid); $arr['deny_gid'] = perms2str($u_arr_deny_gid); $arr['item_restrict'] = ITEM_HIDDEN; - $arr['item_private'] = 0; + $arr['item_private'] = $private; $arr['verb'] = ACTIVITY_UPDATE; $arr['obj_type'] = $objtype; $arr['object'] = $u_jsonobject; diff --git a/include/sharedwithme.php b/include/sharedwithme.php new file mode 100644 index 000000000..3936dc90f --- /dev/null +++ b/include/sharedwithme.php @@ -0,0 +1,32 @@ +<?php + +function apply_updates() { + + //check for updated items and remove them + $x = q("SELECT mid, object FROM item WHERE verb = '%s' AND obj_type = '%s' GROUP BY mid", + dbesc(ACTIVITY_UPDATE), + dbesc(ACTIVITY_OBJ_FILE) + ); + + if($x) { + + foreach($x as $xx) { + + $object = json_decode($xx['object'],true); + + $d_mid = $object['d_mid']; + $u_mid = $xx['mid']; + + $y = q("DELETE FROM item WHERE obj_type = '%s' AND (verb = '%s' AND mid = '%s') OR (verb = '%s' AND mid = '%s')", + dbesc(ACTIVITY_OBJ_FILE), + dbesc(ACTIVITY_POST), + dbesc($d_mid), + dbesc(ACTIVITY_UPDATE), + dbesc($u_mid) + ); + + } + + } + +} 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/like.php b/mod/like.php index 47251935a..dc4531fbb 100755 --- a/mod/like.php +++ b/mod/like.php @@ -303,7 +303,6 @@ function like_content(&$a) { $multi_undo = 1; } - $r = q("SELECT id FROM item WHERE verb in ( $verbs ) AND item_restrict = 0 AND author_xchan = '%s' AND ( parent = %d OR thr_parent = '%s') and uid = %d ", dbesc($observer['xchan_hash']), @@ -316,10 +315,12 @@ function like_content(&$a) { // already liked it. Drop that item. require_once('include/items.php'); foreach($r as $rr) { - drop_item($rr['id'],true,DROPITEM_PHASE1); + drop_item($rr['id'],false,DROPITEM_PHASE1); } + if($interactive) return; + if(! $multi_undo) killme(); } diff --git a/mod/network.php b/mod/network.php index 7f8d39044..f71a7569a 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); @@ -116,8 +117,21 @@ function network_content(&$a, $update = 0, $load = false) { if(x($_GET,'search') || x($_GET,'file')) $nouveau = true; - if($cid) - $def_acl = array('allow_cid' => '<' . intval($cid) . '>'); + if($cid) { + $r = q("SELECT abook_xchan FROM abook WHERE abook_id = %d AND abook_channel = %d LIMIT 1", + intval($cid), + intval(local_channel()) + ); + if(! $r) { + if($update) { + killme(); + } + notice( t('No such channel') . EOL ); + goaway($a->get_baseurl(true) . '/network'); + // NOTREACHED + } + $def_acl = array('allow_cid' => '<' . $r[0]['abook_xchan'] . '>'); + } if(! $update) { $tabs = network_tabs(); @@ -416,8 +430,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/mod/sharedwithme.php b/mod/sharedwithme.php index d91987027..b77c9dad1 100644 --- a/mod/sharedwithme.php +++ b/mod/sharedwithme.php @@ -12,33 +12,9 @@ function sharedwithme_content(&$a) { $is_owner = (local_channel() && (local_channel() == $channel['channel_id'])); - //maintenance - see if a file got dropped and remove it systemwide - this should possibly go to include/poller - $x = q("SELECT * FROM item WHERE verb = '%s' AND obj_type = '%s' AND uid = %d", - dbesc(ACTIVITY_UPDATE), - dbesc(ACTIVITY_OBJ_FILE), - intval(local_channel()) - ); - - if($x) { - - foreach($x as $xx) { - - $object = json_decode($xx['object'],true); - - $d_mid = $object['d_mid']; - $u_mid = $xx['mid']; - - $y = q("DELETE FROM item WHERE obj_type = '%s' AND (verb = '%s' AND mid = '%s') OR (verb = '%s' AND mid = '%s')", - dbesc(ACTIVITY_OBJ_FILE), - dbesc(ACTIVITY_POST), - dbesc($d_mid), - dbesc(ACTIVITY_UPDATE), - dbesc($u_mid) - ); - - } - - } + //check for updated items and remove them + require_once('include/sharedwithme.php'); + apply_updates(); //drop single file - localuser if((argc() > 2) && (argv(2) === 'drop')) { 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 diff --git a/view/tpl/jot.tpl b/view/tpl/jot.tpl index 1dfb0cb75..47787676e 100755 --- a/view/tpl/jot.tpl +++ b/view/tpl/jot.tpl @@ -130,7 +130,7 @@ <div id="profile-jot-submit-right" class="btn-group pull-right"> {{if $showacl}} <button id="dbtn-acl" class="btn btn-default btn-sm" data-toggle="modal" data-target="#aclModal" title="{{$permset}}" onclick="return false;"> - <i id="jot-perms-icon" class="icon-{{$lockstate}} jot-icons">{{$bang}}</i> + <i id="jot-perms-icon" class="icon-{{$lockstate}} jot-icons"></i>{{if $bang}} <i class="icon-exclamation jot-icons"></i>{{/if}} </button> {{/if}} {{if $preview}} diff --git a/view/tpl/section_title.tpl b/view/tpl/section_title.tpl new file mode 100644 index 000000000..338e57042 --- /dev/null +++ b/view/tpl/section_title.tpl @@ -0,0 +1,5 @@ +<div class="section-title-wrapper"> + <h2>{{$title}}</h2> + <div class="clear"></div> +</div> + |