} if (isset($_GET['AJAX'])) { $Pedido = $_GET['AJAX']; if ($Pedido == "AUMENTARMAXSERVIDORES") { $UserVer = new Utilizador($Id, $conn); $UserVer->getInfo(); $UserVer->setNumeroMaxServidores($UserVer->getNumeroMaxServidores() + 1); $UserVer->atualizaInfo(); echo json_encode(array("Status" => true, "MaxServidores" => $UserVer->getNumeroMaxServidores(), "Percentagem" => round(getPercentagem($UserVer->getNumeroServidores(), $UserVer->getNumeroMaxServidores())))); die; } if ($Pedido == "DIMINUIRMAXSERVIDORES") { $UserVer = new Utilizador($Id, $conn); $UserVer->getInfo(); if ($UserVer->getNumeroMaxServidores() > 0) { if ($UserVer->getNumeroServidores() < $UserVer->getNumeroMaxServidores()) { $UserVer->setNumeroMaxServidores($UserVer->getNumeroMaxServidores() - 1); $UserVer->atualizaInfo(); } } echo json_encode(array("Status" => true, "MaxServidores" => $UserVer->getNumeroMaxServidores(), "Percentagem" => round(getPercentagem($UserVer->getNumeroServidores(), $UserVer->getNumeroMaxServidores())))); die; } if ($Pedido == "InfoEstatisticas") { $Servidores = array(); $Servidores = getServidoresByIdUtilizador($User->getId()); # print_r($Servidores); $total = 0; foreach ($Servidores as $Servidor) { $server = new Servidor($Servidor['Id'], $conn); $server->getFullStatus();
} else { } } } $smarty->debugging = false; $smarty->caching = false; $smarty->cache_lifetime = 10; $smarty->assign("NomeTema", $User->getNomeTema(), true); // Nome do Tema $smarty->assign("PastaTema", $User->getPastaTema(), true); // Pasta do Tema $smarty->assign("Titulo", "Cyber-Panel", true); // Titulo do HTML $smarty->assign("Zona", $linguagens[$User->getLinguagem()]['zona_perfil'], true); // Zona em que se encontra $PercentagemServidores = round(getPercentagem($User->getNumeroServidores(), $User->getNumeroMaxServidores())); if ($OldUser) { $Uti = array("Nome" => utf8_encode($User->getNome()), "Apelido" => utf8_encode($User->getApelido()), "Email" => utf8_encode($User->getEmail()), "Id" => $User->getId(), "IdTema" => $User->getIdTema(), "NomeTema" => $User->getNomeTema(), "IsAdmin" => $User->isAdmin(), "NumServidores" => count(getServidoresByIdUtilizador($User->getId())), "MaxServidores" => $User->getNumeroMaxServidores(), "PercentUsado" => round($PercentagemServidores), "Cron" => $User->hasCron(), "OldUser" => $OldUser, "OldId" => $OldUserC->getId(), "OldNome" => utf8_encode($OldUserC->getNome()), "OldApelido" => utf8_encode($OldUserC->getApelido()), "OldEmail" => utf8_encode($OldUserC->getEmail())); } else { $Uti = array("Nome" => utf8_encode($User->getNome()), "Apelido" => utf8_encode($User->getApelido()), "Email" => utf8_encode($User->getEmail()), "Id" => $User->getId(), "IdTema" => $User->getIdTema(), "NomeTema" => $User->getNomeTema(), "NumServidores" => count(getServidoresByIdUtilizador($User->getId())), "MaxServidores" => $User->getNumeroMaxServidores(), "IsAdmin" => $User->isAdmin(), "PercentUsado" => round($PercentagemServidores), "Cron" => $User->hasCron(), "OldUser" => $OldUser); } // Passar Dados para Sistema Smarty. $smarty->assign("Utilizador", $Uti); // Informação sobre o utilizador $smarty->assign("Infos", array("NumServidores" => count(getServidoresByIdUtilizador($User->getId())), "NumServidoresOnline" => count(getServidoresByIdUtilizadorAndStatus($User->getId(), 1)), "NumServidoresOffline" => count(getServidoresByIdUtilizadorAndStatus($User->getId(), 0)), "NumSlotsOcupados" => $slotsOcupados)); // Informação adicional $smarty->assign("TiposServidores", getAllTiposServidores()); // Todos os tipos de servidores disponiveis $smarty->assign("Servidores", getServidoresByIdUtilizador($User->getId())); // Todos os servidores do utilizador $smarty->assign("Lang", $linguagens[$User->getLinguagem()]);
die; } if ($UserVer == $User) { $UserVerIgual = true; } $total = 0; $Servidores = getServidoresByIdUtilizador($UserVer->getId()); foreach ($Servidores as $Servidor) { $server = new Servidor($Servidor['Id'], $conn); $server->getFullStatus(); // Fazer update aos Status $total += $server->getSlots(); } addInformacaoServidores($Servidores); $slotsOcupados = $total; $smarty->assign("UserVer", array("Nome" => utf8_encode($UserVer->getNome()), "Apelido" => utf8_encode($UserVer->getApelido()), "Email" => utf8_encode($UserVer->getEmail()), "Id" => $UserVer->getId(), "IdTema" => $UserVer->getIdTema(), "NomeTema" => $UserVer->getNomeTema(), "NumServidores" => count(getServidoresByIdUtilizador($UserVer->getId())), "MaxServidores" => $UserVer->getNumeroMaxServidores(), "IsAdmin" => $UserVer->isAdmin(), "SlotsUsados" => $slotsOcupados, "PercentUsado" => round(getPercentagem($UserVer->getNumeroServidores(), $UserVer->getNumeroMaxServidores())))); } } } $smarty->assign("passo1", $passo1); $smarty->assign("passo2", $passo2); $smarty->assign("passo3", $passo3); $smarty->assign("passo4", $passo4); $smarty->assign("Opcao", $opcao); $smarty->assign("UserVerIgual", $UserVerIgual); $smarty->display($User->getPastaTema() . '/admin.tpl'); ?> <style type="text/css"> #FullWidth { width: calc(100% - 12px); /* IE 9,10 , Chrome, Firefox */ width: -webkit-calc(100% - 12px); /*For safari 6.0*/