Example #1
0
/**
 *	@author João Reis
 *	Retorna Servidores do Utilizador Usando um filtro, filtro usado na barra de procura ou boolean se o Utilizador/Query não existirem.
 *	@param $IdUtilizador
 *	@param $Query
 *	@return array|boolean
 */
function getServidoresByIdUtilizadorAndQuery($IdUtilizador, $Query)
{
    # GETSERVIDORBYQUERY
    $Query = "%" . $Query . "%";
    global $conn;
    try {
        $stmt = $conn->prepare(GETSERVIDORBYIDUTILIZADORANDQUERY);
        $stmt->execute(array(":IdUtilizador" => $IdUtilizador, ":Query" => $Query));
        $result = $stmt->fetchAll();
        $result = addInformacaoServidores($result);
        return $result;
    } catch (Exception $ex) {
        return false;
    }
}
Example #2
0
            header("Location: admin.php?Logged=0");
            die;
        } catch (Exception $e) {
            $Erros[] = $linguagens[$User->getLinguagem()]['erro_realizarLoginOutroUser'];
        }
    }
}
$total = 0;
$Servidores = getServidoresByIdUtilizador($User->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 = new Smarty();
$OldUser = false;
if (isset($_SESSION['Old_Id']) && !empty($_SESSION['Old_Id']) && $_SESSION['Id'] != $_SESSION['Old_Id']) {
    $OldUser = true;
    try {
        $OldUserC = new Utilizador($_SESSION['Old_Id'], $conn);
        $OldUserC->getInfo();
    } catch (Exception $e) {
        $_SESSION['Old_Id'] = "";
        $OldUser = false;
    }
} else {
    $OldUser = false;
}
Example #3
0
    if (!isset($_GET['Tipo']) && empty($_GET['Tipo'])) {
        header("Location: index.php");
        die;
    }
    $Tipo = addslashes($_GET['Tipo']);
} else {
    header("Location: index.php");
    die;
}
$ServidoresTipo = getServidorByTipoServidorAndIdUtilizador($Tipo, $User->getId());
foreach ($ServidoresTipo as $Servidor) {
    $server = new Servidor($Servidor['Id'], $conn);
    $server->getFullStatus();
    // Fazer update aos Status
}
addInformacaoServidores($ServidoresTipo);
$smarty->debugging = false;
$smarty->caching = false;
$smarty->cache_lifetime = 10;
$smarty->assign("NomeTema", $User->getNomeTema(), true);
$smarty->assign("PastaTema", $User->getPastaTema(), true);
$smarty->assign("Titulo", "Cyber-Panel", true);
$smarty->assign("Zona", $linguagens[$User->getLinguagem()]['zona_criarServidor'], true);
$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(), "NumServidores" => count(getServidoresByIdUtilizador($User->getId())), "MaxServidores" => $User->getNumeroMaxServidores(), "IsAdmin" => $User->isAdmin(), "PercentUsado" => round($PercentagemServidores), "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), "OldUser" => $OldUser);
}
$smarty->assign("Utilizador", $Uti);
$smarty->assign("Infos", array("NumServidores" => count(getServidoresByIdUtilizador($User->getId())), "NumServidoresOnline" => count(getServidoresByIdUtilizadorAndStatus($User->getId(), 1)), "NumServidoresOffline" => count(getServidoresByIdUtilizadorAndStatus($User->getId(), 0)), "NumSlotsOcupados" => $slotsOcupados));