|
- <?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';
-
- 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 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 function limClienteDns(){
- global $app, $conf;
- //Si el cliente esta vacío es admin.
- if($this->cliente){
- 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 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;
- }
- }
- }
- 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 false;
- }
-
- }
-
- ?>
|