XOOPS  2.6.0
function.xoInboxCount.php
Go to the documentation of this file.
1 <?php
2 
3 function smarty_function_xoInboxCount($params, &$smarty)
4 {
6 
7  if (!$xoops->isUser()) {
8  return;
9  }
10  $time = time();
11  if (isset($_SESSION['xoops_inbox_count']) && @$_SESSION['xoops_inbox_count_expire'] > $time) {
12  $count = intval($_SESSION['xoops_inbox_count']);
13  } else {
14  $pm_handler = $xoops->getHandlerPrivmessage();
15 
16  $xoopsPreload = XoopsPreload::getInstance();
17  $xoopsPreload->triggerEvent('core.class.smarty.xoops_plugins.xoinboxcount', array($pm_handler));
18 
19  $criteria = new CriteriaCompo(new Criteria('read_msg', 0));
20  $criteria->add(new Criteria('to_userid', $xoops->user->getVar('uid')));
21  $count = intval($pm_handler->getCount($criteria));
22  $_SESSION['xoops_inbox_count'] = $count;
23  $_SESSION['xoops_inbox_count_expire'] = $time + 60;
24  }
25  if (!@empty($params['assign'])) {
26  $smarty->assign($params['assign'], $count);
27  } else {
28  echo $count;
29  }
30 }
$_SESSION['RF']["verify"]
Definition: dialog.php:4
static getInstance()
Definition: Events.php:57
static getInstance()
Definition: Xoops.php:160
$xoops
Definition: admin.php:25
$criteria
smarty_function_xoInboxCount($params, &$smarty)
$pm_handler
Definition: readpmsg.php:37