require_once('include/bbcode.php');
require_once('include/ForumManager.php');
require_once('include/group.php');
require_once('mod/proxy.php');
require_once('include/xml.php');
require_once('include/cache.php');
require_once('include/bbcode.php');
require_once('include/ForumManager.php');
require_once('include/group.php');
require_once('mod/proxy.php');
require_once('include/xml.php');
require_once('include/cache.php');
- $ev = qu("SELECT count(`event`.`id`) AS total, type, start, adjust FROM `event`
+ $ev = qu("SELECT type, start, adjust FROM `event`
if ($all_events) {
$str_now = datetime_convert('UTC', $a->timezone, 'now', 'Y-m-d');
if ($all_events) {
$str_now = datetime_convert('UTC', $a->timezone, 'now', 'Y-m-d');
// sort notifications by $[]['date']
$sort_function = function($a, $b) {
// sort notifications by $[]['date']
$sort_function = function($a, $b) {
- $adate = date($a['date']);
- $bdate = date($b['date']);
+ $adate = strtotime($a['date']);
+ $bdate = strtotime($b['date']);
+
+ // Unseen messages are kept at the top
+ // The value 31536000 means one year. This should be enough :-)
+ if (!$a['seen']) {
+ $adate += 31536000;
+ }
+ if (!$b['seen']) {
+ $bdate += 31536000;
+ }
+
if (dbm::is_result($notifs)) {
// Are the nofications called from the regular process or via the friendica app?
if (dbm::is_result($notifs)) {
// Are the nofications called from the regular process or via the friendica app?
- if ($notification["visible"] AND !$notification["spam"] AND
- !$notification["deleted"] AND !is_array($result[$notification["parent"]])) {
+ if ($notification["visible"] && !$notification["spam"] &&
+ !$notification["deleted"] && !is_array($result[$notification["parent"]])) {