Ejemplo n.º 1
0
 private function templatePage()
 {
     $form = $this->getForm();
     if (false === ($nick = $this->module->getNickname())) {
         $nick = '';
     }
     // Focus input by js
     $focus = GWF_Session::isLoggedIn() ? 'message' : 'yournick';
     GWF_Javascript::focusElementByName($focus);
     $tVars = array('form' => $form->templateX(), 'msgs' => $this->module->getChannelMessages(), 'privmsgs' => $this->module->getPrivateMessages(), 'online' => $this->module->getOnlineUsers(), 'maxmsg_pub' => $this->module->getChanmsgPerPage(), 'maxmsg_priv' => $this->module->getPrivmsgPerPage(), 'nickname' => $nick, 'onlinetime' => $this->module->getOnlineTime(), 'peaktime' => $this->module->getMessagePeak(), 'lagtime' => $this->module->cfgLagPing(), 'href_history' => GWF_WEB_ROOT . 'chat/history', 'href_webchat' => GWF_WEB_ROOT . 'chat', 'href_ircchat' => GWF_WEB_ROOT . 'irc_chat', 'mibbit_url' => $this->module->cfgMibbitURL(), 'mibbit' => $this->module->cfgMibbit(), 'gwf_chat' => $this->module->cfgGWFChat());
     return $this->module->templatePHP('page.php', $tVars);
 }
Ejemplo n.º 2
0
 private function stream()
 {
     set_time_limit(0);
     $t = time();
     $times = array($t, $t, $t, $t);
     //		$msgtable = new GWF_ChatMsg(false);
     $channel = '';
     while (true) {
         GWF_ChatOnline::setSessOnline($this->module);
         //			GWF_Session::updateLastActivity();
         $page = $this->module->getAjaxUpdates($times);
         # --- Anything happened?
         if ($page !== '') {
             GWF_Javascript::newSection();
             echo $page;
             GWF_Javascript::endSection();
         }
         usleep(999950);
     }
 }
Ejemplo n.º 3
0
 private function templateSend($preview = '')
 {
     $form = $this->getForm();
     if ($this->pm !== false) {
         $this->pm->markRead(GWF_Session::getUser());
     }
     if ($this->pm === false) {
         GWF_Javascript::focusElementByName('title');
     } else {
         GWF_Javascript::focusElementByName('message');
     }
     $tVars = array('reply_to' => $this->pm === false ? '' : $this->templatePM($this->pm), 'form' => $form->templateY($this->getSEOTitle()), 'preview' => $preview);
     return $this->module->templatePHP('send.php', $tVars);
 }
Ejemplo n.º 4
0
<?php

chdir('../../');
apache_setenv('no-gzip', 1);
ini_set('zlib.output_compression', 0);
//ini_set('implicit_flush', 1);
#ob_implicit_flush();
require_once 'gwf3.class.php';
GWF3::onLoadConfig(GWF_CONFIG_PATH);
# Get the modules.
$modules = GWF_Module::loadModulesDB();
# Start session
if (false === GWF_Session::start(false)) {
    GWF3::LogDie('Session error. GWF not installed?');
}
# Init core templates and stuff
GWF_Language::init();
GWF_HTML::initCronjob();
# Yay, a http stream \o/
GWF_Javascript::streamHeader();
# Call Chat::AjaxStream
if (false === ($module = GWF_Module::getModule('Chat'))) {
    GWF3::logDie('MISSING MODULE');
}
$module->onLoadLanguage();
$module->onInclude();
$module->requestMethodB('AjaxStream');
Ejemplo n.º 5
0
<?php

GWF_Javascript::focusElementByName('term');
echo $tVars['form_quick'];
#echo $tVars['form_adv'];
if (count($tVars['result']) > 0) {
    echo $tVars['pagemenu'];
    $headers = array(array($tLang->lang('th_post_date'), 'post_date', 'DESC'), array($tLang->lang('th_user_name'), 'user_name', 'ASC'), array($tLang->lang('th_title')), array($tLang->lang('th_thanks'), 'post_thanks', 'DESC'), array($tLang->lang('th_votes_up'), 'post_votes_up', 'DESC'));
    echo GWF_Table::start();
    echo GWF_Table::displayHeaders1($headers, $tVars['sort_url']);
    foreach ($tVars['result'] as $post) {
        echo GWF_Table::rowStart();
        $post instanceof GWF_ForumPost;
        $hrefPost = $post->getShowHREF($tVars['term']);
        $hrefProfile = $post->getUser()->getProfileHREF();
        echo GWF_Table::column(GWF_HTML::anchor($hrefPost, $post->displayPostDate()));
        echo GWF_Table::column(GWF_HTML::anchor($hrefProfile, $post->getUser()->displayUsername()));
        echo GWF_Table::column(GWF_HTML::anchor($hrefPost, $post->getVar('post_title')));
        echo GWF_Table::column($post->getVar('post_thanks'), 'gwf_num');
        echo GWF_Table::column($post->getVar('post_votes_up'), 'gwf_num');
        echo GWF_Table::rowEnd();
    }
    echo GWF_Table::end();
    echo $tVars['pagemenu'];
}
Ejemplo n.º 6
0
function formSolutionbox(WC_Challenge $chall)
{
    GWF_Javascript::focusElementByID('answer');
    $form = formSolutionboxForm($chall);
    echo '<div id="wc_solutionbox">' . PHP_EOL . $form->templateX(WC_HTML::lang('ft_solution', array($chall->display('chall_title')))) . '</div>' . PHP_EOL;
}
Ejemplo n.º 7
0
# Convert some stuff to javascript
$convert = array();
foreach ($tVars['msgs'] as $msg) {
    $convert[] = $msg->getVar('chatmsg_time');
}
$jsaPub = GWF_Javascript::toJavascriptArray($convert);
$convert = array();
foreach ($tVars['privmsgs'] as $msg) {
    $convert[] = $msg->getVar('chatmsg_time');
}
$jsaPriv = GWF_Javascript::toJavascriptArray($convert);
$convert = array();
foreach ($tVars['online'] as $online) {
    $convert[] = $online->display('chaton_name');
}
$onlinelist = GWF_Javascript::toJavascriptArray($convert);
?>

<?php 
if (GWF_Browser::isGecko()) {
    $script_html = 'window.onload = function() { ';
    $script_html .= sprintf('gwfchatInit(%d, %d, "%s", %d, %s);' . PHP_EOL, $tVars['maxmsg_pub'], $tVars['maxmsg_priv'], $tVars['nickname'], $tVars['peaktime'], $onlinelist);
    $script_html .= sprintf('gwfchatInitPub(%s);' . PHP_EOL, $jsaPub);
    $script_html .= sprintf('gwfchatInitPriv(%s);' . PHP_EOL, $jsaPriv);
    $script_html .= '};';
} else {
    $script_html = 'window.onload = function() { ';
    $script_html .= sprintf('gwfchatInitLaggy(%d, %d, "%s", %d, %s, %d);' . PHP_EOL, $tVars['maxmsg_pub'], $tVars['maxmsg_priv'], $tVars['nickname'], $tVars['peaktime'], $onlinelist, $tVars['lagtime']);
    $script_html .= sprintf('gwfchatInitPub(%s);' . PHP_EOL, $jsaPub);
    $script_html .= sprintf('gwfchatInitPriv(%s);' . PHP_EOL, $jsaPriv);
    $script_html .= '};';
Ejemplo n.º 8
0
 private function startStream()
 {
     #GWF_ChatOnline::setSessOnline();
     GWF_Javascript::streamHeader();
     $times = array(time(), time(), time(), time());
     $i = 0;
     while ($i < 10) {
         echo '+Foo' . PHP_EOL;
         flush();
         //			GWF_Javascript::flush();
         sleep(2);
         $i++;
         continue;
         $stuff_sent = false;
         # Get Kick Messages
         $kicked = GWF_ChatOnline::getKicked($times[0]);
         if (count($kicked) > 0) {
             $stuff_sent = true;
             $this->streamMessageJoin('-', $kicked);
             $times[0] = time();
         }
         # Get Join Messages
         $joined = GWF_ChatOnline::getJoined($times[1]);
         if (count($joined) > 0) {
             $stuff_sent = true;
             $this->streamMessageJoin('+', $joined);
             $times[1] = time();
         }
         # Get Public Channel Messages
         $msgs = new GWF_ChatMsg(false);
         $channel = '';
         $last = $times[2];
         $pubmsg = $msgs->selectAll('*', "chatmsg_to='{$channel}' AND chatmsg_time>{$last}", 'chatmsg_time ASC');
         if (count($pubmsg) > 0) {
             $stuff_sent = true;
             $this->echoMessages($pubmsg, false);
             $times[2] = time();
         }
         # Get Private Messages
         if (false !== ($nick = $this->module->getNickname())) {
             $last = $times[3];
             $privmsg = $msgs->selectAll('*', "(chatmsg_to='{$nick}' OR (chatmsg_from='{$nick}' AND chatmsg_to!='')) AND chatmsg_time>{$last}", 'chatmsg_time ASC');
             if (count($privmsg) > 0) {
                 $stuff_sent = true;
                 $this->echoMessages($privmsg, true);
                 $times[3] = time();
             }
         }
         //			if (!$stuff_sent)
         //			{
         //				usleep(1000000);
         GWF_ChatOnline::setSessOnline($this->module);
         //			}
         //			else
         //			{
         //			}
         //			echo '+Foo'.PHP_EOL;
         echo '+Foo' . PHP_EOL;
         //			flush();
         GWF_Javascript::flush();
         //			flush();
         sleep(1);
     }
     GWF_ChatOnline::setSessOffline($this->module);
     die;
 }