diff options
-rw-r--r-- | include/conversation.php | 22 | ||||
-rw-r--r-- | include/template_processor.php | 6 | ||||
-rw-r--r-- | js/main.js | 39 | ||||
-rw-r--r-- | mod/network.php | 15 | ||||
-rw-r--r-- | mod/ping.php | 24 | ||||
-rw-r--r-- | view/acl_selector.tpl | 14 | ||||
-rw-r--r-- | view/jot-header.tpl | 1 | ||||
-rw-r--r-- | view/theme/slackr/birthdays_reminder.tpl.newlayout (renamed from view/theme/slackr/birthdays_reminder.tpl) | 0 | ||||
-rw-r--r-- | view/theme/slackr/events_reminder.tpl | 39 |
9 files changed, 94 insertions, 66 deletions
diff --git a/include/conversation.php b/include/conversation.php index c7406b1dc..f0d453cf5 100644 --- a/include/conversation.php +++ b/include/conversation.php @@ -311,6 +311,7 @@ function localize_item(&$item){ if(!function_exists('conversation')) { function conversation(&$a, $items, $mode, $update, $page_mode = 'traditional') { + $tstart = dba_timer(); require_once('bbcode.php'); @@ -522,6 +523,8 @@ function conversation(&$a, $items, $mode, $update, $page_mode = 'traditional') { $comments = array(); foreach($items as $item) { + + if((intval($item['gravity']) == 6) && ($item['id'] != $item['parent'])) { if(! x($comments,$item['parent'])) $comments[$item['parent']] = 1; @@ -549,6 +552,8 @@ function conversation(&$a, $items, $mode, $update, $page_mode = 'traditional') { foreach($items as $item) { + $tfirst = dba_timer(); + $comment = ''; $template = $tpl; $commentww = ''; @@ -872,8 +877,21 @@ function conversation(&$a, $items, $mode, $update, $page_mode = 'traditional') { call_hooks('display_item', $arr); $threads[$threadsid]['items'][] = $arr['output']; + + $tlast = dba_timer(); + +// logger('render dba_timer: item# ' . $item['id'] . ' ' . sprintf('%01.4f',$tlast - $tfirst)); + + + + } } + +// logger('render total dba_timer: ' . sprintf('%01.4f',$tlast - $tstart)); + + + } // logger('threads: ' . count($threads) . ' update: ' . $update); @@ -907,6 +925,10 @@ function conversation(&$a, $items, $mode, $update, $page_mode = 'traditional') { )); } + $tfinal = dba_timer(); +// logger('render template dba_timer: ' . sprintf('%01.4f',$tfinal - $tlast)); + + return $o; }} diff --git a/include/template_processor.php b/include/template_processor.php index 46252c355..e891b8bf2 100644 --- a/include/template_processor.php +++ b/include/template_processor.php @@ -189,6 +189,7 @@ } public function replace($s, $r) { +// $t1 = dba_timer(); $this->r = $r; $s = $this->_build_nodes($s); @@ -199,12 +200,17 @@ // remove comments block $s = preg_replace('/{#[^#]*#}/', "" , $s); +// $t2 = dba_timer(); + // replace strings recursively (limit to 10 loops) $os = ""; $count=0; while($os!=$s && $count<10){ $os=$s; $count++; $s = $this->var_replace($s); } +// $t3 = dba_timer(); +// logger('macro timer: ' . sprintf('%01.4f %01.4f',$t3 - $t2, $t2 - $t1)); + return $s; } } diff --git a/js/main.js b/js/main.js index 1454dd0b5..bdc1c83e3 100644 --- a/js/main.js +++ b/js/main.js @@ -154,6 +154,27 @@ window.location.href=window.location.href } + + // start live update + + if($('#live-network').length) { src = 'network'; liveUpdate(); } + if($('#live-profile').length) { src = 'profile'; liveUpdate(); } + if($('#live-community').length) { src = 'community'; liveUpdate(); } + if($('#live-notes').length) { src = 'notes'; liveUpdate(); } + if($('#live-display').length) { + if(liking) { + liking = 0; + window.location.href=window.location.href + } + } + if($('#live-photos').length) { + if(liking) { + liking = 0; + window.location.href=window.location.href + } + } + + if(data.network == 0) { data.network = ''; $('#net-update').removeClass('show') @@ -188,24 +209,6 @@ }); - // start live update - - if($('#live-network').length) { src = 'network'; liveUpdate(); } - if($('#live-profile').length) { src = 'profile'; liveUpdate(); } - if($('#live-community').length) { src = 'community'; liveUpdate(); } - if($('#live-notes').length) { src = 'notes'; liveUpdate(); } - if($('#live-display').length) { - if(liking) { - liking = 0; - window.location.href=window.location.href - } - } - if($('#live-photos').length) { - if(liking) { - liking = 0; - window.location.href=window.location.href - } - } }) ; } diff --git a/mod/network.php b/mod/network.php index 2f93dd3bc..4ab0c790b 100644 --- a/mod/network.php +++ b/mod/network.php @@ -602,6 +602,8 @@ function network_content(&$a, $update = 0, $load = false) { if($load) $simple_update = ''; + $start = dba_timer(); + if($nouveau && $load) { // "New Item View" - show all items unthreaded in reverse created date order @@ -625,7 +627,7 @@ function network_content(&$a, $update = 0, $load = false) { $items = fetch_post_tags($items); } elseif($load) { -logger('loading:'); + // Normal conversation view @@ -696,7 +698,7 @@ logger('loading:'); } } -logger('items: ' . count($items)); +// logger('items: ' . count($items)); // We aren't going to try and figure out at the item, group, and page // level which items you've seen and which you haven't. If you're looking @@ -714,11 +716,20 @@ logger('items: ' . count($items)); $mode = (($nouveau) ? 'network-new' : 'network'); + $first = dba_timer(); + $o .= conversation($a,$items,$mode,$update,'client'); + + $second = dba_timer(); + if(! $update) { $o .= alt_pager($a,count($items)); } +// logger('parent dba_timer: ' . sprintf('%01.4f',$first - $start)); +// logger('child dba_timer: ' . sprintf('%01.4f',$second - $first)); + + return $o; } diff --git a/mod/ping.php b/mod/ping.php index da9de09b6..05bfe7842 100644 --- a/mod/ping.php +++ b/mod/ping.php @@ -17,6 +17,7 @@ function ping_init(&$a) { $result['notice'] = array(); $result['info'] = array(); + $t0 = dba_timer(); header("content-type: application/json"); @@ -89,6 +90,9 @@ function ping_init(&$a) { if($t) $result['notify'] = intval($t[0]['total']); + + $t1 = dba_timer(); + $r = q("SELECT `item`.`id`,`item`.`parent`, `item`.`verb`, `item`.`wall`, `item`.`author-name`, `item`.`author-link`, `item`.`author-avatar`, `item`.`created`, `item`.`object`, `pitem`.`author-name` as `pname`, `pitem`.`author-link` as `plink` @@ -108,12 +112,18 @@ function ping_init(&$a) { } } + + $t2 = dba_timer(); + $intros1 = q("SELECT `intro`.`id`, `intro`.`datetime`, `fcontact`.`name`, `fcontact`.`url`, `fcontact`.`photo` FROM `intro` LEFT JOIN `fcontact` ON `intro`.`fid` = `fcontact`.`id` WHERE `intro`.`uid` = %d AND `intro`.`blocked` = 0 AND `intro`.`ignore` = 0 AND `intro`.`fid`!=0", intval(local_user()) ); + + $t3 = dba_timer(); + $intros2 = q("SELECT `intro`.`id`, `intro`.`datetime`, `contact`.`name`, `contact`.`url`, `contact`.`photo` FROM `intro` LEFT JOIN `contact` ON `intro`.`contact-id` = `contact`.`id` @@ -124,6 +134,8 @@ function ping_init(&$a) { $intros = count($intros1) + count($intros2); $result['intros'] = intval($intros); + $t4 = dba_timer(); + $myurl = $a->get_baseurl() . '/profile/' . $a->user['nickname'] ; $mails = q("SELECT *, COUNT(*) AS `total` FROM `mail` WHERE `uid` = %d AND `seen` = 0 AND `from-url` != '%s' ", @@ -138,8 +150,18 @@ function ping_init(&$a) { if($regs) $result['register'] = intval($regs[0]['total']); } + + $t5 = dba_timer(); + + + + $x = json_encode($result); - echo json_encode($result); + $t6 = 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)); + + echo $x; killme(); } diff --git a/view/acl_selector.tpl b/view/acl_selector.tpl index 655ea8980..e5231b0f8 100644 --- a/view/acl_selector.tpl +++ b/view/acl_selector.tpl @@ -16,11 +16,13 @@ <script> $(document).ready(function() { - if(typeof acl=="undefined"){ - acl = new ACL( - baseurl+"/acl", - [ $allowcid,$allowgid,$denycid,$denygid ] - ); - } + setTimeout( function () { + if(typeof acl=="undefined"){ + acl = new ACL( + baseurl+"/acl", + [ $allowcid,$allowgid,$denycid,$denygid ] + ); + } + }, 5000 ); }); </script> diff --git a/view/jot-header.tpl b/view/jot-header.tpl index 64bcf27ca..f777e997f 100644 --- a/view/jot-header.tpl +++ b/view/jot-header.tpl @@ -103,6 +103,7 @@ function initEditor(cb){ } }); + editor = true; // setup acl popup $("a#jot-perms-icon").fancybox({ diff --git a/view/theme/slackr/birthdays_reminder.tpl b/view/theme/slackr/birthdays_reminder.tpl.newlayout index 1dc65295a..1dc65295a 100644 --- a/view/theme/slackr/birthdays_reminder.tpl +++ b/view/theme/slackr/birthdays_reminder.tpl.newlayout diff --git a/view/theme/slackr/events_reminder.tpl b/view/theme/slackr/events_reminder.tpl deleted file mode 100644 index bd1a57d18..000000000 --- a/view/theme/slackr/events_reminder.tpl +++ /dev/null @@ -1,39 +0,0 @@ -<link rel='stylesheet' type='text/css' href='$baseurl/library/fullcalendar/fullcalendar.css' /> -<script language="javascript" type="text/javascript" - src="$baseurl/library/fullcalendar/fullcalendar.min.js"></script> -<script> - // start calendar from yesterday - var yesterday= new Date() - yesterday.setDate(yesterday.getDate()-1) - - function showEvent(eventid) { - $.get( - '$baseurl/events/?id='+eventid, - function(data){ - $.fancybox(data); - } - ); - } - $(document).ready(function() { - $('#events-reminder').fullCalendar({ - firstDay: yesterday.getDay(), - year: yesterday.getFullYear(), - month: yesterday.getMonth(), - date: yesterday.getDate(), - events: '$baseurl/events/json/', - header: { - left: '', - center: '', - right: '' - }, - timeFormat: 'HH(:mm)', - defaultView: 'basicWeek', - height: 50, - eventClick: function(calEvent, jsEvent, view) { - showEvent(calEvent.id); - } - }); - }); -</script> -<div id="events-reminder" class="$classtoday"></div> -<br> |