forked from ILiedAboutCake/OverRustle
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathchat.php
291 lines (256 loc) · 10.9 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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
<?php
require_once 'config.php';
require_once 'session.php';
?>
<link href="/css/chat.min.css" rel="stylesheet" media="screen">
<div id="overrustlechat" class="chat chat-theme-dark chat-icons">
<!-- chat output -->
<div class="chat-output-frame">
<div class="chat-output nano">
<div class="chat-lines overthrow"></div>
</div>
</div>
<!-- end chat output -->
<!-- chat input -->
<?php if (isset($_SESSION['user'])): ?>
<form class="chat-input">
<div class="clearfix">
<div class="chat-input-wrap">
<div class="chat-input-control">
<input type="text" placeholder="Enter a message..." class="input" autocomplete="off" spellcheck="true"/>
</div>
</div>
<div class="chat-tools-wrap">
<a class="iconbtn chat-settings-btn" title="Settings">
<span class="glyphicon glyphicon-cog"></span>
</a>
<a class="iconbtn chat-users-btn" title="Users">
<span class="glyphicon glyphicon-user"></span>
</a>
</div>
</div>
</form>
<?php else: ?>
<form class="chat-input">
<div class="clearfix">
<div class="chat-input-wrap">
<span class="chat-login-msg">
You must sign in to chat
</span>
<input type="hidden" class="input" />
</div>
<div class="chat-tools-wrap">
<a class="iconbtn chat-users-btn" title="Users">
<span class="glyphicon glyphicon-user"></span>
</a>
</div>
</div>
</form>
<?php endif; ?>
<!-- end chat input -->
<!-- top frame -->
<div id="chat-top-frame">
<!-- hints -->
<div class="hint-popup">
<div class="wrap clearfix">
<div class="alert alert-warning">
<a class="hidehint" title="Hide hint"><span class="glyphicon glyphicon-remove"></span></a>
<a class="nexthint" title="Next hint"><span class="glyphicon glyphicon-chevron-right"></span></a>
<strong>Hint:</strong> <span class="hint-message"></span>
</div>
</div>
</div>
<!-- end hints -->
<!-- user tools -->
<div class="user-tools">
<div class="wrap clearfix">
<h5>
<button type="button" class="close" aria-hidden="true">×</button>
<span class="user-tools-user"></span>
</h5>
<div class="tools">
<div class="user-tools-wrap">
<a id="ignoreuser" href="#ignore">
<span class="glyphicon glyphicon-eye-close"></span> Ignore
</a>
<a id="unignoreuser" href="#unignore">
<span class="glyphicon glyphicon-eye-open"></span> Unignore
</a>
<?php if (false): #no mods for now if(Session::hasFeature(UserFeature::MODERATOR) || Session::hasFeature(UserFeature::ADMIN)): ?>
<a href="#togglemute">
<span class="glyphicon glyphicon-ban-circle"></span> Mute
</a>
<a href="#toggleban">
<span class="glyphicon glyphicon-remove"></span> Ban
</a>
<a href="#clearmessages"><span class="glyphicon glyphicon-fire"></span> Clear messages</a>
<?php endif; ?>
</div>
<?php if (false): #no mods for now if(Session::hasFeature(UserFeature::MODERATOR) || Session::hasFeature(UserFeature::ADMIN)): ?>
<!-- mute -->
<form id="user-mute-form">
<div class="form-group">
<select id="banTimeLength" class="select form-control input-sm">
<option value="0">Length of time</option>
<option value="10">10 minutes</option>
<option value="30">30 minutes</option>
<option value="60">1 hr</option>
<option value="720">12 hrs</option>
<option value="1440">24 hrs</option>
</select>
</div>
<div class="form-group">
<button type="submit" class="btn btn-xs btn-primary">Confirm</button>
<button id="cancelmute" type="button" class="btn btn-xs">Cancel</button>
</div>
</form>
<!-- end mute -->
<!-- ban -->
<form id="user-ban-form">
<input type="hidden" name="ipBan" value="" />
<div class="form-group">
<select id="banTimeLength" class="select form-control input-sm" style="width:150px;" onchange="$('#banReason').focus();">
<option value="0">Length of time</option>
<option value="1">1 minute</option>
<option value="5">5 minutes</option>
<option value="10">10 minutes</option>
<option value="30">30 minutes</option>
<option value="60">1 hr</option>
<option value="720">12 hrs</option>
<option value="1440">24 hrs</option>
<option value="perm">Permanent</option>
</select>
</div>
<div class="form-group">
<input type="text" class="input form-control input-sm" id="banReason" placeholder="Reason for ban" />
</div>
<div class="form-group">
<button type="submit" class="btn btn-xs btn-primary">Ban user</button>
<button id="ipbanuser" type="button" class="btn btn-xs btn-danger">IP ban user</button>
<button id="cancelban" type="button" class="btn btn-xs">Cancel</button>
</div>
</form>
<!-- end ban -->
<?php endif; ?>
</div>
</div>
</div>
<!-- end user tools -->
<!-- broadcast -->
<div id="chat-broadcasts">
<!-- template -->
<div class="chat-broadcast alert alert-info hidden template">
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
<p>
<span class="glyphicon glyphicon-exclamation-sign"></span>
<span class="message">This is a broadcast!</span>
</p>
</div>
<!-- template -->
</div>
<!-- end broadcast -->
</div>
<!-- end top frame -->
<!-- bot frame -->
<div id="chat-bottom-frame">
<!-- user list -->
<div id="chat-user-list" class="chat-menu">
<div class="list-wrap clearfix">
<div class="toolbar">
<h5>
Users (~<span></span>)
<button type="button" class="close" aria-hidden="true">×</button>
</h5>
</div>
<div id="chat-groups" class="scrollable nano">
<div class="content">
<h6>Admins</h6>
<ul class="unstyled admins"></ul>
<hr/>
<h6>VIP</h6>
<ul class="unstyled vips"></ul>
<hr/>
<h6>Moderators</h6>
<ul class="unstyled moderators"></ul>
<hr/>
<h6>Subscribers</h6>
<ul class="unstyled subs"></ul>
<hr/>
<h6>Plebs</h6>
<ul class="unstyled plebs"></ul>
<hr/>
<h6>Bots</h6>
<ul class="unstyled bots"></ul>
</div>
</div>
</div>
</div>
<!-- end user list -->
<!-- settings -->
<div id="chat-settings" class="chat-menu">
<div class="list-wrap clearfix">
<div class="toolbar">
<h5>
<span>Settings</span>
<button type="button" class="close" aria-hidden="true">×</button>
</h5>
</div>
<ul class="unstyled">
<li>
<label class="checkbox" title="Show all user flair icons">
<input name="hideflairicons" type="checkbox" /> Hide flair icons
</label>
</li>
<li>
<label class="checkbox" title="Show the timestamps next to the messages">
<input name="showtime" type="checkbox" /> Show time for messages
</label>
</li>
<li>
<label class="checkbox" title="Highlight text that you are mentioned in">
<input name="highlight" type="checkbox" checked="checked"/> Highlight on mention
</label>
</li>
<li>
<label class="text" title="Your custom list of words that will make messages highlight" style="width: 100%;">
Custom highlight words.
<input name="customhighlight" type="text" class="form-control input-sm" placeholder="Separated using a comma (,)" />
</label>
</li>
<li>
<label class="checkbox" title="Show desktop notifications on hightlight">
<input name="notifications" type="checkbox" /> Desktop notification on highlight
</label>
</li>
<li>
<hr style="margin:5px 0;">
See the <a href="/chat/faq" target="_blank">chat FAQ</a> for more information
</li>
</ul>
</div>
</div>
<!-- end settings -->
</div>
<!-- end bot frame -->
</div>
<script src="/js/libs.min.js"></script>
<script src="/js/jquery.validate.min.js"></script>
<script src="/js/destiny.min.js"></script>
<script type="text/javascript">
var backlog = [];
var broadcasts = [];
</script>
<script src="/js/chat.min.js"></script>
<?php
$nick = '';
if (isset($_SESSION['user'])) {
$nick = $_SESSION['user']['name'];
} ?>
<?php if (isset($_GET['user'])): ?>
<script type="text/javascript">
$('#overrustlechat').ChatGui({ "username": "<?php echo $nick ?>" },
{ "host": "<?php echo $config['chat_host'] ?>",
"port": <?php echo $config['chat_port'] ?>,
"room": "<?php echo $_GET['user'] ?>" });
</script>
<?php endif ?>