Example #1
0
<?php

require_once '../kernel/setup_inc.php';
$gBitSystem->verifyPermission('p_chatterbox_use');
// we'll do the pruning here - no need to clear out the db on *every* js triggered page load
require_once CHATTERBOX_PKG_PATH . 'Chatterbox.php';
$gChatterbox = new Chatterbox();
$gChatterbox->pruneList($gBitSystem->getConfig('chatterbox_prune_threshold', 604800));
// Load common ajax library
$gBitSmarty->assign('loadAjax', 'prototype');
// display template
$gBitSystem->display('bitpackage:chatterbox/chatterbox.tpl', tra('Chat'), array('display_mode' => 'display'));
Example #2
0
 *
 * Chatterbox class
 *
 * @author   xing <*****@*****.**>
 * @version  $Revision$
 * @package  chatterbox
 */
/**
 * required setup
 */
require_once '../kernel/setup_inc.php';
require_once CHATTERBOX_PKG_PATH . 'Chatterbox.php';
//Headers are sent to prevent browsers from caching.. IE is still resistant sometimes
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . "GMT");
header("Cache-Control: no-cache, must-revalidate");
header("Pragma: no-cache");
header("Content-Type: text/html; charset=utf-8");
$gChatterbox = new Chatterbox();
$listHash = array('max_records' => !empty($_REQUEST['max_records']) ? $_REQUEST['max_records'] : 60, 'last_id' => !empty($_REQUEST['last_id']) ? $_REQUEST['last_id'] : -1);
$chatter = $gChatterbox->getList($listHash);
$gBitSmarty->assign('chatter', $chatter['data']);
$gBitSmarty->assign('users', $chatter['users']);
if (!empty($chatter['data'])) {
    $ids = array_keys($chatter['data']);
    echo $ids[0];
    echo '||||';
    echo $gBitSmarty->fetch('bitpackage:chatterbox/chatter_inc.tpl');
    echo '||||';
    echo $gBitSmarty->fetch('bitpackage:chatterbox/users_inc.tpl');
}
Example #3
0
<?php

/**
 * @version $Header$
 *
 * +----------------------------------------------------------------------+
 * | Copyright ( c ) 2004, bitweaver.org
 * +----------------------------------------------------------------------+
 * | All Rights Reserved. See below for details and a complete list of authors.
 * | Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See http://www.gnu.org/copyleft/lesser.html for details
 * |
 * | For comments, please use phpdocu.sourceforge.net documentation standards!!!
 * | -> see http://phpdocu.sourceforge.net/
 * +----------------------------------------------------------------------+
 * | Authors: xing <*****@*****.**>
 * +----------------------------------------------------------------------+
 *
 * Chatterbox class
 *
 * @author   xing <*****@*****.**>
 * @version  $Revision$
 * @package  chatterbox
 */
/**
 * required setup
 */
require_once '../kernel/setup_inc.php';
require_once CHATTERBOX_PKG_PATH . 'Chatterbox.php';
$gChatterbox = new Chatterbox();
$gChatterbox->store($_REQUEST);
<?php

// $Header$
require_once CHATTERBOX_PKG_PATH . 'Chatterbox.php';
$gChatterbox = new Chatterbox();
if (!empty($_REQUEST['chatterbox_settings']) && !empty($_REQUEST['clear_logs'])) {
    $gChatterbox->pruneList(0);
}
// get the chatterbox data
$listHash = array('page' => !empty($_REQUEST['curPage']) ? $_REQUEST['curPage'] : 1, 'max_records' => !empty($_REQUEST['max_records']) ? $_REQUEST['max_records'] : 60, 'last_id' => !empty($_REQUEST['last_id']) ? $_REQUEST['last_id'] : -1, 'get_count' => TRUE);
$chatterbox = $gChatterbox->getList($listHash);
$gBitSmarty->assign('chatterbox', $chatterbox);
// pagination
$offset = !empty($_REQUEST['offset']) ? $_REQUEST['offset'] : 0;
$gBitSmarty->assign('curPage', $curPage = !empty($_REQUEST['curPage']) ? $_REQUEST['curPage'] : 1);
// calculate page number
$numPages = ceil($chatterbox['cant'] / $listHash['max_records']);
$gBitSmarty->assign('numPages', $numPages);
$pruneThreshold = array('-1' => tra('None'), '3600' => tra('Hour'), '86400' => tra('Day'), '604800' => tra('Week'), '2629743' => tra('Month'), '31556926' => tra('Year'), '999999999' => tra('Unlimited'));
$gBitSmarty->assign('pruneThreshold', $pruneThreshold);
if (!empty($_REQUEST['chatterbox_settings'])) {
    simple_set_value('chatterbox_prune_threshold', CHATTERBOX_PKG_NAME);
    simple_set_int('online_user_timeout', CHATTERBOX_PKG_NAME);
}
Example #5
0
 function verify(&$pParamHash)
 {
     global $gBitUser;
     // if user is logged in, use the user_id, otherwise just use custom name
     $pParamHash['chatterbox_store']['user_id'] = NULL;
     $pParamHash['chatterbox_store']['author'] = NULL;
     if ($gBitUser->isRegistered()) {
         $pParamHash['chatterbox_store']['user_id'] = $gBitUser->mUserId;
     } elseif (!empty($pParamHash['author'])) {
         $pParamHash['chatterbox_store']['author'] = Chatterbox::cleanupString($pParamHash['author'], 30);
     }
     // timestamp
     $pParamHash['chatterbox_store']['created'] = $this->mDate->getUTCTime();
     // data string
     if (!empty($pParamHash['data'])) {
         $pParamHash['chatterbox_store']['data'] = Chatterbox::cleanupString($pParamHash['data'], 500);
     } else {
         $pParamHash['chatterbox_store']['data'] = NULL;
         $this->mErrors['data'] = 'You need to enter some data to store';
     }
     return count($this->mErrors) == 0;
 }