Example #1
0
<?php

require '../../model/MensagemChat.php';
$curdir = getcwd();
chdir('/home/ccvteam/public_html/forum');
require_once '/home/ccvteam/public_html/forum/global.php';
require_once '/home/ccvteam/public_html/forum/includes/class_bbcode.php';
require_once '/home/ccvteam/public_html/forum/includes/functions_newpost.php';
chdir($curdir);
$userid = $vbulletin->userinfo['userid'];
if ($userid != '0') {
    $shouter = utf8_encode($vbulletin->userinfo['musername']);
    // clean input
    $vbulletin->input->clean_array_gpc('p', array('message' => TYPE_STR));
    $shout = $vbulletin->GPC['message'];
    // trata aspas
    $shout = addslashes($shout);
    // trata ajax urlencoded
    $shout = convert_urlencoded_unicode($shout);
    // convert links
    $shout = convert_url_to_bbcode($shout);
    // parseador de bbCode
    $parser =& new vB_BbCodeParser($vbulletin, fetch_tag_list());
    // do_parse($text, $do_html = false, $do_smilies = true, $do_bbcode = true , $do_imgcode = true, $do_nl2br = true, $cachable = false)
    $shout = $parser->do_parse($shout, false, true, true, false, false, false);
    $timestamp = date("Y-m-d H:i:s");
    $msg = new MensagemChat($shout, $shouter, $timestamp, $userid);
    $msg->Save();
}
Example #2
0
<?php

require '../../model/MensagemChat.php';
$curdir = getcwd();
chdir('/home/ccvteam/public_html/forum');
require_once '/home/ccvteam/public_html/forum/global.php';
chdir($curdir);
if ($vbulletin->userinfo['usergroupid'] == '6') {
    MensagemChat::DeletarMensagens();
}
Example #3
0
<?php

require '../../model/MensagemChat.php';
header("Content-Type: application/json; charset=utf-8");
//charset=ISO-8859-1");
header("Expires: Sat, 05 Nov 2005 00:00:00 GMT");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
$pagelastmsgid = 0;
if ($_REQUEST['lastmsgid']) {
    $pagelastmsgid = $_REQUEST['lastmsgid'];
}
$count = 0;
$mensagens = MensagemChat::UltimasMensagens();
$result = array();
foreach ($mensagens as $mensagem) {
    if ($count == 0 && $pagelastmsgid >= $mensagem->GetId()) {
        return;
    }
    $result[] = $mensagem->toArray();
    $count++;
}
echo json_encode($result);