Advertisement
arabtion

Untitled

Nov 6th, 2019
141
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 43.31 KB | None | 0 0
  1. <?php
  2. /**
  3. * Codychat
  4. *
  5. * @package Codychat
  6. * @author www.boomcoding.com
  7. * @copyright 2019
  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, $cody;
  33. $page = BOOM_PATH . '/system/' . $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 boomFormat($txt){
  72. $count = substr_count($txt, "\n" );
  73. if($count > 20){
  74. return $txt;
  75. }
  76. else {
  77. return nl2br($txt);
  78. }
  79. }
  80. function boomFileVersion(){
  81. global $data;
  82. if($data['bbfv'] > 1.0){
  83. return '?v=' . $data['bbfv'];
  84. }
  85. return '';
  86. }
  87. function boomNull($val){
  88. if(is_Null($val)){
  89. return 0;
  90. }
  91. else {
  92. return $val;
  93. }
  94. }
  95. function embedMode(){
  96. global $data;
  97. if(isset($_GET['embed'])){
  98. return true;
  99. }
  100. }
  101. function embedCode(){
  102. global $data;
  103. if(isset($_GET['embed'])){
  104. return 1;
  105. }
  106. else {
  107. return 0;
  108. }
  109. }
  110. function myavatar($a){
  111. global $data;
  112. $path = '/avatar/';
  113. if(stripos($a, 'default') !== false){
  114. $path = '/default_images/';
  115. }
  116. return $data['domain'] . $path . $a;
  117. }
  118. function myCover($a){
  119. global $data;
  120. return $data['domain'] . '/cover/' . $a;
  121. }
  122. function getCover($user){
  123. global $data;
  124. if(userHaveCover($user)){
  125. return 'style="background-image: url(' . myCover($user['user_cover']) . ');"';
  126. }
  127. }
  128. function coverClass($user){
  129. global $data;
  130. if(userHaveCover($user)){
  131. return 'cover_size';
  132. }
  133. }
  134. function userHaveCover($user){
  135. global $data;
  136. if($user['user_cover'] != ''){
  137. return true;
  138. }
  139. }
  140. function getIcon($icon, $c){
  141. global $data, $lang;
  142. return '<img class="' . $c . '" src="' . $data['domain'] . '/default_images/icons/' . $icon . boomFileVersion() . '"/>';
  143. }
  144. function boomCode($code, $custom = array()){
  145. $def = array('code'=> $code);
  146. $res = array_merge($def, $custom);
  147. return json_encode( $res, JSON_UNESCAPED_UNICODE);
  148. }
  149. function profileAvatar($a){
  150. global $data;
  151. $path = '/avatar/';
  152. if(stripos($a, 'default') !== false){
  153. $path = '/default_images/';
  154. }
  155. return 'href="' . $data['domain'] . $path . $a . '" src="' . $data['domain'] . $path . $a . '"';
  156. }
  157. function boomUserTheme($user){
  158. global $data;
  159. if($user['user_theme'] == 'system'){
  160. return $data['default_theme'];
  161. }
  162. else {
  163. return $user['user_theme'];
  164. }
  165. }
  166. function linkAvatar($a){
  167. if(preg_match('@^https?://@i', $a)){
  168. return true;
  169. }
  170. }
  171. function escape($t){
  172. global $mysqli;
  173. return $mysqli->real_escape_string(trim(htmlspecialchars($t, ENT_QUOTES)));
  174. }
  175. function boomSanitize($t){
  176. global $mysqli;
  177. $t = str_replace(array('\\', '/', '.', '<', '>', '%', '#'), '', $t);
  178. return $mysqli->real_escape_string(trim(htmlspecialchars($t, ENT_QUOTES)));
  179. }
  180. function softEscape($t){
  181. global $mysqli;
  182. $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>';
  183. $t = strip_tags($t, $atags);
  184. return $mysqli->real_escape_string(trim($t));
  185. }
  186. function systemReplace($text){
  187. global $lang;
  188. $text = str_replace('%bcquit%', $lang['leave_message'], $text);
  189. $text = str_replace('%bcjoin%', $lang['join_message'], $text);
  190. $text = str_replace('%bcclear%', $lang['clear_message'], $text);
  191. $text = str_replace('%spam%', $lang['spam_content'], $text);
  192. return $text;
  193. }
  194. function systemSpecial($content, $type, $custom = array()){
  195. global $data, $lang;
  196. $def = array(
  197. 'content'=> $content,
  198. 'type'=> $type,
  199. 'delete'=> 1,
  200. 'title'=> $lang['default_title'],
  201. 'icon'=> 'default_system.png',
  202. );
  203. $template = array_merge($def, $custom);
  204. return boomTemplate('element/system_log', $template);
  205. }
  206. function specialLogIcon($icon){
  207. global $data;
  208. return $data['domain'] . '/default_images/special/' . $icon . boomFileVersion();
  209. }
  210. function userDetails($id){
  211. global $mysqli;
  212. $user = array();
  213. $getuser = $mysqli->query("SELECT * FROM boom_users WHERE user_id = '$id'");
  214. if($getuser->num_rows > 0){
  215. $user = $getuser->fetch_assoc();
  216. }
  217. return $user;
  218. }
  219. function ownAvatar($i){
  220. global $data;
  221. if($i == $data['user_id']){
  222. return 'glob_av';
  223. }
  224. return '';
  225. }
  226. function chatAction($room, $action = 1){
  227. global $mysqli, $data;
  228. $addthis = '';
  229. if($action == 1){
  230. $addthis = ", room_action = '" . time() . "'";
  231. }
  232. $mysqli->query("UPDATE boom_rooms SET rcaction = rcaction + 1 $addthis WHERE room_id = '$room'");
  233. }
  234. function userPostChat($content, $custom = array()){
  235. global $mysqli, $data;
  236. $def = array(
  237. 'hunter'=> $data['user_id'],
  238. 'room'=> $data['user_roomid'],
  239. 'color'=> escape($data['bccolor'] . ' ' . $data['bcbold']),
  240. 'type'=> 'public',
  241. 'rank'=> 99,
  242. 'snum'=> '',
  243. );
  244. $c = array_merge($def, $data, $custom);
  245. $mysqli->query("INSERT INTO `boom_chat` (post_date, user_id, post_message, post_roomid, type, log_rank, snum, tcolor) VALUES ('" . time() . "', '{$c['hunter']}', '$content', '{$c['room']}', '{$c['type']}', '{$c['rank']}', '{$c['snum']}', '{$c['color']}')");
  246. $last_id = $mysqli->insert_id;
  247. chatAction($data['user_roomid']);
  248. if(!empty($c['snum'])){
  249. $user_post = array(
  250. 'post_id'=> $last_id,
  251. 'type'=> $c['type'],
  252. 'post_date'=> time(),
  253. 'tcolor'=> $c['color'],
  254. 'log_rank'=> $c['rank'],
  255. 'post_message'=> $content,
  256. );
  257. $post = array_merge($c, $user_post);
  258. if(!empty($post)){
  259. return createLog($data, $post);
  260. }
  261. }
  262. }
  263. function userPostChatFile($content, $file_name, $type, $file_name2 = ''){
  264. global $mysqli, $data;
  265. $mysqli->query("INSERT INTO `boom_chat` (post_date, user_id, post_message, post_roomid, type, file) VALUES ('" . time() . "', '{$data['user_id']}', '$content', '{$data['user_roomid']}', 'public', '1')");
  266. $rel = $mysqli->insert_id;
  267. chatAction($data['user_roomid']);
  268. if($file_name2 != ''){
  269. $mysqli->query("INSERT INTO `boom_upload` (file_name, date_sent, file_user, file_zone, file_type, relative_post) VALUES
  270. ('$file_name', '" . time() . "', '{$data['user_id']}', 'chat', '$type', '$rel'),
  271. ('$file_name2', '" . time() . "', '{$data['user_id']}', 'chat', '$type', '$rel')
  272. ");
  273. }
  274. else {
  275. $mysqli->query("INSERT INTO `boom_upload` (file_name, date_sent, file_user, file_zone, file_type, relative_post) VALUES ('$file_name', '" . time() . "', '{$data['user_id']}', 'chat', '$type', '$rel')");
  276. }
  277. return true;
  278. }
  279. function systemPostChat($room, $content, $custom = array()){
  280. global $mysqli, $data;
  281. $def = array(
  282. 'type'=> 'system',
  283. 'color'=> 'chat_system',
  284. 'rank'=> 99,
  285. );
  286. $post = array_merge($def, $custom);
  287. $mysqli->query("INSERT INTO `boom_chat` (post_date, user_id, post_message, post_roomid, type, log_rank, tcolor) VALUES ('" . time() . "', '{$data['system_id']}', '$content', '$room', '{$post['type']}', '{$post['rank']}', '{$post['color']}')");
  288. chatAction($room);
  289. return true;
  290. }
  291. function botPostChat($id, $room, $content, $custom = array()){
  292. global $mysqli, $data;
  293. $def = array(
  294. 'type'=> 'public',
  295. 'color'=> '',
  296. 'rank'=> 99,
  297. );
  298. $post = array_merge($def, $custom);
  299. $mysqli->query("INSERT INTO `boom_chat` (post_date, user_id, post_message, post_roomid, type, log_rank, tcolor) VALUES ('" . time() . "', '$id', '$content', '$room', '{$post['type']}', '{$post['rank']}', '{$post['color']}')");
  300. chatAction($room);
  301. return true;
  302. }
  303. function postPrivate($from, $to, $content, $snum = ''){
  304. global $mysqli, $data;
  305. $mysqli->query("INSERT INTO `boom_private` (time, target, hunter, message) VALUES ('" . time() . "', '$to', '$from', '$content')");
  306. $last_id = $mysqli->insert_id;
  307. if($to != $from){
  308. $mysqli->query("UPDATE boom_users SET pcount = pcount + 1 WHERE user_id = '$to'");
  309. }
  310. if($snum != ''){
  311. $user_post = array(
  312. 'id'=> $last_id,
  313. 'time'=> time(),
  314. 'message'=> $content,
  315. );
  316. $post = array_merge($data, $user_post);
  317. if(!empty($post)){
  318. return privateLog($post, 1);
  319. }
  320. }
  321. }
  322. function postPrivateContent($from, $to, $content){
  323. global $mysqli, $data;
  324. $mysqli->query("INSERT INTO `boom_private` (time, target, hunter, message, file) VALUES ('" . time() . "', '$to', '$from', '$content', 1)");
  325. $rel = $mysqli->insert_id;
  326. $mysqli->query("UPDATE boom_users SET pcount = pcount + 1 WHERE user_id = '$from' OR user_id = '$to'");
  327. return true;
  328. }
  329. function userPostPrivateFile($content, $target, $file_name, $type){
  330. global $mysqli, $data;
  331. $mysqli->query("INSERT INTO `boom_private` (time, target, hunter, message, file) VALUES ('" . time() . "', '$target', '{$data['user_id']}', '$content', 1)");
  332. $rel = $mysqli->insert_id;
  333. $mysqli->query("UPDATE boom_users SET pcount = pcount + 1 WHERE user_id = '{$data['user_id']}' OR user_id = '$target'");
  334. $mysqli->query("INSERT INTO `boom_upload` (file_name, date_sent, file_user, file_zone, file_type, relative_post) VALUES ('$file_name', '" . time() . "', '{$data['user_id']}', 'private', '$type', '$rel')");
  335. return true;
  336. }
  337. function getFriendList($id, $type = 0){
  338. global $mysqli;
  339. $friend_list = array();
  340. $find_friend = $mysqli->query("SELECT target FROM boom_friends WHERE hunter = '$id' AND status = '3'");
  341. if($find_friend->num_rows > 0){
  342. while($find = $find_friend->fetch_assoc()){
  343. array_push($friend_list, $find['target']);
  344. }
  345. if($type == 1){
  346. array_push($friend_list, $id);
  347. }
  348. }
  349. return $friend_list;
  350. }
  351. function getRankList($rank){
  352. global $mysqli;
  353. $list = array();
  354. $find_list = $mysqli->query("SELECT user_id FROM boom_users WHERE user_rank = '$rank'");
  355. if($find_list->num_rows > 0){
  356. while($find = $find_list->fetch_assoc()){
  357. array_push($list, $find['user_id']);
  358. }
  359. }
  360. return $list;
  361. }
  362. function getStaffList(){
  363. global $mysqli;
  364. $list = array();
  365. $find_list = $mysqli->query("SELECT user_id FROM boom_users WHERE user_rank >= 8");
  366. if($find_list->num_rows > 0){
  367. while($find = $find_list->fetch_assoc()){
  368. array_push($list, $find['user_id']);
  369. }
  370. }
  371. return $list;
  372. }
  373. function boomListNotify($list, $type, $custom = array()){
  374. global $mysqli, $data;
  375. if(!empty($list)){
  376. $values = '';
  377. foreach($list as $user){
  378. $def = array(
  379. 'hunter'=> $data['system_id'],
  380. 'room'=> $data['user_roomid'],
  381. 'rank'=> 0,
  382. 'delay'=> 0,
  383. 'reason'=> '',
  384. 'source'=> 'system',
  385. 'sourceid'=> 0,
  386. 'custom' => '',
  387. 'custom2' => '',
  388. );
  389. $c = array_merge($def, $custom);
  390. $values .= "('{$c['hunter']}', '$user', '$type', '" . time() . "', '{$c['source']}', '{$c['sourceid']}', '{$c['rank']}', '{$c['delay']}', '{$c['reason']}', '{$c['custom']}', '{$c['custom2']}'),";
  391. }
  392. $values = rtrim($values, ',');
  393. $mysqli->query("INSERT INTO boom_notification ( notifier, notified, notify_type, notify_date, notify_source, notify_id, notify_rank, notify_delay, notify_reason, notify_custom, notify_custom2) VALUES $values");
  394. updateListNotify($list);
  395. }
  396. }
  397. function boomNotify($target, $type, $custom = array()){
  398. global $mysqli, $data;
  399. $def = array(
  400. 'hunter'=> $data['system_id'],
  401. 'room'=> $data['user_roomid'],
  402. 'rank'=> 0,
  403. 'delay'=> 0,
  404. 'reason'=> '',
  405. 'source'=> 'system',
  406. 'sourceid'=> 0,
  407. 'custom' => '',
  408. 'custom2' => '',
  409. );
  410. $c = array_merge($def, $custom);
  411. $mysqli->query("INSERT INTO boom_notification ( notifier, notified, notify_type, notify_date, notify_source, notify_id, notify_rank, notify_delay, notify_reason, notify_custom, notify_custom2)
  412. VALUE ('{$c['hunter']}', '$target', '$type', '" . time() . "', '{$c['source']}', '{$c['sourceid']}', '{$c['rank']}', '{$c['delay']}', '{$c['reason']}', '{$c['custom']}', '{$c['custom2']}')");
  413. updateNotify($target);
  414. }
  415. function updateNotify($id){
  416. global $mysqli;
  417. $mysqli->query("UPDATE boom_users SET naction = naction + 1 WHERE user_id = '$id'");
  418. }
  419. function updateListNotify($list){
  420. global $mysqli;
  421. if(empty($list)){
  422. return false;
  423. }
  424. $list = implode(", ", $list);
  425. $mysqli->query("UPDATE boom_users SET naction = naction + 1 WHERE user_id IN ($list)");
  426. }
  427. function updateStaffNotify(){
  428. global $mysqli;
  429. $mysqli->query("UPDATE boom_users SET naction = naction + 1 WHERE user_rank > 7");
  430. }
  431. function updateAllNotify(){
  432. global $mysqli;
  433. $delay = calMinutes(2);
  434. $mysqli->query("UPDATE boom_users SET naction = naction + 1 WHERE last_action > '$delay'");
  435. }
  436. function createIgnore(){
  437. global $mysqli, $data, $cody;
  438. $ignore_list = '';
  439. $get_ignore = $mysqli->query("SELECT ignored FROM boom_ignore WHERE ignorer = '{$data['user_id']}'");
  440. while($ignore = $get_ignore->fetch_assoc()){
  441. $ignore_list .= $ignore['ignored'] . '|';
  442. }
  443. $_SESSION[BOOM_PREFIX . 'ignore'] = '|' . $ignore_list;
  444. }
  445. function isIgnored($ignore, $id){
  446. global $cody;
  447. if(strpos($ignore, '|' . $id . '|') !== false){
  448. return true;
  449. }
  450. }
  451. function getIgnore(){
  452. global $cody;
  453. return $_SESSION[BOOM_PREFIX . 'ignore'];
  454. }
  455. function processChatMsg($post) {
  456. global $data;
  457. if($post['user_id'] != $data['user_id'] && !preg_match('/http/',$post['post_message'])){
  458. $post['post_message'] = str_ireplace($data['user_name'], '<span class="my_notice">' . $data['user_name'] . '</span>', $post['post_message']);
  459. }
  460. return htmlspecialchars_decode(mb_convert_encoding(systemReplace($post['post_message']), 'UTF-8', 'auto'));
  461. }
  462. function processPrivateMsg($post) {
  463. global $data;
  464. return htmlspecialchars_decode(mb_convert_encoding(systemReplace($post['message']), 'UTF-8', 'auto'));
  465. }
  466. function mainRoom(){
  467. global $data;
  468. if($data['user_roomid'] == 1){
  469. return true;
  470. }
  471. }
  472. function chatRank($rank, $id){
  473. global $data;
  474. if($id != $data['system_id'] && $data['ico'] == 2){
  475. return systemRank($rank, 'chat_rank');
  476. }
  477. }
  478. function createLog($data, $post, $ignore = ''){
  479. global $lang;
  480. $avmenu = '';
  481. $log_options = '';
  482. $gender = '';
  483. if(isIgnored($ignore, $post['user_id'])){
  484. return false;
  485. }
  486. if(boomAllow($post['log_rank'])){
  487. return false;
  488. }
  489. $avmenu = 'onclick="openAvMenu(this, \''.$post['user_name'].'\','.$post['user_id'].','.$post['user_rank'].', '.$post['user_bot'].');"';
  490. if(boomAllow(1)){
  491. if(canDeleteLog() || canDeleteRoomLog()){
  492. $log_options = '<div onclick="deleteLog(' . $post['post_id'] . ');" class="cclear"><i class="fa fa-times"></i></div>';
  493. }
  494. else if(!isSystem($post['user_id'])){
  495. $log_options = '<div onclick="openReport(' . $post['post_id'] . ', 1);" class="cclear"><i class="fa fa-flag"></i></div>';
  496. }
  497. }
  498. if($data['gender_ico'] > 1){
  499. $gender = 'avsex ' . sex($post['user_sex']) . ' ';
  500. }
  501.  
  502. return '<li id="log' . $post['post_id'] . '" data="' . $post['post_id'] . '" class="ch_logs ' . $post['type'] . '">
  503. <div class="chat_avatar" ' . $avmenu . '>
  504. <img class="avav ' . $gender . ownAvatar($post['user_id']) . '" src="' . myavatar($post['user_tumb']) . '"/>
  505. </div>
  506. <div class="my_text">
  507. <div class="btable">
  508. <div class="cname">' . chatRank($post['user_rank'], $post['user_id']) . '<span class="username ' . $post['user_color'] . '">' . $post['user_name'] . '</span>
  509. : <div class="chat_message ' . $post['tcolor'] . '">' . processChatMsg($post) . '</div></div>
  510.  
  511. ' . $log_options . '
  512.  
  513. </div>
  514. </li>';
  515. }
  516. function privateLog($post, $type){
  517. switch($type){
  518. case 1:
  519. return '<li id="priv' . $post['id'] . '">
  520. <div class="private_logs">
  521. <div class="private_avatar">
  522. <img data="' . $post['user_id'] . '" class="get_info avatar_private" src="' . myavatar($post['user_tumb']) . '"/>
  523. </div>
  524. <div class="private_content">
  525. <div class="hunter_private">' . processPrivateMsg($post) . '</div>
  526.  
  527. </div>
  528. </div>
  529. </li>';
  530. case 2:
  531. return '<li id="priv' . $post['id'] . '">
  532. <div class="private_logs">
  533. <div class="private_content">
  534. <div class="target_private">' . processPrivateMsg($post) . '</div>
  535.  
  536. </div>
  537. <div class="private_avatar">
  538. <img data="' . $post['user_id'] . '" class="get_info avatar_private" src="' . myavatar($post['user_tumb']) . '"/>
  539. </div>
  540. </div>
  541. </li>';
  542. }
  543. }
  544. function createUserlist($list, $type = 1){
  545. global $data, $lang;
  546. if(!isVisible($list)){
  547. return false;
  548. }
  549. $icon = '';
  550. $flag = '';
  551. $muted = '';
  552. $status = '';
  553. $gender = '';
  554. $mood = '';
  555. if(useFlag($list['country'])){
  556. $flag = '<div class="user_item_flag"><img src="' . countryFlag($list['country']) . '"/></div>';
  557. }
  558. $offline = 'offline';
  559. $rank_icon = rankIcon($list, 'list_rank');
  560. $mute_icon = mutedIcon($list, 'list_mute');
  561. if($data['ico'] > 0 && $rank_icon != ''){
  562. $icon = '<div class="user_item_icon icrank">' . $rank_icon . '</div>';
  563. }
  564. if($mute_icon != ''){
  565. $muted = '<div class="user_item_icon icmute">' . $mute_icon . '</div>';
  566. }
  567. if($data['gender_ico'] > 0){
  568. $gender = 'avsex ' . sex($list['user_sex']) . ' ';
  569. }
  570. if($list['last_action'] > getDelay() || isBot($list)){
  571. $offline = '';
  572. $status = getStatus($list['user_status'], 'list_status');
  573. }
  574. if(!empty($list['user_mood'])){
  575. $mood = '<p class="text_xsmall bustate bellips">' . $list['user_mood'] . '</p>';
  576. }
  577. return '<div onclick="dropUser(this,'.$list['user_id'].',\''.$list['user_name'].'\','.$list['user_rank'].','.$list['user_bot'].', ' . $type . ');" class="user_item ' . $offline . '">
  578. <div class="user_item_avatar"><img class="acav ' . $gender . ownAvatar($list['user_id']) . '" src="' . myavatar($list['user_tumb']) . '"/> ' . $status . '</div>
  579. <div class="user_item_data"><p class="username ' . $list['user_color'] . '">' . $list["user_name"] . '</p>' . $mood . '</div>
  580. ' . $muted . $icon . $flag . '
  581. </div>
  582. <div class="drop_list"></div>';
  583. }
  584. function chatDate($date){
  585. return date("j/m G:i", $date);
  586. }
  587. function displayDate($date){
  588. return date("j/m G:i", $date);
  589. }
  590. function longDate($date){
  591. return date("Y-m-d ", $date);
  592. }
  593. function longDateTime($date){
  594. return date("Y-m-d G:i ", $date);
  595. }
  596. function userTime($user){
  597. $d = new DateTime(date("d F Y H:i:s",time()));
  598. $d->setTimezone(new DateTimeZone($user['user_timezone']));
  599. $r =$d->format('G:i');
  600. return $r;
  601. }
  602. function boomRenderMinutes($val){
  603. global $lang;
  604. $day = '';
  605. $hour = '';
  606. $minute = '';
  607. $d = floor ($val / 1440);
  608. $h = floor (($val - $d * 1440) / 60);
  609. $m = $val - ($d * 1440) - ($h * 60);
  610. if($d > 0){
  611. if($d > 1){ $day = $d . ' ' . $lang['days']; } else{ $day = $d . ' ' . $lang['day']; }
  612. }
  613. if($h > 0){
  614. if($h > 1){ $hour = $h . ' ' . $lang['hours']; } else{ $hour = $h . ' ' . $lang['hour']; }
  615. }
  616. if($m > 0){
  617. if($m > 1){ $minute = $m . ' ' . $lang['minutes']; } else{ $minute = $m . ' ' . $lang['minute']; }
  618. }
  619. return trim($day . ' ' . $hour . ' ' . $minute);
  620. }
  621. function boomRenderSeconds($val){
  622. global $lang;
  623. $day = '';
  624. $hour = '';
  625. $minute = '';
  626. $second = '';
  627. $d = floor ($val / 86400);
  628. $h = floor (($val - $d * 86400) / 3600);
  629. $m = floor (($val - ($d * 86400) - ($h * 3600)) / 60);
  630. $s = $val - ($d * 86400) - ($h * 3600) - ($m * 60);
  631. if($d > 0){
  632. if($d > 1){ $day = $d . ' ' . $lang['days']; } else{ $day = $d . ' ' . $lang['day']; } }
  633. if($h > 0){
  634. if($h > 1){ $hour = $h . ' ' . $lang['hours']; } else{ $hour = $h . ' ' . $lang['hour']; }
  635. }
  636. if($m > 0){
  637. if($m > 1){ $minute = $m . ' ' . $lang['minutes']; } else{ $minute = $m . ' ' . $lang['minute']; }
  638. }
  639. if($s > 0){
  640. if($s > 1){ $second = $s . ' ' . $lang['seconds']; } else{ $second = $s . ' ' . $lang['second']; }
  641. }
  642. return trim($day . ' ' . $hour . ' ' . $minute . ' ' . $second);
  643. }
  644. function boomTimeLeft($t){
  645. return boomRenderMinutes(floor(($t - time()) / 60));
  646. }
  647. function boomAllow($rank){
  648. global $data;
  649. if($data['user_rank'] >= $rank){
  650. return true;
  651. }
  652. }
  653. function userBoomAllow($user, $val){
  654. if($user['user_rank'] >= $val){
  655. return true;
  656. }
  657. }
  658. function boomRole($role){
  659. global $data;
  660. if($data['user_role'] >= $role){
  661. return true;
  662. }
  663. }
  664. function haveRole($role){
  665. if($role > 0){
  666. return true;
  667. }
  668. }
  669. function isGreater($rank){
  670. global $data;
  671. if($data['user_rank'] > $rank){
  672. return true;
  673. }
  674. }
  675. function notMe($id){
  676. global $data;
  677. if($id != $data['user_id']){
  678. return true;
  679. }
  680. }
  681. function isBot($user){
  682. if($user['user_bot'] > 0){
  683. return true;
  684. }
  685. }
  686. function systemBot($user){
  687. if($user == 9){
  688. return true;
  689. }
  690. }
  691. function isSystem($id){
  692. global $data;
  693. if($id == $data['system_id']){
  694. return true;
  695. }
  696. }
  697. function getTopic($t){
  698. global $lang;
  699. $topic = processUserData($t);
  700. if(!empty($topic)){
  701. return systemSpecial($topic, 'topic_log', array('icon'=> 'topic.svg', 'title'=> $lang['topic_title']));
  702. }
  703. }
  704. function boomConsole($target, $type, $custom = array()){
  705. global $mysqli, $data;
  706. $def = array(
  707. 'hunter'=> $data['user_id'],
  708. 'room'=> $data['user_roomid'],
  709. 'rank'=> 0,
  710. 'delay'=> 0,
  711. 'reason'=> '',
  712. 'custom' => '',
  713. 'custom2' => '',
  714. );
  715. $c = array_merge($def, $custom);
  716. $mysqli->query("INSERT INTO boom_console (hunter, target, room, ctype, rank, delay, reason, custom, custom2, cdate) VALUES ('{$c['hunter']}', '$target', '{$c['room']}', '$type', '{$c['rank']}', '{$c['delay']}', '{$c['reason']}', '{$c['custom']}', '{$c['custom2']}', '" . time() . "')");
  717. }
  718. function boomHistory($target, $type, $custom = array()){
  719. global $mysqli, $data;
  720. $def = array(
  721. 'hunter'=> $data['user_id'],
  722. 'rank'=> 0,
  723. 'delay'=> 0,
  724. 'reason'=> '',
  725. 'content'=> '',
  726. );
  727. $c = array_merge($def, $custom);
  728. $mysqli->query("INSERT INTO boom_history (hunter, target, htype, delay, reason, history_date) VALUES ('{$c['hunter']}', '$target', '$type', '{$c['delay']}', '{$c['reason']}', '" . time() . "')");
  729. }
  730. function renderReason($t){
  731. global $lang;
  732. switch($t){
  733. case '':
  734. return $lang['no_reason'];
  735. case 'badword':
  736. return $lang['badword'];
  737. case 'spam':
  738. return $lang['spam'];
  739. case 'flood':
  740. return $lang['flood'];
  741. default:
  742. return $t;
  743. }
  744. }
  745. function userUnmute($user){
  746. global $mysqli;
  747. clearNotifyAction($user['user_id'], 'mute');
  748. $mysqli->query("UPDATE boom_users SET user_mute = 0, mute_msg = '' WHERE user_id = '{$user['user_id']}'");
  749. boomNotify($user['user_id'], 'unmute', array('source'=> 'mute'));
  750. }
  751. function userUnkick($user){
  752. global $mysqli;
  753. $mysqli->query("UPDATE boom_users SET user_kick = 0 WHERE user_id = '{$user['user_id']}'");
  754. }
  755. function muted(){
  756. global $data;
  757. if(isMuted($data) || isBanned($data) || isKicked($data) || outChat($data)){
  758. return true;
  759. }
  760. }
  761. function roomMuted(){
  762. global $data;
  763. if($data['room_mute'] > 0){
  764. return true;
  765. }
  766. }
  767. function isRoomMuted($user){
  768. if($user['room_mute'] > 0){
  769. return true;
  770. }
  771. }
  772. function isMuted($user){
  773. if($user['user_mute'] > time()){
  774. return true;
  775. }
  776. }
  777. function mutedData($user){
  778. if($user['user_mute'] > 0){
  779. return true;
  780. }
  781. }
  782. function kickedData($user){
  783. if($user['user_kick'] > 0){
  784. return true;
  785. }
  786. }
  787. function isBanned($user){
  788. if($user['user_banned'] > 0){
  789. return true;
  790. }
  791. }
  792. function isKicked($user){
  793. if($user['user_kick'] > time()){
  794. return true;
  795. }
  796. }
  797. function joinRoom(){
  798. global $lang, $data;
  799. if(allowLogs() && isVisible($data)){
  800. $content = str_replace('%user%', $data['user_name'], $lang['system_join_room']);
  801. systemPostChat($data['user_roomid'], $content);
  802. }
  803. }
  804. function leaveRoom(){
  805. global $data, $lang;
  806. if(allowLogs()){
  807. if(isVisible($data) && $data['user_roomid'] != 0 && $data['last_action'] > time() - 30 ){
  808. $content = str_replace('%user%', $data['user_name'], $lang['quit_room']);
  809. systemPostChat($data['user_roomid'], $content);
  810. }
  811. }
  812. }
  813. function processUserData($t){
  814. global $data;
  815. return str_replace(array('%user%'), array($data['user_name']), $t);
  816. }
  817. function roomStaff(){
  818. if(boomRole(4)){
  819. return true;
  820. }
  821. }
  822. function userRoomStaff($rank){
  823. if($rank >= 4){
  824. return true;
  825. }
  826. }
  827. function allowLogs(){
  828. global $data;
  829. if($data['allow_logs'] == 1){
  830. return true;
  831. }
  832. }
  833. function isVisible($user){
  834. if($user['user_status'] != 6){
  835. return true;
  836. }
  837. }
  838. function isSecure($user){
  839. if(isEmail($user['user_email'])){
  840. return true;
  841. }
  842. }
  843. function isMember($user){
  844. if(!isGuest($user) && !isBot($user)){
  845. return true;
  846. }
  847. }
  848. function isGuest($user){
  849. if($user['user_rank'] == 0){
  850. return true;
  851. }
  852. }
  853. function guestForm(){
  854. global $data;
  855. if($data['guest_form'] == 1){
  856. return true;
  857. }
  858. }
  859. function strictGuest(){
  860. global $cody;
  861. if($cody['strict_guest'] == 1){
  862. return true;
  863. }
  864. }
  865. function userDj($user){
  866. if($user['user_dj'] == 1){
  867. return true;
  868. }
  869. }
  870. function boomRecaptcha(){
  871. global $data;
  872. if($data['use_recapt'] > 0){
  873. return true;
  874. }
  875. }
  876.  
  877. function encrypt($d){
  878. return sha1(str_rot13($d . BOOM_CRYPT));
  879. }
  880. function boomEncrypt($d, $encr){
  881. return sha1(str_rot13($d . $encr));
  882. }
  883. function getDelay(){
  884. return time() - 35;
  885. }
  886. function getMinutes($t){
  887. return $t / 60;
  888. }
  889. function isOwner($user){
  890. if($user['user_rank'] == 11){
  891. return true;
  892. }
  893. }
  894. function isStaff($rank){
  895. if($rank > 7){
  896. return true;
  897. }
  898. }
  899. function genKey(){
  900. return md5(rand(10000,99999) . rand(10000,99999));
  901. }
  902. function genCode(){
  903. return rand(111111,999999);
  904. }
  905. function genSnum(){
  906. global $data;
  907. return $data['user_id'] . rand(1111111, 9999999);
  908. }
  909. function boomUnderClear($t){
  910. return str_replace('_', ' ', $t);
  911. }
  912. function allowGuest(){
  913. global $data;
  914. if($data['allow_guest'] == 1){
  915. return true;
  916. }
  917. }
  918. function roomName(){
  919. global $mysqli, $data;
  920. $groom = $mysqli->query("SELECT room_name FROM boom_rooms WHERE room_id = '{$data['user_roomid']}'");
  921. $r = $groom->fetch_assoc();
  922. return $r['room_name'];
  923. }
  924. function boomMerge($a, $b){
  925. $c = $a . '_' . $b;
  926. return trim($c);
  927. }
  928. function clearNotifyAction($id, $type){
  929. global $mysqli;
  930. $mysqli->query("DELETE FROM boom_notification WHERE notified = '$id' AND notify_source = '$type'");
  931. }
  932. function setToken(){
  933. global $cody;
  934. if(!empty($_SESSION[BOOM_PREFIX . 'token'])){
  935. $_SESSION[BOOM_PREFIX . 'token'] = $_SESSION[BOOM_PREFIX . 'token'];
  936. return $_SESSION[BOOM_PREFIX . 'token'];
  937. }
  938. else {
  939. $session = md5(rand(000000,999999));
  940. $_SESSION[BOOM_PREFIX . 'token'] = $session;
  941. return $session;
  942. }
  943. }
  944. function boomDuplicateIp($val){
  945. global $mysqli, $data, $cody;
  946. $dupli = $mysqli->query("SELECT * FROM `boom_banned` WHERE `ip` = '$val'");
  947. if($dupli->num_rows > 0){
  948. return true;
  949. }
  950. }
  951. function checkToken() {
  952. global $cody;
  953. if (!isset($_POST['token']) || !isset($_SESSION[BOOM_PREFIX . 'token']) || empty($_SESSION[BOOM_PREFIX . 'token'])) {
  954. return false;
  955. }
  956. if($_POST['token'] == $_SESSION[BOOM_PREFIX . 'token']){
  957. return true;
  958. }
  959. return false;
  960. }
  961.  
  962. // ranking functions
  963.  
  964. function mutedIcon($user, $c){
  965. global $lang;
  966. if(isMuted($user)){
  967. return '<img title="' . $lang['muted'] . '" class="' . $c . '" src="default_images/actions/muted.svg"/>';
  968. }
  969. else if(isRoomMuted($user)){
  970. return '<img title="' . $lang['muted'] . '" class="' . $c . '" src="default_images/actions/room_muted.svg"/>';
  971. }
  972. else {
  973. return '';
  974. }
  975. }
  976.  
  977. // sex and gender functions
  978.  
  979. function listGender($sex){
  980. global $lang;
  981. $list = '';
  982. $list .= '<option ' . selCurrent($sex, 1) . ' value="1">' . $lang['male'] . '</option>';
  983. $list .= '<option ' . selCurrent($sex, 2) . ' value="2">' . $lang['female'] . '</option>';
  984. $list .= '<option ' . selCurrent($sex, 3) . ' value="3">' . $lang['other'] . '</option>';
  985. return $list;
  986. }
  987. function boomValidGender($sex){
  988. $gender = array(1,2,3);
  989. if(in_array($sex, $gender)){
  990. return true;
  991. }
  992. }
  993. function getGender($s){
  994. global $lang;
  995. switch($s){
  996. case 1:
  997. return $lang['male'];
  998. case 2:
  999. return $lang['female'];
  1000. case 3:
  1001. return $lang['other'];
  1002. default:
  1003. return $lang['not_set'];
  1004. }
  1005. }
  1006. function sex($s){
  1007. global $lang;
  1008. switch($s){
  1009. case 1:
  1010. return 'boy';
  1011. case 2:
  1012. return 'girl';
  1013. case 3:
  1014. return 'nosex';
  1015. default:
  1016. return 'nosex';
  1017. }
  1018. }
  1019.  
  1020. // status functions
  1021.  
  1022. function getStatus($status, $c){
  1023. global $lang;
  1024. switch($status){
  1025. case 2:
  1026. return curStatus($lang['away'], 'away.svg', $c);
  1027. case 3:
  1028. return curStatus($lang['busy'], 'busy.svg', $c);
  1029. default:
  1030. return '';
  1031. }
  1032. }
  1033. function curStatus($txt, $icon, $c){
  1034. return '<img title="' . $txt . '" class="' . $c . '" src="default_images/status/' . $icon . '"/>';
  1035. }
  1036. function listStatus($status){
  1037. global $lang;
  1038. switch($status){
  1039. case 1:
  1040. return statusMenu($lang['online'], 'online.svg');
  1041. case 2:
  1042. return statusMenu($lang['away'], 'away.svg');
  1043. case 3:
  1044. return statusMenu($lang['busy'], 'busy.svg');
  1045. case 6:
  1046. return statusMenu($lang['invisible'], 'invisible.svg');
  1047. default:
  1048. return statusMenu($lang['online'], 'online.svg');
  1049. }
  1050. }
  1051. function statusMenu($txt, $icon){
  1052. return '<div class="status_icon"><img src="default_images/status/' . $icon . '"/></div><div class="status_text">' . $txt . '</div>';
  1053. }
  1054. function listAllStatus(){
  1055. global $lang, $data, $cody;
  1056. $list = '';
  1057. $list .= statusBox(1, listStatus(1));
  1058. $list .= statusBox(2, listStatus(2));
  1059. $list .= statusBox(3, listStatus(3));
  1060. if(canInvisible()){
  1061. $list .= statusBox(6, listStatus(6));
  1062. }
  1063. return $list;
  1064. }
  1065. function statusBox($value, $content){
  1066. return '<div class="status_option" data="' . $value . '">' . $content . '</div>';
  1067. }
  1068.  
  1069. // system ranking functions
  1070.  
  1071. function rankIcon($list, $type){
  1072. if(isBot($list)){
  1073. return botRank($type);
  1074. }
  1075. else if(haveRole($list['user_role']) && !isStaff($list['user_rank'])){
  1076. return roomRank($list['user_role'], $type);
  1077. }
  1078. else {
  1079. return systemRank($list['user_rank'], $type);
  1080. }
  1081. }
  1082. function botRank($type){
  1083. global $lang;
  1084. return curRanking($type, $lang['user_bot'], 'bot.svg');
  1085. }
  1086. function systemRank($rank, $type){
  1087. global $lang;
  1088. switch($rank){
  1089. case 0:
  1090. return curRanking($type, $lang['guest'], 'owner.jpg');
  1091. case 1:
  1092. return curRanking($type, $lang['user'], 'user.png');
  1093.  
  1094. case 2:
  1095. return curRanking($type, $lang['vip'], 'vip.png');
  1096. case 8:
  1097. return curRanking($type, $lang['mod'], 'mod.png');
  1098. case 9:
  1099. return curRanking($type, $lang['admin'], 'admin.png');
  1100. case 10:
  1101. return curRanking($type, $lang['super_admin'], 'super.png');
  1102. case 11:
  1103. return curRanking($type, $lang['owner'], 'guest.png');
  1104. default:
  1105. return '';
  1106. }
  1107. }
  1108. function proRanking($user, $type){
  1109. global $lang;
  1110. if(isBot($user)){
  1111. return proRank($type, $lang['user_bot'], 'bot.svg');
  1112. }
  1113. else {
  1114. switch($user['user_rank']){
  1115. case 0:
  1116. return proRank($type, $lang['guest'], 'guest.svg');
  1117. case 1:
  1118. return proRank($type, $lang['user'], 'user.svg');
  1119. case 2:
  1120. return proRank($type, $lang['vip'], 'vip.png');
  1121. case 8:
  1122. return proRank($type, $lang['mod'], 'mod.png');
  1123. case 9:
  1124. return proRank($type, $lang['admin'], 'admin.png');
  1125. case 10:
  1126. return proRank($type, $lang['super_admin'], 'super.png');
  1127. case 11:
  1128. return proRank($type, $lang['owner'], 'owner.jpg');
  1129. default:
  1130. return '';
  1131. }
  1132. }
  1133. }
  1134. function roomRank($rank, $type){
  1135. global $lang;
  1136. switch($rank){
  1137. case 6:
  1138. return curRanking($type, $lang['r_owner'], 'room_owner.svg');
  1139. case 5:
  1140. return curRanking($type, $lang['r_admin'], 'room_admin.svg');
  1141. case 4:
  1142. return curRanking($type, $lang['r_mod'], 'room_mod.svg');
  1143. }
  1144. }
  1145. function curRanking($type, $txt, $icon){
  1146. return '<img src="default_images/rank/' . $icon . '" class="' . $type . '" title="' . $txt . '"/>';
  1147. }
  1148. function proRank($type, $txt, $icon){
  1149. return '<img src="default_images/rank/' . $icon . '" class="' . $type . '"/> ' . $txt;
  1150. }
  1151.  
  1152. function getRank($rank){
  1153. global $lang;
  1154. switch($rank){
  1155. case 0:
  1156. return $lang['guest'];
  1157. case 1:
  1158. return $lang['user'];
  1159. case 2:
  1160. return $lang['vip'];
  1161. case 8:
  1162. return $lang['mod'];
  1163. case 9:
  1164. return $lang['admin'];
  1165. case 10:
  1166. return $lang['super_admin'];
  1167. case 11:
  1168. return $lang['owner'];
  1169. default:
  1170. return $lang['user'];
  1171. }
  1172. }
  1173. function roomTitle($rank){
  1174. global $lang;
  1175. switch($rank){
  1176. case 6:
  1177. return $lang['r_owner'];
  1178. case 5:
  1179. return $lang['r_admin'];
  1180. case 4:
  1181. return $lang['r_mod'];
  1182. default:
  1183. return $lang['user'];
  1184. }
  1185. }
  1186. function listRank($current, $req = 0){
  1187. global $lang, $data;
  1188. $rank = '';
  1189. if($req == 1){
  1190. $rank .= '<option value="0" ' . selCurrent($current, 0) . '>' . $lang['guest'] . '</option>';
  1191. }
  1192. $rank .= '<option value="1" ' . selCurrent($current, 1) . '>' . $lang['user'] . '</option>';
  1193. $rank .= '<option value="2" ' . selCurrent($current, 2) . '>' . $lang['vip'] . '</option>';
  1194. $rank .= '<option value="8" ' . selCurrent($current, 8) . '>' . $lang['mod'] . '</option>';
  1195. $rank .= '<option value="9" ' . selCurrent($current, 9) . '>' . $lang['admin'] . '</option>';
  1196. $rank .= '<option value="10" ' . selCurrent($current, 10) . '>' . $lang['super_admin'] . '</option>';
  1197. $rank .= '<option value="11" ' . selCurrent($current, 11) . '>' . $lang['owner'] . '</option>';
  1198. return $rank;
  1199. }
  1200. function changeRank($current){
  1201. global $lang, $data;
  1202. $rank = '';
  1203. if(boomAllow(9)){
  1204. $rank .= '<option value="1" ' . selCurrent($current, 1) . '>' . $lang['user'] . '</option>';
  1205. $rank .= '<option value="2" ' . selCurrent($current, 2) . '>' . $lang['vip'] . '</option>';
  1206. $rank .= '<option value="8" ' . selCurrent($current, 8) . '>' . $lang['mod'] . '</option>';
  1207. }
  1208. if(boomAllow(10)){
  1209. $rank .= '<option value="9" ' . selCurrent($current, 9) . '>' . $lang['admin'] . '</option>';
  1210. }
  1211. if(boomAllow(11)){
  1212. $rank .= '<option value="10" ' . selCurrent($current, 10) . '>' . $lang['super_admin'] . '</option>';
  1213. }
  1214. return $rank;
  1215. }
  1216. function listRoomRank($current = 0){
  1217. global $lang, $data;
  1218. $rank = '';
  1219. $rank .= '<option value="0" ' . selCurrent($current, 0) . '>' . $lang['none'] . '</option>';
  1220. $rank .= '<option value="4" ' . selCurrent($current, 4) . '>' . $lang['r_mod'] . '</option>';
  1221. $rank .= '<option value="5" ' . selCurrent($current, 5) . '>' . $lang['r_admin'] . '</option>';
  1222. if(boomAllow(9)){
  1223. $rank .= '<option value="6" ' . selCurrent($current, 6) . '>' . $lang['r_owner'] . '</option>';
  1224. }
  1225. return $rank;
  1226. }
  1227.  
  1228. // room access ranking functions
  1229.  
  1230. function roomRanking($rank = 0){
  1231. global $lang;
  1232. $room_menu = '<option value="0" ' . selCurrent($rank, 0) . '>' . $lang['public'] . '</option>';
  1233.  
  1234. if(boomAllow(1)){
  1235. $room_menu .= '<option value="1" ' . selCurrent($rank, 1) . '>' . $lang['members'] . '</option>';
  1236. }
  1237. if(boomAllow(2)){
  1238. $room_menu .= '<option value="2" ' . selCurrent($rank, 2) . '>' . $lang['vip'] . '</option>';
  1239. }
  1240. if(boomAllow(8)){
  1241. $room_menu .= '<option value="8" ' . selCurrent($rank, 8) . '>' . $lang['staff'] . '</option>';
  1242. }
  1243. if(boomAllow(9)){
  1244. $room_menu .= '<option value="9" ' . selCurrent($rank, 9) . '>' . $lang['admin'] . '</option>';
  1245. }
  1246. return $room_menu;
  1247. }
  1248. function roomIcon($room, $type){
  1249. global $lang;
  1250. switch($room['access']){
  1251. case 0:
  1252. return roomIconTemplate($type, $lang['public'], 'public_room.svg');
  1253. case 3:
  1254. return roomIconTemplate($type, $lang['egypt'], 'public_room.svg');
  1255. case 4:
  1256. return roomIconTemplate($type, $lang['Tunisia'], 'public_room.svg');
  1257. case 5:
  1258. return roomIconTemplate($type, $lang['Iraq'], 'public_room.svg');
  1259.  
  1260. case 6:
  1261. return roomIconTemplate($type, $lang['Palestine'], 'public_room.svg');
  1262.  
  1263. case 7:
  1264. return roomIconTemplate($type, $lang['Algeria'], 'public_room.svg');
  1265.  
  1266. case 1:
  1267. return roomIconTemplate($type, $lang['members'], 'member_room.svg');
  1268. case 2:
  1269. return roomIconTemplate($type, $lang['vip'], 'vip_room.svg');
  1270. case 8:
  1271. return roomIconTemplate($type, $lang['staff'], 'staff_room.svg');
  1272. case 9:
  1273. return roomIconTemplate($type, $lang['admin'], 'admin_room.svg');
  1274. default:
  1275. return roomIconTemplate($type, $lang['public'], 'public_room.svg');
  1276. }
  1277. }
  1278. function roomIconTemplate($type, $txt, $icon){
  1279. global $data;
  1280. return '<img title="' . $txt . '" class="' . $type . '" src="' . $data['domain'] . '/default_images/rooms/' . $icon . '">';
  1281. }
  1282. function roomAccessTitle($room){
  1283. global $lang;
  1284. switch($room['access']){
  1285. case 0:
  1286. return $lang['public'];
  1287. case 1:
  1288. return $lang['members'];
  1289. case 2:
  1290. return $lang['vip'];
  1291. case 8:
  1292. return $lang['staff'];
  1293. case 9:
  1294. return $lang['admin'];
  1295. case 3:
  1296. return $lang['egypt'];
  1297.  
  1298. case 4:
  1299. return $lang['Tunisia'];
  1300.  
  1301. case 5:
  1302. return $lang['Iraq'];
  1303.  
  1304. case 6:
  1305. return $lang['Palestine'];
  1306.  
  1307. case 7:
  1308. return $lang['Algeria'];
  1309.  
  1310. default:
  1311. return $lang['public'];
  1312. }
  1313. }
  1314. function roomLock($room, $type){
  1315. global $data, $lang;
  1316. if($room['password'] != ''){
  1317. return '<img title="' . $lang['password'] . '" class="' . $type . '" src="' . $data['domain'] . '/default_images/rooms/locked_room.svg">';
  1318. }
  1319. }
  1320.  
  1321. // permission functions
  1322.  
  1323. function canEditRoom(){
  1324. if(boomRole(6) || boomAllow(9)){
  1325. return true;
  1326. }
  1327. }
  1328. function canManageRoom(){
  1329. if(boomRole(4) || boomAllow(9)){
  1330. return true;
  1331. }
  1332. }
  1333. function canUpload(){
  1334. global $data;
  1335. if(boomAllow($data['allow_image'])){
  1336. return true;
  1337. }
  1338. }
  1339. function canCover(){
  1340. global $data;
  1341. if(boomAllow($data['allow_cover'])){
  1342. return true;
  1343. }
  1344. }
  1345. function canGifCover(){
  1346. global $data;
  1347. if(boomAllow($data['allow_gcover'])){
  1348. return true;
  1349. }
  1350. }
  1351. function canPrivate(){
  1352. global $data;
  1353. if(boomAllow($data['allow_private'])){
  1354. return true;
  1355. }
  1356. }
  1357. function userCanPrivate($user){
  1358. global $data;
  1359. if(userBoomAllow($user, $data['allow_private'])){
  1360. return true;
  1361. }
  1362. }
  1363. function canRoom(){
  1364. global $data;
  1365. if(boomAllow($data['allow_room'])){
  1366. return true;
  1367. }
  1368. }
  1369. function canPlayer(){
  1370. global $data;
  1371. if(boomAllow($data['allow_player'])){
  1372. return true;
  1373. }
  1374. }
  1375. function canEmo(){
  1376. global $data;
  1377. if(boomAllow($data['emo_plus'])){
  1378. return true;
  1379. }
  1380. }
  1381. function canName(){
  1382. global $data;
  1383. if(boomAllow($data['allow_name'])){
  1384. return true;
  1385. }
  1386. }
  1387. function canDirect(){
  1388. global $data;
  1389. if(boomAllow($data['allow_direct'])){
  1390. return true;
  1391. }
  1392. }
  1393. function userCanDirect($user){
  1394. global $data;
  1395. if(userBoomAllow($user, $data['allow_direct'])){
  1396. return true;
  1397. }
  1398. }
  1399. function canColor(){
  1400. global $data;
  1401. if(boomAllow($data['allow_colors'])){
  1402. return true;
  1403. }
  1404. }
  1405. function canGrad(){
  1406. global $data;
  1407. if(boomAllow($data['allow_grad'])){
  1408. return true;
  1409. }
  1410. }
  1411. function canMood(){
  1412. global $data;
  1413. if(boomAllow($data['allow_mood'])){
  1414. return true;
  1415. }
  1416. }
  1417. function canVerify(){
  1418. global $data;
  1419. if(boomAllow($data['allow_verify'])){
  1420. return true;
  1421. }
  1422. }
  1423. function canHistory(){
  1424. global $data;
  1425. if(boomAllow($data['allow_history'])){
  1426. return true;
  1427. }
  1428. }
  1429. function canAvatar(){
  1430. global $data;
  1431. if(boomAllow($data['allow_avatar'])){
  1432. return true;
  1433. }
  1434. }
  1435. function canTheme(){
  1436. global $data;
  1437. if(boomAllow($data['allow_theme'])){
  1438. return true;
  1439. }
  1440. }
  1441. function canNameColor(){
  1442. global $data;
  1443. if(boomAllow($data['allow_name_color'])){
  1444. return true;
  1445. }
  1446. }
  1447. function canNameGrad(){
  1448. global $data;
  1449. if(boomAllow($data['allow_name_grad'])){
  1450. return true;
  1451. }
  1452. }
  1453. function canInvisible(){
  1454. global $data, $cody;
  1455. if(boomAllow($cody['can_invisible'])){
  1456. return true;
  1457. }
  1458. }
  1459. function canPostNews(){
  1460. global $data, $cody;
  1461. if(boomAllow($cody['can_post_news'])){
  1462. return true;
  1463. }
  1464. }
  1465. function canModifyAvatar($user){
  1466. global $data, $cody;
  1467. if(!empty($user) && canAvatar() && canEditUser($user, $cody['can_modify_avatar'])){
  1468. return true;
  1469. }
  1470. }
  1471. function canModifyCover($user){
  1472. global $data, $cody;
  1473. if(!empty($user) && canCover() && canEditUser($user, $cody['can_modify_cover'])){
  1474. return true;
  1475. }
  1476. }
  1477. function canModifyName($user){
  1478. global $data, $cody;
  1479. if(!empty($user) && canName() && canEditUser($user, $cody['can_modify_name'])){
  1480. return true;
  1481. }
  1482. }
  1483. function canModifyMood($user){
  1484. global $data, $cody;
  1485. if(!empty($user) && canMood() && canEditUser($user, $cody['can_modify_mood'])){
  1486. return true;
  1487. }
  1488. }
  1489. function canModifyAbout($user){
  1490. global $data, $cody;
  1491. if(!empty($user) && canEditUser($user, $cody['can_modify_about'])){
  1492. return true;
  1493. }
  1494. }
  1495. function canModifyEmail($user){
  1496. global $data, $cody;
  1497. if(!empty($user) && isMember($user) && isSecure($user) && canEditUser($user, $cody['can_modify_email'], 1)){
  1498. return true;
  1499. }
  1500. }
  1501. function canModifyColor($user){
  1502. global $data, $cody;
  1503. if(!empty($user) && canNameColor() && canEditUser($user, $cody['can_modify_color'])){
  1504. return true;
  1505. }
  1506. }
  1507. function canModifyPassword($user){
  1508. global $data, $cody;
  1509. if(!empty($user) && isMember($user) && isSecure($user) && canEditUser($user, $cody['can_modify_password'], 1)){
  1510. return true;
  1511. }
  1512. }
  1513. function canUserHistory($user){
  1514. global $data, $cody;
  1515. if(!empty($user) && canEditUser($user, $cody['can_view_history'], 1)){
  1516. return true;
  1517. }
  1518. }
  1519. function canViewTimezone($user){
  1520. global $data, $cody;
  1521. if(canEditUser($user, $cody['can_view_timezone'], 1)){
  1522. return true;
  1523. }
  1524. }
  1525. function canViewEmail($user){
  1526. global $data, $cody;
  1527. if(userHaveEmail($user) && canEditUser($user, $cody['can_view_email'], 1)){
  1528. return true;
  1529. }
  1530. }
  1531. function canViewId($user){
  1532. global $data, $cody;
  1533. if(canEditUser($user, $cody['can_view_id'], 1)){
  1534. return true;
  1535. }
  1536. }
  1537. function canViewIp($user){
  1538. global $data, $cody;
  1539. if(canEditUser($user, $cody['can_view_ip'], 1)){
  1540. return true;
  1541. }
  1542. }
  1543. function canRoomPassword(){
  1544. global $data, $cody;
  1545. if(boomAllow($cody['can_room_pass']) || boomRole(6)){
  1546. return true;
  1547. }
  1548. }
  1549. function canBan(){
  1550. global $data, $cody;
  1551. if(boomAllow($cody['can_ban'])){
  1552. return true;
  1553. }
  1554. }
  1555. function canBanUser($user){
  1556. global $data, $cody;
  1557. if(!empty($user) && canEditUser($user, $cody['can_ban'], 1)){
  1558. return true;
  1559. }
  1560. }
  1561. function canKick(){
  1562. global $data, $cody;
  1563. if(boomAllow($cody['can_kick'])){
  1564. return true;
  1565. }
  1566. }
  1567. function canKickUser($user){
  1568. global $data, $cody;
  1569. if(!empty($user) && canEditUser($user, $cody['can_kick'], 1)){
  1570. return true;
  1571. }
  1572. }
  1573. function canDeleteNews(){
  1574. global $data, $cody;
  1575. if(boomAllow(11)){
  1576. return true;
  1577. }
  1578. }
  1579. function canDeleteWall(){
  1580. global $data, $cody;
  1581. if(boomAllow(8)){
  1582. return true;
  1583. }
  1584. }
  1585. function canDeleteLog(){
  1586. global $data, $cody;
  1587. if(boomAllow(8)){
  1588. return true;
  1589. }
  1590. }
  1591. function canDeleteRoomLog(){
  1592. global $data, $cody;
  1593. if(boomRole(4)){
  1594. return true;
  1595. }
  1596. }
  1597. function canClearRoom(){
  1598. global $data, $cody;
  1599. if(boomAllow(8) || boomRole(5)){
  1600. return true;
  1601. }
  1602. }
  1603.  
  1604. // DO NOT MODIFY THE MUTE PERMISSION THIS WILL MAKE CONFLICT IN THE SYSTEM.
  1605.  
  1606. function canMute(){
  1607. global $data, $cody;
  1608. if(boomAllow(8)){
  1609. return true;
  1610. }
  1611. }
  1612. function canMuteUser($user){
  1613. global $data, $cody;
  1614. if(!empty($user) && canEditUser($user, 8, 1)){
  1615. return true;
  1616. }
  1617. }
  1618. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement