/** * Public function that creates a single instance */ public static function getInstance() { if (!isset(self::$_instance)) { self::$_instance = new self(); } return self::$_instance; }
function getChats($dbh) { $stmt = $dbh->prepare("select * from " . chat::$table_name . " ORDER BY id desc limit 100"); $stmt->execute(); $result = array(); while ($row = $stmt->fetch()) { $p = new chat(); $p->copyFromRow($row); $result[] = $p; } return $result; }
public static function _self($db) { if (self::$_self == null) { self::$_self = new self($db); } return self::$_self; }
echo "[main]loading " . $datei->getFilename() . " ... "; $json = file_get_contents(ROOT_DIR . "\\modules\\" . $datei->getFilename() . "\\config.json"); if (NULL != json_decode($json)) { if (include_once ROOT_DIR . "\\modules\\" . $datei->getFilename() . "\\" . $datei->getFilename() . ".php") { echo "finish\n"; array_push($modules, $datei->getFilename()); } else { echo "failed no server side file\n"; } } else { echo "failed no or invalid JSON\n"; } } } } echo "[main]Modules included\n"; echo "[main]Starting chat server on port: " . $port . ".\n"; echo "----------------------------------------------------------------------\n"; $chat = new chat(); $server = new User(); $server->name = "SERVER"; $server->rights = 40000000; $server->status = 3; array_push($users, $server); $chat->socket_server($port); echo "ende"; ?>
<?php include "../class.php"; session_start(); chat::get_contact_list();
require_once api_get_path(SYS_CODE_PATH) . 'chat/chat_functions.lib.php'; echo saveMessage($_REQUEST['message'], api_get_user_id(), api_get_course_info(), api_get_session_id(), api_get_group_id(), true); } if (api_get_setting('allow_global_chat') == 'false') { exit; } $to_user_id = isset($_REQUEST['to']) ? $_REQUEST['to'] : null; $message = isset($_REQUEST['message']) ? $_REQUEST['message'] : null; if (!isset($_SESSION['chatHistory'])) { $_SESSION['chatHistory'] = array(); } if (!isset($_SESSION['openChatBoxes'])) { $_SESSION['openChatBoxes'] = array(); } $chat = new Chat(); if (chat::disableChat()) { exit; } if ($chat->is_chat_blocked_by_exercises()) { // Disconnecting the user $chat->setUserStatus(0); exit; } switch ($action) { case 'chatheartbeat': $chat->heartbeat(); break; case 'closechat': $chat->close(); break; case 'sendchat':
<?php require "class/chat.php"; $group_id = $_POST['group_id']; $chatAPI = new chat(); $name = $chatAPI->submitMessage($group_id, '', 'voice'); $save_folder = dirname(__FILE__) . "/voice"; $tmp_name = $_FILES["audiofile"]["tmp_name"]; $upload_name = $_FILES["audiofile"]["name"]; $filename = "{$save_folder}/" . $name . ".wav"; $saved = 0; $saved = move_uploaded_file($tmp_name, $filename) ? 1 : 0; echo $name;
<?php session_start(); include "classes.php"; if (isset($_POST['ChatText'])) { $chat = new chat(); $chat->setChatUserName($_SESSION['accountuser']); $chat->setChatText($_POST['ChatText']); $chat->InsertChatMessage(); header("Location:chathome.php?success=1"); }
public function addChat($nick, $host, $port, $admin, $handler, $fromTimer = false) { $lnick = irc::myStrToLower($nick); foreach ($this->dccList as $index => $dcc) { if ($dcc->type == CHAT) { if (irc::myStrToLower($dcc->nick) == $lnick) { $dcc->disconnect(); break; } } } $reverse = false; if ($this->ircClass->getClientConf("mircdccreverse") != "" && $fromTimer == false) { $port = intval($this->ircClass->getClientConf("mircdccreverse")); if ($port == 0) { return NULL; } $args = new argClass(); $args->arg1 = $nick; $args->arg2 = $host; $args->arg3 = $port; $args->arg4 = $admin; $args->arg5 = $handler; $args->arg7 = time(); $args->arg8 = CHAT; $this->ircClass->notice($nick, "DCC: NOTICE: This server is using the mIRC Chat Server Protocol. Please use ' /dccserver +c on " . $this->ircClass->getClientConf("mircdccreverse") . " ' to chat with me! Starting 6 second delay...", 0); $this->ircClass->sendRaw("WHOIS " . $nick); $this->timerClass->addTimer(irc::randomHash(), $this, "reverseTimer", $args, 6, false); return; } if ($fromTimer == true) { $reverse = DCC_REVERSE; // using mIRC dcc reverse protocol } if ($host == NULL || $port == NULL) { $conn = new connection(null, null, 0); $listening = true; $status = DCC_LISTENING; } else { $conn = new connection($host, $port, CONNECT_TIMEOUT); $listening = false; $status = DCC_CONNECTING; } $conn->setSocketClass($this->socketClass); $conn->setIrcClass($this->ircClass); $conn->setCallbackClass($this); $conn->setTimerClass($this->timerClass); $port = $conn->init(); if ($conn->getError()) { $this->ircClass->log("Start Chat Error: " . $conn->getErrorMsg()); return false; } $sockInt = $conn->getSockInt(); $this->chatCount++; $id = $this->highestId(); $chat = new chat($id, $nick, $admin, $sockInt, $host, $port, $handler, $reverse); $chat->setIrcClass($this->ircClass); $chat->setDccClass($this); $chat->setParserClass($this->parserClass); $chat->setSocketClass($this->socketClass); $chat->setTimerClass($this->timerClass); $chat->connection = $conn; $chat->status = $status; $chat->removed = false; $this->dccList[$sockInt] = $chat; $chat->initialize(); $conn->setCallbackClass($chat); if ($listening == true) { $this->timerClass->addTimer(irc::randomHash(), $this, "checkDccTimeout", $chat, 30, true); } else { $conn->connect(); } return $port; }
<? include("connection.php"); include("classes/users.class.php"); include("classes/chat.class.php"); $chat= new chat(); if ($_POST['txt']) $chat->writechat($_REQUEST['chatid'],$_POST['user'],$_POST['txt']); ?>
if (!$row) { // Username is free to have $sql = "UPDATE users SET lastalive=NULL, username=:username WHERE uid=:uid"; $st = $this->db->prepare($sql); $st->bindParam(':username', $username); $st->bindParam(':uid', $this->uid); $st->execute(); $this->username = $username; } return $this->username; } } if (isset($_POST['action'])) { $action = $_POST['action']; $user = new user(); $chat = new chat($user); $user->updateLastAlive(); switch ($action) { case 'newmsg': $data = $_POST; $chat->newMessage($data); break; case 'update': $chat->updateUser(); break; default: break; } //var_dump($_POST); } ?>
<?php session_start(); include "classes.php"; if (isset($_POST['chattext'])) { $chat = new chat(); $chat->setchatuserid($_SESSION['userid']); $chat->setchattext($_POST['chattext']); $chat->setsender($_SESSION['username']); $chat->setreceiver($_POST['receiver']); $chat->insertchatmessage(); //saves all the chat messages with session username and receiver name in data table by calling the function in classes.php }
<?php /********************************* Author: Corey Muniz Controller for the Admin Panel *********************************/ header('Content-type: application/json'); require_once "models/User.php"; require_once "models/db.php"; require_once "models/PasswordHash.php"; require_once "models/chat.php"; session_start(); //Create some class objects to handle the data $user = new User(); $temp = new User(); $chat = new chat(); //Check to see if they are logged in if (isset($_SESSION['user'])) { $user = $_SESSION['user']; } if ($_GET) { //If they requested to enter a message and the message isn't blank, enter it into the db if (isset($_GET['msg']) && $_GET['msg'] != "") { //If they aren't logged on, don't let them make a new message if (!isset($user)) { die; } $msg = $_GET['msg']; //Grab the message $chat->userid = $user->id; //Get the user id
public static function login($client, $msg) { global $server, $groups, $users; if (DEBUG) { echo "login\n"; } $temp = explode(" ", $msg); if ($temp[0] == "!login") { if ($client->ip == SERVER_IP) { $client->name = "Admin"; $client->status = 3; $client->active_group = "Main"; $client->rights = 10000000; $group = select::receivers($client->active_group); array_push($group->members, new member($client)); array_push($client->groups, $client->active_group); array_push($users, $client); chat::send_msg($server, "Success", $client); } else { if (select::byname($temp[1]) === false) { if (preg_match("/admin/i", $temp[1]) == 0 && preg_match("/server/i", $temp[1]) == 0) { if (preg_match("/[-_a-z0-9]{4,20}/i", $temp[1])) { $client->name = $temp[1]; $client->status = 3; $client->active_group = "Main"; $group = select::receivers($client->active_group); array_push($group->members, new member($client)); array_push($client->groups, $client->active_group); array_push($users, $client); chat::send_msg($server, "Success", $client); } else { chat::send_msg($server, "Invalid Username", $client); } } else { chat::send_msg($server, "Username is reserved", $client); } } else { chat::send_msg($server, "Username already used! Chose a other!", $client); } } } else { chat::send_msg($server, "You must first login with !login <username>!", $client); } }
private function chat($name) { $function = M('Function')->where(array('funname' => 'liaotian'))->find(); if (!$function['status']) { return ''; } $this->requestdata('textnum'); $check = $this->user('connectnum'); if ($check['connectnum'] != 1) { return C('connectout'); } if ($name == '你父母是谁' || $name == '你爸爸是谁' || $name == '你妈妈是谁') { return '主人,' . $this->my . '是PigCms创造的,所以他们是我的父母,不过主人我属于你的'; } else { if ($name == '网站' || $name == '官网' || $name == '网址' || $name == '3g网址') { return '【' . C('site_name') . '】' . "\n" . '' . C('site_name') . '' . "\n" . '【' . C('site_name') . '服务宗旨】' . "\n" . '化繁为简,让菜鸟也能使用强大的系统!'; } else { $chat = new chat($name); $rstr = $chat->index(); return str_replace('mzxing_com', 'pigcms', $rstr); } } }
<?php include "../class.php"; session_start(); $check_if_user_available = new login(); $check_if_user_available->check_user_available(); if ($_SESSION["user_exist"]) { // si el usuario existe vamos a //guardar este contacto en nuestro direcotiro chat::append_into_contact_list(); }
/********************************* Author: Corey Muniz Controller for the main page *********************************/ require_once "models/User.php"; require_once "models/db.php"; require_once "models/PasswordHash.php"; require_once "models/post.php"; require_once "models/chat.php"; require_once "models/comments.php"; session_start(); $guy = new User(); $comment = new comments(); if (isset($_SESSION['user'])) { $user = $_SESSION['user']; } $post = new post(); $posts = $post->getPosts($dbh); $chat = new chat(); $chats = $chat->getChats($dbh); $chats = array_reverse($chats); include_once "models/championList.php"; $champObj = new championList(); $champObj->generateChampionList(); $champObj->generateFreeChampionList(); require_once "views/header.php"; require_once "views/sections/championSlider.php"; require_once "views/sections/front.php"; require_once "views/sections/chat.php"; require_once "views/sections/posts.php"; require_once "views/footer.php";
public function append_into_db_msg() { extract($_POST); $UNIX_TIME = parseInt(strtotime(date("Y-m-d H:i:s"))); //+3600; $QUERY = "INSERT INTO chat values(NULL, {$id_user_writer} ,{$id_user_otherside} ,'{$msg}' , '" . $UNIX_TIME . "' ) "; mysql_query($QUERY, Conectar::con()); $id_last_msg = mysql_insert_id(); chat::get_msg_from_db_by_limit("justOneMSG", $id_user_writer); // obtenemos solo 1 msg notify::set_notify($id_last_msg); // metemos la notifycacion |||| pasamos ( user_writer , user_reader , id_chat); }
<?php session_start(); //echo "hello"; include "../classes/mutliplayer.php"; //echo "hello"; //echo $_SESSION['UserId']; //echo $_SESSION['GameId']; //echo "hello"; $chat = new chat(); $chat->setChatUserId($_SESSION['UserId']); $chat->setChatGameId($_SESSION['GameId']); $chat->DisplayTeam();
<?php /** * * @authors Yurii Kostenko (y.kostenko111@ya.ru) * @date 2015-10-09 11:57:35 * @version 1 */ require 'config.php'; $chat = chat::_self($db); if (isset($_GET['color'])) { $id = intval($_GET['id']); $collor = trim(strip_tags($_GET['color'])); try { if ($chat->collor($collor, $id)) { return true; } } catch (Exception $e) { //Запись в лог } } if (isset($_POST) && !empty($_POST)) { if (!$chat->LoginMembers($_POST['login'], $_POST['password'])) { echo 0; } else { echo 1; } }
<?php include "../class.php"; session_start(); if (isset($_POST)) { $UPDATE_CHAT = new chat(); switch ($_POST["type_rqs"]) { // type_rqs correspondie al parametro de paginacion case "true": $_SESSION["get_by_pagination"] = true; $UPDATE_CHAT->get_msg_from_db_by_limit("all"); break; case "false": $_SESSION["get_by_pagination"] = false; $UPDATE_CHAT->get_msg_from_db_by_limit("all"); break; } }
<?php require '/Constantes.php'; //session_start(); require_once CONSTANT_PATH_CONFIGURACION . "/chat/chat.php"; $refresh = new chat(); require_once CONSTANT_PATH_CONFIGURACION . "/chat/chat.php"; echo $query = "select * from chat"; $a = $refresh->connect_easy($query); $refresh->show($a);
include("classes/users.class.php"); include("classes/chat.class.php"); $user= new users(); if (!$user->isuser($_REQUEST['device'])) { header("location: newuser.php?device=".$_REQUEST['device']); exit(); } $con= new connection(); $con->execute("update users set time='" . time() . "' where iduser='******'"); $chat= new chat(); $chat->closedeadrooms(); if(!$chatid=$_GET['idchat']) { if ($chatid=$chat->findchat($user->id)) { //echo "found chat"; $chat->joinchat($chatid,$user->id); }else{ $chatid=$chat->createchat($user->id); //echo "created chat"; } //echo $chatid;
<?php //session_start(); require_once "chat.php"; $submit = new chat(); $query = "insert into chat values ('" . $usuario . "','" . $_GET["chat"] . "','000000',NOW())"; $submit->connect_easy($query);
<?php include "classes.php"; $chat = new chat(); $chat->DisplayMessage();
<?php $group_id = $_POST['group_id']; require "class/chat.php"; $chatAPI = new chat(); echo $chatAPI->getLastMessage($group_id);
<?php /** * Save java code to server in a specific folder * * @param code [POST] java code string * @param folder [POST] folder to hold the code * @return 1 for successful save */ //$folder = $_POST['folder']; //$file = "../code/". $folder ."/test.java"; //unlink($file); //file_put_contents($file, $code); require "class/chat.php"; $message = $_POST['message']; $group_id = $_POST['group_id']; $chatAPI = new chat(); echo $chatAPI->submitMessage($group_id, $message, 'text');
<?php session_start(); //echo "hello"; include "../classes/chat.php"; //echo "hello"; //echo $_SESSION['UserId']; //echo $_SESSION['GameId']; //echo "hello"; $chat = new chat(); $chat->setChatUserId($_SESSION['UserId']); $chat->setChatGameId($_SESSION['GameId']); $chat->DisplayMessagesInGame();
<?php session_start(); include "classes.php"; if (isset($_POST['ChatText']) && !empty($_POST['ChatText'])) { $chat = new chat(); $chat->setChatUserId($_SESSION['UserId']); $chat->setChatText($_POST['ChatText']); $chat->InsertChatMessage(); }
<? include ("connection.php"); include ("classes/users.class.php"); include ("classes/chat.class.php"); $user=new users(); $chat=new chat(); $count=$user->getusercount(); if (!$chat->chatclosed($_REQUEST['idchat'])) { if ($partner=$chat->getchatpartner($_REQUEST['idchat'], $_REQUEST['iduser'])) echo "<b>Chatting with $partner</b>"; else echo "<b>Waiting for chat partner</b>"; } else echo "<b>Partner has left the chat</b>"; echo " - $count Users Online!"; $con=new connection(); $con->execute("select * from text where idchat='" . $_REQUEST['idchat'] . "' "); $count=$con->numRows(); /* if ($count > 12) $start=$count - 12; else $start=0; */ $con->execute("select * from text where idchat='" . $_REQUEST['idchat'] . "'");