$tabs = '';
if ($a->argc >1 && is_numeric($a->argv[1])) {
- $tabs = render_messages(get_messages(local_user(),0,5), 'mail_list.tpl');
+ $tabs = render_messages(get_messages(local_user(),0,5), 'mail_list.tpl');
}
$new = array(
dbesc($myprofile)
);
- if(count($r)) $a->set_pager_total($r[0]['total']);
+ if (is_filled_array($r)) {
+ $a->set_pager_total($r[0]['total']);
+ }
$r = get_messages(local_user(), $a->pager['start'], $a->pager['itemspage']);
- if(! count($r)) {
+ if(! is_filled_array($r)) {
info( t('No messages.') . EOL);
return $o;
}
);
}
-function render_messages($msg, $t) {
+function render_messages(array $msg, $t) {
$a = get_app();
$dislikes = array();
$friends = array();
$posts = array();
+ $regs = array();
+ $mails = array();
$home = 0;
$network = 0;
intval(local_user()), intval(local_user())
);
- if(count($r)) {
+ if(is_filled_array($r)) {
$arr = array('items' => $r);
call_hooks('network_ping', $arr);
$intro = count($intros1) + count($intros2);
$intros = $intros1+$intros2;
-
-
$myurl = $a->get_baseurl() . '/profile/' . $a->user['nickname'] ;
$mails = q("SELECT * FROM `mail`
WHERE `uid` = %d AND `seen` = 0 AND `from-url` != '%s' ",
dbesc(datetime_convert('UTC','UTC','now'))
);
- if($ev && count($ev)) {
+ if(is_filled_array($ev)) {
$all_events = intval($ev[0]['total']);
if($all_events) {
<home>$home</home>\r\n";
if ($register!=0) echo "<register>$register</register>";
- if (count($groups_unseen)) {
+ if ( is_filled_array($groups_unseen) ) {
echo '<groups>';
foreach ($groups_unseen as $it)
if ($it['count'] > 0)
echo "</groups>";
}
- if (count($forums_unseen)) {
+ if ( is_filled_array($forums_unseen) ) {
echo '<forums>';
foreach ($forums_unseen as $it)
if ($it['count'] > 0)
<birthdays-today>$birthdays_today</birthdays-today>\r\n";
- if(count($notifs) && (! $sysnotify)) {
- foreach($notifs as $zz) {
+ if (is_filled_array($notifs) && (! $sysnotify)) {
+ foreach ($notifs as $zz) {
if($zz['seen'] == 0)
$sysnotify ++;
}
echo ' <notif count="'. ($sysnotify + $intro + $mail + $register) .'">';
// merge all notification types in one array
- if ($intro>0){
+ if ( is_filled_array($intros) ) {
foreach ($intros as $i) {
$n = array(
'href' => $a->get_baseurl().'/notifications/intros/'.$i['id'],
}
}
- if ($mail>0){
+ if ( is_filled_array($mails) ) {
foreach ($mails as $i) {
$n = array(
'href' => $a->get_baseurl().'/message/'.$i['id'],
}
}
- if ($register>0){
+ if ( is_filled_array($regs) ) {
foreach ($regs as $i) {
$n = array(
'href' => $a->get_baseurl().'/admin/users/',
$notifs[] = $n;
}
}
+
// sort notifications by $[]['date']
$sort_function = function($a, $b) {
$adate = date($a['date']);
};
usort($notifs, $sort_function);
- if(count($notifs)) {
+ if( is_filled_array($notifs) ) {
foreach($notifs as $n) {
echo xmlize($n);
}