1, "newmsg" => 3))); } else { // Get the chat file $groupchatfile = APP_PATH.JAK_CACHE_DIRECTORY.'/groupchat'.$_SESSION['groupchatid'].'.txt'; // Check if file is available and user is valid if (file_exists($groupchatfile)) { // Now check the button id if (file_exists($cacheopid)) { // Import the language file if ($groupchat[$_SESSION['groupchatid']]['lang'] && file_exists(APP_PATH.'lang/'.strtolower($groupchat[$_SESSION['groupchatid']]['lang']).'.php')) { include_once(APP_PATH.'lang/'.strtolower($groupchat[$_SESSION['groupchatid']]['lang']).'.php'); } else { include_once(APP_PATH.'lang/'.JAK_LANG.'.php'); } } else { // The chat has gone offline show the message if (!empty($HD_ANSWERS) && is_array($HD_ANSWERS)) foreach ($HD_ANSWERS as $v) { if ($v["msgtype"] == 12 && $v["lang"] == JAK_LANG) { $phold = array("%operator%","%client%","%email%"); $replace = array("", $_SESSION['gcname'], JAK_EMAIL); $offlinemsg = str_replace($phold, $replace, $v["message"]); } } $chatmsg .= '
'; die(json_encode(array("status" => 1, "html" => $chatmsg, "newmsg" => 3, "vislist" => "", "delmsg" => "", "lastid" => $lastid))); } // Update the user status every 2 minutes if (!isset($_SESSION["usrbanned"]) && (!isset($_SESSION["vislasttime"]) || $_SESSION["vislasttime"] < $ctime - 120)) { $_SESSION["vislasttime"] = $ctime; $jakdb->update("groupchatuser", ["statusc" => $ctime], ["id" => $_SESSION['gcuid']]); // We are a operator update the user table as well. if (isset($_SESSION['gcopid']) && !empty($_SESSION['gcopid'])) { $jakdb->update("user", ["lastactivity" => time(), "session" => session_id()], ["id" => $_SESSION['gcopid']]); } } if ($winactive) { // Get the file $chatfile = file_get_contents($groupchatfile); // Each line $chatfile = explode(":!n:", $chatfile); $modstuff = ""; if (isset($chatfile) && is_array($chatfile)) foreach ($chatfile as $v) { $chatline = jak_string_encrypt_decrypt($v, false); // We will go trough each file $chatline = explode(":#!#:", $chatline); // Message format: time:#!#:userid:#!#:name:#!#:avatar:#!#:message:#!#:quote; // Now we check if we have messages after our timeline if ($lastid < $chatline[0]) { // We are banned if (isset($_SESSION["usrbanned"])) { // We have a mod line if ($chatline[2] == "*mod*" && $chatline[4] == "react" && $chatline[3] == $_SESSION['gcuid']) { // remove the banned session unset($_SESSION["usrbanned"]); $lastid = $chatline[0]; $newmsg = 1; // die(json_encode(array("status" => 1, "html" => "", "newmsg" => $newmsg, "lastid" => $lastid))); } } else { // We have a mod line if ($lastid != 0 && $chatline[2] == "*mod*") { // At this moment we have only delete. if ($chatline[4] == "delete") { $delmsg[] = $chatline[3]; $newmsg = 2; // ok the user that reads that is banned } elseif ($chatline[4] == "banned" && $chatline[3] == $_SESSION['gcuid']) { // Session banned $_SESSION["usrbanned"] = true; $lastid = $chatline[0]; $newmsg = 2; } } else { // Unique Message id $umsgid = $chatline[1].str_replace(".", "_", $chatline[0]); // Convert urls $messagedisp = nl2br(replace_urls($chatline[4])); // Convert emotji $messagedisp = Emojione\Emojione::toImage($messagedisp); // We have an operator if (isset($_SESSION['gcopid'])) { $modstuff = ''; } // We have a quoted message $quoted = ""; if (isset($chatline[5]) && !empty($chatline[5])) { // Convert urls $quotemsg = nl2br(replace_urls($chatline[5])); // Convert emotji $quotemsg = Emojione\Emojione::toImage($quotemsg); $quoted = ''.$quotemsg.''; } // is mod $ismod = false; if (isset($chatline[6]) && $chatline[6] === "true") $ismod = true; // Now load the time only once a minute $chattime = ""; if (($lastid + 15) < $chatline[0]) $chattime = '