<?php require_once $_SERVER['DOCUMENT_ROOT'] . '/class/autoload.php'; use NERDZ\Core\Notification; use NERDZ\Core\Db; use NERDZ\Core\Config; use NERDZ\Core\RedisSessionHandler; use NERDZ\Core\Utils; $user = new Notification(); header("Content-Type: text/event-stream\n\n"); $push = function ($event, $status, $message) use($user) { echo 'event: ', $event, "\n", 'data: ', Utils::toJsonResponse($status, $message), "\n\n"; ob_flush(); flush(); }; $dontSendCacheLimiter = function () { // http://stackoverflow.com/a/12315542 ini_set('session.use_only_cookies', false); ini_set('session.use_cookies', false); ini_set('session.use_trans_sid', false); ini_set('session.cache_limiter', null); if (Config\REDIS_HOST !== '' && Config\REDIS_PORT !== '') { new RedisSessionHandler(Config\REDIS_HOST, Config\REDIS_PORT); } else { session_start(); } }; if (!$user->isLogged()) { $push('notification', 'error', $user->lang('REGISTER')); $push('pm', 'error', $user->lang('REGISTER')); } else {
<?php ob_start('ob_gzhandler'); require_once $_SERVER['DOCUMENT_ROOT'] . '/class/autoload.php'; use NERDZ\Core\Notification; use NERDZ\Core\User; $notification = new Notification(); $user = new User(); if ($user->isLogged()) { die(NERDZ\Core\Utils::jsonResponse('ok', $notification->countPms())); } die(NERDZ\Core\Utils::jsonResponse('error', $user->lang('ERROR')));
<?php ob_start('ob_gzhandler'); require_once $_SERVER['DOCUMENT_ROOT'] . '/class/autoload.php'; use NERDZ\Core\Notification; use NERDZ\Core\User; $notification = new Notification(); $user = new User(); if ($user->isLogged()) { die(NERDZ\Core\Utils::jsonResponse('ok', $notification->count(false, true))); } die(NERDZ\Core\Utils::jsonResponse('error', $user->lang('REGISTER')));
<?php ob_start('ob_gzhandler'); require_once $_SERVER['DOCUMENT_ROOT'] . '/class/autoload.php'; use NERDZ\Core\Notification; use NERDZ\Core\User; ob_start(array('NERDZ\\Core\\Utils', 'minifyHTML')); $user = new User(); $notification = new Notification(); // group notification by default if ($user->isLogged()) { $vals = []; $vals['list_a'] = $notification->show('all', !isset($_POST['doNotDelete'])); if (!count($vals['list_a'])) { $vals['list_a'] = $notification->story(); } else { $notification->updateStory($vals['list_a']); } $user->getTPL()->assign($vals); $user->getTPL()->draw('profile/notify'); } else { echo $user->lang('REGISTER'); }