-
Notifications
You must be signed in to change notification settings - Fork 0
/
message.php
54 lines (40 loc) · 1.13 KB
/
message.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
<?php
include("includes/functions.inc");
$chat = false;
if($get_chat_id = Tools::valueGet("chat_id")){
$chat = new Chat($get_chat_id);
if(!$chat->checkUser($user->getID())){
Tools::redirect("index.php");
}
//$messages = $chat->getMessages();
}
elseif($u_id = Tools::valueGet("user")){
$ch_user = new User($u_id);
$insert_id = null;
if($u_id != $user->getID()){
if($user->getChatsID() AND $ch_user->getChatsID()){
if($chat_id = array_intersect($user->getChatsID(), $ch_user->getChatsID())){
$chat_id = current($chat_id);
$chat = new Chat($chat_id);
}else{
$insert_id = App::startChat($user->getID(), $ch_user->getID());
$chat = new Chat($insert_id);
}
}else{
$insert_id = App::startChat($user->getID(), $ch_user->getID());
$chat = new Chat($insert_id);
}
}else{
Tools::redirect("messages.php");
}
}else{
Tools::redirect("messages.php");
}
if( $user->getType() == "parent"){
include("app/parent/message.php");
}elseif( $user->getType() == "teacher"){
include("app/teacher/message.php");
}elseif($user->getType() == "admin"){
include("app/admin/message.php");
}
?>