/* Decoded by unphp.net */ function stmlivecasthd_configoptions () { $configarray = array ('Ouvintes'=>array ('Type'=>'text','Size'=>'10','Description'=>'
(Numero maximo de ouvintes. Ex.: 100)'), 'Bitrate'=>array ('Type'=>'dropdown','Options'=>'24,32,48,64,96,128,320','Description'=>'
(Verifique limite de seu plano)'), 'Espaco AutoDJ'=>array ('Type'=>'text','Size'=>'10','Description'=>'
(Espaco para FTP do autodj, valor em megabytes. Ex.: 1000)'), 'AAC+ RTMP'=>array ('Type'=>'dropdown','Options'=>'sim,nao','Description'=>'
(Verifique se esta ativado em seu plano)'), 'linguagem'=>array ('Type'=>'dropdown','Options'=>'pt-br,en-us,es','Description'=>'
(Idioma Painel - Portugues/English/Espanol)'), 'App Android'=>array ('Type'=>'dropdown','Options'=>'sim,nao','Description'=>'
(App Android)'), 'Programetes DJ'=>array ('Type'=>'dropdown','Options'=>'sim,nao','Description'=>'
(Programetes DJ)'), 'Programetes Download'=>array ('Type'=>'dropdown','Options'=>'sim,nao','Description'=>'
(Programetes Download)'), 'Musica Painel'=>array ('Type'=>'dropdown','Options'=>'sim,nao','Description'=>'
(Musica Painel)'), ); return $configarray; } function stmlivecasthd_adminlink ($params) { $code = "
"; return $code; } function stmlivecasthd_createaccount ($params) { date_default_timezone_set('America/Sao_Paulo'); $date = date('Y-m-d H:m:s'); global $debug; $CustomFieldQuery = mysql_num_rows (mysql_query ('SELECT id FROM tblcustomfields WHERE fieldname=\'Porta\' AND relid='.$params['packageid'])); $CustomID = mysql_fetch_array (mysql_query ('SELECT * FROM tblcustomfields WHERE fieldname=\'Porta\' AND relid = '.$params['packageid'])); if ($CustomFieldQuery == 0) { $return = 'O campo adicional "Porta" não existe.
Crie um campo adicional com o nome "Porta" em Products/Services'; return $return; } $CustomFieldID = $CustomID[id]; $Porta = mysql_fetch_array (mysql_query ('SELECT * FROM `tblcustomfieldsvalues` WHERE fieldid = "'.$CustomFieldID.'" AND relid = "'.$params['accountid'].'"')); $verifica_porta = mysql_num_rows(mysql_query('SELECT * FROM `tblcustomfieldsvalues` WHERE fieldid = "'.$CustomFieldID.'" AND relid = "'.$params['accountid'].'" ')); if ($verifica_porta == 0) { mysql_query("INSERT INTO tblcustomfieldsvalues (fieldid,relid,value,created_at,updated_at) VALUES ('".$CustomFieldID."','".$params['accountid']."','/','".$date."','".$date."')"); } $PortBase = $Porta[value]; if (!empty ($PortBase)) { $return = 'Este streaming já esta criado.'; return $return; } $query3 = 'SELECT * FROM tblhostingconfigoptions WHERE relid=\''.$params['accountid'] .'\''; $result3 = mysql_query ($query3); while ($data3 = mysql_fetch_array ($result3)) { $optionid = $data3['optionid']; $configid = $data3['configid']; $query2 = ''.'SELECT * FROM tblproductconfigoptions WHERE id=\''.$configid .'\''; $result2 = mysql_query ($query2); $data2 = mysql_fetch_array ($result2); $optionname = $data2['optionname']; $query2 = ''.'SELECT * FROM tblproductconfigoptionssub WHERE id=\''.$optionid .'\''; $result2 = mysql_query ($query2); $data2 = mysql_fetch_array ($result2); $optionvalue = $data2['optionname']; $optionvalue = trim ($optionvalue); if ($optionname == 'Ouvintes') { $params['configoption1'] = $optionvalue; continue; }else { if ($optionname == 'Bitrate') { $params['configoption2'] = $optionvalue; continue; }else { if ($optionname == 'Espaço AutoDJ') { $params['configoption3'] = $optionvalue; continue; }else { if ($optionname == 'AAC+ RTMP') { $params['configoption4'] = $optionvalue; continue; }else { if ($optionname == 'linguagem') { $params['configoption5'] = $optionvalue; continue; }else { if ($optionname == 'App Android') { $params['configoption6'] = $optionvalue; continue; }else { if ($optionname == 'Encoder MP3') { $params['configoption7'] = $optionvalue; continue; }else { if ($optionname == 'Encoder AACPlus') { $params['configoption8'] = $optionvalue; continue; }else { if ($optionname == 'Programetes DJ') { $params['configoption9'] = $optionvalue; continue; }else { if ($optionname == 'Programetes Download') { $params['configoption10'] = $optionvalue; continue; }else { if ($optionname == 'Musica Painel') { $params['configoption11'] = $optionvalue; continue; } } } } } } } } } } continue; } } $api['acao'] = 'cadastrar'; $api['ouvintes'] = $params['configoption1']; $api['bitrate'] = $params['configoption2']; $api['espaco'] = $params['configoption3']; $api['senha'] = substr(md5("acegikmoqsuxywz".time()),0,12); $api['aacp'] = $params['configoption4']; $api['linguagem'] = $params['configoption5']; $api['libera_app'] = $params['configoption6']; $api['encoder_mp3'] = $params['configoption7']; $api['encoder'] = $params['configoption8']; $api['programete_dj'] = $params['configoption9']; $api['libe_programete'] = $params['configoption10']; $api['libe_musicas_ftp'] = $params['configoption11']; $response = api2 ($params['serverhostname'],$params['serveraccesshash'],$api); if ($response['command'] == 'success') { list ($ip,$porta) = explode (':',$response['returned']); mysql_query ('UPDATE tblhosting SET username=\''.$porta .'\', password=\''.encrypt ($api['senha']).'\', domain=\''.$ip .':'.$porta .'\', dedicatedip=\''.$ip .'\' WHERE id=\''.$params['accountid'] .'\''); $dados_customfield = mysql_fetch_array (mysql_query ('SELECT * FROM `tblcustomfields` WHERE fieldname = \'Porta\' AND relid = "'.$params['packageid'].'"')); mysql_query ('UPDATE tblcustomfieldsvalues SET value=\''.$porta .'\' WHERE fieldid=\''.$dados_customfield['id'] .'\' AND relid=\''.$params['accountid'] .'\''); return 'success'; } return $response['error']; } function stmlivecasthd_terminateaccount ($params) { global $debug; $PortBaseQuery = mysql_query ('SELECT tblcustomfieldsvalues.value FROM tblcustomfieldsvalues, tblcustomfields WHERE tblcustomfields.fieldname = \'Porta\' AND tblcustomfieldsvalues.fieldid = tblcustomfields.id AND tblcustomfieldsvalues.relid ='.$params['accountid']); $Porta = mysql_fetch_array ($PortBaseQuery); if (mysql_num_rows ($PortBaseQuery) == 0) { $return = 'O streaming não esta criado.'; return $return; } $PortBase = $Porta["value"]; $api['acao'] = 'remover'; $api['porta'] = $PortBase; $response = api2 ($params['serverhostname'],$params['serveraccesshash'],$api); if ($response['command'] == 'success') { $dados_customfield = mysql_fetch_array (mysql_query ('SELECT * FROM `tblcustomfields` WHERE fieldname = \'Porta\' AND relid = "'.$params['packageid'].'"')); mysql_query("DELETE FROM `tblcustomfieldsvalues` WHERE fieldid = '".$dados_customfield['id']."' AND relid = '".$params['accountid']."'"); mysql_query ('UPDATE tblhosting SET username=\'\', password=\'\', domain=\'\', dedicatedip=\'\' WHERE id=\''.$params['accountid'] .'\''); return 'success'; } return $response['error']; } function stmlivecasthd_suspendaccount ($params) { global $debug; $PortBaseQuery = mysql_query ('SELECT tblcustomfieldsvalues.value FROM tblcustomfieldsvalues, tblcustomfields WHERE tblcustomfields.fieldname = \'Porta\' AND tblcustomfieldsvalues.fieldid = tblcustomfields.id AND tblcustomfieldsvalues.relid ='.$params['accountid']); $Porta = mysql_fetch_array ($PortBaseQuery); if (mysql_num_rows ($PortBaseQuery) == 0) { $return = 'O streaming não esta cadastrado.'; return $return; } $PortBase = $Porta["value"]; $api['acao'] = 'bloquear'; $api['porta'] = $PortBase; $response = api2 ($params['serverhostname'],$params['serveraccesshash'],$api); if ($response['command'] == 'success') { return 'success'; } return $response['error']; } function stmlivecasthd_unsuspendaccount ($params) { global $debug; $PortBaseQuery = mysql_query ('SELECT tblcustomfieldsvalues.value FROM tblcustomfieldsvalues, tblcustomfields WHERE tblcustomfields.fieldname = \'Porta\' AND tblcustomfieldsvalues.fieldid = tblcustomfields.id AND tblcustomfieldsvalues.relid ='.$params['accountid']); $Porta = mysql_fetch_array ($PortBaseQuery); if (mysql_num_rows ($PortBaseQuery) == 0) { $return = 'O streaming não esta criado, por favor clique no botão "Create" primeiro.'; return $return; } $PortBase = $Porta["value"]; $api['acao'] = 'desbloquear'; $api['porta'] = $PortBase; $response = api2 ($params['serverhostname'],$params['serveraccesshash'],$api); if ($response['command'] == 'success') { return 'success'; } return $response['error']; } function stmlivecasthd_changepassword ($params) { global $debug; $PortBaseQuery = mysql_query ('SELECT tblcustomfieldsvalues.value FROM tblcustomfieldsvalues, tblcustomfields WHERE tblcustomfields.fieldname = \'Porta\' AND tblcustomfieldsvalues.fieldid = tblcustomfields.id AND tblcustomfieldsvalues.relid ='.$params['accountid']); $Porta = mysql_fetch_array ($PortBaseQuery); if (mysql_num_rows ($PortBaseQuery) == 0) { $return = 'O streaming não esta criado, por favor clique no botão "Create" primeiro.'; return $return; } $PortBase = $Porta["value"]; $api['acao'] = 'alterar_senha'; $api['porta'] = $PortBase; $api['nova_senha'] = $params['password']; $response = api2 ($params['serverhostname'],$params['serveraccesshash'],$api); if ($response['command'] == 'success') { mysql_query ("Update tblhosting set password = '".encrypt ($params['password'])."' where id = '".$params['accountid']."'"); return 'success'; } return $response['error']; } function api2 ($serverhostname,$serverip,$api) { $serverhostname = str_replace("/admin/","",$serverhostname); $serverhostname = str_replace("/admin","",$serverhostname); $serverhostname = (substr($serverhostname,-1) == '/') ?substr($serverhostname,0,-1) : $serverhostname; $requisicao = ''; foreach ($api as $option =>$setting) { if (is_array ($setting)) { $setting = serialize ($setting); } $requisicao .= $setting."/"; } $url_requisicao = "https://".$serverhostname."/admin/api/".$serverip."/".$requisicao.""; $ch = curl_init(); curl_setopt($ch,CURLOPT_URL,$url_requisicao); curl_setopt($ch,CURLOPT_RETURNTRANSFER,1); curl_setopt($ch,CURLOPT_USERAGENT,'Modulo Sub Revenda WHMCS 2.5 ('.$_SERVER['HTTP_HOST'].')'); $resultado = curl_exec($ch); curl_close($ch); if($resultado === false) { return array ('command'=>'failed','error'=>'Erro! Problemas de conexao. / Connection problems.'); }else { list ($status,$retorno,$msg) = explode ('|',$resultado); if ($status == '0') { return array ('command'=>'failed','error'=>''.$msg.''); } return array ('command'=>'success','returned'=>''.$retorno.''); } } ;