Merge branch 'dev' of https://github.com/redmatrix/hubzilla into xdev_merge

This commit is contained in:
zotlabs 2017-07-28 15:25:29 -07:00
commit e316494e06
11 changed files with 110 additions and 17 deletions

View File

@ -140,7 +140,7 @@ class Display extends \Zotlabs\Web\Controller {
if((! $update) && (! $load)) { if((! $update) && (! $load)) {
$static = ((local_channel()) ? channel_manual_conv_update(local_channel()) : 0); $static = ((local_channel()) ? channel_manual_conv_update(local_channel()) : 1);
$o .= '<div id="live-display"></div>' . "\r\n"; $o .= '<div id="live-display"></div>' . "\r\n";
$o .= "<script> var profile_uid = " . ((intval(local_channel())) ? local_channel() : (-1)) $o .= "<script> var profile_uid = " . ((intval(local_channel())) ? local_channel() : (-1))

View File

@ -534,12 +534,13 @@ class Network extends \Zotlabs\Web\Controller {
if($parents_str) { if($parents_str) {
$update_unseen = " AND ( id IN ( " . dbesc($parents_str) . " )"; $update_unseen = " AND ( id IN ( " . dbesc($parents_str) . " )";
$update_unseen .= " AND item_notshown = 0";
$update_unseen .= " OR ( parent IN ( " . dbesc($parents_str) . " ) AND verb in ( '" . dbesc(ACTIVITY_LIKE) . "','" . dbesc(ACTIVITY_DISLIKE) . "' ))) "; $update_unseen .= " OR ( parent IN ( " . dbesc($parents_str) . " ) AND verb in ( '" . dbesc(ACTIVITY_LIKE) . "','" . dbesc(ACTIVITY_DISLIKE) . "' ))) ";
} }
} }
else { else {
if($parents_str) { if($parents_str) {
$update_unseen = " AND parent IN ( " . dbesc($parents_str) . " )"; $update_unseen = " AND parent IN ( " . dbesc($parents_str) . " ) AND item_notshown = 0";
} }
} }
} }

View File

@ -36,6 +36,8 @@ class Ping extends \Zotlabs\Web\Controller {
$result['all_events_today'] = 0; $result['all_events_today'] = 0;
$result['notice'] = array(); $result['notice'] = array();
$result['info'] = array(); $result['info'] = array();
$result['pubs'] = 0;
$result['files'] = 0;
$t0 = dba_timer(); $t0 = dba_timer();
@ -134,6 +136,24 @@ class Ping extends \Zotlabs\Web\Controller {
db_utcnow(), db_quoteinterval('3 MINUTE') db_utcnow(), db_quoteinterval('3 MINUTE')
); );
if(($vnotify & VNOTIFY_PUBS) && ! get_config('system', 'disable_discover_tab')) {
$sys = get_sys_channel();
$pubs = q("SELECT count(id) as total from item
WHERE uid = %d
AND item_unseen = 1
AND created > '" . datetime_convert('UTC','UTC',$_SESSION['static_loadtime']) . "'
$item_normal",
intval($sys['channel_id'])
);
if($pubs)
$result['pubs'] = intval($pubs[0]['total']);
}
$t1 = dba_timer();
if((! local_channel()) || ($result['invalid'])) { if((! local_channel()) || ($result['invalid'])) {
echo json_encode($result); echo json_encode($result);
killme(); killme();
@ -356,13 +376,32 @@ class Ping extends \Zotlabs\Web\Controller {
$result['notify'] = intval($t[0]['total']); $result['notify'] = intval($t[0]['total']);
} }
$t1 = dba_timer(); $t2 = dba_timer();
if($vnotify & VNOTIFY_FILES) {
$files = q("SELECT count(id) as total FROM item
WHERE verb = '%s'
AND obj_type = '%s'
AND uid = %d
AND owner_xchan != '%s'
AND item_unseen = 1",
dbesc(ACTIVITY_POST),
dbesc(ACTIVITY_OBJ_FILE),
intval(local_channel()),
dbesc($ob_hash)
);
if($files)
$result['files'] = intval($files[0]['total']);
}
$t2 = dba_timer();
if($vnotify & (VNOTIFY_NETWORK|VNOTIFY_CHANNEL)) { if($vnotify & (VNOTIFY_NETWORK|VNOTIFY_CHANNEL)) {
$r = q("SELECT id, item_wall FROM item $r = q("SELECT id, item_wall FROM item
WHERE item_unseen = 1 and uid = %d WHERE item_unseen = 1 and uid = %d
$item_normal $item_normal
and author_xchan != '%s'", AND author_xchan != '%s'
AND item_notshown = 0",
intval(local_channel()), intval(local_channel()),
dbesc($ob_hash) dbesc($ob_hash)
); );
@ -384,20 +423,20 @@ class Ping extends \Zotlabs\Web\Controller {
if(! ($vnotify & VNOTIFY_CHANNEL)) if(! ($vnotify & VNOTIFY_CHANNEL))
$result['home'] = 0; $result['home'] = 0;
$t2 = dba_timer(); $t4 = dba_timer();
if($vnotify & VNOTIFY_INTRO) { if($vnotify & VNOTIFY_INTRO) {
$intr = q("SELECT COUNT(abook.abook_id) AS total FROM abook left join xchan on abook.abook_xchan = xchan.xchan_hash where abook_channel = %d and abook_pending = 1 and abook_self = 0 and abook_ignored = 0 and xchan_deleted = 0 and xchan_orphan = 0 ", $intr = q("SELECT COUNT(abook.abook_id) AS total FROM abook left join xchan on abook.abook_xchan = xchan.xchan_hash where abook_channel = %d and abook_pending = 1 and abook_self = 0 and abook_ignored = 0 and xchan_deleted = 0 and xchan_orphan = 0 ",
intval(local_channel()) intval(local_channel())
); );
$t3 = dba_timer(); $t5 = dba_timer();
if($intr) if($intr)
$result['intros'] = intval($intr[0]['total']); $result['intros'] = intval($intr[0]['total']);
} }
$t4 = dba_timer(); $t6 = dba_timer();
$channel = \App::get_channel(); $channel = \App::get_channel();
if($vnotify & VNOTIFY_MAIL) { if($vnotify & VNOTIFY_MAIL) {
@ -420,7 +459,7 @@ class Ping extends \Zotlabs\Web\Controller {
} }
} }
$t5 = dba_timer(); $t7 = dba_timer();
if($vnotify & (VNOTIFY_EVENT|VNOTIFY_EVENTTODAY|VNOTIFY_BIRTHDAY)) { if($vnotify & (VNOTIFY_EVENT|VNOTIFY_EVENTTODAY|VNOTIFY_BIRTHDAY)) {
$events = q("SELECT etype, dtstart, adjust FROM event $events = q("SELECT etype, dtstart, adjust FROM event
@ -466,9 +505,9 @@ class Ping extends \Zotlabs\Web\Controller {
$x = json_encode($result); $x = json_encode($result);
$t6 = dba_timer(); $t8 = dba_timer();
// logger('ping timer: ' . sprintf('%01.4f %01.4f %01.4f %01.4f %01.4f %01.4f',$t6 - $t5, $t5 - $t4, $t4 - $t3, $t3 - $t2, $t2 - $t1, $t1 - $t0)); // logger('ping timer: ' . sprintf('%01.4f %01.4f %01.4f %01.4f %01.4f %01.4f %01.4f %01.4f',$t8 - $t7, $t7 - $t6, $t6 - $t5, $t5 - $t4, $t4 - $t3, $t3 - $t2, $t2 - $t1, $t1 - $t0));
echo $x; echo $x;
killme(); killme();

View File

@ -7,10 +7,11 @@ require_once('include/conversation.php');
class Pubstream extends \Zotlabs\Web\Controller { class Pubstream extends \Zotlabs\Web\Controller {
function get($update = 0, $load = false) { function get($update = 0, $load = false) {
if($load) if($load)
$_SESSION['loadtime'] = datetime_convert(); $_SESSION['loadtime'] = datetime_convert();
if(observer_prohibited(true)) { if(observer_prohibited(true)) {
return login(); return login();
@ -27,7 +28,9 @@ class Pubstream extends \Zotlabs\Web\Controller {
if(! $update) { if(! $update) {
$static = ((local_channel()) ? channel_manual_conv_update(local_channel()) : 0); $_SESSION['static_loadtime'] = datetime_convert();
$static = ((local_channel()) ? channel_manual_conv_update(local_channel()) : 1);
$maxheight = get_config('system','home_divmore_height'); $maxheight = get_config('system','home_divmore_height');
if(! $maxheight) if(! $maxheight)

View File

@ -199,6 +199,10 @@ class Channel {
$vnotify += intval($_POST['vnotify10']); $vnotify += intval($_POST['vnotify10']);
if(x($_POST,'vnotify11')) if(x($_POST,'vnotify11'))
$vnotify += intval($_POST['vnotify11']); $vnotify += intval($_POST['vnotify11']);
if(x($_POST,'vnotify12'))
$vnotify += intval($_POST['vnotify12']);
if(x($_POST,'vnotify13') && ! get_config('system', 'disable_discover_tab'))
$vnotify += intval($_POST['vnotify13']);
$always_show_in_notices = x($_POST,'always_show_in_notices') ? 1 : 0; $always_show_in_notices = x($_POST,'always_show_in_notices') ? 1 : 0;
@ -555,6 +559,8 @@ class Channel {
'$vnotify9' => array('vnotify9', t('System critical alerts'), ($vnotify & VNOTIFY_ALERT), VNOTIFY_ALERT, t('Recommended'), $yes_no), '$vnotify9' => array('vnotify9', t('System critical alerts'), ($vnotify & VNOTIFY_ALERT), VNOTIFY_ALERT, t('Recommended'), $yes_no),
'$vnotify10' => array('vnotify10', t('New connections'), ($vnotify & VNOTIFY_INTRO), VNOTIFY_INTRO, t('Recommended'), $yes_no), '$vnotify10' => array('vnotify10', t('New connections'), ($vnotify & VNOTIFY_INTRO), VNOTIFY_INTRO, t('Recommended'), $yes_no),
'$vnotify11' => array('vnotify11', t('System Registrations'), ($vnotify & VNOTIFY_REGISTER), VNOTIFY_REGISTER, '', $yes_no), '$vnotify11' => array('vnotify11', t('System Registrations'), ($vnotify & VNOTIFY_REGISTER), VNOTIFY_REGISTER, '', $yes_no),
'$vnotify12' => array('vnotify12', t('Unseen shared files'), ($vnotify & VNOTIFY_FILES), VNOTIFY_FILES, '', $yes_no),
'$vnotify13' => ((! get_config('system', 'disable_discover_tab')) ? array('vnotify13', t('Unseen public activity'), ($vnotify & VNOTIFY_PUBS), VNOTIFY_PUBS, '', $yes_no) : array()),
'$always_show_in_notices' => array('always_show_in_notices', t('Also show new wall posts, private messages and connections under Notices'), $always_show_in_notices, 1, '', $yes_no), '$always_show_in_notices' => array('always_show_in_notices', t('Also show new wall posts, private messages and connections under Notices'), $always_show_in_notices, 1, '', $yes_no),
'$evdays' => array('evdays', t('Notify me of events this many days in advance'), $evdays, t('Must be greater than 0')), '$evdays' => array('evdays', t('Notify me of events this many days in advance'), $evdays, t('Must be greater than 0')),

View File

@ -49,7 +49,7 @@ require_once('include/hubloc.php');
require_once('include/attach.php'); require_once('include/attach.php');
define ( 'PLATFORM_NAME', 'hubzilla' ); define ( 'PLATFORM_NAME', 'hubzilla' );
define ( 'STD_VERSION', '2.5.10' ); define ( 'STD_VERSION', '2.7.0' );
define ( 'ZOT_REVISION', '1.3' ); define ( 'ZOT_REVISION', '1.3' );
define ( 'DB_UPDATE_VERSION', 1192 ); define ( 'DB_UPDATE_VERSION', 1192 );
@ -402,6 +402,8 @@ define ( 'VNOTIFY_INFO', 0x0080 );
define ( 'VNOTIFY_ALERT', 0x0100 ); define ( 'VNOTIFY_ALERT', 0x0100 );
define ( 'VNOTIFY_INTRO', 0x0200 ); define ( 'VNOTIFY_INTRO', 0x0200 );
define ( 'VNOTIFY_REGISTER', 0x0400 ); define ( 'VNOTIFY_REGISTER', 0x0400 );
define ( 'VNOTIFY_FILES', 0x0800 );
define ( 'VNOTIFY_PUBS', 0x1000 );

View File

@ -200,12 +200,18 @@ EOT;
$nav['settings'] = array('settings', t('Settings'),"", t('Account/Channel Settings'),'settings_nav_btn'); $nav['settings'] = array('settings', t('Settings'),"", t('Account/Channel Settings'),'settings_nav_btn');
$nav['files'] = array('sharedwithme', t('Shared Files'), "", t('New files shared with me'),'files_nav_btn');
}
if(! get_config('system', 'disable_discover_tab')) {
$nav['pubs'] = array('pubstream', t('Public stream'), "", t('Public stream activities'),'pubs_nav_btn');
} }
/** /**
* Admin page * Admin page
*/ */
if (is_site_admin()){ if (is_site_admin()) {
$nav['admin'] = array('admin/', t('Admin'), "", t('Site Setup and Configuration'),'admin_nav_btn'); $nav['admin'] = array('admin/', t('Admin'), "", t('Site Setup and Configuration'),'admin_nav_btn');
} }

View File

@ -370,7 +370,7 @@ function NavUpdate() {
updateCountsOnly = false; updateCountsOnly = false;
if(data.network || data.home || data.intros || data.mail || data.all_events || data.notify) { if(data.network || data.home || data.intros || data.mail || data.all_events || data.notify || data.files || data.pubs) {
$('#notifications-btn').css('opacity', 1); $('#notifications-btn').css('opacity', 1);
} }
else { else {
@ -386,6 +386,22 @@ function NavUpdate() {
} }
$('.net-update').html(data.network); $('.net-update').html(data.network);
if(data.pubs == 0) {
data.pubs = '';
$('.pubs-update, .pubs-button').hide();
} else {
$('.pubs-update, .pubs-button').show();
}
$('.pubs-update').html(data.pubs);
if(data.files == 0) {
data.files = '';
$('.files-update, .files-button').hide();
} else {
$('.files-update, .files-button').show();
}
$('.files-update').html(data.files);
if(data.home == 0) { data.home = ''; $('.home-update, .home-button').hide(); } else { $('.home-update, .home-button').show(); } if(data.home == 0) { data.home = ''; $('.home-update, .home-button').hide(); } else { $('.home-update, .home-button').show(); }
$('.home-update').html(data.home); $('.home-update').html(data.home);

View File

@ -68,7 +68,7 @@
<i class="fa fa-exclamation-circle"></i> <i class="fa fa-exclamation-circle"></i>
</button> </button>
{{/if}} {{/if}}
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbar-collapse-2"> <button class="navbar-toggler border-0" type="button" data-toggle="collapse" data-target="#navbar-collapse-2">
<i class="fa fa-bars"></i> <i class="fa fa-bars"></i>
</button> </button>
</div> </div>
@ -166,6 +166,22 @@
<a class="nav-link" href="{{$nav.alogout.0}}" title="{{$nav.alogout.3}}" id="{{$nav.alogout.4}}">{{$nav.alogout.1}}</a> <a class="nav-link" href="{{$nav.alogout.0}}" title="{{$nav.alogout.3}}" id="{{$nav.alogout.4}}">{{$nav.alogout.1}}</a>
</li> </li>
{{/if}} {{/if}}
{{if $nav.files}}
<li class="nav-item dropdown files-button" style="display: none;">
<a class="nav-link" href="{{$nav.files.0}}" title="{{$nav.files.3}}" id="{{$nav.files.4}}" rel="#nav-files-menu">
<i class="fa fa-fw fa-folder"></i>
<span class="badge badge-pill badge-primary files-update"></span>
</a>
</li>
{{/if}}
{{if $nav.pubs}}
<li class="nav-item dropdown pubs-button" style="display: none;">
<a class="nav-link" href="{{$nav.pubs.0}}" title="{{$nav.pubs.3}}" id="{{$nav.pubs.4}}" rel="#nav-pubs-menu">
<i class="fa fa-fw fa-globe"></i>
<span class="badge badge-pill badge-primary pubs-update"></span>
</a>
</li>
{{/if}}
</ul> </ul>
<div id="banner" class="navbar-text d-none d-md-flex">{{$banner}}</div> <div id="banner" class="navbar-text d-none d-md-flex">{{$banner}}</div>

View File

@ -137,6 +137,10 @@
{{include file="field_intcheckbox.tpl" field=$vnotify8}} {{include file="field_intcheckbox.tpl" field=$vnotify8}}
{{include file="field_intcheckbox.tpl" field=$vnotify9}} {{include file="field_intcheckbox.tpl" field=$vnotify9}}
{{include file="field_intcheckbox.tpl" field=$vnotify11}} {{include file="field_intcheckbox.tpl" field=$vnotify11}}
{{include file="field_intcheckbox.tpl" field=$vnotify12}}
{{if $vnotify13}}
{{include file="field_intcheckbox.tpl" field=$vnotify13}}
{{/if}}
{{include file="field_intcheckbox.tpl" field=$always_show_in_notices}} {{include file="field_intcheckbox.tpl" field=$always_show_in_notices}}
{{include file="field_input.tpl" field=$evdays}} {{include file="field_input.tpl" field=$evdays}}
</div> </div>

View File

@ -15,7 +15,7 @@
{{foreach $items as $item}} {{foreach $items as $item}}
<tr id="cloud-index-{{$item.id}}"> <tr id="cloud-index-{{$item.id}}">
<td><i class="fa {{$item.objfiletypeclass}}" title="{{$item.objfiletype}}"></i></td> <td><i class="fa {{$item.objfiletypeclass}}" title="{{$item.objfiletype}}"></i></td>
<td><a href="{{$item.objurl}}">{{$item.objfilename}}</a>{{if $item.unseen}}&nbsp;<span class="label label-success">{{$label_new}}</span>{{/if}}</td> <td><a href="{{$item.objurl}}">{{$item.objfilename}}</a>{{if $item.unseen}}&nbsp;<span class="badge badge-pill badge-success">{{$label_new}}</span>{{/if}}</td>
<td class="cloud-index-tool"><a href="#" title="{{$drop}}" onclick="dropItem('/sharedwithme/{{$item.id}}/drop', '#cloud-index-{{$item.id}}'); return false;"><i class="fa fa-trash-o drop-icons"></i></a></td> <td class="cloud-index-tool"><a href="#" title="{{$drop}}" onclick="dropItem('/sharedwithme/{{$item.id}}/drop', '#cloud-index-{{$item.id}}'); return false;"><i class="fa fa-trash-o drop-icons"></i></a></td>
<td class="d-none d-md-table-cell">{{$item.objfilesize}}</td> <td class="d-none d-md-table-cell">{{$item.objfilesize}}</td>
<td class="d-none d-md-table-cell">{{$item.objedited}}</td> <td class="d-none d-md-table-cell">{{$item.objedited}}</td>