function message_seen_all($user, $seen_type = MESSAGE_ENUM_NOTIFICATION_TYPE_SCREEN) { $messages = array(); if (message_get($messages, $user)) { foreach ($messages as $message) { message_seen($message['ref']); } } }
<?php DEFINE("MESSAGE_POLLING_ABSENT_USER_TIMEOUT_SECONDS", 30); DEFINE("MESSAGE_FADEOUT_SECONDS", 5); // check for callback, i.e. this file being called directly to get any new messages if (basename(__FILE__) == basename($_SERVER['PHP_SELF'])) { include __DIR__ . "/../../include/general.php"; include __DIR__ . "/../../include/db.php"; // It is an acknowledgement so set as seen and get out of here if (isset($_GET['seen'])) { message_seen($_GET['seen']); return; } // Acknowledgement all messages then get out of here if (isset($_GET['allseen'])) { message_seen_all($_GET['allseen']); return; } // Purge messages that have an expired TTL then get out of here if (isset($_GET['purge'])) { message_purge(); return; } if (isset($_GET['user'])) { $user = $_GET['user']; } else { include __DIR__ . "/../../include/authenticate.php"; // no user specified so default to the current user $user = $userref; } // Check if there are messages