From 1a485fd6abef7a969edbd43cd028e7d351bfdd8a Mon Sep 17 00:00:00 2001
From: Pascal Dreissen <pascal@dreissen.nl>
Date: Tue, 05 Jul 2016 11:09:43 -0400
Subject: [PATCH] Merge branch 'missing_fonts' into 'stable-3.1'

---
 interface/web/sites/form/web_vhost_domain.tform.php |  217 ++++++++++++++++++++++++++++++++++++++++-------------
 1 files changed, 163 insertions(+), 54 deletions(-)

diff --git a/interface/web/sites/form/web_vhost_domain.tform.php b/interface/web/sites/form/web_vhost_domain.tform.php
index b529181..1bbc148 100644
--- a/interface/web/sites/form/web_vhost_domain.tform.php
+++ b/interface/web/sites/form/web_vhost_domain.tform.php
@@ -41,16 +41,19 @@
 $vhostdomain_type = 'domain';
 $form_title = "Web Domain";
 $validator_function = 'web_domain';
+$first_tab_title = "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";
 	}
 }
 
@@ -82,19 +85,22 @@
 $wildcard_available = true;
 if($vhostdomain_type != 'domain') $wildcard_available = false;
 $ssl_available = true;
+$backup_available = ($vhostdomain_type == 'domain');
 if(!$app->auth->is_admin()) {
 	$client_group_id = $_SESSION["s"]["user"]["default_group"];
-	$client = $app->db->queryOneRecord("SELECT limit_wildcard, limit_ssl FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id");
+	$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');
 $web_config = $app->getconf->get_global_config('sites');
 
 $form["tabs"]['domain'] = array (
-	'title'  => "Domain",
+	'title'  => $first_tab_title,
 	'width'  => 100,
 	'template'  => "templates/web_vhost_domain_edit.htm",
 	'readonly' => $web_domain_edit_readonly,
@@ -234,12 +240,18 @@
 			'default' => 'n',
 			'value'  => array(0 => 'n', 1 => 'y')
 		),
+		'ssl_letsencrypt' => array (
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default' => 'n',
+			'value'  => array(0 => 'n', 1 => 'y')
+		),
 		'php' => array (
 			'datatype' => 'VARCHAR',
 			'formtype' => 'SELECT',
 			'default' => 'fast-cgi',
 			'valuelimit' => 'client:web_php_options',
-			'value'  => array('no' => 'disabled_txt', 'fast-cgi' => 'Fast-CGI', 'cgi' => 'CGI', 'mod' => 'Mod-PHP', 'suphp' => 'SuPHP', 'php-fpm' => 'PHP-FPM'),
+			'value'  => array('no' => 'disabled_txt', 'fast-cgi' => 'Fast-CGI', 'cgi' => 'CGI', 'mod' => 'Mod-PHP', 'suphp' => 'SuPHP', 'php-fpm' => 'PHP-FPM', 'hhvm' => 'HHVM'),
 			'searchable' => 2
 		),
 		'fastcgi_php_version' => array (
@@ -271,6 +283,15 @@
 			'default' => 'n',
 			'value'  => array(0 => 'n', 1 => 'y')
 		),
+		'enable_pagespeed' => array (
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default'  => 'n',
+			'value' => array (
+				0 => 'n',
+				1 => 'y'
+			)
+		),
 		'active' => array (
 			'datatype' => 'VARCHAR',
 			'formtype' => 'CHECKBOX',
@@ -280,7 +301,13 @@
 		//#################################
 		// ENDE Datatable fields
 		//#################################
-	)
+	),
+	'plugins' => array (
+		// needs serverId for web.server_type
+		'directive_snippets_id' => array (
+			'class' => 'plugin_directive_snippets'
+		),
+ 	)
 );
 
 // add type-specific field attributes
@@ -316,6 +343,18 @@
 			'errmsg'=> 'domain_error_autosub'
 		),
 	);
+	$form['tabs']['domain']['fields']['web_folder'] = array (
+		'datatype' => 'VARCHAR',
+		'validators' => array (  0 => array ( 'type' => 'REGEX',
+				'regex' => '@^((?!(.*\.\.)|(.*\./)|(.*//))[^/][\w/_\.\-]{1,100})?$@',
+				'errmsg'=> 'web_folder_error_regex'),
+		),
+		'formtype' => 'TEXT',
+		'default' => '',
+		'value'  => '',
+		'width'  => '30',
+		'maxlength' => '255'
+	);
 } else {
 	$form['tabs']['domain']['fields']['parent_domain_id']['datasource'] = array (
 		'type' => 'SQL',
@@ -326,7 +365,7 @@
 	$form['tabs']['domain']['fields']['web_folder'] = array (
 		'datatype' => 'VARCHAR',
 		'validators' => array (  0 => array ( 'type' => 'REGEX',
-				'regex' => '@^((?!.*\.\.)[\w/_\.\-]{1,100})$@',
+				'regex' => '@^((?!(.*\.\.)|(.*\./)|(.*//))[^/][\w/_\.\-]{1,100})?$@',
 				'errmsg'=> 'web_folder_error_regex'),
 		),
 		'formtype' => 'TEXT',
@@ -380,6 +419,15 @@
 			'width'  => '30',
 			'maxlength' => '255'
 		),
+		'rewrite_to_https' => array (
+			'datatype' => 'VARCHAR',
+			'formtype' => 'CHECKBOX',
+			'default'  => 'n',
+			'value' => array (
+				0 => 'n',
+				1 => 'y'
+			)
+		),
 		//#################################
 		// ENDE Datatable fields
 		//#################################
@@ -400,7 +448,7 @@
 				'datatype' => 'VARCHAR',
 				'formtype' => 'TEXT',
 				'validators' => array (  0 => array ( 'type' => 'REGEX',
-						'regex' => '/^(([\.]{0})|([-a-zA-Z0-9._,&äöüÄÖÜ ]{1,255}))$/',
+						'regex' => '/^(([\.]{0})|([-a-zA-Z0-9._,&äöüÄÖÜ ]{0,255}))$/',
 						'errmsg'=> 'ssl_state_error_regex'),
 				),
 				'default' => '',
@@ -412,7 +460,7 @@
 				'datatype' => 'VARCHAR',
 				'formtype' => 'TEXT',
 				'validators' => array (  0 => array ( 'type' => 'REGEX',
-						'regex' => '/^(([\.]{0})|([-a-zA-Z0-9._,&äöüÄÖÜ ]{1,255}))$/',
+						'regex' => '/^(([\.]{0})|([-a-zA-Z0-9._,&äöüÄÖÜ ]{0,255}))$/',
 						'errmsg'=> 'ssl_locality_error_regex'),
 				),
 				'default' => '',
@@ -424,7 +472,7 @@
 				'datatype' => 'VARCHAR',
 				'formtype' => 'TEXT',
 				'validators' => array (  0 => array ( 'type' => 'REGEX',
-						'regex' => '/^(([\.]{0})|([-a-zA-Z0-9._,&äöüÄÖÜ ]{1,255}))$/',
+						'regex' => '/^(([\.]{0})|([-a-zA-Z0-9._,&äöüÄÖÜ ]{0,255}))$/',
 						'errmsg'=> 'ssl_organisation_error_regex'),
 				),
 				'default' => '',
@@ -436,7 +484,7 @@
 				'datatype' => 'VARCHAR',
 				'formtype' => 'TEXT',
 				'validators' => array (  0 => array ( 'type' => 'REGEX',
-						'regex' => '/^(([\.]{0})|([-a-zA-Z0-9._,&äöüÄÖÜ ]{1,255}))$/',
+						'regex' => '/^(([\.]{0})|([-a-zA-Z0-9._,&äöüÄÖÜ ]{0,255}))$/',
 						'errmsg'=> 'ssl_organistaion_unit_error_regex'),
 				),
 				'default' => '',
@@ -515,6 +563,15 @@
 				'default' => '',
 				'value'  => array('' => 'none_txt', 'save' => 'save_certificate_txt', 'create' => 'create_certificate_txt', 'del' => 'delete_certificate_txt')
 			),
+			'enable_spdy' => array (
+				'datatype' => 'VARCHAR',
+				'formtype' => 'CHECKBOX',
+				'default'  => 'n',
+				'value' => array (
+					0 => 'n',
+					1 => 'y'
+				)
+			),
 			//#################################
 			// ENDE Datatable fields
 			//#################################
@@ -535,6 +592,14 @@
 		'stats_password' => array (
 			'datatype' => 'VARCHAR',
 			'formtype' => 'PASSWORD',
+			'validators' => array(
+				0 => array(
+					'type' => 'CUSTOM',
+					'class' => 'validate_password',
+					'function' => 'password_check',
+					'errmsg' => 'weak_password_txt'
+				)
+			),
 			'encryption' => 'CRYPT',
 			'default' => '',
 			'value'  => '',
@@ -545,7 +610,7 @@
 			'datatype' => 'VARCHAR',
 			'formtype' => 'SELECT',
 			'default' => 'webalizer',
-			'value'  => array('webalizer' => 'Webalizer', 'awstats' => 'AWStats')
+			'value'  => array('webalizer' => 'Webalizer', 'awstats' => 'AWStats', '' => 'None')
 		),
 		//#################################
 		// ENDE Datatable fields
@@ -553,56 +618,55 @@
 	)
 );
 
-// if($_SESSION["s"]["user"]["typ"] == 'admin') {
 
 //* Backup
-$form["tabs"]['backup'] = array (
-	'title'  => "Backup",
-	'width'  => 100,
-	'template'  => "templates/web_vhost_domain_backup.htm",
-	'readonly' => false,
-	'fields'  => array (
-		//#################################
-		// Begin Datatable fields
-		//#################################
-		'backup_interval' => array (
-			'datatype' => 'VARCHAR',
-			'formtype' => 'SELECT',
-			'default' => '',
-			'value'  => array('none' => 'no_backup_txt', 'daily' => 'daily_backup_txt', 'weekly' => 'weekly_backup_txt', 'monthly' => 'monthly_backup_txt')
-		),
-		'backup_copies' => array (
-			'datatype' => 'INTEGER',
-			'formtype' => 'SELECT',
-			'default' => '',
-			'value'  => array('1' => '1', '2' => '2', '3' => '3', '4' => '4', '5' => '5', '6' => '6', '7' => '7', '8' => '8', '9' => '9', '10' => '10')
-		),
-		'backup_excludes' => array (
-			'datatype' => 'VARCHAR',
-			'validators' => array (  0 => array ( 'type' => 'REGEX',
-					'regex' => '@^(?!.*\.\.)[-a-zA-Z0-9_/.~,*]*$@',
-					'errmsg'=> 'backup_excludes_error_regex'),
+if ($backup_available) {
+	$form["tabs"]['backup'] = array (
+		'title'  => "Backup",
+		'width'  => 100,
+		'template'  => "templates/web_vhost_domain_backup.htm",
+		'readonly' => false,
+		'fields'  => array (
+			//#################################
+			// Begin Datatable fields
+			//#################################
+			'backup_interval' => array (
+				'datatype' => 'VARCHAR',
+				'formtype' => 'SELECT',
+				'default' => '',
+				'value'  => array('none' => 'no_backup_txt', 'daily' => 'daily_backup_txt', 'weekly' => 'weekly_backup_txt', 'monthly' => 'monthly_backup_txt')
 			),
-			'formtype' => 'TEXT',
-			'default' => '',
-			'value'  => '',
-			'width'  => '30',
-			'maxlength' => '255'
+			'backup_copies' => array (
+				'datatype' => 'INTEGER',
+				'formtype' => 'SELECT',
+				'default' => '',
+				'value'  => array('1' => '1', '2' => '2', '3' => '3', '4' => '4', '5' => '5', '6' => '6', '7' => '7', '8' => '8', '9' => '9', '10' => '10')
+			),
+			'backup_excludes' => array (
+				'datatype' => 'VARCHAR',
+				'validators' => array (  0 => array ( 'type' => 'REGEX',
+						'regex' => '@^(?!.*\.\.)[-a-zA-Z0-9_/.~,*]*$@',
+						'errmsg'=> 'backup_excludes_error_regex'),
+				),
+				'formtype' => 'TEXT',
+				'default' => '',
+				'value'  => '',
+				'width'  => '30',
+				'maxlength' => '255'
+			),
+			//#################################
+			// ENDE Datatable fields
+			//#################################
 		),
-		//#################################
-		// ENDE Datatable fields
-		//#################################
-	),
-	'plugins' => array (
-		'backup_records' => array (
-			'class'   => 'plugin_backuplist',
-			'options' => array(
+		'plugins' => array (
+			'backup_records' => array (
+				'class'   => 'plugin_backuplist',
+				'options' => array(
+				)
 			)
 		)
-	)
-);
-
-// }
+	);
+}
 
 if($_SESSION["s"]["user"]["typ"] == 'admin'
 	|| ($web_config['reseller_can_use_options'] == 'y' && $app->auth->has_clients($_SESSION['s']['user']['userid']))) {
@@ -632,6 +696,13 @@
 				'formtype' => 'TEXT',
 				'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
 						'errmsg'=> 'sysuser_error_empty'),
+						1 => array(
+							'type' => 'CUSTOM',
+							'class' => 'validate_systemuser',
+							'function' => 'check_sysuser',
+							'check_names' => true,
+							'errmsg' => 'invalid_system_user_or_group_txt'
+						),
 				),
 				'default' => '',
 				'value'  => '',
@@ -643,6 +714,13 @@
 				'formtype' => 'TEXT',
 				'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
 						'errmsg'=> 'sysgroup_error_empty'),
+						1 => array(
+							'type' => 'CUSTOM',
+							'class' => 'validate_systemuser',
+							'function' => 'check_sysgroup',
+							'check_names' => true,
+							'errmsg' => 'invalid_system_user_or_group_txt'
+						),
 				),
 				'default' => '',
 				'value'  => '',
@@ -766,6 +844,13 @@
 			'apache_directives' => array (
 				'datatype' => 'TEXT',
 				'formtype' => 'TEXT',
+				'validators' => array (  0 => array(
+							'type' => 'CUSTOM',
+							'class' => 'validate_domain',
+							'function' => 'web_apache_directives',
+							'errmsg' => 'apache_directive_blockd_error'
+						),
+				),
 				'default' => '',
 				'value'  => '',
 				'width'  => '30',
@@ -809,6 +894,30 @@
 				'rows'  => '',
 				'cols'  => ''
 			),
+			'http_port' => array (
+				'datatype' => 'INTEGER',
+				'formtype' => 'TEXT',
+				'validators' => array (  0 => array ( 'type' => 'REGEX',
+						'regex' => '/^([0-9]{1,5})$/',
+						'errmsg'=> 'http_port_error_regex'),
+				),
+				'default' => '0',
+				'value'  => '',
+				'width'  => '3',
+				'maxlength' => '6'
+			),
+			'https_port' => array (
+				'datatype' => 'INTEGER',
+				'formtype' => 'TEXT',
+				'validators' => array (  0 => array ( 'type' => 'REGEX',
+						'regex' => '/^([0-9]{1,5})$/',
+						'errmsg'=> 'https_port_error_regex'),
+				),
+				'default' => '0',
+				'value'  => '',
+				'width'  => '3',
+				'maxlength' => '6'
+			)
 			//#################################
 			// ENDE Datatable fields
 			//#################################

--
Gitblit v1.9.1