Advertisement
Guest User

Untitled

a guest
Jul 28th, 2019
351
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 11.20 KB | None | 0 0
  1. <?php
  2.  
  3. class Xbot
  4. {
  5. static public function get_ip($proxy)
  6. {
  7. $ip = "";
  8.  
  9. if(getenv('HTTP_CLIENT_IP'))
  10. $ip = getenv('HTTP_CLIENT_IP');
  11. else if(getenv('HTTP_X_FORWARDED'))
  12. $ip = getenv('HTTP_X_FORWARDED');
  13. else if(getenv('HTTP_FORWARDED_FOR'))
  14. $ip = getenv('HTTP_FORWARDED_FOR');
  15. else if(getenv('HTTP_FORWARDED'))
  16. $ip = getenv('HTTP_FORWARDED');
  17. else if(getenv('REMOTE_ADDR') && !$proxy)
  18. $ip = getenv('REMOTE_ADDR');
  19. else if(getenv('HTTP_X_FORWARDED_FOR') && $proxy)
  20. {
  21. $ip_exploded = explode(',', getenv('HTTP_X_FORWARDED_FOR'));
  22. if(count($ip_exploded) > 1) $ip = $ip_exploded[1];
  23. else $ip = $ip_exploded[0];
  24. }
  25.  
  26. return $ip;
  27. }
  28.  
  29. static private function tip_of_words($num, $for1, $for234, $for_others)
  30. {
  31. $text = " ".$num." ";
  32. if($num == 1)
  33. return $text.$for1;
  34. elseif(in_array($num%10, array(2,3,4)))
  35. return $text.$for234;
  36. else return $text.$for_others;
  37. }
  38.  
  39. static public function convert_time($seconds)
  40. {
  41. global $language;
  42. $lang = $language['ends_of_words'];
  43.  
  44. $text = "";
  45. $uptime['d']=floor($seconds / 86400);
  46. $uptime['h']=floor(($seconds - ($uptime['d'] * 86400)) / 3600);
  47. $uptime['m']=floor(($seconds - (($uptime['d'] * 86400)+($uptime['h']*3600))) / 60);
  48.  
  49. if($uptime['d'] != 0)
  50. $text .= self::tip_of_words($uptime['d'], 'dzień', 'dni', 'dni');
  51. if($uptime['h'] != 0)
  52. $text .= self::tip_of_words($uptime['h'], 'godzina', 'godziny', 'godzin');
  53. if($uptime['m'] != 0)
  54. $text .= self::tip_of_words($uptime['m'], 'minuta', 'minuty', 'minut');
  55.  
  56. return ($text == "" ? "Poniżej jednej minuty" : $text);
  57. }
  58.  
  59. static public function get_country($country_code, $full=true)
  60. {
  61. $flags = array
  62. (
  63. 'ae' => 'https://i.imgur.com/OrRDuBP.png',
  64. 'af' => 'https://i.imgur.com/LYb8xj3.png',
  65. 'al' => 'https://i.imgur.com/7E6TfMf.png',
  66. 'ar' => 'https://i.imgur.com/ktqTuwk.png',
  67. 'at' => 'https://i.imgur.com/Tx698hJ.png',
  68. 'au' => 'https://i.imgur.com/rzBBSbu.png',
  69. 'ba' => 'https://i.imgur.com/4H1ou92.png',
  70. 'bb' => 'https://i.imgur.com/TJ4KLvk.png',
  71. 'bd' => 'https://i.imgur.com/OpK1yj6.png',
  72. 'be' => 'https://i.imgur.com/c7SAE54.png',
  73. 'bg' => 'https://i.imgur.com/QQlLePt.png',
  74. 'bo' => 'https://i.imgur.com/NrSA0Gs.png',
  75. 'br' => 'https://i.imgur.com/n3dgrtZ.png',
  76. 'by' => 'https://i.imgur.com/papb3mk.png',
  77. 'ca' => 'https://i.imgur.com/ScvifXf.png',
  78. 'ch' => 'https://i.imgur.com/DVwEz2J.png',
  79. 'cn' => 'https://i.imgur.com/Uw3YwAi.png',
  80. 'co' => 'https://i.imgur.com/4drTp2W.png',
  81. 'cy' => 'https://i.imgur.com/h0gWPnq.png',
  82. 'cz' => 'https://i.imgur.com/NvtVqnB.png',
  83. 'de' => 'https://i.imgur.com/rweop3l.png',
  84. 'dk' => 'https://i.imgur.com/ZQQju3Z.png',
  85. 'dz' => 'https://i.imgur.com/KVgCqUP.png',
  86. 'ec' => 'https://i.imgur.com/4drTp2W.png',
  87. 'ee' => 'https://i.imgur.com/szSbp9P.png',
  88. 'eg' => 'https://i.imgur.com/bon12O9.png',
  89. 'es' => 'https://i.imgur.com/49CXRfp.png',
  90. 'fi' => 'https://i.imgur.com/cQ9uAlu.png',
  91. 'fr' => 'https://i.imgur.com/anOHYez.png',
  92. 'gb' => 'https://i.imgur.com/lbwisgw.png',
  93. 'gr' => 'https://i.imgur.com/NOGPPg4.png',
  94. 'hr' => 'https://i.imgur.com/xjF247h.png',
  95. 'hu' => 'https://i.imgur.com/SYL0jN0.png',
  96. 'id' => 'https://i.imgur.com/8AVva6u.png',
  97. 'ie' => 'https://i.imgur.com/7l6T5B1.png',
  98. 'il' => 'https://i.imgur.com/WFLru5C.png',
  99. 'in' => 'https://i.imgur.com/o7euxxV.png',
  100. 'iq' => 'https://i.imgur.com/10Y7wHc.png',
  101. 'ir' => 'https://i.imgur.com/fLXsNKy.png',
  102. 'it' => 'https://i.imgur.com/CGJPNox.png',
  103. 'jp' => 'https://i.imgur.com/PJqmyyd.png',
  104. 'kn' => 'https://i.imgur.com/btG2IvM.png',
  105. 'kp' => 'https://i.imgur.com/NzcVRf0.png',
  106. 'lr' => 'https://i.imgur.com/fPwjX7C.png',
  107. 'lt' => 'https://i.imgur.com/qt9sEpv.png',
  108. 'lv' => 'https://i.imgur.com/8Kkadkt.png',
  109. 'mc' => 'https://i.imgur.com/8AVva6u.png',
  110. 'md' => 'https://i.imgur.com/whRDzlm.png',
  111. 'mx' => 'https://i.imgur.com/2x5g2HT.png',
  112. 'nl' => 'https://i.imgur.com/sNak9l2.png',
  113. 'no' => 'https://i.imgur.com/f8pxNMV.png',
  114. 'nz' => 'https://i.imgur.com/rzBBSbu.png',
  115. 'ph' => 'https://i.imgur.com/mgUY16d.png',
  116. 'pk' => 'https://i.imgur.com/bALSJej.png',
  117. 'pl' => 'https://i.imgur.com/gJM8pyx.png',
  118. 'pt' => 'https://i.imgur.com/pk01TS5.png',
  119. 'py' => 'https://i.imgur.com/xjF247h.png',
  120. 'ro' => 'https://i.imgur.com/whRDzlm.png',
  121. 'ru' => 'https://i.imgur.com/j8Ffh8l.png',
  122. 'sa' => 'https://i.imgur.com/VuaOAeb.png',
  123. 'se' => 'https://i.imgur.com/Dts9QCD.png',
  124. 'si' => 'https://i.imgur.com/O15LkX8.png',
  125. 'sk' => 'https://i.imgur.com/SSfbe03.png',
  126. 'tn' => 'https://i.imgur.com/THjtWOo.png',
  127. 'ua' => 'https://i.imgur.com/P9nW7Zx.png',
  128. 'us' => 'https://i.imgur.com/aPcZ6GF.png',
  129. 'vn' => 'https://i.imgur.com/Zmnr9ME.png',
  130. );
  131.  
  132. $countries = array
  133. (
  134. 'ae' => 'Zjednoczone Emiraty Arabskie',
  135. 'af' => 'Afganistan',
  136. 'al' => 'Albania',
  137. 'ar' => 'Argentyna',
  138. 'at' => 'Austria',
  139. 'au' => 'Australia',
  140. 'ba' => 'Bośnia i Hercegowina',
  141. 'bb' => 'Barbados',
  142. 'bd' => 'Bangladesz',
  143. 'be' => 'Belgia',
  144. 'bg' => 'Bułgaria',
  145. 'bo' => 'Boliwia',
  146. 'br' => 'Brazylia',
  147. 'by' => 'Białoruś',
  148. 'ca' => 'Kanada',
  149. 'ch' => 'Szwajcaria',
  150. 'cn' => 'Chiny',
  151. 'co' => 'Kolumbia',
  152. 'cy' => 'Cypr',
  153. 'cz' => 'Czechy',
  154. 'de' => 'Niemcy',
  155. 'dk' => 'Dania',
  156. 'dz' => 'Algieria',
  157. 'ec' => 'Ekwador',
  158. 'ee' => 'Estonia',
  159. 'eg' => 'Egipt',
  160. 'es' => 'Hiszpania',
  161. 'fi' => 'Finlandia',
  162. 'fr' => 'Francja',
  163. 'gb' => 'Wielka Brytania',
  164. 'gr' => 'Grecja',
  165. 'hr' => 'Chorwacja',
  166. 'hu' => 'Węgry',
  167. 'id' => 'Indonezja',
  168. 'ie' => 'Irlandia',
  169. 'il' => 'Izrael',
  170. 'in' => 'Indie',
  171. 'iq' => 'Irak',
  172. 'ir' => 'Iran',
  173. 'it' => 'Włochy',
  174. 'jp' => 'Japonia',
  175. 'kn' => 'Saint Kitts i Nevis',
  176. 'kp' => 'Korea Północna',
  177. 'lr' => 'Liberia',
  178. 'lt' => 'Litwa',
  179. 'lv' => 'Łotwa',
  180. 'mc' => 'Monako',
  181. 'md' => 'Mołdawia',
  182. 'mx' => 'Meksyk',
  183. 'nl' => 'Holandia',
  184. 'no' => 'Norwegia',
  185. 'nz' => 'Nowa Zelandia',
  186. 'ph' => 'Filipiny',
  187. 'pk' => 'Pakistan',
  188. 'pl' => 'Polska',
  189. 'pt' => 'Portugalia',
  190. 'py' => 'Paragwaj',
  191. 'ro' => 'Rumunia',
  192. 'ru' => 'Rosja',
  193. 'sa' => 'Arabia Saudyjska',
  194. 'se' => 'Szwecja',
  195. 'si' => 'Słowenia',
  196. 'sk' => 'Słowacja',
  197. 'tn' => 'Tunezja',
  198. 'ua' => 'Ukraina',
  199. 'us' => 'Stany Zjednoczone',
  200. 'vn' => 'Wietnam',
  201. );
  202.  
  203. if(!isset($flags[strtolower($country_code)]))
  204. return '';
  205. else
  206. return ($full ? '<span>'.$countries[strtolower($country_code)].'</span><img class="pull-left" style="margin-right:5px;" src="'.$flags[strtolower($country_code)].'" style="width:16px;height:11px;">' : '<div class="flag-icon pull-right"><img src="'.$flags[strtolower($country_code)].'" style="width:16px;height:11px;"></div>');
  207. }
  208.  
  209. static function get_preview($channels, $clients, $parent_id=-1, $prefix=0)
  210. {
  211. global $query_sql;
  212.  
  213. $channels_tree = "";
  214.  
  215. foreach($channels as $channel)
  216. {
  217. if($parent_id == -1 || $channel['cid'] == $parent_id)
  218. {
  219. $channel['channel_name'] = htmlentities($channel['channel_name'], ENT_QUOTES, "UTF-8");
  220. $channel['channel_topic'] = htmlentities($channel['channel_topic'], ENT_QUOTES, "UTF-8");
  221.  
  222. if($channel['channel_maxclients'] != -1 && $channel['total_clients'] >= $channel['channel_maxclients'])
  223. $ch_icon = "ch_red_sub";
  224. else if($channel['channel_flag_password'] == 1)
  225. $ch_icon = "ch_yellow_sub";
  226. else
  227. $ch_icon = "ch_green_sub";
  228.  
  229. $on_click = 'onclick="show_channel_info(\''.$channel['channel_name'].'\',\''.$channel['cid'].'\',\''.$channel['channel_topic'].'\',\''.$channel['channel_codec'].'\',\''.$channel['channel_codec_quality'].'\');"';
  230.  
  231. if(strpos($channel['channel_name'], "cspacer") !== False && $channel['pid'] == 0)
  232. {
  233. $channel['channel_name'] = explode(']', $channel['channel_name']);
  234.  
  235. if(count($channel['channel_name']) > 2)
  236. for($i=2; $i<count($channel['channel_name']); $i++)
  237. $channel['channel_name'][1] .= "]".$channel['channel_name'][$i];
  238.  
  239. $channels_tree .= '<div class="ts-channel cspacer" '.$on_click.'>'.$channel['channel_name'][1].'</div>';
  240. }
  241. elseif(strpos($channel['channel_name'], "rspacer") !== False && $channel['pid'] == 0)
  242. {
  243. $channel['channel_name'] = explode(']', $channel['channel_name']);
  244.  
  245. if(count($channel['channel_name']) > 2)
  246. for($i=2; $i<count($channel['channel_name']); $i++)
  247. $channel['channel_name'][1] .= "]".$channel['channel_name'][$i];
  248.  
  249. $channels_tree .= '<div class="ts-channel pull-right" '.$on_click.'>'.$channel['channel_name'][1].'</div><br>';
  250. }
  251. elseif(strpos($channel['channel_name'], "lspacer") !== False && $channel['pid'] == 0)
  252. {
  253. $channel['channel_name'] = explode(']', $channel['channel_name']);
  254.  
  255. if(count($channel['channel_name']) > 2)
  256. for($i=2; $i<count($channel['channel_name']); $i++)
  257. $channel['channel_name'][1] .= "]".$channel['channel_name'][$i];
  258.  
  259. $channels_tree .= '<div class="ts-channel" '.$on_click.'>'.$channel['channel_name'][1].'</div>';
  260. }
  261. elseif(strpos($channel['channel_name'], "*spacer") !== False && $channel['pid'] == 0)
  262. {
  263. $channel['channel_name'] = explode(']', $channel['channel_name']);
  264.  
  265. if(count($channel['channel_name']) > 2)
  266. for($i=2; $i<count($channel['channel_name']); $i++)
  267. $channel['channel_name'][1] .= "]".$channel['channel_name'][$i];
  268.  
  269. $channels_tree .= '<div class="ts-channel spacer" '.$on_click.'>';
  270.  
  271. for($i=0; $i<200; $i++)
  272. $channels_tree .= (strpos($channel['channel_name'][1], '-') !== False ? '_' : $channel['channel_name'][1]);
  273.  
  274. $channels_tree .= '</div>';
  275. }
  276. elseif(strpos($channel['channel_name'], "spacer") !== False && $channel['pid'] == 0)
  277. {
  278. $channel['channel_name'] = explode(']', $channel['channel_name']);
  279.  
  280. if(count($channel['channel_name']) > 2)
  281. for($i=2; $i<count($channel['channel_name']); $i++)
  282. $channel['channel_name'][1] .= "]".$channel['channel_name'][$i];
  283.  
  284. $channels_tree .= '<div class="ts-channel" '.$on_click.'>'.$channel['channel_name'][1].'</div>';
  285. }
  286. else
  287. $channels_tree .= '<div class="ts-channel" '.$on_click.' style="margin-left: '.$prefix.'px"><img class="ts-icon" src="img/icons/'.$ch_icon.'.svg" alt="'.$ch_icon.'">'.$channel['channel_name'].($channel['channel_flag_password'] == 1 ? '<img class="ts-icon pull-right" src="img/icons/register.svg" alt="register">' : '' ).'</div>';
  288.  
  289. if(isset($channel['total_clients']) && $channel['total_clients'] > 0)
  290. foreach($clients as $client)
  291. if($client['cid'] == $channel['cid'] && $client['client_type'] != 1)
  292. {
  293. if($client['client_away'])
  294. $cli_icon = "away";
  295. elseif($client['client_output_muted'])
  296. $cli_icon = "output_muted";
  297. elseif(!$client['client_output_hardware'])
  298. $cli_icon = "hardware_output_muted";
  299. elseif(!$client['client_input_hardware'])
  300. $cli_icon = "hardware_input_muted";
  301. elseif($client['client_input_muted'])
  302. $cli_icon = "input_muted";
  303. ..................................................................
  304. ........................................
  305. ............
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement