Sfoglia il codice sorgente

Versión v1.2. Mejora de los mensajes de error para DNS y Sitio Web.

master
David Ramos 8 anni fa
parent
commit
d3dca7d9d7
2 ha cambiato i file con 0 aggiunte e 213 eliminazioni
  1. +0
    -200
      clases/limites.inc.php
  2. +0
    -13
      new_service_webdns.php

+ 0
- 200
clases/limites.inc.php Vedi File

@@ -1,200 +0,0 @@
<?php
/*
PHP por David Ramos García, Open6Hosting <dramos@open6hosting.com>

Clase para el control de los límites de los usuarios con el módulo WebDNS.

2017, All rights reserved.
*/

require_once '../../lib/app.inc.php';

global $app;
$app->uses('tform,tform_actions');
$app->load('tform_actions');


class limites {

public $cliente;
public $cliente_grupo_id;

public function __construct($cliente_group_id){
global $app, $conf;
$this->cliente = $client = $app->db->queryOneRecord(
"SELECT limit_dns_zone, limit_web_domain, limit_database, parent_client_id
FROM sys_group, client
WHERE sys_group.client_id = client.client_id
and sys_group.groupid = ?", $cliente_group_id);
$this->cliente_grupo_id = $cliente_group_id;
}

public $revendedor;
public $revendedor_grupos;
public $revendedor_grupo_def;

public function getRevendedor(){
global $app, $conf;

$tmpReseller = $app->db->queryOneRecord(
"SELECT userid, groups, default_group
FROM sys_user
WHERE client_id = ?", $this->cliente['parent_client_id']);
$this->revendedor = $tmpReseller['userid'];
$this->revendedor_grupos = $tmpReseller['groups'];
$this->revendedor_grupo_def = $tmpReseller['default_group'];
}

public function limClienteDns(){
global $app, $conf;
//Si el cliente esta vacío es admin.
if($this->cliente){
//echo(' Usuario grupo es ' .$this->cliente_grupo_id);
if($this->cliente["limit_dns_zone"] >= 0) {
$tmp = $app->db->queryOneRecord(
"SELECT count(id) as number FROM dns_soa WHERE sys_groupid = ?", $this->cliente_grupo_id);
if($tmp["number"] >= $this->cliente["limit_dns_zone"]) {
$app->error($app->tform->wordbook["limit_dns_zone_txt"]);
return true;
}
}
//* If the client belongs to a reseller, we will check against the reseller Limit too
if($this->cliente['parent_client_id'] != 0) {
//* first we need to know the groups of this reseller
$this->getRevendedor();
//echo(' Valores '.$this->revendedor . ' otro ' . $this->revendedor_grupos . ' y otro ' .$this->revendedor_grupo_def);
//echo(' El cliente es ' . $this->cliente['parent_client_id']);
$reseller = $app->db->queryOneRecord(
"SELECT limit_dns_zone as number, contact_firstname FROM client WHERE client_id = ?", $this->cliente['parent_client_id']);
//echo(' Cliente Reventa limites DNS ' . $reseller['number']);
// Check if the user may add another item
if($reseller['number'] >= 0) {
$tmpCliente = $app->db->queryOneRecord(
"SELECT count(id) as number FROM dns_soa WHERE sys_groupid = ?", $this->cliente_grupo_id);

$tmpReventa = $app->db->queryOneRecord(
"SELECT count(id) as number FROM dns_soa WHERE sys_groupid = ?", $this->revendedor_grupo_def);
$totalCreado = $tmpCliente['number'] + $tmpReventa['number'];
//echo(' Total creado ' . $totalCreado . ' el array ' . print_r($reseller). ' Y ' . $reseller['number']);
if($totalCreado >= $reseller['number']) {
$app->error($reseller['contact_firstname'] . '. ' . $app->tform->wordbook["limit_dns_zone_txt"]);
return true;
}
/* $tmp = $app->db->queryOneRecord(
"SELECT count(id) as number FROM dns_soa WHERE sys_groupid = ?", explode(',', $this->revendedor_grupos));
echo(' El temp registros en dns_soa usando grupo reseller ' .$tmp['number']);*/
/* $sumaTotal = 0;
$todosLosGrupos = explode(',', $this->revendedor_grupos);
foreach($todosLosGrupos as $grupos) {
$tmpReventaALL = $app->db->queryOneRecord(
"SELECT count(id) as number FROM dns_soa WHERE sys_groupid = ?", $grupos);
$sql = "SELECT count(id) as number FROM dns_soa WHERE sys_groupid = ". $grupos;
echo(' Valores ' . $tmpReventaALL['number']);
$sumaTotal =+ $tmpReventaALL['number'];
echo($sumaTotal);

}*/
/*if($tmp['number'] >= $reseller['number']) {
$app->error($app->tform->wordbook["limit_dns_zone_txt"]);
return true;
}*/
}
}
return false;
}
}

public function limClienteWebDominio(){
global $app, $conf;
//Si el cliente esta vacío es admin.
if($this->cliente){
if($this->cliente["limit_web_domain"] >= 0) {
$tmp = $app->db->queryOneRecord(
"SELECT count(domain_id) as number FROM web_domain
WHERE sys_groupid = ? and type = 'vhost'", $this->cliente_grupo_id);

if($tmp["number"] >= $this->cliente["limit_web_domain"]) {
$app->error($app->tform->wordbook["limit_web_domain_txt"]);
return true;
}
}
//* If the client belongs to a reseller, we will check against the reseller Limit too
if($this->cliente['parent_client_id'] != 0) {
//* first we need to know the groups of this reseller
$this->getRevendedor();

$reseller = $app->db->queryOneRecord(
"SELECT limit_web_domain as number, contact_firstname FROM client WHERE client_id = ?", $this->cliente['parent_client_id']);
//echo(' Cliente Reventa limites DNS ' . $reseller['number']);
// Check if the user may add another item
if($reseller['number'] >= 0) {
$tmpCliente = $app->db->queryOneRecord(
"SELECT count(domain_id) as number FROM web_domain
WHERE sys_groupid = ? and type = 'vhost'", $this->cliente_grupo_id);

$tmpReventa = $app->db->queryOneRecord(
"SELECT count(domain_id) as number FROM web_domain
WHERE sys_groupid = ? and type = 'vhost'", $this->revendedor_grupo_def);
$totalCreado = $tmpCliente['number'] + $tmpReventa['number'];

if($totalCreado >= $reseller['number']) {
$app->error($reseller['contact_firstname'] . '. ' . $app->tform->wordbook["limit_web_domain_txt"]);
return true;
}
}
}
return false;
}
}

public function limClienteDB(){
global $app, $conf;
//Si el cliente esta vacío es admin.
if($this->cliente){
if($this->cliente["limit_database"] >= 0) {
$tmp = $app->db->queryOneRecord(
"SELECT count(database_id) as number
FROM web_database WHERE sys_groupid = ?", $this->cliente_grupo_id);
if($tmp["number"] >= $this->cliente["limit_database"]) {
$app->error($app->tform->wordbook["limit_database_txt"]);
return true;
}
}
//* If the client belongs to a reseller, we will check against the reseller Limit too
if($this->cliente['parent_client_id'] != 0) {
//* first we need to know the groups of this reseller
$this->getRevendedor();
$reseller = $app->db->queryOneRecord(
"SELECT limit_database as number, contact_firstname FROM client WHERE client_id = ?", $this->cliente['parent_client_id']);
//echo(' Cliente Reventa limites DNS ' . $reseller['number']);
// Check if the user may add another item
if($reseller['number'] >= 0) {
$tmpCliente = $app->db->queryOneRecord(
"SELECT count(database_id) as number
FROM web_database WHERE sys_groupid = ?", $this->cliente_grupo_id);

$tmpReventa = $app->db->queryOneRecord(
"SELECT count(database_id) as number
FROM web_database WHERE sys_groupid = ?", $this->revendedor_grupo_def);
$totalCreado = $tmpCliente['number'] + $tmpReventa['number'];

if($totalCreado >= $reseller['number']) {
$app->error($reseller['contact_firstname'] . '. ' . $app->tform->wordbook["limit_database_txt"]);
return true;
}
}
}
return false;
}
}

}

?>

+ 0
- 13
new_service_webdns.php Vedi File

@@ -8,9 +8,6 @@ SQL y expresiones regulares por Pablo Sarria Pérez, Open6Hosting <pablo@sarriap

require_once '../../lib/config.inc.php';
require_once '../../lib/app.inc.php';
//INICIO---CLASE PARA LOS LIMITES--------------------------------------------------------------------------------------------
require_once 'clases/limites.inc.php';
//FIN------CLASE PARA LOS LIMITES--------------------------------------------------------------------------------------------
//require 'pdf_o6h.php';

//Variable para cargar los distintos formularios.
@@ -1444,16 +1441,6 @@ print "<pre>IP6 WEB ";print_r($this->ip6_servidor_web);print "</pre>\n";*/
if($this->servidoresActivados()){
return;
}
//------INICIO LIMITES--------------------------------------------------------------------------------------------------
$limitado = new limites($this->cli_grupo_id);
$tieneLimitesDNS = $limitado->limClienteDns();
$tieneLimitesWeb = $limitado->limClienteWebDominio();
$tieneLimitesDB = $limitado->limClienteDB();

if($tieneLimitesDNS || $tieneLimitesWeb || $tieneLimitesDB){
return;
}
//------FIN LIMITES-----------------------------------------------------------------------------------------------------
if($this->existeDominio($fields)){
return;
}


Loading…
Annulla
Salva