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

PHP Chat类代码示例

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

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



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

示例1: onLogoutSuccess

 /**
  * @param Request $request
  * @return null|RedirectResponse
  */
 public function onLogoutSuccess(Request $request)
 {
     // Chamilo logout
     $request->getSession()->remove('_locale');
     $request->getSession()->remove('_locale_user');
     if (api_is_global_chat_enabled()) {
         $chat = new \Chat();
         $chat->setUserStatus(0);
     }
     $userId = $this->storage->getToken()->getUser()->getId();
     $tbl_track_login = Database::get_main_table(TABLE_STATISTIC_TRACK_E_LOGIN);
     $sql = "SELECT login_id, login_date\n                FROM {$tbl_track_login}\n                WHERE login_user_id = {$userId}\n                ORDER BY login_date DESC\n                LIMIT 0,1";
     $row = Database::query($sql);
     $loginId = null;
     if (Database::num_rows($row) > 0) {
         $loginId = Database::result($row, 0, "login_id");
     }
     $loginAs = $this->checker->isGranted('ROLE_PREVIOUS_ADMIN');
     if (!$loginAs) {
         $current_date = api_get_utc_datetime();
         $sql = "UPDATE {$tbl_track_login}\n                    SET logout_date='" . $current_date . "'\n        \t\t    WHERE login_id='{$loginId}'";
         Database::query($sql);
     }
     $online_table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ONLINE);
     $query = "DELETE FROM " . $online_table . " WHERE login_user_id = {$userId}";
     Database::query($query);
     require_once api_get_path(SYS_PATH) . 'main/chat/chat_functions.lib.php';
     exit_of_chat($userId);
     $login = $this->router->generate('home');
     $response = new RedirectResponse($login);
     return $response;
 }
开发者ID:omaoibrahim,项目名称:chamilo-lms,代码行数:36,代码来源:LogoutSuccessHandler.php


示例2: getSpecific

 public function getSpecific()
 {
     $username = Input::get('username');
     $chat = new Chat();
     $result = $chat->getChat($username);
     return json_encode($result);
 }
开发者ID:centaurustech,项目名称:sagip,代码行数:7,代码来源:ChatController.php


示例3: render_chat

	function render_chat($league_id){
		require_once(APPPATH.'controllers/chat.php'); 
	    $chat =  new Chat();
	    $chat->index($league_id);

		
	}
开发者ID:bmfelix,项目名称:draftlounge,代码行数:7,代码来源:leagues.php


示例4: getChatMessages

 /**
  * @param \Chat\Bundle\CommonBundle\Entity\Chat $chat
  * @param array $hashList
  * @return array
  */
 public function getChatMessages(Chat $chat, $hashList = array())
 {
     $messages = $this->_em->getConnection()->fetchAll('
         SELECT 
             cm.id,
             cm.hash,
             cm.content,
             cm.createAt,
             m.username,
             m.textColor,
             m.backgroundColor
         FROM
             `chat_message` cm
         LEFT JOIN
             `chat_member` m ON m.id = cm.member_id
         WHERE
             cm.`chat_id` = :chat_id
             AND cm.hash NOT IN (' . implode(',', $hashList) . ')
         ORDER BY
             cm.create_at ASC
     ', array('chat_id' => $chat->getId()));
     foreach ($messages as $key => $value) {
         $createAt = new \DateTime($value['create_at']);
         $value['create_at'] = $createAt->format('m.d.y g:i a');
         $messages[$key] = $value;
     }
     return $messages;
 }
开发者ID:alexeybob,项目名称:QuickChat,代码行数:33,代码来源:ChatRepository.php


示例5: get_ticket

 public function get_ticket()
 {
     //获取 component_verify_ticket 每十分钟微信服务本服务器请求一次
     $wechat = new Chat($this->config);
     $data = $wechat->request();
     // 	print_r($data);die;
     if (isset($data['InfoType'])) {
         if ($data['InfoType'] == 'component_verify_ticket') {
             if (isset($data['ComponentVerifyTicket']) && $data['ComponentVerifyTicket']) {
                 if ($config = D('Config')->where("`name`='wx_componentverifyticket'")->find()) {
                     D('Config')->where("`name`='wx_componentverifyticket'")->data(array('value' => $data['ComponentVerifyTicket']))->save();
                 } else {
                     D('Config')->data(array('name' => 'wx_componentverifyticket', 'value' => $data['ComponentVerifyTicket'], 'type' => 'type=text', 'gid' => 0, 'tab_id' => 0))->add();
                 }
                 S(C('now_city') . 'config', null);
                 exit('success');
             }
         } elseif ($data['InfoType'] == 'unauthorized') {
             if (isset($data['AuthorizerAppid']) && $data['AuthorizerAppid']) {
                 D('Weixin_bind')->where("`authorizer_appid`='{$data['AuthorizerAppid']}'")->delete();
                 exit('success');
             }
         }
     }
 }
开发者ID:belerweb,项目名称:pigcms,代码行数:25,代码来源:ChatAction.class.php


示例6: onDisconnected

 function onDisconnected()
 {
     // We reset the Chat view
     $c = new Chat();
     $c->ajaxGet();
     $this->refreshRooms();
     Notification::append(null, $this->__('chatrooms.disconnected'));
 }
开发者ID:Anon215,项目名称:movim,代码行数:8,代码来源:Rooms.php


示例7: save

 function save($id = FALSE)
 {
     if ($_POST) {
         $chat = new Chat($id);
         $_POST['user_id'] = $this->session->userdata('id');
         $chat->from_array($_POST);
         $chat->save();
         set_notify('success', lang('save_data_complete'));
     }
     redirect('chats/admin/chats');
 }
开发者ID:unisexx,项目名称:thaigcd2015,代码行数:11,代码来源:chats.php


示例8: logout

 /**
  * @return void  Directly redirects the user or leaves him where he is, but doesn't return anything
  * @param int $userId
  * @param bool $logout_redirect
  * @author Fernando P. García <[email protected]>
  */
 public static function logout($user_id = null, $logout_redirect = false)
 {
     global $extAuthSource;
     // Database table definition
     $tbl_track_login = Database::get_main_table(TABLE_STATISTIC_TRACK_E_LOGIN);
     if (empty($user_id)) {
         $user_id = api_get_user_id();
     }
     $user_id = intval($user_id);
     // Changing global chat status to offline
     if (api_is_global_chat_enabled()) {
         $chat = new Chat();
         $chat->set_user_status(0);
     }
     // selecting the last login of the user
     $sql_last_connection = "SELECT login_id, login_date FROM {$tbl_track_login}\n                              WHERE login_user_id='{$user_id}' ORDER BY login_date DESC LIMIT 0,1";
     $q_last_connection = Database::query($sql_last_connection);
     $i_id_last_connection = null;
     if (Database::num_rows($q_last_connection) > 0) {
         $i_id_last_connection = Database::result($q_last_connection, 0, "login_id");
     }
     if (!isset($_SESSION['login_as']) && !empty($i_id_last_connection)) {
         $current_date = api_get_utc_datetime();
         $s_sql_update_logout_date = "UPDATE {$tbl_track_login} SET logout_date='" . $current_date . "' WHERE login_id = '{$i_id_last_connection}'";
         Database::query($s_sql_update_logout_date);
     }
     Online::loginDelete($user_id);
     //from inc/lib/online.inc.php - removes the "online" status
     //the following code enables the use of an external logout function.
     //example: define a $extAuthSource['ldap']['logout']="file.php" in configuration.php
     // then a function called ldap_logout() inside that file
     // (using *authent_name*_logout as the function name) and the following code
     // will find and execute it
     $uinfo = api_get_user_info($user_id);
     if (isset($uinfo['auth_source']) && $uinfo['auth_source'] != PLATFORM_AUTH_SOURCE && is_array($extAuthSource)) {
         if (is_array($extAuthSource[$uinfo['auth_source']])) {
             $subarray = $extAuthSource[$uinfo['auth_source']];
             if (!empty($subarray['logout']) && file_exists($subarray['logout'])) {
                 require_once $subarray['logout'];
                 $logout_function = $uinfo['auth_source'] . '_logout';
                 if (function_exists($logout_function)) {
                     $logout_function($uinfo);
                 }
             }
         }
     }
     require_once api_get_path(SYS_PATH) . 'main/chat/chat_functions.lib.php';
     exit_of_chat($user_id);
     if ($logout_redirect) {
         header("Location: index.php");
         exit;
     }
 }
开发者ID:ilosada,项目名称:chamilo-lms-icpna,代码行数:59,代码来源:online.inc.php


示例9: editorFileManager

 /**
  * @Route("/editor/filemanager", name="editor_filemanager")
  * @Method({"GET"})
  */
 public function editorFileManager(Request $request)
 {
     \Chat::setDisableChat();
     $courseId = $request->get('course_id');
     $sessionId = $request->get('session_id');
     return $this->render('@ChamiloCore/default/javascript/editor/ckeditor/elfinder.html.twig', ['course_id' => $courseId, 'session_id' => $sessionId]);
 }
开发者ID:omaoibrahim,项目名称:chamilo-lms,代码行数:11,代码来源:FrontController.php


示例10: run

 public function run()
 {
     $faker = Faker::create();
     foreach (range(1, 10) as $index) {
         Chat::create([]);
     }
 }
开发者ID:SenhorBardell,项目名称:yol,代码行数:7,代码来源:ChatsTableSeeder.php


示例11: sc_chat_shortcode_offline

/**
 * Chat offline shortcode
 *
 * @access public
 * @return string
 */
function sc_chat_shortcode_offline($atts, $content = '')
{
    // Check if all OPs offline
    if (!Chat::check_if_any_op_online()) {
        return $content;
    }
}
开发者ID:k2jysy,项目名称:mergeshop,代码行数:13,代码来源:fn.init.php


示例12: getInstance

 /**
  * 单例方法
  */
 public static function getInstance()
 {
     if (!self::$server instanceof Chat) {
         self::$server = new self();
     }
     return self::$server;
 }
开发者ID:xw716825,项目名称:work,代码行数:10,代码来源:Chat.php


示例13: setIsSystem

 public function setIsSystem($isSystem = ChatMessageManager::IS_SYSTEM_YES)
 {
     if (!in_array($isSystem, Chat::getConstsArray('IS_SYSTEM'))) {
         throw new InvalidArgumentException("Invalid \$isSystem specified");
     }
     $this->qb->andWhere($this->qb->expr()->equal(new Field("is_system", "chat_msg"), $isSystem));
     return $this;
 }
开发者ID:Welvin,项目名称:stingle,代码行数:8,代码来源:ChatMessageFilter.class.php


示例14: loadModelById

 public function loadModelById($id)
 {
     $model = Chat::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     } else {
         return $model;
     }
 }
开发者ID:GsHatRed,项目名称:Yiitest,代码行数:9,代码来源:ChatController.php


示例15: getChatByID

 public static function getChatByID($chatID)
 {
     include 'connect.php';
     $sql = "SELECT * FROM chats WHERE id = {$chatID}";
     //echo $sql;
     $result = mysql_query($sql);
     $row = mysql_fetch_array($result);
     mysql_close();
     if ($row) {
         $chat = new Chat();
         $chat->setChatID($row['id']);
         $chat->setUser1($row['user1']);
         $chat->setUser2($row['user2']);
         return $chat;
     } else {
         return false;
     }
 }
开发者ID:snamper,项目名称:Discover,代码行数:18,代码来源:classChat.php


示例16: main

 public function main()
 {
     $room = intval($_POST['room']);
     $game = intval($_POST['game']);
     $loggedUser = LoggedUser::whoIsLogged();
     $lastActivity = Room::getUserLastActivityInRoom($loggedUser['id'], $room);
     Room::updateUserLastActivity($loggedUser['id'], $room);
     MySmarty::assign('messages', Chat::getMessages($room, $loggedUser['id'], 0, $game));
     echo MySmarty::fetch('message-box.tpl');
 }
开发者ID:Tomeno,项目名称:lulcobang,代码行数:10,代码来源:RefreshChat.php


示例17: post

 public function post($resourceVals, $data, $userId)
 {
     global $logger, $warnings_payload;
     $chatId = $resourceVals['messages'];
     if (isset($chatId)) {
         $warnings_payload[] = 'POST call to /messages must not have ' . '/chatID appended i.e. POST /user/messags';
         throw new UnsupportedResourceMethodException();
     }
     $nowFormat = date('Y-m-d H:i:s');
     $chatObj = new Chat($data['from'], $data['to'], $data['message'], $nowFormat, 0);
     $logger->debug("POSTed Message Detail: " . $chatObj->toString());
     $this->collapDAO->insert($chatObj);
     $messageDetail = $chatObj->toArray();
     if (!isset($messageDetail['id'])) {
         return array('code' => '2011');
     }
     $this->messageDetail[] = $messageDetail;
     return array('code' => '2001', 'data' => array('messageDetail' => $this->messageDetail));
 }
开发者ID:rajnishp,项目名称:teamroomV3,代码行数:19,代码来源:UserMessagesResource.class.php


示例18: ajaxSend

 function ajaxSend($to, $pack, $file)
 {
     if (!$this->validateJid($to)) {
         return;
     }
     list($key, $ext) = explode('.', $file);
     $filepath = dirname(__FILE__) . '/stickers/' . $pack . '/' . $key . '.png';
     if (!file_exists($filepath)) {
         return;
     }
     // We get the base64
     $base64 = base64_encode(file_get_contents($filepath));
     // Caching the picture
     if (!file_exists(CACHE_PATH . md5($key) . '.png')) {
         $p = new Picture();
         $p->fromBase($base64);
         $p->set($key, 'png');
     }
     // Creating a message
     $m = new \Modl\Message();
     $m->session = $this->user->getLogin();
     $m->jidto = echapJid($to);
     $m->jidfrom = $this->user->getLogin();
     $m->sticker = $key;
     $m->body = $this->__('sticker.sent');
     $m->published = gmdate('Y-m-d H:i:s');
     $session = \Session::start();
     $m->id = Uuid::uuid4();
     $m->type = 'chat';
     $m->resource = $session->get('resource');
     // Sending the sticker
     $html = "<p><img alt='Sticker' src='cid:sha1+" . $key . "@bob.xmpp.org'/></p>";
     $p = new Publish();
     $p->setTo($m->jidto)->setContent($m->body)->setHTML($html)->setId($m->id)->request();
     $md = new \Modl\MessageDAO();
     $md->set($m);
     // Sending it to Chat
     $packet = new Moxl\Xec\Payload\Packet();
     $packet->content = $m;
     $c = new Chat();
     $c->onMessage($packet);
 }
开发者ID:Anon215,项目名称:movim,代码行数:42,代码来源:Stickers.php


示例19: say

 public function say()
 {
     if ($this->isPost()) {
         $message = new ChatMessage();
         $message->set_model($this->vars());
         $message->save();
         C($message)->commit();
         self::$static_flag = true;
     }
     exit;
 }
开发者ID:riaf,项目名称:ringl,代码行数:11,代码来源:Chat.php


示例20: __construct

 function __construct()
 {
     // Check if chat already exists
     $user_one = getLoggedInUserGuid();
     $user_two = pageArray(2);
     $chat = getEntity(array("type" => "Chat", "metadata_name_value_pairs" => array(array("name" => "user_one", "value" => $user_one), array("name" => "user_two", "value" => $user_two))));
     if (!$chat) {
         $chat = getEntity(array("type" => "Chat", "metadata_name_value_pairs" => array(array("name" => "user_one", "value" => $user_two), array("name" => "user_two", "value" => $user_one))));
     }
     if (!$chat) {
         $chat = new Chat();
         $chat->user_one = $user_one;
         $chat->user_two = $user_two;
         $chat->save();
     }
     $chat->user_one_closed = false;
     $chat->user_two_closed = false;
     $chat->save();
     forward();
 }
开发者ID:socialapparatus,项目名称:socialapparatus,代码行数:20,代码来源:CreateChatActionHandler.php



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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