Newer
Older
<?php
/*
Form Definition
Tabledefinition
Datatypes:
- INTEGER (Forces the input to Int)
- DOUBLE
- CURRENCY (Formats the values to currency notation)
- VARCHAR (no format check, maxlength: 255)
- TEXT (no format check)
- DATE (Dateformat, automatic conversion to timestamps)
Formtype:
- TEXT (Textfield)
- TEXTAREA (Textarea)
- PASSWORD (Password textfield, input is not shown when edited)
- SELECT (Select option field)
- RADIO
- CHECKBOX
- CHECKBOXARRAY
- FILE
VALUE:
- Wert oder Array
Hint:
The ID field of the database table is not part of the datafield definition.
The ID field must be always auto incement (int or bigint).
Search:
- searchable = 1 or searchable = 2 include the field in the search
- searchable = 1: this field will be the title of the search result
- searchable = 2: this field will be included in the description of the search result
$vhostdomain_type = 'domain';
$form_title = "Web Domain";
$validator_function = 'web_domain';
if(isset($_SESSION['s']['var']['vhostdomain_type'])) {
if($_SESSION['s']['var']['vhostdomain_type'] == 'subdomain') {
$vhostdomain_type = 'subdomain';
$form_title = "Subdomain";
$validator_function = 'sub_domain';
$first_tab_title = "Subdomain";
} elseif($_SESSION['s']['var']['vhostdomain_type'] == 'aliasdomain') {
$vhostdomain_type = 'aliasdomain';
$form_title = "Aliasdomain";
$validator_function = 'alias_domain';
$first_tab_title = "Aliasdomain";
}
}
$form["title"] = $form_title;
$form["name"] = "web_vhost_domain";
$form["action"] = "web_vhost_domain_edit.php";
$form["db_table"] = "web_domain";
$form["db_table_idx"] = "domain_id";
$form["db_history"] = "yes";
$form["tab_default"] = "domain";
$form["list_default"] = "web_vhost_domain_list.php";
$form["auth"] = 'yes'; // yes / no
$form["auth_preset"]["userid"] = 0; // 0 = id of the user, > 0 id must match with id of current user
$form["auth_preset"]["groupid"] = 0; // 0 = default groupid of the user, > 0 id must match with groupid of current user
$form["auth_preset"]["perm_user"] = 'riud'; //r = read, i = insert, u = update, d = delete
$form["auth_preset"]["perm_group"] = 'riud'; //r = read, i = insert, u = update, d = delete
$form["auth_preset"]["perm_other"] = ''; //r = read, i = insert, u = update, d = delete
$web_domain_edit_readonly = false;
// Clients may not change the website basic settings if they are not resellers
if($app->auth->has_clients($_SESSION['s']['user']['userid']) || $app->auth->is_admin()) {
$web_domain_edit_readonly = false;
} else {
if($vhostdomain_type == 'domain') $web_domain_edit_readonly = true;
if($vhostdomain_type != 'domain') $wildcard_available = false;
$backup_available = ($vhostdomain_type == 'domain');
$client_group_id = $_SESSION["s"]["user"]["default_group"];
$client = $app->db->queryOneRecord("SELECT limit_wildcard, limit_ssl, limit_ssl_letsencrypt, limit_backup FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = ?", $client_group_id);
if($client['limit_wildcard'] != 'y') $wildcard_available = false;
if($client['limit_ssl'] != 'y') $ssl_available = false;
//if($client['limit_ssl_letsencrypt'] == 'y') $ssl_available = false;
if($client['limit_backup'] != 'y') $backup_available = false;
$app->uses('getconf,system');
$web_config = $app->getconf->get_global_config('sites');
$form["tabs"]['domain'] = array (
'template' => "templates/web_vhost_domain_edit.htm",
'readonly' => $web_domain_edit_readonly,
'fields' => array (
//#################################
// Begin Datatable fields
//#################################
'server_id' => array (
'datatype' => 'INTEGER',
'formtype' => 'SELECT',
'default' => '',
'datasource' => array ( 'type' => 'SQL',
'querystring' => 'SELECT server_id,server_name FROM server WHERE mirror_server_id = 0 AND web_server = 1 AND {AUTHSQL} ORDER BY server_name',
'keyfield'=> 'server_id',
'valuefield'=> 'server_name'
),
'value' => ''
),
'ip_address' => array (
'datatype' => 'VARCHAR',
'formtype' => 'SELECT',
'default' => '',
/*'datasource' => array ( 'type' => 'SQL',
'querystring' => "SELECT ip_address,ip_address FROM server_ip WHERE ip_type = 'IPv4' AND {AUTHSQL} ORDER BY ip_address",
'keyfield'=> 'ip_address',
'valuefield'=> 'ip_address'
'datatype' => 'VARCHAR',
'formtype' => 'SELECT',
'default' => '',
/*'datasource' => array ( 'type' => 'SQL',
'querystring' => "SELECT ip_address,ip_address FROM server_ip WHERE ip_type = 'IPv6' AND {AUTHSQL} ORDER BY ip_address",
'keyfield'=> 'ip_address',
'valuefield'=> 'ip_address'
),*/
),
'domain' => array (
'datatype' => 'VARCHAR',
'formtype' => 'TEXT',
'filters' => array( 0 => array( 'event' => 'SAVE',
'type' => 'IDNTOASCII'),
1 => array( 'event' => 'SHOW',
'type' => 'IDNTOUTF8'),
2 => array( 'event' => 'SAVE',
'type' => 'TOLOWER')
),
'validators' => array ( 0 => array ( 'type' => 'CUSTOM',
'class' => 'validate_domain',
'function' => $validator_function,
'errmsg'=> 'domain_error_regex'),
),
'default' => '',
'value' => '',
'width' => '30',
'maxlength' => '255',
),
'type' => array (
'datatype' => 'VARCHAR',
'formtype' => 'SELECT',
'default' => 'y',
'value' => array('vhost' => 'Site', 'alias' => 'Alias', 'vhostalias' => 'Alias', 'subdomain' => 'Subdomain', 'vhostsubdomain' => 'Subdomain')
),
'parent_domain_id' => array (
'datatype' => 'INTEGER',
'formtype' => 'SELECT',
'default' => '',
'value' => ''
),
'vhost_type' => array (
'datatype' => 'VARCHAR',
'formtype' => 'SELECT',
'default' => 'y',
'value' => array('name' => 'Namebased', 'ip' => 'IP-Based')
),
'hd_quota' => array (
'datatype' => 'INTEGER',
'formtype' => 'TEXT',
'default' => ($vhostdomain_type == 'domain' ? '-1' : '0'),
'value' => '',
'width' => '7',
'maxlength' => '7'
),
'traffic_quota' => array (
'datatype' => 'INTEGER',
'formtype' => 'TEXT',
'validators' => array ( 0 => array ( 'type' => 'NOTEMPTY',
'errmsg'=> 'traffic_quota_error_empty'),
1 => array ( 'type' => 'REGEX',
'regex' => '/^(\-1|[0-9]{1,10})$/',
'errmsg'=> 'traffic_quota_error_regex'),
Loading full blame...