/** * This extension can overide web account logout action * * overrides default logout action and set last activity if required * * @desc last activity is set if * 1. Module is enabled * 2. Override last activity is active * 3. We have found related XMPP user and it was active in the last time() - default timeout - extended timeout * */ public function afterLogout($params) { if ($this->settings['enabled'] == true && $this->settings['check_xmpp_activity_on_web_logout'] == true && erLhcoreClassModelXMPPAccount::getCount(array('filtergt' => array('lactivity' => time() - (int) erLhcoreClassModelChatConfig::fetch('sync_sound_settings')->data['online_timeout'] - (int) $this->settings['append_time']), 'filter' => array('user_id' => (int) $params['user']->getUserID())))) { $db = ezcDbInstance::get(); $stmt = $db->prepare('UPDATE lh_userdep SET last_activity = :last_activity WHERE user_id = :user_id'); $stmt->bindValue(':last_activity', time() + $this->settings['append_time']); $stmt->bindValue(':user_id', (int) $params['user']->getUserID()); $stmt->execute(); } }
<?php if (erLhcoreClassModule::getExtensionInstance('erLhcoreClassExtensionXmppservice')->settings['enabled'] == false) { erLhcoreClassModule::redirect('/'); exit; } $tpl = erLhcoreClassTemplate::getInstance('lhxmppservice/operators.tpl.php'); if (isset($_GET['doSearch'])) { $filterParams = erLhcoreClassSearchHandler::getParams(array('customfilterfile' => 'extension/xmppservice/classes/filter.php', 'format_filter' => true, 'use_override' => true, 'uparams' => $Params['user_parameters_unordered'])); $filterParams['is_search'] = true; } else { $filterParams = erLhcoreClassSearchHandler::getParams(array('customfilterfile' => 'extension/xmppservice/classes/filter.php', 'format_filter' => true, 'uparams' => $Params['user_parameters_unordered'])); $filterParams['is_search'] = false; } $append = erLhcoreClassSearchHandler::getURLAppendFromInput($filterParams['input_form']); $pages = new lhPaginator(); $pages->items_total = erLhcoreClassModelXMPPAccount::getCount($filterParams['filter']); $pages->translationContext = 'chat/activechats'; $pages->serverURL = erLhcoreClassDesign::baseurl('xmppservice/operators') . $append; $pages->paginate(); $tpl->set('pages', $pages); if ($pages->items_total > 0) { $items = erLhcoreClassModelXMPPAccount::getList(array_merge(array('limit' => $pages->items_per_page, 'offset' => $pages->low), $filterParams['filter'])); $tpl->set('items', $items); } $filterParams['input_form']->form_action = erLhcoreClassDesign::baseurl('xmppservice/operators'); $tpl->set('input', $filterParams['input_form']); $tpl->set('inputAppend', $append); $Result['content'] = $tpl->fetch(); $Result['path'] = array(array('url' => erLhcoreClassDesign::baseurl('xmppservice/index'), 'title' => erTranslationClassLhTranslation::getInstance()->getTranslation('xmppservice/module', 'XMPP Service')), array('url' => erLhcoreClassDesign::baseurl('xmppservice/operators'), 'title' => erTranslationClassLhTranslation::getInstance()->getTranslation('xmppservice/module', 'XMPP Accounts')));