SHOW:
|
|
- or go back to the newest paste.
| 1 | <?php | |
| 2 | /** | |
| 3 | * Codychat | |
| 4 | * | |
| 5 | * @package Codychat | |
| 6 | * @author www.boomcoding.com | |
| 7 | * @copyright 2017 | |
| 8 | * @terms any use of this script without a legal license is prohibited | |
| 9 | * all the content of Codychat is the propriety of BoomCoding and Cannot be | |
| 10 | * used for another project. | |
| 11 | */ | |
| 12 | function getIp(){
| |
| 13 | $client = @$_SERVER['HTTP_CLIENT_IP']; | |
| 14 | $forward = @$_SERVER['HTTP_X_FORWARDED_FOR']; | |
| 15 | $cloud = @$_SERVER["HTTP_CF_CONNECTING_IP"]; | |
| 16 | $remote = $_SERVER['REMOTE_ADDR']; | |
| 17 | if(filter_var($cloud, FILTER_VALIDATE_IP)) {
| |
| 18 | $ip = $cloud; | |
| 19 | } | |
| 20 | else if(filter_var($client, FILTER_VALIDATE_IP)) {
| |
| 21 | $ip = $client; | |
| 22 | } | |
| 23 | elseif(filter_var($forward, FILTER_VALIDATE_IP)){
| |
| 24 | $ip = $forward; | |
| 25 | } | |
| 26 | else{
| |
| 27 | $ip = $remote; | |
| 28 | } | |
| 29 | return escape($ip); | |
| 30 | } | |
| 31 | function boomTemplate($getpage, $boom = '') {
| |
| 32 | global $data, $lang, $mysqli, $boom_config; | |
| 33 | $page = __DIR__ . '/' . $getpage . '.php'; | |
| 34 | $structure = ''; | |
| 35 | ob_start(); | |
| 36 | require($page); | |
| 37 | $structure = ob_get_contents(); | |
| 38 | ob_end_clean(); | |
| 39 | return $structure; | |
| 40 | } | |
| 41 | function calHour($h){
| |
| 42 | return time() - ($h * 3600); | |
| 43 | } | |
| 44 | function calWeek($w){
| |
| 45 | return time() - ( 3600 * 24 * 7 * $w); | |
| 46 | } | |
| 47 | function calmonth($m){
| |
| 48 | return time() - ( 3600 * 24 * 30 * $m); | |
| 49 | } | |
| 50 | function calDay($d){
| |
| 51 | return time() - ($d * 86400); | |
| 52 | } | |
| 53 | function calMinutes($min){
| |
| 54 | return time() - ($min * 60); | |
| 55 | } | |
| 56 | function calHourUp($h){
| |
| 57 | return time() + ($h * 3600); | |
| 58 | } | |
| 59 | function calWeekUp($w){
| |
| 60 | return time() + ( 3600 * 24 * 7 * $w); | |
| 61 | } | |
| 62 | function calmonthUp($m){
| |
| 63 | return time() + ( 3600 * 24 * 30 * $m); | |
| 64 | } | |
| 65 | function calDayUp($d){
| |
| 66 | return time() + ($d * 86400); | |
| 67 | } | |
| 68 | function calMinutesUp($min){
| |
| 69 | return time() + ($min * 60); | |
| 70 | } | |
| 71 | function myavatar($a){
| |
| 72 | global $data; | |
| 73 | $path = '/avatar/'; | |
| 74 | if(stripos($a, 'default') !== false){
| |
| 75 | $path = '/default_images/'; | |
| 76 | } | |
| 77 | if(linkAvatar($a)){
| |
| 78 | return $a; | |
| 79 | } | |
| 80 | else {
| |
| 81 | return $data['domain'] . $path . $a; | |
| 82 | } | |
| 83 | } | |
| 84 | function profileAvatar($a){
| |
| 85 | global $data; | |
| 86 | $path = '/avatar/'; | |
| 87 | if(stripos($a, 'default') !== false){
| |
| 88 | $path = '/default_images/'; | |
| 89 | } | |
| 90 | if(linkAvatar($a)){
| |
| 91 | return 'href="' . $a . '" src="'. $a . '"'; | |
| 92 | } | |
| 93 | else{
| |
| 94 | return 'href="' . $data['domain'] . $path . $a . '" src="' . $data['domain'] . $path . $a . '"'; | |
| 95 | } | |
| 96 | } | |
| 97 | function linkAvatar($a){
| |
| 98 | if(preg_match('@^https?://@i', $a)){
| |
| 99 | return true; | |
| 100 | } | |
| 101 | } | |
| 102 | function escape($t){
| |
| 103 | global $mysqli; | |
| 104 | return $mysqli->real_escape_string(trim(htmlspecialchars($t, ENT_QUOTES))); | |
| 105 | } | |
| 106 | function boomSanitize($t){
| |
| 107 | global $mysqli; | |
| 108 | $t = str_replace(array('\\', '/', '.', '<', '>', '%', '#'), '', $t);
| |
| 109 | return $mysqli->real_escape_string(trim(htmlspecialchars($t, ENT_QUOTES))); | |
| 110 | } | |
| 111 | function softEscape($t){
| |
| 112 | global $mysqli; | |
| 113 | $atags = '<a><p><h1><h2><h3><h4><img><b><strong><br><ul><li><div><i><span><u><th><td><tr><table><strike><small><ol><hr><font><center><blink><marquee>'; | |
| 114 | $t = strip_tags($t, $atags); | |
| 115 | return $mysqli->real_escape_string(trim($t)); | |
| 116 | } | |
| 117 | function systemReplace($text){
| |
| 118 | global $lang; | |
| 119 | $text = str_replace('%bcquit%', $lang['leave_message'], $text);
| |
| 120 | $text = str_replace('%bcjoin%', $lang['join_message'], $text);
| |
| 121 | $text = str_replace('%bcclear%', $lang['clear_message'], $text);
| |
| 122 | $text = str_replace('%spam%', $lang['spam_content'], $text);
| |
| 123 | return $text; | |
| 124 | } | |
| 125 | function systemSpecial($content, $type, $delete = 1){
| |
| 126 | global $data; | |
| 127 | $system = userDetails($data['system_id']); | |
| 128 | $template = array( | |
| 129 | 'content'=> $content, | |
| 130 | 'type'=> $type, | |
| 131 | 'delete'=> $delete, | |
| 132 | 'name'=> $system['user_name'], | |
| 133 | 'avatar'=> $system['user_tumb'], | |
| 134 | ); | |
| 135 | return boomTemplate('element/system_log', $template);
| |
| 136 | } | |
| 137 | function userDetails($id){
| |
| 138 | global $mysqli; | |
| 139 | $user = array(); | |
| 140 | $getuser = $mysqli->query("SELECT * FROM boom_users WHERE user_id = '$id'");
| |
| 141 | if($getuser->num_rows > 0){
| |
| 142 | $user = $getuser->fetch_assoc(); | |
| 143 | } | |
| 144 | return $user; | |
| 145 | } | |
| 146 | function ownAvatar($i){
| |
| 147 | global $data; | |
| 148 | if($i == $data['user_id']){
| |
| 149 | return 'glob_av'; | |
| 150 | } | |
| 151 | return ''; | |
| 152 | } | |
| 153 | function systemSay($room, $message, $type = 'system'){
| |
| 154 | global $mysqli, $lang, $data; | |
| 155 | $dsystem = array( | |
| 156 | 'color'=> 'chat_system', | |
| 157 | 'type'=> $type, | |
| 158 | 'bot'=> 1, | |
| 159 | ); | |
| 160 | postChat($data['system_id'], $room, $message, $dsystem); | |
| 161 | } | |
| 162 | function postChat($from, $room, $content, $pdat = array()){
| |
| 163 | global $mysqli; | |
| 164 | $lact = calMinutes(5); | |
| 165 | $def = array( | |
| 166 | 'color'=> '', | |
| 167 | 'snum'=> '', | |
| 168 | 'type'=> 'public', | |
| 169 | 'bot'=> '0', | |
| 170 | ); | |
| 171 | $d = array_merge($def, $pdat); | |
| 172 | $mysqli->query("INSERT INTO `boom_chat` (post_date, user_id, post_message, post_roomid, type, snum, post_bot, tcolor) VALUES ('" . time() . "', '$from', '$content', '$room', '{$d['type']}', '{$d['snum']}', '{$d['bot']}', '{$d['color']}')");
| |
| 173 | $mysqli->query("UPDATE boom_users SET caction = caction + 1 WHERE user_roomid = '$room' and last_action > '$lact'");
| |
| 174 | return true; | |
| 175 | } | |
| 176 | function postPrivate($from, $to, $content, $d = array()){
| |
| 177 | global $mysqli; | |
| 178 | $mysqli->query("INSERT INTO `boom_private` (time, target, hunter, message) VALUES ('" . time() . "', '$to', '$from', '$content')");
| |
| 179 | if($to != $from){
| |
| 180 | $mysqli->query("UPDATE boom_users SET pcount = pcount + 1 WHERE user_id = '$to'");
| |
| 181 | } | |
| 182 | } | |
| 183 | function systemNotify($user, $type, $custom, $custom2 = ''){
| |
| 184 | global $mysqli, $data; | |
| 185 | $mysqli->query("INSERT INTO boom_notification ( notifier, notified, notify_type, notify_date, notify_source, notify_custom, notify_custom2) VALUE ('{$data['system_id']}', '$user', '$type', '" . time() . "', 'system', '$custom', '$custom2')");
| |
| 186 | updateNotify($user); | |
| 187 | } | |
| 188 | function updateNotify($id){
| |
| 189 | global $mysqli; | |
| 190 | $mysqli->query("UPDATE boom_users SET naction = naction + 1 WHERE user_id = '$id'");
| |
| 191 | } | |
| 192 | function updateDualNotify($id1, $id2){
| |
| 193 | global $mysqli; | |
| 194 | $mysqli->query("UPDATE boom_users SET naction = naction + 1 WHERE user_id = '$id1' OR user_id = '$id2'");
| |
| 195 | } | |
| 196 | function updateGroupNotify($list){
| |
| 197 | global $mysqli; | |
| 198 | if(empty($list)){
| |
| 199 | return false; | |
| 200 | } | |
| 201 | $list = implode(", ", $list);
| |
| 202 | $mysqli->query("UPDATE boom_users SET naction = naction + 1 WHERE user_id IN ($list)");
| |
| 203 | } | |
| 204 | function updateFriendsNotify($id){
| |
| 205 | global $mysqli, $data; | |
| 206 | $list = listFriends($id); | |
| 207 | if(empty($list)){
| |
| 208 | return false; | |
| 209 | } | |
| 210 | $list = implode(", ", $list);
| |
| 211 | $mysqli->query("UPDATE boom_users SET naction = naction + 1 WHERE user_id IN ($list)");
| |
| 212 | } | |
| 213 | function updateStaffNotify(){
| |
| 214 | global $mysqli; | |
| 215 | $mysqli->query("UPDATE boom_users SET naction = naction + 1 WHERE user_rank > 7");
| |
| 216 | } | |
| 217 | function updateAllNotify(){
| |
| 218 | global $mysqli; | |
| 219 | $delay = calMinutes(5); | |
| 220 | $mysqli->query("UPDATE boom_users SET naction = naction + 1 WHERE user_id > 0 AND last_action > '$delay'");
| |
| 221 | } | |
| 222 | function isIgnored($id){
| |
| 223 | global $boom_config; | |
| 224 | if(strpos($_SESSION[$boom_config['prefix'] . 'ignore'], 'u' . $id . 'x') !== false){
| |
| 225 | return true; | |
| 226 | } | |
| 227 | } | |
| 228 | function createLog($data, $post, $type = 0){
| |
| 229 | global $lang; | |
| 230 | $add_clear = ''; | |
| 231 | $add_av = ''; | |
| 232 | if(isIgnored($post['user_id'])){
| |
| 233 | return false; | |
| 234 | } | |
| 235 | $message = uprocess($data['user_name'], strtolower($data['user_name']),$post['post_message'], $post['user_id']); | |
| 236 | $message = mb_convert_encoding(systemReplace($message), 'UTF-8', 'auto'); | |
| 237 | if(boomAllow(1)){
| |
| 238 | if(boomAllow(8) || boomRole(4) ){
| |
| 239 | $add_clear = '<span class="delete_log" value="' . $post['post_id'] . '"><i class="fa fa-times"></i></span>'; | |
| 240 | } | |
| 241 | else {
| |
| 242 | if($post['post_bot'] < 1){
| |
| 243 | $add_clear = '<span class="report report_log" onclick="openReport(' . $post['post_id'] . ', 1)"><i class="fa fa-flag"></i></span>';
| |
| 244 | } | |
| 245 | } | |
| 246 | } | |
| 247 | $iconrank = ''; | |
| 248 | if($post['user_rank'] > 1){
| |
| 249 | $iconrank = ' ' . rankIcon($post, 2); | |
| 250 | } | |
| 251 | if(notMe($post['user_id'])){
| |
| 252 | $add_av = 'onclick="openAvMenu(this, \'' . $post['user_name'] . '\', \'' . $post['user_id'] . '\');"'; | |
| 253 | } | |
| 254 | return '<li id="log' . $post['post_id'] . '" data="' . $post['post_id'] . '" class="ch_logs ' . $post['type'] . '"> | |
| 255 | <div class="my_avatar chat_avatar_wrap" ' . $add_av . '> | |
| 256 | <img class="avsex ' . sex($post['user_sex']) . ' avatar_userlist ' . ownAvatar($post['user_id']) . '" src="' . myavatar($post['user_tumb']) . '"/> | |
| 257 | </div> | |
| 258 | ||
| 259 | <div class="my_text"> | |
| 260 | ||
| 261 | <p><span class="adminss_icon">' . $iconrank . '</span> <span class="username ' . $post['user_color'] . '">' . $post['user_name'] . '</span></p> | |
| 262 | <div class="chat_message ' . $post['tcolor'] . '">' . $message . '</div> | |
| 263 | <span class="logs_date">' . displayDate($post['post_date']) . $add_clear . '</span> | |
| 264 | </div> | |
| 265 | </li>'; | |
| 266 | } | |
| 267 | function privateLog($post, $type){
| |
| 268 | $message = systemReplace($post['message']); | |
| 269 | switch($type){
| |
| 270 | case 1: | |
| 271 | return '<li id="priv' . $post['id'] . '"> | |
| 272 | <div class="private_logs"> | |
| 273 | <div class="private_avatar"> | |
| 274 | <img data="' . $post['user_id'] . '" class="get_info avatar_private" src="' . myavatar($post['user_tumb']) . '"/> | |
| 275 | </div> | |
| 276 | <div class="private_content"> | |
| 277 | <div class="hunter_private">' . $message . '</div> | |
| 278 | <p class="pdate">' . displayDate($post['time']) . '</p> | |
| 279 | </div> | |
| 280 | </div> | |
| 281 | </li>'; | |
| 282 | case 2: | |
| 283 | return '<li id="priv' . $post['id'] . '"> | |
| 284 | <div class="private_logs"> | |
| 285 | <div class="private_content"> | |
| 286 | <div class="target_private">' . $message . '</div> | |
| 287 | <p class="ptdate">' . displayDate($post['time']) . '</p> | |
| 288 | </div> | |
| 289 | <div class="private_avatar"> | |
| 290 | <img data="' . $post['user_id'] . '" class="get_info avatar_private" src="' . myavatar($post['user_tumb']) . '"/> | |
| 291 | </div> | |
| 292 | </div> | |
| 293 | </li>'; | |
| 294 | } | |
| 295 | } | |
| 296 | function displayDate($date){
| |
| 297 | return date("j/m G:i", $date);
| |
| 298 | } | |
| 299 | function longDate($date){
| |
| 300 | return date("Y-m-d ", $date);
| |
| 301 | } | |
| 302 | function uprocess($me, $me2, $string, $sender) {
| |
| 303 | if($sender != $me){
| |
| 304 | if (preg_match('/http/',$string)){
| |
| 305 | $string = $string; | |
| 306 | } | |
| 307 | else {
| |
| 308 | $string = str_replace(array($me, $me2), '<span class="my_notice">' . $me . '</span>', $string); | |
| 309 | } | |
| 310 | } | |
| 311 | return $string; | |
| 312 | } | |
| 313 | function boomAllow($rank){
| |
| 314 | global $data; | |
| 315 | if($data['user_rank'] >= $rank){
| |
| 316 | return true; | |
| 317 | } | |
| 318 | } | |
| 319 | function boomRole($role){
| |
| 320 | global $data; | |
| 321 | if($data['user_role'] >= $role){
| |
| 322 | return true; | |
| 323 | } | |
| 324 | } | |
| 325 | function isGreater($rank){
| |
| 326 | global $data; | |
| 327 | if($data['user_rank'] > $rank){
| |
| 328 | return true; | |
| 329 | } | |
| 330 | } | |
| 331 | function notMe($id){
| |
| 332 | global $data; | |
| 333 | if($id != $data['user_id']){
| |
| 334 | return true; | |
| 335 | } | |
| 336 | } | |
| 337 | function isBot($user){
| |
| 338 | if($user > 0){
| |
| 339 | return true; | |
| 340 | } | |
| 341 | } | |
| 342 | function systemBot($user){
| |
| 343 | if($user == 9){
| |
| 344 | return true; | |
| 345 | } | |
| 346 | } | |
| 347 | function getTopic(){
| |
| 348 | global $mysqli, $lang, $data; | |
| 349 | $room_topic = ''; | |
| 350 | $get_topic = $mysqli->query("SELECT topic FROM boom_rooms WHERE room_id = '{$data['user_roomid']}'");
| |
| 351 | if($get_topic->num_rows > 0){
| |
| 352 | $topic = $get_topic->fetch_assoc(); | |
| 353 | if ($topic['topic'] != ''){
| |
| 354 | $room_topic = $topic['topic']; | |
| 355 | } | |
| 356 | } | |
| 357 | return $room_topic; | |
| 358 | } | |
| 359 | function muted(){
| |
| 360 | global $data; | |
| 361 | if($data['user_mute'] > 0 || $data['user_word_mute'] > 0 || $data['ureg_mute'] > 0){
| |
| 362 | return true; | |
| 363 | } | |
| 364 | } | |
| 365 | function roomMuted(){
| |
| 366 | global $data; | |
| 367 | if($data['room_mute'] > 0){
| |
| 368 | return true; | |
| 369 | } | |
| 370 | } | |
| 371 | function joinRoom(){
| |
| 372 | global $lang, $data; | |
| 373 | if(allowLogs() && isVisible()){
| |
| 374 | systemSay($data['user_roomid'], str_replace('%user%', $data['user_name'], $lang['system_join_room']));
| |
| 375 | } | |
| 376 | } | |
| 377 | function processUserData($t){
| |
| 378 | global $data; | |
| 379 | return str_replace(array('%user%'), array($data['user_name']), $t);
| |
| 380 | } | |
| 381 | function leaveRoom(){
| |
| 382 | global $data, $lang; | |
| 383 | if(allowLogs()){
| |
| 384 | if(isVisible() && $data['user_roomid'] != 0 && $data['last_action'] > time() - 30 ){
| |
| 385 | systemSay($data['user_roomid'], str_replace('%user%', $data['user_name'], $lang['quit_room']));
| |
| 386 | } | |
| 387 | } | |
| 388 | } | |
| 389 | function allowLogs(){
| |
| 390 | global $data; | |
| 391 | if($data['allow_logs'] == 1){
| |
| 392 | return true; | |
| 393 | } | |
| 394 | } | |
| 395 | function isVisible(){
| |
| 396 | global $data; | |
| 397 | if($data['user_status'] != 6){
| |
| 398 | return true; | |
| 399 | } | |
| 400 | } | |
| 401 | function isGuest($rank){
| |
| 402 | if($rank == 0){
| |
| 403 | return true; | |
| 404 | } | |
| 405 | } | |
| 406 | function userVisible($s){
| |
| 407 | if($s != 6){
| |
| 408 | return true; | |
| 409 | } | |
| 410 | } | |
| 411 | function boomRecaptcha(){
| |
| 412 | global $data; | |
| 413 | if($data['use_recapt'] > 0){
| |
| 414 | return true; | |
| 415 | } | |
| 416 | } | |
| 417 | function encrypt($d){
| |
| 418 | global $encryption; | |
| 419 | return sha1(str_rot13($d . $encryption)); | |
| 420 | } | |
| 421 | function installEncrypt($d, $encr){
| |
| 422 | return sha1(str_rot13($d . $encr)); | |
| 423 | } | |
| 424 | function getDelay(){
| |
| 425 | return time() - 35; | |
| 426 | } | |
| 427 | function getMinutes($t){
| |
| 428 | return $t / 60; | |
| 429 | } | |
| 430 | function isOwner(){
| |
| 431 | global $data; | |
| 432 | if($data['owner'] == 1 && boomAllow(10)){
| |
| 433 | return true; | |
| 434 | } | |
| 435 | } | |
| 436 | function userOwner($user){
| |
| 437 | if($user['owner'] == 1 || $user['user_rank'] == 10){
| |
| 438 | return true; | |
| 439 | } | |
| 440 | } | |
| 441 | function fullOwner($user){
| |
| 442 | if($user['owner'] == 1){
| |
| 443 | return true; | |
| 444 | } | |
| 445 | } | |
| 446 | function isStaff($rank){
| |
| 447 | if($rank > 7){
| |
| 448 | return true; | |
| 449 | } | |
| 450 | } | |
| 451 | function genKey(){
| |
| 452 | return md5(rand(10000,99999) . rand(10000,99999)); | |
| 453 | } | |
| 454 | function genCode(){
| |
| 455 | return rand(111111,999999); | |
| 456 | } | |
| 457 | function genSnum(){
| |
| 458 | global $data; | |
| 459 | return $data['user_id'] . rand(1111111, 9999999); | |
| 460 | } | |
| 461 | function canUpload(){
| |
| 462 | global $data; | |
| 463 | if(boomAllow($data['allow_image'])){
| |
| 464 | return true; | |
| 465 | } | |
| 466 | } | |
| 467 | function canPrivate(){
| |
| 468 | global $data; | |
| 469 | if(boomAllow($data['allow_private'])){
| |
| 470 | return true; | |
| 471 | } | |
| 472 | } | |
| 473 | function allowRoom(){
| |
| 474 | global $data; | |
| 475 | if(boomAllow($data['allow_room'])){
| |
| 476 | return true; | |
| 477 | } | |
| 478 | } | |
| 479 | function emoPlus(){
| |
| 480 | global $data; | |
| 481 | if(boomAllow($data['emo_plus'])){
| |
| 482 | return true; | |
| 483 | } | |
| 484 | } | |
| 485 | function allowGuest(){
| |
| 486 | global $data; | |
| 487 | if($data['allow_guest'] == 1){
| |
| 488 | return true; | |
| 489 | } | |
| 490 | } | |
| 491 | function canDirect(){
| |
| 492 | global $data; | |
| 493 | if(boomAllow($data['allow_direct'])){
| |
| 494 | return true; | |
| 495 | } | |
| 496 | } | |
| 497 | function canColor(){
| |
| 498 | global $data; | |
| 499 | if(boomAllow($data['allow_color'])){
| |
| 500 | return true; | |
| 501 | } | |
| 502 | } | |
| 503 | function roomName(){
| |
| 504 | global $mysqli, $data; | |
| 505 | $groom = $mysqli->query("SELECT room_name FROM boom_rooms WHERE room_id = '{$data['user_roomid']}'");
| |
| 506 | $r = $groom->fetch_assoc(); | |
| 507 | return $r['room_name']; | |
| 508 | } | |
| 509 | function wordUnmute($d){
| |
| 510 | global $data, $mysqli; | |
| 511 | $unmute = calMinutes($data['word_delay']); | |
| 512 | if($d['user_word_mute'] <= $unmute){
| |
| 513 | $mysqli->query("UPDATE boom_users SET user_word_mute = 0 WHERE user_id = '{$d['user_id']}'");
| |
| 514 | clearMuteNotify($d['user_id']); | |
| 515 | systemNotify($d['user_id'], 'system_unmute', ''); | |
| 516 | } | |
| 517 | } | |
| 518 | function regUnmute($d){
| |
| 519 | global $data, $mysqli; | |
| 520 | $unmute = calMinutes($data['reg_mute']); | |
| 521 | if($d['ureg_mute'] <= $unmute){
| |
| 522 | $mysqli->query("UPDATE boom_users SET ureg_mute = 0 WHERE user_id = '{$d['user_id']}'");
| |
| 523 | clearMuteNotify($d['user_id']); | |
| 524 | systemNotify($d['user_id'], 'system_unmute', ''); | |
| 525 | } | |
| 526 | } | |
| 527 | function boomMerge($a, $b){
| |
| 528 | $c = $a . '_' . $b; | |
| 529 | return trim($c); | |
| 530 | } | |
| 531 | function clearMuteNotify($id){
| |
| 532 | global $mysqli; | |
| 533 | usleep(100000); | |
| 534 | $mysqli->query("DELETE FROM boom_notification WHERE notified = '$id' AND notify_type IN ('bad_word', 'system_mute', 'system_unmute', 'flood_abuse')");
| |
| 535 | usleep(100000); | |
| 536 | } | |
| 537 | function setToken(){
| |
| 538 | global $boom_config; | |
| 539 | if(!empty($_SESSION[$boom_config['prefix'] . 'token'])){
| |
| 540 | $_SESSION[$boom_config['prefix'] . 'token'] = $_SESSION[$boom_config['prefix'] . 'token']; | |
| 541 | return $_SESSION[$boom_config['prefix'] . 'token']; | |
| 542 | } | |
| 543 | else {
| |
| 544 | $session = md5(rand(000000,999999)); | |
| 545 | $_SESSION[$boom_config['prefix'] . 'token'] = $session; | |
| 546 | return $session; | |
| 547 | } | |
| 548 | } | |
| 549 | function checkToken() {
| |
| 550 | global $boom_config; | |
| 551 | if (!isset($_POST['token']) || !isset($_SESSION[$boom_config['prefix'] . 'token']) || empty($_SESSION[$boom_config['prefix'] . 'token'])) {
| |
| 552 | return false; | |
| 553 | } | |
| 554 | if($_POST['token'] == $_SESSION[$boom_config['prefix'] . 'token']){
| |
| 555 | return true; | |
| 556 | } | |
| 557 | return false; | |
| 558 | } | |
| 559 | function userState($state){
| |
| 560 | if(!empty($state)){
| |
| 561 | return '<p class="bustate bellips">' . $state . '</p>'; | |
| 562 | } | |
| 563 | } | |
| 564 | ||
| 565 | // ranking functions | |
| 566 | ||
| 567 | function lmIcon($t, $class = ''){
| |
| 568 | if($t != ''){
| |
| 569 | return '<div class="user_lm_icon ' . $class . '">' . $t . '</div>'; | |
| 570 | } | |
| 571 | else {
| |
| 572 | return ''; | |
| 573 | } | |
| 574 | } | |
| 575 | function isMuted($user){
| |
| 576 | global $lang; | |
| 577 | if($user['user_mute'] > 0 || $user['user_word_mute'] > 0){
| |
| 578 | return '<i title="' . $lang['muted'] . '" class="fa fa-hand-paper-o is_muted"></i>'; | |
| 579 | } | |
| 580 | else if($user['room_mute'] == 1){
| |
| 581 | return '<i title="' . $lang['muted'] . '" class="fa fa-hand-paper-o is_room_muted"></i>'; | |
| 582 | } | |
| 583 | else if($user['ureg_mute'] > 0){
| |
| 584 | return '<i title="' . $lang['muted'] . '" class="fa fa-plus-circle theme_color"></i>'; | |
| 585 | } | |
| 586 | else {
| |
| 587 | return ''; | |
| 588 | } | |
| 589 | } | |
| 590 | function getGender($s){
| |
| 591 | global $lang; | |
| 592 | switch($s){
| |
| 593 | case 1: | |
| 594 | return $lang['male']; | |
| 595 | case 2: | |
| 596 | return $lang['female']; | |
| 597 | default: | |
| 598 | return $lang['not_set']; | |
| 599 | } | |
| 600 | } | |
| 601 | function sex($s){
| |
| 602 | global $lang; | |
| 603 | switch($s){
| |
| 604 | case 1: | |
| 605 | return 'boy'; | |
| 606 | case 2: | |
| 607 | return 'girl'; | |
| 608 | default: | |
| 609 | return 'nosex'; | |
| 610 | } | |
| 611 | } | |
| 612 | function getStatus($status){
| |
| 613 | global $lang; | |
| 614 | switch($status){
| |
| 615 | case 2: | |
| 616 | return curStatus($lang['away'], 'clock-o', 'absent'); | |
| 617 | case 3: | |
| 618 | return curStatus($lang['busy'], 'minus-circle', 'gone'); | |
| 619 | case 4: | |
| 620 | return curStatus($lang['gaming'], 'gamepad', 'gaming'); | |
| 621 | case 5: | |
| 622 | return curStatus($lang['eating'], 'cutlery', 'eating'); | |
| 623 | case 7: | |
| 624 | return curStatus($lang['drankje'], 'glass', 'fa glass fa-glass'); | |
| 625 | case 8: | |
| 626 | return curStatus($lang['Diamant'], 'diamond fa-spin', 'fa dijamant diamond fa-spin'); | |
| 627 | case 9: | |
| 628 | return curStatus($lang['Bliksem'], 'fa-bolt', 'fa munja fa-bolt'); | |
| 629 | case 10: | |
| 630 | return curStatus($lang['Smiley'], 'fa-smile-o', 'fa sretno-o fa-smile-o'); | |
| 631 | case 11: | |
| 632 | return curStatus($lang['coffee'], 'fa-coffee', 'fa kavica fa-coffee'); | |
| 633 | case 12: | |
| 634 | return curStatus($lang['Beer'], 'fa-beer', 'fa beer_time fa-beer'); | |
| 635 | case 13: | |
| 636 | return curStatus($lang['Bed'], 'fa-bed', 'fa krevet fa-bed'); | |
| 637 | case 14: | |
| 638 | return curStatus($lang['Hashtag'], 'fa-hashtag', 'fa hashtag fa-hashtag'); | |
| 639 | case 16: | |
| 640 | return curStatus($lang['battery'], 'fa-battery-full', 'fa battery fa-battery-full'); | |
| 641 | case 17: | |
| 642 | return curStatus($lang['battery_empty'], 'fa-battery-empty', 'fa battery_empty fa-battery-empty'); | |
| 643 | case 18: | |
| 644 | return curStatus($lang['thermometer-full'], 'fa-thermometer-full', 'fa thermometer-full fa-thermometer-full'); | |
| 645 | case 19: | |
| 646 | return curStatus($lang['sad'], 'fa-frown-o', 'fa frown-o fa-frown-o'); | |
| 647 | case 20: | |
| 648 | return curStatus($lang['bug'], 'fa-bug', 'fa bug fa-bug'); | |
| 649 | case 21: | |
| 650 | return curStatus($lang['blij'], 'fa-smile-o', 'fa smile fa-smile-o'); | |
| 651 | case 15: | |
| 652 | return curStatus($lang['music'], 'fa-music', 'fa glazba fa-music'); | |
| 653 | case 22: | |
| 654 | return curStatus($lang['love'], 'fa-heart', 'fa heart fa-heart faa-pulse animated'); | |
| 655 | default: | |
| 656 | return ''; | |
| 657 | } | |
| 658 | } | |
| 659 | function curStatus($txt, $icon, $color){
| |
| 660 | return '<i title="' . $txt . '" class="fa ' . $color . ' fa-' . $icon . '"></i>'; | |
| 661 | } | |
| 662 | function listStatus($status, $id = ''){
| |
| 663 | global $lang; | |
| 664 | if($id == 1){
| |
| 665 | return statusMenu($lang['online'], 'check-circle', 'userid1'); | |
| 666 | } | |
| 667 | switch($status){
| |
| 668 | case 1: | |
| 669 | return statusMenu($lang['online'], 'check-circle', 'online'); | |
| 670 | case 2: | |
| 671 | return statusMenu($lang['away'], 'clock-o', 'absent'); | |
| 672 | case 3: | |
| 673 | return statusMenu($lang['busy'], 'minus-circle', 'gone'); | |
| 674 | case 4: | |
| 675 | return statusMenu($lang['gaming'], 'gamepad', 'gaming'); | |
| 676 | case 5: | |
| 677 | return statusMenu($lang['eating'], 'cutlery', 'eating'); | |
| 678 | case 7: | |
| 679 | return statusMenu($lang['drankje'], 'glass', 'glass'); | |
| 680 | case 8: | |
| 681 | return statusMenu($lang['Diamant'], 'diamond fa-spin', 'fa dijamant diamond fa-spin'); | |
| 682 | case 9: | |
| 683 | return statusMenu($lang['Bliksem'], 'fa-bolt', 'fa munja fa-bolt'); | |
| 684 | case 10: | |
| 685 | return statusMenu($lang['Smiley'], 'fa-smile-o', 'fa sretno-o fa-smile-o'); | |
| 686 | case 11: | |
| 687 | return statusMenu($lang['coffee'], 'fa-coffee', 'fa kavica fa-coffee'); | |
| 688 | case 12: | |
| 689 | return statusMenu($lang['Beer'], 'fa-beer', 'fa beer_time fa-beer'); | |
| 690 | case 13: | |
| 691 | return statusMenu($lang['Bed'], 'fa-bed', 'fa krevet fa-bed'); | |
| 692 | case 14: | |
| 693 | return statusMenu($lang['Hashtag'], 'fa-hashtag', 'fa hashtag fa-hashtag'); | |
| 694 | case 15: | |
| 695 | return statusMenu($lang['music'], 'fa-music', 'fa glazba fa-music'); | |
| 696 | case 16: | |
| 697 | return statusMenu($lang['battery'], 'fa-battery-full', 'fa battery fa-battery-full'); | |
| 698 | case 17: | |
| 699 | return statusMenu($lang['battery_empty'], 'fa-battery-empty', 'fa battery_empty fa-battery-empty'); | |
| 700 | case 18: | |
| 701 | return statusMenu($lang['thermometer-full'], 'fa-thermometer-full', 'fa thermometer-full fa-thermometer-full'); | |
| 702 | case 19: | |
| 703 | return statusMenu($lang['sad'], 'fa-frown-o', 'fa frown-o fa-frown-o'); | |
| 704 | case 20: | |
| 705 | return statusMenu($lang['bug'], 'fa-bug', 'fa bug fa-bug'); | |
| 706 | case 21: | |
| 707 | return statusMenu($lang['blij'], 'fa-smile-o', 'fa smile fa-smile-o'); | |
| 708 | case 22: | |
| 709 | return statusMenu($lang['love'], 'fa-heart', 'fa heart fa-heart faa-pulse animated'); | |
| 710 | case 6: | |
| 711 | return statusMenu($lang['invisible'], 'eye-slash', 'invisible'); | |
| 712 | default: | |
| 713 | return statusMenu($lang['online'], 'check-circle', 'online'); | |
| 714 | } | |
| 715 | } | |
| 716 | function statusMenu($txt, $icon, $color){
| |
| 717 | return '<span class="boom_menu_icon"><i class="fa ' . $color . ' status_icon fa-' . $icon . '"></i></span>' . $txt; | |
| 718 | } | |
| 719 | function listAllStatus(){
| |
| 720 | global $lang, $data; | |
| 721 | $list = ''; | |
| 722 | $list .= statusBox(1, listStatus(1)); | |
| 723 | $list .= statusBox(2, listStatus(2)); | |
| 724 | $list .= statusBox(3, listStatus(3)); | |
| 725 | $list .= statusBox(4, listStatus(4)); | |
| 726 | $list .= statusBox(5, listStatus(5)); | |
| 727 | if(boomAllow(2)){
| |
| 728 | $list .= statusBox(7, listStatus(7)); | |
| 729 | $list .= statusBox(8, listStatus(8)); | |
| 730 | $list .= statusBox(9, listStatus(9)); | |
| 731 | $list .= statusBox(10, listStatus(10)); | |
| 732 | $list .= statusBox(11, listStatus(11)); | |
| 733 | $list .= statusBox(12, listStatus(12)); | |
| 734 | $list .= statusBox(13, listStatus(13)); | |
| 735 | $list .= statusBox(14, listStatus(14)); | |
| 736 | $list .= statusBox(15, listStatus(15)); | |
| 737 | $list .= statusBox(16, listStatus(16)); | |
| 738 | $list .= statusBox(17, listStatus(17)); | |
| 739 | $list .= statusBox(18, listStatus(18)); | |
| 740 | $list .= statusBox(19, listStatus(19)); | |
| 741 | $list .= statusBox(20, listStatus(20)); | |
| 742 | $list .= statusBox(21, listStatus(21)); | |
| 743 | $list .= statusBox(22, listStatus(22)); | |
| 744 | } | |
| 745 | if(boomAllow(9)){
| |
| 746 | $list .= statusBox(6, listStatus(6)); | |
| 747 | } | |
| 748 | return $list; | |
| 749 | } | |
| 750 | function statusBox($value, $content){
| |
| 751 | return '<div class="status_option elem_in" data="' . $value . '"><div class="actual_in">' . $content . '</div></div>'; | |
| 752 | } | |
| 753 | function getRankIcon($rank){
| |
| 754 | $user = array( | |
| 755 | 'user_bot'=> 0, | |
| 756 | 'user_role'=> 0, | |
| 757 | 'user_rank'=> $rank, | |
| 758 | ); | |
| 759 | return rankIcon($user); | |
| 760 | } | |
| 761 | function rankIcon($list, $type = 1){
| |
| 762 | global $lang; | |
| 763 | if(isBot($list['user_bot'])){
| |
| 764 | return curRanking($lang['user_bot'], 'ico_bot', 'bot'); | |
| 765 | } | |
| 766 | else if($list['user_role'] > 0 && $list['user_rank'] < 8 && $type == 2){
| |
| 767 | switch($list['user_role']){
| |
| 768 | case 5: | |
| 769 | return curRanking($lang['r_admin'], 'ico_radmin', 'cog'); | |
| 770 | case 4: | |
| 771 | return curRanking($lang['r_mod'], 'ico_rmod', 'legal'); | |
| 772 | } | |
| 773 | } | |
| 774 | else {
| |
| 775 | switch($list['user_rank']){
| |
| 776 | case 0: | |
| 777 | return curRanking($lang['guest'], 'ico_guest', ''); | |
| 778 | case 1: | |
| 779 | return curRanking($lang['user'], 'ico_user', ''); | |
| 780 | case 2: | |
| 781 | return curRanking($lang['vip'], 'ico_vip', 'crown'); | |
| 782 | case 3: | |
| 783 | return curRanking($lang['jarig'], 'ico_jarig', 'birthday'); | |
| 784 | case 4: | |
| 785 | return curRanking($lang['gold_member'], 'ico_goldmember', 'bookmark'); | |
| 786 | case 8: | |
| 787 | return curRanking($lang['mod'], 'ico_mod', 'shield'); | |
| 788 | case 9: | |
| 789 | return curRanking($lang['admin'], 'ico_admin', 'police'); | |
| 790 | case 10: | |
| 791 | return curRanking($lang['owner'], 'ico_owner', 'police'); | |
| 792 | case 11: | |
| 793 | return curRanking($lang['owner'], 'ico_owner', 'police'); | |
| 794 | default: | |
| 795 | return curRanking($lang['user'], 'ico_user', ''); | |
| 796 | } | |
| 797 | } | |
| 798 | } | |
| 799 | function curRanking($txt, $color, $icon){
| |
| 800 | return '<i title="' . $txt . '" class="' . $color . ' fa fa-' . $icon . '"></i>'; | |
| 801 | } | |
| 802 | function listRank($current, $req = 0){
| |
| 803 | global $lang, $data; | |
| 804 | $rank = ''; | |
| 805 | if($req == 1){
| |
| 806 | $rank .= '<option value="0" ' . selCurrent($current, 0) . '>' . $lang['guest'] . '</option>'; | |
| 807 | } | |
| 808 | $rank .= '<option value="1" ' . selCurrent($current, 1) . '>' . $lang['user'] . '</option>'; | |
| 809 | $rank .= '<option value="2" ' . selCurrent($current, 2) . '>' . $lang['vip'] . '</option>'; | |
| 810 | $rank .= '<option value="3" ' . selCurrent($current, 3) . '>' . $lang['jarig'] . '</option>'; | |
| 811 | $rank .= '<option value="4" ' . selCurrent($current, 4) . '>' . $lang['gold_member'] . '</option>'; | |
| 812 | $rank .= '<option value="8" ' . selCurrent($current, 8) . '>' . $lang['mod'] . '</option>'; | |
| 813 | $rank .= '<option value="9" ' . selCurrent($current, 9) . '>' . $lang['admin'] . '</option>'; | |
| 814 | $rank .= '<option value="10" ' . selCurrent($current, 10) . '>' . $lang['owner'] . '</option>'; | |
| 815 | return $rank; | |
| 816 | } | |
| 817 | function changeRank($current){
| |
| 818 | global $lang, $data; | |
| 819 | $rank = ''; | |
| 820 | if(boomAllow(9)){
| |
| 821 | $rank .= '<option value="1" ' . selCurrent($current, 1) . '>' . $lang['user'] . '</option>'; | |
| 822 | $rank .= '<option value="2" ' . selCurrent($current, 2) . '>' . $lang['vip'] . '</option>'; | |
| 823 | $rank .= '<option value="3" ' . selCurrent($current, 3) . '>' . $lang['jarig'] . '</option>'; | |
| 824 | $rank .= '<option value="4" ' . selCurrent($current, 4) . '>' . $lang['gold_member'] . '</option>'; | |
| 825 | $rank .= '<option value="8" ' . selCurrent($current, 8) . '>' . $lang['mod'] . '</option>'; | |
| 826 | } | |
| 827 | if(boomAllow(10)){
| |
| 828 | $rank .= '<option value="9" ' . selCurrent($current, 9) . '>' . $lang['admin'] . '</option>'; | |
| 829 | } | |
| 830 | return $rank; | |
| 831 | } | |
| 832 | function getRank($rank){
| |
| 833 | global $lang; | |
| 834 | switch($rank){
| |
| 835 | case 0: | |
| 836 | return $lang['guest']; | |
| 837 | case 1: | |
| 838 | return $lang['user']; | |
| 839 | case 2: | |
| 840 | return $lang['vip']; | |
| 841 | case 3: | |
| 842 | return $lang['jarig']; | |
| 843 | case 4: | |
| 844 | return $lang['gold_member']; | |
| 845 | case 8: | |
| 846 | return $lang['mod']; | |
| 847 | case 9: | |
| 848 | return $lang['admin']; | |
| 849 | case 10: | |
| 850 | return $lang['owner']; | |
| 851 | default: | |
| 852 | return $lang['user']; | |
| 853 | } | |
| 854 | } | |
| 855 | function changeRoomRank($current){
| |
| 856 | global $lang, $data; | |
| 857 | $rank = ''; | |
| 858 | if(boomAllow(9) || boomRole(5)){
| |
| 859 | $rank .= '<option value="0" ' . selCurrent($current, 0) . '>' . $lang['none'] . '</option>'; | |
| 860 | $rank .= '<option value="4" ' . selCurrent($current, 4) . '>' . $lang['r_mod'] . '</option>'; | |
| 861 | } | |
| 862 | if(boomAllow(9)){
| |
| 863 | $rank .= '<option value="5" ' . selCurrent($current, 5) . '>' . $lang['r_admin'] . '</option>'; | |
| 864 | } | |
| 865 | return $rank; | |
| 866 | } | |
| 867 | function roomTitle($rank){
| |
| 868 | global $lang; | |
| 869 | switch($rank){
| |
| 870 | case 5: | |
| 871 | return $lang['r_admin']; | |
| 872 | case 4: | |
| 873 | return $lang['r_mod']; | |
| 874 | case 0: | |
| 875 | return $lang['user']; | |
| 876 | default: | |
| 877 | return $lang['user']; | |
| 878 | } | |
| 879 | } | |
| 880 | function roomAccess($type){
| |
| 881 | switch($type){
| |
| 882 | case 0: | |
| 883 | return roomAccessIcon('globe', 'ico_public');
| |
| 884 | case 1: | |
| 885 | return roomAccessIcon('user', 'ico_user');
| |
| 886 | case 2: | |
| 887 | return roomAccessIcon('diamond', 'ico_vip');
| |
| 888 | case 8: | |
| 889 | return roomAccessIcon('star', 'ico_admin');
| |
| 890 | default: | |
| 891 | return roomAccessIcon('globe', 'ico_public');
| |
| 892 | } | |
| 893 | } | |
| 894 | function roomAccessIcon($icon, $color){
| |
| 895 | return '<i class="fa fa-' . $icon . ' ' . $color . '"></i>'; | |
| 896 | } | |
| 897 | ?> |