-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathchat.php
108 lines (89 loc) · 3.33 KB
/
chat.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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
<?php
require("includes.php");
$database = new Database($config);
$db = $database->getConnection();
$smarty->assign('fullurl', $config->getFullUrl());
$smarty->assign('logo', $config->getLogo());
$mobile_browser = '0';
if (preg_match('/(up.browser|up.link|mmp|symbian|smartphone|midp|wap|phone|android)/i', strtolower($_SERVER['HTTP_USER_AGENT']))) {
$mobile_browser++;
}
if ((strpos(strtolower($_SERVER['HTTP_ACCEPT']),'application/vnd.wap.xhtml+xml') > 0) or ((isset($_SERVER['HTTP_X_WAP_PROFILE']) or isset($_SERVER['HTTP_PROFILE'])))) {
$mobile_browser++;
}
$mobile_ua = strtolower(substr($_SERVER['HTTP_USER_AGENT'], 0, 4));
$mobile_agents = array(
'w3c ','acs-','alav','alca','amoi','audi','avan','benq','bird','blac',
'blaz','brew','cell','cldc','cmd-','dang','doco','eric','hipt','inno',
'ipaq','java','jigs','kddi','keji','leno','lg-c','lg-d','lg-g','lge-',
'maui','maxo','midp','mits','mmef','mobi','mot-','moto','mwbp','nec-',
'newt','noki','oper','palm','pana','pant','phil','play','port','prox',
'qwap','sage','sams','sany','sch-','sec-','send','seri','sgh-','shar',
'sie-','siem','smal','smar','sony','sph-','symb','t-mo','teli','tim-',
'tosh','tsm-','upg1','upsi','vk-v','voda','wap-','wapa','wapi','wapp',
'wapr','webc','winw','winw','xda ','xda-');
if (in_array($mobile_ua,$mobile_agents)) {
$mobile_browser++;
}
if (strpos(strtolower($_SERVER['ALL_HTTP']),'OperaMini') > 0) {
$mobile_browser++;
}
if (strpos(strtolower($_SERVER['HTTP_USER_AGENT']),'windows') > 0) {
$mobile_browser = 0;
}
if ($mobile_browser > 0) {
if (isset($_GET['id'])) {
$id = $_GET['id'];
$chat = new Chatbox($db);
if ($chat->getById($id)) {
$chat->setCall();
//$chat->printConfig();
$metadata = $chat->getMetaData();
if (($metadata['radio'] != "true") && ($metadata['ads_enabled'] == "true"))
header('Location: https://chameleon.chattersworld.nl/chat2.php?'.$_SERVER['QUERY_STRING']);
$smarty->assign('metadata',$metadata);
$smarty->display('kiwi-conf.tpl');
$smarty->display('kiwi.tpl');
if ($metadata['radio'] == "true") {
if ($metadata['radio_player'] == "internal") {
$smarty->display('chat_ads.tpl');
}else{
$smarty->display('chat_radio.tpl');
}
}
$smarty->display('chat_end.tpl');
}
else {
$smarty->display('chat_does_not_exist.tpl');
}
}
else {
$smarty->display('chat_does_not_exist.tpl');
}
}
else {
if (isset($_GET['id'])) {
$id = $_GET['id'];
$chat = new Chatbox($db);
if ($chat->getById($id)) {
$chat->setCall();
$chat->printConfig();
$metadata = $chat->getMetaData();
if (($metadata['radio'] != "true") && ($metadata['ads_enabled'] == "true"))
header('Location: https://chameleon.chattersworld.nl/chat2.php?'.$_SERVER['QUERY_STRING']);
$smarty->assign('metadata',$metadata);
$smarty->display('chat.tpl');
if ($metadata['radio'] == "true") {
$smarty->display('chat_radio.tpl');
}
$smarty->display('chat_end.tpl');
}
else {
$smarty->display('chat_does_not_exist.tpl');
}
}
else {
$smarty->display('chat_does_not_exist.tpl');
}
}
?>