if (!isset($_POST['csfr_token']) || !$currentUser->validateCSFRToken($_POST['csfr_token'])) {
        erLhcoreClassModule::redirect('chat/blockedusers');
        exit;
    }
    $form = new ezcInputForm(INPUT_POST, $definition);
    $Errors = array();
    if ($form->hasValidData('IPToBlock') && $form->IPToBlock != '') {
        $ipBlock = new erLhcoreClassModelChatBlockedUser();
        $ipBlock->ip = $form->IPToBlock;
        $ipBlock->user_id = erLhcoreClassUser::instance()->getUserID();
        $ipBlock->datets = time();
        $ipBlock->saveThis();
        $tpl->set('block_saved', true);
    } else {
        $tpl->set('errors', array('Please enter an IP to block'));
    }
}
$pages = new lhPaginator();
$pages->serverURL = '/index.php/site_admin/chat/blockedusers';
$pages->items_total = erLhcoreClassModelChatBlockedUser::getCount();
$pages->setItemsPerPage(20);
$pages->paginate();
$items = array();
if ($pages->items_total > 0) {
    $items = erLhcoreClassModelChatBlockedUser::getList(array('offset' => $pages->low, 'limit' => $pages->items_per_page, 'sort' => 'id ASC'));
}
$tpl->set('items', $items);
$tpl->set('pages', $pages);
$Result['content'] = $tpl->fetch();
$Result['path'] = array(array('url' => '/index.php/site_admin/system/configuration', 'title' => 'System configuration'), array('title' => 'Blocked users'));
erLhcoreClassChatEventDispatcher::getInstance()->dispatch('chat.blockedusres_path', array('result' => &$Result));