• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP phpFreeChat类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中phpFreeChat的典型用法代码示例。如果您正苦于以下问题:PHP phpFreeChat类的具体用法?PHP phpFreeChat怎么用?PHP phpFreeChat使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了phpFreeChat类的16个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: index

 function index()
 {
     App::import('Vendor', 'phpFreeChat', array('file' => 'phpfreechat' . DS . 'src' . DS . 'phpfreechat.class.php'));
     Configure::write('debug', '0');
     $this->layout = '2col_layout';
     $this->Group->id = $this->ZTAuth->user('group_id');
     $group = $this->Group->read();
     $params["serverid"] = md5(__FILE__);
     $params["theme"] = "animated";
     $params["theme_url"] = 'vendors/phpfreechat/themes/';
     $params["data_public_url"] = 'vendors/phpfreechat/data/public';
     $params["theme"] = 'msn';
     $params["language"] = 'ru_RU';
     $params["display_pfc_logo"] = false;
     $params["title"] = 'Бумер чат';
     $params["nick"] = $this->ZTAuth->user('username');
     $params["isadmin"] = $this->isAuthorized($this->ZTAuth->user('username'), $this->name, 'admin');
     $params["nickmeta"] = array('Статус' => $group['Group']['user_status']);
     $params["nickmarker"] = false;
     $params["frozen_nick"] = true;
     //        $params["debug"] = true;
     //        $params["server_script_path"] = '../../vendors/phpfreechat/chat.php';
     $chat = new phpFreeChat($params);
     $this->set('chat', $chat->printChat(true));
 }
开发者ID:BGCX262,项目名称:ztrackerengine-svn-to-git,代码行数:25,代码来源:chat_controller.php


示例2: run

 function run(&$xml_reponse, $p)
 {
     $clientid = $p["clientid"];
     $param = $p["param"];
     $sender = $p["sender"];
     $recipient = $p["recipient"];
     $recipientid = $p["recipientid"];
     $c =& pfcGlobalConfig::Instance();
     $u =& pfcUserConfig::Instance();
     $nicktochange = phpFreeChat::FilterNickname($param);
     if ($c->frozen_nick) {
         // assign a random nick
         $cmdp = $p;
         $cmdp["param"] = $nicktochange . "" . rand(1, 1000);
         $cmd =& pfcCommand::Factory("nick");
         $cmd->run($xml_reponse, $cmdp);
     } else {
         if ($nicktochange == "") {
             $nicktochange = $u->nick;
             $msg = _pfc("Please enter your nickname");
         } else {
             $msg = "'" . $nicktochange . "' is used, please choose another nickname.";
         }
         $xml_reponse->script("var newnick = prompt('" . addslashes($msg) . "', '" . addslashes($nicktochange) . "'); if (newnick) pfc.sendRequest('/nick \"'+newnick+'\"');");
     }
 }
开发者ID:codethics,项目名称:proteoerp,代码行数:26,代码来源:asknick.class.php


示例3: run

 function run(&$xml_reponse, $p)
 {
     $clientid = $p["clientid"];
     $msg = $p["param"];
     $sender = $p["sender"];
     $recipient = $p["recipient"];
     $recipientid = $p["recipientid"];
     $flag = isset($p["flag"]) ? $p["flag"] : 7;
     $c =& pfcGlobalConfig::Instance();
     $u =& pfcUserConfig::Instance();
     $ct =& pfcContainer::Instance();
     if ($c->shownotice > 0 && ($c->shownotice & $flag) == $flag) {
         $msg = phpFreeChat::FilterSpecialChar($msg);
         $msg = $flag == 7 ? '(' . $sender . ') ' . $msg : $msg;
         $nick = $ct->getNickname($u->nickid);
         $res = $ct->write($recipient, $nick, "notice", $msg);
         if (is_array($res)) {
             $cmdp = $p;
             $cmdp["param"] = implode(",", $res);
             $cmd =& pfcCommand::Factory("error");
             $cmd->run($xml_reponse, $cmdp);
             return;
         }
     }
 }
开发者ID:ho96,项目名称:yii2-phpfreechat,代码行数:25,代码来源:notice.class.php


示例4: run

 function run(&$xml_reponse, $p)
 {
     $clientid = $p["clientid"];
     $param = $p["param"];
     $sender = $p["sender"];
     $recipient = $p["recipient"];
     $recipientid = $p["recipientid"];
     $owner = isset($p["owner"]) ? $p["owner"] : '';
     $c =& pfcGlobalConfig::Instance();
     $u =& pfcUserConfig::Instance();
     $ct =& pfcContainer::Instance();
     $newnick = phpFreeChat::FilterNickname($param);
     $oldnick = $ct->getNickname($u->nickid);
     if ($this->name == 'nick') {
         // if the user want to change his nickname but the frozen_nick is enable
         // then send him a warning
         if ($this->name == 'nick' && $oldnick != '' && $newnick != $oldnick && $c->frozen_nick == true && $owner != $this->proxyname) {
             $msg = _pfc("You are not allowed to change your nickname");
             $xml_reponse->script("pfc.handleResponse('" . $this->proxyname . "', 'nick', '" . addslashes($msg) . "');");
             return false;
         }
         $newnickid = $ct->getNickId($newnick);
         $oldnickid = $u->nickid;
         if ($newnick == $oldnick && $newnickid == $oldnickid) {
             $xml_reponse->script("pfc.handleResponse('" . $this->name . "', 'notchanged', '" . addslashes($newnick) . "');");
             return true;
         }
         // now check the nickname is not yet used (unsensitive case)
         // 'BoB' and 'bob' must be considered same nicknames
         $nick_in_use = $this->_checkNickIsUsed($newnick, $oldnickid);
         if ($nick_in_use) {
             if ($c->frozen_nick) {
                 $xml_reponse->script("pfc.handleResponse('nick', 'notallowed', '" . addslashes($newnick) . "');");
             } else {
                 $xml_reponse->script("pfc.handleResponse('nick', 'isused', '" . addslashes($newnick) . "');");
             }
             return false;
         }
     }
     // allow nick changes only from the parameters array (server side)
     if ($this->name != 'connect' && $c->frozen_nick == true && $oldnick != $c->nick && $c->nick != '' && $owner != $this->proxyname) {
         // change the user nickname
         $cmdp = $p;
         $cmdp["param"] = $c->nick;
         $cmdp["owner"] = $this->proxyname;
         $cmd =& pfcCommand::Factory("nick");
         return $cmd->run($xml_reponse, $cmdp);
     }
     // forward the command to the next proxy or to the final command
     return $this->next->run($xml_reponse, $p);
 }
开发者ID:codethics,项目名称:proteoerp,代码行数:51,代码来源:checknickchange.class.php


示例5: run

 function run(&$xml_reponse, $p)
 {
     $clientid = $p["clientid"];
     $param = $p["param"];
     $sender = $p["sender"];
     $recipient = $p["recipient"];
     $recipientid = $p["recipientid"];
     $c =& pfcGlobalConfig::Instance();
     $u =& pfcUserConfig::Instance();
     $ct =& pfcContainer::Instance();
     if (trim($param) == "") {
         // error
         $cmdp = $p;
         $cmdp["param"] = _pfc("Missing parameter");
         $cmdp["param"] .= " (" . $this->usage . ")";
         $cmd =& pfcCommand::Factory("error");
         $cmd->run($xml_reponse, $cmdp);
         return;
     }
     $msg = phpFreeChat::PreFilterMsg($param);
     $ct->write($recipient, "*me*", $this->name, $u->getNickname() . " " . $msg);
 }
开发者ID:codethics,项目名称:proteoerp,代码行数:22,代码来源:me.class.php


示例6: run

 function run(&$xml_reponse, $p)
 {
     $clientid = $p["clientid"];
     $param = $p["param"];
     $sender = $p["sender"];
     $recipient = $p["recipient"];
     $recipientid = $p["recipientid"];
     $c =& pfcGlobalConfig::Instance();
     $u =& pfcUserConfig::Instance();
     $ct =& pfcContainer::Instance();
     $nick = $u->getNickname();
     $text_src = phpFreeChat::PreFilterMsg(trim($param));
     $text_src = str_replace(" ", "", $text_src);
     try {
         $p = new Parser($text_src);
         $p->setDebug($ct, $nick, $recipient);
         $ov = $p->Parse();
         $text = $nick . " : " . $text_src . " >> " . $ov->str . " = " . $ov->val;
     } catch (Exception $e) {
         $text = "Error: " . $e->getMessage();
     }
     $ct->write($recipient, $nick, "send", $text);
 }
开发者ID:a711960,项目名称:phpdiceroller,代码行数:23,代码来源:dice.class.php


示例7: dirname

<?php

require_once dirname(__FILE__) . "/../src/phpfreechat.class.php";
$params["serverid"] = md5(__FILE__);
// calculate a unique id for this chat
$params["language"] = "hy_AM";
$chat = new phpFreeChat($params);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
  <head>
    <meta http-equiv="content-type" content="text/html; charset=utf-8" />
    <title>phpFreeChat demo</title>

    <?php 
$chat->printJavascript();
?>
    <?php 
$chat->printStyle();
?>

  </head>

  <body>
    <?php 
$chat->printChat();
?>

<?php 
// print the current file
echo "<h2>The source code</h2>";
开发者ID:codethics,项目名称:proteoerp,代码行数:31,代码来源:demo53_in_armenian.php


示例8: dirname

<?php

require_once dirname(__FILE__) . "/../src/phpfreechat.class.php";
$params["serverid"] = md5(__FILE__);
// calculate a unique id for this chat
//echo "<pre>";print_r($params);exit;
$chat = new phpFreeChat($params);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
       "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

  <head>
    <meta http-equiv="content-type" content="text/html; charset=utf-8" />
    <title>phpFreeChat demo</title>
  </head>
    
  <body>
    <?php 
$chat->printChat();
?>

<?php 
// print the current file
echo "<h2>The source code</h2>";
$filename = __FILE__;
echo "<p><code>" . $filename . "</code></p>";
echo "<pre style=\"margin: 0 50px 0 50px; padding: 10px; background-color: #DDD;\">";
$content = file_get_contents($filename);
highlight_string($content);
echo "</pre>";
开发者ID:beyondkeysystem,项目名称:testone,代码行数:31,代码来源:index19-04-2014.php


示例9: _pfc

  </div>

  <div id="pfc_input_container">

    <table style="margin:0;padding:0;border-collapse:collapse;">
      <tbody>
      <tr>
      <td class="pfc_td1">
        <p id="pfc_handle"
           <?php 
if (!$frozen_nick) {
    echo ' title="' . _pfc("Enter your nickname here") . '"' . ' onclick="pfc.askNick(\'\')"' . ' style="cursor: pointer"';
}
?>
           ><?php 
echo phpFreeChat::FilterSpecialChar($u->nick);
?>
</p>      
      </td>
      <td class="pfc_td2">
        <input type="text"
               id="pfc_words"
               title="<?php 
echo _pfc("Enter your message here");
?>
"
               maxlength="<?php 
echo $max_text_len;
?>
"/>
      </td>
开发者ID:vlad88sv,项目名称:UFS,代码行数:31,代码来源:chat.html.tpl.php


示例10: run

 function run(&$xml_reponse, $p)
 {
     $clientid = $p["clientid"];
     $param = $p["param"];
     $sender = $p["sender"];
     $recipient = $p["recipient"];
     $recipientid = $p["recipientid"];
     $c =& pfcGlobalConfig::Instance();
     $u =& pfcUserConfig::Instance();
     $ct =& pfcContainer::Instance();
     if (trim($param) == '') {
         // error
         $cmdp = $p;
         $cmdp["param"] = _pfc("Missing parameter");
         $cmdp["param"] .= " (" . $this->usage . ")";
         $cmd =& pfcCommand::Factory("error");
         $cmd->run($xml_reponse, $cmdp);
         return false;
     }
     $newnick = phpFreeChat::FilterNickname($param);
     $oldnick = $ct->getNickname($u->nickid);
     $newnickid = $ct->getNickId($newnick);
     $oldnickid = $u->nickid;
     // new nickname is undefined (not used) and
     // current nickname (oldnick) is mine and
     // oldnick is different from new nick
     // -> this is a nickname change
     if ($oldnick != $newnick && $oldnick != '') {
         // really change the nick (rename it)
         $ct->changeNick($newnick, $oldnick);
         $u->nick = $newnick;
         $u->saveInCache();
         $this->forceWhoisReload($u->nickid);
         // notify all the joined channels/privmsg
         $cmdp = $p;
         $cmdp["param"] = _pfc("%s changes his nickname to %s", $oldnick, $newnick);
         $cmdp["flag"] = 1;
         $cmd =& pfcCommand::Factory("notice");
         foreach ($u->channels as $id => $chan) {
             $cmdp["recipient"] = $chan["recipient"];
             $cmdp["recipientid"] = $id;
             $cmd->run($xml_reponse, $cmdp);
         }
         foreach ($u->privmsg as $id => $pv) {
             $cmdp["recipient"] = $pv["recipient"];
             $cmdp["recipientid"] = $id;
             $cmd->run($xml_reponse, $cmdp);
         }
         $xml_reponse->script("pfc.handleResponse('nick', 'changed', '" . addslashes($newnick) . "');");
         return true;
     }
     // new nickname is undefined (not used)
     // -> this is a first connection (this piece of code is called by /connect command)
     if ($newnickid == '') {
         // this is a first connection : create the nickname on the server
         $ct->createNick($u->nickid, $newnick);
         $u->nick = $newnick;
         $u->saveInCache();
         $this->forceWhoisReload($u->nickid);
         $xml_reponse->script("pfc.handleResponse('nick', 'connected', '" . addslashes($newnick) . "');");
         return true;
     }
     return false;
 }
开发者ID:danielheyman,项目名称:EazySubs,代码行数:64,代码来源:nick.class.php


示例11: PreFilterMsg

 /**
  * Filter messages before they are sent to container
  */
 function PreFilterMsg($msg)
 {
     $c =& pfcGlobalConfig::Instance();
     if (preg_match("/^\\[/i", $msg)) {
         // add 25 characteres if the message starts with [ : means there is a bbcode
         $msg = utf8_substr($msg, 0, $c->max_text_len + 25);
     } else {
         $msg = utf8_substr($msg, 0, $c->max_text_len);
     }
     $msg = phpFreeChat::FilterSpecialChar($msg);
     //    $msg = phpFreeChat::FilterSmiley($msg);
     /*    if ($msg[0] == "\n") $msg = substr($msg, 1); */
     // delete the first \n generated by FF
     /* if (strpos($msg,"\n") > 0) $msg  = "<br/>".$msg;
        $msg = str_replace("\r\n", "<br/>", $msg);
        $msg = str_replace("\n", "<br/>", $msg);
        $msg = str_replace("\t", "    ", $msg);*/
     //$msg = str_replace("  ", "&nbsp;&nbsp;", $msg);
     //    $msg = preg_replace('/(http\:\/\/[^\s]*)/i',  "<a href=\"$1\">$1</a>", $msg );
     return $msg;
 }
开发者ID:codethics,项目名称:proteoerp,代码行数:24,代码来源:phpfreechat.class.php


示例12: defined

/// Author: Rafał "Endzio" Enden
/// modules/chat/index.php
defined('KioCMS') || exit;
$lang = include_lang('modules/chat');
$chat = get_config('chat');
$title[] = 'Chat';
$module['columns'] = 2;
//file_exists(root_dir.'modules/chat/data/private/cache/'.md5(__FILE__).'.php') ? unlink(root_dir.'modules/chat/data/private/cache/'.md5(__FILE__).'.php') : '';
require_once root_dir . 'modules/chat/src/phpfreechat.class.php';
$params = array();
$params["title"] = "Quick chat";
$params["isadmin"] = strtolower($user['username']) == 'test' ? true : false;
// do not use it on production servers ;)
$params["serverid"] = md5(__FILE__);
// calculate a unique id for this chat
$params["nick"] = defined('LOGGED') ? $user['username'] : 'guest' . rand();
// setup the intitial nickname
$params["debug"] = false;
$params["max_msg"] = 0;
$params["frozen_nick"] = true;
$params["theme_url"] = local_dir . "modules/chat/data/public/themes";
$params["theme_default_url"] = local_dir . "modules/chat/data/public/themes";
$params["server_script_url"] = local_url . "chat/";
// Must ending with slash (/)
$params["client_script_path"] = root_dir . 'modules/chat/index.php';
$params["data_public_url"] = local_dir . "modules/chat/data/public";
$params["prototypejs_url"] = local_dir . "modules/chat/data/public/js/prototype.js";
$pfc = new phpFreeChat($params);
echo '<div style="text-align: left;">';
$pfc->printChat();
echo '</div>';
开发者ID:rafalenden,项目名称:KioCMS,代码行数:31,代码来源:index.php


示例13: dirname

global $CONFIG;
require_once dirname(__FILE__) . "/src/phpfreechat.class.php";
$params = array();
$params['title'] = elgg_echo('Chat');
$params['nick'] = $_SESSION['user']->username;
// setup the intitial nickname
$params['isadmin'] = isadminloggedin();
$params['serverid'] = 'phpfreechat';
// calculate a unique id for this chat
$params['debug'] = false;
if (get_plugin_setting('container_type', 'chat') == 'Mysql') {
    $params['container_type'] = 'Mysql';
    $params['container_cfg_mysql_host'] = $CONFIG->dbhost;
    $params['container_cfg_mysql_port'] = 3306;
    $params['container_cfg_mysql_database'] = $CONFIG->dbname;
    $params['container_cfg_mysql_table'] = $CONFIG->dbprefix . "phpfreechat";
    $params['container_cfg_mysql_username'] = $CONFIG->dbuser;
    $params['container_cfg_mysql_password'] = $CONFIG->dbpass;
}
$params['theme'] = get_plugin_setting('theme', 'chat');
$params['frozen_nick'] = get_plugin_setting('strict_access', 'chat') == 1;
$params['channels'] = explode(',', get_plugin_setting('channels', 'chat'));
$chat = new phpFreeChat($params);
if (get_plugin_setting('use_popup', 'chat')) {
    include dirname(dirname(__FILE__)) . '/popup.inc.php';
} else {
    // Format Page
    $body = elgg_view_layout('one_column', $chat->printChat(true));
    // Draw it
    echo page_draw(elgg_echo('Chat'), $body);
}
开发者ID:eokyere,项目名称:elgg,代码行数:31,代码来源:index.php


示例14: render

 function render($mode, Doku_Renderer $renderer, $data)
 {
     global $conf, $USERINFO, $ID;
     if (auth_quickaclcheck($ID) >= AUTH_READ) {
         if ($mode == 'xhtml') {
             $renderer->info['cache'] = FALSE;
             ob_start();
             require_once DOKU_INC . 'lib/plugins/freechat/phpfreechat/src/phpfreechat.class.php';
             $params = array();
             $params['serverid'] = md5($conf['title']);
             if (isset($data['chatid']) && $data['chatid'] != '') {
                 $params['serverid'] = md5($data['chatid']);
             }
             $params['focus_on_connect'] = true;
             $params['language'] = $this->getConf('language');
             $params['theme'] = $this->getConf('template');
             $params['height'] = $this->getConf('height') . 'px';
             $params["title"] = $this->getConf('title');
             if (isset($data['rooms'])) {
                 $params["channels"] = explode(',', $data['rooms']);
             } else {
                 $params["channels"] = explode(',', $this->getConf('channels'));
             }
             $params['frozen_nick'] = $this->getConf('frozen_nick');
             $params['frozen_nick'] = !($params['frozen_nick'] == 'off' || $params['frozen_nick'] == 0);
             if (isset($data['locked'])) {
                 $params['frozen_channels'] = explode(',', $data['locked']);
             } else {
                 if ($this->getConf('frozen_channels') != '') {
                     $params['frozen_channels'] = explode(',', $this->getConf('frozen_channels'));
                 }
             }
             $params['isadmin'] = false;
             if ($this->getConf('admin_group') != '' && isset($USERINFO['grps'])) {
                 $temp = explode(',', $this->getConf('admin_group'));
                 foreach ($temp as $item) {
                     if (in_array(trim($item), $USERINFO['grps'])) {
                         $params['isadmin'] = true;
                     }
                 }
             }
             $params['startwithsound'] = false;
             $params['display_pfc_logo'] = true;
             $params['showsmileys'] = false;
             $params['nick'] = isset($_SERVER['REMOTE_USER']) ? $_SERVER['REMOTE_USER'] : "guest" . rand(1, 1000);
             if ($this->getConf('fullname')) {
                 if (isset($USERINFO['name']) && !empty($USERINFO['name'])) {
                     $params['nick'] = $USERINFO['name'];
                 }
             }
             //          $params['channels'] =  array('Generale');
             $params['data_public_path'] = DOKU_INC . 'data/cache/public';
             $params['data_public_url'] = DOKU_URL . 'data/cache/public';
             $params['data_public_path'] = DOKU_INC . 'lib/plugins/freechat/phpfreechat/data/public';
             $params['data_public_url'] = DOKU_URL . 'lib/plugins/freechat/phpfreechat/data/public';
             //        $params['data_public_path']   = DOKU_INC.'data/tmp';
             //        $params['data_public_url']    = DOKU_URL.'data/tmp';
             $params['data_private_path'] = DOKU_INC . 'data/cache/freechat/private';
             $params['server_script_path'] = DOKU_INC . 'lib/plugins/freechat/backend.php';
             $params['server_script_url'] = DOKU_URL . 'lib/plugins/freechat/backend.php';
             //        $params['debug']  = true;
             // store in session the parameters list for the backend script
             @session_start();
             $_SESSION['freechat_params_list'] = $params;
             $pfc = new phpFreeChat($params);
             $pfc->printChat();
             $content = ob_get_contents();
             ob_end_clean();
             $renderer->doc .= $content;
             /*
             echo "<pre>";
             print_r($params);
             echo "</pre>";
             */
             return true;
         }
     }
     return false;
 }
开发者ID:bzfwunde,项目名称:dokuwiki-freechat,代码行数:79,代码来源:syntax.php


示例15: run

 function run(&$xml_reponse, $p)
 {
     $clientid = $p["clientid"];
     $param = $p["param"];
     $sender = $p["sender"];
     $recipient = $p["recipient"];
     $recipientid = $p["recipientid"];
     $c =& pfcGlobalConfig::Instance();
     // do nothing if the recipient is not defined
     if ($recipient == "") {
         return;
     }
     // check this methode is not being called
     if (isset($_SESSION["pfc_lock_readnewmsg_" . $c->getId() . "_" . $clientid])) {
         // kill the lock if it has been created more than 10 seconds ago
         $last_10sec = time() - 10;
         $last_lock = $_SESSION["pfc_lock_readnewmsg_" . $c->getId() . "_" . $clientid];
         if ($last_lock < $last_10sec) {
             $_SESSION["pfc_lock_" . $c->getId() . "_" . $clientid] = 0;
         }
         if ($_SESSION["pfc_lock_readnewmsg_" . $c->getId() . "_" . $clientid] != 0) {
             exit;
         }
     }
     // create a new lock
     $_SESSION["pfc_lock_readnewmsg_" . $c->getId() . "_" . $clientid] = time();
     // read the last from_id value
     $container =& pfcContainer::Instance();
     $from_id_sid = "pfc_from_id_" . $c->getId() . "_" . $clientid . "_" . $recipientid;
     $from_id = 0;
     if (isset($_SESSION[$from_id_sid])) {
         $from_id = $_SESSION[$from_id_sid];
     } else {
         $from_id = $container->getLastId($recipient) - $c->max_msg - 1;
         if ($from_id < 0) {
             $from_id = 0;
         }
     }
     // check if this is the first time you get messages
     $oldmsg_sid = "pfc_oldmsg_" . $c->getId() . "_" . $clientid . "_" . $recipientid;
     $oldmsg = false;
     if (isset($_SESSION[$oldmsg_sid])) {
         unset($_SESSION[$oldmsg_sid]);
         $oldmsg = true;
     }
     $new_msg = $container->read($recipient, $from_id);
     $new_from_id = $new_msg["new_from_id"];
     $data = $new_msg["data"];
     // transform new message in html format
     $js = array();
     $data_sent = false;
     foreach ($data as $d) {
         $m_id = $d["id"];
         $m_date = gmdate($c->date_format, $d["timestamp"] + $c->time_offset);
         $m_time = gmdate($c->time_format, $d["timestamp"] + $c->time_offset);
         $m_sender = $d["sender"];
         $m_recipientid = $recipientid;
         $m_cmd = $d["cmd"];
         $m_param = phpFreeChat::PostFilterMsg($d["param"]);
         $js[] = array($m_id, $m_date, $m_time, $m_sender, $m_recipientid, $m_cmd, $m_param, gmdate($c->date_format, time() + $c->time_offset) == $m_date ? 1 : 0, $oldmsg ? 1 : 0);
         // is it a new message in the current session or is it a part of the history
         $data_sent = true;
     }
     if (count($js) != 0) {
         require_once dirname(__FILE__) . '/../pfcjson.class.php';
         $json = new pfcJSON();
         $js = $json->encode($js);
         $xml_reponse->script("pfc.handleResponse('" . $this->name . "', 'ok', (" . $js . "));");
     }
     if ($data_sent) {
         // store the new msg id
         $_SESSION[$from_id_sid] = $new_from_id;
     }
     // remove the lock
     $_SESSION["pfc_lock_readnewmsg_" . $c->getId() . "_" . $clientid] = 0;
 }
开发者ID:codethics,项目名称:proteoerp,代码行数:76,代码来源:getnewmsg.class.php


示例16: run

 function run(&$xml_reponse, $p)
 {
     $clientid = $p["clientid"];
     $param = $p["param"];
     $sender = $p["sender"];
     $recipient = $p["recipient"];
     $recipientid = $p["recipientid"];
     $c =& pfcGlobalConfig::Instance();
     $u =& pfcUserConfig::Instance();
     $ct =& pfcContainer::Instance();
     $nick = $ct->getNickname($u->nickid);
     //phpFreeChat::FilterSpecialChar($sender);
     $text = phpFreeChat::PreFilterMsg($param);
     //        $offline = $container->getMeta("offline", "nickname", $u->privmsg[$recipientid]["name"]);
     // if this channel is a pv (one to one channel),
     // first of all, check if the other user is connected
     // if he is not connected anymore, display an error
     $can_send = true;
     if (isset($u->privmsg[$recipientid])) {
         $pvnickid = $u->privmsg[$recipientid]["pvnickid"];
         $pvnick = $ct->getNickname($pvnickid);
         //$u->privmsg[$recipientid]["name"];
         //      $pvnickid = $ct->getNickId($pvnick);
         // now check if this user is currently online
         $onlineusers = $ct->getOnlineNick(NULL);
         if (!in_array($pvnickid, $onlineusers["nickid"])) {
             // send an error because the user is not online
             $cmdp = $p;
             $cmdp["param"] = _pfc("Can't send the message, %s is offline", $pvnick);
             $cmd =& pfcCommand::Factory("error");
             $cmd->run($xml_reponse, $cmdp);
             $can_send = false;
         }
     }
     // check the sent text is not empty and the user has a none empty nickname
     $errors = array();
     if ($text == "") {
         $errors["pfc_words"] = _pfc("Text cannot be empty");
     }
     if ($nick == "") {
         $errors["pfc_handle"] = _pfc("Please enter your nickname");
     }
     if (count($errors) > 0) {
         // an error occured, just ignore the message and display errors
         $cmdp = $p;
         $cmdp["param"] = $errors;
         $cmd =& pfcCommand::Factory("error");
         $cmd->run($xml_reponse, $cmdp);
         if (isset($errors["pfc_handle"])) {
             // the nick is empty so give it focus
             $xml_reponse->script("\$('pfc_handle').focus();");
         }
         $can_send = false;
     }
     // Now send the message if there is no errors
     if ($can_send) {
         $msgid = $ct->write($recipient, $nick, "send", $text);
         if (is_array($msgid)) {
             $cmdp = $p;
             $cmdp["param"] = implode(",", $msgid);
             $cmd =& pfcCommand::Factory("error");
             $cmd->run($xml_reponse, $cmdp);
             return;
         }
         // a message has been posted so :
         // - clear errors
         // - give focus to "words" field
         // @todo move this code in the handleResponse function
         $xml_reponse->script("pfc.clearError(Array('pfc_words" . "','pfc_handle" . "'));");
         $xml_reponse->script("\$('pfc_words').focus();");
     }
     $xml_reponse->script("pfc.handleResponse('" . $this->name . "', 'ok', '');");
 }
开发者ID:danielheyman,项目名称:EazySubs,代码行数:73,代码来源:send.class.php



注:本文中的phpFreeChat类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP phpQuery类代码示例发布时间:2022-05-23
下一篇:
PHP phpFlickr类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap