diff --git a/main/chat/chat.php b/main/chat/chat.php
index 605137fe68..d0212454a4 100644
--- a/main/chat/chat.php
+++ b/main/chat/chat.php
@@ -48,9 +48,8 @@ $cidreq = Security::remove_XSS($_GET['cidReq']);
?>
-
-
+
'.get_lang('Chat').' - '.$mycourseid.' - '.api_get_setting('siteName').'';
diff --git a/main/chat/chat_chat.php b/main/chat/chat_chat.php
index 21fee299a8..afae2d7e55 100644
--- a/main/chat/chat_chat.php
+++ b/main/chat/chat_chat.php
@@ -132,10 +132,10 @@ if (!empty($course)) {
array_splice($content, 0, $remove);
require 'header_frame.inc.php';
- if ($_GET['origin'] == 'whoisonline') { //the caller
+ if (isset($_GET['origin']) && $_GET['origin'] == 'whoisonline') { //the caller
$content[0] = get_lang('CallSent').'
'.$content[0];
}
- if ($_GET['origin'] == 'whoisonlinejoin') { //the joiner (we have to delete the chat request to him when he joins the chat)
+ if (isset($_GET['origin']) && $_GET['origin'] == 'whoisonlinejoin') { //the joiner (we have to delete the chat request to him when he joins the chat)
$track_user_table = Database::get_main_table(TABLE_MAIN_USER);
$sql = "UPDATE $track_user_table set chatcall_user_id = '', chatcall_date = '', chatcall_text='' WHERE (user_id = ".$_user['user_id'].")";
$result = Database::query($sql);
diff --git a/main/chat/chat_hidden.php b/main/chat/chat_hidden.php
index d132ba567c..a61e89e1d4 100644
--- a/main/chat/chat_hidden.php
+++ b/main/chat/chat_hidden.php
@@ -34,8 +34,8 @@ $isMaster = (bool)$is_courseAdmin;
$date_now = date('Y-m-d');
-$group_id = intval($_SESSION['_gid']);
-$session_id = intval($_SESSION['id_session']);
+$group_id = api_get_group_id();
+$session_id = api_get_session_id();
$session_condition = api_get_session_condition($session_id);
$group_condition = " AND to_group_id = '$group_id'";
@@ -68,7 +68,7 @@ if (!empty($group_id)) {
$basename_chat = 'messages-'.$date_now;
}
-$chat_size_old = intval($_POST['chat_size_old']);
+$chat_size_old = isset($_POST['chat_size_old']) ? intval($_POST['chat_size_old']) : null;
$file = $chat_path.$basename_chat.'.log.html';
$chat_size_new = 0;
@@ -92,7 +92,7 @@ Database::query($query);
$query = "SELECT COUNT(user_id) FROM $tbl_chat_connected WHERE last_connection>'".date('Y-m-d H:i:s',time()-60*5)."' $extra_condition";
$result = Database::query($query);
-$connected_old = intval($_POST['connected_old']);
+$connected_old = isset($_POST['connected_old']) ? intval($_POST['connected_old']) : null;
list($connected_new) = Database::fetch_row($result);
/*disconnected user of chat*/
disconnect_user_of_chat ();
@@ -104,16 +104,17 @@ require 'header_frame.inc.php';
alert('".get_lang('ChatDenied')."'); ";
- $sql = "update $track_user_table set chatcall_user_id = '', chatcall_date = '', chatcall_text='' WHERE (user_id = $talk_to)";
- $result = Database::query($sql);
- }
+if (isset($_SESSION["origin"]) && $_SESSION["origin"] == 'whoisonline') {
+ //check if our target has denied our request or not
+ $talk_to = $_SESSION["target"];
+ $track_user_table = Database::get_main_table(TABLE_MAIN_USER);
+ $sql = "select chatcall_text from $track_user_table where ( user_id = $talk_to )";
+ $result = Database::query($sql);
+ $row = Database::fetch_array($result);
+ if ($row['chatcall_text'] == 'DENIED') {
+ echo "";
+ $sql = "update $track_user_table set chatcall_user_id = '', chatcall_date = '', chatcall_text='' WHERE (user_id = $talk_to)";
+ $result = Database::query($sql);
+ }
}
-require 'footer_frame.inc.php';
\ No newline at end of file
+require 'footer_frame.inc.php';
diff --git a/main/chat/chat_message.php b/main/chat/chat_message.php
index fa3496e21e..5ae67e6889 100644
--- a/main/chat/chat_message.php
+++ b/main/chat/chat_message.php
@@ -250,7 +250,7 @@ if (!empty($course) && !empty($_user['user_id'])) {
echo "".$emoticon_img7."";
echo "".$emoticon_img8."";
echo "".$emoticon_img9."";
- echo "".$emoticon_img10."";
+ //echo "".$emoticon_img10."";
echo "".$emoticon_img11."";
echo "".$emoticon_img12."";
echo "".$emoticon_img13."";
diff --git a/main/chat/header_frame.inc.php b/main/chat/header_frame.inc.php
index abaab50788..42fc07788c 100644
--- a/main/chat/header_frame.inc.php
+++ b/main/chat/header_frame.inc.php
@@ -35,35 +35,29 @@ if (empty($mycourseid)) {
* Choose CSS style (platform's, user's, or course's)
*/
$my_style = api_get_visual_theme();
+$chat_size_old = isset($chat_size_old) ? $chat_size_old : null;
+$chat_size_new = isset($chat_size_new) ? $chat_size_new : null;
+$connected_new = isset($connected_new) ? $connected_new : null;
+$connected_old = isset($connected_old) ? $connected_old : null;
-?>
-
+?>
-
-Chat
-
-
-
-
>