Minor - format code.

1.9.x
Julio Montoya 11 years ago
parent 9b386d3516
commit 094ad87c8e
  1. 43
      main/inc/ajax/chat.ajax.php

@ -1,5 +1,6 @@
<?php <?php
/* For licensing terms, see /license.txt */ /* For licensing terms, see /license.txt */
/** /**
* Responses to AJAX calls * Responses to AJAX calls
*/ */
@ -11,49 +12,49 @@ require_once '../global.inc.php';
$action = isset($_REQUEST['action']) ? $_REQUEST['action'] : null; $action = isset($_REQUEST['action']) ? $_REQUEST['action'] : null;
if (api_is_anonymous()) { if (api_is_anonymous()) {
exit; exit;
} }
if (api_get_setting('allow_global_chat') == 'false') { if (api_get_setting('allow_global_chat') == 'false') {
exit; exit;
} }
$to_user_id = isset($_REQUEST['to']) ? $_REQUEST['to'] : null; $to_user_id = isset($_REQUEST['to']) ? $_REQUEST['to'] : null;
$message = isset($_REQUEST['message']) ? $_REQUEST['message'] : null; $message = isset($_REQUEST['message']) ? $_REQUEST['message'] : null;
if (!isset($_SESSION['chatHistory'])) { if (!isset($_SESSION['chatHistory'])) {
$_SESSION['chatHistory'] = array(); $_SESSION['chatHistory'] = array();
} }
if (!isset($_SESSION['openChatBoxes'])) { if (!isset($_SESSION['openChatBoxes'])) {
$_SESSION['openChatBoxes'] = array(); $_SESSION['openChatBoxes'] = array();
} }
$chat = new Chat(); $chat = new Chat();
if ($chat->is_chat_blocked_by_exercises()) { if ($chat->is_chat_blocked_by_exercises()) {
//Desconnecting the user //Disconnecting the user
$chat->set_user_status(0); $chat->set_user_status(0);
exit; exit;
} }
switch ($action) { switch ($action) {
case 'chatheartbeat': case 'chatheartbeat':
$chat->heartbeat(); $chat->heartbeat();
break; break;
case 'closechat': case 'closechat':
$chat->close(); $chat->close();
break; break;
case 'sendchat': case 'sendchat':
$chat->send(api_get_user_id(), $to_user_id, $message); $chat->send(api_get_user_id(), $to_user_id, $message);
break; break;
case 'startchatsession': case 'startchatsession':
$chat->start_session(); $chat->start_session();
break; break;
case 'set_status': case 'set_status':
$status = isset($_REQUEST['status']) ? intval($_REQUEST['status']) : 0; $status = isset($_REQUEST['status']) ? intval($_REQUEST['status']) : 0;
$chat->set_user_status($status); $chat->set_user_status($status);
break; break;
default: default:
echo ''; echo '';
} }
exit; exit;

Loading…
Cancel
Save