Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- class Xbot
- {
- static public function get_ip($proxy)
- {
- $ip = "";
- if(getenv('HTTP_CLIENT_IP'))
- $ip = getenv('HTTP_CLIENT_IP');
- else if(getenv('HTTP_X_FORWARDED'))
- $ip = getenv('HTTP_X_FORWARDED');
- else if(getenv('HTTP_FORWARDED_FOR'))
- $ip = getenv('HTTP_FORWARDED_FOR');
- else if(getenv('HTTP_FORWARDED'))
- $ip = getenv('HTTP_FORWARDED');
- else if(getenv('REMOTE_ADDR') && !$proxy)
- $ip = getenv('REMOTE_ADDR');
- else if(getenv('HTTP_X_FORWARDED_FOR') && $proxy)
- {
- $ip_exploded = explode(',', getenv('HTTP_X_FORWARDED_FOR'));
- if(count($ip_exploded) > 1) $ip = $ip_exploded[1];
- else $ip = $ip_exploded[0];
- }
- return $ip;
- }
- static private function tip_of_words($num, $for1, $for234, $for_others)
- {
- $text = " ".$num." ";
- if($num == 1)
- return $text.$for1;
- elseif(in_array($num%10, array(2,3,4)))
- return $text.$for234;
- else return $text.$for_others;
- }
- static public function convert_time($seconds)
- {
- global $language;
- $lang = $language['ends_of_words'];
- $text = "";
- $uptime['d']=floor($seconds / 86400);
- $uptime['h']=floor(($seconds - ($uptime['d'] * 86400)) / 3600);
- $uptime['m']=floor(($seconds - (($uptime['d'] * 86400)+($uptime['h']*3600))) / 60);
- if($uptime['d'] != 0)
- $text .= self::tip_of_words($uptime['d'], 'dzień', 'dni', 'dni');
- if($uptime['h'] != 0)
- $text .= self::tip_of_words($uptime['h'], 'godzina', 'godziny', 'godzin');
- if($uptime['m'] != 0)
- $text .= self::tip_of_words($uptime['m'], 'minuta', 'minuty', 'minut');
- return ($text == "" ? "Poniżej jednej minuty" : $text);
- }
- static public function get_country($country_code, $full=true)
- {
- $flags = array
- (
- 'ae' => 'https://i.imgur.com/OrRDuBP.png',
- 'af' => 'https://i.imgur.com/LYb8xj3.png',
- 'al' => 'https://i.imgur.com/7E6TfMf.png',
- 'ar' => 'https://i.imgur.com/ktqTuwk.png',
- 'at' => 'https://i.imgur.com/Tx698hJ.png',
- 'au' => 'https://i.imgur.com/rzBBSbu.png',
- 'ba' => 'https://i.imgur.com/4H1ou92.png',
- 'bb' => 'https://i.imgur.com/TJ4KLvk.png',
- 'bd' => 'https://i.imgur.com/OpK1yj6.png',
- 'be' => 'https://i.imgur.com/c7SAE54.png',
- 'bg' => 'https://i.imgur.com/QQlLePt.png',
- 'bo' => 'https://i.imgur.com/NrSA0Gs.png',
- 'br' => 'https://i.imgur.com/n3dgrtZ.png',
- 'by' => 'https://i.imgur.com/papb3mk.png',
- 'ca' => 'https://i.imgur.com/ScvifXf.png',
- 'ch' => 'https://i.imgur.com/DVwEz2J.png',
- 'cn' => 'https://i.imgur.com/Uw3YwAi.png',
- 'co' => 'https://i.imgur.com/4drTp2W.png',
- 'cy' => 'https://i.imgur.com/h0gWPnq.png',
- 'cz' => 'https://i.imgur.com/NvtVqnB.png',
- 'de' => 'https://i.imgur.com/rweop3l.png',
- 'dk' => 'https://i.imgur.com/ZQQju3Z.png',
- 'dz' => 'https://i.imgur.com/KVgCqUP.png',
- 'ec' => 'https://i.imgur.com/4drTp2W.png',
- 'ee' => 'https://i.imgur.com/szSbp9P.png',
- 'eg' => 'https://i.imgur.com/bon12O9.png',
- 'es' => 'https://i.imgur.com/49CXRfp.png',
- 'fi' => 'https://i.imgur.com/cQ9uAlu.png',
- 'fr' => 'https://i.imgur.com/anOHYez.png',
- 'gb' => 'https://i.imgur.com/lbwisgw.png',
- 'gr' => 'https://i.imgur.com/NOGPPg4.png',
- 'hr' => 'https://i.imgur.com/xjF247h.png',
- 'hu' => 'https://i.imgur.com/SYL0jN0.png',
- 'id' => 'https://i.imgur.com/8AVva6u.png',
- 'ie' => 'https://i.imgur.com/7l6T5B1.png',
- 'il' => 'https://i.imgur.com/WFLru5C.png',
- 'in' => 'https://i.imgur.com/o7euxxV.png',
- 'iq' => 'https://i.imgur.com/10Y7wHc.png',
- 'ir' => 'https://i.imgur.com/fLXsNKy.png',
- 'it' => 'https://i.imgur.com/CGJPNox.png',
- 'jp' => 'https://i.imgur.com/PJqmyyd.png',
- 'kn' => 'https://i.imgur.com/btG2IvM.png',
- 'kp' => 'https://i.imgur.com/NzcVRf0.png',
- 'lr' => 'https://i.imgur.com/fPwjX7C.png',
- 'lt' => 'https://i.imgur.com/qt9sEpv.png',
- 'lv' => 'https://i.imgur.com/8Kkadkt.png',
- 'mc' => 'https://i.imgur.com/8AVva6u.png',
- 'md' => 'https://i.imgur.com/whRDzlm.png',
- 'mx' => 'https://i.imgur.com/2x5g2HT.png',
- 'nl' => 'https://i.imgur.com/sNak9l2.png',
- 'no' => 'https://i.imgur.com/f8pxNMV.png',
- 'nz' => 'https://i.imgur.com/rzBBSbu.png',
- 'ph' => 'https://i.imgur.com/mgUY16d.png',
- 'pk' => 'https://i.imgur.com/bALSJej.png',
- 'pl' => 'https://i.imgur.com/gJM8pyx.png',
- 'pt' => 'https://i.imgur.com/pk01TS5.png',
- 'py' => 'https://i.imgur.com/xjF247h.png',
- 'ro' => 'https://i.imgur.com/whRDzlm.png',
- 'ru' => 'https://i.imgur.com/j8Ffh8l.png',
- 'sa' => 'https://i.imgur.com/VuaOAeb.png',
- 'se' => 'https://i.imgur.com/Dts9QCD.png',
- 'si' => 'https://i.imgur.com/O15LkX8.png',
- 'sk' => 'https://i.imgur.com/SSfbe03.png',
- 'tn' => 'https://i.imgur.com/THjtWOo.png',
- 'ua' => 'https://i.imgur.com/P9nW7Zx.png',
- 'us' => 'https://i.imgur.com/aPcZ6GF.png',
- 'vn' => 'https://i.imgur.com/Zmnr9ME.png',
- );
- $countries = array
- (
- 'ae' => 'Zjednoczone Emiraty Arabskie',
- 'af' => 'Afganistan',
- 'al' => 'Albania',
- 'ar' => 'Argentyna',
- 'at' => 'Austria',
- 'au' => 'Australia',
- 'ba' => 'Bośnia i Hercegowina',
- 'bb' => 'Barbados',
- 'bd' => 'Bangladesz',
- 'be' => 'Belgia',
- 'bg' => 'Bułgaria',
- 'bo' => 'Boliwia',
- 'br' => 'Brazylia',
- 'by' => 'Białoruś',
- 'ca' => 'Kanada',
- 'ch' => 'Szwajcaria',
- 'cn' => 'Chiny',
- 'co' => 'Kolumbia',
- 'cy' => 'Cypr',
- 'cz' => 'Czechy',
- 'de' => 'Niemcy',
- 'dk' => 'Dania',
- 'dz' => 'Algieria',
- 'ec' => 'Ekwador',
- 'ee' => 'Estonia',
- 'eg' => 'Egipt',
- 'es' => 'Hiszpania',
- 'fi' => 'Finlandia',
- 'fr' => 'Francja',
- 'gb' => 'Wielka Brytania',
- 'gr' => 'Grecja',
- 'hr' => 'Chorwacja',
- 'hu' => 'Węgry',
- 'id' => 'Indonezja',
- 'ie' => 'Irlandia',
- 'il' => 'Izrael',
- 'in' => 'Indie',
- 'iq' => 'Irak',
- 'ir' => 'Iran',
- 'it' => 'Włochy',
- 'jp' => 'Japonia',
- 'kn' => 'Saint Kitts i Nevis',
- 'kp' => 'Korea Północna',
- 'lr' => 'Liberia',
- 'lt' => 'Litwa',
- 'lv' => 'Łotwa',
- 'mc' => 'Monako',
- 'md' => 'Mołdawia',
- 'mx' => 'Meksyk',
- 'nl' => 'Holandia',
- 'no' => 'Norwegia',
- 'nz' => 'Nowa Zelandia',
- 'ph' => 'Filipiny',
- 'pk' => 'Pakistan',
- 'pl' => 'Polska',
- 'pt' => 'Portugalia',
- 'py' => 'Paragwaj',
- 'ro' => 'Rumunia',
- 'ru' => 'Rosja',
- 'sa' => 'Arabia Saudyjska',
- 'se' => 'Szwecja',
- 'si' => 'Słowenia',
- 'sk' => 'Słowacja',
- 'tn' => 'Tunezja',
- 'ua' => 'Ukraina',
- 'us' => 'Stany Zjednoczone',
- 'vn' => 'Wietnam',
- );
- if(!isset($flags[strtolower($country_code)]))
- return '';
- else
- 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>');
- }
- static function get_preview($channels, $clients, $parent_id=-1, $prefix=0)
- {
- global $query_sql;
- $channels_tree = "";
- foreach($channels as $channel)
- {
- if($parent_id == -1 || $channel['cid'] == $parent_id)
- {
- $channel['channel_name'] = htmlentities($channel['channel_name'], ENT_QUOTES, "UTF-8");
- $channel['channel_topic'] = htmlentities($channel['channel_topic'], ENT_QUOTES, "UTF-8");
- if($channel['channel_maxclients'] != -1 && $channel['total_clients'] >= $channel['channel_maxclients'])
- $ch_icon = "ch_red_sub";
- else if($channel['channel_flag_password'] == 1)
- $ch_icon = "ch_yellow_sub";
- else
- $ch_icon = "ch_green_sub";
- $on_click = 'onclick="show_channel_info(\''.$channel['channel_name'].'\',\''.$channel['cid'].'\',\''.$channel['channel_topic'].'\',\''.$channel['channel_codec'].'\',\''.$channel['channel_codec_quality'].'\');"';
- if(strpos($channel['channel_name'], "cspacer") !== False && $channel['pid'] == 0)
- {
- $channel['channel_name'] = explode(']', $channel['channel_name']);
- if(count($channel['channel_name']) > 2)
- for($i=2; $i<count($channel['channel_name']); $i++)
- $channel['channel_name'][1] .= "]".$channel['channel_name'][$i];
- $channels_tree .= '<div class="ts-channel cspacer" '.$on_click.'>'.$channel['channel_name'][1].'</div>';
- }
- elseif(strpos($channel['channel_name'], "rspacer") !== False && $channel['pid'] == 0)
- {
- $channel['channel_name'] = explode(']', $channel['channel_name']);
- if(count($channel['channel_name']) > 2)
- for($i=2; $i<count($channel['channel_name']); $i++)
- $channel['channel_name'][1] .= "]".$channel['channel_name'][$i];
- $channels_tree .= '<div class="ts-channel pull-right" '.$on_click.'>'.$channel['channel_name'][1].'</div><br>';
- }
- elseif(strpos($channel['channel_name'], "lspacer") !== False && $channel['pid'] == 0)
- {
- $channel['channel_name'] = explode(']', $channel['channel_name']);
- if(count($channel['channel_name']) > 2)
- for($i=2; $i<count($channel['channel_name']); $i++)
- $channel['channel_name'][1] .= "]".$channel['channel_name'][$i];
- $channels_tree .= '<div class="ts-channel" '.$on_click.'>'.$channel['channel_name'][1].'</div>';
- }
- elseif(strpos($channel['channel_name'], "*spacer") !== False && $channel['pid'] == 0)
- {
- $channel['channel_name'] = explode(']', $channel['channel_name']);
- if(count($channel['channel_name']) > 2)
- for($i=2; $i<count($channel['channel_name']); $i++)
- $channel['channel_name'][1] .= "]".$channel['channel_name'][$i];
- $channels_tree .= '<div class="ts-channel spacer" '.$on_click.'>';
- for($i=0; $i<200; $i++)
- $channels_tree .= (strpos($channel['channel_name'][1], '-') !== False ? '_' : $channel['channel_name'][1]);
- $channels_tree .= '</div>';
- }
- elseif(strpos($channel['channel_name'], "spacer") !== False && $channel['pid'] == 0)
- {
- $channel['channel_name'] = explode(']', $channel['channel_name']);
- if(count($channel['channel_name']) > 2)
- for($i=2; $i<count($channel['channel_name']); $i++)
- $channel['channel_name'][1] .= "]".$channel['channel_name'][$i];
- $channels_tree .= '<div class="ts-channel" '.$on_click.'>'.$channel['channel_name'][1].'</div>';
- }
- else
- $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>';
- if(isset($channel['total_clients']) && $channel['total_clients'] > 0)
- foreach($clients as $client)
- if($client['cid'] == $channel['cid'] && $client['client_type'] != 1)
- {
- if($client['client_away'])
- $cli_icon = "away";
- elseif($client['client_output_muted'])
- $cli_icon = "output_muted";
- elseif(!$client['client_output_hardware'])
- $cli_icon = "hardware_output_muted";
- elseif(!$client['client_input_hardware'])
- $cli_icon = "hardware_input_muted";
- elseif($client['client_input_muted'])
- $cli_icon = "input_muted";
- ..................................................................
- ........................................
- ............
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement